Lumiera  0.pre.03
»edit your freedom«
mini-button.hpp
Go to the documentation of this file.
1 /*
2  MINI-BUTTON.hpp - a tool button-like widget
3 
4  Copyright (C) Lumiera.org
5  2009, Joel Holdsworth <joel@airwebreathe.org.uk>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
23 
32 #ifndef STAGE_WIDGET_MINI_BUTTON_H
33 #define STAGE_WIDGET_MINI_BUTTON_H
34 
35 #include "stage/gtk-base.hpp"
36 
37 
38 namespace stage {
39 namespace widget {
40 
44  template<class T>
46  : public T
47  {
49  Gtk::Image image_;
50 
51  public:
58  MiniWrapper (Gtk::StockID const& stock_id
59  ,const Gtk::IconSize icon_size = Gtk::ICON_SIZE_LARGE_TOOLBAR)
60  : image_(stock_id, icon_size)
61  {
62  T::add (image_);
63  T::set_relief (Gtk::RELIEF_NONE);
64  T::set_focus_on_click (false);
65  }
66 
67 
73  void
74  setStockID (Gtk::StockID const& stock_id
75  ,const Gtk::IconSize icon_size = Gtk::ICON_SIZE_LARGE_TOOLBAR)
76  {
77  image_.set (stock_id, icon_size);
78  }
79  };
80 
81 
82 
85 
88 
89 
90 
91 }}// stage::widget
92 #endif /*STAGE_WIDGET_MINI_BUTTON_H*/
A wrapper for ToolButton-like Button widgets.
Definition: mini-button.hpp:45
void setStockID(Gtk::StockID const &stock_id, const Gtk::IconSize icon_size=Gtk::ICON_SIZE_LARGE_TOOLBAR)
Sets a new image from a stock-id for this button.
Definition: mini-button.hpp:74
Gtk::Image image_
image widget for the button.
Definition: mini-button.hpp:49
Lumiera GTK UI implementation root.
Definition: guifacade.cpp:46
MiniWrapper(Gtk::StockID const &stock_id, const Gtk::IconSize icon_size=Gtk::ICON_SIZE_LARGE_TOOLBAR)
Creates a new Button containing the image and text from a stock item.
Definition: mini-button.hpp:58
A set of basic GTK includes for the UI.