1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/univ/themes/win32.cpp
3 // Purpose: wxUniversal theme implementing Win32-like LNF
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ===========================================================================
14 // ===========================================================================
16 // ---------------------------------------------------------------------------
18 // ---------------------------------------------------------------------------
20 // For compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
27 #include "wx/univ/theme.h"
35 #include "wx/window.h"
37 #include "wx/dcmemory.h"
38 #include "wx/dcclient.h"
40 #include "wx/button.h"
41 #include "wx/bmpbuttn.h"
42 #include "wx/listbox.h"
43 #include "wx/checklst.h"
44 #include "wx/combobox.h"
45 #include "wx/scrolbar.h"
46 #include "wx/slider.h"
47 #include "wx/textctrl.h"
48 #include "wx/toolbar.h"
49 #include "wx/statusbr.h"
52 // for COLOR_* constants
53 #include "wx/msw/private.h"
56 #include "wx/settings.h"
57 #include "wx/toplevel.h"
61 #include "wx/notebook.h"
62 #include "wx/spinbutt.h"
63 #include "wx/artprov.h"
64 #include "wx/tglbtn.h"
66 #include "wx/univ/scrtimer.h"
67 #include "wx/univ/stdrend.h"
68 #include "wx/univ/inpcons.h"
69 #include "wx/univ/inphand.h"
70 #include "wx/univ/colschem.h"
72 // ----------------------------------------------------------------------------
74 // ----------------------------------------------------------------------------
76 static const int BORDER_THICKNESS
= 2;
78 static const size_t NUM_STATUSBAR_GRIP_BANDS
= 3;
79 static const size_t WIDTH_STATUSBAR_GRIP_BAND
= 4;
80 static const size_t STATUSBAR_GRIP_SIZE
=
81 WIDTH_STATUSBAR_GRIP_BAND
*NUM_STATUSBAR_GRIP_BANDS
;
83 static const wxCoord SLIDER_MARGIN
= 6; // margin around slider
84 static const wxCoord SLIDER_THUMB_LENGTH
= 18;
85 static const wxCoord SLIDER_TICK_LENGTH
= 6;
87 // wxWin32Renderer: draw the GUI elements in Win32 style
88 // ----------------------------------------------------------------------------
90 class wxWin32Renderer
: public wxStdRenderer
94 wxWin32Renderer(const wxColourScheme
*scheme
);
96 // reimplement the renderer methods which are different for this theme
97 virtual void DrawLabel(wxDC
& dc
,
98 const wxString
& label
,
101 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
103 wxRect
*rectBounds
= NULL
);
104 virtual void DrawButtonLabel(wxDC
& dc
,
105 const wxString
& label
,
106 const wxBitmap
& image
,
109 int alignment
= wxALIGN_LEFT
| wxALIGN_TOP
,
111 wxRect
*rectBounds
= NULL
);
112 virtual void DrawButtonBorder(wxDC
& dc
,
115 wxRect
*rectIn
= NULL
);
117 virtual void DrawArrow(wxDC
& dc
,
121 virtual void DrawScrollbarThumb(wxDC
& dc
,
122 wxOrientation orient
,
125 virtual void DrawScrollbarShaft(wxDC
& dc
,
126 wxOrientation orient
,
131 virtual void DrawToolBarButton(wxDC
& dc
,
132 const wxString
& label
,
133 const wxBitmap
& bitmap
,
138 #endif // wxUSE_TOOLBAR
141 virtual void DrawTab(wxDC
& dc
,
144 const wxString
& label
,
145 const wxBitmap
& bitmap
= wxNullBitmap
,
147 int indexAccel
= -1);
148 #endif // wxUSE_NOTEBOOK
151 virtual void DrawSliderShaft(wxDC
& dc
,
154 wxOrientation orient
,
157 wxRect
*rectShaft
= NULL
);
158 virtual void DrawSliderThumb(wxDC
& dc
,
160 wxOrientation orient
,
163 virtual void DrawSliderTicks(wxDC
& dc
,
166 wxOrientation orient
,
172 #endif // wxUSE_SLIDER
175 virtual void DrawMenuBarItem(wxDC
& dc
,
177 const wxString
& label
,
179 int indexAccel
= -1);
180 virtual void DrawMenuItem(wxDC
& dc
,
182 const wxMenuGeometryInfo
& geometryInfo
,
183 const wxString
& label
,
184 const wxString
& accel
,
185 const wxBitmap
& bitmap
= wxNullBitmap
,
187 int indexAccel
= -1);
188 virtual void DrawMenuSeparator(wxDC
& dc
,
190 const wxMenuGeometryInfo
& geomInfo
);
191 #endif // wxUSE_MENUS
194 virtual void DrawStatusField(wxDC
& dc
,
196 const wxString
& label
,
197 int flags
= 0, int style
= 0);
198 #endif // wxUSE_STATUSBAR
200 virtual void GetComboBitmaps(wxBitmap
*bmpNormal
,
202 wxBitmap
*bmpPressed
,
203 wxBitmap
*bmpDisabled
);
205 virtual void AdjustSize(wxSize
*size
, const wxWindow
*window
);
206 virtual bool AreScrollbarsInsideBorder() const;
208 virtual wxSize
GetScrollbarArrowSize() const
209 { return m_sizeScrollbarArrow
; }
211 virtual wxSize
GetCheckBitmapSize() const
212 { return wxSize(13, 13); }
213 virtual wxSize
GetRadioBitmapSize() const
214 { return wxSize(12, 12); }
215 virtual wxCoord
GetCheckItemMargin() const
219 virtual wxSize
GetToolBarButtonSize(wxCoord
*separator
) const
220 { if ( separator
) *separator
= 5; return wxSize(16, 15); }
221 virtual wxSize
GetToolBarMargin() const
222 { return wxSize(4, 4); }
223 #endif // wxUSE_TOOLBAR
226 virtual wxRect
GetTextTotalArea(const wxTextCtrl
*text
,
227 const wxRect
& rect
) const;
228 virtual wxRect
GetTextClientArea(const wxTextCtrl
*text
,
230 wxCoord
*extraSpaceBeyond
) const;
231 #endif // wxUSE_TEXTCTRL
234 virtual wxSize
GetTabIndent() const { return wxSize(2, 2); }
235 virtual wxSize
GetTabPadding() const { return wxSize(6, 5); }
236 #endif // wxUSE_NOTEBOOK
240 virtual wxCoord
GetSliderDim() const { return SLIDER_THUMB_LENGTH
+ 2*BORDER_THICKNESS
; }
241 virtual wxCoord
GetSliderTickLen() const { return SLIDER_TICK_LENGTH
; }
242 virtual wxRect
GetSliderShaftRect(const wxRect
& rect
,
244 wxOrientation orient
,
245 long style
= 0) const;
246 virtual wxSize
GetSliderThumbSize(const wxRect
& rect
,
248 wxOrientation orient
) const;
249 #endif // wxUSE_SLIDER
251 virtual wxSize
GetProgressBarStep() const { return wxSize(16, 32); }
254 virtual wxSize
GetMenuBarItemSize(const wxSize
& sizeText
) const;
255 virtual wxMenuGeometryInfo
*GetMenuGeometry(wxWindow
*win
,
256 const wxMenu
& menu
) const;
257 #endif // wxUSE_MENUS
260 // overridden wxStdRenderer methods
261 virtual void DrawFrameWithLabel(wxDC
& dc
,
262 const wxString
& label
,
263 const wxRect
& rectFrame
,
264 const wxRect
& rectText
,
269 virtual void DrawCheckItemBitmap(wxDC
& dc
,
270 const wxBitmap
& bitmap
,
275 // draw the border used for scrollbar arrows
276 void DrawArrowBorder(wxDC
& dc
, wxRect
*rect
, bool isPressed
= false);
278 // public DrawArrow()s helper
279 void DrawArrow(wxDC
& dc
, const wxRect
& rect
,
280 ArrowDirection arrowDir
, ArrowStyle arrowStyle
);
282 // DrawArrowButton is used by DrawScrollbar and DrawComboButton
283 void DrawArrowButton(wxDC
& dc
, const wxRect
& rect
,
284 ArrowDirection arrowDir
,
285 ArrowStyle arrowStyle
);
287 // draw a normal or transposed line (useful for using the same code fo both
288 // horizontal and vertical widgets)
289 void DrawLine(wxDC
& dc
,
290 wxCoord x1
, wxCoord y1
,
291 wxCoord x2
, wxCoord y2
,
292 bool transpose
= false)
295 dc
.DrawLine(y1
, x1
, y2
, x2
);
297 dc
.DrawLine(x1
, y1
, x2
, y2
);
300 // get the standard check/radio button bitmap
301 wxBitmap
GetIndicator(IndicatorType indType
, int flags
);
302 virtual wxBitmap
GetCheckBitmap(int flags
)
303 { return GetIndicator(IndicatorType_Check
, flags
); }
304 virtual wxBitmap
GetRadioBitmap(int flags
)
305 { return GetIndicator(IndicatorType_Radio
, flags
); }
307 virtual wxBitmap
GetFrameButtonBitmap(FrameButtonType type
);
310 // Fill the arguments with true or false if this slider has labels on
311 // left/right side (or top/bottom for horizontal sliders) respectively
313 void GetSliderLabelsSides(wxOrientation orient
, long style
,
314 bool *left
, bool *right
)
316 // should we draw ticks at all?
317 if ( !(style
& wxSL_AUTOTICKS
) )
324 // should we draw them on both sides?
325 if ( style
& wxSL_BOTH
)
332 // we draw them on one side only, determine which one
333 if ( ((style
& wxSL_TOP
) && (orient
== wxHORIZONTAL
)) ||
334 ((style
& wxSL_LEFT
) && (orient
== wxVERTICAL
)) )
339 else if ( ((style
& wxSL_BOTTOM
) && (orient
== wxHORIZONTAL
)) ||
340 ((style
& wxSL_RIGHT
) && (orient
== wxVERTICAL
)) )
347 wxFAIL_MSG( "inconsistent wxSlider flags" );
353 #endif // wxUSE_SLIDER
356 // the sizing parameters (TODO make them changeable)
357 wxSize m_sizeScrollbarArrow
;
359 // the checked and unchecked bitmaps for DrawCheckItemBitmap()
360 wxBitmap m_bmpCheckBitmaps
[IndicatorStatus_Max
];
362 // the bitmaps returned by GetIndicator()
363 wxBitmap m_bmpIndicators
[IndicatorType_Max
]
364 [IndicatorState_MaxMenu
]
365 [IndicatorStatus_Max
];
368 wxBitmap m_bmpFrameButtons
[FrameButton_Max
];
370 // standard defaults for the above bitmaps
371 static const char **ms_xpmChecked
[IndicatorStatus_Max
];
372 static const char **ms_xpmIndicators
[IndicatorType_Max
]
373 [IndicatorState_MaxMenu
]
374 [IndicatorStatus_Max
];
375 static const char **ms_xpmFrameButtons
[FrameButton_Max
];
377 // first row is for the normal state, second - for the disabled
378 wxBitmap m_bmpArrows
[Arrow_StateMax
][Arrow_Max
];
381 // ----------------------------------------------------------------------------
382 // wxWin32InputHandler and derived classes: process the keyboard and mouse
383 // messages according to Windows standards
384 // ----------------------------------------------------------------------------
386 class wxWin32InputHandler
: public wxInputHandler
389 wxWin32InputHandler() { }
391 virtual bool HandleKey(wxInputConsumer
*control
,
392 const wxKeyEvent
& event
,
394 virtual bool HandleMouse(wxInputConsumer
*control
,
395 const wxMouseEvent
& event
);
399 class wxWin32ScrollBarInputHandler
: public wxStdScrollBarInputHandler
402 wxWin32ScrollBarInputHandler(wxRenderer
*renderer
,
403 wxInputHandler
*handler
);
405 virtual bool HandleMouse(wxInputConsumer
*control
,
406 const wxMouseEvent
& event
);
407 virtual bool HandleMouseMove(wxInputConsumer
*control
,
408 const wxMouseEvent
& event
);
410 virtual bool OnScrollTimer(wxScrollBar
*scrollbar
,
411 const wxControlAction
& action
);
414 virtual void Highlight(wxScrollBar
* WXUNUSED(scrollbar
),
417 // we don't highlight anything
420 // the first and last event which caused the thumb to move
421 wxMouseEvent m_eventStartDrag
,
424 // have we paused the scrolling because the mouse moved?
427 // we remember the interval of the timer to be able to restart it
430 #endif // wxUSE_SCROLLBAR
433 class wxWin32CheckboxInputHandler
: public wxStdInputHandler
436 wxWin32CheckboxInputHandler(wxInputHandler
*handler
)
437 : wxStdInputHandler(handler
) { }
439 virtual bool HandleKey(wxInputConsumer
*control
,
440 const wxKeyEvent
& event
,
443 #endif // wxUSE_CHECKBOX
446 class wxWin32TextCtrlInputHandler
: public wxStdInputHandler
449 wxWin32TextCtrlInputHandler(wxInputHandler
*handler
)
450 : wxStdInputHandler(handler
) { }
452 virtual bool HandleKey(wxInputConsumer
*control
,
453 const wxKeyEvent
& event
,
456 #endif // wxUSE_TEXTCTRL
458 class wxWin32StatusBarInputHandler
: public wxStdInputHandler
461 wxWin32StatusBarInputHandler(wxInputHandler
*handler
);
463 virtual bool HandleMouse(wxInputConsumer
*consumer
,
464 const wxMouseEvent
& event
);
466 virtual bool HandleMouseMove(wxInputConsumer
*consumer
,
467 const wxMouseEvent
& event
);
470 // is the given point over the statusbar grip?
471 bool IsOnGrip(wxWindow
*statbar
, const wxPoint
& pt
) const;
474 // the cursor we had replaced with the resize one
475 wxCursor m_cursorOld
;
477 // was the mouse over the grip last time we checked?
481 class wxWin32SystemMenuEvtHandler
;
483 class wxWin32FrameInputHandler
: public wxStdInputHandler
486 wxWin32FrameInputHandler(wxInputHandler
*handler
);
487 virtual ~wxWin32FrameInputHandler();
489 virtual bool HandleMouse(wxInputConsumer
*control
,
490 const wxMouseEvent
& event
);
492 virtual bool HandleActivation(wxInputConsumer
*consumer
, bool activated
);
495 void PopupSystemMenu(wxTopLevelWindow
*window
) const;
496 #endif // wxUSE_MENUS
499 // was the mouse over the grip last time we checked?
500 wxWin32SystemMenuEvtHandler
*m_menuHandler
;
503 // ----------------------------------------------------------------------------
504 // wxWin32ColourScheme: uses (default) Win32 colours
505 // ----------------------------------------------------------------------------
507 class wxWin32ColourScheme
: public wxColourScheme
510 virtual wxColour
Get(StdColour col
) const;
511 virtual wxColour
GetBackground(wxWindow
*win
) const;
514 // ----------------------------------------------------------------------------
515 // wxWin32ArtProvider
516 // ----------------------------------------------------------------------------
518 class wxWin32ArtProvider
: public wxArtProvider
521 virtual wxBitmap
CreateBitmap(const wxArtID
& id
,
522 const wxArtClient
& client
,
526 // ----------------------------------------------------------------------------
528 // ----------------------------------------------------------------------------
530 WX_DEFINE_ARRAY_PTR(wxInputHandler
*, wxArrayHandlers
);
532 class wxWin32Theme
: public wxTheme
536 virtual ~wxWin32Theme();
538 virtual wxRenderer
*GetRenderer();
539 virtual wxArtProvider
*GetArtProvider();
540 virtual wxInputHandler
*GetInputHandler(const wxString
& control
,
541 wxInputConsumer
*consumer
);
542 virtual wxColourScheme
*GetColourScheme();
545 wxWin32Renderer
*m_renderer
;
547 wxWin32ArtProvider
*m_artProvider
;
549 // the names of the already created handlers and the handlers themselves
550 // (these arrays are synchronized)
551 wxSortedArrayString m_handlerNames
;
552 wxArrayHandlers m_handlers
;
554 wxWin32ColourScheme
*m_scheme
;
556 WX_DECLARE_THEME(win32
)
559 // ----------------------------------------------------------------------------
561 // ----------------------------------------------------------------------------
563 // frame buttons bitmaps
564 static const char *frame_button_close_xpm
[] = {
579 static const char *frame_button_help_xpm
[] = {
594 static const char *frame_button_maximize_xpm
[] = {
609 static const char *frame_button_minimize_xpm
[] = {
624 static const char *frame_button_restore_xpm
[] = {
639 const char **wxWin32Renderer::ms_xpmFrameButtons
[FrameButton_Max
] =
641 frame_button_close_xpm
,
642 frame_button_minimize_xpm
,
643 frame_button_maximize_xpm
,
644 frame_button_restore_xpm
,
645 frame_button_help_xpm
,
650 static const char *checked_menu_xpm
[] = {
651 /* columns rows colors chars-per-pixel */
667 static const char *selected_checked_menu_xpm
[] = {
668 /* columns rows colors chars-per-pixel */
684 static const char *disabled_checked_menu_xpm
[] = {
685 /* columns rows colors chars-per-pixel */
702 static const char *selected_disabled_checked_menu_xpm
[] = {
703 /* columns rows colors chars-per-pixel */
719 // checkbox and radiobox bitmaps below
721 static const char *checked_xpm
[] = {
722 /* columns rows colors chars-per-pixel */
745 static const char *pressed_checked_xpm
[] = {
746 /* columns rows colors chars-per-pixel */
768 static const char *pressed_disabled_checked_xpm
[] = {
769 /* columns rows colors chars-per-pixel */
791 static const char *checked_item_xpm
[] = {
792 /* columns rows colors chars-per-pixel */
813 static const char *unchecked_xpm
[] = {
814 /* columns rows colors chars-per-pixel */
837 static const char *pressed_unchecked_xpm
[] = {
838 /* columns rows colors chars-per-pixel */
860 static const char *unchecked_item_xpm
[] = {
861 /* columns rows colors chars-per-pixel */
881 static const char *undetermined_xpm
[] = {
882 /* columns rows colors chars-per-pixel */
905 static const char *pressed_undetermined_xpm
[] = {
906 /* columns rows colors chars-per-pixel */
929 static const char *checked_radio_xpm
[] = {
930 /* columns rows colors chars-per-pixel */
953 static const char *pressed_checked_radio_xpm
[] = {
954 /* columns rows colors chars-per-pixel */
977 static const char *pressed_disabled_checked_radio_xpm
[] = {
978 /* columns rows colors chars-per-pixel */
1001 static const char *unchecked_radio_xpm
[] = {
1002 /* columns rows colors chars-per-pixel */
1025 static const char *pressed_unchecked_radio_xpm
[] = {
1026 /* columns rows colors chars-per-pixel */
1049 const char **wxWin32Renderer::ms_xpmIndicators
[IndicatorType_Max
]
1050 [IndicatorState_MaxMenu
]
1051 [IndicatorStatus_Max
] =
1056 { checked_xpm
, unchecked_xpm
, undetermined_xpm
},
1059 { pressed_checked_xpm
, pressed_unchecked_xpm
, pressed_undetermined_xpm
},
1062 { pressed_disabled_checked_xpm
, pressed_unchecked_xpm
, pressed_disabled_checked_xpm
},
1068 { checked_radio_xpm
, unchecked_radio_xpm
, NULL
},
1071 { pressed_checked_radio_xpm
, pressed_unchecked_radio_xpm
, NULL
},
1074 { pressed_disabled_checked_radio_xpm
, pressed_unchecked_radio_xpm
, NULL
},
1080 { checked_menu_xpm
, NULL
, NULL
},
1083 { selected_checked_menu_xpm
, NULL
, NULL
},
1086 { disabled_checked_menu_xpm
, NULL
, NULL
},
1088 // disabled selected state
1089 { selected_disabled_checked_menu_xpm
, NULL
, NULL
},
1093 const char **wxWin32Renderer::ms_xpmChecked
[IndicatorStatus_Max
] =
1099 // ============================================================================
1101 // ============================================================================
1103 WX_IMPLEMENT_THEME(wxWin32Theme
, win32
, wxTRANSLATE("Win32 theme"));
1105 // ----------------------------------------------------------------------------
1107 // ----------------------------------------------------------------------------
1109 wxWin32Theme::wxWin32Theme()
1113 m_artProvider
= NULL
;
1116 wxWin32Theme::~wxWin32Theme()
1120 delete m_artProvider
;
1123 wxRenderer
*wxWin32Theme::GetRenderer()
1127 m_renderer
= new wxWin32Renderer(GetColourScheme());
1133 wxArtProvider
*wxWin32Theme::GetArtProvider()
1135 if ( !m_artProvider
)
1137 m_artProvider
= new wxWin32ArtProvider
;
1140 return m_artProvider
;
1144 wxWin32Theme::GetInputHandler(const wxString
& control
,
1145 wxInputConsumer
*consumer
)
1147 wxInputHandler
*handler
= NULL
;
1148 int n
= m_handlerNames
.Index(control
);
1149 if ( n
== wxNOT_FOUND
)
1151 static wxWin32InputHandler s_handlerDef
;
1153 wxInputHandler
* const
1154 handlerStd
= consumer
->DoGetStdInputHandler(&s_handlerDef
);
1156 // create a new handler
1157 if ( control
== wxINP_HANDLER_TOPLEVEL
)
1159 static wxWin32FrameInputHandler
s_handler(handlerStd
);
1161 handler
= &s_handler
;
1164 else if ( control
== wxINP_HANDLER_CHECKBOX
)
1166 static wxWin32CheckboxInputHandler
s_handler(handlerStd
);
1168 handler
= &s_handler
;
1170 #endif // wxUSE_CHECKBOX
1172 else if ( control
== wxINP_HANDLER_SCROLLBAR
)
1174 static wxWin32ScrollBarInputHandler
1175 s_handler(GetRenderer(), handlerStd
);
1177 handler
= &s_handler
;
1179 #endif // wxUSE_SCROLLBAR
1181 else if ( control
== wxINP_HANDLER_STATUSBAR
)
1183 static wxWin32StatusBarInputHandler
s_handler(handlerStd
);
1185 handler
= &s_handler
;
1187 #endif // wxUSE_STATUSBAR
1189 else if ( control
== wxINP_HANDLER_TEXTCTRL
)
1191 static wxWin32TextCtrlInputHandler
s_handler(handlerStd
);
1193 handler
= &s_handler
;
1195 #endif // wxUSE_TEXTCTRL
1196 else // no special handler for this control
1198 handler
= handlerStd
;
1201 n
= m_handlerNames
.Add(control
);
1202 m_handlers
.Insert(handler
, n
);
1204 else // we already have it
1206 handler
= m_handlers
[n
];
1212 wxColourScheme
*wxWin32Theme::GetColourScheme()
1216 m_scheme
= new wxWin32ColourScheme
;
1221 // ============================================================================
1222 // wxWin32ColourScheme
1223 // ============================================================================
1225 wxColour
wxWin32ColourScheme::GetBackground(wxWindow
*win
) const
1228 if ( win
->UseBgCol() )
1230 // use the user specified colour
1231 col
= win
->GetBackgroundColour();
1234 if ( !win
->ShouldInheritColours() )
1237 wxTextCtrl
*text
= wxDynamicCast(win
, wxTextCtrl
);
1238 #endif // wxUSE_TEXTCTRL
1240 wxListBox
* listBox
= wxDynamicCast(win
, wxListBox
);
1241 #endif // wxUSE_LISTBOX
1250 if ( !win
->IsEnabled() ) // not IsEditable()
1256 // doesn't depend on the state
1261 #endif // wxUSE_TEXTCTRL
1264 col
= Get(CONTROL
); // Most controls should be this colour, not WINDOW
1268 int flags
= win
->GetStateFlags();
1270 // the colour set by the user should be used for the normal state
1271 // and for the states for which we don't have any specific colours
1272 if ( !col
.IsOk() || (flags
& wxCONTROL_PRESSED
) != 0 )
1275 if ( wxDynamicCast(win
, wxScrollBar
) )
1276 col
= Get(flags
& wxCONTROL_PRESSED
? SCROLLBAR_PRESSED
1279 #endif // wxUSE_SCROLLBAR
1287 wxColour
wxWin32ColourScheme::Get(wxWin32ColourScheme::StdColour col
) const
1291 // use the system colours under Windows
1292 #if defined(__WXMSW__)
1293 case WINDOW
: return wxColour(GetSysColor(COLOR_WINDOW
));
1295 case CONTROL_PRESSED
:
1296 case CONTROL_CURRENT
:
1297 case CONTROL
: return wxColour(GetSysColor(COLOR_BTNFACE
));
1299 case CONTROL_TEXT
: return wxColour(GetSysColor(COLOR_BTNTEXT
));
1301 #if defined(COLOR_3DLIGHT)
1302 case SCROLLBAR
: return wxColour(GetSysColor(COLOR_3DLIGHT
));
1304 case SCROLLBAR
: return wxColour(0xe0e0e0);
1306 case SCROLLBAR_PRESSED
: return wxColour(GetSysColor(COLOR_BTNTEXT
));
1308 case HIGHLIGHT
: return wxColour(GetSysColor(COLOR_HIGHLIGHT
));
1309 case HIGHLIGHT_TEXT
: return wxColour(GetSysColor(COLOR_HIGHLIGHTTEXT
));
1311 #if defined(COLOR_3DDKSHADOW)
1312 case SHADOW_DARK
: return wxColour(GetSysColor(COLOR_3DDKSHADOW
));
1314 case SHADOW_DARK
: return wxColour(GetSysColor(COLOR_3DHADOW
));
1317 case CONTROL_TEXT_DISABLED
:
1318 case SHADOW_HIGHLIGHT
: return wxColour(GetSysColor(COLOR_BTNHIGHLIGHT
));
1320 case SHADOW_IN
: return wxColour(GetSysColor(COLOR_BTNFACE
));
1322 case CONTROL_TEXT_DISABLED_SHADOW
:
1323 case SHADOW_OUT
: return wxColour(GetSysColor(COLOR_BTNSHADOW
));
1325 case TITLEBAR
: return wxColour(GetSysColor(COLOR_INACTIVECAPTION
));
1326 case TITLEBAR_ACTIVE
: return wxColour(GetSysColor(COLOR_ACTIVECAPTION
));
1327 case TITLEBAR_TEXT
: return wxColour(GetSysColor(COLOR_INACTIVECAPTIONTEXT
));
1328 case TITLEBAR_ACTIVE_TEXT
: return wxColour(GetSysColor(COLOR_CAPTIONTEXT
));
1330 case DESKTOP
: return wxColour(0x808000);
1331 case FRAME
: return wxColour(GetSysColor(COLOR_APPWORKSPACE
));
1333 // use the standard Windows colours elsewhere
1334 case WINDOW
: return *wxWHITE
;
1336 case CONTROL_PRESSED
:
1337 case CONTROL_CURRENT
:
1338 case CONTROL
: return wxColour(0xc0c0c0);
1340 case CONTROL_TEXT
: return *wxBLACK
;
1342 case SCROLLBAR
: return wxColour(0xe0e0e0);
1343 case SCROLLBAR_PRESSED
: return *wxBLACK
;
1345 case HIGHLIGHT
: return wxColour(0x800000);
1346 case HIGHLIGHT_TEXT
: return wxColour(0xffffff);
1348 case SHADOW_DARK
: return *wxBLACK
;
1350 case CONTROL_TEXT_DISABLED
:return wxColour(0xe0e0e0);
1351 case SHADOW_HIGHLIGHT
: return wxColour(0xffffff);
1353 case SHADOW_IN
: return wxColour(0xc0c0c0);
1355 case CONTROL_TEXT_DISABLED_SHADOW
:
1356 case SHADOW_OUT
: return wxColour(0x7f7f7f);
1358 case TITLEBAR
: return wxColour(0xaeaaae);
1359 case TITLEBAR_ACTIVE
: return wxColour(0x820300);
1360 case TITLEBAR_TEXT
: return wxColour(0xc0c0c0);
1361 case TITLEBAR_ACTIVE_TEXT
:return *wxWHITE
;
1363 case DESKTOP
: return wxColour(0x808000);
1364 case FRAME
: return wxColour(0x808080);
1367 case GAUGE
: return Get(HIGHLIGHT
);
1371 wxFAIL_MSG(wxT("invalid standard colour"));
1376 // ============================================================================
1378 // ============================================================================
1380 // ----------------------------------------------------------------------------
1382 // ----------------------------------------------------------------------------
1384 wxWin32Renderer::wxWin32Renderer(const wxColourScheme
*scheme
)
1385 : wxStdRenderer(scheme
)
1388 m_sizeScrollbarArrow
= wxSize(16, 16);
1390 // init the arrow bitmaps
1391 static const size_t ARROW_WIDTH
= 7;
1392 static const size_t ARROW_LENGTH
= 4;
1395 wxMemoryDC dcNormal
,
1398 for ( size_t n
= 0; n
< Arrow_Max
; n
++ )
1400 bool isVertical
= n
> Arrow_Right
;
1413 // disabled arrow is larger because of the shadow
1414 m_bmpArrows
[Arrow_Normal
][n
].Create(w
, h
);
1415 m_bmpArrows
[Arrow_Disabled
][n
].Create(w
+ 1, h
+ 1);
1417 dcNormal
.SelectObject(m_bmpArrows
[Arrow_Normal
][n
]);
1418 dcDisabled
.SelectObject(m_bmpArrows
[Arrow_Disabled
][n
]);
1420 dcNormal
.SetBackground(*wxWHITE_BRUSH
);
1421 dcDisabled
.SetBackground(*wxWHITE_BRUSH
);
1425 dcNormal
.SetPen(m_penBlack
);
1426 dcDisabled
.SetPen(m_penDarkGrey
);
1428 // calculate the position of the point of the arrow
1432 x1
= (ARROW_WIDTH
- 1)/2;
1433 y1
= n
== Arrow_Up
? 0 : ARROW_LENGTH
- 1;
1437 x1
= n
== Arrow_Left
? 0 : ARROW_LENGTH
- 1;
1438 y1
= (ARROW_WIDTH
- 1)/2;
1449 for ( size_t i
= 0; i
< ARROW_LENGTH
; i
++ )
1451 dcNormal
.DrawLine(x1
, y1
, x2
, y2
);
1452 dcDisabled
.DrawLine(x1
, y1
, x2
, y2
);
1459 if ( n
== Arrow_Up
)
1470 else // left or right arrow
1475 if ( n
== Arrow_Left
)
1488 // draw the shadow for the disabled one
1489 dcDisabled
.SetPen(m_penHighlight
);
1494 dcDisabled
.DrawLine(x1
, y1
, x2
, y2
);
1498 x1
= ARROW_LENGTH
- 1;
1499 y1
= (ARROW_WIDTH
- 1)/2 + 1;
1502 dcDisabled
.DrawLine(x1
, y1
, x2
, y2
);
1503 dcDisabled
.DrawLine(++x1
, y1
, x2
, ++y2
);
1508 dcDisabled
.DrawLine(x1
, y1
, x2
, y2
);
1512 x1
= ARROW_WIDTH
- 1;
1514 x2
= (ARROW_WIDTH
- 1)/2;
1516 dcDisabled
.DrawLine(x1
, y1
, x2
, y2
);
1517 dcDisabled
.DrawLine(++x1
, y1
, x2
, ++y2
);
1522 // create the inverted bitmap but only for the right arrow as we only
1523 // use it for the menus
1524 if ( n
== Arrow_Right
)
1526 m_bmpArrows
[Arrow_Inverted
][n
].Create(w
, h
);
1527 dcInverse
.SelectObject(m_bmpArrows
[Arrow_Inverted
][n
]);
1529 dcInverse
.Blit(0, 0, w
, h
,
1532 dcInverse
.SelectObject(wxNullBitmap
);
1534 mask
= new wxMask(m_bmpArrows
[Arrow_Inverted
][n
], *wxBLACK
);
1535 m_bmpArrows
[Arrow_Inverted
][n
].SetMask(mask
);
1537 m_bmpArrows
[Arrow_InvertedDisabled
][n
].Create(w
, h
);
1538 dcInverse
.SelectObject(m_bmpArrows
[Arrow_InvertedDisabled
][n
]);
1540 dcInverse
.Blit(0, 0, w
, h
,
1543 dcInverse
.SelectObject(wxNullBitmap
);
1545 mask
= new wxMask(m_bmpArrows
[Arrow_InvertedDisabled
][n
], *wxBLACK
);
1546 m_bmpArrows
[Arrow_InvertedDisabled
][n
].SetMask(mask
);
1549 dcNormal
.SelectObject(wxNullBitmap
);
1550 dcDisabled
.SelectObject(wxNullBitmap
);
1552 mask
= new wxMask(m_bmpArrows
[Arrow_Normal
][n
], *wxWHITE
);
1553 m_bmpArrows
[Arrow_Normal
][n
].SetMask(mask
);
1554 mask
= new wxMask(m_bmpArrows
[Arrow_Disabled
][n
], *wxWHITE
);
1555 m_bmpArrows
[Arrow_Disabled
][n
].SetMask(mask
);
1557 m_bmpArrows
[Arrow_Pressed
][n
] = m_bmpArrows
[Arrow_Normal
][n
];
1561 bool wxWin32Renderer::AreScrollbarsInsideBorder() const
1566 // ----------------------------------------------------------------------------
1568 // ----------------------------------------------------------------------------
1570 void wxWin32Renderer::DrawLabel(wxDC
& dc
,
1571 const wxString
& label
,
1578 // the underscores are not drawn for focused controls in wxMSW
1579 if ( flags
& wxCONTROL_FOCUSED
)
1584 if ( flags
& wxCONTROL_DISABLED
)
1586 // the combination of wxCONTROL_SELECTED and wxCONTROL_DISABLED
1587 // currently only can happen for a menu item and it seems that Windows
1588 // doesn't draw the shadow in this case, so we don't do it neither
1589 if ( flags
& wxCONTROL_SELECTED
)
1591 // just make the label text greyed out
1592 dc
.SetTextForeground(m_penDarkGrey
.GetColour());
1594 flags
&= ~wxCONTROL_DISABLED
;
1598 wxStdRenderer::DrawLabel(dc
, label
, rect
, flags
, alignment
,
1599 indexAccel
, rectBounds
);
1602 void wxWin32Renderer::DrawFrameWithLabel(wxDC
& dc
,
1603 const wxString
& label
,
1604 const wxRect
& rectFrame
,
1605 const wxRect
& rectText
,
1611 label2
<< wxT(' ') << label
<< wxT(' ');
1612 if ( indexAccel
!= -1 )
1614 // adjust it as we prepended a space
1618 wxStdRenderer::DrawFrameWithLabel(dc
, label2
, rectFrame
, rectText
,
1619 flags
, alignment
, indexAccel
);
1622 void wxWin32Renderer::DrawButtonLabel(wxDC
& dc
,
1623 const wxString
& label
,
1624 const wxBitmap
& image
,
1631 // the underscores are not drawn for focused controls in wxMSW
1632 if ( flags
& wxCONTROL_PRESSED
)
1637 wxStdRenderer::DrawButtonLabel(dc
, label
, image
, rect
, flags
, alignment
,
1638 indexAccel
, rectBounds
);
1641 void wxWin32Renderer::DrawButtonBorder(wxDC
& dc
,
1642 const wxRect
& rectTotal
,
1646 wxRect rect
= rectTotal
;
1648 wxPen
penOut(*wxBLACK
);
1649 if ( flags
& wxCONTROL_PRESSED
)
1651 // button pressed: draw a double border around it
1652 DrawRect(dc
, &rect
, penOut
);
1653 DrawRect(dc
, &rect
, m_penDarkGrey
);
1655 else // button not pressed
1657 if ( flags
& (wxCONTROL_FOCUSED
| wxCONTROL_ISDEFAULT
) )
1659 // button either default or focused (or both): add an extra border
1661 DrawRect(dc
, &rect
, penOut
);
1664 // now draw a normal button border
1665 DrawRaisedBorder(dc
, &rect
);
1672 // ----------------------------------------------------------------------------
1673 // (check)listbox items
1674 // ----------------------------------------------------------------------------
1676 void wxWin32Renderer::DrawCheckItemBitmap(wxDC
& dc
,
1677 const wxBitmap
& bitmap
,
1682 if ( bitmap
.IsOk() )
1686 else // use default bitmap
1688 IndicatorStatus i
= flags
& wxCONTROL_CHECKED
1689 ? IndicatorStatus_Checked
1690 : IndicatorStatus_Unchecked
;
1692 if ( !m_bmpCheckBitmaps
[i
].IsOk() )
1694 m_bmpCheckBitmaps
[i
] = wxBitmap(ms_xpmChecked
[i
]);
1697 bmp
= m_bmpCheckBitmaps
[i
];
1700 dc
.DrawBitmap(bmp
, rect
.x
, rect
.y
+ (rect
.height
- bmp
.GetHeight()) / 2 - 1,
1701 true /* use mask */);
1704 // ----------------------------------------------------------------------------
1705 // check/radio buttons
1706 // ----------------------------------------------------------------------------
1708 wxBitmap
wxWin32Renderer::GetIndicator(IndicatorType indType
, int flags
)
1710 IndicatorState indState
;
1711 IndicatorStatus indStatus
;
1712 GetIndicatorsFromFlags(flags
, indState
, indStatus
);
1714 wxBitmap
& bmp
= m_bmpIndicators
[indType
][indState
][indStatus
];
1717 const char **xpm
= ms_xpmIndicators
[indType
][indState
][indStatus
];
1720 // create and cache it
1721 bmp
= wxBitmap(xpm
);
1728 // ----------------------------------------------------------------------------
1730 // ----------------------------------------------------------------------------
1733 void wxWin32Renderer::DrawToolBarButton(wxDC
& dc
,
1734 const wxString
& label
,
1735 const wxBitmap
& bitmap
,
1736 const wxRect
& rectOrig
,
1741 if (style
== wxTOOL_STYLE_BUTTON
)
1743 wxRect rect
= rectOrig
;
1744 rect
.Deflate(BORDER_THICKNESS
);
1746 if ( flags
& wxCONTROL_PRESSED
)
1748 DrawBorder(dc
, wxBORDER_SUNKEN
, rect
, flags
);
1750 else if ( flags
& wxCONTROL_CURRENT
)
1752 DrawBorder(dc
, wxBORDER_RAISED
, rect
, flags
);
1755 if(tbarStyle
& wxTB_TEXT
)
1757 if(tbarStyle
& wxTB_HORIZONTAL
)
1759 dc
.DrawLabel(label
, bitmap
, rect
, wxALIGN_CENTRE
);
1763 dc
.DrawLabel(label
, bitmap
, rect
, wxALIGN_LEFT
|wxALIGN_CENTER_VERTICAL
);
1768 int xpoint
= (rect
.GetLeft() + rect
.GetRight() + 1 - bitmap
.GetWidth()) / 2;
1769 int ypoint
= (rect
.GetTop() + rect
.GetBottom() + 1 - bitmap
.GetHeight()) / 2;
1770 dc
.DrawBitmap(bitmap
, xpoint
, ypoint
, bitmap
.GetMask() != NULL
);
1773 else if (style
== wxTOOL_STYLE_SEPARATOR
)
1775 // leave a small gap aroudn the line, also account for the toolbar
1777 if(rectOrig
.height
> rectOrig
.width
)
1780 DrawVerticalLine(dc
, rectOrig
.x
+ rectOrig
.width
/2,
1781 rectOrig
.y
+ 2*BORDER_THICKNESS
,
1782 rectOrig
.GetBottom() - BORDER_THICKNESS
);
1787 DrawHorizontalLine(dc
, rectOrig
.y
+ rectOrig
.height
/2,
1788 rectOrig
.x
+ 2*BORDER_THICKNESS
,
1789 rectOrig
.GetRight() - BORDER_THICKNESS
);
1792 // don't draw wxTOOL_STYLE_CONTROL
1794 #endif // wxUSE_TOOLBAR
1796 // ----------------------------------------------------------------------------
1798 // ----------------------------------------------------------------------------
1802 void wxWin32Renderer::DrawTab(wxDC
& dc
,
1803 const wxRect
& rectOrig
,
1805 const wxString
& label
,
1806 const wxBitmap
& bitmap
,
1810 #define SELECT_FOR_VERTICAL(X,Y) ( isVertical ? Y : X )
1811 #define REVERSE_FOR_VERTICAL(X,Y) \
1812 SELECT_FOR_VERTICAL(X,Y) \
1814 SELECT_FOR_VERTICAL(Y,X)
1816 wxRect rect
= rectOrig
;
1818 bool isVertical
= ( dir
== wxLEFT
) || ( dir
== wxRIGHT
);
1820 // the current tab is drawn indented (to the top for default case) and
1821 // bigger than the other ones
1822 const wxSize indent
= GetTabIndent();
1823 if ( flags
& wxCONTROL_SELECTED
)
1825 rect
.Inflate( SELECT_FOR_VERTICAL( indent
.x
, 0),
1826 SELECT_FOR_VERTICAL( 0, indent
.y
));
1830 wxFAIL_MSG(wxT("invaild notebook tab orientation"));
1837 rect
.height
+= indent
.y
;
1844 rect
.width
+= indent
.x
;
1849 // draw the text, image and the focus around them (if necessary)
1850 wxRect
rectLabel( REVERSE_FOR_VERTICAL(rect
.x
,rect
.y
),
1851 REVERSE_FOR_VERTICAL(rect
.width
,rect
.height
)
1853 rectLabel
.Deflate(1, 1);
1856 // draw it horizontally into memory and rotate for screen
1858 wxBitmap bitmapRotated
,
1859 bitmapMem( rectLabel
.x
+ rectLabel
.width
,
1860 rectLabel
.y
+ rectLabel
.height
);
1861 dcMem
.SelectObject(bitmapMem
);
1862 dcMem
.SetBackground(dc
.GetBackground());
1863 dcMem
.SetFont(dc
.GetFont());
1864 dcMem
.SetTextForeground(dc
.GetTextForeground());
1868 wxBitmap( wxImage( bitmap
.ConvertToImage() ).Rotate90(dir
==wxLEFT
) )
1871 #endif // wxUSE_IMAGE
1873 DrawButtonLabel(dcMem
, label
, bitmapRotated
, rectLabel
,
1874 flags
, wxALIGN_CENTRE
, indexAccel
);
1875 dcMem
.SelectObject(wxNullBitmap
);
1876 bitmapMem
= bitmapMem
.GetSubBitmap(rectLabel
);
1878 bitmapMem
= wxBitmap(wxImage(bitmapMem
.ConvertToImage()).Rotate90(dir
==wxRIGHT
));
1879 #endif // wxUSE_IMAGE
1880 dc
.DrawBitmap(bitmapMem
, rectLabel
.y
, rectLabel
.x
, false);
1884 DrawButtonLabel(dc
, label
, bitmap
, rectLabel
,
1885 flags
, wxALIGN_CENTRE
, indexAccel
);
1888 // now draw the tab border itself (maybe use DrawRoundedRectangle()?)
1889 static const wxCoord CUTOFF
= 2; // radius of the rounded corner
1890 wxCoord x
= SELECT_FOR_VERTICAL(rect
.x
,rect
.y
),
1891 y
= SELECT_FOR_VERTICAL(rect
.y
,rect
.x
),
1892 x2
= SELECT_FOR_VERTICAL(rect
.GetRight(),rect
.GetBottom()),
1893 y2
= SELECT_FOR_VERTICAL(rect
.GetBottom(),rect
.GetRight());
1895 // FIXME: all this code will break if the tab indent or the border width,
1896 // it is tied to the fact that both of them are equal to 2
1902 // left orientation looks like top but IsVertical makes x and y reversed
1904 // top is not vertical so use coordinates in written order
1905 dc
.SetPen(m_penHighlight
);
1906 dc
.DrawLine(REVERSE_FOR_VERTICAL(x
, y2
),
1907 REVERSE_FOR_VERTICAL(x
, y
+ CUTOFF
));
1908 dc
.DrawLine(REVERSE_FOR_VERTICAL(x
, y
+ CUTOFF
),
1909 REVERSE_FOR_VERTICAL(x
+ CUTOFF
, y
));
1910 dc
.DrawLine(REVERSE_FOR_VERTICAL(x
+ CUTOFF
, y
),
1911 REVERSE_FOR_VERTICAL(x2
- CUTOFF
+ 1, y
));
1913 dc
.SetPen(m_penBlack
);
1914 dc
.DrawLine(REVERSE_FOR_VERTICAL(x2
, y2
),
1915 REVERSE_FOR_VERTICAL(x2
, y
+ CUTOFF
));
1916 dc
.DrawLine(REVERSE_FOR_VERTICAL(x2
, y
+ CUTOFF
),
1917 REVERSE_FOR_VERTICAL(x2
- CUTOFF
, y
));
1919 dc
.SetPen(m_penDarkGrey
);
1920 dc
.DrawLine(REVERSE_FOR_VERTICAL(x2
- 1, y2
),
1921 REVERSE_FOR_VERTICAL(x2
- 1, y
+ CUTOFF
- 1));
1923 if ( flags
& wxCONTROL_SELECTED
)
1925 dc
.SetPen(m_penLightGrey
);
1927 // overwrite the part of the border below this tab
1928 dc
.DrawLine(REVERSE_FOR_VERTICAL(x
+ 1, y2
+ 1),
1929 REVERSE_FOR_VERTICAL(x2
- 1, y2
+ 1));
1931 // and the shadow of the tab to the left of us
1932 dc
.DrawLine(REVERSE_FOR_VERTICAL(x
+ 1, y
+ CUTOFF
+ 1),
1933 REVERSE_FOR_VERTICAL(x
+ 1, y2
+ 1));
1938 // right orientation looks like bottom but IsVertical makes x and y reversed
1940 // bottom is not vertical so use coordinates in written order
1941 dc
.SetPen(m_penHighlight
);
1942 // we need to continue one pixel further to overwrite the corner of
1943 // the border for the selected tab
1944 dc
.DrawLine(REVERSE_FOR_VERTICAL(x
, y
- (flags
& wxCONTROL_SELECTED
? 1 : 0)),
1945 REVERSE_FOR_VERTICAL(x
, y2
- CUTOFF
));
1946 dc
.DrawLine(REVERSE_FOR_VERTICAL(x
, y2
- CUTOFF
),
1947 REVERSE_FOR_VERTICAL(x
+ CUTOFF
, y2
));
1949 dc
.SetPen(m_penBlack
);
1950 dc
.DrawLine(REVERSE_FOR_VERTICAL(x
+ CUTOFF
, y2
),
1951 REVERSE_FOR_VERTICAL(x2
- CUTOFF
+ 1, y2
));
1952 dc
.DrawLine(REVERSE_FOR_VERTICAL(x2
, y
),
1953 REVERSE_FOR_VERTICAL(x2
, y2
- CUTOFF
));
1954 dc
.DrawLine(REVERSE_FOR_VERTICAL(x2
, y2
- CUTOFF
),
1955 REVERSE_FOR_VERTICAL(x2
- CUTOFF
, y2
));
1957 dc
.SetPen(m_penDarkGrey
);
1958 dc
.DrawLine(REVERSE_FOR_VERTICAL(x
+ CUTOFF
, y2
- 1),
1959 REVERSE_FOR_VERTICAL(x2
- CUTOFF
+ 1, y2
- 1));
1960 dc
.DrawLine(REVERSE_FOR_VERTICAL(x2
- 1, y
),
1961 REVERSE_FOR_VERTICAL(x2
- 1, y2
- CUTOFF
+ 1));
1963 if ( flags
& wxCONTROL_SELECTED
)
1965 dc
.SetPen(m_penLightGrey
);
1967 // overwrite the part of the (double!) border above this tab
1968 dc
.DrawLine(REVERSE_FOR_VERTICAL(x
+ 1, y
- 1),
1969 REVERSE_FOR_VERTICAL(x2
- 1, y
- 1));
1970 dc
.DrawLine(REVERSE_FOR_VERTICAL(x
+ 1, y
- 2),
1971 REVERSE_FOR_VERTICAL(x2
- 1, y
- 2));
1973 // and the shadow of the tab to the left of us
1974 dc
.DrawLine(REVERSE_FOR_VERTICAL(x
+ 1, y2
- CUTOFF
),
1975 REVERSE_FOR_VERTICAL(x
+ 1, y
- 1));
1980 #undef SELECT_FOR_VERTICAL
1981 #undef REVERSE_FOR_VERTICAL
1984 #endif // wxUSE_NOTEBOOK
1988 // ----------------------------------------------------------------------------
1990 // ----------------------------------------------------------------------------
1993 wxWin32Renderer::GetSliderThumbSize(const wxRect
& WXUNUSED(rect
),
1995 wxOrientation orient
) const
1998 wxCoord width
= wxMax (lenThumb
, SLIDER_THUMB_LENGTH
) / 2;
1999 wxCoord height
= wxMax (lenThumb
, SLIDER_THUMB_LENGTH
);
2001 if (orient
== wxHORIZONTAL
)
2015 wxRect
wxWin32Renderer::GetSliderShaftRect(const wxRect
& rectOrig
,
2017 wxOrientation orient
,
2021 GetSliderLabelsSides(orient
, style
, &left
, &right
);
2023 wxRect rect
= rectOrig
;
2025 wxSize sizeThumb
= GetSliderThumbSize (rect
, lenThumb
, orient
);
2027 if (orient
== wxHORIZONTAL
)
2029 rect
.x
+= SLIDER_MARGIN
;
2032 rect
.y
+= wxMax ((rect
.height
- 2*BORDER_THICKNESS
) / 2, sizeThumb
.y
/2);
2036 rect
.y
+= wxMax ((rect
.height
- 2*BORDER_THICKNESS
- sizeThumb
.y
/2), sizeThumb
.y
/2);
2040 rect
.y
+= sizeThumb
.y
/2;
2042 rect
.width
-= 2*SLIDER_MARGIN
;
2043 rect
.height
= 2*BORDER_THICKNESS
;
2045 else // == wxVERTICAL
2047 rect
.y
+= SLIDER_MARGIN
;
2050 rect
.x
+= wxMax ((rect
.width
- 2*BORDER_THICKNESS
) / 2, sizeThumb
.x
/2);
2054 rect
.x
+= wxMax ((rect
.width
- 2*BORDER_THICKNESS
- sizeThumb
.x
/2), sizeThumb
.x
/2);
2058 rect
.x
+= sizeThumb
.x
/2;
2060 rect
.width
= 2*BORDER_THICKNESS
;
2061 rect
.height
-= 2*SLIDER_MARGIN
;
2067 void wxWin32Renderer::DrawSliderShaft(wxDC
& dc
,
2068 const wxRect
& rectOrig
,
2070 wxOrientation orient
,
2075 /* show shaft geometry
2093 if (flags
& wxCONTROL_FOCUSED
)
2094 DrawFocusRect(NULL
, dc
, rectOrig
);
2096 wxRect rect
= GetSliderShaftRect(rectOrig
, lenThumb
, orient
, style
);
2098 if (rectShaft
) *rectShaft
= rect
;
2100 DrawSunkenBorder(dc
, &rect
);
2103 void wxWin32Renderer::DrawSliderThumb(wxDC
& dc
,
2105 wxOrientation orient
,
2109 /* show thumb geometry
2118 H D B where H is highlight colour
2132 The interior of this shape is filled with the hatched brush if the thumb
2136 DrawBackground(dc
, wxNullColour
, rect
, flags
);
2139 GetSliderLabelsSides(orient
, style
, &left
, &right
);
2141 bool isVertical
= orient
== wxVERTICAL
;
2143 wxCoord sizeArrow
= (isVertical
? rect
.height
: rect
.width
) / 2;
2144 wxCoord c
= ((isVertical
? rect
.height
: rect
.width
) - 2*sizeArrow
);
2146 wxCoord x1
, x2
, x3
, y1
, y2
, y3
, y4
;
2147 x1
= (isVertical
? rect
.y
: rect
.x
);
2148 x2
= (isVertical
? rect
.GetBottom() : rect
.GetRight());
2149 x3
= (x1
-1+c
) + sizeArrow
;
2150 y1
= (isVertical
? rect
.x
: rect
.y
);
2151 y2
= (isVertical
? rect
.GetRight() : rect
.GetBottom());
2152 y3
= (left
? (y1
-1+c
) + sizeArrow
: y1
);
2153 y4
= (right
? (y2
+1-c
) - sizeArrow
: y2
);
2155 dc
.SetPen(m_penBlack
);
2158 DrawLine(dc
, x3
+1-c
, y1
, x2
, y3
, isVertical
);
2160 DrawLine(dc
, x2
, y3
, x2
, y4
, isVertical
);
2163 DrawLine(dc
, x3
+1-c
, y2
, x2
, y4
, isVertical
);
2167 DrawLine(dc
, x1
, y2
, x2
, y2
, isVertical
);
2170 dc
.SetPen(m_penDarkGrey
);
2171 DrawLine(dc
, x2
-1, y3
+1, x2
-1, y4
-1, isVertical
);
2174 DrawLine(dc
, x3
+1-c
, y2
-1, x2
-1, y4
, isVertical
);
2178 DrawLine(dc
, x1
+1, y2
-1, x2
-1, y2
-1, isVertical
);
2181 dc
.SetPen(m_penHighlight
);
2184 DrawLine(dc
, x1
, y3
, x3
, y1
, isVertical
);
2185 DrawLine(dc
, x3
+1-c
, y1
+1, x2
-1, y3
, isVertical
);
2189 DrawLine(dc
, x1
, y1
, x2
, y1
, isVertical
);
2191 DrawLine(dc
, x1
, y3
, x1
, y4
, isVertical
);
2194 DrawLine(dc
, x1
, y4
, x3
+c
, y2
+c
, isVertical
);
2197 if (flags
& wxCONTROL_PRESSED
)
2199 // TODO: MSW fills the entire area inside, not just the rect
2200 wxRect rectInt
= rect
;
2203 rectInt
.SetLeft(y3
);
2204 rectInt
.SetRight(y4
);
2209 rectInt
.SetBottom(y4
);
2213 static const char *stipple_xpm
[] = {
2214 /* columns rows colors chars-per-pixel */
2222 dc
.SetBrush(wxBrush(stipple_xpm
));
2224 dc
.SetTextForeground(wxSCHEME_COLOUR(m_scheme
, SHADOW_HIGHLIGHT
));
2225 dc
.SetTextBackground(wxSCHEME_COLOUR(m_scheme
, CONTROL
));
2226 dc
.SetPen(*wxTRANSPARENT_PEN
);
2227 dc
.DrawRectangle(rectInt
);
2231 void wxWin32Renderer::DrawSliderTicks(wxDC
& dc
,
2234 wxOrientation orient
,
2238 int WXUNUSED(flags
),
2241 /* show ticks geometry
2260 GetSliderLabelsSides(orient
, style
, &left
, &right
);
2262 bool isVertical
= orient
== wxVERTICAL
;
2264 // default thumb size
2265 wxSize sizeThumb
= GetSliderThumbSize (rect
, 0, orient
);
2266 wxCoord defaultLen
= (isVertical
? sizeThumb
.x
: sizeThumb
.y
);
2268 // normal thumb size
2269 sizeThumb
= GetSliderThumbSize (rect
, lenThumb
, orient
);
2270 wxCoord widthThumb
= (isVertical
? sizeThumb
.y
: sizeThumb
.x
);
2272 wxRect rectShaft
= GetSliderShaftRect (rect
, lenThumb
, orient
, style
);
2274 wxCoord x1
, x2
, y1
, y2
, y3
, y4
, len
;
2275 x1
= (isVertical
? rectShaft
.y
: rectShaft
.x
) + widthThumb
/2;
2276 x2
= (isVertical
? rectShaft
.GetBottom() : rectShaft
.GetRight()) - widthThumb
/2;
2277 y1
= (isVertical
? rectShaft
.x
: rectShaft
.y
) - defaultLen
/2;
2278 y2
= (isVertical
? rectShaft
.GetRight() : rectShaft
.GetBottom()) + defaultLen
/2;
2279 y3
= (isVertical
? rect
.x
: rect
.y
);
2280 y4
= (isVertical
? rect
.GetRight() : rect
.GetBottom());
2283 dc
.SetPen(m_penBlack
);
2285 int range
= end
- start
;
2286 for ( int n
= 0; n
< range
; n
+= step
)
2288 wxCoord x
= x1
+ (len
*n
) / range
;
2290 if (left
& (y1
> y3
))
2292 DrawLine(dc
, x
, y1
, x
, y3
, orient
== wxVERTICAL
);
2294 if (right
& (y4
> y2
))
2296 DrawLine(dc
, x
, y2
, x
, y4
, orient
== wxVERTICAL
);
2299 // always draw the line at the end position
2300 if (left
& (y1
> y3
))
2302 DrawLine(dc
, x2
, y1
, x2
, y3
, orient
== wxVERTICAL
);
2304 if (right
& (y4
> y2
))
2306 DrawLine(dc
, x2
, y2
, x2
, y4
, orient
== wxVERTICAL
);
2310 #endif // wxUSE_SLIDER
2314 // ----------------------------------------------------------------------------
2316 // ----------------------------------------------------------------------------
2318 // wxWin32MenuGeometryInfo: the wxMenuGeometryInfo used by wxWin32Renderer
2319 class WXDLLEXPORT wxWin32MenuGeometryInfo
: public wxMenuGeometryInfo
2322 virtual wxSize
GetSize() const { return m_size
; }
2324 wxCoord
GetLabelOffset() const { return m_ofsLabel
; }
2325 wxCoord
GetAccelOffset() const { return m_ofsAccel
; }
2327 wxCoord
GetItemHeight() const { return m_heightItem
; }
2330 // the total size of the menu
2333 // the offset of the start of the menu item label
2336 // the offset of the start of the accel label
2339 // the height of a normal (not separator) item
2340 wxCoord m_heightItem
;
2342 friend wxMenuGeometryInfo
*
2343 wxWin32Renderer::GetMenuGeometry(wxWindow
*, const wxMenu
&) const;
2346 // FIXME: all constants are hardcoded but shouldn't be
2347 static const wxCoord MENU_LEFT_MARGIN
= 9;
2348 static const wxCoord MENU_RIGHT_MARGIN
= 18;
2349 static const wxCoord MENU_VERT_MARGIN
= 3;
2351 // the margin around bitmap/check marks (on each side)
2352 static const wxCoord MENU_BMP_MARGIN
= 2;
2354 // the margin between the labels and accel strings
2355 static const wxCoord MENU_ACCEL_MARGIN
= 8;
2357 // the separator height in pixels: in fact, strangely enough, the real height
2358 // is 2 but Windows adds one extra pixel in the bottom margin, so take it into
2360 static const wxCoord MENU_SEPARATOR_HEIGHT
= 3;
2362 // the size of the standard checkmark bitmap
2363 static const wxCoord MENU_CHECK_SIZE
= 9;
2365 void wxWin32Renderer::DrawMenuBarItem(wxDC
& dc
,
2366 const wxRect
& rectOrig
,
2367 const wxString
& label
,
2371 wxRect rect
= rectOrig
;
2374 wxDCTextColourChanger
colChanger(dc
);
2376 if ( flags
& wxCONTROL_SELECTED
)
2378 colChanger
.Set(wxSCHEME_COLOUR(m_scheme
, HIGHLIGHT_TEXT
));
2380 const wxColour colBg
= wxSCHEME_COLOUR(m_scheme
, HIGHLIGHT
);
2383 dc
.DrawRectangle(rect
);
2386 // don't draw the focus rect around menu bar items
2387 DrawLabel(dc
, label
, rect
, flags
& ~wxCONTROL_FOCUSED
,
2388 wxALIGN_CENTRE
, indexAccel
);
2391 void wxWin32Renderer::DrawMenuItem(wxDC
& dc
,
2393 const wxMenuGeometryInfo
& gi
,
2394 const wxString
& label
,
2395 const wxString
& accel
,
2396 const wxBitmap
& bitmap
,
2400 const wxWin32MenuGeometryInfo
& geometryInfo
=
2401 (const wxWin32MenuGeometryInfo
&)gi
;
2406 rect
.width
= geometryInfo
.GetSize().x
;
2407 rect
.height
= geometryInfo
.GetItemHeight();
2409 // draw the selected item specially
2410 wxDCTextColourChanger
colChanger(dc
);
2411 if ( flags
& wxCONTROL_SELECTED
)
2413 colChanger
.Set(wxSCHEME_COLOUR(m_scheme
, HIGHLIGHT_TEXT
));
2415 const wxColour colBg
= wxSCHEME_COLOUR(m_scheme
, HIGHLIGHT
);
2418 dc
.DrawRectangle(rect
);
2421 // draw the bitmap: use the bitmap provided or the standard checkmark for
2422 // the checkable items
2423 wxBitmap bmp
= bitmap
;
2424 if ( !bmp
.IsOk() && (flags
& wxCONTROL_CHECKED
) )
2426 bmp
= GetIndicator(IndicatorType_Menu
, flags
);
2431 rect
.SetRight(geometryInfo
.GetLabelOffset());
2432 wxControlRenderer::DrawBitmap(dc
, bmp
, rect
);
2436 rect
.x
= geometryInfo
.GetLabelOffset();
2437 rect
.SetRight(geometryInfo
.GetAccelOffset());
2439 DrawLabel(dc
, label
, rect
, flags
, wxALIGN_CENTRE_VERTICAL
, indexAccel
);
2441 // draw the accel string
2442 rect
.x
= geometryInfo
.GetAccelOffset();
2443 rect
.SetRight(geometryInfo
.GetSize().x
);
2445 // NB: no accel index here
2446 DrawLabel(dc
, accel
, rect
, flags
, wxALIGN_CENTRE_VERTICAL
);
2448 // draw the submenu indicator
2449 if ( flags
& wxCONTROL_ISSUBMENU
)
2451 rect
.x
= geometryInfo
.GetSize().x
- MENU_RIGHT_MARGIN
;
2452 rect
.width
= MENU_RIGHT_MARGIN
;
2454 ArrowStyle arrowStyle
;
2455 if ( flags
& wxCONTROL_DISABLED
)
2456 arrowStyle
= flags
& wxCONTROL_SELECTED
? Arrow_InvertedDisabled
2458 else if ( flags
& wxCONTROL_SELECTED
)
2459 arrowStyle
= Arrow_Inverted
;
2461 arrowStyle
= Arrow_Normal
;
2463 DrawArrow(dc
, rect
, Arrow_Right
, arrowStyle
);
2467 void wxWin32Renderer::DrawMenuSeparator(wxDC
& dc
,
2469 const wxMenuGeometryInfo
& geomInfo
)
2471 DrawHorizontalLine(dc
, y
+ MENU_VERT_MARGIN
, 0, geomInfo
.GetSize().x
);
2474 wxSize
wxWin32Renderer::GetMenuBarItemSize(const wxSize
& sizeText
) const
2476 wxSize size
= sizeText
;
2478 // FIXME: menubar height is configurable under Windows
2485 wxMenuGeometryInfo
*wxWin32Renderer::GetMenuGeometry(wxWindow
*win
,
2486 const wxMenu
& menu
) const
2488 // prepare the dc: for now we draw all the items with the system font
2490 dc
.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT
));
2492 // the height of a normal item
2493 wxCoord heightText
= dc
.GetCharHeight();
2498 // the max length of label and accel strings: the menu width is the sum of
2499 // them, even if they're for different items (as the accels should be
2502 // the max length of the bitmap is never 0 as Windows always leaves enough
2503 // space for a check mark indicator
2504 wxCoord widthLabelMax
= 0,
2506 widthBmpMax
= MENU_LEFT_MARGIN
;
2508 for ( wxMenuItemList::compatibility_iterator node
= menu
.GetMenuItems().GetFirst();
2510 node
= node
->GetNext() )
2512 // height of this item
2515 wxMenuItem
*item
= node
->GetData();
2516 if ( item
->IsSeparator() )
2518 h
= MENU_SEPARATOR_HEIGHT
;
2520 else // not separator
2525 dc
.GetTextExtent(item
->GetItemLabelText(), &widthLabel
, NULL
);
2526 if ( widthLabel
> widthLabelMax
)
2528 widthLabelMax
= widthLabel
;
2532 dc
.GetTextExtent(item
->GetAccelString(), &widthAccel
, NULL
);
2533 if ( widthAccel
> widthAccelMax
)
2535 widthAccelMax
= widthAccel
;
2538 const wxBitmap
& bmp
= item
->GetBitmap();
2541 wxCoord widthBmp
= bmp
.GetWidth();
2542 if ( widthBmp
> widthBmpMax
)
2543 widthBmpMax
= widthBmp
;
2545 //else if ( item->IsCheckable() ): no need to check for this as
2546 // MENU_LEFT_MARGIN is big enough to show the check mark
2549 h
+= 2*MENU_VERT_MARGIN
;
2551 // remember the item position and height
2552 item
->SetGeometry(height
, h
);
2557 // bundle the metrics into a struct and return it
2558 wxWin32MenuGeometryInfo
*gi
= new wxWin32MenuGeometryInfo
;
2560 gi
->m_ofsLabel
= widthBmpMax
+ 2*MENU_BMP_MARGIN
;
2561 gi
->m_ofsAccel
= gi
->m_ofsLabel
+ widthLabelMax
;
2562 if ( widthAccelMax
> 0 )
2564 // if we actually have any accesl, add a margin
2565 gi
->m_ofsAccel
+= MENU_ACCEL_MARGIN
;
2568 gi
->m_heightItem
= heightText
+ 2*MENU_VERT_MARGIN
;
2570 gi
->m_size
.x
= gi
->m_ofsAccel
+ widthAccelMax
+ MENU_RIGHT_MARGIN
;
2571 gi
->m_size
.y
= height
;
2576 #endif // wxUSE_MENUS
2580 // ----------------------------------------------------------------------------
2582 // ----------------------------------------------------------------------------
2584 void wxWin32Renderer::DrawStatusField(wxDC
& dc
,
2586 const wxString
& label
,
2592 if ( flags
& wxCONTROL_SIZEGRIP
)
2594 // draw the size grip: it is a normal rect except that in the lower
2595 // right corner we have several bands which may be used for dragging
2596 // the status bar corner
2598 // each band consists of 4 stripes: m_penHighlight, double
2599 // m_penDarkGrey and transparent one
2600 wxCoord x2
= rect
.GetRight(),
2601 y2
= rect
.GetBottom();
2603 // draw the upper left part of the rect normally
2604 if (style
!= wxSB_FLAT
)
2606 if (style
== wxSB_RAISED
)
2607 dc
.SetPen(m_penHighlight
);
2609 dc
.SetPen(m_penDarkGrey
);
2610 dc
.DrawLine(rect
.GetLeft(), rect
.GetTop(), rect
.GetLeft(), y2
);
2611 dc
.DrawLine(rect
.GetLeft() + 1, rect
.GetTop(), x2
, rect
.GetTop());
2614 // draw the grey stripes of the grip
2616 wxCoord ofs
= WIDTH_STATUSBAR_GRIP_BAND
- 1;
2617 for ( n
= 0; n
< NUM_STATUSBAR_GRIP_BANDS
; n
++, ofs
+= WIDTH_STATUSBAR_GRIP_BAND
)
2619 dc
.DrawLine(x2
- ofs
+ 1, y2
- 1, x2
, y2
- ofs
);
2620 dc
.DrawLine(x2
- ofs
, y2
- 1, x2
, y2
- ofs
- 1);
2623 // draw the white stripes
2624 dc
.SetPen(m_penHighlight
);
2625 ofs
= WIDTH_STATUSBAR_GRIP_BAND
+ 1;
2626 for ( n
= 0; n
< NUM_STATUSBAR_GRIP_BANDS
; n
++, ofs
+= WIDTH_STATUSBAR_GRIP_BAND
)
2628 dc
.DrawLine(x2
- ofs
+ 1, y2
- 1, x2
, y2
- ofs
);
2631 // draw the remaining rect boundaries
2632 if (style
!= wxSB_FLAT
)
2634 if (style
== wxSB_RAISED
)
2635 dc
.SetPen(m_penDarkGrey
);
2637 dc
.SetPen(m_penHighlight
);
2638 ofs
-= WIDTH_STATUSBAR_GRIP_BAND
;
2639 dc
.DrawLine(x2
, rect
.GetTop(), x2
, y2
- ofs
+ 1);
2640 dc
.DrawLine(rect
.GetLeft(), y2
, x2
- ofs
+ 1, y2
);
2646 rectIn
.width
-= STATUSBAR_GRIP_SIZE
;
2648 // this will prevent the standard version from drawing any borders
2652 wxStdRenderer::DrawStatusField(dc
, rect
, label
, flags
, style
);
2655 #endif // wxUSE_STATUSBAR
2657 // ----------------------------------------------------------------------------
2659 // ----------------------------------------------------------------------------
2661 void wxWin32Renderer::GetComboBitmaps(wxBitmap
*bmpNormal
,
2662 wxBitmap
* WXUNUSED(bmpFocus
),
2663 wxBitmap
*bmpPressed
,
2664 wxBitmap
*bmpDisabled
)
2666 static const wxCoord widthCombo
= 16;
2667 static const wxCoord heightCombo
= 17;
2673 bmpNormal
->Create(widthCombo
, heightCombo
);
2674 dcMem
.SelectObject(*bmpNormal
);
2675 DrawArrowButton(dcMem
, wxRect(0, 0, widthCombo
, heightCombo
),
2676 Arrow_Down
, Arrow_Normal
);
2681 bmpPressed
->Create(widthCombo
, heightCombo
);
2682 dcMem
.SelectObject(*bmpPressed
);
2683 DrawArrowButton(dcMem
, wxRect(0, 0, widthCombo
, heightCombo
),
2684 Arrow_Down
, Arrow_Pressed
);
2689 bmpDisabled
->Create(widthCombo
, heightCombo
);
2690 dcMem
.SelectObject(*bmpDisabled
);
2691 DrawArrowButton(dcMem
, wxRect(0, 0, widthCombo
, heightCombo
),
2692 Arrow_Down
, Arrow_Disabled
);
2696 // ----------------------------------------------------------------------------
2698 // ----------------------------------------------------------------------------
2700 void wxWin32Renderer::DrawArrowBorder(wxDC
& dc
, wxRect
*rect
, bool isPressed
)
2704 DrawRect(dc
, rect
, m_penDarkGrey
);
2706 // the arrow is usually drawn inside border of width 2 and is offset by
2707 // another pixel in both directions when it's pressed - as the border
2708 // in this case is more narrow as well, we have to adjust rect like
2716 DrawAntiSunkenBorder(dc
, rect
);
2720 void wxWin32Renderer::DrawArrow(wxDC
& dc
,
2725 ArrowStyle arrowStyle
;
2726 if ( flags
& wxCONTROL_PRESSED
)
2728 // can't be pressed and disabled
2729 arrowStyle
= Arrow_Pressed
;
2733 arrowStyle
= flags
& wxCONTROL_DISABLED
? Arrow_Disabled
: Arrow_Normal
;
2736 DrawArrowButton(dc
, rect
, GetArrowDirection(dir
), arrowStyle
);
2739 void wxWin32Renderer::DrawArrow(wxDC
& dc
,
2741 ArrowDirection arrowDir
,
2742 ArrowStyle arrowStyle
)
2744 const wxBitmap
& bmp
= m_bmpArrows
[arrowStyle
][arrowDir
];
2746 // under Windows the arrows always have the same size so just centre it in
2747 // the provided rectangle
2748 wxCoord x
= rect
.x
+ (rect
.width
- bmp
.GetWidth()) / 2,
2749 y
= rect
.y
+ (rect
.height
- bmp
.GetHeight()) / 2;
2751 // Windows does it like this...
2752 if ( arrowDir
== Arrow_Left
)
2756 dc
.DrawBitmap(bmp
, x
, y
, true /* use mask */);
2759 void wxWin32Renderer::DrawArrowButton(wxDC
& dc
,
2760 const wxRect
& rectAll
,
2761 ArrowDirection arrowDir
,
2762 ArrowStyle arrowStyle
)
2764 wxRect rect
= rectAll
;
2765 DrawBackground(dc
, wxSCHEME_COLOUR(m_scheme
, CONTROL
), rect
);
2766 DrawArrowBorder(dc
, &rect
, arrowStyle
== Arrow_Pressed
);
2767 DrawArrow(dc
, rect
, arrowDir
, arrowStyle
);
2770 void wxWin32Renderer::DrawScrollbarThumb(wxDC
& dc
,
2771 wxOrientation
WXUNUSED(orient
),
2773 int WXUNUSED(flags
))
2775 // we don't use the flags, the thumb never changes appearance
2776 wxRect rectThumb
= rect
;
2777 DrawArrowBorder(dc
, &rectThumb
);
2778 DrawBackground(dc
, wxNullColour
, rectThumb
);
2781 void wxWin32Renderer::DrawScrollbarShaft(wxDC
& dc
,
2782 wxOrientation
WXUNUSED(orient
),
2783 const wxRect
& rectBar
,
2786 wxColourScheme::StdColour col
= flags
& wxCONTROL_PRESSED
2787 ? wxColourScheme::SCROLLBAR_PRESSED
2788 : wxColourScheme::SCROLLBAR
;
2789 DrawBackground(dc
, m_scheme
->Get(col
), rectBar
);
2792 // ----------------------------------------------------------------------------
2794 // ----------------------------------------------------------------------------
2796 /* Copyright (c) Julian Smart */
2797 static const char *error_xpm
[]={
2798 /* columns rows colors chars-per-pixel */
2875 " $oooooooooooo%& ",
2876 " *=-ooooooooooooo;: ",
2877 " *oooooooooooooooooo> ",
2878 " =ooooooooooooooooooo, ",
2879 " $-ooooooooooooooooooo<1 ",
2880 " .oooooo2334ooo533oooooo6 ",
2881 " +ooooooo789oo2883oooooo0q ",
2882 " oooooooo2w83o78eoooooooor ",
2883 " toooooooooy88u884oooooooori ",
2884 " Xooooooooooe888poooooooooas ",
2885 " ooooooooooo4889doooooooooof ",
2886 " ooooooooooo588w2oooooooooofi ",
2887 " oooooooooodw8887oooooooooofi ",
2888 " goooooooooh8w588jooooooookli ",
2889 " tooooooooz885op8wdooooooorix ",
2890 " oooooood98cood98cooooooori ",
2891 " @oooooop8w2ooo5885ooooovbi ",
2892 " n%ooooooooooooooooooooomiM ",
2893 " &;oooooooooooooooooooNBiV ",
2894 " :ooooooooooooooooooCZiA ",
2895 " nSooooooooooooooooCDiF ",
2896 " nG<oooooooooooooNZiiH ",
2897 " 160ooooooooovmBiFH ",
2898 " nqrraoookrrbiiA ",
2905 /* Copyright (c) Julian Smart */
2906 static const char *info_xpm
[]={
2907 /* columns rows colors chars-per-pixel */
2929 " ..XXXXXXXXXXXXX.. ",
2930 " .XXXXXXXXXXXXXXXXX. ",
2931 " .XXXXXXXXoO+XXXXXXXX. ",
2932 " .XXXXXXXXX@#OXXXXXXXXX. ",
2933 " .XXXXXXXXXX$@oXXXXXXXXXX. ",
2934 " .XXXXXXXXXXXXXXXXXXXXXXX.% ",
2935 " .XXXXXXXXX&*=-XXXXXXXXXX.%% ",
2936 ".XXXXXXXXXX;:#>XXXXXXXXXXX.% ",
2937 ".XXXXXXXXXXX;#+XXXXXXXXXXX.% ",
2938 ".XXXXXXXXXXX;#+XXXXXXXXXXX.%% ",
2939 " .XXXXXXXXXX;#+XXXXXXXXXX.%%% ",
2940 " .XXXXXXXXXX;#+XXXXXXXXXX.%%% ",
2941 " .XXXXXXXXXX;#+XXXXXXXXXX.%% ",
2942 " .XXXXXXXX*-##+XXXXXXXX.%%% ",
2943 " .XXXXXXXXXXXXXXXXXXX.%%%% ",
2944 " .XXXXXXXXXXXXXXXXX.%%%% ",
2945 " ..XXXXXXXXXXXXX..%%%% ",
2946 " %...XXXXXXXX..%%%%% ",
2947 " %%%..XXXXXX.%%%%% ",
2961 /* Copyright (c) Julian Smart */
2962 static const char *question_xpm
[]={
2963 /* columns rows colors chars-per-pixel */
2984 " ..XXXXXXXXXXXXX.. ",
2985 " .XXXXXXoO++@XXXXXX. ",
2986 " .XXXXXXO#$$$$#%XXXXX. ",
2987 " .XXXXXX@$$#&&#$#oXXXXX. ",
2988 " .XXXXXXX*$$%XX%$$=XXXXXX. ",
2989 " .XXXXXXX+-;XXXX$$-XXXXXX.: ",
2990 " .XXXXXXXXXXXXX+$$&XXXXXX.:: ",
2991 ".XXXXXXXXXXXXo;$$*oXXXXXXX.: ",
2992 ".XXXXXXXXXXXo*$$*oXXXXXXXX.: ",
2993 ".XXXXXXXXXXX+$$*oXXXXXXXXX.:: ",
2994 " .XXXXXXXXXX-$$oXXXXXXXXX.::: ",
2995 " .XXXXXXXXXXX--XXXXXXXXXX.::: ",
2996 " .XXXXXXXXXXXXXXXXXXXXXXX.:: ",
2997 " .XXXXXXXXX-$$XXXXXXXXX.::: ",
2998 " .XXXXXXXX-$$XXXXXXXX.:::: ",
2999 " .XXXXXXXO++XXXXXXX.:::: ",
3000 " ..XXXXXXXXXXXXX..:::: ",
3001 " :...XXXXXXXX..::::: ",
3002 " :::..XXXXXX.::::: ",
3016 /* Copyright (c) Julian Smart */
3017 static const char *warning_xpm
[]={
3018 /* columns rows colors chars-per-pixel */
3044 " ..XXXXO@#XXX... ",
3045 " ...XXXXO@#XXXX.. ",
3046 " ..XXXXXO@#XXXX... ",
3047 " ...XXXXXo@OXXXXX.. ",
3048 " ...XXXXXXo@OXXXXXX.. ",
3049 " ..XXXXXXX$@OXXXXXX... ",
3050 " ...XXXXXXXX@XXXXXXXX.. ",
3051 " ...XXXXXXXXXXXXXXXXXX... ",
3052 " ..XXXXXXXXXXOXXXXXXXXX.. ",
3053 " ...XXXXXXXXXO@#XXXXXXXXX.. ",
3054 " ..XXXXXXXXXXX#XXXXXXXXXX... ",
3055 " ...XXXXXXXXXXXXXXXXXXXXXXX.. ",
3056 " ...XXXXXXXXXXXXXXXXXXXXXXXX... ",
3057 " .............................. ",
3058 " .............................. ",
3065 wxBitmap
wxWin32ArtProvider::CreateBitmap(const wxArtID
& id
,
3066 const wxArtClient
& WXUNUSED(client
),
3067 const wxSize
& WXUNUSED(size
))
3069 if ( id
== wxART_INFORMATION
)
3070 return wxBitmap(info_xpm
);
3071 if ( id
== wxART_ERROR
)
3072 return wxBitmap(error_xpm
);
3073 if ( id
== wxART_WARNING
)
3074 return wxBitmap(warning_xpm
);
3075 if ( id
== wxART_QUESTION
)
3076 return wxBitmap(question_xpm
);
3077 return wxNullBitmap
;
3083 // ----------------------------------------------------------------------------
3084 // text control geometry
3085 // ----------------------------------------------------------------------------
3088 wxWin32Renderer::GetTextTotalArea(const wxTextCtrl
*text
,
3089 const wxRect
& rect
) const
3091 wxRect rectTotal
= wxStdRenderer::GetTextTotalArea(text
, rect
);
3093 // this is strange but it's what Windows does
3100 wxWin32Renderer::GetTextClientArea(const wxTextCtrl
*text
,
3102 wxCoord
*extraSpaceBeyond
) const
3104 wxRect rectText
= rect
;
3106 // undo GetTextTotalArea()
3107 if ( rectText
.height
> 0 )
3110 return wxStdRenderer::GetTextClientArea(text
, rect
, extraSpaceBeyond
);
3113 #endif // wxUSE_TEXTCTRL
3115 // ----------------------------------------------------------------------------
3117 // ----------------------------------------------------------------------------
3119 void wxWin32Renderer::AdjustSize(wxSize
*size
, const wxWindow
*window
)
3122 if ( wxDynamicCast(window
, wxScrollBar
) )
3125 Don't adjust the size for a scrollbar as its DoGetBestClientSize
3126 already has the correct size set. Any size changes here would get
3127 added to the best size, making the scrollbar larger.
3128 Also skip border width adjustments, they don't make sense for us.
3132 #endif // wxUSE_SCROLLBAR
3135 if ( wxDynamicCast(window
, wxBitmapButton
) )
3139 #endif // wxUSE_BMPBUTTON
3140 #if wxUSE_BUTTON || wxUSE_TOGGLEBTN
3143 || wxDynamicCast(window
, wxButton
)
3144 # endif // wxUSE_BUTTON
3145 # if wxUSE_TOGGLEBTN
3146 || wxDynamicCast(window
, wxToggleButton
)
3147 # endif // wxUSE_TOGGLEBTN
3150 if ( !(window
->GetWindowStyle() & wxBU_EXACTFIT
) )
3152 // TODO: don't harcode all this
3153 size
->x
+= 3*window
->GetCharWidth();
3155 wxCoord heightBtn
= (11*(window
->GetCharHeight() + 8))/10;
3156 if ( size
->y
< heightBtn
- 8 )
3157 size
->y
= heightBtn
;
3162 // for compatibility with other ports, the buttons default size is never
3163 // less than the standard one, but not when display not PDAs.
3164 if (wxSystemSettings::GetScreenType() > wxSYS_SCREEN_PDA
)
3166 if ( !(window
->GetWindowStyle() & wxBU_EXACTFIT
) )
3168 wxSize szDef
= wxButton::GetDefaultSize();
3169 if ( size
->x
< szDef
.x
)
3174 // no border width adjustments for buttons
3177 #endif // wxUSE_BUTTON || wxUSE_TOGGLEBTN
3179 wxStdRenderer::AdjustSize(size
, window
);
3182 wxBitmap
wxWin32Renderer::GetFrameButtonBitmap(FrameButtonType type
)
3184 wxBitmap
& bmp
= m_bmpFrameButtons
[type
];
3187 bmp
= wxBitmap(ms_xpmFrameButtons
[type
]);
3193 // ============================================================================
3195 // ============================================================================
3197 // ----------------------------------------------------------------------------
3198 // wxWin32InputHandler
3199 // ----------------------------------------------------------------------------
3201 bool wxWin32InputHandler::HandleKey(wxInputConsumer
* WXUNUSED(control
),
3202 const wxKeyEvent
& WXUNUSED(event
),
3203 bool WXUNUSED(pressed
))
3208 bool wxWin32InputHandler::HandleMouse(wxInputConsumer
*control
,
3209 const wxMouseEvent
& event
)
3211 // clicking on the control gives it focus
3212 if ( event
.ButtonDown() )
3214 wxWindow
* const win
= control
->GetInputWindow();
3216 if ( win
->CanAcceptFocus() && wxWindow::FindFocus() != win
)
3229 // ----------------------------------------------------------------------------
3230 // wxWin32ScrollBarInputHandler
3231 // ----------------------------------------------------------------------------
3233 wxWin32ScrollBarInputHandler::
3234 wxWin32ScrollBarInputHandler(wxRenderer
*renderer
, wxInputHandler
*handler
)
3235 : wxStdScrollBarInputHandler(renderer
, handler
)
3237 m_scrollPaused
= false;
3241 bool wxWin32ScrollBarInputHandler::OnScrollTimer(wxScrollBar
*scrollbar
,
3242 const wxControlAction
& action
)
3244 // stop if went beyond the position of the original click (this can only
3245 // happen when we scroll by pages)
3247 if ( action
== wxACTION_SCROLL_PAGE_DOWN
)
3249 stop
= scrollbar
->HitTestBar(m_ptStartScrolling
) != wxHT_SCROLLBAR_BAR_2
;
3251 else if ( action
== wxACTION_SCROLL_PAGE_UP
)
3253 stop
= scrollbar
->HitTestBar(m_ptStartScrolling
) != wxHT_SCROLLBAR_BAR_1
;
3258 StopScrolling(scrollbar
);
3260 scrollbar
->Refresh();
3265 return wxStdScrollBarInputHandler::OnScrollTimer(scrollbar
, action
);
3268 bool wxWin32ScrollBarInputHandler::HandleMouse(wxInputConsumer
*control
,
3269 const wxMouseEvent
& event
)
3271 // remember the current state
3272 bool wasDraggingThumb
= m_htLast
== wxHT_SCROLLBAR_THUMB
;
3274 // do process the message
3275 bool rc
= wxStdScrollBarInputHandler::HandleMouse(control
, event
);
3277 // analyse the changes
3278 if ( !wasDraggingThumb
&& (m_htLast
== wxHT_SCROLLBAR_THUMB
) )
3280 // we just started dragging the thumb, remember its initial position to
3281 // be able to restore it if the drag is cancelled later
3282 m_eventStartDrag
= event
;
3288 bool wxWin32ScrollBarInputHandler::HandleMouseMove(wxInputConsumer
*control
,
3289 const wxMouseEvent
& event
)
3291 // we don't highlight scrollbar elements, so there is no need to process
3292 // mouse move events normally - only do it while mouse is captured (i.e.
3293 // when we're dragging the thumb or pressing on something)
3294 if ( !m_winCapture
)
3297 if ( event
.Entering() )
3299 // we're not interested in this at all
3303 wxScrollBar
*scrollbar
= wxStaticCast(control
->GetInputWindow(), wxScrollBar
);
3305 if ( m_scrollPaused
)
3307 // check if the mouse returned to its original location
3309 if ( event
.Leaving() )
3315 ht
= scrollbar
->HitTestBar(event
.GetPosition());
3316 if ( ht
== m_htLast
)
3318 // yes it did, resume scrolling
3319 m_scrollPaused
= false;
3320 if ( m_timerScroll
)
3322 // we were scrolling by line/page, restart timer
3323 m_timerScroll
->Start(m_interval
);
3325 Press(scrollbar
, true);
3327 else // we were dragging the thumb
3329 // restore its last location
3330 HandleThumbMove(scrollbar
, m_eventLastDrag
);
3336 else // normal case, scrolling hasn't been paused
3338 // if we're scrolling the scrollbar because the arrow or the shaft was
3339 // pressed, check that the mouse stays on the same scrollbar element
3342 // Always let thumb jump back if we leave the scrollbar
3343 if ( event
.Moving() )
3345 ht
= scrollbar
->HitTestBar(event
.GetPosition());
3347 else // event.Leaving()
3352 // Jump back only if we get far away from it
3353 wxPoint pos
= event
.GetPosition();
3354 if (scrollbar
->HasFlag( wxVERTICAL
))
3356 if (pos
.x
> -40 && pos
.x
< scrollbar
->GetSize().x
+40)
3361 if (pos
.y
> -40 && pos
.y
< scrollbar
->GetSize().y
+40)
3364 ht
= scrollbar
->HitTestBar(pos
);
3367 // if we're dragging the thumb and the mouse stays in the scrollbar, it
3368 // is still ok - we only want to catch the case when the mouse leaves
3369 // the scrollbar here
3370 if ( m_htLast
== wxHT_SCROLLBAR_THUMB
&& ht
!= wxHT_NOWHERE
)
3372 ht
= wxHT_SCROLLBAR_THUMB
;
3375 if ( ht
!= m_htLast
)
3377 // what were we doing? 2 possibilities: either an arrow/shaft was
3378 // pressed in which case we have a timer and so we just stop it or
3379 // we were dragging the thumb
3380 if ( m_timerScroll
)
3383 m_interval
= m_timerScroll
->GetInterval();
3384 m_timerScroll
->Stop();
3385 m_scrollPaused
= true;
3387 // unpress the arrow
3388 Press(scrollbar
, false);
3390 else // we were dragging the thumb
3392 // remember the current thumb position to be able to restore it
3393 // if the mouse returns to it later
3394 m_eventLastDrag
= event
;
3396 // and restore the original position (before dragging) of the
3398 HandleThumbMove(scrollbar
, m_eventStartDrag
);
3405 return wxStdInputHandler::HandleMouseMove(control
, event
);
3408 #endif // wxUSE_SCROLLBAR
3412 // ----------------------------------------------------------------------------
3413 // wxWin32CheckboxInputHandler
3414 // ----------------------------------------------------------------------------
3416 bool wxWin32CheckboxInputHandler::HandleKey(wxInputConsumer
*control
,
3417 const wxKeyEvent
& event
,
3422 wxControlAction action
;
3423 int keycode
= event
.GetKeyCode();
3427 action
= wxACTION_CHECKBOX_TOGGLE
;
3431 case WXK_NUMPAD_SUBTRACT
:
3432 action
= wxACTION_CHECKBOX_CHECK
;
3436 case WXK_NUMPAD_ADD
:
3437 case WXK_NUMPAD_EQUAL
:
3438 action
= wxACTION_CHECKBOX_CLEAR
;
3442 if ( !action
.IsEmpty() )
3444 control
->PerformAction(action
);
3453 #endif // wxUSE_CHECKBOX
3457 // ----------------------------------------------------------------------------
3458 // wxWin32TextCtrlInputHandler
3459 // ----------------------------------------------------------------------------
3461 bool wxWin32TextCtrlInputHandler::HandleKey(wxInputConsumer
*control
,
3462 const wxKeyEvent
& event
,
3465 // handle only MSW-specific text bindings here, the others are handled in
3469 int keycode
= event
.GetKeyCode();
3471 wxControlAction action
;
3472 if ( keycode
== WXK_DELETE
&& event
.ShiftDown() )
3474 action
= wxACTION_TEXT_CUT
;
3476 else if ( keycode
== WXK_INSERT
)
3478 if ( event
.ControlDown() )
3479 action
= wxACTION_TEXT_COPY
;
3480 else if ( event
.ShiftDown() )
3481 action
= wxACTION_TEXT_PASTE
;
3484 if ( action
!= wxACTION_NONE
)
3486 control
->PerformAction(action
);
3492 return wxStdInputHandler::HandleKey(control
, event
, pressed
);
3495 #endif // wxUSE_TEXTCTRL
3499 // ----------------------------------------------------------------------------
3500 // wxWin32StatusBarInputHandler
3501 // ----------------------------------------------------------------------------
3503 wxWin32StatusBarInputHandler::
3504 wxWin32StatusBarInputHandler(wxInputHandler
*handler
)
3505 : wxStdInputHandler(handler
)
3510 bool wxWin32StatusBarInputHandler::IsOnGrip(wxWindow
*statbar
,
3511 const wxPoint
& pt
) const
3513 if ( statbar
->HasFlag(wxST_SIZEGRIP
) &&
3514 statbar
->GetParent()->HasFlag(wxRESIZE_BORDER
) )
3517 parentTLW
= wxDynamicCast(statbar
->GetParent(), wxTopLevelWindow
);
3519 wxCHECK_MSG( parentTLW
, false,
3520 wxT("the status bar should be a child of a TLW") );
3522 // a maximized window can't be resized anyhow
3523 if ( !parentTLW
->IsMaximized() )
3525 // VZ: I think that the standard Windows behaviour is to only
3526 // show the resizing cursor when the mouse is on top of the
3527 // grip itself but apparently different Windows versions behave
3528 // differently (?) and it seems a better UI to allow resizing
3529 // the status bar even when the mouse is above the grip
3530 wxSize sizeSbar
= statbar
->GetSize();
3532 int diff
= sizeSbar
.x
- pt
.x
;
3533 return diff
>= 0 && diff
< (wxCoord
)STATUSBAR_GRIP_SIZE
;
3540 bool wxWin32StatusBarInputHandler::HandleMouse(wxInputConsumer
*consumer
,
3541 const wxMouseEvent
& event
)
3543 if ( event
.Button(1) )
3545 if ( event
.ButtonDown(1) )
3547 wxWindow
*statbar
= consumer
->GetInputWindow();
3549 if ( IsOnGrip(statbar
, event
.GetPosition()) )
3551 wxTopLevelWindow
*tlw
= wxDynamicCast(statbar
->GetParent(),
3555 tlw
->PerformAction(wxACTION_TOPLEVEL_RESIZE
,
3556 wxHT_TOPLEVEL_BORDER_SE
);
3558 statbar
->SetCursor(m_cursorOld
);
3566 return wxStdInputHandler::HandleMouse(consumer
, event
);
3569 bool wxWin32StatusBarInputHandler::HandleMouseMove(wxInputConsumer
*consumer
,
3570 const wxMouseEvent
& event
)
3572 wxWindow
*statbar
= consumer
->GetInputWindow();
3574 bool isOnGrip
= IsOnGrip(statbar
, event
.GetPosition());
3575 if ( isOnGrip
!= m_isOnGrip
)
3577 m_isOnGrip
= isOnGrip
;
3580 m_cursorOld
= statbar
->GetCursor();
3581 statbar
->SetCursor(wxCURSOR_SIZENWSE
);
3585 statbar
->SetCursor(m_cursorOld
);
3589 return wxStdInputHandler::HandleMouseMove(consumer
, event
);
3592 #endif // wxUSE_STATUSBAR
3594 // ----------------------------------------------------------------------------
3595 // wxWin32FrameInputHandler
3596 // ----------------------------------------------------------------------------
3598 class wxWin32SystemMenuEvtHandler
: public wxEvtHandler
3601 wxWin32SystemMenuEvtHandler(wxWin32FrameInputHandler
*handler
);
3603 void Attach(wxInputConsumer
*consumer
);
3607 DECLARE_EVENT_TABLE()
3608 void OnSystemMenu(wxCommandEvent
&event
);
3609 void OnCloseFrame(wxCommandEvent
&event
);
3610 void OnClose(wxCloseEvent
&event
);
3612 wxWin32FrameInputHandler
*m_inputHnd
;
3613 wxTopLevelWindow
*m_wnd
;
3615 wxAcceleratorTable m_oldAccelTable
;
3619 wxWin32SystemMenuEvtHandler::
3620 wxWin32SystemMenuEvtHandler(wxWin32FrameInputHandler
*handler
)
3622 m_inputHnd
= handler
;
3626 void wxWin32SystemMenuEvtHandler::Attach(wxInputConsumer
*consumer
)
3628 wxASSERT_MSG( m_wnd
== NULL
, wxT("can't attach the handler twice!") );
3630 m_wnd
= wxStaticCast(consumer
->GetInputWindow(), wxTopLevelWindow
);
3631 m_wnd
->PushEventHandler(this);
3634 // VS: This code relies on using generic implementation of
3635 // wxAcceleratorTable in wxUniv!
3636 wxAcceleratorTable table
= *m_wnd
->GetAcceleratorTable();
3637 m_oldAccelTable
= table
;
3638 table
.Add(wxAcceleratorEntry(wxACCEL_ALT
, WXK_SPACE
, wxID_SYSTEM_MENU
));
3639 table
.Add(wxAcceleratorEntry(wxACCEL_ALT
, WXK_F4
, wxID_CLOSE_FRAME
));
3640 m_wnd
->SetAcceleratorTable(table
);
3644 void wxWin32SystemMenuEvtHandler::Detach()
3649 m_wnd
->SetAcceleratorTable(m_oldAccelTable
);
3651 m_wnd
->RemoveEventHandler(this);
3656 BEGIN_EVENT_TABLE(wxWin32SystemMenuEvtHandler
, wxEvtHandler
)
3657 EVT_MENU(wxID_SYSTEM_MENU
, wxWin32SystemMenuEvtHandler::OnSystemMenu
)
3658 EVT_MENU(wxID_CLOSE_FRAME
, wxWin32SystemMenuEvtHandler::OnCloseFrame
)
3659 EVT_CLOSE(wxWin32SystemMenuEvtHandler::OnClose
)
3662 void wxWin32SystemMenuEvtHandler::OnSystemMenu(wxCommandEvent
&WXUNUSED(event
))
3665 wxAcceleratorTable table
= *m_wnd
->GetAcceleratorTable();
3666 m_wnd
->SetAcceleratorTable(wxNullAcceleratorTable
);
3670 m_inputHnd
->PopupSystemMenu(m_wnd
);
3671 #endif // wxUSE_MENUS
3674 m_wnd
->SetAcceleratorTable(table
);
3678 void wxWin32SystemMenuEvtHandler::OnCloseFrame(wxCommandEvent
&WXUNUSED(event
))
3680 m_wnd
->PerformAction(wxACTION_TOPLEVEL_BUTTON_CLICK
,
3681 wxTOPLEVEL_BUTTON_CLOSE
);
3684 void wxWin32SystemMenuEvtHandler::OnClose(wxCloseEvent
&event
)
3691 wxWin32FrameInputHandler::wxWin32FrameInputHandler(wxInputHandler
*handler
)
3692 : wxStdInputHandler(handler
)
3694 m_menuHandler
= new wxWin32SystemMenuEvtHandler(this);
3697 wxWin32FrameInputHandler::~wxWin32FrameInputHandler()
3699 if ( m_menuHandler
)
3701 m_menuHandler
->Detach();
3702 delete m_menuHandler
;
3706 bool wxWin32FrameInputHandler::HandleMouse(wxInputConsumer
*consumer
,
3707 const wxMouseEvent
& event
)
3709 if ( event
.LeftDClick() || event
.LeftDown() || event
.RightDown() )
3711 wxTopLevelWindow
*tlw
=
3712 wxStaticCast(consumer
->GetInputWindow(), wxTopLevelWindow
);
3714 long hit
= tlw
->HitTest(event
.GetPosition());
3716 if ( event
.LeftDClick() && hit
== wxHT_TOPLEVEL_TITLEBAR
)
3718 tlw
->PerformAction(wxACTION_TOPLEVEL_BUTTON_CLICK
,
3719 tlw
->IsMaximized() ? wxTOPLEVEL_BUTTON_RESTORE
3720 : wxTOPLEVEL_BUTTON_MAXIMIZE
);
3723 else if ( tlw
->GetWindowStyle() & wxSYSTEM_MENU
)
3725 if ( (event
.LeftDown() && hit
== wxHT_TOPLEVEL_ICON
) ||
3726 (event
.RightDown() &&
3727 (hit
== wxHT_TOPLEVEL_TITLEBAR
||
3728 hit
== wxHT_TOPLEVEL_ICON
)) )
3731 PopupSystemMenu(tlw
);
3732 #endif // wxUSE_MENUS
3738 return wxStdInputHandler::HandleMouse(consumer
, event
);
3743 void wxWin32FrameInputHandler::PopupSystemMenu(wxTopLevelWindow
*window
) const
3747 if ( window
->GetWindowStyle() & wxMAXIMIZE_BOX
)
3748 menu
.Append(wxID_RESTORE_FRAME
, _("&Restore"));
3749 menu
.Append(wxID_MOVE_FRAME
, _("&Move"));
3750 if ( window
->GetWindowStyle() & wxRESIZE_BORDER
)
3751 menu
.Append(wxID_RESIZE_FRAME
, _("&Size"));
3752 if ( wxSystemSettings::HasFeature(wxSYS_CAN_ICONIZE_FRAME
) )
3753 menu
.Append(wxID_ICONIZE_FRAME
, _("Mi&nimize"));
3754 if ( window
->GetWindowStyle() & wxMAXIMIZE_BOX
)
3755 menu
.Append(wxID_MAXIMIZE_FRAME
, _("Ma&ximize"));
3756 menu
.AppendSeparator();
3757 menu
.Append(wxID_CLOSE_FRAME
, _("&Close") + wxT("\t") + _("Alt+") + wxT("F4"));
3759 if ( window
->GetWindowStyle() & wxMAXIMIZE_BOX
)
3761 if ( window
->IsMaximized() )
3763 menu
.Enable(wxID_MAXIMIZE_FRAME
, false);
3764 menu
.Enable(wxID_MOVE_FRAME
, false);
3765 if ( window
->GetWindowStyle() & wxRESIZE_BORDER
)
3766 menu
.Enable(wxID_RESIZE_FRAME
, false);
3769 menu
.Enable(wxID_RESTORE_FRAME
, false);
3772 window
->PopupMenu(&menu
, wxPoint(0, 0));
3775 #endif // wxUSE_MENUS
3777 bool wxWin32FrameInputHandler::HandleActivation(wxInputConsumer
*consumer
,
3780 if ( consumer
->GetInputWindow()->GetWindowStyle() & wxSYSTEM_MENU
)
3782 // always detach if active frame changed:
3783 m_menuHandler
->Detach();
3787 m_menuHandler
->Attach(consumer
);
3791 return wxStdInputHandler::HandleActivation(consumer
, activated
);
3794 #endif // wxUSE_THEME_WIN32