ENH:Adaptive window width
jira: STUDIO-11300 Change-Id: I687985c29faf888b70474ee28784184ea0d98420
This commit is contained in:
parent
50059fad62
commit
49e2fcc1a9
|
@ -30,6 +30,14 @@ BaseTransparentDPIFrame::BaseTransparentDPIFrame(
|
||||||
// SetBackgroundStyle(wxBackgroundStyle::wxBG_STYLE_TRANSPARENT);
|
// SetBackgroundStyle(wxBackgroundStyle::wxBG_STYLE_TRANSPARENT);
|
||||||
SetTransparent(m_init_transparent);
|
SetTransparent(m_init_transparent);
|
||||||
SetBackgroundColour(wxColour(23, 25, 22, 128));
|
SetBackgroundColour(wxColour(23, 25, 22, 128));
|
||||||
|
//Adaptive Frame Width
|
||||||
|
wxClientDC dc(parent);
|
||||||
|
wxSize msg_sz = dc.GetMultiLineTextExtent(ok_text);
|
||||||
|
auto ratio = msg_sz.GetX() / (float) win_width;
|
||||||
|
if (ratio > 0.75f) {
|
||||||
|
win_width += msg_sz.GetX() / 2.0f;
|
||||||
|
}
|
||||||
|
|
||||||
SetMinSize(wxSize(FromDIP(win_width), -1));
|
SetMinSize(wxSize(FromDIP(win_width), -1));
|
||||||
SetMaxSize(wxSize(FromDIP(win_width), -1));
|
SetMaxSize(wxSize(FromDIP(win_width), -1));
|
||||||
SetPosition(dialog_pos);
|
SetPosition(dialog_pos);
|
||||||
|
|
Loading…
Reference in New Issue