X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=blobdiff_plain;f=source%2Fwidgets%2FXCCalendarListCalendarCtrl.cpp;h=3729231539ae7090255d869fadae95af1370a382;hp=758fb4b33d6ffb9ce0fb4d7af34ec04f35c56172;hb=c5716d0f27f0f917282df9121aa97eab7a1bf6b8;hpb=4d0316bf5312ee073aef9f2199f43b70aa147e7a diff --git a/source/widgets/XCCalendarListCalendarCtrl.cpp b/source/widgets/XCCalendarListCalendarCtrl.cpp index 758fb4b..3729231 100644 --- a/source/widgets/XCCalendarListCalendarCtrl.cpp +++ b/source/widgets/XCCalendarListCalendarCtrl.cpp @@ -30,8 +30,6 @@ XCCalendarListCalendarCtrl::XCCalendarListCalendarCtrl(wxWindow* parent, string // Setup the checkbox. - //chkShowAll = new wxCheckBox(); - chkShowCalendar = new wxCheckBox(this, wxID_ANY, "", wxPoint(0,0), wxDefaultSize, wxCHK_3STATE, wxDefaultValidator, ""); // Setup the label. @@ -43,6 +41,12 @@ XCCalendarListCalendarCtrl::XCCalendarListCalendarCtrl(wxWindow* parent, string pnlColour = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(16,16), 0, ""); pnlColour->SetBackgroundColour(wxColour(calendarColour.red, calendarColour.green, calendarColour.blue, calendarColour.alpha)); + // Setup the popup menu. + + calendarMenu = new XCCalendarMenu(); + calendarMenu->SetWindowPointer(this); + calendarMenu->SetPopupPointer((wxPopupTransientWindow*)this->GetParent()); + // Connect them to the sizer. szrMain->Add(15, 0, 0, 0, 5); @@ -53,6 +57,10 @@ XCCalendarListCalendarCtrl::XCCalendarListCalendarCtrl(wxWindow* parent, string // Connect the events to the controls. chkShowCalendar->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxMouseEventHandler(XCCalendarListCalendarCtrl::ShowAllCheckboxClick), NULL, this); + chkShowCalendar->Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarListCalendarCtrl::PopupMenu), NULL, this); + lblCalendarName->Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarListCalendarCtrl::PopupMenu), NULL, this); + pnlColour->Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarListCalendarCtrl::PopupMenu), NULL, this); + Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarListCalendarCtrl::PopupMenu), NULL, this); chkShowCalendar->SetValue(wxCHK_CHECKED); } @@ -78,6 +86,14 @@ int XCCalendarListCalendarCtrl::GetCalendarID(){ void XCCalendarListCalendarCtrl::SetCalendarID(int calendarID){ this->calendarID = calendarID; + calendarMenu->SetCalendarID(this->calendarID); + +} + +void XCCalendarListCalendarCtrl::SetAccountPreferencesID(int accountPreferencesID){ + + this->accountPreferencesID = accountPreferencesID; + calendarMenu->SetAccountPreferencesID(this->accountPreferencesID); } @@ -99,4 +115,22 @@ void XCCalendarListCalendarCtrl::ShowAllCheckboxClick( wxMouseEvent &mouseEvent } +} + +void XCCalendarListCalendarCtrl::SetCheckBoxValue(wxCheckBoxState newValue){ + + if (newValue == wxCHK_CHECKED){ + showCalendar = true; + } else { + showCalendar = false; + } + + chkShowCalendar->SetValue(newValue); + +} + +void XCCalendarListCalendarCtrl::PopupMenu( wxMouseEvent &mouseEvent ){ + + this->GetParent()->GetParent()->GetParent()->GetParent()->PopupMenu(calendarMenu->MenuPointer(), wxDefaultPosition); + } \ No newline at end of file