+// ----------------------------------------------------------------------------
+// top level windows
+// ----------------------------------------------------------------------------
+
+void wxWin32Renderer::DrawFrameTitleBar(wxDC& dc,
+ const wxRect& rect,
+ const wxString& title,
+ const wxIcon& icon,
+ int flags,
+ int pressedButtons)
+{
+ if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) )
+ {
+ DrawFrameBorder(dc, rect, flags);
+ }
+ if ( flags & wxTOPLEVEL_TITLEBAR )
+ {
+ DrawFrameBackground(dc, rect, flags);
+ if ( flags & wxTOPLEVEL_ICON )
+ DrawFrameIcon(dc, rect, icon, flags);
+ DrawFrameTitle(dc, rect, title, flags);
+
+ wxRect client = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
+ wxCoord x,y;
+ x = client.GetRight() -2 - FRAME_BUTTON_WIDTH;
+ y = client.GetTop() + (FRAME_TITLEBAR_HEIGHT-FRAME_BUTTON_HEIGHT)/2;
+
+ if ( flags & wxTOPLEVEL_CLOSE_BUTTON )
+ {
+ DrawFrameButton(dc, x, y, wxTOPLEVEL_CLOSE_BUTTON);
+ x -= FRAME_BUTTON_WIDTH + 2;
+ }
+ if ( flags & wxTOPLEVEL_MAXIMIZE_BUTTON )
+ {
+ DrawFrameButton(dc, x, y, wxTOPLEVEL_MAXIMIZE_BUTTON);
+ x -= FRAME_BUTTON_WIDTH;
+ }
+ if ( flags & wxTOPLEVEL_RESTORE_BUTTON )
+ {
+ DrawFrameButton(dc, x, y, wxTOPLEVEL_RESTORE_BUTTON);
+ x -= FRAME_BUTTON_WIDTH;
+ }
+ if ( flags & wxTOPLEVEL_MINIMIZE_BUTTON )
+ {
+ DrawFrameButton(dc, x, y, wxTOPLEVEL_MINIMIZE_BUTTON);
+ x -= FRAME_BUTTON_WIDTH;
+ }
+ if ( flags & wxTOPLEVEL_HELP_BUTTON )
+ {
+ DrawFrameButton(dc, x, y, wxTOPLEVEL_HELP_BUTTON);
+ x -= FRAME_BUTTON_WIDTH;
+ }
+ }
+}
+
+void wxWin32Renderer::DrawFrameBorder(wxDC& dc,
+ const wxRect& rect,
+ int flags)
+{
+ if ( !(flags & wxTOPLEVEL_BORDER) ) return;
+
+ wxRect r(rect);
+
+ DrawShadedRect(dc, &r, m_penLightGrey, m_penBlack);
+ DrawShadedRect(dc, &r, m_penHighlight, m_penDarkGrey);
+ DrawShadedRect(dc, &r, m_penLightGrey, m_penLightGrey);
+ if ( flags & wxTOPLEVEL_RESIZEABLE )
+ DrawShadedRect(dc, &r, m_penLightGrey, m_penLightGrey);
+}
+
+void wxWin32Renderer::DrawFrameBackground(wxDC& dc,
+ const wxRect& rect,
+ int flags)
+{
+ if ( !(flags & wxTOPLEVEL_TITLEBAR) ) return;
+
+ wxColour col = (flags & wxTOPLEVEL_ACTIVE) ?
+ wxSCHEME_COLOUR(m_scheme, TITLEBAR_ACTIVE) :
+ wxSCHEME_COLOUR(m_scheme, TITLEBAR);
+
+ wxRect r = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
+ r.height = FRAME_TITLEBAR_HEIGHT;
+
+ DrawBackground(dc, col, r);
+}
+
+void wxWin32Renderer::DrawFrameTitle(wxDC& dc,
+ const wxRect& rect,
+ const wxString& title,
+ int flags)
+{
+ wxRect r = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
+ r.height = FRAME_TITLEBAR_HEIGHT;
+ if ( flags & wxTOPLEVEL_ICON )
+ r.x += FRAME_TITLEBAR_HEIGHT;
+ else
+ r.x += 1;
+
+ dc.SetFont(m_titlebarFont);
+ dc.SetTextForeground(wxSCHEME_COLOUR(m_scheme, TITLEBAR_TEXT));
+ dc.DrawLabel(title, wxNullBitmap, r, wxALIGN_LEFT | wxALIGN_CENTRE_VERTICAL);
+}
+
+void wxWin32Renderer::DrawFrameIcon(wxDC& dc,
+ const wxRect& rect,
+ const wxIcon& icon,
+ int flags)
+{
+ wxRect r = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
+ dc.DrawIcon(icon, r.x, r.y);
+}
+
+void wxWin32Renderer::DrawFrameButton(wxDC& dc,
+ wxCoord x, wxCoord y,
+ int button,
+ int flags)
+{
+ wxRect r(x, y, FRAME_BUTTON_WIDTH, FRAME_BUTTON_HEIGHT);
+
+ DrawShadedRect(dc, &r, m_penHighlight, m_penBlack);
+ DrawShadedRect(dc, &r, m_penLightGrey, m_penDarkGrey);
+ DrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), r);
+
+ size_t idx = 0;
+ switch (button)
+ {
+ case wxTOPLEVEL_CLOSE_BUTTON: idx = FrameButton_Close; break;
+ case wxTOPLEVEL_MAXIMIZE_BUTTON: idx = FrameButton_Maximize; break;
+ case wxTOPLEVEL_MINIMIZE_BUTTON: idx = FrameButton_Minimize; break;
+ case wxTOPLEVEL_RESTORE_BUTTON: idx = FrameButton_Restore; break;
+ case wxTOPLEVEL_HELP_BUTTON: idx = FrameButton_Help; break;
+ default:
+ wxFAIL_MSG(wxT("incorrect button specification"));
+ }
+
+ dc.DrawBitmap(m_bmpFrameButtons[idx], r.x, r.y, TRUE);
+}
+
+
+wxRect wxWin32Renderer::GetFrameClientArea(const wxRect& rect,
+ int flags) const
+{
+ wxRect r(rect);
+
+ if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) )
+ {
+ int border = (flags & wxTOPLEVEL_RESIZEABLE) ?
+ RESIZEABLE_FRAME_BORDER_THICKNESS :
+ FRAME_BORDER_THICKNESS;
+ r.Inflate(-border);
+ }
+ if ( flags & wxTOPLEVEL_TITLEBAR )
+ {
+ r.y += FRAME_TITLEBAR_HEIGHT;
+ r.height -= FRAME_TITLEBAR_HEIGHT;
+ }
+
+ return r;
+}
+
+wxSize wxWin32Renderer::GetFrameTotalSize(const wxSize& clientSize,
+ int flags) const
+{
+ wxSize s(clientSize);
+
+ 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;
+
+ return s;
+}
+
+wxSize wxWin32Renderer::GetFrameIconSize() const
+{
+ return wxSize(16, 16);
+}
+
+
+