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/CEGUIStaticImageProperties.h"
00027 #include "elements/CEGUIStaticImage.h"
00028 #include "CEGUIPropertyHelper.h"
00029
00030
00031
00032 namespace CEGUI
00033 {
00034
00035
00036 namespace StaticImageProperties
00037 {
00038 String Image::get(const PropertyReceiver* receiver) const
00039 {
00040 return PropertyHelper::imageToString(static_cast<const StaticImage*>(receiver)->getImage());
00041 }
00042
00043
00044 void Image::set(PropertyReceiver* receiver, const String& value)
00045 {
00046 static_cast<StaticImage*>(receiver)->setImage(PropertyHelper::stringToImage(value));
00047 }
00048
00049
00050 String ImageColours::get(const PropertyReceiver* receiver) const
00051 {
00052 return PropertyHelper::colourRectToString(static_cast<const StaticImage*>(receiver)->getImageColours());
00053 }
00054
00055
00056 void ImageColours::set(PropertyReceiver* receiver, const String& value)
00057 {
00058 static_cast<StaticImage*>(receiver)->setImageColours(PropertyHelper::stringToColourRect(value));
00059 }
00060
00061
00062 String VertFormatting::get(const PropertyReceiver* receiver) const
00063 {
00064 switch(static_cast<const StaticImage*>(receiver)->getVerticalFormatting())
00065 {
00066 case StaticImage::TopAligned:
00067 return String((utf8*)"TopAligned");
00068 break;
00069
00070 case StaticImage::BottomAligned:
00071 return String((utf8*)"BottomAligned");
00072 break;
00073
00074 case StaticImage::VertTiled:
00075 return String((utf8*)"VertTiled");
00076 break;
00077
00078 case StaticImage::VertCentred:
00079 return String((utf8*)"VertCentred");
00080 break;
00081
00082 default:
00083 return String((utf8*)"VertStretched");
00084 break;
00085 }
00086
00087 }
00088
00089
00090 void VertFormatting::set(PropertyReceiver* receiver, const String& value)
00091 {
00092 StaticImage::VertFormatting fmt;
00093
00094 if (value == (utf8*)"TopAligned")
00095 {
00096 fmt = StaticImage::TopAligned;
00097 }
00098 else if (value == (utf8*)"BottomAligned")
00099 {
00100 fmt = StaticImage::BottomAligned;
00101 }
00102 else if (value == (utf8*)"VertTiled")
00103 {
00104 fmt = StaticImage::VertTiled;
00105 }
00106 else if (value == (utf8*)"VertCentred")
00107 {
00108 fmt = StaticImage::VertCentred;
00109 }
00110 else
00111 {
00112 fmt = StaticImage::VertStretched;
00113 }
00114
00115 static_cast<StaticImage*>(receiver)->setVerticalFormatting(fmt);
00116 }
00117
00118
00119 String HorzFormatting::get(const PropertyReceiver* receiver) const
00120 {
00121 switch(static_cast<const StaticImage*>(receiver)->getHorizontalFormatting())
00122 {
00123 case StaticImage::LeftAligned:
00124 return String((utf8*)"LeftAligned");
00125 break;
00126
00127 case StaticImage::RightAligned:
00128 return String((utf8*)"RightAligned");
00129 break;
00130
00131 case StaticImage::HorzTiled:
00132 return String((utf8*)"HorzTiled");
00133 break;
00134
00135 case StaticImage::HorzCentred:
00136 return String((utf8*)"HorzCentred");
00137 break;
00138
00139 default:
00140 return String((utf8*)"HorzStretched");
00141 break;
00142 }
00143
00144 }
00145
00146
00147 void HorzFormatting::set(PropertyReceiver* receiver, const String& value)
00148 {
00149 StaticImage::HorzFormatting fmt;
00150
00151 if (value == (utf8*)"LeftAligned")
00152 {
00153 fmt = StaticImage::LeftAligned;
00154 }
00155 else if (value == (utf8*)"RightAligned")
00156 {
00157 fmt = StaticImage::RightAligned;
00158 }
00159 else if (value == (utf8*)"HorzTiled")
00160 {
00161 fmt = StaticImage::HorzTiled;
00162 }
00163 else if (value == (utf8*)"HorzCentred")
00164 {
00165 fmt = StaticImage::HorzCentred;
00166 }
00167 else
00168 {
00169 fmt = StaticImage::HorzStretched;
00170 }
00171
00172 static_cast<StaticImage*>(receiver)->setHorizontalFormatting(fmt);
00173 }
00174
00175 }
00176
00177 }