diff options
| author | Alex Valavanis <valavanisalex@gmail.com> | 2013-03-12 12:20:04 +0000 |
|---|---|---|
| committer | Alex Valavanis <valavanisalex@gmail.com> | 2013-03-12 12:20:04 +0000 |
| commit | aade0f7b5d272eb8a95b5f5ea6f8978ce24b8a72 (patch) | |
| tree | 4ccdbf9ccc5a0bce690d6f649dd3d1af3950579c /src/ui/widget | |
| parent | fix build warning (diff) | |
| download | inkscape-aade0f7b5d272eb8a95b5f5ea6f8978ce24b8a72.tar.gz inkscape-aade0f7b5d272eb8a95b5f5ea6f8978ce24b8a72.zip | |
Further migration to Gtk::Grid
(bzr r12196)
Diffstat (limited to 'src/ui/widget')
| -rw-r--r-- | src/ui/widget/style-swatch.cpp | 52 | ||||
| -rw-r--r-- | src/ui/widget/style-swatch.h | 21 |
2 files changed, 54 insertions, 19 deletions
diff --git a/src/ui/widget/style-swatch.cpp b/src/ui/widget/style-swatch.cpp index 44bceb826..a89f42575 100644 --- a/src/ui/widget/style-swatch.cpp +++ b/src/ui/widget/style-swatch.cpp @@ -11,15 +11,11 @@ * Released under GNU GPL. Read the file 'COPYING' for more information. */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif +#include "style-swatch.h" #include <cstring> #include <string> -#include "style-swatch.h" - #include "widgets/spw-utilities.h" #include "ui/widget/color-preview.h" @@ -37,6 +33,12 @@ #include "verbs.h" #include <glibmm/i18n.h> +#if WITH_GTKMM_3_0 +# include <gtkmm/grid.h> +#else +# include <gtkmm/table.h> +#endif + enum { SS_FILL, SS_STROKE @@ -114,7 +116,11 @@ StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) _css(NULL), _tool_obs(NULL), _style_obs(NULL), - _table(2, 6), +#if WITH_GTKMM_3_0 + _table(Gtk::manage(new Gtk::Grid())), +#else + _table(Gtk::manage(new Gtk::Table(2, 6))), +#endif _sw_unit(NULL) { _label[SS_FILL].set_markup(_("Fill:")); @@ -130,23 +136,35 @@ StyleSwatch::StyleSwatch(SPCSSAttr *css, gchar const *main_tip) _opacity_value.set_alignment(0.0, 0.5); _opacity_value.set_padding(0, 0); - _table.set_col_spacings (2); - _table.set_row_spacings (0); +#if WITH_GTKMM_3_0 + _table->set_column_spacing(2); + _table->set_row_spacing(0); +#else + _table->set_col_spacings(2); + _table->set_row_spacings(0); +#endif _stroke.pack_start(_place[SS_STROKE]); _stroke_width_place.add(_stroke_width); _stroke.pack_start(_stroke_width_place, Gtk::PACK_SHRINK); - - _table.attach(_label[SS_FILL], 0,1, 0,1, Gtk::FILL, Gtk::SHRINK); - _table.attach(_label[SS_STROKE], 0,1, 1,2, Gtk::FILL, Gtk::SHRINK); - - _table.attach(_place[SS_FILL], 1,2, 0,1); - _table.attach(_stroke, 1,2, 1,2); - + _opacity_place.add(_opacity_value); - _table.attach(_opacity_place, 2,3, 0,2, Gtk::SHRINK, Gtk::SHRINK); - _swatch.add(_table); +#if WITH_GTKMM_3_0 + _table->attach(_label[SS_FILL], 0, 0, 1, 1); + _table->attach(_label[SS_STROKE], 0, 1, 1, 1); + _table->attach(_place[SS_FILL], 1, 0, 1, 1); + _table->attach(_stroke, 1, 1, 1, 1); + _table->attach(_opacity_place, 2, 0, 1, 2); +#else + _table->attach(_label[SS_FILL], 0,1, 0,1, Gtk::FILL, Gtk::SHRINK); + _table->attach(_label[SS_STROKE], 0,1, 1,2, Gtk::FILL, Gtk::SHRINK); + _table->attach(_place[SS_FILL], 1,2, 0,1); + _table->attach(_stroke, 1,2, 1,2); + _table->attach(_opacity_place, 2,3, 0,2, Gtk::SHRINK, Gtk::SHRINK); +#endif + + _swatch.add(*_table); pack_start(_swatch, true, true, 0); set_size_request (STYLE_SWATCH_WIDTH, -1); diff --git a/src/ui/widget/style-swatch.h b/src/ui/widget/style-swatch.h index 999bbd4ca..7e385e3df 100644 --- a/src/ui/widget/style-swatch.h +++ b/src/ui/widget/style-swatch.h @@ -13,8 +13,11 @@ #ifndef INKSCAPE_UI_CURRENT_STYLE_H #define INKSCAPE_UI_CURRENT_STYLE_H +#if HAVE_CONFIG_H +# include "config.h" +#endif + #include <gtkmm/box.h> -#include <gtkmm/table.h> #include <gtkmm/label.h> #include <gtkmm/eventbox.h> #include <gtkmm/enums.h> @@ -27,6 +30,14 @@ class SPUnit; class SPStyle; class SPCSSAttr; +namespace Gtk { +#if WITH_GTKMM_3_0 +class Grid; +#else +class Table; +#endif +} + namespace Inkscape { namespace UI { namespace Widget { @@ -60,7 +71,13 @@ private: Glib::ustring _tool_path; Gtk::EventBox _swatch; - Gtk::Table _table; + +#if WITH_GTKMM_3_0 + Gtk::Grid *_table; +#else + Gtk::Table *_table; +#endif + Gtk::Label _label[2]; Gtk::EventBox _place[2]; Gtk::EventBox _opacity_place; |
