From 7fd3615231b1780c3d5304e17f09d2c5ebb9a6f5 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Wed, 19 Jul 2017 22:58:17 +0100 Subject: [PATCH] XCCalendarManipulator: Show simple border for buttons on mouse over and no border on mouse out --- source/widgets/XCCalendarManipulator.cpp | 23 ++++++++++++++++++++++- source/widgets/XCCalendarManipulator.h | 4 ++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/source/widgets/XCCalendarManipulator.cpp b/source/widgets/XCCalendarManipulator.cpp index c71692c..131146f 100644 --- a/source/widgets/XCCalendarManipulator.cpp +++ b/source/widgets/XCCalendarManipulator.cpp @@ -110,11 +110,20 @@ XCCalendarManipulator::XCCalendarManipulator(wxWindow* parent, const wxString& t // Setup the event controls. dateButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::DateTextClick), NULL, this); + dateButton->Connect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseover), NULL, this); + dateButton->Connect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseout), NULL, this); nextButton->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::NextMonth), 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_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::ShowCalendarsList), 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_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(XCCalendarManipulator::PreviousMonth), NULL, this); - + previousButton->Connect(wxEVT_ENTER_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseover), NULL, this); + previousButton->Connect(wxEVT_LEAVE_WINDOW, wxMouseEventHandler(XCCalendarManipulator::ButtonMouseout), NULL, this); Bind(XCCALENDARMANIPULATOR_CHANGEGRID, &XCCalendarManipulator::ChangeGrid, this, ID_CHANGEGRID); + + this->Refresh(); } XCCalendarManipulator::~XCCalendarManipulator(){ @@ -308,4 +317,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 diff --git a/source/widgets/XCCalendarManipulator.h b/source/widgets/XCCalendarManipulator.h index 8f46398..4e5bb7e 100644 --- a/source/widgets/XCCalendarManipulator.h +++ b/source/widgets/XCCalendarManipulator.h @@ -62,8 +62,8 @@ class XCCalendarManipulator: public wxPanel void UpdateDateButtonText(); protected: - void DateTextMouseover(wxMouseEvent &event); - void DateTextMouseout(wxMouseEvent &event); + void ButtonMouseover(wxMouseEvent &event); + void ButtonMouseout(wxMouseEvent &event); void DateTextClick(wxCommandEvent &event); void ChangeGrid(wxCommandEvent &event); void NextMonth(wxCommandEvent &event); -- 2.39.5