summaryrefslogtreecommitdiffstats
path: root/src/ink-action.cpp
diff options
context:
space:
mode:
authorJohan B. C. Engelen <jbc.engelen@swissonline.ch>2012-01-05 20:22:09 +0000
committerJohan Engelen <goejendaagh@zonnet.nl>2012-01-05 20:22:09 +0000
commit5f739493fd73a6ae099e3929e8934bb8d3fe87cd (patch)
tree3256109cd5af8e5acadd35e4f8cbb2ee75b4b297 /src/ink-action.cpp
parentGTK 2.20 compat for interface.cpp (diff)
downloadinkscape-5f739493fd73a6ae099e3929e8934bb8d3fe87cd.tar.gz
inkscape-5f739493fd73a6ae099e3929e8934bb8d3fe87cd.zip
add toolbutton menu action type. now the add extremum node buttons are somewhat subbuttons of the insert node button...
(bzr r10849)
Diffstat (limited to 'src/ink-action.cpp')
-rw-r--r--src/ink-action.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/ink-action.cpp b/src/ink-action.cpp
index d26b038f8..becf5971a 100644
--- a/src/ink-action.cpp
+++ b/src/ink-action.cpp
@@ -675,3 +675,74 @@ static GtkWidget* ink_radio_action_create_tool_item( GtkAction* action )
return item;
}
+
+
+/* --------------------------------------------------------------- */
+/* --------------------------------------------------------------- */
+/* --------------------------------------------------------------- */
+/* --------------------------------------------------------------- */
+
+// ToolMenu Action is happily derived from http://www.gtkforums.com/viewtopic.php?t=4215
+
+static void ink_tool_menu_action_init (InkToolMenuAction *tma);
+static void ink_tool_menu_action_class_init (InkToolMenuActionClass *klass);
+
+GType
+ink_tool_menu_action_get_type (void)
+{
+ static GType myType = 0;
+ if (! myType)
+ {
+ static const GTypeInfo myInfo =
+ {
+ sizeof (InkToolMenuActionClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) ink_tool_menu_action_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (InkToolMenuAction),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) ink_tool_menu_action_init,
+ NULL
+ };
+
+ myType = g_type_register_static( INK_ACTION_TYPE, "InkToolMenuAction", &myInfo, (GTypeFlags)0 );
+ }
+
+ return myType;
+}
+
+static void
+ink_tool_menu_action_class_init (InkToolMenuActionClass *klass)
+{
+ GtkActionClass *action_class = GTK_ACTION_CLASS (klass);
+ action_class->toolbar_item_type = GTK_TYPE_MENU_TOOL_BUTTON;
+}
+
+static void
+ink_tool_menu_action_init (InkToolMenuAction* /*tma*/)
+{
+}
+
+InkToolMenuAction *
+ink_tool_menu_action_new (const gchar *name,
+ const gchar *label,
+ const gchar *tooltip,
+ const gchar *inkId,
+ Inkscape::IconSize size )
+{
+ g_return_val_if_fail (name != NULL, NULL);
+
+ GObject* obj = (GObject*)g_object_new( INK_TOOL_MENU_ACTION_TYPE,
+ "name", name,
+ "label", label,
+ "tooltip", tooltip,
+ "iconId", inkId,
+ "iconSize", size,
+ NULL );
+
+ InkToolMenuAction* action = INK_TOOL_MENU_ACTION( obj );
+
+ return action;
+}