44class YWidgetActionHandler
49 YWidgetActionHandler() {}
50 virtual ~YWidgetActionHandler() {}
79 template<
typename T,
typename I >
81 selector->activateItem( item );
84 virtual void activate_widget( YMultiSelectionBox * widget, YItem * item ) {};
87 std::function<void (T*)> get_item_selector_handler( T *widget,
const std::string &value,
const int state = -1 ) {
88 return [&] (T *selector) {
89 YItem * item = selector->findItem( value );
92 selector->setKeyboardFocus();
94 bool select = state < 0 ? !item->selected() : (state != 0);
97 select = !item->selected();
101 select = (state != 0);
103 item->setSelected( select );
104 selector->selectItem( item, select );
109 throw YUIException(
"Item: '" + value +
"' cannot be found in the item selector widget");
117 static std::string normalize_label(
const std::string & label);
120 static bool normalized_labels_equal(
const std::string & a,
const std::string & b)
122 std::string na = normalize_label(a);
123 std::string nb = normalize_label(b);