| 198 | } |
| 199 | |
| 200 | void snapToParent(MyGUI::Widget* _child) |
| 201 | { |
| 202 | if (_child->isUserString("SnapTo")) |
| 203 | { |
| 204 | MyGUI::Align align = MyGUI::Align::parse(_child->getUserString("SnapTo")); |
| 205 | |
| 206 | MyGUI::IntCoord coord = _child->getCoord(); |
| 207 | MyGUI::IntSize size = _child->getParentSize(); |
| 208 | |
| 209 | if (align.isHStretch()) |
| 210 | { |
| 211 | coord.left = 0; |
| 212 | coord.width = size.width; |
| 213 | } |
| 214 | else if (align.isLeft()) |
| 215 | { |
| 216 | coord.left = 0; |
| 217 | } |
| 218 | else if (align.isRight()) |
| 219 | { |
| 220 | coord.left = size.width - coord.width; |
| 221 | } |
| 222 | else |
| 223 | { |
| 224 | coord.left = (size.width - coord.width) / 2; |
| 225 | } |
| 226 | |
| 227 | if (align.isVStretch()) |
| 228 | { |
| 229 | coord.top = 0; |
| 230 | coord.height = size.height; |
| 231 | } |
| 232 | else if (align.isTop()) |
| 233 | { |
| 234 | coord.top = 0; |
| 235 | } |
| 236 | else if (align.isBottom()) |
| 237 | { |
| 238 | coord.top = size.height - coord.height; |
| 239 | } |
| 240 | else |
| 241 | { |
| 242 | coord.top = (size.height - coord.height) / 2; |
| 243 | } |
| 244 | |
| 245 | _child->setCoord(coord); |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | template<typename T> |
| 250 | T* _createFakeWidget(MyGUI::Widget* _parent) |
nothing calls this directly
no test coverage detected