X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=blobdiff_plain;f=source%2Fwidgets%2FXCCalendarListAccountCtrl.cpp;h=5674da72d5626b44c306f5c1cb937b70ec65e29f;hp=7ae30f896a645f0dd980b757d987ee2502d42d3b;hb=baa27c175ee6111fd4b88a3c53614a9b6be3541e;hpb=e79afea4cd8930a1ebbdda0e3543dd0a89e45b34 diff --git a/source/widgets/XCCalendarListAccountCtrl.cpp b/source/widgets/XCCalendarListAccountCtrl.cpp index 7ae30f8..5674da7 100644 --- a/source/widgets/XCCalendarListAccountCtrl.cpp +++ b/source/widgets/XCCalendarListAccountCtrl.cpp @@ -18,6 +18,9 @@ #include "XCCalendarListAccountCtrl.h" +BEGIN_EVENT_TABLE(XCCalendarListAccountCtrl, wxPanel) +END_EVENT_TABLE() + using namespace std; XCCalendarListAccountCtrl::XCCalendarListAccountCtrl(wxWindow* parent, string accountName) : @@ -42,6 +45,11 @@ XCCalendarListAccountCtrl::XCCalendarListAccountCtrl(wxWindow* parent, string ac accountFont.MakeBold(); lblAccountName->SetFont(accountFont); + // Connect events to the controls. + + chkShowAll->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxMouseEventHandler(XCCalendarListAccountCtrl::ShowAllCheckboxClick), NULL, this); + chkShowAll->SetValue(wxCHK_CHECKED); + // Connect them to the sizer. szrMain->Add(chkShowAll, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5); @@ -53,6 +61,19 @@ XCCalendarListAccountCtrl::~XCCalendarListAccountCtrl(){ // Delete the calendar controls. + for (std::vector::iterator calendarIter = calendarControlList.begin(); + calendarIter != calendarControlList.end(); calendarIter++){ + + delete *calendarIter; + + } + + // Clear the list of deleted controls. + + calendarControlList.clear(); + + // Clear the widget controls. + } void XCCalendarListAccountCtrl::AddCalendar(XCCalendarListCalendarCtrl *calendarControl){ @@ -65,4 +86,61 @@ void XCCalendarListAccountCtrl::AddCalendar(XCCalendarListCalendarCtrl *calendar calendarControlList.push_back(calendarControl); +} + +void XCCalendarListAccountCtrl::ShowAllCheckboxClick( wxMouseEvent &mouseEvent ){ + + if (chkShowAll->Get3StateValue() == wxCHK_CHECKED){ + + wxCommandEvent event(XCCALENDARCTRL_SHOWACCOUNTENTRIES); + event.SetInt(accountID); + event.SetId(ID_SHOWENTRIES); + wxPostEvent(this->GetParent()->GetParent()->GetParent(), event); + + } else { + + wxCommandEvent event(XCCALENDARCTRL_HIDEACCOUNTENTRIES); + event.SetInt(accountID); + event.SetId(ID_HIDEENTRIES); + wxPostEvent(this->GetParent()->GetParent()->GetParent(), event); + + } + +} + +wxCheckBoxState XCCalendarListAccountCtrl::GetShowCheckboxState(){ + + return chkShowAll->Get3StateValue(); + +} + +int XCCalendarListAccountCtrl::GetAccountID(){ + + return accountID; + +} + +void XCCalendarListAccountCtrl::SetAccountID(int accountID){ + + this->accountID = accountID; + +} + +vector XCCalendarListAccountCtrl::GetHiddenCalendarList(){ + + vector calendarList; + + for (vector::iterator calendarControlListIter = calendarControlList.begin(); + calendarControlListIter != calendarControlList.end(); calendarControlListIter++){ + + if ((*calendarControlListIter)->GetShowCheckboxState() == wxCHK_UNCHECKED){ + + calendarList.push_back((*calendarControlListIter)->GetCalendarID()); + + } + + } + + return calendarList; + } \ No newline at end of file