26 wxDatePickerCtrl * date = (wxDatePickerCtrl *) m_validatorWindow;
27 *
pdt = date->GetValue();
31 wxDatePickerCtrl * date = (wxDatePickerCtrl *) m_validatorWindow;
32 date->SetValue (*
pdt);
50 wxTimePickerCtrl * date = (wxTimePickerCtrl *) m_validatorWindow;
51 *
pdt = date->GetValue();
55 wxTimePickerCtrl * date = (wxTimePickerCtrl *) m_validatorWindow;
56 date->SetValue (*
pdt);
62 #include <wx/string.h> 90 choiceOK = pdb->FillChoice (choiceProject,
project_tid);
91 choiceOK = pdb->FillChoice (choiceTask,
task_tid);
92 choiceOK = pdb->FillChoice (choiceTool,
tool_tid);
93 if (!choiceOK) wxLogError (
"Initialization of choices failed (yatishDlgTimeslot)");
94 long activity_id = pdb->Activity (
id);
95 project = pdb->ChoiceSelector (
project_tid, activity_id);
96 task = pdb->ChoiceSelector (
task_tid, activity_id);
97 tool = pdb->ChoiceSelector (
tool_tid, activity_id);
98 choiceProject->SetValidator ( wxGenericValidator (&project) );
99 choiceTask ->SetValidator ( wxGenericValidator (&task) );
100 choiceTool ->SetValidator ( wxGenericValidator (&tool) );
101 if ( pdb->ReadDates (
id, date1, date2) ) {
104 time1 = date1; time2 = date2;
108 wxLogError (
"Initialization of dates failed (yatishDlgTimeslot)");
109 Fit(); SetMaxSize ( GetSize() );
116 staticBoxSizer->GetStaticBox()->SetLabel (_(
"New row") );
118 buttonSave->Disable();
121 choiceOK = pdb->FillChoice (choiceTask,
task_tid);
122 choiceOK = pdb->FillChoice (choiceTool,
tool_tid);
123 if (!choiceOK) wxLogError (
"Initialization of choices failed (yatishDlgTimeslot)");
127 choiceProject->SetValidator ( wxGenericValidator (&project) );
128 choiceTask ->SetValidator ( wxGenericValidator (&task) );
129 choiceTool ->SetValidator ( wxGenericValidator (&tool) );
130 date1 = wxDateTime::Now(); date2 = date1;
133 time1 = date1; time2 = date2;
136 Fit(); SetMaxSize ( GetSize() );
137 if ( choiceProject->IsEmpty() || choiceTask->IsEmpty() || choiceTool->IsEmpty() )
138 buttonNew->Disable();
143 wxFlexGridSizer* FlexGridSizer1;
144 wxBoxSizer* BoxSizer2;
145 wxStaticText* StaticText1;
146 wxBoxSizer* BoxSizer1;
147 wxButton* buttonCancel;
148 wxStaticText* StaticText2;
150 Create(0, wxID_ANY, _(
"Table: yatish_timeslot"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T(
"wxID_ANY"));
151 BoxSizer1 =
new wxBoxSizer(wxVERTICAL);
152 staticBoxSizer =
new wxStaticBoxSizer(wxHORIZONTAL,
this, _(
"(previously selected row)"));
153 FlexGridSizer1 =
new wxFlexGridSizer(3, 3, 0, 0);
154 StaticText1 =
new wxStaticText(
this, wxID_ANY, _(
"Start:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"wxID_ANY"));
155 FlexGridSizer1->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
156 datePicker1 =
new wxDatePickerCtrl(
this, idDatePicker1, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT|wxDP_SHOWCENTURY, wxDefaultValidator, _T(
"idDatePicker1"));
157 FlexGridSizer1->Add(datePicker1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
158 timePicker1 =
new wxTimePickerCtrl(
this,idTimePicker1,wxDefaultDateTime,wxDefaultPosition,wxDefaultSize,wxDP_DEFAULT,wxDefaultValidator,_T(
"idTimePicker1"));
159 FlexGridSizer1->Add(timePicker1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
160 StaticText2 =
new wxStaticText(
this, wxID_ANY, _(
"Stop:"), wxDefaultPosition, wxDefaultSize, 0, _T(
"wxID_ANY"));
161 FlexGridSizer1->Add(StaticText2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
162 datePicker2 =
new wxDatePickerCtrl(
this, idDatePicker2, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DEFAULT|wxDP_SHOWCENTURY, wxDefaultValidator, _T(
"idDatePicker2"));
163 FlexGridSizer1->Add(datePicker2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
164 timePicker2 =
new wxTimePickerCtrl(
this,idTimePicker2,wxDefaultDateTime,wxDefaultPosition,wxDefaultSize,wxDP_DEFAULT,wxDefaultValidator,_T(
"idTimePicker2"));
165 FlexGridSizer1->Add(timePicker2, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
166 choiceProject =
new wxChoice(
this, idChoiceProject, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T(
"idChoiceProject"));
167 FlexGridSizer1->Add(choiceProject, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
168 choiceTask =
new wxChoice(
this, idChoiceTask, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T(
"idChoiceTask"));
169 FlexGridSizer1->Add(choiceTask, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
170 choiceTool =
new wxChoice(
this, idChoiceTool, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T(
"idChoiceTool"));
171 FlexGridSizer1->Add(choiceTool, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
172 staticBoxSizer->Add(FlexGridSizer1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
173 BoxSizer1->Add(staticBoxSizer, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
174 BoxSizer2 =
new wxBoxSizer(wxHORIZONTAL);
175 buttonCancel =
new wxButton(
this, wxID_CANCEL, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"wxID_CANCEL"));
176 BoxSizer2->Add(buttonCancel, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
177 buttonSave =
new wxButton(
this, wxID_SAVE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"wxID_SAVE"));
178 BoxSizer2->Add(buttonSave, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
179 buttonNew =
new wxButton(
this, wxID_NEW, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T(
"wxID_NEW"));
180 BoxSizer2->Add(buttonNew, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
181 BoxSizer1->Add(BoxSizer2, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
183 BoxSizer1->Fit(
this);
184 BoxSizer1->SetSizeHints(
this);
197 TransferDataFromWindow();
198 wxDateTime dt1 = date1 + ( time1 - time1.GetDateOnly() );
199 wxDateTime dt2 = date2 + ( time2 - time2.GetDateOnly() );
200 if ( pdb->RecordTimeslot (
id, dt1, dt2, project, task, tool) )
201 EndModal (wxID_SAVE);
203 EndModal (wxID_CANCEL);
207 TransferDataFromWindow();
208 wxDateTime dt1 = date1 + ( time1 - time1.GetDateOnly() );
209 wxDateTime dt2 = date2 + ( time2 - time2.GetDateOnly() );
210 if ( pdb->RecordTimeslot (wxNOT_FOUND, dt1, dt2, project, task, tool) )
213 EndModal (wxID_CANCEL);
DateValidator(wxDateTime *p)
static const long idDatePicker1
bool TransferFromWindow()
DateValidator(const DateValidator &v)
void OnButtonSaveClick(wxCommandEvent &event)
static const long idDatePicker2
void OnButtonNewClick(wxCommandEvent &event)
static const long idChoiceTask
bool Validate(wxWindow *)
Simplified from the wxWidgets Wiki:
Interacts with yatish tables in a SQLite database.
static const long idChoiceProject
static const long idTimePicker2
static const long idTimePicker1
bool TransferFromWindow()
TimeValidator(wxDateTime *p)
bool Validate(wxWindow *)
TimeValidator(const TimeValidator &v)
yatishDlgTimeslot(yatishDBsqlite *, long)
This constructor initializes the dialog box with data from the SQL record identified by sql_id...
bool FillChoice(wxChoice *, tableID)
Fills a wxChoice.
static const long idChoiceTool