Custom control : Fixed un-hovering for labels, which work as a hyperlinks

This commit is contained in:
YuSanka 2020-11-03 13:40:49 +01:00
parent 8af25f7771
commit 1c1b1bc019
2 changed files with 12 additions and 0 deletions

View File

@ -62,6 +62,7 @@ OG_CustomCtrl::OG_CustomCtrl( wxWindow* parent,
this->Bind(wxEVT_PAINT, &OG_CustomCtrl::OnPaint, this); this->Bind(wxEVT_PAINT, &OG_CustomCtrl::OnPaint, this);
this->Bind(wxEVT_MOTION, &OG_CustomCtrl::OnMotion, this); this->Bind(wxEVT_MOTION, &OG_CustomCtrl::OnMotion, this);
this->Bind(wxEVT_LEFT_DOWN, &OG_CustomCtrl::OnLeftDown, this); this->Bind(wxEVT_LEFT_DOWN, &OG_CustomCtrl::OnLeftDown, this);
this->Bind(wxEVT_LEAVE_WINDOW, &OG_CustomCtrl::OnLeaveWin, this);
} }
void OG_CustomCtrl::init_ctrl_lines() void OG_CustomCtrl::init_ctrl_lines()
@ -281,6 +282,16 @@ void OG_CustomCtrl::OnLeftDown(wxMouseEvent& event)
} }
void OG_CustomCtrl::OnLeaveWin(wxMouseEvent& event)
{
for (CtrlLine& line : ctrl_lines)
line.is_focused = false;
Refresh();
Update();
event.Skip();
}
bool OG_CustomCtrl::update_visibility(ConfigOptionMode mode) bool OG_CustomCtrl::update_visibility(ConfigOptionMode mode)
{ {
wxCoord v_pos = 0; wxCoord v_pos = 0;

View File

@ -78,6 +78,7 @@ public:
void OnPaint(wxPaintEvent&); void OnPaint(wxPaintEvent&);
void OnMotion(wxMouseEvent& event); void OnMotion(wxMouseEvent& event);
void OnLeftDown(wxMouseEvent& event); void OnLeftDown(wxMouseEvent& event);
void OnLeaveWin(wxMouseEvent& event);
void init_ctrl_lines(); void init_ctrl_lines();
bool update_visibility(ConfigOptionMode mode); bool update_visibility(ConfigOptionMode mode);