MyGUI 3.5.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
18 void TabItem::shutdownOverride()
19 {
20 TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
21 if (owner != nullptr)
22 owner->_notifyDeleteItem(this);
23
24 Base::shutdownOverride();
25 }
26
27 void TabItem::setCaption(const UString& _value)
28 {
29 TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
30 if (owner != nullptr)
31 owner->setItemName(this, _value);
32 else
33 Base::setCaption(_value);
34 }
35
36 const UString& TabItem::getCaption() const
37 {
38 TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
39 if (owner != nullptr)
40 return owner->getItemName(this);
41 return Base::getCaption();
42 }
43
44 void TabItem::setButtonWidth(int _width)
45 {
46 TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
47 if (owner != nullptr)
48 owner->setButtonWidth(this, _width);
49 }
50
51 void TabItem::setPropertyOverride(std::string_view _key, std::string_view _value)
52 {
54 if (_key == "ButtonWidth")
55 setButtonWidth(utility::parseValue<int>(_value));
56
57 else
58 {
59 Base::setPropertyOverride(_key, _value);
60 return;
61 }
62
63 eventChangeProperty(this, _key, _value);
64 }
65
66} // namespace MyGUI
T parseValue(std::string_view value)