00001
00002
00003
00004
00005 #ifndef _TSAVER_H_
00006 #define _TSAVER_H_
00007
00014
00015
00016
00017
00018 class tsaverapp : public wxApp{
00019 public:
00020 virtual bool OnInit();
00021 };
00022
00029 class tsaverList: public wxListCtrl {
00030
00031 public:
00032
00033 tsaverList(wxWindow *parent,
00034 const wxWindowID id,
00035 const wxPoint& pos,
00036 const wxSize& size,
00037 long style)
00038 : wxListCtrl(parent, id, pos, size, style) {}
00039
00040 void OnFocused(wxListEvent& event);
00041 };
00042
00043
00044
00045
00046
00047
00048 enum open_type {
00049 F_OPEN=1,
00050 F_SAVE
00051 };
00052
00059 class tsaverFrame : public wxFrame{
00060 public:
00061 tsaverFrame( const wxString& title, const wxPoint& pos, const wxSize& pos );
00062
00063
00064 void OnQuit( wxCommandEvent& event );
00065 void OnAbout( wxCommandEvent& event );
00066 void OnAdd( wxCommandEvent& event );
00067 void OnDelete( wxCommandEvent& event );
00068 void OnStart( wxCommandEvent& event );
00069 void OnOpen( wxCommandEvent& event );
00070 void OnSave( wxCommandEvent& event );
00071 void OnCompleted( wxCommandEvent& event );
00072 void OnEnter(wxCommandEvent& event);
00073 void OnSelected(wxListEvent& event);
00074 void OnListRightClick(wxListEvent& event);
00075 void OnTimer(wxTimerEvent& event);
00076
00077
00078 void DoLayout();
00079
00080
00081 wxFFile *file;
00082
00083 wxFFileOutputStream *file_out;
00084 wxTextOutputStream *text_out;
00085 wxFFileInputStream *file_in;
00086 wxTextInputStream *text_in;
00087
00088 void OpenFile(wxString file_name,open_type type);
00089 wxString ReadSession(c_session *sess);
00090 void WriteSession(c_session *sess);
00091
00092
00093 c_session *session;
00094 c_task *active_task;
00095 void add_task(int position,int task_number);
00096 void rebuild_list();
00097 void update_status();
00098 void addtolist();
00099
00100 private:
00101 DECLARE_EVENT_TABLE()
00102
00103 protected:
00104 wxListCtrl *lstList;
00105 wxBoxSizer *boxVmain;
00106 wxBoxSizer *boxHtop;
00107 wxBoxSizer *boxHbottom;
00108 wxBoxSizer *boxVstatus;
00109 wxPanel *panList;
00110 wxTextCtrl *txtName;
00111 wxToolBar *tolMain;
00112 wxTimer *timer;
00113 wxGauge *gauge;
00114 wxSpinCtrl *spin;
00115 wxSound *sound;
00116 wxStaticText *status;
00117 wxCheckBox *chkCompleted;
00118
00119 wxMenu *menuTask;
00120
00121 int selected_item;
00122 };
00123
00124 enum{
00125 MENU_QUIT = 1,
00126 MENU_ABOUT,
00127 MENU_ADD,
00128 MENU_DELETE,
00129 MENU_SAVE,
00130 MENU_OPEN,
00131 TOOL_START=100,
00132 TOOL_COMPLETED,
00133 LIST_CTRL,
00134 TXT_NAME,
00135 SXT_STATUS,
00136 TIMER,
00137 GAUGE,
00138 STATUS_BAR,
00139 INSERT,
00140 CANCEL,
00141 CHK_COMPLETE,
00142 CHK_COMMAND
00143 };
00144
00145
00146
00147 void tsaverFrame::DoLayout() {
00148
00149
00150 boxVmain = new wxBoxSizer(wxVERTICAL);
00151 boxHtop = new wxBoxSizer(wxHORIZONTAL);
00152 boxHbottom = new wxBoxSizer(wxHORIZONTAL);
00153 boxVstatus = new wxBoxSizer(wxVERTICAL);
00154
00155 gauge = new wxGauge(this,GAUGE,200);
00156
00157 wxSize *size;
00158
00159
00160 size = new wxSize(40,-1);
00161 spin = new wxSpinCtrl(this,-1,_T("10"),wxDefaultPosition,*size, wxSP_ARROW_KEYS, 1, 99, 10);
00162
00163 txtName = new wxTextCtrl(this,TXT_NAME,_T(""),wxDefaultPosition, wxDefaultSize,wxTE_PROCESS_ENTER);
00164
00165 status = new wxStaticText(this,SXT_STATUS,_T("danko.komlen@bj.htnet.hr"),wxDefaultPosition, wxDefaultSize,wxALIGN_CENTRE);
00166
00167 wxMenu *menuFile = new wxMenu;
00168 menuTask = new wxMenu;
00169
00170 lstList = new tsaverList(this, LIST_CTRL, wxDefaultPosition, wxDefaultSize,wxSUNKEN_BORDER | wxLC_EDIT_LABELS | wxLC_REPORT);
00171
00172 tolMain = new wxToolBar(this, -1,wxDefaultPosition, wxDefaultSize,wxTB_HORZ_TEXT | wxTB_DOCKABLE);
00173
00174 chkCompleted = new wxCheckBox(tolMain,CHK_COMPLETE,wxT("Complete"));
00175
00176 SetIcon (wxICON(clock));
00177
00178 menuFile->Append( MENU_SAVE,wxT("&Save session"));
00179 menuFile->Append( MENU_OPEN,wxT("&Open session"));
00180 menuFile->AppendSeparator();
00181 menuFile->Append( MENU_ABOUT, wxT( "&About..." ) );
00182 menuFile->Append( MENU_QUIT, wxT( "E&xit\tAlt-X" ) );
00183
00184 menuTask->Append( MENU_ADD,wxT( "&New task\tAlt-N"));
00185 menuTask->Append( MENU_DELETE,wxT( "&Delete task\tAlt-D"));
00186
00187 wxMenuBar *menuBar = new wxMenuBar;
00188 menuBar->Append( menuFile, wxT( "&File" ) );
00189 menuBar->Append( menuTask, wxT( "&Task" ));
00190 SetMenuBar( menuBar );
00191
00192
00193 wxImageList *ilist = new wxImageList(32, 32, true);
00194 ilist->Add( wxIcon(_T("icon1"), wxBITMAP_TYPE_ICO_RESOURCE) );
00195
00196
00197
00198 wxStandardPaths *datadir = new wxStandardPaths;
00199
00200 tolMain->AddTool(TOOL_START, wxT("Start"),wxBitmap(play_xpm));
00201
00202 tolMain->AddControl(chkCompleted);
00203 tolMain->Realize();
00204
00205
00206 int stBar_size=100;
00207
00208
00209 boxHtop->Add (txtName,1,wxEXPAND);
00210 boxHtop->Add (spin,0,wxEXPAND);
00211 boxHtop->Add (tolMain,1,wxEXPAND);
00212
00213
00214
00215
00216
00217
00218
00219 lstList->InsertColumn(0,_T("Name"));
00220 lstList->InsertColumn(1,_T("Type"));
00221 lstList->InsertColumn(2,_T("Duration"));
00222
00223 lstList->SetColumnWidth( 0, 150 );
00224 lstList->SetColumnWidth( 1, 140 );
00225 lstList->SetColumnWidth( 2, 100 );
00226
00227
00228
00229 boxVmain->Add (boxHtop,0,wxEXPAND);
00230 boxVmain->Add (lstList,1,wxEXPAND);
00231 boxVmain->Add (boxHbottom,0,wxEXPAND);
00232
00233
00234 timer = new wxTimer(this,TIMER);
00235 timer->Start(1000,wxTIMER_CONTINUOUS);
00236
00237 SetSizer(boxVmain);
00238 boxVmain->Fit(this);
00239 boxVmain->SetSizeHints(this);
00240 Layout();
00241
00242
00243
00244 boxVstatus->AddSpacer(6);
00245 boxVstatus->Add(status,1,wxEXPAND);
00246 boxHbottom->Add(boxVstatus,1,wxEXPAND);
00247
00248 boxHbottom->Add(gauge,1,wxEXPAND);
00249
00250 SetStatusText(wxT( "Testing version of Time Saver 0.1" ),0 );
00251
00252
00253 file_out = new wxFFileOutputStream ( stderr );
00254 text_out = new wxTextOutputStream ( *file_out );
00255
00256
00257
00258
00259 delete size;
00260 SetSize (wxSize(410,200));
00261 }
00262
00263
00264
00265 #endif // _TSAVER_H_