MyGUI_MenuItem.h
Go to the documentation of this file.
/*
* This source file is part of MyGUI. For the latest info, see http://mygui.info/
* Distributed under the MIT License
* (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
*/
#ifndef MYGUI_MENU_ITEM_H_
#define MYGUI_MENU_ITEM_H_
#include "MyGUI_Prerequest.h"
#include "MyGUI_Button.h"
#include "MyGUI_MenuControl.h"
#include "MyGUI_IItem.h"
namespace MyGUI
{
class MYGUI_EXPORT MenuItem : public Button, public IItem, public MemberObsolete<MenuItem>
{
MYGUI_RTTI_DERIVED(MenuItem)
public:
void setCaption(const UString& _value) override;
void setFontName(std::string_view _value) override;
void setFontHeight(int _value) override;
void setItemName(const UString& _value);
const UString& getItemName() const;
void setItemData(Any _data);
template<typename ValueType>
ValueType* getItemData(bool _throw = true)
{
return mOwner->getItemData<ValueType>(this, _throw);
}
void removeItem();
void setItemId(std::string_view _id);
const std::string& getItemId() const;
size_t getItemIndex() const;
MenuControl* createItemChild();
template<typename Type>
Type* createItemChildT()
{
return mOwner->createItemChildT<Type>(this);
}
void setItemType(MenuItemType _type);
MenuItemType getItemType() const;
void setItemChildVisible(bool _visible);
MenuControl* getMenuCtrlParent() const;
MenuControl* getItemChild() const;
bool getItemChecked() const;
void setItemChecked(bool _value);
/*internal:*/
IItemContainer* _getItemContainer() const override;
IntSize _getContentSize() const;
protected:
void initialiseOverride() override;
void shutdownOverride() override;
void setPropertyOverride(std::string_view _key, std::string_view _value) override;
void onWidgetCreated(Widget* _widget) override;
private:
void updateCheck();
private:
MenuControl* mOwner{nullptr};
IntSize mMinSize{10, 10};
Widget* mCheck{nullptr};
bool mCheckValue{false};
};
} // namespace MyGUI
#endif // MYGUI_MENU_ITEM_H_
MyGUI_Button.h
MyGUI_IItem.h
MYGUI_EXPORT
#define MYGUI_EXPORT
Definition MyGUI_Platform.h:77
MyGUI_Prerequest.h
MYGUI_RTTI_DERIVED
#define MYGUI_RTTI_DERIVED(DerivedType)
Definition MyGUI_RTTI.h:69
MyGUI::Any
Definition MyGUI_Any.h:56
MyGUI::Button
widget description should be here.
Definition MyGUI_Button.h:20
MyGUI::IItemContainer
Definition MyGUI_IItemContainer.h:19
MyGUI::IItem
Definition MyGUI_IItem.h:18
MyGUI::MemberObsolete
Definition MyGUI_DeprecatedTypes.h:14
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition MyGUI_UString.h:144
MyGUI::Widget
widget description should be here.
Definition MyGUI_Widget.h:40
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::IntSize
types::TSize< int > IntSize
Definition MyGUI_Types.h:30