17#ifndef YMenuWidgetActionHandler_h
18#define YMenuWidgetActionHandler_h
20#include "YWidgetActionHandler.h"
31 std::function<void (T*)> get_handler( T *widget,
const std::string &value ) {
32 return [&] ( T *menu_selector ) {
33 std::string value_sanitized = normalize_label( value );
35 std::vector<std::string> path;
36 boost::split( path, value_sanitized, boost::is_any_of( TreePathDelimiter ) );
37 YMenuItem * item = findItem( path.begin(), path.end(), widget->itemsBegin(), widget->itemsEnd() );
40 menu_selector->setKeyboardFocus();
45 throw YUIException(
"Item with path: '" + value +
"' cannot be found in the menu selector widget" );
52 YMenuItem * findItem( std::vector<std::string>::iterator path_begin,
53 std::vector<std::string>::iterator path_end,
54 YItemConstIterator begin,
55 YItemConstIterator end )
const;