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