*/
#include <config.h>
-#include <gtkmm.h>
-#include <cassert>
+
+// Too hard to make concept checks work with this file
+#ifdef _GLIBCPP_CONCEPT_CHECKS
+#undef _GLIBCPP_CONCEPT_CHECKS
+#endif
+
#include "GXpmBtnTbl.h"
+#include <gtkmm.h>
+
+#include <boost/assert.hpp>
+
void GXpmBtnTbl::GXpmBtn::setXpm(XpmData xpm)
{
Glib::RefPtr<Gdk::Colormap> clrmap = get_colormap();
- Gtk::Image * image;
pixmap_ = Gdk::Pixmap::create_from_xpm(clrmap,
mask_,
xpm);
- image = SigC::manage(new Gtk::Image(pixmap_, mask_));
+ Gtk::Image * image = Gtk::manage(new Gtk::Image(pixmap_, mask_));
image->show();
add(*image);
}
{
pixmap_ = pixmap;
mask_ = mask;
- Gtk::Image * image;
- image = SigC::manage(new Gtk::Image(pixmap_, mask_));
+ Gtk::Image * image =
+ Gtk::manage(new Gtk::Image(pixmap_, mask_));
image->show();
add(*image);
}
}
-GXpmBtnTbl::GXpmBtnTbl(int rows, int cols, const XbmData& xbm) :
+GXpmBtnTbl::GXpmBtnTbl(int rows, int cols, XbmData const & xbm) :
Gtk::Table(rows, cols, true), rows_(rows), cols_(cols),
xbm_(&xbm)
{
void GXpmBtnTbl::construct()
{
- assert(rows_);
- assert(cols_);
+ BOOST_ASSERT(rows_);
+ BOOST_ASSERT(cols_);
btns_.reset(new GXpmBtn[rows_ * cols_]);
- assert(btns_.get());
+ BOOST_ASSERT(btns_.get());
- GXpmBtn * btn;
- int row, col;
- for (row = 0; row < rows_; ++row)
- for (col = 0; col < cols_; ++col) {
- btn = &btns_[index(row, col)];
+ for (int row = 0; row < rows_; ++row)
+ for (int col = 0; col < cols_; ++col) {
+ GXpmBtn * btn = &btns_[index(row, col)];
btn->setRow(row);
btn->setCol(col);
- btn->signalClicked().connect(signalClicked_.slot());
+ btn->signalClicked().connect(signalClicked_);
btn->show();
attach(*btn, col, col + 1, row, row + 1);
}
void GXpmBtnTbl::setBtnXpm(XpmData xpms[])
{
- int row, col;
- for (row = 0; row < rows_; ++row)
- for (col = 0; col < cols_; ++col)
+ for (int row = 0; row < rows_; ++row)
+ for (int col = 0; col < cols_; ++col)
btns_[index(row, col)].setXpm(xpms[index(row, col)]);
}
-void GXpmBtnTbl::setBtnXpm(const XbmData& xbm)
+void GXpmBtnTbl::setBtnXpm(XbmData const & xbm)
{
- Glib::RefPtr<Gdk::Bitmap> mask;
- Glib::RefPtr<Gdk::Pixmap> pixmap;
Glib::RefPtr<Gdk::Colormap> clrmap = get_colormap();
Gdk::Color fg(const_cast<GdkColor *>(&xbm.fg_));
clrmap->alloc_color(fg);
Glib::RefPtr<Gdk::Window> window = get_window();
- pixmap = Gdk::Pixmap::create_from_data(
+
+ Glib::RefPtr<Gdk::Pixmap> pixmap = Gdk::Pixmap::create_from_data(
window,
reinterpret_cast<char const * const>(xbm.data_),
xbm.width_,
window->get_depth(),
fg,
get_style()->get_bg(Gtk::STATE_NORMAL));
- mask = Gdk::Bitmap::create(
+
+ Glib::RefPtr<Gdk::Bitmap> mask = Gdk::Bitmap::create(
window,
reinterpret_cast<char const * const>(xbm.data_),
xbm.width_,
xbm.height_);
- Glib::RefPtr<Gdk::Bitmap> maskBtn;
- Glib::RefPtr<Gdk::Pixmap> pixmapBtn;
+
+
+
Glib::RefPtr<Gdk::GC> gc = Gdk::GC::create(mask);
- int row, col;
- int btnWidth = xbm.width_ / cols_;
- int btnHeight = xbm.height_ / rows_;
- for (row = 0; row < rows_; ++row)
- for (col = 0; col < cols_; ++col) {
- pixmapBtn = Gdk::Pixmap::create(
+ int const btnWidth = xbm.width_ / cols_;
+ int const btnHeight = xbm.height_ / rows_;
+ for (int row = 0; row < rows_; ++row)
+ for (int col = 0; col < cols_; ++col) {
+ Glib::RefPtr<Gdk::Pixmap> pixmapBtn =
+ Gdk::Pixmap::create(
window,
btnWidth,
btnHeight,
0,
btnWidth,
btnHeight);
- maskBtn = Gdk::Bitmap::create(
+ Glib::RefPtr<Gdk::Bitmap> maskBtn =
+ Gdk::Bitmap::create(
window,
reinterpret_cast<char const * const>(xbm.data_),
btnWidth,
}
-void buttonSetXpm(Gtk::Button * btn, char const **xpm)
+void buttonSetXpm(Gtk::Button * btn, char const ** xpm)
{
- Glib::RefPtr<Gdk::Bitmap> mask;
- Glib::RefPtr<Gdk::Pixmap> pixmap;
Glib::RefPtr<Gdk::Colormap> clrmap = btn->get_colormap();
- Gtk::Image * image;
- pixmap = Gdk::Pixmap::create_from_xpm(clrmap,
- mask,
- xpm);
- image = SigC::manage(new Gtk::Image(pixmap, mask));
+
+ Glib::RefPtr<Gdk::Bitmap> mask;
+ Glib::RefPtr<Gdk::Pixmap> pixmap =
+ Gdk::Pixmap::create_from_xpm(clrmap, mask, xpm);
+ Gtk::Image * image = Gtk::manage(new Gtk::Image(pixmap, mask));
image->show();
btn->add(*image);
}