my log
[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: zoomdial.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
6 **
7 **      \legal
8 **      Copyright (c) 2002 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === S T A R T =========================================================== */
23
24 #ifndef __SYNFIG_STUDIO_ZOOMDIAL_H
25 #define __SYNFIG_STUDIO_ZOOMDIAL_H
26
27 /* === H E A D E R S ======================================================= */
28
29 #include <gtkmm/tooltips.h>
30 #include <gtkmm/button.h>
31
32 /* === M A C R O S ========================================================= */
33
34 #define SMALL_BUTTON(button,stockid,tooltip)    \
35         button = manage(new class Gtk::Button());       \
36         icon=manage(new Gtk::Image(Gtk::StockID(stockid),iconsize));    \
37         button->add(*icon);     \
38         tooltips.set_tip(*button,tooltip);      \
39         icon->set_padding(0,0);\
40         icon->show();   \
41         button->set_relief(Gtk::RELIEF_NONE); \
42         button->show()
43
44 /* === T Y P E D E F S ===================================================== */
45
46 /* === C L A S S E S & S T R U C T S ======================================= */
47
48 namespace studio
49 {
50
51 class ZoomDial : public Gtk::Table
52 {
53
54         Gtk::Tooltips tooltips;
55         Gtk::IconSize iconsize;
56
57         
58 public:
59         Gtk::Button *zoom_in;
60         Gtk::Button *zoom_out;
61         Gtk::Button *zoom_fit;
62         Gtk::Button *zoom_norm;
63
64         ZoomDial(Gtk::IconSize &size):Table(3, 1, false),iconsize(size)
65         {
66                 Gtk::Image *icon;
67
68                 SMALL_BUTTON(zoom_in,"gtk-add","Zoom In");
69                 SMALL_BUTTON(zoom_out,"gtk-remove","Zoom Out");
70                 SMALL_BUTTON(zoom_fit,"gtk-zoom-fit","Zoom Fit");
71                 SMALL_BUTTON(zoom_norm,"gtk-zoom-100","Zoom to 100%");
72
73                 attach(*zoom_out, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
74                 attach(*zoom_norm, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
75                 attach(*zoom_in, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
76         }
77
78         Glib::SignalProxy0<void> signal_zoom_in()
79         { return zoom_in->signal_clicked(); }
80         Glib::SignalProxy0<void> signal_zoom_out()
81         { return zoom_out->signal_clicked(); }
82         Glib::SignalProxy0<void> signal_zoom_fit()
83         { return zoom_fit->signal_clicked(); }
84         Glib::SignalProxy0<void> signal_zoom_norm()
85         { return zoom_norm->signal_clicked(); }
86
87 }; // END of class ZoomDial
88
89 }; // END of namespace studio
90
91 /* === E N D =============================================================== */
92
93 #endif