index 7004e848f2c1ab41e22b2e3d00b2bc7622decd31..79f06359166c3ea62b115d10d0ac890945cb92d8 100644 (file)
#include <gtkmm/label.h>
#include <gtkmm/frame.h>
#include <gtkmm/table.h>
+#include <gtkmm/tooltips.h>
#include "inkscape.h"
#include "extension/implementation/implementation.h"
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
{
if (g_slist_length(parameters) == 0) return NULL;
- Gtk::VBox * vbox = new Gtk::VBox();
- vbox = 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;
};
/**