| 137 | } |
| 138 | |
| 139 | bool PropertyColourControl::parseColour1(const std::string& _value, MyGUI::Colour& _resultValue) |
| 140 | { |
| 141 | if (!_value.empty()) |
| 142 | { |
| 143 | if (_value[0] == '#') |
| 144 | { |
| 145 | std::istringstream stream(_value.substr(1)); |
| 146 | int result = 0; |
| 147 | stream >> std::hex >> result; |
| 148 | if (!stream.fail()) |
| 149 | { |
| 150 | int item = stream.get(); |
| 151 | while (item != -1) |
| 152 | { |
| 153 | if (item != ' ' && item != '\t') |
| 154 | return false; |
| 155 | item = stream.get(); |
| 156 | } |
| 157 | |
| 158 | _resultValue = MyGUI::Colour( |
| 159 | (unsigned char)(result >> 16) / 256.0f, |
| 160 | (unsigned char)(result >> 8) / 256.0f, |
| 161 | (unsigned char)(result) / 256.0f); |
| 162 | return true; |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | |
| 167 | return false; |
| 168 | } |
| 169 | |
| 170 | bool PropertyColourControl::parseColour2(const std::string& _value, MyGUI::Colour& _resultValue) |
| 171 | { |