00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
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
00035 namespace CEGUI
00036 {
00037
00038
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 }
00190
00191 }