add Action-Button for rc-config dialog
This commit is contained in:
@@ -113,6 +113,31 @@ OptionEditorBox::add_to_page (OptionEditorPage* p)
|
||||
add_widget_to_page (p, _box);
|
||||
}
|
||||
|
||||
RcActionButton::RcActionButton (std::string const & t, const Glib::SignalProxy0< void >::SlotType & slot, std::string const & l)
|
||||
: _label (NULL)
|
||||
{
|
||||
_button = manage (new Button (t));
|
||||
_button->signal_clicked().connect (slot);
|
||||
if (!l.empty ()) {
|
||||
_label = manage (right_aligned_label (l));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RcActionButton::add_to_page (OptionEditorPage *p)
|
||||
{
|
||||
int const n = p->table.property_n_rows();
|
||||
int m = n + 1;
|
||||
p->table.resize (m, 3);
|
||||
if (_label) {
|
||||
p->table.attach (*_label, 1, 2, n, n + 1, FILL | EXPAND);
|
||||
p->table.attach (*_button, 2, 3, n, n + 1, FILL | EXPAND);
|
||||
} else {
|
||||
p->table.attach (*_button, 1, 3, n, n + 1, FILL | EXPAND);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BoolOption::BoolOption (string const & i, string const & n, sigc::slot<bool> g, sigc::slot<bool, bool> s)
|
||||
: Option (i, n),
|
||||
_get (g),
|
||||
|
||||
@@ -121,6 +121,22 @@ protected:
|
||||
Gtk::VBox* _box; ///< constituent box for subclasses to add widgets to
|
||||
};
|
||||
|
||||
class RcActionButton : public OptionEditorComponent
|
||||
{
|
||||
public:
|
||||
RcActionButton (std::string const & t, const Glib::SignalProxy0< void >::SlotType & slot, std::string const & l = "");
|
||||
void add_to_page (OptionEditorPage *);
|
||||
|
||||
void parameter_changed (std::string const & p) {}
|
||||
void set_state_from_config () {}
|
||||
Gtk::Widget& tip_widget() { return *_button; }
|
||||
|
||||
protected:
|
||||
Gtk::Button* _button;
|
||||
Gtk::Label* _label;
|
||||
std::string _name;
|
||||
};
|
||||
|
||||
/** Base class for components which provide UI to change an option */
|
||||
class Option : public OptionEditorComponent
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user