XCCalendarDay::XCCalendarDay(wxWindow *parent, const wxString& title, const wxPoint& pos, const wxSize& size)
: wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL, title){
-
- Connect(wxID_ANY, XCCALENDARDAY_DESELECTOTHERENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectOthersEvent));
- Connect(ID_DESELECTALLITEMS, XCCALENDARDAY_DESELECTALLENTRIES, wxCommandEventHandler(XCCalendarDay::DeselectAllEvent));
this->SetMinSize( wxSize( 100,100 ) );
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));
+
}
XCCalendarDay::~XCCalendarDay(){
// Destory the controls from the widget.
+ for (vector<XCCalendarDayEntry*>::iterator CalendarEntryIter = CalendarEntryList.begin();
+ CalendarEntryIter != CalendarEntryList.end(); CalendarEntryIter++){
+
+ delete((*CalendarEntryIter));
+
+ }
+
+ CalendarEntryList.clear();
+
+ this->Refresh();
+
}
void XCCalendarDay::Repaint(){
void XCCalendarDay::DeselectOthersEvent(wxCommandEvent &DeselectEvent)
{
-
+
int SelectedEntryID = DeselectEvent.GetInt();
wxCommandEvent DeselectEntryEvent(XCCALENDARDAYENTRY_DESELECT);
+ DeselectEntryEvent.SetId(ID_ENTRYDESELECT);
for (vector<XCCalendarDayEntry*>::iterator EntryIter = CalendarEntryList.begin();
EntryIter != CalendarEntryList.end(); EntryIter++){
{
int SelectedEntryID = DeselectEvent.GetInt();
-
+
wxCommandEvent DeselectEntryEvent(XCCALENDARDAYENTRY_DESELECT);
+ DeselectEntryEvent.SetId(ID_ENTRYDESELECT);
for (vector<XCCalendarDayEntry*>::iterator EntryIter = CalendarEntryList.begin();
EntryIter != CalendarEntryList.end(); EntryIter++){
}
-void XCCalendarDay::SetupControl(int SetupDay, int SetupMonth, int SetupYear, bool SetupIsInMonth, XCCalendarMonthView *MonthViewPointer, CalendarDataStorage *dataStorage)
+void XCCalendarDay::SetupControl(int SetupDay, int SetupMonth, int SetupYear, bool SetupIsInMonth, XCCalendarMonthView *MonthViewPointer, CalendarDataStorage *dataStorage, vector<int> *hideAccounts, vector<int> *hideCalendars)
{
// Set the day
newEntry->SetColour(&newEntryCalendarInfo.calendarColour);
newEntry->SetTime(newEntryInfo.entryStartHour, newEntryInfo.entryStartMinute, newEntryInfo.entryStartSecond);
- newEntry->SetEntryIDs(newEntryCalendarInfo.accountID, newEntryInfo.calendarID, newEntryInfo.calendarEntryID);
+ newEntry->SetEntryIDs(newEntryCalendarInfo.accountID, newEntryInfo.calendarID, newEntryInfo.calendarEntryID);
EventListFrameSizer->Add(newEntry, 0, wxEXPAND, 5);
wxSizerItem *afterSpacer = EventListFrameSizer->Add(0, 5, 0, 0, 5);
newEntry->SetAfterSpacer(afterSpacer);
+ // Go through the list of calendar entries to hide by account.
+
+ for (vector<int>::iterator hideAccountsItem = hideAccounts->begin();
+ hideAccountsItem != hideAccounts->end(); hideAccountsItem++){
+
+ if (*hideAccountsItem = newEntryCalendarInfo.accountID){
+ newEntry->Show(false);
+ newEntry->GetAfterSpacer()->Show(false);
+ }
+
+ }
+
+ // Go through the list of calendar entries to hide by calendar.
+
+ for (vector<int>::iterator hideCalendarsItem = hideCalendars->begin();
+ hideCalendarsItem != hideCalendars->end(); hideCalendarsItem++){
+
+ if (*hideCalendarsItem == newEntryInfo.calendarID){
+ newEntry->Show(false);
+ newEntry->GetAfterSpacer()->Show(false);
+ }
+
+ }
+
CalendarEntryList.push_back(newEntry);
}
}
+
+void XCCalendarDay::HideAccountEntries(wxCommandEvent &accountData){
+
+ // Go through each of the controls and hide the controls (and spacing) that
+ // have the matched account IDs.
+
+ int sizerPosition = 0;
+
+ for (vector<XCCalendarDayEntry*>::iterator CalendarEntryIter = CalendarEntryList.begin();
+ CalendarEntryIter != CalendarEntryList.end(); CalendarEntryIter++){
+
+ (*CalendarEntryIter)->SetShowAccountStatus(false);
+
+ if ((*CalendarEntryIter)->GetAccountID() == accountData.GetInt()){
+
+ wxSizerItem *calendarItem = EventListFrameSizer->GetItem((*CalendarEntryIter));
+ (*CalendarEntryIter)->Show(false);
+
+ // Get the spacing and hide it as well.
+
+ wxSizerItem *afterSpacer = (*CalendarEntryIter)->GetAfterSpacer();
+ afterSpacer->Show(false);
+
+ }
+
+ }
+
+ this->Refresh();
+ Repaint();
+
+}
+
+void XCCalendarDay::ShowAccountEntries(wxCommandEvent &accountData){
+
+ // Go through each of the controls and hide the controls (and spacing) that
+ // have the matched account IDs.
+
+ int sizerPosition = 0;
+
+ for (vector<XCCalendarDayEntry*>::iterator CalendarEntryIter = CalendarEntryList.begin();
+ CalendarEntryIter != CalendarEntryList.end(); CalendarEntryIter++){
+
+ (*CalendarEntryIter)->SetShowAccountStatus(true);
+
+ if ((*CalendarEntryIter)->GetShowCalendarStatus() == false){
+ continue;
+ }
+
+ if ((*CalendarEntryIter)->GetAccountID() == accountData.GetInt()){
+
+ wxSizerItem *calendarItem = EventListFrameSizer->GetItem((*CalendarEntryIter));
+ (*CalendarEntryIter)->Show(true);
+
+ // Get the spacing and hide it as well.
+
+ wxSizerItem *afterSpacer = (*CalendarEntryIter)->GetAfterSpacer();
+ afterSpacer->Show(true);
+
+ }
+
+ }
+
+ this->Refresh();
+ Repaint();
+
+}
+
+void XCCalendarDay::HideCalendarEntries(wxCommandEvent &calendarData){
+
+ // Go through each of the controls and hide the controls (and spacing) that
+ // have the matched account IDs.
+
+ int sizerPosition = 0;
+
+ for (vector<XCCalendarDayEntry*>::iterator CalendarEntryIter = CalendarEntryList.begin();
+ CalendarEntryIter != CalendarEntryList.end(); CalendarEntryIter++){
+
+ if ((*CalendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
+
+ (*CalendarEntryIter)->SetShowCalendarStatus(false);
+
+ wxSizerItem *calendarItem = EventListFrameSizer->GetItem((*CalendarEntryIter));
+ (*CalendarEntryIter)->Show(false);
+
+ // Get the spacing and hide it as well.
+
+ wxSizerItem *afterSpacer = (*CalendarEntryIter)->GetAfterSpacer();
+ afterSpacer->Show(false);
+
+ }
+
+ }
+
+ this->Refresh();
+ Repaint();
+
+}
+
+void XCCalendarDay::ShowCalendarEntries(wxCommandEvent &calendarData){
+
+ // Go through each of the controls and hide the controls (and spacing) that
+ // have the matched account IDs.
+
+ int sizerPosition = 0;
+
+ for (vector<XCCalendarDayEntry*>::iterator CalendarEntryIter = CalendarEntryList.begin();
+ CalendarEntryIter != CalendarEntryList.end(); CalendarEntryIter++){
+
+ if ((*CalendarEntryIter)->GetCalendarID() == calendarData.GetInt()){
+
+ (*CalendarEntryIter)->SetShowCalendarStatus(true);
+
+ if ((*CalendarEntryIter)->GetShowAccountStatus() == false){
+
+ // Don't show the calendar entry because the account status
+ // is set to hidden. Continue to the next one.
+
+ continue;
+
+ }
+
+ wxSizerItem *calendarItem = EventListFrameSizer->GetItem((*CalendarEntryIter));
+ (*CalendarEntryIter)->Show(true);
+
+ // Get the spacing and hide it as well.
+
+ wxSizerItem *afterSpacer = (*CalendarEntryIter)->GetAfterSpacer();
+ afterSpacer->Show(true);
+
+ }
+
+ }
+
+ this->Refresh();
+ Repaint();
+
+}
\ No newline at end of file