Added the necessary buttons to the canvas window to enable the user to go
[synfig.git] / synfig-studio / trunk / src / gtkmm / framedial.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file framedial.cpp
3 **      \brief Template File
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **  Copyright (c) 2009 Gerco Ballintijn
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 /* === H E A D E R S ======================================================= */
25
26 #ifdef USING_PCH
27 #       include "pch.h"
28 #else
29 #ifdef HAVE_CONFIG_H
30 #       include <config.h>
31 #endif
32
33 #include "framedial.h"
34 #include <gtkmm/image.h>
35
36 #endif
37
38 /* === U S I N G =========================================================== */
39
40 using namespace std;
41 using namespace studio;
42
43 /* === M A C R O S ========================================================= */
44
45 /* === G L O B A L S ======================================================= */
46
47 /* === P R O C E D U R E S ================================================= */
48
49 /* === M E T H O D S ======================================================= */
50
51 FrameDial::FrameDial(): Gtk::Table(3, 1, false)
52 {
53         Gtk::IconSize iconsize = Gtk::IconSize::from_name("synfig-small_icon");
54
55         seek_begin = create_icon(iconsize, "synfig-seek_begin", _("Seek to Begin"));
56         seek_prev_frame = create_icon(iconsize, "synfig-seek_prev_frame", _("Previous Frame"));
57         seek_next_frame = create_icon(iconsize, "synfig-seek_next_frame", _("Next Frame"));
58         seek_end = create_icon(iconsize, "synfig-seek_end", _("Seek to End"));
59
60         attach(*seek_begin, 0, 1, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
61         attach(*seek_prev_frame, 1, 2, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
62         attach(*seek_next_frame, 2, 3, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
63         attach(*seek_end, 3, 4, 0, 1, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
64 }
65
66 Gtk::Button *
67 FrameDial::create_icon(Gtk::IconSize iconsize, const char * stockid,
68                 const char * tooltip)
69 {
70         Gtk::Button *button = manage(new class Gtk::Button());
71         Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID(stockid), iconsize));
72         button->add(*icon);
73         tooltips.set_tip(*button, tooltip);
74         icon->set_padding(0, 0);
75         icon->show();
76         button->set_relief(Gtk::RELIEF_NONE);
77         button->show();
78
79         return button;
80 }