[4744] | 1 | /* |
---|
[1853] | 2 | orxonox - the future of 3D-vertical-scrollers |
---|
| 3 | |
---|
| 4 | Copyright (C) 2004 orx |
---|
| 5 | |
---|
| 6 | This program is free software; you can redistribute it and/or modify |
---|
| 7 | it under the terms of the GNU General Public License as published by |
---|
| 8 | the Free Software Foundation; either version 2, or (at your option) |
---|
| 9 | any later version. |
---|
[1855] | 10 | |
---|
| 11 | ### File Specific: |
---|
| 12 | main-programmer: ... |
---|
| 13 | co-programmer: ... |
---|
[1853] | 14 | */ |
---|
| 15 | |
---|
[3955] | 16 | //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ |
---|
[1853] | 17 | |
---|
[8141] | 18 | #include "glgui_style.h" |
---|
[1853] | 19 | |
---|
[8448] | 20 | #include "loading/load_param.h" |
---|
| 21 | |
---|
[8141] | 22 | namespace OrxGui |
---|
| 23 | { |
---|
[1853] | 24 | |
---|
[1856] | 25 | |
---|
[8141] | 26 | /** |
---|
| 27 | * @brief standard constructor |
---|
| 28 | */ |
---|
[8448] | 29 | GLGuiStyle::GLGuiStyle (const TiXmlElement* root) |
---|
[8141] | 30 | { |
---|
[8518] | 31 | _font = NULL; |
---|
| 32 | this->reset(); |
---|
| 33 | |
---|
| 34 | |
---|
[8448] | 35 | if (root != NULL) |
---|
| 36 | this->loadParams(root); |
---|
| 37 | |
---|
[8141] | 38 | } |
---|
[4320] | 39 | |
---|
| 40 | |
---|
[8141] | 41 | /** |
---|
| 42 | * @brief standard deconstructor |
---|
[4320] | 43 | */ |
---|
[8141] | 44 | GLGuiStyle::~GLGuiStyle () |
---|
| 45 | { |
---|
| 46 | // delete what has to be deleted here |
---|
| 47 | } |
---|
[8448] | 48 | |
---|
[8518] | 49 | void GLGuiStyle::reset() |
---|
[8448] | 50 | { |
---|
[8518] | 51 | this->setBorderLeft(1.0); |
---|
| 52 | this->setBorderRight(1.0); |
---|
| 53 | this->setBorderTop(1.0); |
---|
| 54 | this->setBorderBottom(1.0); |
---|
| 55 | |
---|
| 56 | this->setTextSize(20.0); |
---|
| 57 | this->setBackgroundColor(1.0); |
---|
| 58 | this->setForegroundColor(1.0); |
---|
| 59 | |
---|
| 60 | this->setFeaturePosition(FeatureLeft); |
---|
| 61 | this->setFont(NULL); |
---|
| 62 | |
---|
| 63 | this->setAnimated(true); |
---|
| 64 | this->setAnimatedStateChanges(true); |
---|
[8448] | 65 | } |
---|
| 66 | |
---|
[8518] | 67 | void GLGuiStyle::loadParams(const TiXmlElement* root) |
---|
| 68 | {} |
---|
| 69 | |
---|
[8448] | 70 | void GLGuiStyle::setBorderLeft(float value) |
---|
| 71 | { |
---|
| 72 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
| 73 | setBorderLeft(value, (OrxGui::State)i); |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | void GLGuiStyle::setBorderLeft(float value, OrxGui::State state) |
---|
[8518] | 77 | { |
---|
| 78 | _style[state]._borderLeft = value; |
---|
| 79 | } |
---|
[8448] | 80 | |
---|
| 81 | void GLGuiStyle::setBorderLeftS(float value, const std::string& state) |
---|
[8518] | 82 | { |
---|
| 83 | } |
---|
[8448] | 84 | |
---|
| 85 | |
---|
| 86 | void GLGuiStyle::setBorderRight(float value) |
---|
| 87 | { |
---|
| 88 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
| 89 | setBorderRight(value, (OrxGui::State)i); |
---|
| 90 | } |
---|
| 91 | |
---|
| 92 | void GLGuiStyle::setBorderRight(float value, OrxGui::State state) |
---|
[8518] | 93 | { |
---|
| 94 | _style[state]._borderRight = value; |
---|
| 95 | } |
---|
[8448] | 96 | |
---|
| 97 | void GLGuiStyle::setBorderRightS(float value, const std::string& state) |
---|
| 98 | {} |
---|
| 99 | |
---|
| 100 | |
---|
| 101 | void GLGuiStyle::setBorderTop(float value) |
---|
| 102 | { |
---|
| 103 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
| 104 | setBorderTop(value, (OrxGui::State)i); |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | void GLGuiStyle::setBorderTop(float value, OrxGui::State state) |
---|
[8518] | 108 | { |
---|
| 109 | _style[state]._borderTop = value; |
---|
| 110 | } |
---|
[8448] | 111 | |
---|
| 112 | void GLGuiStyle::setBorderTopS(float value, const std::string& state) |
---|
| 113 | {} |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | void GLGuiStyle::setBorderBottom(float value) |
---|
| 117 | { |
---|
| 118 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
| 119 | setBorderBottom(value, (OrxGui::State)i); |
---|
| 120 | } |
---|
| 121 | |
---|
| 122 | void GLGuiStyle::setBorderBottom(float value, OrxGui::State state) |
---|
[8518] | 123 | { |
---|
| 124 | _style[state]._borderBottom = value; |
---|
| 125 | } |
---|
[8448] | 126 | |
---|
| 127 | void GLGuiStyle::setBorderBottomS(float value, const std::string& state) |
---|
| 128 | {} |
---|
| 129 | |
---|
| 130 | |
---|
| 131 | void GLGuiStyle::setTextSize(float value) |
---|
| 132 | { |
---|
| 133 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
| 134 | setTextSize(value, (OrxGui::State)i); |
---|
| 135 | } |
---|
| 136 | |
---|
| 137 | void GLGuiStyle::setTextSize(float value, OrxGui::State state) |
---|
[8518] | 138 | { |
---|
| 139 | _style[state]._textSize = value; |
---|
| 140 | } |
---|
[8448] | 141 | |
---|
| 142 | void GLGuiStyle::setTextSizeS(float value, const std::string& state) |
---|
| 143 | {} |
---|
| 144 | |
---|
| 145 | |
---|
| 146 | void GLGuiStyle::setBackgroundColor(const Color& color) |
---|
| 147 | { |
---|
| 148 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
| 149 | setBackgroundColor(color, (OrxGui::State)i); |
---|
| 150 | } |
---|
| 151 | |
---|
| 152 | void GLGuiStyle::setBackgroundColor(const Color& color, OrxGui::State state) |
---|
[8518] | 153 | { |
---|
| 154 | _style[state]._backgroundColor = color; |
---|
| 155 | } |
---|
[8448] | 156 | |
---|
| 157 | void GLGuiStyle::setBackgroundColorS(float r, float g, float b, float a, const std::string& state) |
---|
| 158 | {} |
---|
| 159 | |
---|
| 160 | |
---|
| 161 | void GLGuiStyle::setBackgroundTexture(const Texture& texture) |
---|
| 162 | { |
---|
| 163 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
| 164 | setBackgroundTexture(texture, (OrxGui::State)i); |
---|
| 165 | } |
---|
| 166 | |
---|
| 167 | void GLGuiStyle::setBackgroundTexture(const Texture& texture, OrxGui::State state) |
---|
[8518] | 168 | { |
---|
| 169 | _style[state]._backgroundTexture = texture; |
---|
| 170 | } |
---|
[8448] | 171 | |
---|
| 172 | void GLGuiStyle::setBackgroundTexture(const std::string& textureName, const std::string& state) |
---|
| 173 | {} |
---|
| 174 | |
---|
| 175 | |
---|
| 176 | void GLGuiStyle::setForegroundColor(const Color& color) |
---|
| 177 | { |
---|
| 178 | for (unsigned int i = 0; i < GLGUI_STATE_COUNT; ++i) |
---|
| 179 | setForegroundColor(color, (OrxGui::State)i); |
---|
| 180 | } |
---|
| 181 | |
---|
| 182 | void GLGuiStyle::setForegroundColor(const Color& color, OrxGui::State state) |
---|
[8518] | 183 | { |
---|
| 184 | _style[state]._foregroundColor = color; |
---|
| 185 | } |
---|
[8448] | 186 | |
---|
| 187 | void GLGuiStyle::setForegroundColorS(float r, float g, float b, float a, const std::string& state) |
---|
| 188 | {} |
---|
| 189 | |
---|
| 190 | |
---|
| 191 | |
---|
| 192 | void GLGuiStyle::setFeaturePosition(FeaturePosition featurePosition) |
---|
| 193 | { |
---|
| 194 | this->_featurePosition = featurePosition; |
---|
| 195 | } |
---|
| 196 | |
---|
| 197 | void GLGuiStyle::setFeaturePosition(const std::string& featurePosition) |
---|
[8518] | 198 | {} |
---|
[8448] | 199 | |
---|
| 200 | |
---|
| 201 | void GLGuiStyle::setFont(Font* font) |
---|
| 202 | { |
---|
| 203 | this->_font = font; |
---|
| 204 | } |
---|
| 205 | |
---|
| 206 | void GLGuiStyle::setFont(const std::string& fontName) |
---|
| 207 | { |
---|
| 208 | //this->font = new Font(fontName); |
---|
| 209 | } |
---|
| 210 | |
---|
| 211 | |
---|
| 212 | void GLGuiStyle::setAnimated(bool animated) |
---|
| 213 | { |
---|
| 214 | this->_animated = animated; |
---|
| 215 | } |
---|
| 216 | |
---|
[8518] | 217 | void GLGuiStyle::setAnimatedStateChanges(bool animated) |
---|
[8448] | 218 | { |
---|
| 219 | this->_animatedStateChanges = animated; |
---|
| 220 | } |
---|
| 221 | |
---|
[3365] | 222 | } |
---|