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 
15  {
16  }
17 
19  {
20  Base::initialiseOverride();
21  }
22 
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 
38  {
39  MultiListBox* owner = getOwner();
40  if (owner != nullptr)
41  return owner->getColumnName(this);
42 
43  return Base::getCaption();
44  }
45 
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")
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  {
88  return getParent()->getParent()->castType<MultiListBox>();
89  }
90  }
91 
92  return nullptr;
93  }
94 
95 } // namespace MyGUI
virtual void setPropertyOverride(const std::string &_key, const std::string &_value)
Widget * getClientWidget()
void setItemResizingPolicy(ResizingPolicy _value)
void setColumnWidth(MultiListItem *_item, int _width)
virtual const UString & getCaption()
void setColumnResizingPolicy(MultiListItem *_item, ResizingPolicy _value)
EventHandle_WidgetStringString eventChangeProperty
Definition: MyGUI_Widget.h:266
virtual void initialiseOverride()
void setItemWidth(int _value)
Type * castType(bool _throw=true)
Definition: MyGUI_IObject.h:18
static ResizingPolicy parse(const std::string &_value)
virtual bool isType(const std::type_info &_type) const
Definition: MyGUI_Widget.h:41
virtual void shutdownOverride()
Widget * getParent() const
MultiListBox properties. MultiListBox_skin_childs Skin childs. MultiListBox widget description shoul...
A UTF-16 string with implicit conversion to/from std::string and std::wstring.
const UString & getColumnName(MultiListItem *_item)
virtual void setCaption(const UString &_value)
void setColumnName(MultiListItem *_item, const UString &_name)