[Gcblue-commits] gcb_wx/include/graphics tcCreditView.h,NONE,1.1 tcNetworkView.h,NONE,1.1 tcPanel.h,
Status: Alpha
Brought to you by:
ddcforge
|
From: Dewitt C. <ddc...@us...> - 2004-09-05 01:02:46
|
Update of /cvsroot/gcblue/gcb_wx/include/graphics In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28730/include/graphics Modified Files: tcDisplaySettingsView.h Added Files: tcCreditView.h tcNetworkView.h tcPanel.h tcPopupControl.h tcScenarioSelectView.h tcStartView.h tcXmlWindow.h Removed Files: tcStandardWindow.h Log Message: --- NEW FILE: tcPanel.h --- /* ** tcPanel.h ** ** Copyright (C) 2003 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 _TCPANEL_H_ #define _TCPANEL_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #include "wx/msw/private.h" // for MS Windows specific definitions #include <string> #include <vector> #include "gdiplus.h" struct tsItemData { std::string caption; std::string command; std::string userInput; int cmd; bool isSelected; bool isBold; Gdiplus::RectF rect; void Clear() { caption="";command="";userInput=""; cmd = 0;isSelected=0;isBold=0; } }; // note: this class mixes view/display with data, may have to be separated later class tcPanel { public: void AddItem(std::string caption, std::string command, float x, float y, float width, float height, int param = -1); void AddItem(std::string caption, int cmd, float x, float y, float width, float height); void AddItemUI(std::string caption, std::string callback, std::string input, float x, float y, float width, float height, int param = -1); void BoldLastItem(); void Clear(void); void ClearSelected(void); int Draw(Gdiplus::Graphics *apGraphics); virtual void DrawItem(tsItemData *item, Gdiplus::Graphics *apGraphics); static void InitGdi(void); void InitWithDefaults(); tsItemData* ItemContainingPoint(Gdiplus::PointF point); bool UpdateSelection(Gdiplus::PointF point); static void ReleaseGdi(void); void SetAnchor(Gdiplus::PointF p) {anchor = p;} void SetTitle(std::string new_title) {title = new_title;} void UpdateBox(void); tcPanel(void); tcPanel(tcPanel* apParent); virtual ~tcPanel(void); private: std::string title; std::vector<tsItemData> panelItems; Gdiplus::PointF anchor; ///< reference point (upper left) for drawing menu float mfItemWidth, mfItemHeight; Gdiplus::RectF boundingBox; ///< rectangle encompassing entire control Gdiplus::RectF titleBox; ///< rectangle for title bool mbUpdateRegions; float border_width; static unsigned mnReferenceCount; static Gdiplus::Pen *mpPen; ///< GDI+ objects static Gdiplus::SolidBrush *mpBrush; static Gdiplus::Font *mpFont; static Gdiplus::Font *mpBoldFont; static Gdiplus::StringFormat stringformatleftalign; static WCHAR mzwchar[255]; ///< wide char array for string buffer }; #endif --- NEW FILE: tcXmlWindow.h --- /** @file tcXmlWindow.h */ /* ** Copyright (C) 2003 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 _STANDARDWINDOW_H_ #define _STANDARDWINDOW_H_ #if _MSC_VER > 1000 #pragma once #endif #ifndef WX_PRECOMP #include "wx/wx.h" #ifdef WIN32 #include "wx/msw/private.h" // for MS Windows specific definitions #endif // WIN32 #endif // WX_PRECOMP #include "tcWindow.h" #include "tcSound.h" class TiXmlDocument; /** * tcWindow with Gdiplus drawing objects and sound */ class tcXmlWindow : public tcWindow { public: tcXmlWindow(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& configFile = "", const wxString& name = "StandardWindow", tcWindow *surfaceHost = NULL); virtual ~tcXmlWindow(); protected: TiXmlDocument* config; ///< XML auto-configuration file for window static Gdiplus::SolidBrush* mpBrush; static Gdiplus::Font* font20; static Gdiplus::Font* font16; static Gdiplus::Font* font12; static Gdiplus::Font* font10; static Gdiplus::Font* font8; static Gdiplus::Pen* mpPen; void AddXMLControls(); ///< adds XML controls to window that can be added automatically virtual void OnButtonCommand(wxCommandEvent& event); private: static unsigned ref_count; DECLARE_EVENT_TABLE() }; #endif Index: tcDisplaySettingsView.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/graphics/tcDisplaySettingsView.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** tcDisplaySettingsView.h 14 Jun 2004 21:52:55 -0000 1.1 --- tcDisplaySettingsView.h 5 Sep 2004 01:02:00 -0000 1.2 *************** *** 34,38 **** #include "tcOptions.h" ! #include "tcStandardWindow.h" #include "tcSound.h" --- 34,38 ---- #include "tcOptions.h" ! #include "tcXmlWindow.h" #include "tcSound.h" *************** *** 40,44 **** * Display settings GUI */ ! class tcDisplaySettingsView : public tcStandardWindow { public: --- 40,44 ---- * Display settings GUI */ ! class tcDisplaySettingsView : public tcXmlWindow { public: --- NEW FILE: tcStartView.h --- /* ** Copyright (C) 2003 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 _STARTVIEW_H_ #define _STARTVIEW_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #ifdef WIN32 #include "wx/msw/private.h" // for MS Windows specific definitions #endif #include "tcwindow.h" #include "aerror.h" #include "tcString.h" class tcOptions; class tcStartView : public tcWindow { public: // placement info for GUI buttons, text, etc. struct tsButtonInfo { tcString mzCaption; int mnButtonX; int mnButtonY; int mnTextX; int mnTextY; int mnButtonWidth; int mnButtonHeight; Gdiplus::Image *mpiButtonOn; Gdiplus::Image *mpiButtonOver; Gdiplus::Image *mpiButtonOff; int mnState; }; public: int mnActiveButton; bool mbPlayEnabled; // TODO create better implementation of this later void AttachOptions(tcOptions *apOptions) {mpOptions=apOptions;} bool Init(void); int Draw(void); void DrawButton(Gdiplus::Graphics *apGraphics, int anButton); void DrawButtonLine(Gdiplus::Graphics *apGraphics, int anButton); int GetActiveButton(void) {return mnActiveButton;} void OnLButtonDown(wxMouseEvent& event); void OnMouseMove(wxMouseEvent& event); void PlaceButtons(void); bool ButtonContainingPoint(wxPoint point, int& rnButton); tcStartView(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name = "StartView"); virtual ~tcStartView(); private: enum {N_START_BUTTONS = 6}; tcOptions *mpOptions; Gdiplus::SolidBrush *mpBrush; Gdiplus::Font *mpFont; Gdiplus::Pen *mpPen; tsButtonInfo maButton[N_START_BUTTONS]; int mnXStart,mnYStart; }; #endif --- NEW FILE: tcPopupControl.h --- /** ** @file tcPopupControl.h */ /* Copyright (C) 2003 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 _POPUPCONTROL_H_ #define _POPUPCONTROL_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #ifdef WIN32 #include "wx/msw/private.h" // for MS Windows specific definitions #endif #include <string> #include <vector> #include "tcMenu.h" #include "tcPanel.h" #include "tcWindow.h" #include "commandlist.h" namespace ScriptInterface { class tcSimPythonInterface; } using namespace ScriptInterface; enum teMenuMode { MENUMODE_GAME, MENUMODE_PLATFORM, MENUMODE_GROUP, MENUMODE_TRACK, MENUMODE_GAMEEDIT, MENUMODE_PLATFORMEDIT, MENUMODE_FLIGHTPANEL }; class tcPopupControl : public tcWindow { public: tcCommandQueue *mpCommandInterface; tcSimPythonInterface *mpPythonInterface; teMenuMode meMode; void AttachCommandInterface(tcCommandQueue *apCommandInterface) {mpCommandInterface=apCommandInterface;} void AttachPythonInterface(tcSimPythonInterface *apIF) {mpPythonInterface = apIF;} void SetMenu(teMenuMode mode); void SetMenu(); ///< this shouldn't be an override? bool Track(wxPoint point); void OnLButtonDown(wxMouseEvent& event); void OnMouseMove(wxMouseEvent& event); int Draw(); void UpdateRegions(); void InitMenu(); tcPopupControl(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name = "PopupControl"); virtual ~tcPopupControl(); private: tcMenu mcGameMenu; tcMenu mcGameEditMenu; tcMenu mcPlatformMenu; tcMenu mcPlatformEditMenu; tcMenu mcTrackMenu; // menu for (non-alliance) sensor tracks tcPanel mcPanel; tcMenu *mpMenu; // current menu tcPanel *mpPanel; // current panel (may have more than one panel in future) wxPoint mpointUpperLeft; // upperleft coords of menu wxRect mrectMenuExtent; Gdiplus::Pen *mpPen; Gdiplus::SolidBrush *mpBrush; Gdiplus::Font *mpFont; WCHAR mzwchar[255]; // wide char array for string buffer bool mbShowDebug; bool mbRebuildMenu; // set true to rebuild menu before draw wxPoint mpointMouse; }; #endif --- NEW FILE: tcScenarioSelectView.h --- /* ** @file tcScenarioSelectView.h */ /* Copyright (C) 2003-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 _SCENARIOSELECTVIEW_H_ #define _SCENARIOSELECTVIEW_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #include "wx/dir.h" #ifdef WIN32 #include "wx/msw/private.h" // for MS Windows specific definitions #endif #include "tcXmlWindow.h" #include "tcSound.h" #include "tcSimState.h" // to load scenario #include "aerror.h" #include "tcString.h" #ifndef SCENARIO_PATH #define SCENARIO_PATH "scenarios" #endif /** * TODO: this class along with StartView class should be derived from a more * general button interface or user interface class */ class tcScenarioSelectView : public tcXmlWindow { struct scenarioInfo { std::string path; ///< path after SCENARIO_PATH including filename std::string caption; ///< dir name or filename without the .py extension std::vector<scenarioInfo> children; bool showChildren; ///< for directories struct { float x; float y; float width; float height; } drawBox; ///< location to draw to screen enum {OFF = 0, OVER = 1, ON = 2} drawState; }; /** * Directory traverser to build scenario tree */ class wxScenarioTraverser : public wxDirTraverser { public: wxScenarioTraverser(std::vector<scenarioInfo>& sInfo); wxDirTraverseResult OnFile(const wxString& filename); wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname)); private: std::vector<scenarioInfo>& info; }; public: bool Init(); int Draw(); void OnLButtonDown(wxMouseEvent& event); void OnMouseMove(wxMouseEvent& event); tcScenarioSelectView(wxWindow *parent, tcWindow *surfaceHost, const wxPoint& pos, const wxSize& size, const wxString& name = "ScenarioSelectView"); virtual ~tcScenarioSelectView(); private: const float xIndent; const float xStart; const float xWidth; const float yHeight; ///< vertical spacing between scen items const float yHeightDir; ///< vertical spacing between directory and next item const float yStart; const wxRealPoint basePosition; wxPoint mousePosition; tcOptions *mpOptions; Gdiplus::Image* directoryIcon; Gdiplus::Image* scenarioIcon; std::string loadedScenarioCaption; int mnButtonWidth; int mnButtonHeight; std::vector<scenarioInfo> scenInfo; tcSimState *mpSimState; void BuildScenarioInfo(); void DrawScenarioDirectory(std::vector<scenarioInfo>& info, Gdiplus::Graphics* graphics); wxArrayString GetListOfScenarioFiles(); void LoadScenario(std::string filePath, std::string caption); void LogScenarioInfo(std::vector<scenarioInfo>& info, int level); bool ProcessMouseClick(std::vector<scenarioInfo>& info, wxPoint pos); void UpdateDrawInfo(std::vector<scenarioInfo>& info, wxRealPoint& currentPos); }; #endif --- NEW FILE: tcCreditView.h --- /* ** Copyright (C) 2003 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 _CREDITVIEW_H_ #define _CREDITVIEW_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #ifdef WIN32 #include "wx/msw/private.h" //for MS Windows specific definitions #endif #include "tcwindow.h" #include "tcSound.h" #include "aerror.h" #include "tcString.h" /** * View window to display scrolling credits */ class tcCreditView : public tcWindow { struct tsCreditInfo { tcString mzCaption; float mfTrailSpace; int mnEffect; ///< 0 - standard text, 1 - bold, 2 - small }; public: void AddCredit(tcString& s, float afTrailSpace, int effect); bool Init(); int Draw(); void OnLButtonDown(wxMouseEvent& event); void Rewind(); tcCreditView(wxWindow *parent, const wxPoint& pos, const wxSize& size, const wxString& name = "CreditView", tcWindow *sharedSurface = NULL); virtual ~tcCreditView(void); private: enum {MAX_CREDITS = 96}; Gdiplus::SolidBrush *mpBrush; Gdiplus::Font *mpFont; Gdiplus::Font *mpFontLarge; Gdiplus::Font *mpFontSmall; Gdiplus::Pen *mpPen; UINT32 mnStartTime; // 30 Hz counter to mark start of sequence int mnXStart,mnYStart; tcString crawlstring; tsCreditInfo maCredit[MAX_CREDITS]; unsigned mnCredits; bool mbDrawRewind; // flag to reset Draw() method }; #endif --- tcStandardWindow.h DELETED --- --- NEW FILE: tcNetworkView.h --- /** @file tcNetworkView.h */ /* ** Copyright (C) 2003 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 _NETWORKVIEW_H_ #define _NETWORKVIEW_H_ #if _MSC_VER > 1000 #pragma once #endif #include "wx/wx.h" #ifdef WIN32 #include "wx/msw/private.h" //for MS Windows specific definitions #endif #include "tcXmlWindow.h" class tcEditBox; class tcConsoleBox; /** * User interface window for multiplayer and network * setup and test. * Called a "view" even though this class has data and more * included to be consistent with other view classes. */ class tcNetworkView : public tcXmlWindow { public: int Draw(); void DrawStatusBox(Gdiplus::Graphics *graphics); void OnConnect(wxCommandEvent& event); void OnLButtonDown(wxMouseEvent& event); void SendChatText(wxCommandEvent& event); void SendTest(wxCommandEvent& event); void SetChatProtocol(wxCommandEvent& event); void SetIPText(wxCommandEvent& event); void SetNetworkMode(wxCommandEvent& event); tcNetworkView(wxWindow *parent, tcWindow *surfaceHost, const wxPoint& pos, const wxSize& size, const wxString& name = "NetworkView"); virtual ~tcNetworkView(); private: std::string ipText; int networkMode; tcEditBox *ipEdit; tcConsoleBox *chatBox; tcEditBox *chatEntry; wxRect statusBoxBounds; DECLARE_EVENT_TABLE() }; #endif |