Use GTK icons for Zoom Dial buttons
[synfig.git] / synfig-studio / trunk / src / gtkmm / zoomdial.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file zoomdial.cpp
3 **      \brief Template File
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 /* === H E A D E R S ======================================================= */
24
25 #ifdef USING_PCH
26 #       include "pch.h"
27 #else
28 #ifdef HAVE_CONFIG_H
29 #       include <config.h>
30 #endif
31
32 #include "zoomdial.h"
33 #include <gtkmm/image.h>
34
35 #include "general.h"
36
37 #endif
38
39 /* === U S I N G =========================================================== */
40
41 using namespace std;
42 using namespace studio;
43
44 /* === M A C R O S ========================================================= */
45
46 /* === G L O B A L S ======================================================= */
47
48 /* === P R O C E D U R E S ================================================= */
49
50 /* === M E T H O D S ======================================================= */
51
52 ZoomDial::ZoomDial(Gtk::IconSize & size): Table(3, 1, false)
53 {
54         zoom_in = create_icon(size, GTK_STOCK_ZOOM_IN, _("Zoom In"));
55         zoom_out = create_icon(size, GTK_STOCK_ZOOM_OUT, _("Zoom Out"));
56         zoom_fit = create_icon(size, GTK_STOCK_ZOOM_FIT, _("Zoom to Fit"));
57         zoom_norm = create_icon(size, GTK_STOCK_ZOOM_100, _("Zoom to 100%"));
58
59         attach(*zoom_out, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
60         attach(*zoom_norm, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
61         attach(*zoom_fit, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
62         attach(*zoom_in, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
63 }
64
65 Gtk::Button *
66 ZoomDial::create_icon(Gtk::IconSize size, const char * stockid,
67                 const char * tooltip)
68 {
69         Gtk::Button *button = manage(new class Gtk::Button());
70         Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID(stockid), size));
71         button->add(*icon);
72         tooltips.set_tip(*button, tooltip);
73         icon->set_padding(0, 0);
74         icon->show();
75         button->set_relief(Gtk::RELIEF_NONE);
76         button->show();
77
78         return button;
79 }
80
81