Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Events: Now using wxDEFINE_EVENT, wxDECLARE_EVENT and Bind
authorSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 2 Jul 2017 17:29:53 +0000 (18:29 +0100)
committerSteve Brokenshire <sbrokenshire@xestia.co.uk>
Sun, 2 Jul 2017 17:29:53 +0000 (18:29 +0100)
source/common/events.h
source/forms/main/frmMain.cpp
source/widgets/XCCalendarCtrl.cpp
source/widgets/XCCalendarCtrl.h
source/widgets/XCCalendarDay.cpp
source/widgets/XCCalendarDayEntry.cpp
source/widgets/XCCalendarManipulator.cpp
source/widgets/XCCalendarManipulator.h
source/widgets/XCCalendarMonthView.cpp

index e425fa7..001c617 100644 (file)
 
 #include <wx/wx.h>
 
-DEFINE_EVENT_TYPE(XCMAIN_PROCESSCALENDAR)
-DEFINE_EVENT_TYPE(XCMAIN_EDITCALENDAR)
-DEFINE_EVENT_TYPE(XCMAIN_DELETECALENDAR)
-DEFINE_EVENT_TYPE(XCMAIN_EDITEVENT)
-DEFINE_EVENT_TYPE(XCMAIN_DELETEEVENT)
-DEFINE_EVENT_TYPE(XCMAIN_ADDEVENT)
-DEFINE_EVENT_TYPE(XCMAIN_UPDATEEVENT)
-
-DECLARE_EVENT_TYPE(XCMAIN_PROCESSCALENDAR, wxID_ANY)
-DECLARE_EVENT_TYPE(XCMAIN_EDITCALENDAR, wxID_ANY)
-DECLARE_EVENT_TYPE(XCMAIN_DELETECALENDAR, wxID_ANY)
-DECLARE_EVENT_TYPE(XCMAIN_EDITEVENT, wxID_ANY)
-DECLARE_EVENT_TYPE(XCMAIN_DELETEEVENT, wxID_ANY)
-DECLARE_EVENT_TYPE(XCMAIN_ADDEVENT, wxID_ANY)
-DECLARE_EVENT_TYPE(XCMAIN_UPDATEEVENT, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCMAIN_ADDWINDOWINFO)
-DEFINE_EVENT_TYPE(XCMAIN_UPDATEWINDOWINFO)
-DEFINE_EVENT_TYPE(XCMAIN_DELETEWINDOWINFO)
-
-DECLARE_EVENT_TYPE(XCMAIN_ADDWINDOWINFO, wxID_ANY)
-DECLARE_EVENT_TYPE(XCMAIN_UPDATEWINDOWINFO, wxID_ANY)
-DECLARE_EVENT_TYPE(XCMAIN_DELETEWINDOWINFO, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARDAY_UPDATEICONS)
-DEFINE_EVENT_TYPE(XCCALENDARDAY_DESELECTOTHERENTRIES)
-DEFINE_EVENT_TYPE(XCCALENDARDAY_DESELECTALLENTRIES)
-
-DECLARE_EVENT_TYPE(XCCALENDARDAY_UPDATEICONS, wxID_ANY)
-DECLARE_EVENT_TYPE(XCCALENDARDAY_DESELECTOTHERENTRIES, wxID_ANY)
-DECLARE_EVENT_TYPE(XCCALENDARDAY_DESELECTALLENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARDAYENTRY_DESELECT)
-DECLARE_EVENT_TYPE(XCCALENDARDAYENTRY_DESELECT, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARMONTH_DESELECTOTHERENTRIES)
-DECLARE_EVENT_TYPE(XCCALENDARMONTH_DESELECTOTHERENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARMANIPULATOR_CHANGEGRID);
-DECLARE_EVENT_TYPE(XCCALENDARMANIPULATOR_CHANGEGRID, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARCTRL_CHANGEGRID);
-DECLARE_EVENT_TYPE(XCCALENDARCTRL_CHANGEGRID, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARCTRL_HIDEACCOUNTENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARCTRL_HIDEACCOUNTENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARCTRL_SHOWACCOUNTENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARCTRL_SHOWACCOUNTENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARCTRL_DELETECALENDARENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARCTRL_DELETECALENDARENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARCTRL_DELETEENTRY);
-DECLARE_EVENT_TYPE(XCCALENDARCTRL_DELETEENTRY, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARCTRL_ADDENTRY);
-DECLARE_EVENT_TYPE(XCCALENDARCTRL_ADDENTRY, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARCTRL_UPDATEENTRY);
-DECLARE_EVENT_TYPE(XCCALENDARCTRL_UPDATEENTRY, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARCTRL_UPDATECALENDARCOLOUR);
-DECLARE_EVENT_TYPE(XCCALENDARCTRL_UPDATECALENDARCOLOUR, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARMONTH_HIDEACCOUNTENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARMONTH_HIDEACCOUNTENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARMONTH_SHOWACCOUNTENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARMONTH_SHOWACCOUNTENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARMONTH_DELETECALENDARENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARMONTH_DELETECALENDARENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARMONTH_DELETEENTRY)
-DECLARE_EVENT_TYPE(XCCALENDARMONTH_DELETEENTRY, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARMONTH_ADDENTRY);
-DECLARE_EVENT_TYPE(XCCALENDARMONTH_ADDENTRY, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARMONTH_UPDATEENTRY);
-DECLARE_EVENT_TYPE(XCCALENDARMONTH_UPDATEENTRY, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARMONTH_UPDATECALENDARCOLOUR);
-DECLARE_EVENT_TYPE(XCCALENDARMONTH_UPDATECALENDARCOLOUR, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARDAY_HIDEACCOUNTENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARDAY_HIDEACCOUNTENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARDAY_SHOWACCOUNTENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARDAY_SHOWACCOUNTENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARDAY_DELETECALENDARENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARDAY_DELETECALENDARENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARDAY_DELETEENTRY);
-DECLARE_EVENT_TYPE(XCCALENDARDAY_DELETEENTRY, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARDAY_ADDENTRY)
-DECLARE_EVENT_TYPE(XCCALENDARDAY_ADDENTRY, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARDAY_UPDATEENTRY)
-DECLARE_EVENT_TYPE(XCCALENDARDAY_UPDATEENTRY, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARDAY_UPDATECALENDARCOLOUR);
-DECLARE_EVENT_TYPE(XCCALENDARDAY_UPDATECALENDARCOLOUR, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARDAYENTRY_HIDEACCOUNTENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARDAYENTRY_HIDEACCOUNTENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARDAYENTRY_SHOWACCOUNTENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARDAYENTRY_SHOWACCOUNTENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARCTRL_HIDECALENDARENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARCTRL_HIDECALENDARENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARCTRL_SHOWCALENDARENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARCTRL_SHOWCALENDARENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARDAY_HIDECALENDARENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARDAY_HIDECALENDARENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARDAY_SHOWCALENDARENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARDAY_SHOWCALENDARENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARMONTH_SHOWCALENDARENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARMONTH_SHOWCALENDARENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARMONTH_HIDECALENDARENTRIES);
-DECLARE_EVENT_TYPE(XCCALENDARMONTH_HIDECALENDARENTRIES, wxID_ANY)
-
-DEFINE_EVENT_TYPE(XCCALENDARMONTH_DISPLAYEVENTMENU);
-DECLARE_EVENT_TYPE(XCCALENDARMONTH_DISPLAYEVENTMENU, wxID_ANY)
+wxDECLARE_EVENT(XCMAIN_PROCESSCALENDAR, wxCommandEvent);
+wxDECLARE_EVENT(XCMAIN_EDITCALENDAR, wxCommandEvent);
+wxDECLARE_EVENT(XCMAIN_DELETECALENDAR, wxCommandEvent);
+wxDECLARE_EVENT(XCMAIN_EDITEVENT, wxCommandEvent);
+wxDECLARE_EVENT(XCMAIN_DELETEEVENT, wxCommandEvent);
+wxDECLARE_EVENT(XCMAIN_ADDEVENT, wxCommandEvent);
+wxDECLARE_EVENT(XCMAIN_UPDATEEVENT, wxCommandEvent);
+
+wxDECLARE_EVENT(XCMAIN_ADDWINDOWINFO, wxCommandEvent);
+wxDECLARE_EVENT(XCMAIN_UPDATEWINDOWINFO, wxCommandEvent);
+wxDECLARE_EVENT(XCMAIN_DELETEWINDOWINFO, wxCommandEvent);
+
+wxDECLARE_EVENT(XCCALENDARDAY_UPDATEICONS, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARDAY_DESELECTOTHERENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARDAY_DESELECTALLENTRIES, wxCommandEvent);
+
+wxDECLARE_EVENT(XCCALENDARDAYENTRY_DESELECT, wxCommandEvent);
+
+wxDECLARE_EVENT(XCCALENDARMONTH_DESELECTOTHERENTRIES, wxCommandEvent);
+
+wxDECLARE_EVENT(XCCALENDARMANIPULATOR_CHANGEGRID, wxCommandEvent);
+
+wxDECLARE_EVENT(XCCALENDARCTRL_CHANGEGRID, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARCTRL_HIDEACCOUNTENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARCTRL_SHOWACCOUNTENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARCTRL_DELETECALENDARENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARCTRL_DELETEENTRY, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARCTRL_ADDENTRY, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARCTRL_UPDATEENTRY, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARCTRL_UPDATECALENDARCOLOUR, wxCommandEvent);
+
+wxDECLARE_EVENT(XCCALENDARMONTH_HIDEACCOUNTENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARMONTH_SHOWACCOUNTENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARMONTH_DELETECALENDARENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARMONTH_DELETEENTRY, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARMONTH_ADDENTRY, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARMONTH_UPDATEENTRY, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARMONTH_UPDATECALENDARCOLOUR, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARMONTH_SHOWCALENDARENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARMONTH_HIDECALENDARENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARMONTH_DISPLAYEVENTMENU, wxCommandEvent);
+
+wxDECLARE_EVENT(XCCALENDARDAY_HIDEACCOUNTENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARDAY_SHOWACCOUNTENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARDAY_DELETECALENDARENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARDAY_DELETEENTRY, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARDAY_ADDENTRY, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARDAY_UPDATEENTRY, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARDAY_UPDATECALENDARCOLOUR, wxCommandEvent);
+
+wxDECLARE_EVENT(XCCALENDARDAYENTRY_HIDEACCOUNTENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARDAYENTRY_SHOWACCOUNTENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARCTRL_HIDECALENDARENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARCTRL_SHOWCALENDARENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARDAY_HIDECALENDARENTRIES, wxCommandEvent);
+wxDECLARE_EVENT(XCCALENDARDAY_SHOWCALENDARENTRIES, wxCommandEvent);
 
 #define ID_MONTHVIEWCLEARSELECTION 7000
 #define ID_DESELECTALLITEMS 7001
