Vultraz

Untitled

Jan 25th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. // main_grid
  2. tgrid* main_grid = dynamic_cast<tgrid*>(pref_node.find("pref_main_grid", true));
  3.  
  4. // THIS WORKS
  5. tlabel& value_label = find_widget<tlabel>(main_grid, "value", false);
  6.  
  7. // NEXT USECASE
  8. setup_single_toggle("value_toggle"
  9.         , preferences::get(option["field"], option["default"].to_bool())
  10.         , boost::bind(set_ptr, option["field"].str(), _1)
  11.         , main_grid);
  12.  
  13. // DEFINITION OF ABOVE
  14. template <typename T>
  15. void tpreferences::setup_single_toggle(
  16.           const std::string& widget_id
  17.         , const bool start_value
  18.         , boost::function<void(bool)> callback
  19.         , T& window)
  20. {
  21.     ttoggle_button& widget =
  22.         find_widget<ttoggle_button>(&window, widget_id, false);
  23.  
  24.     widget.set_value(start_value);
  25.  
  26.     connect_signal_mouse_left_click(widget, boost::bind(
  27.           &tpreferences::single_toggle_callback<T>
  28.         , this, widget_id
  29.         , callback, boost::ref(window)));
  30. }
  31.  
  32. // ERROR
  33. C:\Users\\Documents\wesnoth-git\src\gui\dialogs\preferences_dialog.cpp|165|error: no matching function for call to 'find_widget(gui2::tgrid**, const string&, bool)'|
Advertisement
Add Comment
Please, Sign In to add comment