ENH: help video play failure

Change-Id: I5f847547877a82d626bffb78488e5f3d20cc56d0
This commit is contained in:
chunmao.guo 2022-09-09 15:05:59 +08:00 committed by Lane.Wei
parent 6dc68c4c9e
commit 70de37d1ae
5 changed files with 54 additions and 9 deletions

View file

@ -64,11 +64,36 @@ wxSize Label::split_lines(wxDC &dc, int width, const wxString &text, wxString &m
return dc.GetMultiLineTextExtent(multiline_text);
}
Label::Label(wxWindow *parent, wxString const &text) : Label(parent, Body_14, text) {}
Label::Label(wxWindow *parent, wxString const &text, long style) : Label(parent, Body_14, text, style) {}
Label::Label(wxWindow *parent, wxFont const &font, wxString const &text)
: wxStaticText(parent, wxID_ANY, text, wxDefaultPosition, wxDefaultSize, 0)
Label::Label(wxWindow *parent, wxFont const &font, wxString const &text, long style)
: wxStaticText(parent, wxID_ANY, text, wxDefaultPosition, wxDefaultSize, style)
{
this->font = font;
SetFont(font);
SetBackgroundColour(StaticBox::GetParentBackgroundColor(parent));
Bind(wxEVT_ENTER_WINDOW, [this](auto &e) {
if (GetWindowStyle() & LB_HYPERLINK) {
SetFont(this->font.Underlined());
Refresh();
}
});
Bind(wxEVT_LEAVE_WINDOW, [this](auto &e) {
SetFont(this->font);
Refresh();
});
}
void Label::SetWindowStyleFlag(long style)
{
wxStaticText::SetWindowStyleFlag(style);
if (style & LB_HYPERLINK) {
this->color = GetForegroundColour();
static wxColor clr_url("#00AE42");
SetForegroundColour(clr_url);
} else {
SetForegroundColour(this->color);
SetFont(this->font);
}
Refresh();
}

View file

@ -3,12 +3,21 @@
#include <wx/stattext.h>
#define LB_HYPERLINK 0x0001
class Label : public wxStaticText
{
public:
Label(wxWindow *parent, wxString const &text = {});
Label(wxWindow *parent, wxString const &text = {}, long style = 0);
Label(wxWindow *parent, wxFont const &font, wxString const &text = {});
Label(wxWindow *parent, wxFont const &font, wxString const &text = {}, long style = 0);
void SetWindowStyleFlag(long style) override;
private:
wxFont font;
wxColour color;
public:
static wxFont Head_24;

View file

@ -237,6 +237,7 @@ Button *SpinInput::createButton(bool inc)
});
btn->Bind(wxEVT_LEFT_DCLICK, [=](auto &e) {
delta = inc ? 1 : -1;
btn->CaptureMouse();
SetValue(val + delta);
sendSpinEvent();
});