index 8d6a4f8..9c420ff 100644 (file)
 
 #include "frmMain.h"
 
+wxDEFINE_EVENT(XCMAIN_PROCESSCALENDAR, wxCommandEvent);
+wxDEFINE_EVENT(XCMAIN_EDITCALENDAR, wxCommandEvent);
+wxDEFINE_EVENT(XCMAIN_DELETECALENDAR, wxCommandEvent);
+wxDEFINE_EVENT(XCMAIN_ADDEVENT, wxCommandEvent);
+wxDEFINE_EVENT(XCMAIN_UPDATEEVENT, wxCommandEvent);
+wxDEFINE_EVENT(XCMAIN_EDITEVENT, wxCommandEvent);
+wxDEFINE_EVENT(XCMAIN_DELETEEVENT, wxCommandEvent);
+
+wxDEFINE_EVENT(XCMAIN_ADDWINDOWINFO, wxCommandEvent);
+wxDEFINE_EVENT(XCMAIN_UPDATEWINDOWINFO, wxCommandEvent);
+wxDEFINE_EVENT(XCMAIN_DELETEWINDOWINFO, wxCommandEvent);
+
 frmMain::frmMain( wxWindow* parent )
 :
 frmMainADT( parent )
 {
-       
        // Setup the default settings if they don't
        // exist.
        
@@ -76,19 +87,20 @@ frmMainADT( parent )
        mainCalendarCtrl = new XCCalendarCtrl(this, &calendarData);
        szrMain->Add(mainCalendarCtrl, 1, wxEXPAND, 5);
        szrMain->Layout();
+
+       // Bind events to the control.
        
-       Connect(ID_PROCESSCALENDAR, XCMAIN_PROCESSCALENDAR, wxCommandEventHandler(frmMain::ProcessCalendar));
-       Connect(ID_EDITCALENDAR, XCMAIN_EDITCALENDAR, wxCommandEventHandler(frmMain::EditCalendar));
-       Connect(ID_DELETECALENDAR, XCMAIN_DELETECALENDAR, wxCommandEventHandler(frmMain::DeleteCalendar));
-       Connect(ID_DELETEEVENT, XCMAIN_DELETEEVENT, wxCommandEventHandler(frmMain::DeleteEvent));
-       Connect(ID_ADDENTRY, XCMAIN_ADDEVENT, wxCommandEventHandler(frmMain::AddEvent));
-       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));
+       Bind(XCMAIN_PROCESSCALENDAR, &frmMain::ProcessCalendar, this, ID_PROCESSCALENDAR);
+       Bind(XCMAIN_EDITCALENDAR, &frmMain::EditCalendar, this, ID_EDITCALENDAR);
+       Bind(XCMAIN_DELETECALENDAR, &frmMain::DeleteCalendar, this, ID_DELETECALENDAR);
+       Bind(XCMAIN_ADDEVENT, &frmMain::AddEvent, this, ID_ADDENTRY);
+       Bind(XCMAIN_UPDATEEVENT, &frmMain::UpdateEvent, this, ID_UPDATEENTRY);
+       Bind(XCMAIN_EDITEVENT, &frmMain::EditEvent, this, ID_EDITEVENT);
+       Bind(XCMAIN_DELETEEVENT, &frmMain::DeleteEvent, this, ID_DELETEEVENT);
        
