- Timestamp:
- May 29, 2011, 11:24:31 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/modules/notifications/NotificationQueueCEGUI.cc
r8651 r8656 95 95 void NotificationQueueCEGUI::registerVariables() 96 96 { 97 registerVariable( this->position_, VariableDirection::ToClient 98 registerVariable( this->fontSize_, VariableDirection::ToClient 99 registerVariable( this->fontColor_, VariableDirection::ToClient 100 registerVariable( this->alignment_, VariableDirection::ToClient 101 registerVariable( this->displaySize_, VariableDirection::ToClient 97 registerVariable( this->position_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::positionChanged)); 98 registerVariable( this->fontSize_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::fontSizeChanged)); 99 registerVariable( this->fontColor_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::fontColorChanged)); 100 registerVariable( this->alignment_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::alignmentChanged)); 101 registerVariable( this->displaySize_, VariableDirection::ToClient, new NetworkCallback<NotificationQueueCEGUI>(this, &NotificationQueueCEGUI::displaySizeChanged)); 102 102 } 103 103 … … 141 141 142 142 this->displaySize_ = size; 143 this->displaySizeChanged(); 144 } 145 146 /** 147 @brief 148 Is called when the display size has changed. 149 */ 150 void NotificationQueueCEGUI::displaySizeChanged(void) 151 { 143 152 if(GameMode::showsGraphics()) 144 153 { 145 if( size.z == 0.0 && size.w == 0.0)154 if(this->displaySize_.z == 0.0 && this->displaySize_.w == 0.0) 146 155 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".resizeQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->displaySize_.x) + ", " + multi_cast<std::string>(this->displaySize_.y) + ")"); 147 156 else … … 172 181 173 182 this->position_ = position; 183 this->positionChanged(); 184 } 185 186 /** 187 @brief 188 Is called when the NotificationQueue's position has changed. 189 */ 190 void NotificationQueueCEGUI::positionChanged(void) 191 { 174 192 if(GameMode::showsGraphics()) 175 193 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".moveQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->position_.x) + ", " + multi_cast<std::string>(this->position_.y) + ", " + multi_cast<std::string>(this->position_.z) + ", " + multi_cast<std::string>(this->position_.w) + ")"); … … 190 208 // TODO: Check whether the alignment string is correct? 191 209 this->alignment_ = alignment; 210 this->alignmentChanged(); 211 } 212 213 /** 214 @brief 215 Is called when the horizontal alignment of the Notifications text has changed. 216 */ 217 void NotificationQueueCEGUI::alignmentChanged(void) 218 { 192 219 if(GameMode::showsGraphics()) 193 220 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueAlignment(\"" + this->getName() + "\", \"" + this->alignment_ + "\")"); … … 206 233 207 234 this->fontSize_ = size; 235 this->fontSizeChanged(); 236 } 237 238 /** 239 @brief 240 Is called when the font size of the text displayed by this NotificationQueue has changed. 241 */ 242 void NotificationQueueCEGUI::fontSizeChanged(void) 243 { 208 244 if(GameMode::showsGraphics()) 209 245 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueFontSize(\"" + this->getName() + "\", " + multi_cast<std::string>(this->fontSize_) + ")"); … … 222 258 223 259 this->fontColor_ = color; 260 this->fontColorChanged(); 261 } 262 263 /** 264 @brief 265 Is called when the font color if the text displayed by this NotificationQueue. 266 */ 267 void NotificationQueueCEGUI::fontColorChanged(void) 268 { 224 269 // Convert to ARGB format. 225 270 std::stringstream stream; … … 227 272 stream << std::hex << std::setw(2) << std::setfill('0') << int(this->fontColor_[(i+3)%4]*255); 228 273 this->fontColorStr_ = stream.str(); 274 229 275 if(GameMode::showsGraphics()) 230 276 GUIManager::getInstance().getLuaState()->doString(NotificationQueueCEGUI::NOTIFICATION_LAYER + ".changeQueueFontColor(\"" + this->getName() + "\", \"" + this->fontColorStr_ + "\")"); … … 249 295 /** 250 296 @brief 251 Is called by the NotificationQueue when a notification was pushed.297 Is called by the NotificationQueue when a Notification was pushed. 252 298 @param notification 253 299 The Notification that was pushed. … … 262 308 /** 263 309 @brief 264 Is called by the NotificationQueue when a notification was popped.310 Is called by the NotificationQueue when a Notification was popped. 265 311 */ 266 312 void NotificationQueueCEGUI::notificationPopped(void) … … 273 319 /** 274 320 @brief Is called when a notification was removed. 275 @param index The index the removed notification was at.321 @param index The index the removed Notification was at. 276 322 */ 277 323 void NotificationQueueCEGUI::notificationRemoved(unsigned int index)
Note: See TracChangeset
for help on using the changeset viewer.