MyGUI  3.2.1
MyGUI_TabItem.cpp
Go to the documentation of this file.
00001 /*
00002  * This source file is part of MyGUI. For the latest info, see http://mygui.info/
00003  * Distributed under the MIT License
00004  * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT)
00005  */
00006 
00007 #include "MyGUI_Precompiled.h"
00008 #include "MyGUI_TabItem.h"
00009 
00010 namespace MyGUI
00011 {
00012 
00013     TabItem::TabItem()
00014     {
00015     }
00016 
00017     void TabItem::initialiseOverride()
00018     {
00019         Base::initialiseOverride();
00020 
00021         // FIXME проверить смену скина ибо должно один раз вызываться
00022         //mOwner = getParent()->castType<TabControl>();
00023     }
00024 
00025     void TabItem::shutdownOverride()
00026     {
00027         TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
00028         if (owner != nullptr)
00029             owner->_notifyDeleteItem(this);
00030 
00031         Base::shutdownOverride();
00032     }
00033 
00034     void TabItem::setCaption(const UString& _value)
00035     {
00036         TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
00037         if (owner != nullptr)
00038             owner->setItemName(this, _value);
00039         else
00040             Base::setCaption(_value);
00041     }
00042 
00043     const UString& TabItem::getCaption()
00044     {
00045         TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
00046         if (owner != nullptr)
00047             return owner->getItemName(this);
00048         return Base::getCaption();
00049     }
00050 
00051     void TabItem::setButtonWidth(int _width)
00052     {
00053         TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
00054         if (owner != nullptr)
00055             owner->setButtonWidth(this, _width);
00056     }
00057 
00058     void TabItem::setPropertyOverride(const std::string& _key, const std::string& _value)
00059     {
00061         if (_key == "ButtonWidth")
00062             setButtonWidth(utility::parseValue<int>(_value));
00063 
00064         else
00065         {
00066             Base::setPropertyOverride(_key, _value);
00067             return;
00068         }
00069 
00070         eventChangeProperty(this, _key, _value);
00071     }
00072 
00073 } // namespace MyGUI