diff --git a/clientgui/sg_BoincSimpleGUI.h b/clientgui/sg_BoincSimpleGUI.h new file mode 100644 index 0000000000..3375a4cd75 --- /dev/null +++ b/clientgui/sg_BoincSimpleGUI.h @@ -0,0 +1,201 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: BOincSimpleGUI.cpp +// Purpose: SimpleGUI sample +// Author: Milos Travar +// Modified by: +// Created: 05/20/2006 +///////////////////////////////////////////////////////////////////////////// +#include +#include +#include "wx/animate/animate.h" +#include "wx/dc.h" +#include "wx/notebook.h" +#include "wx/statline.h" +#include "wx/image.h" +#include "wx/menu.h" +#include "sg_ImageLoader.h" +#include "sg_StatImageLoader.h" +#include "wx/icon.h" +#include "wx/wxFlatNotebook/wxFlatNotebook.h" +#include "wx/xml/xml.h" +#include "sg_DlgPreferences.h" +#include "sg_SkinClass.h" +//#include "string" +// Define a new application +class MyApp : public wxApp +{ +public: + bool OnInit(); +}; + +class MyCanvas : public wxScrolledWindow +{ +public: + MyCanvas(wxWindow *parent, const wxPoint& pos, const wxSize& size); + void OnPaint(wxPaintEvent& event); + +private: + + DECLARE_EVENT_TABLE() +}; + +// Define a new frame +class MyFrame : public wxFrame +{ +public: + + MyFrame(wxWindow *parent, const wxWindowID id, const wxString& title, + const wxPoint& pos, const wxSize& size, const long style); + // ~MyFrame(); + // Images + wxImage *g_prjIcnWCG; + wxImage *g_prjIcnPDRC; + wxImage *g_icoSleepWU; + wxImage *g_icoWorkWU; + // + ImageLoader *i_prjIcnPT1; + wxWindow *w_iconPT1; + // + ImageLoader *i_prjIcnP1; + wxWindow *w_iconP1; + /// + ImageLoader *i_prjIcnP2; + wxWindow *w_iconP2; + // Flat Neotebook + wxWindow *wTab1; + wxWindow *wTab2; + wxFlatNotebookImageList m_ImageList; + wxFlatNotebook *wrkUnitNB; + //wxBitmap const sleepWUico; + wxBitmap const workWUico; + ////// Skin variables ////// + //XML doc + wxXmlDocument *skinXML; + //Skin Class + SkinClass *appSkin; + wxString skinPath; + // My projects area + wxImage *g_statWCG; + StatImageLoader *i_statWCG; + wxWindow *w_statWCG; + + // + wxImage *g_statSeti; + StatImageLoader *i_statSeti; + wxWindow *w_statSeti; + // + wxImage *g_statPred; + StatImageLoader *i_statPred; + wxWindow *w_statPred; + // arrows + wxImage *g_arwLeft; + wxImage *g_arwRight; + wxImage *g_arwLeftClick; + wxImage *g_arwRightClick; + wxBitmap btmpArwL; + wxBitmap btmpArwR; + wxBitmap btmpArwLC; + wxBitmap btmpArwRC; + wxBitmapButton *btnArwLeft; + wxBitmapButton *btnArwRight; + //Collapse buttons + bool midAppCollapsed; + bool btmAppCollapsed; + wxImage *g_collapse; + wxImage *g_collapseClick; + wxBitmap btmpCol; + wxBitmap btmpColClick; + wxBitmapButton *btnCollapseMid; + //wxBitmapButton *btnCollapseBtm; + //Expand buttons + wxImage *g_expand; + wxImage *g_expandClick; + wxBitmap btmpExp; + wxBitmap btmpExpClick; + wxBitmapButton *btnExpandMid; + //////////////////////////// + wxStaticText *st9c; + wxWindow *w11c; + wxStaticText *st12c; + wxStaticLine *lno14c; + wxStaticText *st15c; + wxStaticText *st16c; + wxGauge *gaugeWuP1; + wxStaticText *st18c; + wxStaticText *st19c; + wxStaticText *st20c; + wxStaticText *st21c; + wxStaticText *st22c; + wxStaticText *st23c; + wxStaticText *stMyProj; + wxStaticText *st27c; + wxStaticLine *lnMyProjTop; + wxStaticBitmap *bm29c; + wxGauge *gaugeProjP1; + wxBitmapButton *btnPreferences; + wxBitmapButton *btnAttProj; + wxStaticBitmap *icnProjWork; + wxStaticBitmap *bm39c; + wxGauge *gaugeProjP2; + wxStaticText *st41c; + wxStaticBitmap *icnProjSleep; + wxBitmapButton *btnPause; + wxBitmapButton *btnPlay; + wxBitmapButton *btnMessages; + wxBitmapButton *btnAdvancedView; + wxStaticBitmap *imgBgAnim; + wxStaticLine *lnMyProjBtm; + virtual ~MyFrame(); + void InitSimpleClient(); + void LoadSkinXML(); + void LoadSkinImages(); + void ReskinAppGUI(); + void initAfter(); + void MoveControlsUp(); + void MoveControlsDown(); + ////////// + wxFlexGridSizer *mainSizer; + wxSize wxNotebookSize; + wxWindow* CreateNotebookPage(); + ////////// + wxBitmap *MyFrameImg0; + wxBitmap *bm13cImg0; + wxBitmap *btmpBtnPrefL; + wxBitmap *btmpBtnAttProjL; + wxBitmap *btmpIcnWorking; + wxBitmap *bm39cImg0; + wxBitmap *btmpBtnPauseL; + wxBitmap *btmpBtnPlayL; + wxBitmap *btmpMessagesBtnL; + wxBitmap *btmpBtnAdvViewL; + wxBitmap *btmpBgAnim; + wxBitmap *btmpIcnSleeping; + wxBitmap fileImgBuf[11]; + wxWindow *wAnimWk1; + // Animation + MyCanvas* GetCanvas() const { return m_canvas; } + wxGIFAnimationCtrl* GetAnimationCtrl() const { return m_animationCtrl; } + +#if 0 + wxAnimationPlayer& GetPlayer() { return m_player; } + wxAnimationBase& GetAnimation() { return m_animation; } +#endif + + DECLARE_EVENT_TABLE() + +protected: + void OnEraseBackground(wxEraseEvent& event); + void OnBtnClick(wxCommandEvent& event); + void DrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz); + wxPoint m_tmppoint; + wxSize m_tmpsize; + wxPoint& SetwxPoint(long x,long y); + wxSize& SetwxSize(long w,long h); + ///////////////////////////////////////////////////// + MyCanvas* m_canvas; + wxGIFAnimationCtrl* m_animationCtrl; +#if 0 + wxAnimationPlayer m_player; + wxGIFAnimation m_animation; +#endif +}; diff --git a/clientgui/sg_DlgPreferences.h b/clientgui/sg_DlgPreferences.h new file mode 100644 index 0000000000..017e3a43b9 --- /dev/null +++ b/clientgui/sg_DlgPreferences.h @@ -0,0 +1,67 @@ + +#include +#include +#include "sg_SkinClass.h" + +class CDlgPreferences:public wxDialog +{ +public: + CDlgPreferences(wxWindow* parent, wxWindowID id = -1, const wxString& title = wxT(""), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE, const wxString& name = wxT("dialogBox")); + //Skin Class + SkinClass *appSkin; + // Pointer control + wxStaticText *st3c; + wxStaticText *st4c; + wxStaticText *st5c; + wxStaticText *st6c; + wxStaticText *st7c; + wxComboBox *cmb8c; + wxComboBox *cmb11c; + wxComboBox *cmb12c; + wxComboBox *cmb13c; + wxStaticText *st14c; + wxStaticText *st15c; + wxTextCtrl *tx17c; + wxStaticText *st18c; + wxStaticText *st19c; + wxStaticText *st22c; + wxTextCtrl *tx23c; + wxStaticText *st24c; + wxComboBox *cmb25c; + wxBitmapButton *btnSave; + wxBitmapButton *btnCancel; + wxStaticText *st28c; + wxTextCtrl *tx30c; + wxBitmapButton *btnOpen; + wxBitmap *dlg10484fImg0; + wxBitmap *bti26cImg1; + wxBitmap *bti27cImg1; + wxBitmap *btmpBtnAttProjL; + wxBitmap fileImgBuf[4]; + virtual ~CDlgPreferences(); + void initBefore(); + void OnPreCreate(); + void InitDialog(); + void LoadSkinImages(); + wxString GetSkinPath() const { return m_SkinPath; } + void SetSkinPath(const wxString& skinPath) { m_SkinPath = skinPath; } + void initAfter(); + + DECLARE_EVENT_TABLE() + +protected: + wxPoint m_tmppoint; + wxSize m_tmpsize; + wxString m_SkinPath; + wxPoint& SetwxPoint(long x,long y); + wxSize& SetwxSize(long w,long h); + void OnEraseBackground(wxEraseEvent& event); + void OnBtnClick(wxCommandEvent& event); + void VwXEvOnEraseBackground(wxEraseEvent& event); + void VwXDrawBackImg(wxEraseEvent& event,wxWindow *win,wxBitmap & bitMap,int opz); + +//[win]end your code +}; +// end CDlgPreferences + +//#endif diff --git a/clientgui/sg_ImageLoader.h b/clientgui/sg_ImageLoader.h new file mode 100644 index 0000000000..57cc6ccf5e --- /dev/null +++ b/clientgui/sg_ImageLoader.h @@ -0,0 +1,19 @@ +#ifndef _IMAGELOADER_H_ +#define _IMAGELOADER_H_ + +class ImageLoader : public wxWindow +{ +public: + /// Constructors + ImageLoader(wxWindow* parent); + void LoadImage(const wxImage& image); + void OnPaint(wxPaintEvent& event); +private: + //static const int MaxWidth = 320; + //static const int MaxHeight = 240; + wxBitmap Bitmap; + DECLARE_EVENT_TABLE() +}; + +#endif + diff --git a/clientgui/sg_SkinClass.h b/clientgui/sg_SkinClass.h new file mode 100644 index 0000000000..6f2f79c518 --- /dev/null +++ b/clientgui/sg_SkinClass.h @@ -0,0 +1,155 @@ +#ifndef _SKIN_CLASS +#define _SKIN_CLASS + + +#include +#ifdef __BORLANDC__ + #pragma hdrstop +#endif + +#ifndef WX_PRECOMP + #include +#endif + + +class SkinClass +{ +public: + static SkinClass* Instance(); + + // Getters + wxString GetAppBg() { return m_appBg; } + wxColour GetAppBgCol() { return GetColorFromStr(m_appBgCol); } + wxString GetBtnPrefer() const { return m_btnPrefer; } + wxString GetBtnAttProj() const { return m_btnAttProj; } + wxString GetBtnAdvView() const { return m_btnAdvView; } + wxString GetBtnPlay() const { return m_btnPlay; } + wxString GetBtnPause() const { return m_btnPause; } + wxString GetBtnMessages() const { return m_btnMessages; } + wxString GetBtnOpen() const { return m_btnOpen; } + wxString GetBtnSave() const { return m_btnSave; } + wxString GetBtnCancel() const { return m_btnCancel; } + wxString GetBtnLeftArr() const { return m_btnLeftArr; } + wxString GetBtnRightArr() const { return m_btnRightArr; } + wxString GetBtnLeftArrClick() const { return m_btnLeftArrClick; } + wxString GetBtnRightArrClick() const { return m_btnRightArrClick; } + wxString GetBtnExpand() const { return m_btnExpand; } + wxString GetBtnCollapse() const { return m_btnCollapse; } + wxString GetBtnExpandClick() const { return m_btnExpandClick; } + wxString GetBtnCollapseClick() const { return m_btnCollapseClick; } + + wxString GetDlgPrefBg() { return m_dlgPrefBg; } + + wxColour GetGaugeFgCol() { return GetColorFromStr(m_gaugeFgCol); } + wxColour GetGaugeBgCol() { return GetColorFromStr(m_gaugeBgCol); } + + + wxColour GetTabFromColAc() { return GetColorFromStr(m_tabFromColAc); } + wxColour GetTabToColAc() { return GetColorFromStr(m_tabToColAc); } + wxColour GetTabBrdColAc() { return GetColorFromStr(m_tabBrdColAc); } + wxColour GetTabFromColIn() { return GetColorFromStr(m_tabFromColIn); } + wxColour GetTabToColIn() { return GetColorFromStr(m_tabToColIn); } + wxColour GetTabBrdColIn() { return GetColorFromStr(m_tabBrdColIn); } + + wxString GetIcnWorking() const { return m_icnWorking; } + wxString GetIcnSleeping() const { return m_icnSleeping; } + wxString GetIcnWorkingWkUnit() const { return m_icnWorkingWkUnit; } + wxString GetIcnSleepingWkUnit() const { return m_icnSleepingWkUnit; } + wxString GetIcnPrjWCG() const { return m_icnPrjWCG; } + wxString GetIcnPrjPRED() const { return m_icnPrjPRED; } + wxString GetAnimationBG() const { return m_animBg; } + wxString GetAnimationFile() const { return m_animFile; } + + // Setters + void SetAppBg(const wxString& imgsrc) { m_appBg = imgsrc; } + void SetAppBgCol(const wxString& clr) { m_appBgCol = clr; } + void SetBtnPrefer(const wxString& imgsrc) { m_btnPrefer = imgsrc; } + void SetBtnAttProj(const wxString& imgsrc) { m_btnAttProj = imgsrc; } + void SetBtnAdvView(const wxString& imgsrc) { m_btnAdvView = imgsrc; } + void SetBtnPlay(const wxString& imgsrc) { m_btnPlay = imgsrc; } + void SetBtnPause(const wxString& imgsrc) { m_btnPause = imgsrc; } + void SetBtnMessages(const wxString& imgsrc) { m_btnMessages = imgsrc; } + void SetBtnOpen(const wxString& imgsrc) { m_btnOpen = imgsrc; } + void SetBtnSave(const wxString& imgsrc) { m_btnSave = imgsrc; } + void SetBtnCancel(const wxString& imgsrc) { m_btnCancel = imgsrc; } + void SetBtnLeftArr(const wxString& imgsrc) { m_btnLeftArr = imgsrc; } + void SetBtnRightArr(const wxString& imgsrc) { m_btnRightArr = imgsrc; } + void SetBtnLeftArrClick(const wxString& imgsrc) { m_btnLeftArrClick = imgsrc; } + void SetBtnRightArrClick(const wxString& imgsrc) { m_btnRightArrClick = imgsrc; } + void SetBtnExpand(const wxString& imgsrc) { m_btnExpand = imgsrc; } + void SetBtnCollapse(const wxString& imgsrc) { m_btnCollapse = imgsrc; } + void SetBtnExpandClick(const wxString& imgsrc) { m_btnExpandClick = imgsrc; } + void SetBtnCollapseClick(const wxString& imgsrc) { m_btnCollapseClick = imgsrc; } + + void SetDlgPrefBg(const wxString& imgsrc) { m_dlgPrefBg = imgsrc; } + + void SetGaugeFgCol(const wxString& clr) { m_gaugeFgCol = clr; } + void SetGaugeBgCol(const wxString& clr) { m_gaugeBgCol = clr; } + + void SetTabFromColAc(const wxString& clr) { m_tabFromColAc = clr; } + void SetTabToColAc(const wxString& clr) { m_tabToColAc = clr; } + void SetTabBrdColAc(const wxString& clr) { m_tabBrdColAc = clr; } + void SetTabFromColIn(const wxString& clr) { m_tabFromColIn = clr; } + void SetTabToColIn(const wxString& clr) { m_tabToColIn = clr; } + void SetTabBrdColIn(const wxString& clr) { m_tabBrdColIn = clr; } + + void SetIcnWorking(const wxString& imgsrc) { m_icnWorking = imgsrc; } + void SetIcnSleeping(const wxString& imgsrc) { m_icnSleeping = imgsrc; } + void SetIcnWorkingWkUnit(const wxString& imgsrc) { m_icnWorkingWkUnit = imgsrc; } + void SetIcnSleepingWkUnit(const wxString& imgsrc) { m_icnSleepingWkUnit = imgsrc; } + void SetIcnPrjWCG(const wxString& imgsrc) { m_icnPrjWCG = imgsrc; } + void SetIcnPrjPRED(const wxString& imgsrc) { m_icnPrjPRED = imgsrc; } + void SetAnimationBg(const wxString& imgsrc) { m_animBg = imgsrc; } + void SetAnimationFile(const wxString& imgsrc) { m_animFile = imgsrc; } + +private: + /// Constructors + SkinClass(); + wxColour GetColorFromStr(wxString col); + // Bg + wxString m_appBg; + wxString m_appBgCol; + //Dialogs + wxString m_dlgPrefBg; + //gauge colors + wxString m_gaugeFgCol; + wxString m_gaugeBgCol; + //notebook colors + //active tab + wxString m_tabFromColAc; + wxString m_tabToColAc; + wxString m_tabBrdColAc; + //inactive tab + wxString m_tabFromColIn; + wxString m_tabToColIn; + wxString m_tabBrdColIn; + // Btns + wxString m_btnPrefer; + wxString m_btnAttProj; + wxString m_btnAdvView; + wxString m_btnPlay; + wxString m_btnPause; + wxString m_btnMessages; + wxString m_btnOpen; + wxString m_btnSave; + wxString m_btnCancel; + wxString m_btnLeftArr; + wxString m_btnRightArr; + wxString m_btnLeftArrClick; + wxString m_btnRightArrClick; + wxString m_btnExpand; + wxString m_btnCollapse; + wxString m_btnExpandClick; + wxString m_btnCollapseClick; + // Icons + wxString m_icnWorking; + wxString m_icnSleeping; + wxString m_icnWorkingWkUnit; + wxString m_icnSleepingWkUnit; + wxString m_icnPrjWCG; + wxString m_icnPrjPRED; + // animation + wxString m_animBg; + wxString m_animFile; +}; +#endif /* _SKIN_CLASS */ diff --git a/clientgui/sg_StatImageLoader.h b/clientgui/sg_StatImageLoader.h new file mode 100644 index 0000000000..021c02245e --- /dev/null +++ b/clientgui/sg_StatImageLoader.h @@ -0,0 +1,28 @@ +#ifndef _STATIMAGELOADER_H_ +#define _STATIMAGELOADER_H_ + +#include "wx/menu.h" +#include "sg_SkinClass.h" + +class StatImageLoader : public wxWindow +{ +public: + //members + wxMenu *statPopUpMenu; + //Skin Class + SkinClass *appSkin; + /// Constructors + StatImageLoader(wxWindow* parent); + void LoadImage(const wxImage& image); + void CreateMenu(); + void PopUpMenu(wxMouseEvent& event); + void OnPaint(wxPaintEvent& event); +private: + //private memb + wxWindow *m_parent; + wxBitmap Bitmap; + DECLARE_EVENT_TABLE() +}; + +#endif +