summaryrefslogtreecommitdiffstats
path: root/src/ui/widget/style-swatch.cpp
diff options
context:
space:
mode:
authorAlex Valavanis <valavanisalex@gmail.com>2013-03-12 12:20:04 +0000
committerAlex Valavanis <valavanisalex@gmail.com>2013-03-12 12:20:04 +0000
commitaade0f7b5d272eb8a95b5f5ea6f8978ce24b8a72 (patch)
tree4ccdbf9ccc5a0bce690d6f649dd3d1af3950579c /src/ui/widget/style-swatch.cpp
parentfix build warning (diff)
downloadinkscape-aade0f7b5d272eb8a95b5f5ea6f8978ce24b8a72.tar.gz
inkscape-aade0f7b5d272eb8a95b5f5ea6f8978ce24b8a72.zip
Further migration to Gtk::Grid
(bzr r12196)
Diffstat (limited to 'src/ui/widget/style-swatch.cpp')
-rw-r--r--src/ui/widget/style-swatch.cpp52
1 files changed, 35 insertions, 17 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);