[Gcblue-commits] gcb_wx/include/graphics tcMessageCenter.h,NONE,1.1 tcMessageChannel.h,NONE,1.1 tcMe
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-11-14 22:53:02
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22147/include/graphics Modified Files: tc3DWindow.h Added Files: tcMessageCenter.h tcMessageChannel.h tcMessageInterface.h tcPopupMessage.h Log Message: Text message "message center" GUI screen --- NEW FILE: tcMessageCenter.h --- /** ** @file tcMessageCenter.h */ /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MESSAGECENTER_H_ #define _MESSAGECENTER_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #include "wx/string.h" #include <osg/Vec4> #include "tc3DWindow.h" class tcMessageChannel; /** * */ class tcMessageCenter : public tc3DWindow { public: void AddMessage(const std::string& channel, const std::string& msg); void Clear(); virtual void Draw(); tcMessageCenter(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name = "MessageCenter"); virtual ~tcMessageCenter(); private: std::map<std::string, tcMessageChannel*> channelMap; std::string activeChannelName; ///< name of active channel tcRect channelTab; ///< rectangle for next new channel selection button tcRect defaultTextRect; ///< text box rectangle for channels tcMessageChannel* GetChannel(const std::string& channelName); tcMessageChannel* GetOrCreateChannel(const std::string& channelName); virtual void OnLButtonDown(wxMouseEvent& event); virtual void OnMouseMove(wxMouseEvent& event); }; #endif --- NEW FILE: tcMessageChannel.h --- /** ** @file tcMessageChannel.h */ /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MESSAGECHANNEL_H_ #define _MESSAGECHANNEL_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #include "wx/string.h" #include <queue> #include <osg/Vec4> #include "tcRect.h" class tc3DWindow; /** * */ class tcMessageChannel { public: std::string channelName; std::deque<std::string> messages; ///< chat text to display void AddMessage(const std::string& msg); void Draw(tc3DWindow* graphics); std::string GetName(); bool IsActive() const; bool IsPointInActivationRect(const wxPoint& p) const; void SetActivationRect(tcRect r); void SetActive(bool state); void SetMouseOver(bool state); void SetTextRect(tcRect r); tcMessageChannel(std::string name); virtual ~tcMessageChannel(); private: float fontSize; float buttonFontSize; tcRect activationRect; ///< rectangle for activation button tcRect textRect; ///< rectangle for text message display bool isActive; bool isMouseOver; void DrawActivationButton(tc3DWindow* graphics); void DrawMessageText(tc3DWindow* graphics); }; #endif Index: tc3DWindow.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tc3DWindow.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** tc3DWindow.h 2 Nov 2004 04:23:55 -0000 1.9 --- tc3DWindow.h 14 Nov 2004 22:52:20 -0000 1.10 *************** *** 31,34 **** --- 31,35 ---- #endif + #include <queue> #include <vector> *************** *** 80,83 **** --- 81,85 ---- void AddChild(tc3DWindow* child); + void RemoveChild(tc3DWindow* child); osg::Geometry* CreateDefaultGeometry(); *************** *** 174,177 **** --- 176,180 ---- bool GetBlend(); void SetBlend(bool blendingOn); + int GetBaseRenderBin() const; virtual void SetBaseRenderBin(int n); void SetName(const char* s); *************** *** 195,198 **** --- 198,203 ---- protected: std::vector<tc3DWindow*> children; + std::queue<tc3DWindow*> childrenToRemove; ///< for safe removal of children + tc3DWindow* const hostParent; int baseRenderBin; ///< base offset for render bin for this window *************** *** 235,238 **** --- 240,244 ---- osg::MatrixTransform* CreateDrawTransform(); + void ClearDrawObjects(); void FinishDraw(); void HideUnusedObjects(); *************** *** 240,243 **** --- 246,250 ---- virtual void OnChar(wxKeyEvent& event); + virtual void OnClose(wxCloseEvent& event); virtual void OnEnterWindow(wxMouseEvent& event); void OnEraseBackground(wxEraseEvent& event); *************** *** 299,302 **** --- 306,310 ---- void InitGraphicsObjects(); void LogStatus(); + void UpdateChildren(); DECLARE_EVENT_TABLE() --- NEW FILE: tcPopupMessage.h --- /** ** @file tcPopupMessage.h */ /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _POPUPMESSAGE_H_ #define _POPUPMESSAGE_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #include "wx/string.h" #include <osg/Vec4> #include "tc3DWindow.h" /** * Class based on tcConsole modified to use 3D window graphics */ class tcPopupMessage : public tc3DWindow { public: std::string messageText; void Clear(); virtual void Draw(); void SetMessageText(const std::string& text); static void SetParent(tc3DWindow* par); tcPopupMessage(std::string text, const wxPoint& pos, int width); virtual ~tcPopupMessage(); protected: static tc3DWindow* parent; bool redraw; unsigned int birthCount; virtual void OnLButtonDown(wxMouseEvent& event); }; #endif --- NEW FILE: tcMessageInterface.h --- /** ** @file tcMessageInterface.h */ /* Copyright (C) 2004 Dewitt Colclough (de...@tw...) ** All rights reserved. ** This file is part of the Global Conflict Blue (GCB) program. ** GCB is free software; you can redistribute it and/or modify ** it under the terms of version 2 of the GNU General Public License as ** published by the Free Software Foundation. ** GCB is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** You should have received a copy of the GNU General Public License ** along with GCB; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef _MESSAGEINTERFACE_H_ #define _MESSAGEINTERFACE_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #include <string> class tcMessageCenter; /** * Singleton class for writing text messages for GUI display */ class tcMessageInterface { public: void ChannelMessage(const std::string& channelName, const std::string& msg); static tcMessageInterface* Get(); ///< singleton accessor static void SetMessageCenter(tcMessageCenter* mc); private: static tcMessageCenter* messageCenter; tcMessageInterface(); ~tcMessageInterface(); }; #endif |