From 9af3b480980742e04a220fb2dd37ee8b55df62c4 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Fri, 8 Mar 2013 01:22:57 +0000 Subject: Drop more Gtk::Table usage (bzr r12180) --- src/display/canvas-axonomgrid.cpp | 54 +++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 5 deletions(-) (limited to 'src/display/canvas-axonomgrid.cpp') diff --git a/src/display/canvas-axonomgrid.cpp b/src/display/canvas-axonomgrid.cpp index bfc6f27c4..170684328 100644 --- a/src/display/canvas-axonomgrid.cpp +++ b/src/display/canvas-axonomgrid.cpp @@ -12,11 +12,20 @@ * smaller than 90 degrees (measured from horizontal, 0 degrees being a line extending * to the right). The x-axis will always have an angle between 0 and 90 degrees. */ - + +#if HAVE_CONFIG_H +# include "config.h" +#endif #include #include -#include + +#if WITH_GTKMM_3_0 +# include +#else +# include +#endif + #include #include "display/canvas-axonomgrid.h" @@ -83,28 +92,60 @@ namespace Inkscape { #define SPACE_SIZE_X 15 #define SPACE_SIZE_Y 10 static inline void +#if WITH_GTKMM_3_0 +attach_all(Gtk::Grid &table, Gtk::Widget const *const arr[], unsigned size, int start = 0) +#else attach_all(Gtk::Table &table, Gtk::Widget const *const arr[], unsigned size, int start = 0) +#endif { for (unsigned i=0, r=start; i(*arr[i])).set_hexpand(); + (const_cast(*arr[i])).set_valign(Gtk::ALIGN_CENTER); + table.attach(const_cast(*arr[i]), 1, r, 1, 1); + + (const_cast(*arr[i+1])).set_hexpand(); + (const_cast(*arr[i+1])).set_valign(Gtk::ALIGN_CENTER); + table.attach(const_cast(*arr[i+1]), 2, r, 1, 1); +#else table.attach (const_cast(*arr[i]), 1, 2, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); table.attach (const_cast(*arr[i+1]), 2, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); +#endif } else { if (arr[i+1]) { +#if WITH_GTKMM_3_0 + (const_cast(*arr[i+1])).set_hexpand(); + (const_cast(*arr[i+1])).set_valign(Gtk::ALIGN_CENTER); + table.attach(const_cast(*arr[i+1]), 1, r, 2, 1); +#else table.attach (const_cast(*arr[i+1]), 1, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); +#endif } else if (arr[i]) { Gtk::Label& label = reinterpret_cast (const_cast(*arr[i])); label.set_alignment (0.0); +#if WITH_GTKMM_3_0 + label.set_hexpand(); + label.set_valign(Gtk::ALIGN_CENTER); + table.attach(label, 0, r, 3, 1); +#else table.attach (label, 0, 3, r, r+1, Gtk::FILL|Gtk::EXPAND, (Gtk::AttachOptions)0,0,0); +#endif } else { Gtk::HBox *space = manage (new Gtk::HBox); space->set_size_request (SPACE_SIZE_X, SPACE_SIZE_Y); +#if WITH_GTKMM_3_0 + space->set_halign(Gtk::ALIGN_CENTER); + space->set_valign(Gtk::ALIGN_CENTER); + table.attach(*space, 0, r, 1, 1); +#else table.attach (*space, 0, 1, r, r+1, (Gtk::AttachOptions)0, (Gtk::AttachOptions)0,0,0); +#endif } } ++r; @@ -306,14 +347,17 @@ CanvasAxonomGrid::onReprAttrChanged(Inkscape::XML::Node */*repr*/, gchar const * updateWidgets(); } - - - Gtk::Widget * CanvasAxonomGrid::newSpecificWidget() { +#if WITH_GTKMM_3_0 + Gtk::Grid *table = Gtk::manage(new Gtk::Grid()); + table->set_row_spacing(2); + table->set_column_spacing(2); +#else Gtk::Table * table = Gtk::manage( new Gtk::Table(1,1) ); table->set_spacings(2); +#endif _wr.setUpdating (true); -- cgit v1.2.3