+       Bind(XCMAIN_ADDWINDOWINFO, &frmMain::WindowAdd, this, ID_ADDWINDOW);
+       Bind(XCMAIN_UPDATEWINDOWINFO, &frmMain::WindowUpdate, this, ID_UPDATEWINDOW);
+       Bind(XCMAIN_DELETEWINDOWINFO, &frmMain::WindowDelete, this, ID_DELETEWINDOW);
 }
 
 void frmMain::QuitApp( wxCloseEvent& event )
index 7c6127c..5a9e598 100644 (file)
 
 #include "XCCalendarCtrl.h"
 
-BEGIN_EVENT_TABLE(XCCalendarCtrl, wxPanel)
-END_EVENT_TABLE()
+wxDEFINE_EVENT(XCCALENDARCTRL_CHANGEGRID, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARCTRL_HIDEACCOUNTENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARCTRL_SHOWACCOUNTENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARCTRL_HIDECALENDARENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARCTRL_SHOWCALENDARENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARCTRL_DELETECALENDARENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARCTRL_ADDENTRY, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARCTRL_UPDATEENTRY, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARCTRL_UPDATECALENDARCOLOUR, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARCTRL_DELETEENTRY, wxCommandEvent);
 
 using namespace std; 
 
 XCCalendarCtrl::XCCalendarCtrl(wxWindow *parent, CalendarDataStorage *dataStorage)
        : wxPanel (parent, wxID_ANY, wxDefaultPosition, wxDefaultSize){
-       
        // Setup the pointers.
                
        calendarStorage = dataStorage;
@@ -60,19 +67,19 @@ XCCalendarCtrl::XCCalendarCtrl(wxWindow *parent, CalendarDataStorage *dataStorag
        monthViewCtrl = new XCCalendarMonthView(this, "XCCalendarMonthView Test", wxDefaultPosition, wxDefaultSize, &CurrentMonthGrid, calendarStorage, &hideAccountsList, &hideCalendarsList);
        szrMain->Add(monthViewCtrl, 1, wxEXPAND, 5);
        
-       // Connect events to the control.
-       
-       Connect(ID_CHANGEGRID, XCCALENDARCTRL_CHANGEGRID, wxCommandEventHandler(XCCalendarCtrl::UpdateGrid));
-       Connect(ID_HIDEENTRIES, XCCALENDARCTRL_HIDEACCOUNTENTRIES, wxCommandEventHandler(XCCalendarCtrl::HideAccountEntries));
-       Connect(ID_SHOWENTRIES, XCCALENDARCTRL_SHOWACCOUNTENTRIES, wxCommandEventHandler(XCCalendarCtrl::ShowAccountEntries));
-       Connect(ID_HIDECALENDARENTRIES, XCCALENDARCTRL_HIDECALENDARENTRIES, wxCommandEventHandler(XCCalendarCtrl::HideCalendarEntries));
-       Connect(ID_SHOWCALENDARENTRIES, XCCALENDARCTRL_SHOWCALENDARENTRIES, wxCommandEventHandler(XCCalendarCtrl::ShowCalendarEntries));
-       Connect(ID_DELETECALENDARENTRIES, XCCALENDARCTRL_DELETECALENDARENTRIES, wxCommandEventHandler(XCCalendarCtrl::DeleteCalendarEntries));
-       Connect(ID_DELETEENTRY, XCCALENDARCTRL_DELETEENTRY, wxCommandEventHandler(XCCalendarCtrl::DeleteCalendarEntry));
-       Connect(ID_ADDENTRY, XCCALENDARCTRL_ADDENTRY, wxCommandEventHandler(XCCalendarCtrl::AddCalendarEntry));
-       Connect(ID_UPDATEENTRY, XCCALENDARCTRL_UPDATEENTRY, wxCommandEventHandler(XCCalendarCtrl::UpdateCalendarEntry));
-       Connect(ID_UPDATECOLOUR, XCCALENDARCTRL_UPDATECALENDARCOLOUR, wxCommandEventHandler(XCCalendarCtrl::UpdateCalendarColour));
-       
+       // Bind events to the control.
+       
+       Bind(XCCALENDARCTRL_CHANGEGRID, &XCCalendarCtrl::UpdateGrid, this, ID_CHANGEGRID);
+       Bind(XCCALENDARCTRL_HIDEACCOUNTENTRIES, &XCCalendarCtrl::HideAccountEntries, this, ID_HIDEENTRIES);
+       Bind(XCCALENDARCTRL_SHOWACCOUNTENTRIES, &XCCalendarCtrl::ShowAccountEntries, this, ID_SHOWENTRIES);
+       Bind(XCCALENDARCTRL_HIDECALENDARENTRIES, &XCCalendarCtrl::HideCalendarEntries, this, ID_HIDECALENDARENTRIES);
+       Bind(XCCALENDARCTRL_SHOWCALENDARENTRIES, &XCCalendarCtrl::ShowCalendarEntries, this, ID_SHOWCALENDARENTRIES);
+       Bind(XCCALENDARCTRL_DELETECALENDARENTRIES, &XCCalendarCtrl::DeleteCalendarEntries, this, ID_DELETECALENDARENTRIES);
+       Bind(XCCALENDARCTRL_DELETEENTRY, &XCCalendarCtrl::DeleteCalendarEntry, this, ID_DELETEENTRY);
+       Bind(XCCALENDARCTRL_ADDENTRY, &XCCalendarCtrl::AddCalendarEntry, this, ID_ADDENTRY);
+       Bind(XCCALENDARCTRL_UPDATEENTRY, &XCCalendarCtrl::UpdateCalendarEntry, this, ID_UPDATEENTRY);
+       Bind(XCCALENDARCTRL_DELETEENTRY, &XCCalendarCtrl::DeleteCalendarEntry, this, ID_DELETEENTRY);
+       Bind(XCCALENDARCTRL_UPDATECALENDARCOLOUR, &XCCalendarCtrl::UpdateCalendarColour, this, ID_UPDATECOLOUR);
 }
 
 XCCalendarCtrl::~XCCalendarCtrl(){
index 66f33f1..5c2e986 100644 (file)
@@ -55,9 +55,6 @@ class XCCalendarCtrl: public wxPanel
        public:
                XCCalendarCtrl(wxWindow *parent, CalendarDataStorage *storage);
                ~XCCalendarCtrl();
-
-       
-       DECLARE_EVENT_TABLE()
        
 };
 
index 54e1196..64b58e7 100644 (file)
 
 using namespace std;
 
+wxDEFINE_EVENT(XCCALENDARDAY_DESELECTOTHERENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARDAY_DESELECTALLENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARDAY_HIDEACCOUNTENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARDAY_SHOWACCOUNTENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARDAY_HIDECALENDARENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARDAY_SHOWCALENDARENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARDAY_DELETECALENDARENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARDAY_DELETEENTRY, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARDAY_ADDENTRY, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARDAY_UPDATEENTRY, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARDAY_UPDATECALENDARCOLOUR, wxCommandEvent);
+
 BEGIN_EVENT_TABLE(XCCalendarDay, wxPanel)
 EVT_PAINT(XCCalendarDay::PaintFrameEvent)
 EVT_SIZE(XCCalendarDay::ResizeFrameEvent)
@@ -27,7 +39,6 @@ END_EVENT_TABLE()
 
 XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size)
         : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL, title){
-
        this->SetMinSize( wxSize( 100,100 ) );
        
        // Setip the icons.
@@ -65,7 +76,6 @@ XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPo
        eventListFrame->SetSizer(eventListFrameSizer);
 
        eventListFrame->SetScrollRate(0,1);
-       //EventListFrameSizer->FitInside(EventListFrame);
        eventListFrameSizer->Fit(eventListFrame);
        eventListFrameSizer->Layout();
        windowSizer->Fit(this);
@@ -85,18 +95,19 @@ XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPo
        
        UpdateTopIcons();
        
-       Connect(ID_DESELECTOTHERENTRIES, XCCALENDARDAY_DESELECTOTHERENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectOthersEvent));
-       Connect(ID_DESELECTALLITEMS, XCCALENDARDAY_DESELECTALLENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectAllEvent));
-       Connect(ID_HIDEENTRIES, XCCALENDARDAY_HIDEACCOUNTENTRIES, wxCommandEventHandler(XCCalendarDay::HideAccountEntries));
-       Connect(ID_SHOWENTRIES, XCCALENDARDAY_SHOWACCOUNTENTRIES, wxCommandEventHandler(XCCalendarDay::ShowAccountEntries));
-       Connect(ID_HIDECALENDARENTRIES, XCCALENDARDAY_HIDECALENDARENTRIES, wxCommandEventHandler(XCCalendarDay::HideCalendarEntries));
-       Connect(ID_SHOWCALENDARENTRIES, XCCALENDARDAY_SHOWCALENDARENTRIES, wxCommandEventHandler(XCCalendarDay::ShowCalendarEntries));
-       Connect(ID_DELETECALENDARENTRIES, XCCALENDARDAY_DELETECALENDARENTRIES, wxCommandEventHandler(XCCalendarDay::DeleteCalendarEntries));
-       Connect(ID_DELETEENTRY, XCCALENDARDAY_DELETEENTRY, wxCommandEventHandler(XCCalendarDay::DeleteCalendarEntry));
-       Connect(ID_ADDENTRY, XCCALENDARDAY_ADDENTRY, wxCommandEventHandler(XCCalendarDay::AddCalendarEntry));
-       Connect(ID_UPDATEENTRY, XCCALENDARDAY_UPDATEENTRY, wxCommandEventHandler(XCCalendarDay::UpdateCalendarEntry));
-       Connect(ID_UPDATECOLOUR, XCCALENDARDAY_UPDATECALENDARCOLOUR, wxCommandEventHandler(XCCalendarDay::UpdateCalendarColour));
-
+       // Bind events to the control.
+       
+       Bind(XCCALENDARDAY_DESELECTOTHERENTRIES, &XCCalendarDay::DeselectOthersEvent, this, ID_DESELECTOTHERENTRIES);
+       Bind(XCCALENDARDAY_DESELECTALLENTRIES, &XCCalendarDay::DeselectAllEvent, this, ID_DESELECTALLITEMS);
+       Bind(XCCALENDARDAY_HIDEACCOUNTENTRIES, &XCCalendarDay::HideAccountEntries, this, ID_HIDEENTRIES);
+       Bind(XCCALENDARDAY_SHOWACCOUNTENTRIES, &XCCalendarDay::ShowAccountEntries, this, ID_SHOWENTRIES);
+       Bind(XCCALENDARDAY_HIDECALENDARENTRIES, &XCCalendarDay::HideCalendarEntries, this, ID_HIDECALENDARENTRIES);
+       Bind(XCCALENDARDAY_SHOWCALENDARENTRIES, &XCCalendarDay::ShowCalendarEntries, this, ID_SHOWCALENDARENTRIES);
+       Bind(XCCALENDARDAY_DELETECALENDARENTRIES, &XCCalendarDay::DeleteCalendarEntries, this, ID_DELETECALENDARENTRIES);
+       Bind(XCCALENDARDAY_DELETEENTRY, &XCCalendarDay::DeleteCalendarEntry, this, ID_DELETEENTRY);
+       Bind(XCCALENDARDAY_ADDENTRY, &XCCalendarDay::AddCalendarEntry, this, ID_ADDENTRY);
+       Bind(XCCALENDARDAY_UPDATEENTRY, &XCCalendarDay::UpdateCalendarEntry, this, ID_UPDATEENTRY);
+       Bind(XCCALENDARDAY_UPDATECALENDARCOLOUR, &XCCalendarDay::UpdateCalendarColour, this, ID_UPDATECOLOUR);
 }
 
 XCCalendarDay::~XCCalendarDay(){
@@ -234,7 +245,7 @@ void XCCalendarDay::DeselectOthersEvent(wxCommandEvent &deselectEvent)
                        wxPostEvent((*entryIter), deselectEntryEvent);
                        
                }
