MyGUI  3.2.0
MyGUI_TabItem.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_TabItem.h"
24 
25 namespace MyGUI
26 {
27 
29  {
30  }
31 
33  {
34  Base::initialiseOverride();
35 
36  // FIXME проверить смену скина ибо должно один раз вызываться
37  //mOwner = getParent()->castType<TabControl>();
38  }
39 
41  {
42  TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
43  if (owner != nullptr)
44  owner->_notifyDeleteItem(this);
45 
46  Base::shutdownOverride();
47  }
48 
49  void TabItem::setCaption(const UString& _value)
50  {
51  TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
52  if (owner != nullptr)
53  owner->setItemName(this, _value);
54  else
55  Base::setCaption(_value);
56  }
57 
59  {
60  TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
61  if (owner != nullptr)
62  return owner->getItemName(this);
63  return Base::getCaption();
64  }
65 
66  void TabItem::setButtonWidth(int _width)
67  {
68  TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
69  if (owner != nullptr)
70  owner->setButtonWidth(this, _width);
71  }
72 
73  void TabItem::setPropertyOverride(const std::string& _key, const std::string& _value)
74  {
75  if (_key == "ButtonWidth")
76  setButtonWidth(utility::parseValue<int>(_value));
77  else
78  {
79  Base::setPropertyOverride(_key, _value);
80  return;
81  }
82  eventChangeProperty(this, _key, _value);
83  }
84 
85 } // namespace MyGUI