MyGUI 3.2.2

MyGUI_MultiListItem.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_MultiListItem.h"
9 #include "MyGUI_MultiListBox.h"
10
11 namespace MyGUI
12 {
13
14 MultiListItem::MultiListItem()
15 {
16 }
17
18 void MultiListItem::initialiseOverride()
19 {
20 Base::initialiseOverride();
21 }
22
23 void MultiListItem::shutdownOverride()
24 {
25 Base::shutdownOverride();
26 }
27
28 void MultiListItem::setCaption(const UString& _value)
29 {
30 MultiListBox* owner = getOwner();
31 if (owner != nullptr)
32 owner->setColumnName(this, _value);
33 else
34 Base::setCaption(_value);
35 }
36
37 const UString& MultiListItem::getCaption()
38 {
39 MultiListBox* owner = getOwner();
40 if (owner != nullptr)
41 return owner->getColumnName(this);
42
43 return Base::getCaption();
44 }
45
46 void MultiListItem::setItemResizingPolicy(ResizingPolicy _value)
47 {
48 MultiListBox* owner = getOwner();
49 if (owner != nullptr)
50 owner->setColumnResizingPolicy(this, _value);
51 }
52
53 void MultiListItem::setItemWidth(int _value)
54 {
55 MultiListBox* owner = getOwner();
56 if (owner != nullptr)
57 owner->setColumnWidth(this, _value);
58 }
59
60 void MultiListItem::setPropertyOverride(const std::string& _key, const std::string& _value)
61 {
63 if (_key == "ItemResizingPolicy")
64 setItemResizingPolicy(ResizingPolicy::parse(_value));
65
67 else if (_key == "ItemWidth")
68 setItemWidth(utility::parseValue<int>(_value));
69
70 else
71 {
72 Base::setPropertyOverride(_key, _value);
73 return;
74 }
75
76 eventChangeProperty(this, _key, _value);
77 }
78
79 MultiListBox* MultiListItem::getOwner()
80 {
81 if (getParent() != nullptr)
82 {
83 if (getParent()->isType<MultiListBox>())
84 return getParent()->castType<MultiListBox>();
85 else if ((getParent()->getParent() != nullptr) && (getParent()->getParent()->getClientWidget() == getParent()))
86 {
87 if (getParent()->getParent()->isType<MultiListBox>())
88 return getParent()->getParent()->castType<MultiListBox>();
89 }
90 }
91
92 return nullptr;
93 }
94
95 } // namespace MyGUI
MyGUI_Precompiled.h
MyGUI::MultiListItem::setPropertyOverride
virtual void setPropertyOverride(const std::string &_key, const std::string &_value)
Definition: MyGUI_MultiListItem.cpp:60
MyGUI::Widget::getClientWidget
Widget * getClientWidget()
Definition: MyGUI_Widget.cpp:1290
MyGUI::MultiListItem::setItemResizingPolicy
void setItemResizingPolicy(ResizingPolicy _value)
Definition: MyGUI_MultiListItem.cpp:46
MyGUI::Widget::isType
virtual bool isType(const std::type_info &_type) const
Definition: MyGUI_Widget.h:41
MyGUI::MultiListBox::setColumnWidth
void setColumnWidth(MultiListItem *_item, int _width)
Definition: MyGUI_MultiListBox.cpp:802
MyGUI::MultiListItem::getCaption
virtual const UString & getCaption()
Definition: MyGUI_MultiListItem.cpp:37
MyGUI::MultiListBox::setColumnResizingPolicy
void setColumnResizingPolicy(MultiListItem *_item, ResizingPolicy _value)
Definition: MyGUI_MultiListBox.cpp:790
MyGUI_MultiListBox.h
MyGUI_MultiListItem.h
MyGUI
Definition: MyGUI_ActionController.h:14
MyGUI::ResizingPolicy
Definition: MyGUI_ResizingPolicy.h:15
MyGUI::Widget::eventChangeProperty
EventHandle_WidgetStringString eventChangeProperty
Definition: MyGUI_Widget.h:266
MyGUI::Widget::getParent
Widget * getParent() const
Definition: MyGUI_Widget.cpp:1275
MyGUI::MultiListItem::initialiseOverride
virtual void initialiseOverride()
Definition: MyGUI_MultiListItem.cpp:18
MyGUI::MultiListItem::setItemWidth
void setItemWidth(int _value)
Definition: MyGUI_MultiListItem.cpp:53
MyGUI::MultiListItem::MultiListItem
MultiListItem()
Definition: MyGUI_MultiListItem.cpp:14
MyGUI::IObject::castType
Type * castType(bool _throw=true)
Definition: MyGUI_IObject.h:18
MyGUI::ResizingPolicy::parse
static ResizingPolicy parse(const std::string &_value)
Definition: MyGUI_ResizingPolicy.h:30
MyGUI::MultiListItem::shutdownOverride
virtual void shutdownOverride()
Definition: MyGUI_MultiListItem.cpp:23
MyGUI::MultiListBox
MultiListBox properties. MultiListBox_skin_childs Skin childs. MultiListBox widget description shoul...
Definition: MyGUI_MultiListBox.h:32
MyGUI::UString
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
Definition: MyGUI_UString.h:168
MyGUI::MultiListBox::getColumnName
const UString & getColumnName(MultiListItem *_item)
Definition: MyGUI_MultiListBox.cpp:774
MyGUI::MultiListItem::setCaption
virtual void setCaption(const UString &_value)
Definition: MyGUI_MultiListItem.cpp:28
MyGUI::MultiListBox::setColumnName
void setColumnName(MultiListItem *_item, const UString &_name)
Definition: MyGUI_MultiListBox.cpp:769