4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
15 #include <boost/scoped_array.hpp>
18 class GXpmBtnTbl : public Gtk::Table
21 typedef char const ** XpmData;
22 typedef SigC::Signal2<void, int, int> SigType;
25 unsigned char const* data_;
30 class GXpmBtn : public Gtk::Button
33 GXpmBtn() : row_(-1), col_(-1)
35 signal_clicked().connect(
37 &GXpmBtn::onButtonClicked));
39 void setRow(int row) { row_ = row; }
40 void setCol(int col) { col_ = col; }
41 int getRow() { return row_; }
42 int getCol() { return col_; }
43 void setXpm(XpmData xpm);
44 void setXpm(Glib::RefPtr<Gdk::Pixmap> pixmap,
45 Glib::RefPtr<Gdk::Bitmap> mask);
46 Glib::RefPtr<Gdk::Pixmap> getPixmap() { return pixmap_; }
47 Glib::RefPtr<Gdk::Bitmap> getMask() { return mask_; }
48 SigType signalClicked() { return signalClicked_; }
49 void onButtonClicked()
50 { signalClicked_.emit(row_, col_); }
54 Glib::RefPtr<Gdk::Pixmap> pixmap_;
55 Glib::RefPtr<Gdk::Bitmap> mask_;
56 SigType signalClicked_;
58 GXpmBtnTbl(int rows, int cols, XpmData xpms[]);
59 //GXpmBtnTbl(int rows, int cols, XpmData xpm);
60 GXpmBtnTbl(int rows, int cols, const XbmData& xbm);
62 GXpmBtn* getBtn(int row, int col)
63 { return &btns_[index(row, col)]; }
64 SigType signalClicked() { return signalClicked_; }
66 int index(int row, int col) { return row * cols_ + col; }
69 void setBtnXpm(XpmData xpms[]);
70 void setBtnXpm(const XbmData& xbm);
74 boost::scoped_array<GXpmBtn> btns_;
76 SigType signalClicked_;
80 void buttonSetXpm(Gtk::Button * btn, char const **xpm);