summaryrefslogtreecommitdiffstats
path: root/src/ui/widget
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2012-06-09 15:43:34 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2012-06-09 15:43:34 +0000
commit3c3a754c162492932c8037100155a0cd7281e437 (patch)
treee904cc141533d600e6beafd3bd4b87775daf638e /src/ui/widget
parentFix build failure with old GtkAdjustment API (diff)
downloadinkscape-3c3a754c162492932c8037100155a0cd7281e437.tar.gz
inkscape-3c3a754c162492932c8037100155a0cd7281e437.zip
Fix remaining size_request issues for Gtk+ build
(bzr r11475)
Diffstat (limited to 'src/ui/widget')
-rw-r--r--src/ui/widget/imagetoggler.cpp46
-rw-r--r--src/ui/widget/imagetoggler.h16
2 files changed, 51 insertions, 11 deletions
diff --git a/src/ui/widget/imagetoggler.cpp b/src/ui/widget/imagetoggler.cpp
index 73c343887..29907f4c9 100644
--- a/src/ui/widget/imagetoggler.cpp
+++ b/src/ui/widget/imagetoggler.cpp
@@ -53,13 +53,44 @@ ImageToggler::ImageToggler( char const* on, char const* off) :
property_pixbuf() = _property_pixbuf_off.get_value();
}
-void
-ImageToggler::get_size_vfunc( Gtk::Widget& widget,
- const Gdk::Rectangle* cell_area,
- int* x_offset,
- int* y_offset,
- int* width,
- int* height ) const
+
+#if WITH_GTKMM_3_0
+void ImageToggler::get_preferred_height_vfunc(Gtk::Widget& widget,
+ int& min_h,
+ int& nat_h) const
+{
+ Gtk::CellRendererPixbuf::get_preferred_height_vfunc(widget, min_h, nat_h);
+
+ if (min_h) {
+ min_h += (min_h) >> 1;
+ }
+
+ if (nat_h) {
+ nat_h += (nat_h) >> 1;
+ }
+}
+
+void ImageToggler::get_preferred_width_vfunc(Gtk::Widget& widget,
+ int& min_w,
+ int& nat_w) const
+{
+ Gtk::CellRendererPixbuf::get_preferred_width_vfunc(widget, min_w, nat_w);
+
+ if (min_w) {
+ min_w += (min_w) >> 1;
+ }
+
+ if (nat_w) {
+ nat_w += (nat_w) >> 1;
+ }
+}
+#else
+void ImageToggler::get_size_vfunc(Gtk::Widget& widget,
+ const Gdk::Rectangle* cell_area,
+ int* x_offset,
+ int* y_offset,
+ int* width,
+ int* height ) const
{
Gtk::CellRendererPixbuf::get_size_vfunc( widget, cell_area, x_offset, y_offset, width, height );
@@ -70,6 +101,7 @@ ImageToggler::get_size_vfunc( Gtk::Widget& widget,
*height += (*height) >> 1;
}
}
+#endif
#if WITH_GTKMM_3_0
void ImageToggler::render_vfunc( const Cairo::RefPtr<Cairo::Context>& cr,
diff --git a/src/ui/widget/imagetoggler.h b/src/ui/widget/imagetoggler.h
index 0a20fe7ed..ca1bfd69d 100644
--- a/src/ui/widget/imagetoggler.h
+++ b/src/ui/widget/imagetoggler.h
@@ -37,16 +37,20 @@ public:
protected:
- virtual void get_size_vfunc( Gtk::Widget &widget,
- Gdk::Rectangle const *cell_area,
- int *x_offset, int *y_offset, int *width, int *height ) const;
-
#if WITH_GTKMM_3_0
virtual void render_vfunc( const Cairo::RefPtr<Cairo::Context>& cr,
Gtk::Widget& widget,
const Gdk::Rectangle& background_area,
const Gdk::Rectangle& cell_area,
Gtk::CellRendererState flags );
+
+ virtual void get_preferred_width_vfunc(Gtk::Widget& widget,
+ int& min_w,
+ int& nat_w) const;
+
+ virtual void get_preferred_height_vfunc(Gtk::Widget& widget,
+ int& min_h,
+ int& nat_h) const;
#else
virtual void render_vfunc( const Glib::RefPtr<Gdk::Drawable>& window,
Gtk::Widget& widget,
@@ -54,6 +58,10 @@ protected:
const Gdk::Rectangle& cell_area,
const Gdk::Rectangle& expose_area,
Gtk::CellRendererState flags );
+
+ virtual void get_size_vfunc( Gtk::Widget &widget,
+ Gdk::Rectangle const *cell_area,
+ int *x_offset, int *y_offset, int *width, int *height ) const;
#endif
virtual bool activate_vfunc(GdkEvent *event,