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/CEGUIStaticTextProperties.h"
00027 #include "elements/CEGUIStaticText.h"
00028 #include "CEGUIPropertyHelper.h"
00029
00030
00031
00032 namespace CEGUI
00033 {
00034
00035
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 }
00177
00178 }