diff options
| author | Ted Gould <ted@gould.cx> | 2006-05-02 05:26:00 +0000 |
|---|---|---|
| committer | gouldtj <gouldtj@users.sourceforge.net> | 2006-05-02 05:26:00 +0000 |
| commit | 82d842bbdc1707a470a20933e9b7e49b5e885119 (patch) | |
| tree | 8f1327cfb412b738a0332740368639b64cc95e7f /src | |
| parent | r11465@tres: ted | 2006-04-19 09:03:46 -0700 (diff) | |
| download | inkscape-82d842bbdc1707a470a20933e9b7e49b5e885119.tar.gz inkscape-82d842bbdc1707a470a20933e9b7e49b5e885119.zip | |
r11466@tres: ted | 2006-04-19 21:27:49 -0700
Moving the auto gui stuff into it's own class that subclasses from VBox.
This should make adding tooltips easier...
(bzr r674)
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/extension.cpp | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index e41990a1c..79f063591 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -26,6 +26,7 @@ #include <gtkmm/label.h> #include <gtkmm/frame.h> #include <gtkmm/table.h> +#include <gtkmm/tooltips.h> #include "inkscape.h" #include "extension/implementation/implementation.h" @@ -580,6 +581,31 @@ Extension::error_file_close (void) error_file.close(); }; +/** \brief A widget to represent the inside of an AutoGUI widget */ +class AutoGUI : public Gtk::VBox { + Gtk::Tooltips _tooltips; +public: + /** \brief Create an AutoGUI object */ + AutoGUI (void) : Gtk::VBox() {}; + /** \brief Adds a widget with a tool tip into the autogui + \param widg Widget to add + \param tooltip Tooltip for the widget + + If there is no widget, nothing happens. Otherwise it is just + added into the VBox. If there is a tooltip (non-NULL) then it + is placed on the widget. + */ + void addWidget (Gtk::Widget * widg, gchar const * tooltip) { + if (widg == NULL) return; + this->pack_start(*widg, true, true); + if (tooltip != NULL) { + _tooltips.set_tip(*widg, Glib::ustring(tooltip)); + // printf("Setting tooltip: %s\n", tooltip); + } + return; + }; +}; + /** \brief A function to automatically generate a GUI using the parameters \return Generated widget @@ -594,17 +620,17 @@ Extension::autogui (void) { if (g_slist_length(parameters) == 0) return NULL; - Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox()); + AutoGUI * agui = Gtk::manage(new AutoGUI()); for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) { Parameter * param = reinterpret_cast<Parameter *>(list->data); Gtk::Widget * widg = param->get_widget(); - if (widg != NULL) - vbox->pack_start(*widg, true, true); + gchar const * tip = param->get_tooltip(); + agui->addWidget(widg, tip); } - vbox->show(); - return vbox; + agui->show(); + return agui; }; /** |
