X-Git-Url: http://Server1/repobrowser/?p=xestiacalendar%2F.git;a=blobdiff_plain;f=source%2Fwidgets%2FXCCalendarManipulator.cpp;h=4ca64bc9aced30497f2aa2c475d5bf8714beae65;hp=c71692c02ae7ddafd19451f7a9ad91d8358669a4;hb=df012cf9ec9670db199095c4f4408dff556c4d5f;hpb=7644bfc35e0d53134b1dc98d98278ca1e73051e3 diff --git a/source/widgets/XCCalendarManipulator.cpp b/source/widgets/XCCalendarManipulator.cpp index c71692c..4ca64bc 100644 --- a/source/widgets/XCCalendarManipulator.cpp +++ b/source/widgets/XCCalendarManipulator.cpp @@ -27,7 +27,11 @@ XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& t : 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); +#if defined(__APPLE__) + pnlMain->SetBackgroundColour(wxColour(120,120,120)); +#else pnlMain->SetBackgroundColour(wxColour(40,40,40)); +#endif this->SetSizer(szrMain); szrMain->Add(pnlMain, 0, wxEXPAND, 0); @@ -89,7 +93,7 @@ XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& t wxDateTime dtNow = wxDateTime::Now(); -#if defined(WIN32) +#if defined(WIN32) || defined(__APPLE__) moo = new frmCalendarSelectMonth(this); #else moo = new XCCalendarMonthSelect(this); @@ -114,7 +118,20 @@ XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& t calendarsButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::ShowCalendarsList), NULL, this); previousButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::PreviousMonth), NULL, this); +#if defined(WIN32) + dateButton->Connect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseover), NULL, this); + dateButton->Connect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseout), NULL, this); + nextButton->Connect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseover), NULL, this); + nextButton->Connect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseout), NULL, this); + calendarsButton->Connect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseover), NULL, this); + calendarsButton->Connect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseout), NULL, this); + previousButton->Connect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseover), NULL, this); + previousButton->Connect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseout), NULL, this); +#endif + Bind(XCCALENDARMANIPULATOR_CHANGEGRID, &XCCalendarManipulator::ChangeGrid, this, ID_CHANGEGRID); + + this->Refresh(); } XCCalendarManipulator::~XCCalendarManipulator(){ @@ -127,11 +144,11 @@ void XCCalendarManipulator::DateTextClick(wxCommandEvent &event){ // Bring up a popup control to select the month and year. - // TODO: Do something different for Win32. + // Do something different for Win32 and macOS. moo->SetPosition(wxPoint(dateButton->GetScreenRect().GetLeft(), dateButton->GetScreenRect().GetBottom())); moo->UpdateDate(month, year); -#if defined(WIN32) +#if defined(WIN32) || defined(__APPLE__) moo->ShowModal(); #else moo->Popup(); @@ -228,8 +245,22 @@ void XCCalendarManipulator::ShowCalendarsList(wxCommandEvent &event){ calendarList->SetPosition(wxPoint(calendarsButton->GetScreenRect().GetLeft(), calendarsButton->GetScreenRect().GetBottom())); calendarList->UpdateCalendarList(dataStorage); +#if defined(__APPLE__) + + if (calendarListShow == false) + { + calendarList->Show(); + calendarListShow = true; + } + else + { + calendarList->Hide(); + calendarListShow = false; + } +#else calendarList->Popup(); - +#endif + } void XCCalendarManipulator::UpdateDateButtonText(){ @@ -308,4 +339,16 @@ vector XCCalendarManipulator::GetHiddenCalendarsList(){ return calendarList->GetHiddenCalendarsList(); +} + +void XCCalendarManipulator::ButtonMouseover(wxMouseEvent &event) +{ + wxWindow *eventObject = (wxWindow*)event.GetEventObject(); + eventObject->SetWindowStyle(0 | wxSIMPLE_BORDER); +} + +void XCCalendarManipulator::ButtonMouseout(wxMouseEvent &event) +{ + wxWindow *eventObject = (wxWindow*)event.GetEventObject(); + eventObject->SetWindowStyle(0 | wxNO_BORDER); } \ No newline at end of file