MyGUI 3.2.0

- Main Page
- Related Pages
- Namespaces
- Data Structures
- Files
- Examples

- File List
- Globals

MyGUI_TabItem.cpp
Go to the documentation of this file.
1
6 /*
7 This file is part of MyGUI.
8
9 MyGUI is free software: you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13
14 MyGUI is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU Lesser General Public License for more details.
18
19 You should have received a copy of the GNU Lesser General Public License
20 along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #include "MyGUI_Precompiled.h"
23 #include "MyGUI_TabItem.h"
24
25 namespace MyGUI
26 {
27
28 TabItem::TabItem()
29 {
30 }
31
32 void TabItem::initialiseOverride()
33 {
34 Base::initialiseOverride();
35
36 // FIXME проверить смену скина ибо должно один раз вызываться
37 //mOwner = getParent()->castType<TabControl>();
38 }
39
40 void TabItem::shutdownOverride()
41 {
42 TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
43 if (owner != nullptr)
44 owner->_notifyDeleteItem(this);
45
46 Base::shutdownOverride();
47 }
48
49 void TabItem::setCaption(const UString& _value)
50 {
51 TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
52 if (owner != nullptr)
53 owner->setItemName(this, _value);
54 else
55 Base::setCaption(_value);
56 }
57
58 const UString& TabItem::getCaption()
59 {
60 TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
61 if (owner != nullptr)
62 return owner->getItemName(this);
63 return Base::getCaption();
64 }
65
66 void TabItem::setButtonWidth(int _width)
67 {
68 TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
69 if (owner != nullptr)
70 owner->setButtonWidth(this, _width);
71 }
72
73 void TabItem::setPropertyOverride(const std::string& _key, const std::string& _value)
74 {
75 if (_key == "ButtonWidth")
76 setButtonWidth(utility::parseValue<int>(_value));
77 else
78 {
79 Base::setPropertyOverride(_key, _value);
80 return;
81 }
82 eventChangeProperty(this, _key, _value);
83 }
84
85 } // namespace MyGUI
MyGUI::TabItem::TabItem
TabItem()
Definition: MyGUI_TabItem.cpp:28
MyGUI_Precompiled.h
MyGUI::TabControl::_notifyDeleteItem
void _notifyDeleteItem(TabItem *_item)
Definition: MyGUI_TabControl.cpp:465
MyGUI::TabControl::setButtonWidth
void setButtonWidth(TabItem *_item, int _width=DEFAULT)
Set button width.
Definition: MyGUI_TabControl.cpp:734
MyGUI::TabItem::setCaption
virtual void setCaption(const UString &_value)
Definition: MyGUI_TabItem.cpp:49
MyGUI::Widget::eventChangeProperty
EventHandle_WidgetStringString eventChangeProperty
Definition: MyGUI_Widget.h:271
MyGUI::TabControl::setItemName
void setItemName(TabItem *_item, const UString &_name)
Replace an item name.
Definition: MyGUI_TabControl.cpp:701
MyGUI::TabItem::initialiseOverride
virtual void initialiseOverride()
Definition: MyGUI_TabItem.cpp:32
MyGUI::TabControl::getItemName
const UString & getItemName(TabItem *_item)
Get item name.
Definition: MyGUI_TabControl.cpp:706
MyGUI::IObject::castType
Type * castType(bool _throw=true)
Definition: MyGUI_IObject.h:33
MyGUI::TabItem::shutdownOverride
virtual void shutdownOverride()
Definition: MyGUI_TabItem.cpp:40
MyGUI_TabItem.h
MyGUI::Widget::getParent
Widget * getParent() const
Definition: MyGUI_Widget.cpp:1245
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition: MyGUI_UString.h:169
MyGUI::TabItem::setPropertyOverride
virtual void setPropertyOverride(const std::string &_key, const std::string &_value)
Definition: MyGUI_TabItem.cpp:73
MyGUI::TabItem::setButtonWidth
void setButtonWidth(int _value=DEFAULT)
Set button width.
Definition: MyGUI_TabItem.cpp:66
MyGUI::TabItem::getCaption
virtual const UString & getCaption()
Definition: MyGUI_TabItem.cpp:58
MyGUI::TabControl
Definition: MyGUI_TabControl.h:38