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

CEGUIStaticTextProperties.cpp

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIStaticTextProperties.cpp
00003         created:        10/7/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Implements properties for the StaticText class
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/CEGUIStaticTextProperties.h"
00027 #include "elements/CEGUIStaticText.h"
00028 #include "CEGUIPropertyHelper.h"
00029 
00030 
00031 // Start of CEGUI namespace section
00032 namespace CEGUI
00033 {
00034 
00035 // Start of StaticTextProperties namespace section
00036 namespace StaticTextProperties
00037 {
00038 String  TextColours::get(const PropertyReceiver* receiver) const
00039 {
00040         return PropertyHelper::colourRectToString(static_cast<const StaticText*>(receiver)->getTextColours());
00041 }
00042 
00043 
00044 void    TextColours::set(PropertyReceiver* receiver, const String& value)
00045 {
00046         static_cast<StaticText*>(receiver)->setTextColours(PropertyHelper::stringToColourRect(value));
00047 }
00048 
00049 
00050 String  HorzFormatting::get(const PropertyReceiver* receiver) const
00051 {
00052         switch(static_cast<const StaticText*>(receiver)->getHorizontalFormatting())
00053         {
00054         case StaticText::RightAligned:
00055                 return String((utf8*)"RightAligned");
00056                 break;
00057 
00058         case StaticText::HorzCentred:
00059                 return String((utf8*)"HorzCentred");
00060                 break;
00061 
00062         case StaticText::WordWrapLeftAligned:
00063                 return String((utf8*)"WordWrapLeftAligned");
00064                 break;
00065 
00066         case StaticText::WordWrapRightAligned:
00067                 return String((utf8*)"WordWrapRightAligned");
00068                 break;
00069 
00070         case StaticText::WordWrapCentred:
00071                 return String((utf8*)"WordWrapCentred");
00072                 break;
00073 
00074         default:
00075                 return String((utf8*)"LeftAligned");
00076                 break;
00077         }
00078 }
00079 
00080 
00081 void    HorzFormatting::set(PropertyReceiver* receiver, const String& value)
00082 {
00083         StaticText::HorzFormatting fmt;
00084 
00085         if (value == (utf8*)"RightAligned")
00086         {
00087                 fmt = StaticText::RightAligned;
00088         }
00089         else if (value == (utf8*)"HorzCentred")
00090         {
00091                 fmt = StaticText::HorzCentred;
00092         }
00093         else if (value == (utf8*)"WordWrapLeftAligned")
00094         {
00095                 fmt = StaticText::WordWrapLeftAligned;
00096         }
00097         else if (value == (utf8*)"WordWrapRightAligned")
00098         {
00099                 fmt = StaticText::WordWrapRightAligned;
00100         }
00101         else if (value == (utf8*)"WordWrapCentred")
00102         {
00103                 fmt = StaticText::WordWrapCentred;
00104         }
00105         else
00106         {
00107                 fmt = StaticText::LeftAligned;
00108         }
00109 
00110         static_cast<StaticText*>(receiver)->setHorizontalFormatting(fmt);
00111 }
00112 
00113 
00114 String  VertFormatting::get(const PropertyReceiver* receiver) const
00115 {
00116         switch(static_cast<const StaticText*>(receiver)->getVerticalFormatting())
00117         {
00118         case StaticText::BottomAligned:
00119                 return String((utf8*)"BottomAligned");
00120                 break;
00121 
00122         case StaticText::VertCentred:
00123                 return String((utf8*)"VertCentred");
00124                 break;
00125 
00126         default:
00127                 return String((utf8*)"TopAligned");
00128                 break;
00129         }
00130 }
00131 
00132 
00133 void    VertFormatting::set(PropertyReceiver* receiver, const String& value)
00134 {
00135         StaticText::VertFormatting fmt;
00136 
00137         if (value == (utf8*)"BottomAligned")
00138         {
00139                 fmt = StaticText::BottomAligned;
00140         }
00141         else if (value == (utf8*)"VertCentred")
00142         {
00143                 fmt = StaticText::VertCentred;
00144         }
00145         else
00146         {
00147                 fmt = StaticText::TopAligned;
00148         }
00149 
00150         static_cast<StaticText*>(receiver)->setVerticalFormatting(fmt);
00151 }
00152 
00153 
00154 String  VertScrollbar::get(const PropertyReceiver* receiver) const
00155 {
00156         return PropertyHelper::boolToString(static_cast<const StaticText*>(receiver)->isVerticalScrollbarEnabled());
00157 }
00158 
00159 
00160 void    VertScrollbar::set(PropertyReceiver* receiver, const String& value)
00161 {
00162         static_cast<StaticText*>(receiver)->setVerticalScrollbarEnabled(PropertyHelper::stringToBool(value));
00163 }
00164 
00165 String  HorzScrollbar::get(const PropertyReceiver* receiver) const
00166 {
00167         return PropertyHelper::boolToString(static_cast<const StaticText*>(receiver)->isHorizontalScrollbarEnabled());
00168 }
00169 
00170 
00171 void    HorzScrollbar::set(PropertyReceiver* receiver, const String& value)
00172 {
00173         static_cast<StaticText*>(receiver)->setHorizontalScrollbarEnabled(PropertyHelper::stringToBool(value));
00174 }
00175 
00176 } // End of  StaticTextProperties namespace section
00177 
00178 } // End of  CEGUI namespace section

Generated on Wed Feb 16 12:41:07 2005 for Crazy Eddies GUI System by  doxygen 1.3.9.1