~inkscape+alexander/inkscape/break

« back to all changes in this revision

Viewing changes to src/extension/param/radiobutton.cpp

  • Committer: Alexander Brock
  • Date: 2015-05-31 17:41:01 UTC
  • mfrom: (13749.1.441 Inkscape)
  • Revision ID: brock.alexander@web.de-20150531174101-2roftkxg6oy1oav5
MergeĀ lp:inkscape

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
# include "config.h"
19
19
#endif
20
20
 
21
 
#if GLIBMM_DISABLE_DEPRECATED && HAVE_GLIBMM_THREADS_H
22
 
#include <glibmm/threads.h>
23
 
#endif
24
 
 
25
21
#include <gtkmm/box.h>
26
22
#include <gtkmm/comboboxtext.h>
27
23
#include <gtkmm/radiobutton.h>
249
245
 
250
246
 
251
247
class ComboWdg : public Gtk::ComboBoxText {
 
248
private:
 
249
    ParamRadioButton* _base;
 
250
    SPDocument* _doc;
 
251
    Inkscape::XML::Node* _node;
 
252
    sigc::signal<void> * _changeSignal;
 
253
 
252
254
public:
253
 
    ComboWdg(ParamRadioButton* base, SPDocument * doc, Inkscape::XML::Node * node) :
254
 
        Gtk::ComboBoxText(),
255
 
        base(base),
256
 
        doc(doc),
257
 
        node(node)
 
255
    ComboWdg(ParamRadioButton* base, SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) :
 
256
        _base(base),
 
257
        _doc(doc),
 
258
        _node(node),
 
259
        _changeSignal(changeSignal)
258
260
    {
 
261
        this->signal_changed().connect(sigc::mem_fun(this, &ComboWdg::changed));
259
262
    }
260
263
    virtual ~ComboWdg() {}
261
 
 
262
 
protected:
263
 
    ParamRadioButton* base;
264
 
    SPDocument* doc;
265
 
    Inkscape::XML::Node* node;
266
 
 
267
 
    virtual void on_changed() {
268
 
        if ( base ) {
269
 
            Glib::ustring value = base->value_from_label(get_active_text());
270
 
            base->set(value.c_str(), doc, node);
271
 
        }
272
 
    }
 
264
    void changed (void);
273
265
};
274
266
 
 
267
void ComboWdg::changed(void)
 
268
{
 
269
    if ( _base ) {
 
270
            Glib::ustring value = _base->value_from_label(get_active_text());
 
271
            _base->set(value.c_str(), _doc, _node);
 
272
    }
 
273
    if (_changeSignal != NULL) {
 
274
        _changeSignal->emit();
 
275
    }
 
276
}
 
277
 
275
278
/**
276
279
 * Returns the value for the options label parameter
277
280
 */
317
320
    Gtk::ComboBoxText* cbt = 0;
318
321
    bool comboSet = false;
319
322
    if (_mode == MINIMAL) {
320
 
        cbt = Gtk::manage(new ComboWdg(this, doc, node));
 
323
        cbt = Gtk::manage(new ComboWdg(this, doc, node, changeSignal));
321
324
        cbt->show();
322
325
        vbox->pack_start(*cbt, false, false);
323
326
    }