MyGUI: MyGUI_MultiListItem.cpp Source File

MyGUI 3.4.3

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
11namespace MyGUI
12{
13
14 void MultiListItem::initialiseOverride()
15 {
16 Base::initialiseOverride();
17 }
18
19 void MultiListItem::shutdownOverride()
20 {
21 Base::shutdownOverride();
22 }
23
24 void MultiListItem::setCaption(const UString& _value)
25 {
26 MultiListBox* owner = getOwner();
27 if (owner != nullptr)
28 owner->setColumnName(this, _value);
29 else
30 Base::setCaption(_value);
31 }
32
33 const UString& MultiListItem::getCaption() const
34 {
35 MultiListBox* owner = getOwner();
36 if (owner != nullptr)
37 return owner->getColumnName(this);
38
39 return Base::getCaption();
40 }
41
42 void MultiListItem::setItemResizingPolicy(ResizingPolicy _value)
43 {
44 MultiListBox* owner = getOwner();
45 if (owner != nullptr)
46 owner->setColumnResizingPolicy(this, _value);
47 }
48
49 void MultiListItem::setItemWidth(int _value)
50 {
51 MultiListBox* owner = getOwner();
52 if (owner != nullptr)
53 owner->setColumnWidth(this, _value);
54 }
55
56 void MultiListItem::setPropertyOverride(std::string_view _key, std::string_view _value)
57 {
59 if (_key == "ItemResizingPolicy")
60 setItemResizingPolicy(ResizingPolicy::parse(_value));
61
63 else if (_key == "ItemWidth")
64 setItemWidth(utility::parseValue<int>(_value));
65
66 else
67 {
68 Base::setPropertyOverride(_key, _value);
69 return;
70 }
71
72 eventChangeProperty(this, _key, _value);
73 }
74
75 MultiListBox* MultiListItem::getOwner() const
76 {
77 if (getParent() != nullptr)
78 {
79 if (getParent()->isType<MultiListBox>())
80 return getParent()->castType<MultiListBox>();
81 if ((getParent()->getParent() != nullptr) && (getParent()->getParent()->getClientWidget() == getParent()))
82 {
83 if (getParent()->getParent()->isType<MultiListBox>())
84 return getParent()->getParent()->castType<MultiListBox>();
85 }
86 }
87
88 return nullptr;
89 }
90
91} // namespace MyGUI
MyGUI_MultiListBox.h
MyGUI_MultiListItem.h
MyGUI_Precompiled.h
MyGUI::IObject::castType
Type * castType(bool _throw=true)
Definition MyGUI_IObject.h:18
MyGUI::MultiListBox
widget description should be here.
Definition MyGUI_MultiListBox.h:43
MyGUI::MultiListBox::setColumnWidth
void setColumnWidth(MultiListItem *_item, int _width)
Definition MyGUI_MultiListBox.cpp:818
MyGUI::MultiListBox::setColumnName
void setColumnName(MultiListItem *_item, const UString &_name)
Definition MyGUI_MultiListBox.cpp:785
MyGUI::MultiListBox::setColumnResizingPolicy
void setColumnResizingPolicy(MultiListItem *_item, ResizingPolicy _value)
Definition MyGUI_MultiListBox.cpp:806
MyGUI::MultiListBox::getColumnName
const UString & getColumnName(const MultiListItem *_item) const
Definition MyGUI_MultiListBox.cpp:790
MyGUI::MultiListItem::setPropertyOverride
void setPropertyOverride(std::string_view _key, std::string_view _value) override
Definition MyGUI_MultiListItem.cpp:56
MyGUI::MultiListItem::isType
bool isType() const
Definition MyGUI_MultiListItem.h:23
MyGUI::MultiListItem::setItemWidth
void setItemWidth(int _value)
Definition MyGUI_MultiListItem.cpp:49
MyGUI::MultiListItem::initialiseOverride
void initialiseOverride() override
Definition MyGUI_MultiListItem.cpp:14
MyGUI::MultiListItem::setCaption
void setCaption(const UString &_value) override
Definition MyGUI_MultiListItem.cpp:24
MyGUI::MultiListItem::getCaption
const UString & getCaption() const override
Definition MyGUI_MultiListItem.cpp:33
MyGUI::MultiListItem::setItemResizingPolicy
void setItemResizingPolicy(ResizingPolicy _value)
Definition MyGUI_MultiListItem.cpp:42
MyGUI::MultiListItem::shutdownOverride
void shutdownOverride() override
Definition MyGUI_MultiListItem.cpp:19
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::Widget::getClientWidget
Widget * getClientWidget()
Definition MyGUI_Widget.cpp:1367
MyGUI::utility::parseValue
T parseValue(std::string_view _value)
Definition MyGUI_StringUtility.h:60
MyGUI
Definition MyGUI_ActionController.h:15
MyGUI::ResizingPolicy
Definition MyGUI_ResizingPolicy.h:16
MyGUI::ResizingPolicy::parse
static ResizingPolicy parse(std::string_view _value)
Definition MyGUI_ResizingPolicy.h:30