Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Jan 19, 2016
1 parent eb4b8ea commit 8471d1c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/gui/widgets/combobox.cpp
Expand Up @@ -144,6 +144,9 @@ void tcombobox::signal_handler_left_button_click(const event::tevent event,
if(droplist.show(get_window()->video())) {
selected_ = droplist.selected_item();
this->set_label(values_[selected_]);
if(selected_callback_) {
selected_callback_(*this);
}
if(retval_ != 0) {
twindow* window = get_window();
if(window) {
Expand Down
10 changes: 10 additions & 0 deletions src/gui/widgets/combobox.hpp
Expand Up @@ -72,6 +72,13 @@ class tcombobox : public tcontrol, public tclickable_, public tselectable_

/** Inherited from tselectable_ */
virtual unsigned num_states() const OVERRIDE { return values_.size(); }

/** Inherited from tselectable_ */
virtual void set_callback_state_change(boost::function<void(twidget&)> callback)
{
selected_callback_ = callback;
}

private:
/**
* Possible states of the widget.
Expand Down Expand Up @@ -108,6 +115,9 @@ class tcombobox : public tcontrol, public tclickable_, public tselectable_
/**
*/
int selected_;

boost::function<void(twidget&)> selected_callback_;

/** See @ref tcontrol::get_control_type. */
virtual const std::string& get_control_type() const OVERRIDE;

Expand Down

0 comments on commit 8471d1c

Please sign in to comment.