FIX: [STUDIO-3374] DropDown only show tooltip for ellipsize text

Change-Id: I719df15ff5f6601ecbadfb3f483c4a48a90523f4
This commit is contained in:
chunmao.guo 2023-06-28 11:54:51 +08:00 committed by Lane.Wei
parent 63029c628a
commit ff45fc536a
2 changed files with 4 additions and 2 deletions

View file

@ -300,6 +300,8 @@ void DropDown::render(wxDC &dc)
if (!text_off && !text.IsEmpty()) {
wxSize tSize = dc.GetMultiLineTextExtent(text);
if (pt.x + tSize.x > rcContent.GetRight()) {
if (i == hover_item)
SetToolTip(text);
text = wxControl::Ellipsize(text, dc, wxELLIPSIZE_END,
rcContent.GetRight() - pt.x);
}
@ -444,8 +446,7 @@ void DropDown::mouseMove(wxMouseEvent &event)
if (hover >= (int) texts.size()) hover = -1;
if (hover == hover_item) return;
hover_item = hover;
if (hover >= 0)
SetToolTip(texts[hover]);
SetToolTip("");
}
paintNow();
}