summaryrefslogtreecommitdiffstats
path: root/src/helper/window.cpp
diff options
context:
space:
mode:
authorMenTaLguY <mental@rydia.net>2006-01-16 02:36:01 +0000
committermental <mental@users.sourceforge.net>2006-01-16 02:36:01 +0000
commit179fa413b047bede6e32109e2ce82437c5fb8d34 (patch)
treea5a6ac2c1708bd02288fbd8edb2ff500ff2e0916 /src/helper/window.cpp
downloadinkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.tar.gz
inkscape-179fa413b047bede6e32109e2ce82437c5fb8d34.zip
moving trunk for module inkscape
(bzr r1)
Diffstat (limited to 'src/helper/window.cpp')
-rw-r--r--src/helper/window.cpp47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/helper/window.cpp b/src/helper/window.cpp
new file mode 100644
index 000000000..346bd19f1
--- /dev/null
+++ b/src/helper/window.cpp
@@ -0,0 +1,47 @@
+#define __SP_WINDOW_C__
+
+/*
+ * Generic window implementation
+ *
+ * Author:
+ * Lauris Kaplinski <lauris@kaplinski.com>
+ *
+ * This code is in public domain
+ */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include <gtk/gtkwindow.h>
+
+#include "inkscape.h"
+#include "shortcuts.h"
+#include "desktop.h"
+#include "event-context.h"
+
+static gboolean
+sp_window_key_press (GtkWidget *widget, GdkEventKey *event)
+{
+ unsigned int shortcut;
+ shortcut = get_group0_keyval (event) |
+ ( event->state & GDK_SHIFT_MASK ?
+ SP_SHORTCUT_SHIFT_MASK : 0 ) |
+ ( event->state & GDK_CONTROL_MASK ?
+ SP_SHORTCUT_CONTROL_MASK : 0 ) |
+ ( event->state & GDK_MOD1_MASK ?
+ SP_SHORTCUT_ALT_MASK : 0 );
+ return sp_shortcut_invoke (shortcut, SP_ACTIVE_DESKTOP);
+}
+
+GtkWidget *
+sp_window_new (const gchar *title, unsigned int resizeable)
+{
+ GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+ gtk_window_set_title ((GtkWindow *) window, title);
+ gtk_window_set_resizable ((GtkWindow *) window, resizeable);
+ g_signal_connect_after ((GObject *) window, "key_press_event", (GCallback) sp_window_key_press, NULL);
+
+ return window;
+}
+
+