MyGUI  3.2.0
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 
30  {
31  }
32 
34  {
35  Base::initialiseOverride();
36  }
37 
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 
53  {
54  MultiListBox* owner = getOwner();
55  if (owner != nullptr)
56  return owner->getColumnName(this);
57 
58  return Base::getCaption();
59  }
60 
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")
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  {
98  return getParent()->getParent()->castType<MultiListBox>();
99  }
100  }
101 
102  return nullptr;
103  }
104 
105 } // namespace MyGUI