-                       
+               
        }
        
        // Send event notification to deselect the other calendar entries.
index cc5dea6..0aede56 100644 (file)
@@ -18,6 +18,8 @@
 
 #include "XCCalendarDayEntry.h"
 
+wxDEFINE_EVENT(XCCALENDARDAYENTRY_DESELECT, wxCommandEvent);
+
 BEGIN_EVENT_TABLE(XCCalendarDayEntry, wxPanel)
 EVT_PAINT(XCCalendarDayEntry::PaintFrameEvent)
 EVT_SIZE(XCCalendarDayEntry::ResizeFrameEvent)
@@ -29,7 +31,6 @@ using namespace std;
 
 XCCalendarDayEntry::XCCalendarDayEntry(wxWindow* parent, const wxString& title, const wxPoint& pos, const wxSize& size, const int id)
         : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL, title){
-       
        dayPanel = parent->GetParent();
        eventID = id;
        
@@ -54,8 +55,6 @@ XCCalendarDayEntry::XCCalendarDayEntry(wxWindow* parent, const wxString& title,
                
        alarmIcon->SetBitmap(alarmIconBitmap);
        highPriorityIcon->SetBitmap(priorityIconBitmap);
-
-       Connect(ID_ENTRYDESELECT, XCCALENDARDAYENTRY_DESELECT, wxCommandEventHandler(XCCalendarDayEntry::Deselect));
        
        alarmIcon->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
        highPriorityIcon->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this);
@@ -71,6 +70,9 @@ XCCalendarDayEntry::XCCalendarDayEntry(wxWindow* parent, const wxString& title,
 
        UpdateInformation();
        
+       // Bind events to the control.
+       
+       Bind(XCCALENDARDAYENTRY_DESELECT, &XCCalendarDayEntry::Deselect, this, ID_ENTRYDESELECT);
 }
 
 XCCalendarDayEntry::~XCCalendarDayEntry(){
index f8971ca..a055eb8 100644 (file)
 
 #include "XCCalendarManipulator.h"
 
-BEGIN_EVENT_TABLE(XCCalendarManipulator, wxPanel)
-END_EVENT_TABLE()
+wxDEFINE_EVENT(XCCALENDARMANIPULATOR_CHANGEGRID, wxCommandEvent);
 
 using namespace std;
 
 XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& title, 
        const wxPoint& pos, const wxSize& size, CalendarDataStorage *dataStorage)
         : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL, title){
-       
        szrMain = new wxBoxSizer( wxVERTICAL );
        pnlMain = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(500, 50), wxTAB_TRAVERSAL);
        pnlMain->SetBackgroundColour(wxColour(40,40,40));
