8bdb7f3827b51ae60c476b7d17845db7226c1a24
1 /*
2 * Copyright (C) 2005-2010 Authors:
3 * Ted Gould <ted@gould.cx>
4 * Johan Engelen <johan@shouraizou.nl> *
5 * Nicolas Dufour <nicoduf@yahoo.fr>
6 * Released under GNU GPL, read the file 'COPYING' for more information
7 */
9 #ifdef linux // does the dollar sign need escaping when passed as string parameter?
10 # define ESCAPE_DOLLAR_COMMANDLINE
11 #endif
13 #ifdef HAVE_CONFIG_H
14 # include "config.h"
15 #endif
18 #include "groupheader.h"
20 #include <gtkmm/adjustment.h>
21 #include <gtkmm/box.h>
22 #include <gtkmm/spinbutton.h>
23 #include <sstream>
24 #include <glibmm/i18n.h>
26 #include "xml/node.h"
27 #include "extension/extension.h"
29 namespace Inkscape {
30 namespace Extension {
33 /** \brief Initialize the object, to do that, copy the data. */
34 ParamGroupHeader::ParamGroupHeader (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) :
35 Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(NULL)
36 {
37 // printf("Building GroupHeader\n");
38 const char * defaultval = NULL;
39 if (sp_repr_children(xml) != NULL)
40 defaultval = sp_repr_children(xml)->content();
42 if (defaultval != NULL)
43 _value = g_strdup(defaultval);
45 return;
46 }
48 /** \brief Create a label for the GroupHeader */
49 Gtk::Widget *
50 ParamGroupHeader::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal<void> * /*changeSignal*/)
51 {
52 if (_gui_hidden) return NULL;
54 Gtk::Label * label = Gtk::manage(new Gtk::Label(Glib::ustring("<b>") + _(_value) + Glib::ustring("</b>"), Gtk::ALIGN_LEFT));
55 label->set_line_wrap();
56 label->set_padding(0,5);
57 label->set_use_markup(true);
58 label->show();
60 Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4));
61 hbox->pack_start(*label, true, true);
62 hbox->show();
64 return hbox;
65 }
67 } /* namespace Extension */
68 } /* namespace Inkscape */