]> git.lyx.org Git - lyx.git/blob - src/frontends/gnome/pixbutton.h
fix math fonts with LyX/Mac
[lyx.git] / src / frontends / gnome / pixbutton.h
1 // -*- C++ -*-
2 /**
3  * \file pixbutton.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author unknown
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef GNOME_PIXBUTTON
13 #define GNOME_PIXBUTTON
14
15 #include <gtk--/button.h>
16 #include <gtk--/box.h>
17 #include <gtk--/label.h>
18 #include <gnome--/pixmap.h>
19 #include <gnome--/stock.h>
20
21 /* Button class used in LyX Gnome frontend for buttons with pixmaps and
22    accelerators */
23
24 namespace Gnome
25 {
26 class PixButton: public Gtk::Button
27 {
28 public:
29         PixButton(string label, string pixname): Button()
30         {
31                 Gtk::Box * b = manage( new Gtk::HBox() );
32                 l = manage( new Gtk::Label(label) );
33                 Gnome::Pixmap * p = Gtk::wrap( GNOME_PIXMAP( gnome_stock_pixmap_widget(0, pixname.c_str()) ) );
34
35                 b->set_spacing(3);
36                 b->children().push_back(Gtk::Box_Helpers::Element(*p, false, false));
37                 b->children().push_back(Gtk::Box_Helpers::Element(*l, false, false));
38
39                 add(*b);
40
41                 accelkey_ = l->parse_uline(label);
42
43                 l->show();
44                 p->show();
45                 b->show();
46         }
47
48         guint get_accelkey() { return accelkey_; }
49
50         void set_text(string const & newlabel) { l->set_text(newlabel); }
51
52 protected:
53         guint accelkey_;
54         Gtk::Label * l;
55 };
56 }
57
58 #endif