@@ -73,15 +71,6 @@ XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& t
        dateButton->SetFont(test);
        dateButton->SetForegroundColour(wxColour(255,255,255));
        
-       // Setup the event controls.
-
-       dateButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::DateTextClick), NULL, this);
-       nextButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::NextMonth), NULL, this);
-       calendarsButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::ShowCalendarsList), NULL, this);
-       previousButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::PreviousMonth), NULL, this);
-       
-       Connect(ID_CHANGEGRID, XCCALENDARMANIPULATOR_CHANGEGRID, wxCommandEventHandler(XCCalendarManipulator::ChangeGrid));
-       
        // Setup the manipulator control.
 
        szrNavigation->Add(previousButton, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5);
@@ -110,6 +99,14 @@ XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& t
        
        this->dataStorage = dataStorage;
                
+       // Setup the event controls.
+
+       dateButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::DateTextClick), NULL, this);
+       nextButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::NextMonth), NULL, this);
+       calendarsButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::ShowCalendarsList), NULL, this);
+       previousButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::PreviousMonth), NULL, this);
+       
+       Bind(XCCALENDARMANIPULATOR_CHANGEGRID, &XCCalendarManipulator::ChangeGrid, this, ID_CHANGEGRID);
 }
 
 XCCalendarManipulator::~XCCalendarManipulator(){
index 01968a2..a06c726 100644 (file)
@@ -69,8 +69,6 @@ class XCCalendarManipulator: public wxPanel
                std::vector<int> GetHiddenAccountsList();
                std::vector<int> GetHiddenCalendarsList();
        
-       DECLARE_EVENT_TABLE()
-       
 };
 
 #endif
