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 #ifndef BOINC_SG_TASKPANEL_H 19 #define BOINC_SG_TASKPANEL_H 20 21 // Comment??? 22 // 23 #define SELECTBYRESULTNAME 0 24 25 #include "sg_PanelBase.h" 26 27 28 typedef struct { 29 RESULT * result; 30 char result_name[256]; 31 char project_url[256]; 32 int dotColor; 33 wxArrayString slideShowFileNames; 34 int lastSlideShown; 35 double project_files_downloaded_time; 36 } TaskSelectionData; 37 38 39 40 /////////////////////////////////////////////////////////////////////////// 41 /// Class CScrolledTextBox 42 /////////////////////////////////////////////////////////////////////////////// 43 class CScrolledTextBox : public wxScrolledWindow 44 { 45 DECLARE_DYNAMIC_CLASS( CScrolledTextBox ) 46 DECLARE_EVENT_TABLE() 47 public: 48 CScrolledTextBox(); 49 CScrolledTextBox( wxWindow* parent); 50 ~CScrolledTextBox(); 51 52 void SetValue(const wxString& s); 53 virtual void OnEraseBackground(wxEraseEvent& event); 54 55 private: 56 int Wrap(const wxString& text, int widthMax, int *lineHeight); 57 bool IsStartOfNewLine(); 58 void OnOutputLine(const wxString& line); 59 60 wxBoxSizer* m_TextSizer; 61 bool m_eol; 62 wxString m_text; 63 int m_hLine; 64 }; 65 66 67 68 /////////////////////////////////////////////////////////////////////////// 69 /// Class CSlideShowPanel 70 /////////////////////////////////////////////////////////////////////////////// 71 72 class CSlideShowPanel : public wxPanel 73 { 74 DECLARE_DYNAMIC_CLASS( CSlideShowPanel ) 75 DECLARE_EVENT_TABLE() 76 77 public: 78 CSlideShowPanel(); 79 CSlideShowPanel( wxWindow* parent); 80 ~CSlideShowPanel(); 81 82 void OnSlideShowTimer(wxTimerEvent& WXUNUSED(event)); 83 void SetDescriptionText(void); 84 void AdvanceSlideShow(bool changeSlide, bool reload); 85 void OnPaint(wxPaintEvent& WXUNUSED(event)); 86 void OnEraseBackground(wxEraseEvent& event); 87 88 private: 89 CScrolledTextBox* m_description; 90 wxTimer* m_ChangeSlideTimer; 91 wxBitmap m_SlideBitmap; 92 bool m_bCurrentSlideIsDefault; 93 bool m_bGotAllProjectsList; 94 bool m_bHasBeenDrawn; 95 ALL_PROJECTS_LIST m_AllProjectsList; 96 }; 97 98 99 /////////////////////////////////////////////////////////////////////////////// 100 /// Class CSimpleTaskPanel 101 /////////////////////////////////////////////////////////////////////////////// 102 103 #ifdef __WXMAC__ 104 #include "MacBitmapComboBox.h" 105 #else 106 #define CBOINCBitmapComboBox wxBitmapComboBox 107 #endif 108 109 class CSimpleTaskPanel : public CSimplePanelBase 110 { 111 DECLARE_DYNAMIC_CLASS( CSimpleTaskPanel ) 112 DECLARE_EVENT_TABLE() 113 114 public: 115 CSimpleTaskPanel(); 116 CSimpleTaskPanel( wxWindow* parent); 117 ~CSimpleTaskPanel(); 118 119 TaskSelectionData* GetTaskSelectionData(); GetSelectedTaskString()120 wxString GetSelectedTaskString() { return m_TaskSelectionCtrl->GetValue(); } 121 void UpdatePanel(bool delayShow=false); 122 wxRect* GetProgressRect(); 123 void ReskinInterface(); 124 125 private: 126 void OnTaskSelection(wxCommandEvent &event); 127 void GetApplicationAndProjectNames(RESULT* result, wxString* appName, wxString* projName); 128 wxString GetElapsedTimeString(double f); 129 wxString GetTimeRemainingString(double f); 130 wxString GetStatusString(RESULT* result); 131 void FindSlideShowFiles(TaskSelectionData *selData); 132 void UpdateTaskSelectionList(bool reskin); 133 bool isRunning(RESULT* result); 134 bool DownloadingResults(); 135 bool Suspended(); 136 bool ProjectUpdateScheduled(); 137 void DisplayIdleState(); 138 139 protected: 140 #ifdef __WXMAC__ 141 void OnEraseBackground(wxEraseEvent& event); 142 #endif 143 wxRect* m_progressBarRect; 144 CTransparentStaticText* m_myTasksLabel; 145 CBOINCBitmapComboBox* m_TaskSelectionCtrl; 146 CTransparentStaticText* m_TaskProjectLabel; 147 CTransparentStaticText* m_TaskProjectName; 148 #if SELECTBYRESULTNAME 149 CTransparentStaticText* m_TaskApplicationName; 150 #endif 151 CSlideShowPanel* m_SlideShowArea; 152 CTransparentStaticText* m_ElapsedTimeValue; 153 CTransparentStaticText* m_TimeRemainingValue; 154 wxGauge* m_ProgressBar; 155 CTransparentStaticText* m_ProgressValueText; 156 CTransparentStaticText* m_StatusValueText; 157 wxButton* m_TaskCommandsButton; 158 wxRect m_ProgressRect; 159 int m_oldWorkCount; 160 int m_ipctDoneX1000; 161 time_t error_time; 162 bool m_bStableTaskInfoChanged; 163 int m_CurrentTaskSelection; 164 wxString m_sNotAvailableString; 165 wxString m_sNoProjectsString; 166 }; 167 168 #endif 169