Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CEGUITabControlProperties.cpp

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUITabControlProperties.cpp
00003         created:        08/08/2004
00004         author:         Steve Streeting
00005         
00006         purpose:        Implements Listbox Property classes
00007 *************************************************************************/
00008 /*************************************************************************
00009     Crazy Eddie's GUI System (http://www.cegui.org.uk)
00010     Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
00011 
00012     This library is free software; you can redistribute it and/or
00013     modify it under the terms of the GNU Lesser General Public
00014     License as published by the Free Software Foundation; either
00015     version 2.1 of the License, or (at your option) any later version.
00016 
00017     This library is distributed in the hope that it will be useful,
00018     but WITHOUT ANY WARRANTY; without even the implied warranty of
00019     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020     Lesser General Public License for more details.
00021 
00022     You should have received a copy of the GNU Lesser General Public
00023     License along with this library; if not, write to the Free Software
00024     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025 *************************************************************************/
00026 #include "elements/CEGUITabControlProperties.h"
00027 #include "elements/CEGUITabControl.h"
00028 #include "CEGUIPropertyHelper.h"
00029 
00030 
00031 // Start of CEGUI namespace section
00032 namespace CEGUI
00033 {
00034 
00035 // Start of TabControlProperties namespace section
00036 namespace TabControlProperties
00037 {
00038 String  AbsoluteTabHeight::get(const PropertyReceiver* receiver) const
00039 {
00040     return PropertyHelper::floatToString(static_cast<const TabControl*>(receiver)->getAbsoluteTabHeight());
00041 }
00042 
00043 
00044 void    AbsoluteTabHeight::set(PropertyReceiver* receiver, const String& value)
00045 {
00046         static_cast<TabControl*>(receiver)->setAbsoluteTabHeight(PropertyHelper::stringToFloat(value));
00047 }
00048 
00049 String  RelativeTabHeight::get(const PropertyReceiver* receiver) const
00050 {
00051     return PropertyHelper::floatToString(static_cast<const TabControl*>(receiver)->getRelativeTabHeight());
00052 }
00053 
00054 bool    AbsoluteTabHeight::isDefault(const PropertyReceiver* receiver) const
00055 {
00056         return static_cast<const TabControl*>(receiver)->getRelativeTabHeight() == 0.05f;
00057 }
00058 
00059 String  AbsoluteTabHeight::getDefault(const PropertyReceiver* receiver) const
00060 {
00061         float defval = 0;
00062         Window* par = static_cast<const TabControl*>(receiver)->getParent();
00063 
00064         if (par != 0)
00065         {
00066                 defval = par->relativeToAbsoluteY(0.05f);
00067         }
00068 
00069         return PropertyHelper::floatToString(defval);
00070 }
00071 
00072 
00073 void    RelativeTabHeight::set(PropertyReceiver* receiver, const String& value)
00074 {
00075     static_cast<TabControl*>(receiver)->setRelativeTabHeight(PropertyHelper::stringToFloat(value));
00076 }
00077 
00078 
00079 String  TabHeight::get(const PropertyReceiver* receiver) const
00080 {
00081     return PropertyHelper::floatToString(static_cast<const TabControl*>(receiver)->getTabHeight());
00082 }
00083 
00084 
00085 void    TabHeight::set(PropertyReceiver* receiver, const String& value)
00086 {
00087     static_cast<TabControl*>(receiver)->setTabHeight(PropertyHelper::stringToFloat(value));
00088 }
00089 
00090 bool TabHeight::isDefault(const PropertyReceiver* receiver) const
00091 {
00092         if (static_cast<const TabControl*>(receiver)->getMetricsMode() == Relative)
00093         {
00094                 return static_cast<const TabControl*>(receiver)->isPropertyDefault("RelativeTabHeight");
00095         }
00096         else
00097         {
00098                 return static_cast<const TabControl*>(receiver)->isPropertyDefault("AbsoluteTabHeight");
00099         }
00100 }
00101 
00102 String TabHeight::getDefault(const PropertyReceiver* receiver) const
00103 {
00104         if (static_cast<const TabControl*>(receiver)->getMetricsMode() == Relative)
00105         {
00106                 return static_cast<const TabControl*>(receiver)->getPropertyDefault("RelativeTabHeight");
00107         }
00108         else
00109         {
00110                 return static_cast<const TabControl*>(receiver)->getPropertyDefault("AbsoluteTabHeight");
00111         }
00112 }
00113 
00114 
00115 
00116 String  AbsoluteTabTextPadding::get(const PropertyReceiver* receiver) const
00117 {
00118     return PropertyHelper::floatToString(static_cast<const TabControl*>(receiver)->getAbsoluteTabTextPadding());
00119 }
00120 
00121 
00122 void    AbsoluteTabTextPadding::set(PropertyReceiver* receiver, const String& value)
00123 {
00124     static_cast<TabControl*>(receiver)->setAbsoluteTabTextPadding(PropertyHelper::stringToFloat(value));
00125 }
00126 
00127 String  RelativeTabTextPadding::get(const PropertyReceiver* receiver) const
00128 {
00129     return PropertyHelper::floatToString(static_cast<const TabControl*>(receiver)->getRelativeTabTextPadding());
00130 }
00131 
00132 
00133 void    RelativeTabTextPadding::set(PropertyReceiver* receiver, const String& value)
00134 {
00135     static_cast<TabControl*>(receiver)->setRelativeTabTextPadding(PropertyHelper::stringToFloat(value));
00136 }
00137 
00138 bool    RelativeTabTextPadding::isDefault(const PropertyReceiver* receiver) const
00139 {
00140         return static_cast<const TabControl*>(receiver)->getAbsoluteTabTextPadding() == 5.0f;
00141 }
00142 
00143 String  RelativeTabTextPadding::getDefault(const PropertyReceiver* receiver) const
00144 {
00145         float defval = 0;
00146         Window* par = static_cast<const TabControl*>(receiver)->getParent();
00147 
00148         if (par != 0)
00149         {
00150                 defval = par->absoluteToRelativeY(5.0f);
00151         }
00152 
00153         return PropertyHelper::floatToString(defval);
00154 }
00155 
00156 
00157 
00158 String  TabTextPadding::get(const PropertyReceiver* receiver) const
00159 {
00160     return PropertyHelper::floatToString(static_cast<const TabControl*>(receiver)->getTabTextPadding());
00161 }
00162 
00163 
00164 void    TabTextPadding::set(PropertyReceiver* receiver, const String& value)
00165 {
00166     static_cast<TabControl*>(receiver)->setTabTextPadding(PropertyHelper::stringToFloat(value));
00167 }
00168 
00169 bool    TabTextPadding::isDefault(const PropertyReceiver* receiver) const
00170 {
00171         if (static_cast<const TabControl*>(receiver)->getMetricsMode() == Relative)
00172         {
00173                 return static_cast<const TabControl*>(receiver)->isPropertyDefault("RelativeTabTextPadding");
00174         }
00175         else
00176         {
00177                 return static_cast<const TabControl*>(receiver)->isPropertyDefault("AbsoluteTabTextPadding");
00178         }
00179 }
00180 
00181 String  TabTextPadding::getDefault(const PropertyReceiver* receiver) const
00182 {
00183         if (static_cast<const TabControl*>(receiver)->getMetricsMode() == Relative)
00184         {
00185                 return static_cast<const TabControl*>(receiver)->getPropertyDefault("RelativeTabTextPadding");
00186         }
00187         else
00188         {
00189                 return static_cast<const TabControl*>(receiver)->getPropertyDefault("AbsoluteTabTextPadding");
00190         }
00191 }
00192 
00193 
00194 
00195 
00196 
00197 } // End of  TabControlProperties namespace section
00198 
00199 } // End of  CEGUI namespace section

Generated on Wed Sep 7 09:56:34 2005 for Crazy Eddies GUI System by  doxygen 1.4.3