\ No newline at end of file
index dbe1fdb..22ee98d 100644 (file)
 
 using namespace std;
 
+wxDEFINE_EVENT(XCCALENDARMONTH_DESELECTOTHERENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARMONTH_HIDEACCOUNTENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARMONTH_SHOWACCOUNTENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARMONTH_HIDECALENDARENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARMONTH_SHOWCALENDARENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARMONTH_DELETECALENDARENTRIES, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARMONTH_DISPLAYEVENTMENU, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARMONTH_DELETEENTRY, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARMONTH_ADDENTRY, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARMONTH_UPDATEENTRY, wxCommandEvent);
+wxDEFINE_EVENT(XCCALENDARMONTH_UPDATECALENDARCOLOUR, wxCommandEvent);
+
 BEGIN_EVENT_TABLE(XCCalendarMonthView, wxPanel)
 EVT_PAINT(XCCalendarMonthView::PaintFrameEvent)
 END_EVENT_TABLE()
 
 XCCalendarMonthView::XCCalendarMonthView(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size, XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage, std::vector<int> *hideAccounts, std::vector<int> *hideCalendars)
         : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL){
-       
        calendarStorage = dataStorage;
                
        mondayText = new XCCalendarMonthViewDayTitle(this, _("Monday"), wxDefaultPosition, wxDefaultSize);
@@ -68,18 +79,19 @@ XCCalendarMonthView::XCCalendarMonthView(wxWindow *parent, const wxString& title
        this->Layout();
        this->SetBackgroundColour(wxColour(0,0,0));
        
-       Connect(ID_MONTHVIEWCLEARSELECTION, XCCALENDARMONTH_DESELECTOTHERENTRIES, wxCommandEventHandler(XCCalendarMonthView::DeselectOthersEvent));
-       Connect(ID_HIDEENTRIES, XCCALENDARMONTH_HIDEACCOUNTENTRIES, wxCommandEventHandler(XCCalendarMonthView::HideAccountEntries));
-       Connect(ID_SHOWENTRIES, XCCALENDARMONTH_SHOWACCOUNTENTRIES, wxCommandEventHandler(XCCalendarMonthView::ShowAccountEntries));
-       Connect(ID_HIDECALENDARENTRIES, XCCALENDARMONTH_HIDECALENDARENTRIES, wxCommandEventHandler(XCCalendarMonthView::HideCalendarEntries));
-       Connect(ID_SHOWCALENDARENTRIES, XCCALENDARMONTH_SHOWCALENDARENTRIES, wxCommandEventHandler(XCCalendarMonthView::ShowCalendarEntries));
-       Connect(ID_DELETECALENDARENTRIES, XCCALENDARMONTH_DELETECALENDARENTRIES, wxCommandEventHandler(XCCalendarMonthView::DeleteCalendarEntries));
-       Connect(ID_DISPLAYEVENTMENU, XCCALENDARMONTH_DISPLAYEVENTMENU, wxCommandEventHandler(XCCalendarMonthView::ShowEventMenu));
-       Connect(ID_DELETEENTRY, XCCALENDARMONTH_DELETEENTRY, wxCommandEventHandler(XCCalendarMonthView::DeleteCalendarEntry));
-       Connect(ID_ADDENTRY, XCCALENDARMONTH_ADDENTRY, wxCommandEventHandler(XCCalendarMonthView::AddCalendarEntry));
-       Connect(ID_UPDATEENTRY, XCCALENDARMONTH_UPDATEENTRY, wxCommandEventHandler(XCCalendarMonthView::UpdateCalendarEntry));
-       Connect(ID_UPDATECOLOUR, XCCALENDARMONTH_UPDATECALENDARCOLOUR, wxCommandEventHandler(XCCalendarMonthView::UpdateCalendarColour));
+       // Bind events to the control.
 
+       Bind(XCCALENDARMONTH_DELETECALENDARENTRIES, &XCCalendarMonthView::DeselectOthersEvent, this, ID_MONTHVIEWCLEARSELECTION);
+       Bind(XCCALENDARMONTH_HIDEACCOUNTENTRIES, &XCCalendarMonthView::HideAccountEntries, this, ID_HIDEENTRIES);
+       Bind(XCCALENDARMONTH_SHOWACCOUNTENTRIES, &XCCalendarMonthView::ShowAccountEntries, this, ID_SHOWENTRIES);
+       Bind(XCCALENDARMONTH_HIDECALENDARENTRIES, &XCCalendarMonthView::HideCalendarEntries, this, ID_HIDECALENDARENTRIES);
+       Bind(XCCALENDARMONTH_SHOWCALENDARENTRIES, &XCCalendarMonthView::ShowCalendarEntries, this, ID_SHOWCALENDARENTRIES);
+       Bind(XCCALENDARMONTH_DELETECALENDARENTRIES, &XCCalendarMonthView::DeleteCalendarEntries, this, ID_DELETECALENDARENTRIES);
+       Bind(XCCALENDARMONTH_DISPLAYEVENTMENU, &XCCalendarMonthView::ShowEventMenu, this, ID_DISPLAYEVENTMENU);
+       Bind(XCCALENDARMONTH_DELETEENTRY, &XCCalendarMonthView::DeleteCalendarEntry, this, ID_DELETEENTRY);
+       Bind(XCCALENDARMONTH_ADDENTRY, &XCCalendarMonthView::AddCalendarEntry, this, ID_ADDENTRY);
+       Bind(XCCALENDARMONTH_UPDATEENTRY, &XCCalendarMonthView::UpdateCalendarEntry, this, ID_UPDATEENTRY);
+       Bind(XCCALENDARMONTH_UPDATECALENDARCOLOUR, &XCCalendarMonthView::UpdateCalendarColour, this, ID_UPDATECOLOUR);
 }
 
 XCCalendarMonthView::XCCalendarMonthView(XCCalendarMonthViewGrid *grid, CalendarDataStorage *dataStorage, std::vector<int> *hideAccounts, std::vector<int> *hideCalendars)
Xestia Software Development
Yn Maystri
© 2006 - 2019 Xestia Software Development
Software

Xestia Address Book
Xestia Calendar
Development

Xestia Gelforn
Everything else

About
News
Privacy Policy