Vultraz

Untitled

Jan 27th, 2016
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. template <typename T, typename W>
  2. void tpreferences::bind_status_label(
  3.           W& parent
  4.         , const std::string& label_id
  5.         , T& window)
  6. {
  7.     tcontrol& label = find_widget<tcontrol>(&window, label_id, false);
  8.     std::string value;
  9.  
  10.     if (ttoggle_button* type = dynamic_cast<ttoggle_button*>(&parent)) {
  11.         value = bool_to_display_string(parent.get_value_bool());
  12.     } else if (tcombobox* type = dynamic_cast<tcombobox*>(&parent)) {
  13.         value = parent.get_value_string();
  14.     } else {
  15.         value = parent.get_value();
  16.     }
  17.  
  18.     label.set_label(value);
  19.  
  20.     parent.set_callback_state_change(boost::bind(
  21.           &tpreferences::status_label_callback<W>
  22.         , this, boost::ref(parent), boost::ref(label)));
  23. }
Advertisement
Add Comment
Please, Sign In to add comment