MyGUI: MyGUI_TabItem.cpp Source File

MyGUI 3.4.3

MyGUI_TabItem.cpp
Go to the documentation of this file.
1/*
2 * This source file is part of MyGUI. For the latest info, see http://mygui.info/
3 * Distributed under the MIT License
4 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
5 */
6
7#include "MyGUI_Precompiled.h"
8#include "MyGUI_TabItem.h"
9
10namespace MyGUI
11{
12
13 void TabItem::initialiseOverride()
14 {
15 Base::initialiseOverride();
16
17 // FIXME проверить смену скина ибо должно один раз вызываться
18 //mOwner = getParent()->castType<TabControl>();
19 }
20
21 void TabItem::shutdownOverride()
22 {
23 TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
24 if (owner != nullptr)
25 owner->_notifyDeleteItem(this);
26
27 Base::shutdownOverride();
28 }
29
30 void TabItem::setCaption(const UString& _value)
31 {
32 TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
33 if (owner != nullptr)
34 owner->setItemName(this, _value);
35 else
36 Base::setCaption(_value);
37 }
38
39 const UString& TabItem::getCaption() const
40 {
41 TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
42 if (owner != nullptr)
43 return owner->getItemName(this);
44 return Base::getCaption();
45 }
46
47 void TabItem::setButtonWidth(int _width)
48 {
49 TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
50 if (owner != nullptr)
51 owner->setButtonWidth(this, _width);
52 }
53
54 void TabItem::setPropertyOverride(std::string_view _key, std::string_view _value)
55 {
57 if (_key == "ButtonWidth")
58 setButtonWidth(utility::parseValue<int>(_value));
59
60 else
61 {
62 Base::setPropertyOverride(_key, _value);
63 return;
64 }
65
66 eventChangeProperty(this, _key, _value);
67 }
68
69} // namespace MyGUI
MyGUI_Precompiled.h
MyGUI_TabItem.h
MyGUI::IObject::castType
Type * castType(bool _throw=true)
Definition MyGUI_IObject.h:18
MyGUI::TabControl
widget description should be here.
Definition MyGUI_TabControl.h:27
MyGUI::TabControl::_notifyDeleteItem
void _notifyDeleteItem(TabItem *_sheet)
Definition MyGUI_TabControl.cpp:452
MyGUI::TabControl::setButtonWidth
void setButtonWidth(TabItem *_item, int _width=DEFAULT_WIDTH)
Set button width.
Definition MyGUI_TabControl.cpp:715
MyGUI::TabControl::setItemName
void setItemName(TabItem *_item, const UString &_name)
Replace an item name.
Definition MyGUI_TabControl.cpp:682
MyGUI::TabControl::getItemName
const UString & getItemName(const TabItem *_item) const
Get item name.
Definition MyGUI_TabControl.cpp:687
MyGUI::TabItem::setCaption
void setCaption(const UString &_value) override
Definition MyGUI_TabItem.cpp:30
MyGUI::TabItem::setPropertyOverride
void setPropertyOverride(std::string_view _key, std::string_view _value) override
Definition MyGUI_TabItem.cpp:54
MyGUI::TabItem::setButtonWidth
void setButtonWidth(int _width=TabControl::DEFAULT_WIDTH)
Set button width.
Definition MyGUI_TabItem.cpp:47
MyGUI::TabItem::shutdownOverride
void shutdownOverride() override
Definition MyGUI_TabItem.cpp:21
MyGUI::TabItem::initialiseOverride
void initialiseOverride() override
Definition MyGUI_TabItem.cpp:13
MyGUI::TabItem::getCaption
const UString & getCaption() const override
Definition MyGUI_TabItem.cpp:39
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition MyGUI_UString.h:144
MyGUI::Widget::getParent
Widget * getParent() const
Definition MyGUI_Widget.cpp:1352
MyGUI::Widget::eventChangeProperty
EventHandle_WidgetStringString eventChangeProperty
Definition MyGUI_Widget.h:324
MyGUI::utility::parseValue
T parseValue(std::string_view _value)
Definition MyGUI_StringUtility.h:60
MyGUI
Definition MyGUI_ActionController.h:15