]> git.saurik.com Git - wxWidgets.git/blob - src/generic/renderg.cpp
fixed wxBitmapButton to use focus and hover bitmaps correctly; also fixed tons of...
[wxWidgets.git] / src / generic / renderg.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/generic/renderg.cpp
3 // Purpose: generic implementation of wxRendererNative (for any platform)
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 20.07.2003
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // License: wxWindows license
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #include "wx/renderer.h"
28
29 #ifndef WX_PRECOMP
30 #include "wx/string.h"
31 #include "wx/dc.h"
32 #include "wx/settings.h"
33 #include "wx/gdicmn.h"
34 #include "wx/module.h"
35 #endif //WX_PRECOMP
36
37 #include "wx/splitter.h"
38 #include "wx/dcmirror.h"
39
40 #ifdef __WXMAC__
41 #include "wx/mac/private.h"
42 #endif
43
44 // ----------------------------------------------------------------------------
45 // wxRendererGeneric: our wxRendererNative implementation
46 // ----------------------------------------------------------------------------
47
48 class WXDLLEXPORT wxRendererGeneric : public wxRendererNative
49 {
50 public:
51 wxRendererGeneric();
52
53 virtual int DrawHeaderButton(wxWindow *win,
54 wxDC& dc,
55 const wxRect& rect,
56 int flags = 0,
57 wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
58 wxHeaderButtonParams* params = NULL);
59
60 virtual int DrawHeaderButtonContents(wxWindow *win,
61 wxDC& dc,
62 const wxRect& rect,
63 int flags = 0,
64 wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
65 wxHeaderButtonParams* params = NULL);
66
67 virtual int GetHeaderButtonHeight(wxWindow *win);
68
69 virtual void DrawTreeItemButton(wxWindow *win,
70 wxDC& dc,
71 const wxRect& rect,
72 int flags = 0);
73
74 virtual void DrawSplitterBorder(wxWindow *win,
75 wxDC& dc,
76 const wxRect& rect,
77 int flags = 0);
78
79 virtual void DrawSplitterSash(wxWindow *win,
80 wxDC& dc,
81 const wxSize& size,
82 wxCoord position,
83 wxOrientation orient,
84 int flags = 0);
85
86 virtual void DrawComboBoxDropButton(wxWindow *win,
87 wxDC& dc,
88 const wxRect& rect,
89 int flags = 0);
90
91 virtual void DrawDropArrow(wxWindow *win,
92 wxDC& dc,
93 const wxRect& rect,
94 int flags = 0);
95
96 virtual void DrawCheckBox(wxWindow *win,
97 wxDC& dc,
98 const wxRect& rect,
99 int flags = 0);
100
101 virtual void DrawPushButton(wxWindow *win,
102 wxDC& dc,
103 const wxRect& rect,
104 int flags = 0);
105
106 virtual void DrawItemSelectionRect(wxWindow *win,
107 wxDC& dc,
108 const wxRect& rect,
109 int flags = 0);
110
111 virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0);
112
113 virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
114
115 virtual wxRendererVersion GetVersion() const
116 {
117 return wxRendererVersion(wxRendererVersion::Current_Version,
118 wxRendererVersion::Current_Age);
119 }
120
121
122 // Cleanup by deleting standard renderer
123 static void Cleanup();
124
125 // Get the generic object
126 static wxRendererGeneric* DoGetGeneric();
127
128 protected:
129 // draw the rectange using the first pen for the left and top sides and
130 // the second one for the bottom and right ones
131 void DrawShadedRect(wxDC& dc, wxRect *rect,
132 const wxPen& pen1, const wxPen& pen2);
133
134 // the standard pens
135 wxPen m_penBlack,
136 m_penDarkGrey,
137 m_penLightGrey,
138 m_penHighlight;
139
140 static wxRendererGeneric* sm_rendererGeneric;
141 };
142
143 // ============================================================================
144 // wxRendererGeneric implementation
145 // ============================================================================
146
147 // Get the generic object
148 wxRendererGeneric* wxRendererGeneric::DoGetGeneric()
149 {
150 if (!sm_rendererGeneric)
151 sm_rendererGeneric = new wxRendererGeneric;
152 return sm_rendererGeneric;
153 }
154
155 // ----------------------------------------------------------------------------
156 // wxRendererGeneric creation
157 // ----------------------------------------------------------------------------
158
159 /* static */
160 wxRendererNative& wxRendererNative::GetGeneric()
161 {
162 return * wxRendererGeneric::DoGetGeneric();
163 }
164
165 void wxRendererGeneric::Cleanup()
166 {
167 if (sm_rendererGeneric)
168 delete sm_rendererGeneric;
169
170 sm_rendererGeneric = NULL;
171 }
172
173 wxRendererGeneric* wxRendererGeneric::sm_rendererGeneric = NULL;
174
175 wxRendererGeneric::wxRendererGeneric()
176 : m_penBlack(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW)),
177 m_penDarkGrey(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)),
178 m_penLightGrey(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)),
179 m_penHighlight(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT))
180 {
181 }
182
183 // ----------------------------------------------------------------------------
184 // wxRendererGeneric helpers
185 // ----------------------------------------------------------------------------
186
187 void
188 wxRendererGeneric::DrawShadedRect(wxDC& dc,
189 wxRect *rect,
190 const wxPen& pen1,
191 const wxPen& pen2)
192 {
193 // draw the rectangle
194 dc.SetPen(pen1);
195 dc.DrawLine(rect->GetLeft(), rect->GetTop(),
196 rect->GetLeft(), rect->GetBottom());
197 dc.DrawLine(rect->GetLeft() + 1, rect->GetTop(),
198 rect->GetRight(), rect->GetTop());
199 dc.SetPen(pen2);
200 dc.DrawLine(rect->GetRight(), rect->GetTop(),
201 rect->GetRight(), rect->GetBottom());
202 dc.DrawLine(rect->GetLeft(), rect->GetBottom(),
203 rect->GetRight() + 1, rect->GetBottom());
204
205 // adjust the rect
206 rect->Inflate(-1);
207 }
208
209 // ----------------------------------------------------------------------------
210 // tree/list ctrl drawing
211 // ----------------------------------------------------------------------------
212
213 int
214 wxRendererGeneric::DrawHeaderButton(wxWindow* win,
215 wxDC& dc,
216 const wxRect& rect,
217 int flags,
218 wxHeaderSortIconType sortArrow,
219 wxHeaderButtonParams* params)
220 {
221 const wxCoord x = rect.x,
222 y = rect.y,
223 w = rect.width,
224 h = rect.height;
225
226 dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)));
227 dc.SetPen(*wxTRANSPARENT_PEN);
228 dc.DrawRectangle(rect);
229
230 dc.SetBrush(*wxTRANSPARENT_BRUSH);
231
232 dc.SetPen(m_penBlack);
233 dc.DrawLine( x+w-1, y, x+w-1, y+h ); // right (outer)
234 dc.DrawLine( x, y+h-1, x+w, y+h-1 ); // bottom (outer)
235
236 dc.SetPen(m_penDarkGrey);
237 dc.DrawLine( x+w-2, y+1, x+w-2, y+h-1 ); // right (inner)
238 dc.DrawLine( x+1, y+h-2, x+w-1, y+h-2 ); // bottom (inner)
239
240 dc.SetPen(m_penHighlight);
241 dc.DrawLine( x, y, x, y+h-1 ); // left (outer)
242 dc.DrawLine( x, y, x+w-1, y ); // top (outer)
243
244 return DrawHeaderButtonContents(win, dc, rect, flags, sortArrow, params);
245 }
246
247
248 int
249 wxRendererGeneric::DrawHeaderButtonContents(wxWindow *win,
250 wxDC& dc,
251 const wxRect& rect,
252 int flags,
253 wxHeaderSortIconType sortArrow,
254 wxHeaderButtonParams* params)
255 {
256 int labelWidth = 0;
257
258 // Mark this item as selected. For the generic version we'll just draw an
259 // underline
260 if ( flags & wxCONTROL_SELECTED )
261 {
262 // draw a line at the bottom of the header button, overlaying the
263 // native hot-tracking line (on XP)
264 const int penwidth = 3;
265 int y = rect.y + rect.height + 1 - penwidth;
266 wxColour c = (params && params->m_selectionColour.Ok()) ?
267 params->m_selectionColour : wxColour(0x66, 0x66, 0x66);
268 wxPen pen(c, penwidth);
269 pen.SetCap(wxCAP_BUTT);
270 dc.SetPen(pen);
271 dc.DrawLine(rect.x, y, rect.x + rect.width, y);
272 }
273
274 // Draw an up or down arrow
275 int arrowSpace = 0;
276 if (sortArrow != wxHDR_SORT_ICON_NONE )
277 {
278 wxRect ar = rect;
279
280 // make a rect for the arrow
281 ar.height = 4;
282 ar.width = 8;
283 ar.y += (rect.height - ar.height)/2;
284 ar.x = ar.x + rect.width - 3*ar.width/2;
285 arrowSpace = 3*ar.width/2; // space to preserve when drawing the label
286
287 wxPoint triPt[3];
288 if ( sortArrow & wxHDR_SORT_ICON_UP )
289 {
290 triPt[0].x = ar.width / 2;
291 triPt[0].y = 0;
292 triPt[1].x = ar.width;
293 triPt[1].y = ar.height;
294 triPt[2].x = 0;
295 triPt[2].y = ar.height;
296 }
297 else
298 {
299 triPt[0].x = 0;
300 triPt[0].y = 0;
301 triPt[1].x = ar.width;
302 triPt[1].y = 0;
303 triPt[2].x = ar.width / 2;
304 triPt[2].y = ar.height;
305 }
306
307 wxColour c = (params && params->m_arrowColour.Ok()) ?
308 params->m_arrowColour : wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW);
309 dc.SetPen(wxPen(c));
310 dc.SetBrush(wxBrush(c));
311 dc.DrawPolygon( 3, triPt, ar.x, ar.y);
312 }
313 labelWidth += arrowSpace;
314
315 const int margin = 5; // number of pixels to reserve on either side of the label
316 int bmpWidth = 0;
317 int txtEnd = 0;
318
319 if ( params && params->m_labelBitmap.Ok() )
320 bmpWidth = params->m_labelBitmap.GetWidth() + 2;
321
322 labelWidth += bmpWidth + 2*margin;
323
324 // Draw a label if one is given
325 if ( params && !params->m_labelText.empty() )
326 {
327 wxFont font = params->m_labelFont.Ok() ?
328 params->m_labelFont : win->GetFont();
329 wxColour clr = params->m_labelColour.Ok() ?
330 params->m_labelColour : win->GetForegroundColour();
331
332 wxString label( params->m_labelText );
333
334 dc.SetFont(font);
335 dc.SetTextForeground(clr);
336 dc.SetBackgroundMode(wxTRANSPARENT);
337
338 int tw, th, td, x, y;
339 dc.GetTextExtent( label, &tw, &th, &td);
340 labelWidth += tw;
341 y = rect.y + wxMax(0, (rect.height - (th+td)) / 2);
342
343 // truncate and add an ellipsis (...) if the text is too wide.
344 int targetWidth = rect.width - arrowSpace - bmpWidth - 2*margin;
345 if ( tw > targetWidth )
346 {
347 int ellipsisWidth;
348 dc.GetTextExtent( wxT("..."), &ellipsisWidth, NULL);
349 do {
350 label.Truncate( label.length() - 1 );
351 dc.GetTextExtent( label, &tw, &th);
352 } while (tw + ellipsisWidth > targetWidth && label.length() );
353 label.append( wxT("...") );
354 tw += ellipsisWidth;
355 }
356
357 switch (params->m_labelAlignment)
358 {
359 default:
360 case wxALIGN_LEFT:
361 x = rect.x + margin;
362 break;
363 case wxALIGN_CENTER:
364 x = rect.x + wxMax(0, (rect.width - arrowSpace - tw - bmpWidth)/2);
365 break;
366 case wxALIGN_RIGHT:
367 x = rect.x + wxMax(0, rect.width - arrowSpace - margin - tw - bmpWidth);
368 break;
369 }
370
371 dc.DrawText(label, x, y);
372 txtEnd = x + tw + 2;
373 }
374
375 // draw the bitmap if there is one
376 if ( params && params->m_labelBitmap.Ok() )
377 {
378 int w, h, x, y;
379 w = params->m_labelBitmap.GetWidth();
380 h = params->m_labelBitmap.GetHeight();
381
382 y = rect.y + wxMax(1, (rect.height - h) / 2);
383
384 // if there is a text label, then put the bitmap at the end of the label
385 if ( txtEnd != 0 )
386 {
387 x = txtEnd;
388 }
389 // otherwise use the alignment flags
390 else
391 {
392 switch (params->m_labelAlignment)
393 {
394 default:
395 case wxALIGN_LEFT:
396 x = rect.x + margin;
397 break;
398 case wxALIGN_CENTER:
399 x = rect.x + wxMax(1, (rect.width - arrowSpace - w)/2);
400 break;
401 case wxALIGN_RIGHT:
402 x = rect.x + wxMax(1, rect.width - arrowSpace - margin - w);
403 break;
404 }
405 }
406 dc.DrawBitmap(params->m_labelBitmap, x, y, true);
407 }
408 return labelWidth;
409 }
410
411
412 int wxRendererGeneric::GetHeaderButtonHeight(wxWindow *win)
413 {
414 // Copied and adapted from src/generic/listctrl.cpp
415 const int HEADER_OFFSET_Y = 1;
416 const int EXTRA_HEIGHT = 4;
417
418 int w=0, h=14, d=0;
419 if (win)
420 win->GetTextExtent(wxT("Hg"), &w, &h, &d);
421
422 return h + d + 2 * HEADER_OFFSET_Y + EXTRA_HEIGHT;
423 }
424
425
426 // draw the plus or minus sign
427 void
428 wxRendererGeneric::DrawTreeItemButton(wxWindow * WXUNUSED(win),
429 wxDC& dc,
430 const wxRect& rect,
431 int flags)
432 {
433 // store settings
434 wxDCPenChanger penChanger(dc, *wxGREY_PEN);
435 wxDCBrushChanger brushChanger(dc, *wxWHITE_BRUSH);
436
437 dc.DrawRectangle(rect);
438
439 // black lines
440 const wxCoord xMiddle = rect.x + rect.width/2;
441 const wxCoord yMiddle = rect.y + rect.height/2;
442
443 // half of the length of the horz lines in "-" and "+"
444 const wxCoord halfWidth = rect.width/2 - 2;
445 dc.SetPen(*wxBLACK_PEN);
446 dc.DrawLine(xMiddle - halfWidth, yMiddle,
447 xMiddle + halfWidth + 1, yMiddle);
448
449 if ( !(flags & wxCONTROL_EXPANDED) )
450 {
451 // turn "-" into "+"
452 const wxCoord halfHeight = rect.height/2 - 2;
453 dc.DrawLine(xMiddle, yMiddle - halfHeight,
454 xMiddle, yMiddle + halfHeight + 1);
455 }
456 }
457
458 // ----------------------------------------------------------------------------
459 // sash drawing
460 // ----------------------------------------------------------------------------
461
462 wxSplitterRenderParams
463 wxRendererGeneric::GetSplitterParams(const wxWindow *win)
464 {
465 // see below
466 wxCoord sashWidth,
467 border;
468
469 if ( win->HasFlag(wxSP_3DSASH) )
470 sashWidth = 7;
471 else if ( win->HasFlag(wxSP_NOSASH) )
472 sashWidth = 0;
473 else // no 3D effect
474 sashWidth = 3;
475
476 if ( win->HasFlag(wxSP_3DBORDER) )
477 border = 2;
478 else // no 3D effect
479 border = 0;
480
481 return wxSplitterRenderParams(sashWidth, border, false);
482 }
483
484 void
485 wxRendererGeneric::DrawSplitterBorder(wxWindow *win,
486 wxDC& dc,
487 const wxRect& rectOrig,
488 int WXUNUSED(falgs))
489 {
490 if ( win->HasFlag(wxSP_3DBORDER) )
491 {
492 wxRect rect = rectOrig;
493 DrawShadedRect(dc, &rect, m_penDarkGrey, m_penHighlight);
494 DrawShadedRect(dc, &rect, m_penBlack, m_penLightGrey);
495 }
496 }
497
498 void
499 wxRendererGeneric::DrawSplitterSash(wxWindow *win,
500 wxDC& dcReal,
501 const wxSize& sizeReal,
502 wxCoord position,
503 wxOrientation orient,
504 int WXUNUSED(flags))
505 {
506 // to avoid duplicating the same code for horizontal and vertical sashes,
507 // simply mirror the DC instead if needed (i.e. if horz splitter)
508 wxMirrorDC dc(dcReal, orient != wxVERTICAL);
509 wxSize size = dc.Reflect(sizeReal);
510
511
512 // we draw a Win32-like grey sash with possible 3D border here:
513 //
514 // ---- this is position
515 // /
516 // v
517 // dWGGGDd
518 // GWGGGDB
519 // GWGGGDB where G is light grey (face)
520 // GWGGGDB W white (light)
521 // GWGGGDB D dark grey (shadow)
522 // GWGGGDB B black (dark shadow)
523 // GWGGGDB
524 // GWGGGDB and lower letters are our border (already drawn)
525 // GWGGGDB
526 // wWGGGDd
527 //
528 // only the middle 3 columns are drawn unless wxSP_3D is specified
529
530 const wxCoord h = size.y;
531 wxCoord offset = 0;
532
533 // If we're drawing the border, draw the sash 3d lines shorter
534 if ( win->HasFlag(wxSP_3DBORDER) )
535 {
536 offset = 1;
537 }
538
539 dc.SetPen(*wxTRANSPARENT_PEN);
540 dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)));
541
542 if ( win->HasFlag(wxSP_3DSASH) )
543 {
544 // Draw the 3D sash
545 dc.DrawRectangle(position + 2, 0, 3, h);
546
547 dc.SetPen(m_penLightGrey);
548 dc.DrawLine(position, offset, position, h - offset);
549
550 dc.SetPen(m_penHighlight);
551 dc.DrawLine(position + 1, 0, position + 1, h);
552
553 dc.SetPen(m_penDarkGrey);
554 dc.DrawLine(position + 5, 0, position + 5, h);
555
556 dc.SetPen(m_penBlack);
557 dc.DrawLine(position + 6, offset, position + 6, h - offset);
558 }
559 else
560 {
561 // Draw a flat sash
562 dc.DrawRectangle(position, 0, 3, h);
563 }
564 }
565
566 // ----------------------------------------------------------------------------
567 // button drawing
568 // ----------------------------------------------------------------------------
569
570 void
571 wxRendererGeneric::DrawComboBoxDropButton(wxWindow *win,
572 wxDC& dc,
573 const wxRect& rect,
574 int flags)
575 {
576 DrawPushButton(win,dc,rect,flags);
577 DrawDropArrow(win,dc,rect,flags);
578 }
579
580 void
581 wxRendererGeneric::DrawDropArrow(wxWindow *win,
582 wxDC& dc,
583 const wxRect& rect,
584 int WXUNUSED(flags))
585 {
586 // This generic implementation should be good
587 // enough for Windows platforms (including XP).
588
589 int arrowHalf = rect.width/5;
590 int rectMid = rect.width / 2;
591 int arrowTopY = (rect.height/2) - (arrowHalf/2);
592
593 // This should always result in arrow with odd width.
594 wxPoint pt[] =
595 {
596 wxPoint(rectMid - arrowHalf, arrowTopY),
597 wxPoint(rectMid + arrowHalf, arrowTopY),
598 wxPoint(rectMid, arrowTopY + arrowHalf)
599 };
600 dc.SetBrush(wxBrush(win->GetForegroundColour()));
601 dc.SetPen(wxPen(win->GetForegroundColour()));
602 dc.DrawPolygon(WXSIZEOF(pt), pt, rect.x, rect.y);
603 }
604
605 void
606 wxRendererGeneric::DrawCheckBox(wxWindow *WXUNUSED(win),
607 wxDC& dc,
608 const wxRect& rect,
609 int flags)
610 {
611 dc.SetPen(*(flags & wxCONTROL_DISABLED ? wxGREY_PEN : wxBLACK_PEN));
612 dc.SetBrush( *wxTRANSPARENT_BRUSH );
613 dc.DrawRectangle(rect);
614
615 if ( flags & wxCONTROL_CHECKED )
616 {
617 dc.DrawCheckMark(rect.Deflate(2, 2));
618 }
619 }
620
621 void
622 wxRendererGeneric::DrawPushButton(wxWindow *win,
623 wxDC& dc,
624 const wxRect& rect,
625 int flags)
626 {
627 // Don't try anything too fancy. It'll just turn out looking
628 // out-of-place on most platforms.
629 wxColour bgCol = flags & wxCONTROL_DISABLED ?
630 wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE) :
631 win->GetBackgroundColour();
632 dc.SetBrush(wxBrush(bgCol));
633 dc.SetPen(wxPen(bgCol));
634 dc.DrawRectangle(rect);
635 }
636
637 void
638 #ifdef __WXMAC__
639 wxRendererGeneric::DrawItemSelectionRect(wxWindow * win,
640 wxDC& dc,
641 const wxRect& rect,
642 int flags)
643 #else
644 wxRendererGeneric::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
645 wxDC& dc,
646 const wxRect& rect,
647 int flags)
648 #endif
649 {
650 wxBrush brush;
651 if ( flags & wxCONTROL_SELECTED )
652 {
653 if ( flags & wxCONTROL_FOCUSED )
654 {
655 brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
656 }
657 else // !focused
658 {
659 brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
660 }
661 }
662 else // !selected
663 {
664 brush = *wxTRANSPARENT_BRUSH;
665 }
666
667 dc.SetBrush(brush);
668 if ((flags & wxCONTROL_CURRENT) && (flags & wxCONTROL_FOCUSED)
669 #if defined( __WXMAC__ ) && !defined(__WXUNIVERSAL__)
670 && IsControlActive( (ControlRef)win->GetHandle() )
671 #endif
672 )
673 dc.SetPen( *wxBLACK_PEN );
674 else
675 dc.SetPen( *wxTRANSPARENT_PEN );
676
677 dc.DrawRectangle( rect );
678 }
679
680 void
681 wxRendererGeneric::DrawFocusRect(wxWindow* WXUNUSED(win), wxDC& dc, const wxRect& rect, int WXUNUSED(flags))
682 {
683 // draw the pixels manually because the "dots" in wxPen with wxDOT style
684 // may be short traits and not really dots
685 //
686 // note that to behave in the same manner as DrawRect(), we must exclude
687 // the bottom and right borders from the rectangle
688 wxCoord x1 = rect.GetLeft(),
689 y1 = rect.GetTop(),
690 x2 = rect.GetRight(),
691 y2 = rect.GetBottom();
692
693 dc.SetPen(m_penBlack);
694
695 #ifdef __WXMAC__
696 dc.SetLogicalFunction(wxCOPY);
697 #else
698 // this seems to be closer than what Windows does than wxINVERT although
699 // I'm still not sure if it's correct
700 dc.SetLogicalFunction(wxAND_REVERSE);
701 #endif
702
703 wxCoord z;
704 for ( z = x1 + 1; z < x2; z += 2 )
705 dc.DrawPoint(z, rect.GetTop());
706
707 wxCoord shift = z == x2 ? 0 : 1;
708 for ( z = y1 + shift; z < y2; z += 2 )
709 dc.DrawPoint(x2, z);
710
711 shift = z == y2 ? 0 : 1;
712 for ( z = x2 - shift; z > x1; z -= 2 )
713 dc.DrawPoint(z, y2);
714
715 shift = z == x1 ? 0 : 1;
716 for ( z = y2 - shift; z > y1; z -= 2 )
717 dc.DrawPoint(x1, z);
718
719 dc.SetLogicalFunction(wxCOPY);
720 }
721
722 // ----------------------------------------------------------------------------
723 // A module to allow cleanup of generic renderer.
724 // ----------------------------------------------------------------------------
725
726 class wxGenericRendererModule: public wxModule
727 {
728 DECLARE_DYNAMIC_CLASS(wxGenericRendererModule)
729 public:
730 wxGenericRendererModule() {}
731 bool OnInit() { return true; }
732 void OnExit() { wxRendererGeneric::Cleanup(); }
733 };
734
735 IMPLEMENT_DYNAMIC_CLASS(wxGenericRendererModule, wxModule)