1 /* === S Y N F I G ========================================================= */
2 /*! \file toggleducksdial.cpp
3 ** \brief Template File
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 ** Copyright (c) 2009 Gerco Ballintijn
10 ** Copyright (c) 2009 Carlos Lopez
12 ** This package is free software; you can redistribute it and/or
13 ** modify it under the terms of the GNU General Public License as
14 ** published by the Free Software Foundation; either version 2 of
15 ** the License, or (at your option) any later version.
17 ** This package is distributed in the hope that it will be useful,
18 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 ** General Public License for more details.
23 /* ========================================================================= */
25 /* === H E A D E R S ======================================================= */
34 #include "toggleducksdial.h"
35 #include <gtkmm/image.h>
36 #include <gtkmm/stock.h>
40 /* === U S I N G =========================================================== */
43 using namespace studio;
45 /* === M A C R O S ========================================================= */
47 /* === G L O B A L S ======================================================= */
49 /* === P R O C E D U R E S ================================================= */
51 /* === M E T H O D S ======================================================= */
53 ToggleDucksDial::ToggleDucksDial(): Gtk::Table(1, 6, false)
55 Gtk::IconSize iconsize = Gtk::IconSize::from_name("synfig-small_icon");
57 ducks_position = create_label_button(iconsize, "synfig-toggle_duck_position", _("Toggle position ducks"));
58 ducks_vertex = create_label_button(iconsize, "synfig-toggle_duck_vertex", _("Toggle vertex ducks"));
59 ducks_tangent = create_label_button(iconsize, "synfig-toggle_duck_tangent", _("Toggle tangent ducks"));
60 ducks_radius = create_label_button(iconsize, "synfig-toggle_duck_radius", _("Toggle radius ducks"));
61 ducks_width = create_label_button(iconsize, "synfig-toggle_duck_width", _("Toggle width ducks"));
62 ducks_angle = create_label_button(iconsize, "synfig-toggle_duck_angle", _("Toggle angle ducks"));
64 attach(*ducks_position, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
65 attach(*ducks_vertex, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
66 attach(*ducks_tangent, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
67 attach(*ducks_radius, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
68 attach(*ducks_width, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
69 attach(*ducks_angle, 5, 6, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
73 ToggleDucksDial::create_label_button(Gtk::IconSize iconsize, const char *stockid,
76 Gtk::ToggleButton *tbutton = manage(new class Gtk::ToggleButton());
77 Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID(stockid), iconsize));
78 tooltips.set_tip(*tbutton, tooltip);
80 icon->set_padding(0, 0);
82 tbutton->set_relief(Gtk::RELIEF_NONE);
89 ToggleDucksDial::update_toggles(Duck::Type mask)
91 ducks_position-> set_active((mask & Duck::TYPE_POSITION));
92 ducks_vertex -> set_active((mask & Duck::TYPE_VERTEX));
93 ducks_tangent -> set_active((mask & Duck::TYPE_TANGENT));
94 ducks_radius -> set_active((mask & Duck::TYPE_RADIUS));
95 ducks_width -> set_active((mask & Duck::TYPE_WIDTH));
96 ducks_angle -> set_active((mask & Duck::TYPE_ANGLE));