+// frmMain.h - frmMain form functions
+//
+// (c) 2016-2017 Xestia Software Development.
+//
+// This file is part of Xestia Calendar.
+//
+// Xestia Calendar is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by the
+// Free Software Foundation, version 3 of the license.
+//
+// Xestia Calendar is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License along
+// with Xestia Calendar. If not, see <http://www.gnu.org/licenses/>
+
#include "frmMain.h"
frmMain::frmMain( wxWindow* parent )
Connect(ID_UPDATEENTRY, XCMAIN_UPDATEEVENT, wxCommandEventHandler(frmMain::UpdateEvent));
Connect(ID_EDITEVENT, XCMAIN_EDITEVENT, wxCommandEventHandler(frmMain::EditEvent));
+ Connect(ID_ADDWINDOW, XCMAIN_ADDWINDOWINFO, wxCommandEventHandler(frmMain::WindowAdd));
+ Connect(ID_UPDATEWINDOW, XCMAIN_UPDATEWINDOWINFO, wxCommandEventHandler(frmMain::WindowUpdate));
+ Connect(ID_DELETEWINDOW, XCMAIN_DELETEWINDOWINFO, wxCommandEventHandler(frmMain::WindowDelete));
+
}
void frmMain::QuitApp( wxCloseEvent& event )
void frmMain::ShowPreferencesWindow( wxCommandEvent& event )
{
+ // Close all windows first.
+
+ if (CloseAllWindows() == false)
+ {
+ return;
+ }
+
// Open the preferences window.
reloadAccounts = FALSE;
void frmMain::EditCalendar( wxCommandEvent& event )
{
+ // Close all windows first.
+
+ if (CloseAllWindows() == false)
+ {
+ return;
+ }
+
// Get the calendar data.
CDSGetCalendarInfo calendarInfo = calendarData.GetCalendar(event.GetInt());
void frmMain::DeleteCalendar( wxCommandEvent& event )
{
+ // Close all windows first.
+
+ if (CloseAllWindows() == false)
+ {
+ return;
+ }
+
CalendarProperties *calendarEventInfo = (CalendarProperties*)event.GetClientData();
// Get the calendar data.
frmEventEditor *frameNewEvent = new frmEventEditor ( this );
frameNewEvent->SetupForm(&calendarData, preferences);
+ frameNewEvent->SetWindowMenuItemID(++WindowMenuItemID);
+
+ // Add the window to the window list.
+
+ WindowData *newWindowData = new WindowData;
+
+ newWindowData->DataType = 1;
+ newWindowData->WindowPointer = (void*)frameNewEvent;
+ newWindowData->WindowID = WindowMenuItemID;
+
+ wxCommandEvent addevent(XCMAIN_ADDWINDOWINFO);
+ addevent.SetId(ID_ADDWINDOW);
+ addevent.SetClientData(newWindowData);
+ wxPostEvent(this, addevent);
+
frameNewEvent->Show();
}
frmEventEditor *frameEditEvent = new frmEventEditor ( this );
frameEditEvent->SetEventID(event.GetInt());
frameEditEvent->SetEditMode(true);
+ frameEditEvent->SetWindowMenuItemID(++WindowMenuItemID);
frameEditEvent->SetupForm(&calendarData, preferences);
+
+ // Add the window to the window list.
+
+ WindowData *newWindowData = new WindowData;
+
+ newWindowData->DataType = 1;
+ newWindowData->WindowPointer = (void*)frameEditEvent;
+ newWindowData->WindowID = WindowMenuItemID;
+
+ wxCommandEvent addevent(XCMAIN_ADDWINDOWINFO);
+ addevent.SetId(ID_ADDWINDOW);
+ addevent.SetClientData(newWindowData);
+ wxPostEvent(this, addevent);
+
+ // Setup the form and display it.
+
frameEditEvent->Show();
}