9 #include <wx/listctrl.h>
31 AddReminderDialog( wxWindow* parent, wxWindowID
id = 500,
const wxString& title = wxT(
"Add Reminder"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU );
35 AddReminderDialog::AddReminderDialog( wxWindow* parent, wxWindowID
id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style ) : wxDialog( parent, id, title, pos, size, style )
37 wxTextValidator textVal(wxFILTER_INCLUDE_CHAR_LIST,NULL);
40 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
47 this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
48 this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
51 bSizer3 =
new wxBoxSizer( wxVERTICAL );
53 bSizer3->SetMinSize( wxSize( -1,10 ) );
55 gSizer2 =
new wxGridSizer( 2, 2, 0, 0 );
57 RNameCtrl =
new wxTextCtrl(
this, 501, wxEmptyString, wxDefaultPosition, wxSize(-1,-1), 0 , textVal);
58 gSizer2->Add(
RNameCtrl, 0, wxALL|wxEXPAND, 5 );
60 RNameText =
new wxStaticText(
this, wxID_ANY,
l(
"Name"), wxDefaultPosition, wxDefaultSize, 0 );
62 gSizer2->Add(
RNameText, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
64 RDateCtrl =
new wxDatePickerCtrl(
this, wxID_ANY, wxDefaultDateTime, wxDefaultPosition, wxDefaultSize, wxDP_DROPDOWN );
65 gSizer2->Add(
RDateCtrl, 0, wxALL|wxEXPAND, 5 );
67 RDateText =
new wxStaticText(
this, wxID_ANY,
l(
"Date"), wxDefaultPosition, wxDefaultSize, 0 );
69 gSizer2->Add(
RDateText, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_CENTER_HORIZONTAL, 5 );
71 bSizer3->Add( gSizer2, 0, wxEXPAND, 5 );
73 RTextCtrl =
new wxTextCtrl(
this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 , textVal);
74 bSizer3->Add(
RTextCtrl, 1, wxALL|wxEXPAND, 5 );
77 gSizer3 =
new wxGridSizer( 1, 2, 0, 0 );
79 RCancel =
new wxButton(
this, wxID_ANY,
l(
"Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
80 gSizer3->Add(
RCancel, 0, wxALL|wxEXPAND, 5 );
82 RSave =
new wxButton(
this, wxID_ANY,
l(
"Save"), wxDefaultPosition, wxDefaultSize, 0 );
83 gSizer3->Add(
RSave, 0, wxALL|wxEXPAND, 5 );
85 bSizer3->Add( gSizer3, 0, wxEXPAND, 5 );
86 bSizer3->SetSizeHints(
this);
91 this->SetSizer( bSizer3 );
103 string curRName =
RNameCtrl->GetLineText(0).ToStdString();
106 wxMessageDialog* dialog =
new wxMessageDialog(
this,
107 l(
"Please Enter A Name!"));
115 wxMessageDialog* dialog =
new wxMessageDialog(
this,
116 l(
"Please Enter A Different Name!\nThis One Exists Already!"));
123 string curRText =
RTextCtrl->GetLineText(0).ToStdString();
131 selDate.GetDay(wxDateTime::Local),
132 selDate.GetMonth(wxDateTime::Local) + 1,
133 selDate.GetYear(wxDateTime::Local)
137 string SQL =
"INSERT INTO Reminders VALUES(" + to_string(
Remind.
GetValidID()) +
", '";
138 SQL += curRName +
"','" + Date.
ToSortable(
"/") +
"','" + curRText +
"',0);";
141 wxMessageDialog* dialog =
new wxMessageDialog(
this,
175 ReminderDialog( wxWindow* parent, wxWindowID
id = 500,
const wxString& title = wxT(
"Reminders"),
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxSize( 500,500 ),
long style = wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER );
179 ReminderDialog::ReminderDialog( wxWindow* parent, wxWindowID
id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style ) : wxDialog( parent, id, title, pos, size, style )
181 this->SetSizeHints( wxDefaultSize, wxDefaultSize );
188 this->SetForegroundColour( wxColor(ColorRed[8],ColorGreen[8],ColorBlue[8]) );
189 this->SetBackgroundColour( wxColor(ColorRed[7],ColorGreen[7],ColorBlue[7]) );
192 bSizer3 =
new wxBoxSizer( wxVERTICAL );
194 bSizer3->SetMinSize( wxSize( -1,10 ) );
196 RListView =
new wxListView(
this, 1254, wxDefaultPosition, wxDefaultSize, wxLC_REPORT );
197 bSizer3->Add(
RListView, 1, wxALL|wxEXPAND, 5 );
199 wxGridSizer* gSizer3;
200 gSizer3 =
new wxGridSizer( 1, 3, 0, 0 );
202 RRemv =
new wxButton(
this, wxID_ANY,
l(
"Remove"), wxDefaultPosition, wxDefaultSize, 0 );
203 gSizer3->Add(
RRemv, 0, wxALL|wxEXPAND, 5 );
205 RAdd =
new wxButton(
this, wxID_ANY,
l(
"Add"), wxDefaultPosition, wxDefaultSize, 0 );
206 gSizer3->Add(
RAdd, 0, wxALL|wxEXPAND, 5 );
208 RClose =
new wxButton(
this, wxID_ANY,
l(
"Close"), wxDefaultPosition, wxDefaultSize, 0 );
209 gSizer3->Add(
RClose, 0, wxALL|wxEXPAND, 5 );
211 bSizer3->Add( gSizer3, 0, wxEXPAND, 5 );
219 this->SetSizer( bSizer3 );
244 wxMessageDialog* dialog =
new wxMessageDialog(
this,
245 l(
"No Item Is Selected!"));
253 int really = wxMessageBox(wxString::Format(wxT(
"Delete %s ?"),
Remind.
GetName(sel).c_str()),
l(
"Delete?"),wxOK| wxCANCEL);
257 wxMessageDialog* dialog =
new wxMessageDialog(
this,
279 RListView->InsertColumn(0,
l(
"Date" ), wxLIST_FORMAT_LEFT, 80);
280 RListView->InsertColumn(1,
l(
"Name" ), wxLIST_FORMAT_LEFT, 180);
281 RListView->InsertColumn(2,
l(
"Text" ), wxLIST_FORMAT_LEFT, 300);
HK_Database Database(HATCHKEEPER_DATA+"HatchKeeper.db")
std::string l(std::string Text)
A Helper Function For HK_Language.
A Dialog For Adding Reminders.
void OnSaveButton(wxCommandEvent &)
Adds A Reminder To The Database.
AddReminderDialog(wxWindow *parent, wxWindowID id=500, const wxString &title=wxT("Add Reminder"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU)
Constructor.
void OnCancelButton(wxCommandEvent &)
Closes Dialog.
wxDatePickerCtrl * RDateCtrl
bool Execute(string SQL)
Executes SQL Statments.
HK_Storage ReadRemind()
Reads Reminders Table Into HK_Storage Object.
string GetErrors()
Returns sqlite3_errmsg(HK_DB))
A Class For Managing Dates.
std::string ToSortable(std::string Separator)
Generate A Sortable String For Database.
std::string ToReadable(std::string Separator, int Mode)
Generate A Readable String.
std::string GetValidChars()
Returns Chars That Are Allowed In Text Controls.
vector< int > GetIntArray(int Selection)
Returns The Selected Value As An Array Of Integers.
int GetInt(int Selection)
Returns The Selected Setting Value As An Integer.
HK_Date GetDate(int Select)
Returns The Selected Stored Date.
int GetValidID()
Returns A Valid ID For Adding Entries To The Database.
int GetCount()
Returns The Number Of Elements Stored.
string GetName(int Select)
Returns The Selected Stored Name.
string GetText(int Select)
Returns The Selected Stored Text.
int GetID(int Select)
Returns The Selected Stored ID.
A Dialog For Managing Reminders.
void OnRCloseButton(wxCommandEvent &)
Closes Dialog.
ReminderDialog(wxWindow *parent, wxWindowID id=500, const wxString &title=wxT("Reminders"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(500, 500), long style=wxCAPTION|wxCLOSE_BOX|wxSYSTEM_MENU|wxRESIZE_BORDER)
Constructor.
void ShowRemind(bool Scan)
void OnRUnselect(wxListEvent &evt)
void OnRAddButton(wxCommandEvent &)
Adds A Reminder To The Database.
void OnRRemvButton(wxCommandEvent &)
Deletes The Selected Reminder From The Database.
void OnRSelect(wxListEvent &evt)