Code

r10923@tres: ted | 2006-02-13 09:47:15 -0800
authorgouldtj <gouldtj@users.sourceforge.net>
Wed, 29 Mar 2006 05:39:11 +0000 (05:39 +0000)
committergouldtj <gouldtj@users.sourceforge.net>
Wed, 29 Mar 2006 05:39:11 +0000 (05:39 +0000)
 Adding in the help dialog basics.

src/extension/helpdialog.cpp [new file with mode: 0644]
src/extension/helpdialog.h [new file with mode: 0644]
src/extension/prefdialog.cpp
src/extension/prefdialog.h

diff --git a/src/extension/helpdialog.cpp b/src/extension/helpdialog.cpp
new file mode 100644 (file)
index 0000000..d53a3f0
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * Authors:
+ *   Ted Gould <ted@gould.cx>
+ *
+ * Copyright (C) 2006 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include <gtkmm/stock.h>
+#include <glibmm/i18n.h>
+
+#include "../dialogs/dialog-events.h"
+
+#include "prefdialog.h"
+
+namespace Inkscape {
+namespace Extension {
+
+HelpDialog::HelpDialog (Glib::ustring name, gchar const * help) :
+    Gtk::Dialog::Dialog(_("Help with ") + name, true, true)
+{
+    Gtk::Button * ok = add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);
+    set_default_response(Gtk::RESPONSE_OK);
+    ok->grab_focus();
+    
+    GtkWidget *dlg = GTK_WIDGET(gobj());
+    sp_transientize(dlg);
+
+    return;
+}
+
+}; }; /* namespace Inkscape, Extension */
+
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+  indent-tabs-mode:nil
+  fill-column:99
+  End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/src/extension/helpdialog.h b/src/extension/helpdialog.h
new file mode 100644 (file)
index 0000000..90a4269
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Authors:
+ *   Ted Gould <ted@gould.cx>
+ *
+ * Copyright (C) 2006 Authors
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#ifndef INKSCAPE_EXTENSION_HELP_DIALOG_H__
+#define INKSCAPE_EXTENSION_HELP_DIALOG_H__
+
+#include <glibmm/ustring.h>
+
+#include <gdkmm/types.h>
+#include <gtkmm/dialog.h>
+
+namespace Inkscape {
+namespace Extension {
+
+class HelpDialog : public Gtk::Dialog {
+
+public:
+    HelpDialog (Glib::ustring name, gchar const * help);
+};
+
+
+};}; /* namespace Inkscape, Extension */
+
+#endif /* INKSCAPE_EXTENSION_HELP_DIALOG_H__ */
+
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+  indent-tabs-mode:nil
+  fill-column:99
+  End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
index 86f1a50bed8518a9a4187a53589cecc3e448a813..aacf5eec32237ba22b8103b20cda068a2ccb59dd 100644 (file)
@@ -36,6 +36,20 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co
     return;
 }
 
+Gtk::ResponseType
+PrefDialog::run (void) {
+    Gtk::ResponseType resp = Gtk::RESPONSE_HELP;
+    while (resp == Gtk::RESPONSE_HELP) {
+        resp = Gtk::Dialog::run();
+        if (resp == Gtk::RESPONSE_HELP) {
+            HelpDialog help(_name, _help);
+            help->run();
+            help->hide();
+        }
+    }
+    return resp;
+}
+
 }; }; /* namespace Inkscape, Extension */
 
 /*
index 4324bedfdaffd677f1ca71e74383dc583ff208b1..bf30eda36617535eea455986be0ba56667f85f4c 100644 (file)
@@ -28,6 +28,8 @@ class PrefDialog : public Gtk::Dialog {
 
 public:
     PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * controls);
+    Gtk::ResponseType run (void);
+
 };