-void wxWin32Renderer::DrawArrow(wxDC& dc,
- wxDirection dir,
- const wxRect& rect,
- int flags)
-{
- // get the bitmap for this arrow
- wxArrowDirection arrowDir;
- switch ( dir )
- {
- case wxLEFT: arrowDir = Arrow_Left; break;
- case wxRIGHT: arrowDir = Arrow_Right; break;
- case wxUP: arrowDir = Arrow_Up; break;
- case wxDOWN: arrowDir = Arrow_Down; break;
-
- default:
- wxFAIL_MSG(_T("unknown arrow direction"));
- return;
- }
-
- wxArrowStyle arrowStyle;
- if ( flags & wxCONTROL_PRESSED )
- {
- // can't be pressed and disabled
- arrowStyle = Arrow_Pressed;
- }
- else
- {
- arrowStyle = flags & wxCONTROL_DISABLED ? Arrow_Disabled : Arrow_Normal;
- }
-
- DrawArrowButton(dc, rect, arrowDir, arrowStyle);
-}
-
-void wxWin32Renderer::DrawArrow(wxDC& dc,
- const wxRect& rect,
- wxArrowDirection arrowDir,
- wxArrowStyle arrowStyle)
-{
- const wxBitmap& bmp = m_bmpArrows[arrowStyle][arrowDir];
-
- // under Windows the arrows always have the same size so just centre it in
- // the provided rectangle
- wxCoord x = rect.x + (rect.width - bmp.GetWidth()) / 2,
- y = rect.y + (rect.height - bmp.GetHeight()) / 2;
-
- // Windows does it like this...
- if ( arrowDir == Arrow_Left )
- x--;
-
- // draw it
- dc.DrawBitmap(bmp, x, y, TRUE /* use mask */);
-}
-
-void wxWin32Renderer::DrawArrowButton(wxDC& dc,
- const wxRect& rectAll,
- wxArrowDirection arrowDir,
- wxArrowStyle arrowStyle)
-{
- wxRect rect = rectAll;
- DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
- DrawArrowBorder(dc, &rect, arrowStyle == Arrow_Pressed);
- DrawArrow(dc, rect, arrowDir, arrowStyle);
-}
-
-void wxWin32Renderer::DrawScrollbarThumb(wxDC& dc,
- wxOrientation orient,
- const wxRect& rect,
- int flags)
-{
- // we don't use the flags, the thumb never changes appearance
- wxRect rectThumb = rect;
- DrawArrowBorder(dc, &rectThumb);
- DrawBackground(dc, wxNullColour, rectThumb);
-}
-
-void wxWin32Renderer::DrawScrollbarShaft(wxDC& dc,
- wxOrientation orient,
- const wxRect& rectBar,
- int flags)
-{
- wxColourScheme::StdColour col = flags & wxCONTROL_PRESSED
- ? wxColourScheme::SCROLLBAR_PRESSED
- : wxColourScheme::SCROLLBAR;
- DoDrawBackground(dc, m_scheme->Get(col), rectBar);
-}
-
-void wxWin32Renderer::DrawScrollCorner(wxDC& dc, const wxRect& rect)
-{
- DoDrawBackground(dc, wxSCHEME_COLOUR(m_scheme, CONTROL), rect);
-}
-
-wxRect wxWin32Renderer::GetScrollbarRect(const wxScrollBar *scrollbar,
- wxScrollBar::Element elem,
- int thumbPos) const
-{
- return StandardGetScrollbarRect(scrollbar, elem,
- thumbPos, m_sizeScrollbarArrow);
-}
-
-wxCoord wxWin32Renderer::GetScrollbarSize(const wxScrollBar *scrollbar)
-{
- return StandardScrollBarSize(scrollbar, m_sizeScrollbarArrow);
-}
-
-wxHitTest wxWin32Renderer::HitTestScrollbar(const wxScrollBar *scrollbar,
- const wxPoint& pt) const
-{
- return StandardHitTestScrollbar(scrollbar, pt, m_sizeScrollbarArrow);
-}
-
-wxCoord wxWin32Renderer::ScrollbarToPixel(const wxScrollBar *scrollbar,
- int thumbPos)
-{
- return StandardScrollbarToPixel(scrollbar, thumbPos, m_sizeScrollbarArrow);
-}
-
-int wxWin32Renderer::PixelToScrollbar(const wxScrollBar *scrollbar,
- wxCoord coord)
-{
- return StandardPixelToScrollbar(scrollbar, coord, m_sizeScrollbarArrow);
-}
-
-// ----------------------------------------------------------------------------
-// top level windows
-// ----------------------------------------------------------------------------
-
-int wxWin32Renderer::HitTestFrame(const wxRect& rect, const wxPoint& pt, int flags) const
-{
- wxRect client = GetFrameClientArea(rect, flags);
-
- if ( client.Inside(pt) )
- return wxHT_TOPLEVEL_CLIENT_AREA;
-
- if ( flags & wxTOPLEVEL_TITLEBAR )
- {
- wxRect client = GetFrameClientArea(rect, flags & ~wxTOPLEVEL_TITLEBAR);
-
- if ( flags & wxTOPLEVEL_ICON )
- {
- if ( wxRect(client.GetPosition(), GetFrameIconSize()).Inside(pt) )
- return wxHT_TOPLEVEL_ICON;
- }
-
- wxRect btnRect(client.GetRight() - 2 - FRAME_BUTTON_WIDTH,
- client.GetTop() + (FRAME_TITLEBAR_HEIGHT-FRAME_BUTTON_HEIGHT)/2,
- FRAME_BUTTON_WIDTH, FRAME_BUTTON_HEIGHT);
-
- if ( flags & wxTOPLEVEL_BUTTON_CLOSE )
- {
- if ( btnRect.Inside(pt) )
- return wxHT_TOPLEVEL_BUTTON_CLOSE;
- btnRect.x -= FRAME_BUTTON_WIDTH + 2;
- }
- if ( flags & wxTOPLEVEL_BUTTON_MAXIMIZE )
- {
- if ( btnRect.Inside(pt) )
- return wxHT_TOPLEVEL_BUTTON_MAXIMIZE;
- btnRect.x -= FRAME_BUTTON_WIDTH;
- }
- if ( flags & wxTOPLEVEL_BUTTON_RESTORE )
- {
- if ( btnRect.Inside(pt) )
- return wxHT_TOPLEVEL_BUTTON_RESTORE;
- btnRect.x -= FRAME_BUTTON_WIDTH;
- }
- if ( flags & wxTOPLEVEL_BUTTON_ICONIZE )
- {
- if ( btnRect.Inside(pt) )
- return wxHT_TOPLEVEL_BUTTON_ICONIZE;
- btnRect.x -= FRAME_BUTTON_WIDTH;
- }
- if ( flags & wxTOPLEVEL_BUTTON_HELP )
- {
- if ( btnRect.Inside(pt) )
- return wxHT_TOPLEVEL_BUTTON_HELP;
- btnRect.x -= FRAME_BUTTON_WIDTH;
- }
-
- if ( pt.y >= client.y && pt.y < client.y + FRAME_TITLEBAR_HEIGHT )
- return wxHT_TOPLEVEL_TITLEBAR;
- }
-
- if ( (flags & wxTOPLEVEL_BORDER) && !(flags & wxTOPLEVEL_MAXIMIZED) )