23 #ifndef __MYGUI_MENU_CTRL_H__
24 #define __MYGUI_MENU_CTRL_H__
88 virtual void setVisible(
bool _value);
91 void setVisibleSmooth(
bool _value);
108 void removeItemAt(
size_t _index);
113 void removeAllItems();
120 size_t getItemIndex(
MenuItem* _item);
123 size_t findItemIndex(
MenuItem* _item);
132 void setItemDataAt(
size_t _index,
Any _data);
142 template <
typename ValueType>
143 ValueType * getItemDataAt(
size_t _index,
bool _throw =
true)
146 return mItemsInfo[_index].data.castType<ValueType>(_throw);
149 template <
typename ValueType>
150 ValueType * getItemData(
MenuItem* _item,
bool _throw =
true)
152 return getItemDataAt<ValueType>(getItemIndex(_item), _throw);
156 void setItemIdAt(
size_t _index,
const std::string& _id);
158 void setItemId(
MenuItem* _item,
const std::string& _id) { setItemIdAt(getItemIndex(_item), _id); }
161 const std::string& getItemIdAt(
size_t _index);
166 MenuItem* getItemById(
const std::string& _id);
169 size_t getItemIndexById(
const std::string& _id);
174 void setItemNameAt(
size_t _index,
const UString& _name);
179 const UString& getItemNameAt(
size_t _index);
184 size_t findItemIndexWith(
const UString& _name);
187 void setItemChildVisibleAt(
size_t _index,
bool _visible);
195 template <
typename Type>
196 Type * createItemChildTAt(
size_t _index)
198 return static_cast<Type*
>(createItemChildByType(_index, Type::getClassTypeName()));
202 template <
typename Type>
206 MenuCtrl* getItemChildAt(
size_t _index);
218 void removeItemChildAt(
size_t _index);
260 void _notifyDeleteItem(
MenuItem* _item);
261 void _notifyUpdateName(
MenuItem* _item);
267 #ifndef MYGUI_DONT_USE_OBSOLETE
270 void showMenu() { setVisible(
true); }
272 void hideMenu() { setVisible(
false); }
274 bool isShowMenu() {
return isVisible(); }
276 MYGUI_OBSOLETE(
"use : void setItemChildVisibleAt(size_t _index, bool _visible)")
277 void showItemChildAt(
size_t _index) { setItemChildVisibleAt(_index,
true); }
278 MYGUI_OBSOLETE(
"use : void setItemChildVisible(MenuItem* _item, bool _visible)")
279 void showItemChild(
MenuItem* _item) { setItemChildVisible(_item,
true); }
280 MYGUI_OBSOLETE(
"use : void setItemChildVisibleAt(size_t _index, bool _visible)")
281 void hideItemChildAt(
size_t _index) { setItemChildVisibleAt(_index,
false); }
282 MYGUI_OBSOLETE(
"use : void setItemChildVisible(MenuItem* _item, bool _visible)")
283 void hideItemChild(
MenuItem* _item) { setItemChildVisible(_item,
false); }
285 #endif // MYGUI_DONT_USE_OBSOLETE
293 virtual Widget* baseCreateWidget(
WidgetStyle _style,
const std::string& _type,
const std::string& _skin,
const IntCoord& _coord,
Align _align,
const std::string& _layer,
const std::string& _name);
295 virtual void onKeyChangeRootFocus(
bool _focus);
299 void shutdownWidgetSkin();
301 void notifyRootKeyChangeFocus(
Widget* _sender,
bool _focus);
302 void notifyMouseButtonClick(
Widget* _sender);
303 void notifyMouseSetFocus(
Widget* _sender,
Widget* _new);
310 size_t getIconIndexByType(MenuItemType _type)
317 void setButtonImageIndex(Button* _button,
size_t _index);
319 MenuItemType getItemType(
bool _submenu,
bool _separator)
326 void notifyMenuCtrlAccept(MenuItem* _item);
328 Widget* createItemChildByType(
size_t _index,
const std::string& _type);
330 void _wrapItem(MenuItem* _item,
size_t _index,
const UString& _name, MenuItemType _type,
const std::string& _id, Any _data);
332 ControllerFadeAlpha* createControllerFadeAlpha(
float _alpha,
float _coef,
bool _enable);
334 Widget* _getClientWidget();
335 const Widget* _getClientWidget()
const;
348 std::string mSkinLine;
350 int mSubmenuImageSize;
352 std::string mSubMenuSkin;
353 std::string mSubMenuLayer;
358 int mSeparatorHeight;
359 std::string mSeparatorSkin;
371 #endif // __MYGUI_MENU_CTRL_H__