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

CEGUIEditboxProperties.cpp

Go to the documentation of this file.
00001 /************************************************************************
00002         filename:       CEGUIEditboxProperties.cpp
00003         created:        9/7/2004
00004         author:         Paul D Turner
00005         
00006         purpose:        Implements properties for the Editbox 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/CEGUIEditboxProperties.h"
00027 #include "elements/CEGUIEditbox.h"
00028 #include "CEGUIPropertyHelper.h"
00029 #include "CEGUIExceptions.h"
00030 #include <cstdlib>
00031 #include <cstdio>
00032 
00033 
00034 // Start of CEGUI namespace section
00035 namespace CEGUI
00036 {
00037 
00038 // Start of EditboxProperties namespace section
00039 namespace EditboxProperties
00040 {
00041 
00042 String ReadOnly::get(const PropertyReceiver* receiver) const
00043 {
00044         return PropertyHelper::boolToString(static_cast<const Editbox*>(receiver)->isReadOnly());
00045 }
00046 
00047 
00048 void ReadOnly::set(PropertyReceiver* receiver, const String& value)
00049 {
00050         static_cast<Editbox*>(receiver)->setReadOnly(PropertyHelper::stringToBool(value));
00051 }
00052 
00053 
00054 String MaskText::get(const PropertyReceiver* receiver) const
00055 {
00056         return PropertyHelper::boolToString(static_cast<const Editbox*>(receiver)->isTextMasked());
00057 }
00058 
00059 
00060 void MaskText::set(PropertyReceiver* receiver, const String& value)
00061 {
00062         static_cast<Editbox*>(receiver)->setTextMasked(PropertyHelper::stringToBool(value));
00063 }
00064 
00065 
00066 String MaskCodepoint::get(const PropertyReceiver* receiver) const
00067 {
00068         return PropertyHelper::uintToString(static_cast<const Editbox*>(receiver)->getMaskCodePoint());
00069 }
00070 
00071 
00072 void MaskCodepoint::set(PropertyReceiver* receiver, const String& value)
00073 {
00074         static_cast<Editbox*>(receiver)->setMaskCodePoint(PropertyHelper::stringToUint(value));
00075 }
00076 
00077 
00078 String ValidationString::get(const PropertyReceiver* receiver) const
00079 {
00080         return static_cast<const Editbox*>(receiver)->getValidationString();
00081 }
00082 
00083 
00084 void ValidationString::set(PropertyReceiver* receiver, const String& value)
00085 {
00086         static_cast<Editbox*>(receiver)->setValidationString(value);
00087 }
00088 
00089 
00090 String CaratIndex::get(const PropertyReceiver* receiver) const
00091 {
00092         return PropertyHelper::uintToString(static_cast<const Editbox*>(receiver)->getCaratIndex());
00093 }
00094 
00095 
00096 void CaratIndex::set(PropertyReceiver* receiver, const String& value)
00097 {
00098         static_cast<Editbox*>(receiver)->setCaratIndex(PropertyHelper::stringToUint(value));
00099 }
00100 
00101 
00102 String SelectionStart::get(const PropertyReceiver* receiver) const
00103 {
00104         return PropertyHelper::uintToString(static_cast<const Editbox*>(receiver)->getSelectionStartIndex());
00105 }
00106 
00107 
00108 void SelectionStart::set(PropertyReceiver* receiver, const String& value)
00109 {
00110         Editbox* eb = static_cast<Editbox*>(receiver);
00111         uint selStart = PropertyHelper::stringToUint(value);
00112         eb->setSelection(selStart, selStart + eb->getSelectionLength());
00113 }
00114 
00115 
00116 String SelectionLength::get(const PropertyReceiver* receiver) const
00117 {
00118         return PropertyHelper::uintToString(static_cast<const Editbox*>(receiver)->getSelectionLength());
00119 }
00120 
00121 
00122 void SelectionLength::set(PropertyReceiver* receiver, const String& value)
00123 {
00124         Editbox* eb = static_cast<Editbox*>(receiver);
00125         uint selLen = PropertyHelper::stringToUint(value);
00126         eb->setSelection(eb->getSelectionStartIndex(), eb->getSelectionStartIndex() + selLen);
00127 }
00128 
00129 
00130 String MaxTextLength::get(const PropertyReceiver* receiver) const
00131 {
00132         return PropertyHelper::uintToString(static_cast<const Editbox*>(receiver)->getMaxTextLength());
00133 }
00134 
00135 
00136 void MaxTextLength::set(PropertyReceiver* receiver, const String& value)
00137 {
00138         static_cast<Editbox*>(receiver)->setMaxTextLength(PropertyHelper::stringToUint(value));
00139 }
00140 
00141 
00142 String NormalTextColour::get(const PropertyReceiver* receiver) const
00143 {
00144         return PropertyHelper::colourToString(static_cast<const Editbox*>(receiver)->getNormalTextColour());
00145 }
00146 
00147 
00148 void NormalTextColour::set(PropertyReceiver* receiver, const String& value)
00149 {
00150         static_cast<Editbox*>(receiver)->setNormalTextColour(PropertyHelper::stringToColour(value));
00151 }
00152 
00153 
00154 String SelectedTextColour::get(const PropertyReceiver* receiver) const
00155 {
00156         return PropertyHelper::colourToString(static_cast<const Editbox*>(receiver)->getSelectedTextColour());
00157 }
00158 
00159 
00160 void SelectedTextColour::set(PropertyReceiver* receiver, const String& value)
00161 {
00162         static_cast<Editbox*>(receiver)->setSelectedTextColour(PropertyHelper::stringToColour(value));
00163 }
00164 
00165 
00166 String ActiveSelectionColour::get(const PropertyReceiver* receiver) const
00167 {
00168         return PropertyHelper::colourToString(static_cast<const Editbox*>(receiver)->getNormalSelectBrushColour());
00169 }
00170 
00171 
00172 void ActiveSelectionColour::set(PropertyReceiver* receiver, const String& value)
00173 {
00174         static_cast<Editbox*>(receiver)->setNormalSelectBrushColour(PropertyHelper::stringToColour(value));
00175 }
00176 
00177 
00178 String InactiveSelectionColour::get(const PropertyReceiver* receiver) const
00179 {
00180         return PropertyHelper::colourToString(static_cast<const Editbox*>(receiver)->getInactiveSelectBrushColour());
00181 }
00182 
00183 
00184 void InactiveSelectionColour::set(PropertyReceiver* receiver, const String& value)
00185 {
00186         static_cast<Editbox*>(receiver)->setInactiveSelectBrushColour(PropertyHelper::stringToColour(value));
00187 }
00188 
00189 } // End of  EditboxProperties namespace section
00190 
00191 } // End of  CEGUI namespace section

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