Home | News | Projects | Releases
Bugs | RFE | Repositories | Help
Events: Now using wxDEFINE_EVENT, wxDECLARE_EVENT and Bind
[xestiacalendar/.git] / source / widgets / XCCalendarManipulator.cpp
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(){
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