virtual void PositionToolBar();
#endif // wxUSE_TOOLBAR
+ virtual int GetMinWidth() const;
+ virtual int GetMinHeight() const;
+
protected:
void OnSize(wxSizeEvent& event);
// get size of whole top level window, given size of its client area size
virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const = 0;
+ // get the minimal size of top level window
+ virtual wxSize GetFrameMinSize(int flags) const = 0;
+
// get titlebar icon size
virtual wxSize GetFrameIconSize() const = 0;
{ return m_renderer->GetFrameClientArea(rect, flags); }
virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const
{ return m_renderer->GetFrameTotalSize(clientSize, flags); }
+ virtual wxSize GetFrameMinSize(int flags) const
+ { return m_renderer->GetFrameMinSize(flags); }
virtual wxSize GetFrameIconSize() const
{ return m_renderer->GetFrameIconSize(); }
virtual int HitTestFrame(const wxRect& rect,
// move/resize the frame interactively, i.e. let the user do it
virtual void InteractiveMove(int flags = wxINTERACTIVE_MOVE);
+ virtual int GetMinWidth() const;
+ virtual int GetMinHeight() const;
+
protected:
// handle titlebar button click event
virtual void ClickTitleBarButton(long button);
int maxW = -1, int maxH = -1,
int incW = -1, int incH = -1 );
- int GetMinWidth() const { return m_minWidth; }
- int GetMinHeight() const { return m_minHeight; }
+ virtual int GetMinWidth() const { return m_minWidth; }
+ virtual int GetMinHeight() const { return m_minHeight; }
int GetMaxWidth() const { return m_maxWidth; }
int GetMaxHeight() const { return m_maxHeight; }
skip the part which handles m_frameMenuBar, m_frameToolBar and (most
importantly) m_mainWidget */
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
+
+ if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
+ if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
+ if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
+ if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
if (m_mainWidget)
{
/* set size hints */
gint flag = 0; // GDK_HINT_POS;
- if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
- if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
+ if ((minWidth != -1) || (minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
+ if ((maxWidth != -1) || (maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
GdkGeometry geom;
- geom.min_width = m_minWidth;
- geom.min_height = m_minHeight;
- geom.max_width = m_maxWidth;
- geom.max_height = m_maxHeight;
+ geom.min_width = minWidth;
+ geom.min_height = minHeight;
+ geom.max_width = maxWidth;
+ geom.max_height = maxHeight;
gtk_window_set_geometry_hints( GTK_WINDOW(m_widget),
(GtkWidget*) NULL,
&geom,
}
*/
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
+
+ if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
+ if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
+ if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
+ if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
if ((m_x != -1) || (m_y != -1))
{
m_width = width;
m_height = height;
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
+
+ if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
+ if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
+ if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
+ if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
/* set size hints */
gint flag = 0; // GDK_HINT_POS;
- if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
- if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
+ if ((minWidth != -1) || (minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
+ if ((maxWidth != -1) || (maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
GdkGeometry geom;
- geom.min_width = m_minWidth;
- geom.min_height = m_minHeight;
- geom.max_width = m_maxWidth;
- geom.max_height = m_maxHeight;
+ geom.min_width = minWidth;
+ geom.min_height = minHeight;
+ geom.max_width = maxWidth;
+ geom.max_height = maxHeight;
gtk_window_set_geometry_hints( GTK_WINDOW(m_widget),
(GtkWidget*) NULL,
&geom,
}
*/
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
+
+ if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
+ if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
+ if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
+ if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
if ((m_x != -1) || (m_y != -1))
{
skip the part which handles m_frameMenuBar, m_frameToolBar and (most
importantly) m_mainWidget */
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
+
+ if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
+ if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
+ if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
+ if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
if (m_mainWidget)
{
// set size hints
gint flag = 0; // GDK_HINT_POS;
- if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
- if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
+ if ((minWidth != -1) || (minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
+ if ((maxWidth != -1) || (maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
GdkGeometry geom;
- geom.min_width = m_minWidth;
- geom.min_height = m_minHeight;
- geom.max_width = m_maxWidth;
- geom.max_height = m_maxHeight;
+ geom.min_width = minWidth;
+ geom.min_height = minHeight;
+ geom.max_width = maxWidth;
+ geom.max_height = maxHeight;
gtk_window_set_geometry_hints( GTK_WINDOW(m_widget),
(GtkWidget*) NULL,
&geom,
if (height == -1) m_height = 26;
}
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
+
+ if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
+ if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
+ if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
+ if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
int border = 0;
int bottom_border = 0;
skip the part which handles m_frameMenuBar, m_frameToolBar and (most
importantly) m_mainWidget */
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
+
+ if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
+ if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
+ if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
+ if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
if (m_mainWidget)
{
/* set size hints */
gint flag = 0; // GDK_HINT_POS;
- if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
- if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
+ if ((minWidth != -1) || (minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
+ if ((maxWidth != -1) || (maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
GdkGeometry geom;
- geom.min_width = m_minWidth;
- geom.min_height = m_minHeight;
- geom.max_width = m_maxWidth;
- geom.max_height = m_maxHeight;
+ geom.min_width = minWidth;
+ geom.min_height = minHeight;
+ geom.max_width = maxWidth;
+ geom.max_height = maxHeight;
gtk_window_set_geometry_hints( GTK_WINDOW(m_widget),
(GtkWidget*) NULL,
&geom,
}
*/
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
+
+ if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
+ if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
+ if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
+ if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
if ((m_x != -1) || (m_y != -1))
{
m_width = width;
m_height = height;
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
+
+ if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
+ if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
+ if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
+ if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
/* set size hints */
gint flag = 0; // GDK_HINT_POS;
- if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
- if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
+ if ((minWidth != -1) || (minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
+ if ((maxWidth != -1) || (maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
GdkGeometry geom;
- geom.min_width = m_minWidth;
- geom.min_height = m_minHeight;
- geom.max_width = m_maxWidth;
- geom.max_height = m_maxHeight;
+ geom.min_width = minWidth;
+ geom.min_height = minHeight;
+ geom.max_width = maxWidth;
+ geom.max_height = maxHeight;
gtk_window_set_geometry_hints( GTK_WINDOW(m_widget),
(GtkWidget*) NULL,
&geom,
}
*/
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
+
+ if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
+ if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
+ if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
+ if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
if ((m_x != -1) || (m_y != -1))
{
skip the part which handles m_frameMenuBar, m_frameToolBar and (most
importantly) m_mainWidget */
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
+
+ if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
+ if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
+ if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
+ if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
if (m_mainWidget)
{
// set size hints
gint flag = 0; // GDK_HINT_POS;
- if ((m_minWidth != -1) || (m_minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
- if ((m_maxWidth != -1) || (m_maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
+ if ((minWidth != -1) || (minHeight != -1)) flag |= GDK_HINT_MIN_SIZE;
+ if ((maxWidth != -1) || (maxHeight != -1)) flag |= GDK_HINT_MAX_SIZE;
GdkGeometry geom;
- geom.min_width = m_minWidth;
- geom.min_height = m_minHeight;
- geom.max_width = m_maxWidth;
- geom.max_height = m_maxHeight;
+ geom.min_width = minWidth;
+ geom.min_height = minHeight;
+ geom.max_width = maxWidth;
+ geom.max_height = maxHeight;
gtk_window_set_geometry_hints( GTK_WINDOW(m_widget),
(GtkWidget*) NULL,
&geom,
if (height == -1) m_height = 26;
}
- if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
- if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
- if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_maxWidth;
- if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_maxHeight;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
+
+ if ((minWidth != -1) && (m_width < minWidth)) m_width = minWidth;
+ if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
+ if ((maxWidth != -1) && (m_width > maxWidth)) m_width = maxWidth;
+ if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
int border = 0;
int bottom_border = 0;
// not on the values specified in wxWindow m_max variables
bool processed = MSWDefWindowProc(WM_GETMINMAXINFO, 0, (LPARAM)mmInfo) != 0;
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight();
+
// but allow GetSizeHints() to set the min size
- if ( m_minWidth != -1 )
+ if ( minWidth != -1 )
{
- info->ptMinTrackSize.x = m_minWidth;
+ info->ptMinTrackSize.x = minWidth;
processed = TRUE;
}
- if ( m_minHeight != -1 )
+ if ( minHeight != -1 )
{
- info->ptMinTrackSize.y = m_minHeight;
+ info->ptMinTrackSize.y = minHeight;
processed = TRUE;
}
MINMAXINFO *info = (MINMAXINFO *)mmInfo;
bool rc = FALSE;
+
+ int minWidth = GetMinWidth(),
+ minHeight = GetMinHeight(),
+ maxWidth = GetMaxWidth(),
+ maxHeight = GetMaxHeight();
- if ( m_minWidth != -1 )
+ if ( minWidth != -1 )
{
- info->ptMinTrackSize.x = m_minWidth;
+ info->ptMinTrackSize.x = minWidth;
rc = TRUE;
}
- if ( m_minHeight != -1 )
+ if ( minHeight != -1 )
{
- info->ptMinTrackSize.y = m_minHeight;
+ info->ptMinTrackSize.y = minHeight;
rc = TRUE;
}
- if ( m_maxWidth != -1 )
+ if ( maxWidth != -1 )
{
- info->ptMaxTrackSize.x = m_maxWidth;
+ info->ptMaxTrackSize.x = maxWidth;
rc = TRUE;
}
- if ( m_maxHeight != -1 )
+ if ( maxHeight != -1 )
{
- info->ptMaxTrackSize.y = m_maxHeight;
+ info->ptMaxTrackSize.y = maxHeight;
rc = TRUE;
}
wxFrameBase::DoSetClientSize(width, height);
}
+int wxFrame::GetMinWidth() const
+{
+#if wxUSE_MENUS
+ if ( m_frameMenuBar )
+ {
+ return wxMax(m_frameMenuBar->GetBestSize().x, wxFrameBase::GetMinWidth());
+ }
+ else
+#endif // wxUSE_MENUS
+ return wxFrameBase::GetMinWidth();
+}
+
+int wxFrame::GetMinHeight() const
+{
+ int height = 0;
+
+#if wxUSE_MENUS
+ if ( m_frameMenuBar )
+ {
+ height += m_frameMenuBar->GetSize().y;
+ }
+#endif // wxUSE_MENUS
+
+#if wxUSE_TOOLBAR
+ if ( m_frameToolBar )
+ {
+ height += m_frameToolBar->GetSize().y;
+ }
+#endif // wxUSE_TOOLBAR
+
+#if wxUSE_STATUSBAR
+ if ( m_frameStatusBar )
+ {
+ height += m_frameStatusBar->GetSize().y;
+ }
+#endif // wxUSE_STATUSBAR
+
+ if ( height )
+ return height + wxMax(0, wxFrameBase::GetMinHeight());
+ else
+ return wxFrameBase::GetMinHeight();
+}
+
bool wxFrame::Enable(bool enable)
{
if (!wxFrameBase::Enable(enable))
// titlebars
virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const;
virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const;
+ virtual wxSize GetFrameMinSize(int flags) const;
virtual wxSize GetFrameIconSize() const;
virtual int HitTestFrame(const wxRect& rect, const wxPoint& pt, int flags) const;
return clientSize;
}
+wxSize wxGTKRenderer::GetFrameMinSize(int flags) const
+{
+ return wxSize(0,0);
+}
+
wxSize wxGTKRenderer::GetFrameIconSize() const
{
return wxSize(-1, -1);
int flags = 0);
virtual wxRect GetFrameClientArea(const wxRect& rect, int flags) const;
virtual wxSize GetFrameTotalSize(const wxSize& clientSize, int flags) const;
+ virtual wxSize GetFrameMinSize(int flags) const;
virtual wxSize GetFrameIconSize() const;
virtual int HitTestFrame(const wxRect& rect, const wxPoint& pt, int flags) const;
wxRect r = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
r.height = FRAME_TITLEBAR_HEIGHT;
if ( flags & wxTOPLEVEL_ICON )
+ {
r.x += FRAME_TITLEBAR_HEIGHT;
+ r.width -= FRAME_TITLEBAR_HEIGHT + 2;
+ }
else
+ {
r.x += 1;
+ r.width -= 3;
+ }
+
+ if ( flags & wxTOPLEVEL_BUTTON_CLOSE )
+ r.width -= FRAME_BUTTON_WIDTH + 2;
+ if ( flags & wxTOPLEVEL_BUTTON_MAXIMIZE )
+ r.width -= FRAME_BUTTON_WIDTH;
+ if ( flags & wxTOPLEVEL_BUTTON_RESTORE )
+ r.width -= FRAME_BUTTON_WIDTH;
+ if ( flags & wxTOPLEVEL_BUTTON_ICONIZE )
+ r.width -= FRAME_BUTTON_WIDTH;
+ if ( flags & wxTOPLEVEL_BUTTON_HELP )
+ r.width -= FRAME_BUTTON_WIDTH;
dc.SetFont(m_titlebarFont);
dc.SetTextForeground(col);
- dc.DrawLabel(title, wxNullBitmap, r, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
+
+ wxCoord textW;
+ dc.GetTextExtent(title, &textW, NULL);
+ if ( textW > r.width )
+ {
+ // text is too big, let's shorten it and add "..." after it:
+ size_t len = title.length();
+ wxCoord WSoFar, letterW;
+
+ dc.GetTextExtent(wxT("..."), &WSoFar, NULL);
+ if ( WSoFar > r.width )
+ {
+ // not enough space to draw anything
+ return;
+ }
+
+ wxString s;
+ s.Alloc(len);
+ for (size_t i = 0; i < len; i++)
+ {
+ dc.GetTextExtent(title[i], &letterW, NULL);
+ if ( letterW + WSoFar > r.width )
+ break;
+ WSoFar += letterW;
+ s << title[i];
+ }
+ s << wxT("...");
+ dc.DrawLabel(s, wxNullBitmap, r,
+ wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
+ }
+ else
+ dc.DrawLabel(title, wxNullBitmap, r,
+ wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
}
void wxWin32Renderer::DrawFrameIcon(wxDC& dc,
return s;
}
+wxSize wxWin32Renderer::GetFrameMinSize(int flags) const
+{
+ wxSize s(0, 0);
+
+ if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) )
+ {
+ int border = (flags & wxTOPLEVEL_RESIZEABLE) ?
+ RESIZEABLE_FRAME_BORDER_THICKNESS :
+ FRAME_BORDER_THICKNESS;
+ s.x += 2*border;
+ s.y += 2*border;
+ }
+
+ if ( flags & wxTOPLEVEL_TITLEBAR )
+ {
+ s.y += FRAME_TITLEBAR_HEIGHT;
+
+ if ( flags & wxTOPLEVEL_ICON )
+ s.x += FRAME_TITLEBAR_HEIGHT + 2;
+ if ( flags & wxTOPLEVEL_BUTTON_CLOSE )
+ s.x += FRAME_BUTTON_WIDTH + 2;
+ if ( flags & wxTOPLEVEL_BUTTON_MAXIMIZE )
+ s.x += FRAME_BUTTON_WIDTH;
+ if ( flags & wxTOPLEVEL_BUTTON_RESTORE )
+ s.x += FRAME_BUTTON_WIDTH;
+ if ( flags & wxTOPLEVEL_BUTTON_ICONIZE )
+ s.x += FRAME_BUTTON_WIDTH;
+ if ( flags & wxTOPLEVEL_BUTTON_HELP )
+ s.x += FRAME_BUTTON_WIDTH;
+ }
+
+ return s;
+}
+
wxSize wxWin32Renderer::GetFrameIconSize() const
{
return wxSize(16, 16);
return m_renderer->HitTestFrame(rect, pt+GetClientAreaOrigin(), GetDecorationsStyle());
}
+int wxTopLevelWindow::GetMinWidth() const
+{
+ if ( ms_drawDecorations )
+ {
+ return wxMax(wxTopLevelWindowNative::GetMinWidth(),
+ m_renderer->GetFrameMinSize(GetDecorationsStyle()).x);
+ }
+ else
+ return wxTopLevelWindowNative::GetMinWidth();
+}
+
+int wxTopLevelWindow::GetMinHeight() const
+{
+ if ( ms_drawDecorations )
+ {
+ return wxMax(wxTopLevelWindowNative::GetMinHeight(),
+ m_renderer->GetFrameMinSize(GetDecorationsStyle()).y);
+ }
+ else
+ return wxTopLevelWindowNative::GetMinHeight();
+}
+
// ----------------------------------------------------------------------------
// icons
// ----------------------------------------------------------------------------