Ensure wxMiniFrame title bar height is big enough in wxGTK
Hardcoded 16px could be insufficient for the font size being used, resulting in the title text being truncated. Closes #22534.
This commit is contained in:
parent
dd5162ee1d
commit
3b6595184f
@ -92,6 +92,7 @@ static gboolean expose_event(GtkWidget* widget, GdkEventExpose* gdk_event, wxMin
|
||||
if (win->m_miniTitle && !win->GetTitle().empty())
|
||||
{
|
||||
dc.SetFont( *wxSMALL_FONT );
|
||||
int height = wxMax(dc.GetTextExtent("X").y, 16);
|
||||
|
||||
wxBrush brush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
|
||||
dc.SetBrush( brush );
|
||||
@ -99,16 +100,20 @@ static gboolean expose_event(GtkWidget* widget, GdkEventExpose* gdk_event, wxMin
|
||||
dc.DrawRectangle( win->m_miniEdge-1,
|
||||
win->m_miniEdge-1,
|
||||
win->m_width - (2*(win->m_miniEdge-1)),
|
||||
15 );
|
||||
height );
|
||||
|
||||
const wxColour textColor = wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHTTEXT);
|
||||
dc.SetTextForeground(textColor);
|
||||
dc.DrawText( win->GetTitle(), 6, 4 );
|
||||
dc.DrawText( win->GetTitle(), 6, 2 );
|
||||
|
||||
if (style & wxCLOSE_BOX)
|
||||
{
|
||||
dc.SetTextBackground(textColor);
|
||||
dc.DrawBitmap( win->m_closeButton, win->m_width-18, 3, true );
|
||||
dc.DrawBitmap(
|
||||
win->m_closeButton,
|
||||
win->m_width-18,
|
||||
win->m_miniEdge - 1 + (height - 16) / 2,
|
||||
true );
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,10 +328,16 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
|
||||
const wxPoint &pos, const wxSize &size,
|
||||
long style, const wxString &name )
|
||||
{
|
||||
wxFrame::Create( parent, id, title, pos, size, style, name );
|
||||
|
||||
m_isDragMove = false;
|
||||
m_miniTitle = 0;
|
||||
if (style & wxCAPTION)
|
||||
m_miniTitle = 16;
|
||||
{
|
||||
wxClientDC dc(this);
|
||||
dc.SetFont(*wxSMALL_FONT);
|
||||
m_miniTitle = wxMax(dc.GetTextExtent("X").y, 16);
|
||||
}
|
||||
|
||||
if (style & wxRESIZE_BORDER)
|
||||
m_miniEdge = 4;
|
||||
@ -341,8 +352,6 @@ bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title
|
||||
if (m_minHeight < minHeight)
|
||||
m_minHeight = minHeight;
|
||||
|
||||
wxFrame::Create( parent, id, title, pos, size, style, name );
|
||||
|
||||
// Use a GtkEventBox for the title and borders. Using m_widget for this
|
||||
// almost works, except that setting the resize cursor has no effect.
|
||||
GtkWidget* eventbox = gtk_event_box_new();
|
||||
|
Loading…
Reference in New Issue
Block a user