MyGUI 3.2.0

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

- File List
- Globals

MyGUI_MultiListItem.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_MultiListItem.h"
24 #include "MyGUI_MultiListBox.h"
25
26 namespace MyGUI
27 {
28
29 MultiListItem::MultiListItem()
30 {
31 }
32
33 void MultiListItem::initialiseOverride()
34 {
35 Base::initialiseOverride();
36 }
37
38 void MultiListItem::shutdownOverride()
39 {
40 Base::shutdownOverride();
41 }
42
43 void MultiListItem::setCaption(const UString& _value)
44 {
45 MultiListBox* owner = getOwner();
46 if (owner != nullptr)
47 owner->setColumnName(this, _value);
48 else
49 Base::setCaption(_value);
50 }
51
52 const UString& MultiListItem::getCaption()
53 {
54 MultiListBox* owner = getOwner();
55 if (owner != nullptr)
56 return owner->getColumnName(this);
57
58 return Base::getCaption();
59 }
60
61 void MultiListItem::setItemResizingPolicy(ResizingPolicy _value)
62 {
63 MultiListBox* owner = getOwner();
64 if (owner != nullptr)
65 owner->setColumnResizingPolicy(this, _value);
66 }
67
68 void MultiListItem::setItemWidth(int _value)
69 {
70 MultiListBox* owner = getOwner();
71 if (owner != nullptr)
72 owner->setColumnWidth(this, _value);
73 }
74
75 void MultiListItem::setPropertyOverride(const std::string& _key, const std::string& _value)
76 {
77 if (_key == "ItemResizingPolicy")
78 setItemResizingPolicy(ResizingPolicy::parse(_value));
79 else if (_key == "ItemWidth")
80 setItemWidth(utility::parseValue<int>(_value));
81 else
82 {
83 Base::setPropertyOverride(_key, _value);
84 return;
85 }
86 eventChangeProperty(this, _key, _value);
87 }
88
89 MultiListBox* MultiListItem::getOwner()
90 {
91 if (getParent() != nullptr)
92 {
93 if (getParent()->isType<MultiListBox>())
94 return getParent()->castType<MultiListBox>();
95 else if ((getParent()->getParent() != nullptr) && (getParent()->getParent()->getClientWidget() == getParent()))
96 {
97 if (getParent()->getParent()->isType<MultiListBox>())
98 return getParent()->getParent()->castType<MultiListBox>();
99 }
100 }
101
102 return nullptr;
103 }
104
105 } // namespace MyGUI
MyGUI_Precompiled.h
MyGUI::MultiListItem::setPropertyOverride
virtual void setPropertyOverride(const std::string &_key, const std::string &_value)
Definition: MyGUI_MultiListItem.cpp:75
MyGUI::Widget::getClientWidget
Widget * getClientWidget()
Definition: MyGUI_Widget.cpp:1260
MyGUI::MultiListItem::setItemResizingPolicy
void setItemResizingPolicy(ResizingPolicy _value)
Definition: MyGUI_MultiListItem.cpp:61
MyGUI::MultiListBox::setColumnWidth
void setColumnWidth(MultiListItem *_item, int _width)
Definition: MyGUI_MultiListBox.cpp:811
MyGUI::MultiListItem::getCaption
virtual const UString & getCaption()
Definition: MyGUI_MultiListItem.cpp:52
MyGUI::MultiListBox::setColumnResizingPolicy
void setColumnResizingPolicy(MultiListItem *_item, ResizingPolicy _value)
Definition: MyGUI_MultiListBox.cpp:799
MyGUI_MultiListBox.h
MyGUI_MultiListItem.h
MyGUI::ResizingPolicy
Definition: MyGUI_ResizingPolicy.h:30
MyGUI::Widget::eventChangeProperty
EventHandle_WidgetStringString eventChangeProperty
Definition: MyGUI_Widget.h:271
MyGUI::MultiListItem::initialiseOverride
virtual void initialiseOverride()
Definition: MyGUI_MultiListItem.cpp:33
MyGUI::MultiListItem::setItemWidth
void setItemWidth(int _value)
Definition: MyGUI_MultiListItem.cpp:68
MyGUI::MultiListItem::MultiListItem
MultiListItem()
Definition: MyGUI_MultiListItem.cpp:29
MyGUI::IObject::castType
Type * castType(bool _throw=true)
Definition: MyGUI_IObject.h:33
MyGUI::ResizingPolicy::parse
static ResizingPolicy parse(const std::string &_value)
Definition: MyGUI_ResizingPolicy.h:45
MyGUI::Widget::isType
virtual bool isType(const std::type_info &_type) const
Definition: MyGUI_Widget.h:53
MyGUI::MultiListItem::shutdownOverride
virtual void shutdownOverride()
Definition: MyGUI_MultiListItem.cpp:38
MyGUI::Widget::getParent
Widget * getParent() const
Definition: MyGUI_Widget.cpp:1245
MyGUI::MultiListBox
Definition: MyGUI_MultiListBox.h:44
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition: MyGUI_UString.h:169
MyGUI::MultiListBox::getColumnName
const UString & getColumnName(MultiListItem *_item)
Definition: MyGUI_MultiListBox.cpp:783
MyGUI::MultiListItem::setCaption
virtual void setCaption(const UString &_value)
Definition: MyGUI_MultiListItem.cpp:43
MyGUI::MultiListBox::setColumnName
void setColumnName(MultiListItem *_item, const UString &_name)
Definition: MyGUI_MultiListBox.cpp:778