MyGUI  3.2.0
MyGUI_TabItem.cpp
Go to the documentation of this file.
00001 
00006 /*
00007     This file is part of MyGUI.
00008 
00009     MyGUI is free software: you can redistribute it and/or modify
00010     it under the terms of the GNU Lesser General Public License as published by
00011     the Free Software Foundation, either version 3 of the License, or
00012     (at your option) any later version.
00013 
00014     MyGUI is distributed in the hope that it will be useful,
00015     but WITHOUT ANY WARRANTY; without even the implied warranty of
00016     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017     GNU Lesser General Public License for more details.
00018 
00019     You should have received a copy of the GNU Lesser General Public License
00020     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00021 */
00022 #include "MyGUI_Precompiled.h"
00023 #include "MyGUI_TabItem.h"
00024 
00025 namespace MyGUI
00026 {
00027 
00028     TabItem::TabItem()
00029     {
00030     }
00031 
00032     void TabItem::initialiseOverride()
00033     {
00034         Base::initialiseOverride();
00035 
00036         // FIXME проверить смену скина ибо должно один раз вызываться
00037         //mOwner = getParent()->castType<TabControl>();
00038     }
00039 
00040     void TabItem::shutdownOverride()
00041     {
00042         TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
00043         if (owner != nullptr)
00044             owner->_notifyDeleteItem(this);
00045 
00046         Base::shutdownOverride();
00047     }
00048 
00049     void TabItem::setCaption(const UString& _value)
00050     {
00051         TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
00052         if (owner != nullptr)
00053             owner->setItemName(this, _value);
00054         else
00055             Base::setCaption(_value);
00056     }
00057 
00058     const UString& TabItem::getCaption()
00059     {
00060         TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
00061         if (owner != nullptr)
00062             return owner->getItemName(this);
00063         return Base::getCaption();
00064     }
00065 
00066     void TabItem::setButtonWidth(int _width)
00067     {
00068         TabControl* owner = getParent() != nullptr ? getParent()->castType<TabControl>(false) : nullptr;
00069         if (owner != nullptr)
00070             owner->setButtonWidth(this, _width);
00071     }
00072 
00073     void TabItem::setPropertyOverride(const std::string& _key, const std::string& _value)
00074     {
00075         if (_key == "ButtonWidth")
00076             setButtonWidth(utility::parseValue<int>(_value));
00077         else
00078         {
00079             Base::setPropertyOverride(_key, _value);
00080             return;
00081         }
00082         eventChangeProperty(this, _key, _value);
00083     }
00084 
00085 } // namespace MyGUI