1 // This file is part of BOINC.
2 // http://boinc.berkeley.edu
3 // Copyright (C) 2008 University of California
4 //
5 // BOINC is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU Lesser General Public License
7 // as published by the Free Software Foundation,
8 // either version 3 of the License, or (at your option) any later version.
9 //
10 // BOINC is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 // See the GNU Lesser General Public License for more details.
14 //
15 // You should have received a copy of the GNU Lesser General Public License
16 // along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
17 
18 
19 #ifndef BOINC_SG_BOINCSIMPLEFRAME_H
20 #define BOINC_SG_BOINCSIMPLEFRAME_H
21 
22 #include "BOINCBaseFrame.h"
23 
24 #if defined(__GNUG__) && !defined(__APPLE__)
25 #pragma interface "sg_BoincSimpleFrame.cpp"
26 #endif
27 
28 class CSimpleTaskPanel;
29 class CSimpleProjectPanel;
30 class CSimpleTaskPanel;
31 class CDlgMessages;
32 
33 class CSimpleGUIPanel : public wxPanel
34 {
35     DECLARE_DYNAMIC_CLASS(CSimpleGUIPanel)
36 
37 public:
38     CSimpleGUIPanel();
39     CSimpleGUIPanel(wxWindow* parent);
40 
41    ~CSimpleGUIPanel();
42 	//
43     // My tasks panel (shown when there are active tasks)
44     CSimpleTaskPanel *m_taskPanel;
45 	// My projects panel
46 	CSimpleProjectPanel *m_projPanel;
47 	////////////////////////////;
48 
49     void SetBackgroundBitmap();
50     void ReskinInterface();
51 	void UpdateProjectView();
52     void OnFrameRender();
53 	void OnProjectsAttachToProject(wxCommandEvent& event);
54     void OnShowNotices(wxCommandEvent& event);
55     void OnSuspendResume(wxCommandEvent& event);
56     void OnHelp( wxCommandEvent& event );
SetDlgOpen(bool newDlgState)57 	void SetDlgOpen(bool newDlgState) { dlgOpen = newDlgState; }
GetDlgOpen()58 	bool GetDlgOpen() { return dlgOpen; }
GetBackgroundBitMap()59     wxBitmap *GetBackgroundBitMap() { return &m_bmpBg; }
60     void OnCheckForNewNotices(wxTimerEvent& WXUNUSED(event));
61     void NoticesViewed();
62 
63 	//////////
64 	wxBoxSizer *mainSizer;
65 	//////////
66     bool        m_bNewNoticeAlert;
67     bool        m_bNoticesButtonIsRed;
68     DECLARE_EVENT_TABLE()
69 
70 protected:
71     void OnPaint(wxPaintEvent& event);
72     void OnEraseBackground(wxEraseEvent& event);
73 #ifdef __WXMAC__
74     int         m_iRedRingRadius;
75 #endif
76     wxBitmap    m_bmpBg;
77     wxButton    *m_NoticesButton;
78     wxButton    *m_SuspendResumeButton;
79     wxButton    *m_HelpButton;
80     wxString    m_sSuspendString;
81     wxString    m_sResumeString;
82     int         m_oldWorkCount;
83     bool        m_bIsSuspended;
84 
85 private:
86     int         m_irefreshCount;
87     bool        dlgOpen;
88 	wxTimer*    checkForNewNoticesTimer;
89     wxString    m_sSuspendButtonToolTip;
90     wxString    m_sResumeButtonToolTip;
91 };
92 
93 
94 // Define a new frame
95 class CSimpleFrame : public CBOINCBaseFrame
96 {
97     DECLARE_DYNAMIC_CLASS(CSimpleFrame)
98 
99 public:
100     CSimpleFrame();
101     CSimpleFrame(wxString title, wxIconBundle* icons, wxPoint position, wxSize size);
102 
103    ~CSimpleFrame();
104 
105     void OnMenuOpening( wxMenuEvent &event);
106     void OnChangeGUI( wxCommandEvent& event );
107     void BuildSkinSubmenu( wxMenu *submenu );
108     void OnSelectDefaultSkin( wxCommandEvent& event );
109     void OnSelectSkin( wxCommandEvent& event );
110     void OnPreferences( wxCommandEvent& event );
111     void OnOptions( wxCommandEvent& event );
112     void OnDiagnosticLogFlags( wxCommandEvent& event );
113     void OnOldSG( wxCommandEvent& event );
114     void OnHelp( wxHelpEvent& event );
115     void OnHelpBOINC( wxCommandEvent& event );
116     void OnHelpAbout( wxCommandEvent& event );
117     void OnCheckVersion( wxCommandEvent& event );
118 
119     void OnProjectsAttachToProject(wxCommandEvent& event);
120 
121 	void OnConnect(CFrameEvent& event );
122     void OnReloadSkin( CFrameEvent& event );
123     void OnRefreshView( CFrameEvent& event );
124     void OnNotification( CFrameEvent& event );
125     void OnEventLog(wxCommandEvent& event);
126 
SetMsgsDlgOpen(CDlgMessages * newDlgPtr)127 	void SetMsgsDlgOpen(CDlgMessages* newDlgPtr) { dlgMsgsPtr = newDlgPtr; }
isMessagesDlgOpen()128     bool isMessagesDlgOpen() { return (dlgMsgsPtr != NULL); }
129 
130     bool SaveWindowPosition();
131     bool SaveState();
132     bool RestoreState();
133     void OnMove(wxMoveEvent& event);
134 
135 protected:
136     virtual int     _GetCurrentViewPage();
137 
138 	wxMenuBar*          m_pMenubar;
139     wxMenu*             m_pSubmenuSkins;
140     wxAcceleratorEntry  m_Shortcuts[3];
141     wxAcceleratorTable* m_pAccelTable;
142 
143 	CSimpleGUIPanel* m_pBackgroundPanel;
144 
145 
146 private:
147     CDlgMessages* dlgMsgsPtr;
148 
149     DECLARE_EVENT_TABLE()
150 };
151 
152 #endif
153