X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=blobdiff_plain;f=source%2Fwidgets%2FXCCalendarDayEntry.cpp;h=7ec8de0017343aaa4023dadded50dd108ab0874a;hp=d2d948305fa97ea5965be7579c35154f53c8f81f;hb=c5716d0f27f0f917282df9121aa97eab7a1bf6b8;hpb=4d0316bf5312ee073aef9f2199f43b70aa147e7a diff --git a/source/widgets/XCCalendarDayEntry.cpp b/source/widgets/XCCalendarDayEntry.cpp index d2d9483..7ec8de0 100644 --- a/source/widgets/XCCalendarDayEntry.cpp +++ b/source/widgets/XCCalendarDayEntry.cpp @@ -21,7 +21,8 @@ BEGIN_EVENT_TABLE(XCCalendarDayEntry, wxPanel) EVT_PAINT(XCCalendarDayEntry::PaintFrameEvent) EVT_SIZE(XCCalendarDayEntry::ResizeFrameEvent) -EVT_LEFT_DOWN(XCCalendarDayEntry::LeftClick) +EVT_LEFT_UP(XCCalendarDayEntry::LeftClick) +EVT_RIGHT_UP(XCCalendarDayEntry::RightClick) END_EVENT_TABLE() using namespace std; @@ -30,7 +31,7 @@ XCCalendarDayEntry::XCCalendarDayEntry(wxWindow* parent, const wxString& title, : wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL, title){ DayPanel = parent->GetParent(); - entryID = id; + eventID = id; this->SetMinSize(wxSize(65, 30)); @@ -55,12 +56,19 @@ XCCalendarDayEntry::XCCalendarDayEntry(wxWindow* parent, const wxString& title, 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); EventText->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this); EventTime->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this); DayPanel->Connect(wxEVT_LEFT_UP, wxMouseEventHandler(XCCalendarDayEntry::LeftClick), NULL, this); + AlarmIcon->Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this); + HighPriorityIcon->Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this); + EventText->Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this); + EventTime->Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this); + DayPanel->Connect(wxEVT_RIGHT_UP, wxMouseEventHandler(XCCalendarDayEntry::RightClick), NULL, this); + UpdateInformation(); } @@ -200,12 +208,27 @@ void XCCalendarDayEntry::LeftClick(wxMouseEvent &MouseEvent){ this->SetBackgroundColour(wxColor(255,215,0)); wxCommandEvent DeselectOthersEvent(XCCALENDARDAY_DESELECTOTHERENTRIES); - DeselectOthersEvent.SetInt(entryID); + DeselectOthersEvent.SetInt(eventID); DeselectOthersEvent.SetId(ID_DESELECTOTHERENTRIES); wxPostEvent(DayPanel, DeselectOthersEvent); } +void XCCalendarDayEntry::RightClick(wxMouseEvent &MouseEvent){ + + // Sent an event to the month view control. + + EventProperties *eventData = new EventProperties; + eventData->calendarID = calendarID; + eventData->eventID = eventID; + + wxCommandEvent eventMenu(XCCALENDARMONTH_DISPLAYEVENTMENU); + eventMenu.SetClientData(eventData); + eventMenu.SetId(ID_DISPLAYEVENTMENU); + wxPostEvent(this->GetParent()->GetParent(), eventMenu); + +} + void XCCalendarDayEntry::Deselect(wxCommandEvent &DeselectEvent){ this->SetBackgroundColour(wxNullColour); @@ -258,7 +281,7 @@ bool XCCalendarDayEntry::GetDisplayHighPriority(){ int XCCalendarDayEntry::GetID(){ - return entryID; + return eventID; } @@ -268,6 +291,12 @@ int XCCalendarDayEntry::GetCalendarID(){ } +int XCCalendarDayEntry::GetEventID(){ + + return eventID; + +} + int XCCalendarDayEntry::GetAccountID(){ return accountID; @@ -310,11 +339,11 @@ string XCCalendarDayEntry::BuildEventTime(int timeHour, int timeMinute){ } -void XCCalendarDayEntry::SetEntryIDs(int accountID, int calendarID, int entryID){ +void XCCalendarDayEntry::SetEntryIDs(int accountID, int calendarID, int eventID){ this->accountID = accountID; this->calendarID = calendarID; - this->entryID = entryID; + this->eventID = eventID; } @@ -324,6 +353,12 @@ void XCCalendarDayEntry::SetAfterSpacer(wxSizerItem *afterSpacer){ } +void XCCalendarDayEntry::SetEventName(string eventName){ + + EventText->SetLabel((wxString)eventName); + +} + wxSizerItem* XCCalendarDayEntry::GetAfterSpacer(){ return afterSpacer;