Fix bugs in previous commit that caused FTBFS in synfig and ETL FTBFS with older...
[synfig.git] / synfig-studio / tags / stable / src / gtkmm / zoomdial.h
1 /* === S Y N F I G ========================================================= */
2 /*!     \file zoomdial.h
3 **      \brief Template Header
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **  Copyright (c) 2008 Chris Moore
10 **
11 **      This package is free software; you can redistribute it and/or
12 **      modify it under the terms of the GNU General Public License as
13 **      published by the Free Software Foundation; either version 2 of
14 **      the License, or (at your option) any later version.
15 **
16 **      This package is distributed in the hope that it will be useful,
17 **      but WITHOUT ANY WARRANTY; without even the implied warranty of
18 **      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 **      General Public License for more details.
20 **      \endlegal
21 */
22 /* ========================================================================= */
23
24 /* === S T A R T =========================================================== */
25
26 #ifndef __SYNFIG_STUDIO_ZOOMDIAL_H
27 #define __SYNFIG_STUDIO_ZOOMDIAL_H
28
29 /* === H E A D E R S ======================================================= */
30
31 #include <gtkmm/tooltips.h>
32 #include <gtkmm/button.h>
33
34 #include "general.h"
35
36 /* === M A C R O S ========================================================= */
37
38 #define SMALL_BUTTON(button,stockid,tooltip)    \
39         button = manage(new class Gtk::Button());       \
40         icon=manage(new Gtk::Image(Gtk::StockID(stockid),iconsize));    \
41         button->add(*icon);     \
42         tooltips.set_tip(*button,tooltip);      \
43         icon->set_padding(0,0);\
44         icon->show();   \
45         button->set_relief(Gtk::RELIEF_NONE); \
46         button->show()
47
48 /* === T Y P E D E F S ===================================================== */
49
50 /* === C L A S S E S & S T R U C T S ======================================= */
51
52 namespace studio
53 {
54
55 class ZoomDial : public Gtk::Table
56 {
57
58         Gtk::Tooltips tooltips;
59         Gtk::IconSize iconsize;
60
61
62 public:
63         Gtk::Button *zoom_in;
64         Gtk::Button *zoom_out;
65         Gtk::Button *zoom_fit;
66         Gtk::Button *zoom_norm;
67
68         ZoomDial(Gtk::IconSize &size):Table(3, 1, false),iconsize(size)
69         {
70                 Gtk::Image *icon;
71
72                 SMALL_BUTTON(zoom_in,"gtk-add",_("Zoom In"));
73                 SMALL_BUTTON(zoom_out,"gtk-remove",_("Zoom Out"));
74                 SMALL_BUTTON(zoom_fit,"gtk-zoom-fit",_("Zoom to Fit"));
75                 SMALL_BUTTON(zoom_norm,"gtk-zoom-100",_("Zoom to 100%"));
76
77                 attach(*zoom_out, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
78                 attach(*zoom_norm, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
79                 attach(*zoom_fit, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
80                 attach(*zoom_in, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
81         }
82
83         Glib::SignalProxy0<void> signal_zoom_in()
84         { return zoom_in->signal_clicked(); }
85         Glib::SignalProxy0<void> signal_zoom_out()
86         { return zoom_out->signal_clicked(); }
87         Glib::SignalProxy0<void> signal_zoom_fit()
88         { return zoom_fit->signal_clicked(); }
89         Glib::SignalProxy0<void> signal_zoom_norm()
90         { return zoom_norm->signal_clicked(); }
91
92 }; // END of class ZoomDial
93
94 }; // END of namespace studio
95
96 /* === E N D =============================================================== */
97
98 #endif