2000-09-25 11:10:15 +00:00
|
|
|
// -*- C++ -*-
|
2002-09-25 14:26:13 +00:00
|
|
|
/**
|
|
|
|
* \file pixbutton.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 21:21:28 +00:00
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
* \author unknown
|
2002-03-21 21:21:28 +00:00
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
* Full author contact details are available in file CREDITS
|
|
|
|
*/
|
2000-09-25 11:10:15 +00:00
|
|
|
|
|
|
|
#ifndef GNOME_PIXBUTTON
|
|
|
|
#define GNOME_PIXBUTTON
|
|
|
|
|
|
|
|
#include <gtk--/button.h>
|
|
|
|
#include <gtk--/box.h>
|
|
|
|
#include <gtk--/label.h>
|
|
|
|
#include <gnome--/pixmap.h>
|
|
|
|
#include <gnome--/stock.h>
|
|
|
|
|
|
|
|
/* Button class used in LyX Gnome frontend for buttons with pixmaps and
|
|
|
|
accelerators */
|
|
|
|
|
|
|
|
namespace Gnome
|
|
|
|
{
|
|
|
|
class PixButton: public Gtk::Button
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PixButton(string label, string pixname): Button()
|
|
|
|
{
|
|
|
|
Gtk::Box * b = manage( new Gtk::HBox() );
|
2000-10-12 15:17:42 +00:00
|
|
|
l = manage( new Gtk::Label(label) );
|
2000-10-30 11:33:05 +00:00
|
|
|
Gnome::Pixmap * p = Gtk::wrap( GNOME_PIXMAP( gnome_stock_pixmap_widget(0, pixname.c_str()) ) );
|
2000-09-25 11:10:15 +00:00
|
|
|
|
|
|
|
b->set_spacing(3);
|
|
|
|
b->children().push_back(Gtk::Box_Helpers::Element(*p, false, false));
|
|
|
|
b->children().push_back(Gtk::Box_Helpers::Element(*l, false, false));
|
|
|
|
|
|
|
|
add(*b);
|
|
|
|
|
|
|
|
accelkey_ = l->parse_uline(label);
|
2002-03-21 21:21:28 +00:00
|
|
|
|
2000-09-25 11:10:15 +00:00
|
|
|
l->show();
|
|
|
|
p->show();
|
|
|
|
b->show();
|
|
|
|
}
|
|
|
|
|
|
|
|
guint get_accelkey() { return accelkey_; }
|
|
|
|
|
2000-10-12 15:17:42 +00:00
|
|
|
void set_text(string const & newlabel) { l->set_text(newlabel); }
|
|
|
|
|
2000-09-25 11:10:15 +00:00
|
|
|
protected:
|
|
|
|
guint accelkey_;
|
2000-10-12 15:17:42 +00:00
|
|
|
Gtk::Label * l;
|
2000-09-25 11:10:15 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|