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::IconSize & size): Gtk::Table(1, 6, false)
55 ducks_position = create_label_button(size, "synfig-toggle_duck_position", _("Toggle position ducks"));
56 ducks_vertex = create_label_button(size, "synfig-toggle_duck_vertex", _("Toggle vertex ducks"));
57 ducks_tangent = create_label_button(size, "synfig-toggle_duck_tangent", _("Toggle tangent ducks"));
58 ducks_radius = create_label_button(size, "synfig-toggle_duck_radius", _("Toggle radius ducks"));
59 ducks_width = create_label_button(size, "synfig-toggle_duck_width", _("Toggle width ducks"));
60 ducks_angle = create_label_button(size, "synfig-toggle_duck_angle", _("Toggle angle ducks"));
62 attach(*ducks_position, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
63 attach(*ducks_vertex, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
64 attach(*ducks_tangent, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
65 attach(*ducks_radius, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
66 attach(*ducks_width, 4, 5, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
67 attach(*ducks_angle, 5, 6, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
71 ToggleDucksDial::create_label_button(Gtk::IconSize iconsize, const char *stockid,
74 Gtk::ToggleButton *tbutton = manage(new class Gtk::ToggleButton());
75 Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID(stockid), iconsize));
76 tooltips.set_tip(*tbutton, tooltip);
78 icon->set_padding(0, 0);
80 tbutton->set_relief(Gtk::RELIEF_NONE);
87 ToggleDucksDial::update_toggles(Duck::Type mask)
89 ducks_position-> set_active((mask & Duck::TYPE_POSITION));
90 ducks_vertex -> set_active((mask & Duck::TYPE_VERTEX));
91 ducks_tangent -> set_active((mask & Duck::TYPE_TANGENT));
92 ducks_radius -> set_active((mask & Duck::TYPE_RADIUS));
93 ducks_width -> set_active((mask & Duck::TYPE_WIDTH));
94 ducks_angle -> set_active((mask & Duck::TYPE_ANGLE));