• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List
  • Globals

MyGUI_TabItem.cpp

Go to the documentation of this file.
00001 
00007 /*
00008     This file is part of MyGUI.
00009     
00010     MyGUI is free software: you can redistribute it and/or modify
00011     it under the terms of the GNU Lesser General Public License as published by
00012     the Free Software Foundation, either version 3 of the License, or
00013     (at your option) any later version.
00014     
00015     MyGUI is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018     GNU Lesser General Public License for more details.
00019     
00020     You should have received a copy of the GNU Lesser General Public License
00021     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00022 */
00023 #include "MyGUI_Precompiled.h"
00024 #include "MyGUI_TabItem.h"
00025 
00026 namespace MyGUI
00027 {
00028 
00029     TabItem::TabItem()
00030     {
00031     }
00032 
00033     void TabItem::_initialise(WidgetStyle _style, const IntCoord& _coord, Align _align, ResourceSkin* _info, WidgetPtr _parent, ICroppedRectangle * _croppedParent, IWidgetCreator * _creator, const std::string& _name)
00034     {
00035         Base::_initialise(_style, _coord, _align, _info, _parent, _croppedParent, _creator, _name);
00036 
00037         mOwner = getParent()->castType<Tab>();
00038     }
00039 
00040     TabItem::~TabItem()
00041     {
00042         mOwner->_notifyDeleteItem(this);
00043     }
00044 
00045     void TabItem::setSelected(bool _value)
00046     {
00047         if (_value) setItemSelected();
00048     }
00049 
00050     void TabItem::setCaption(const UString& _value)
00051     {
00052         mOwner->setItemName(this, _value);
00053     }
00054 
00055     const UString& TabItem::getCaption()
00056     {
00057         return mOwner->getItemName(this);
00058     }
00059 
00060     void TabItem::setButtonWidth(int _width)
00061     {
00062         mOwner->setButtonWidth(this, _width);
00063     }
00064 
00065     int TabItem::getButtonWidth()
00066     {
00067         return mOwner->getButtonWidth(this);
00068     }
00069 
00070     const UString& TabItem::getItemName()
00071     {
00072         return mOwner->getItemName(this);
00073     }
00074 
00075     void TabItem::setItemName(const UString& _name)
00076     {
00077         mOwner->setItemName(this, _name);
00078     }
00079 
00080     void TabItem::setItemData(Any _data)
00081     {
00082         mOwner->setItemData(this, _data);
00083     }
00084 
00085     void TabItem::setItemSelected()
00086     {
00087         mOwner->setItemSelected(this);
00088     }
00089 
00090     void TabItem::removeItem()
00091     {
00092         mOwner->removeItem(this);
00093     }
00094 
00095     void TabItem::setProperty(const std::string& _key, const std::string& _value)
00096     {
00097         if (_key == "TabItem_ButtonWidth") setButtonWidth(utility::parseValue<int>(_value));
00098         else if (_key == "TabItem_Select") setSelected(utility::parseValue<bool>(_value));
00099 
00100 #ifndef MYGUI_DONT_USE_OBSOLETE
00101         else if (_key == "Sheet_ButtonWidth")
00102         {
00103             MYGUI_LOG(Warning, "Sheet_ButtonWidth is obsolete, use TabItem_ButtonWidth");
00104             setButtonWidth(utility::parseValue<int>(_value));
00105         }
00106         else if (_key == "Sheet_Select")
00107         {
00108             MYGUI_LOG(Warning, "Sheet_Select is obsolete, use TabItem_Select");
00109             setSelected(utility::parseValue<bool>(_value));
00110         }
00111 #endif // MYGUI_DONT_USE_OBSOLETE
00112 
00113         else Base::setProperty(_key, _value);
00114     }
00115 
00116 } // namespace MyGUI

Generated on Sun Jan 30 2011 for MyGUI by  doxygen 1.7.1