summaryrefslogtreecommitdiffstats
path: root/src/widgets
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/widgets
parentfix build warning (diff)
downloadinkscape-aade0f7b5d272eb8a95b5f5ea6f8978ce24b8a72.tar.gz
inkscape-aade0f7b5d272eb8a95b5f5ea6f8978ce24b8a72.zip
Further migration to Gtk::Grid
(bzr r12196)
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/sp-attribute-widget.cpp44
-rw-r--r--src/widgets/sp-attribute-widget.h19
2 files changed, 55 insertions, 8 deletions
diff --git a/src/widgets/sp-attribute-widget.cpp b/src/widgets/sp-attribute-widget.cpp
index a1702a864..1f0fcd94e 100644
--- a/src/widgets/sp-attribute-widget.cpp
+++ b/src/widgets/sp-attribute-widget.cpp
@@ -12,9 +12,18 @@
* Released under GNU GPL, read the file 'COPYING' for more information
*/
+#include "sp-attribute-widget.h"
+
#include <glibmm/i18n.h>
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
+
+#if WITH_GTKMM_3_0
+# include <gtkmm/grid.h>
+#else
+# include <gtkmm/table.h>
+#endif
+
#include <sigc++/functors/ptr_fun.h>
#include <sigc++/adaptors/bind.h>
@@ -24,7 +33,6 @@
#include "document.h"
#include "document-undo.h"
#include "verbs.h"
-#include "sp-attribute-widget.h"
using Inkscape::DocumentUndo;
@@ -150,11 +158,14 @@ void SPAttributeTable::set_object(SPObject *object,
release_connection = object->connectRelease (sigc::bind<1>(sigc::ptr_fun(&sp_attribute_table_object_release), this));
// Create table
- table = new Gtk::Table (attributes.size(), 2, false);
+#if WITH_GTKMM_3_0
+ table = new Gtk::Grid();
+#else
+ table = new Gtk::Table(attributes.size(), 2, false);
+#endif
+
if (!(parent == NULL))
- {
- gtk_container_add (GTK_CONTAINER (parent),(GtkWidget*)table->gobj());
- }
+ gtk_container_add(GTK_CONTAINER(parent), (GtkWidget*)table->gobj());
// Fill rows
_attributes = attributes;
@@ -162,18 +173,41 @@ void SPAttributeTable::set_object(SPObject *object,
Gtk::Label *ll = new Gtk::Label (_(labels[i].c_str()));
ll->show();
ll->set_alignment (1.0, 0.5);
+
+#if WITH_GTKMM_3_0
+ ll->set_vexpand();
+ ll->set_margin_left(XPAD);
+ ll->set_margin_right(XPAD);
+ ll->set_margin_top(XPAD);
+ ll->set_margin_bottom(XPAD);
+ table->attach(*ll, 0, i, 1, 1);
+#else
table->attach (*ll, 0, 1, i, i + 1,
Gtk::FILL,
(Gtk::EXPAND | Gtk::FILL),
XPAD, YPAD );
+#endif
+
Gtk::Entry *ee = new Gtk::Entry();
ee->show();
const gchar *val = object->getRepr()->attribute(attributes[i].c_str());
ee->set_text (val ? val : (const gchar *) "");
+
+#if WITH_GTKMM_3_0
+ ee->set_hexpand();
+ ee->set_vexpand();
+ ee->set_margin_left(XPAD);
+ ee->set_margin_right(XPAD);
+ ee->set_margin_top(XPAD);
+ ee->set_margin_bottom(XPAD);
+ table->attach(*ee, 1, i, 1, 1);
+#else
table->attach (*ee, 1, 2, i, i + 1,
(Gtk::EXPAND | Gtk::FILL),
(Gtk::EXPAND | Gtk::FILL),
XPAD, YPAD );
+#endif
+
_entries.push_back(ee);
g_signal_connect ( ee->gobj(), "changed",
G_CALLBACK (sp_attribute_table_entry_changed),
diff --git a/src/widgets/sp-attribute-widget.h b/src/widgets/sp-attribute-widget.h
index fb8a74632..d9b972201 100644
--- a/src/widgets/sp-attribute-widget.h
+++ b/src/widgets/sp-attribute-widget.h
@@ -15,13 +15,22 @@
#ifndef SEEN_DIALOGS_SP_ATTRIBUTE_WIDGET_H
#define SEEN_DIALOGS_SP_ATTRIBUTE_WIDGET_H
-#include <gtkmm/table.h>
+#if HAVE_CONFIG_H
+# include "config.h"
+#endif
+
#include <gtkmm/widget.h>
#include <stddef.h>
#include <sigc++/connection.h>
namespace Gtk {
class Entry;
+
+#if WITH_GTKMM_3_0
+class Grid;
+#else
+class Table;
+#endif
}
namespace Inkscape {
@@ -126,12 +135,16 @@ public:
bool blocked;
private:
- /**
+ /**
* Container widget for the dynamically created child widgets (labels and entry boxes).
*/
+#if WITH_GTKMM_3_0
+ Gtk::Grid *table;
+#else
Gtk::Table *table;
+#endif
- /**
+ /**
* List of attributes.
*
* _attributes stores the attribute names of the selected object that