FIX:speed ctrl in device

1.the speed ctrl shouldn't open popup when the printer is in idle status.
2.add tooltip

Change-Id: I3b0b4c58ef1c1961835ee2e06b2e7f3cccb53428
This commit is contained in:
liz.li 2022-09-05 17:08:12 +08:00 committed by Lane.Wei
parent b025de8746
commit e6f0c5abec
3 changed files with 21 additions and 3 deletions

View file

@ -58,6 +58,10 @@ bool StepCtrlBase::SetTipFont(wxFont const& font)
return true;
}
void StepCtrlBase::SetHint(wxString hint) {
this->hint = hint;
}
int StepCtrlBase::AppendItem(const wxString &item, wxString const & tip)
{
steps.push_back(item);
@ -181,6 +185,12 @@ void StepCtrl::doRender(wxDC &dc)
int circleY = size.y / 2;
dc.SetPen(wxPen(clr_step.colorForStates(states)));
dc.SetBrush(wxBrush(clr_step.colorForStates(states)));
if (!hint.empty()) {
dc.SetFont(font_tip);
dc.SetTextForeground(clr_tip.colorForStates(states));
wxSize sz = dc.GetTextExtent(hint);
dc.DrawText(hint, dc.GetCharWidth(), circleY - FromDIP(20) - sz.y);
}
for (int i = 0; i < steps.size(); ++i) {
bool check = (pos_thumb == wxPoint{0, 0} ? step : pos_thumb.y) == i;
dc.DrawEllipse(circleX - radius, circleY - radius, radius * 2, radius * 2);