Mac fix
[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 // ----------------------------------------------------------------------------
41 // wxRendererGeneric: our wxRendererNative implementation
42 // ----------------------------------------------------------------------------
43
44 class WXDLLEXPORT wxRendererGeneric : public wxRendererNative
45 {
46 public:
47 wxRendererGeneric();
48
49 virtual int DrawHeaderButton(wxWindow *win,
50 wxDC& dc,
51 const wxRect& rect,
52 int flags = 0,
53 wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
54 wxHeaderButtonParams* params = NULL);
55
56 virtual int DrawHeaderButtonContents(wxWindow *win,
57 wxDC& dc,
58 const wxRect& rect,
59 int flags = 0,
60 wxHeaderSortIconType sortArrow = wxHDR_SORT_ICON_NONE,
61 wxHeaderButtonParams* params = NULL);
62
63 virtual int GetHeaderButtonHeight(wxWindow *win);
64
65 virtual void DrawTreeItemButton(wxWindow *win,
66 wxDC& dc,
67 const wxRect& rect,
68 int flags = 0);
69
70 virtual void DrawSplitterBorder(wxWindow *win,
71 wxDC& dc,
72 const wxRect& rect,
73 int flags = 0);
74
75 virtual void DrawSplitterSash(wxWindow *win,
76 wxDC& dc,
77 const wxSize& size,
78 wxCoord position,
79 wxOrientation orient,
80 int flags = 0);
81
82 virtual void DrawComboBoxDropButton(wxWindow *win,
83 wxDC& dc,
84 const wxRect& rect,
85 int flags = 0);
86
87 virtual void DrawDropArrow(wxWindow *win,
88 wxDC& dc,
89 const wxRect& rect,
90 int flags = 0);
91
92 virtual void DrawCheckBox(wxWindow *win,
93 wxDC& dc,
94 const wxRect& rect,
95 int flags = 0);
96
97 virtual void DrawPushButton(wxWindow *win,
98 wxDC& dc,
99 const wxRect& rect,
100 int flags = 0);
101
102 virtual void DrawItemSelectionRect(wxWindow *win,
103 wxDC& dc,
104 const wxRect& rect,
105 int flags = 0);
106
107 virtual void DrawFocusRect(wxWindow* win, wxDC& dc, const wxRect& rect, int flags = 0);
108
109 virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
110
111 virtual wxRendererVersion GetVersion() const
112 {
113 return wxRendererVersion(wxRendererVersion::Current_Version,
114 wxRendererVersion::Current_Age);
115 }
116
117
118 // Cleanup by deleting standard renderer
119 static void Cleanup();
120
121 // Get the generic object
122 static wxRendererGeneric* DoGetGeneric();
123
124 protected:
125 // draw the rectange using the first pen for the left and top sides and
126 // the second one for the bottom and right ones
127 void DrawShadedRect(wxDC& dc, wxRect *rect,
128 const wxPen& pen1, const wxPen& pen2);
129
130 // the standard pens
131 wxPen m_penBlack,
132 m_penDarkGrey,
133 m_penLightGrey,
134 m_penHighlight;
135
136 static wxRendererGeneric* sm_rendererGeneric;
137 };
138
139 // ============================================================================
140 // wxRendererGeneric implementation
141 // ============================================================================
142
143 // Get the generic object
144 wxRendererGeneric* wxRendererGeneric::DoGetGeneric()
145 {
146 if (!sm_rendererGeneric)
147 sm_rendererGeneric = new wxRendererGeneric;
148 return sm_rendererGeneric;
149 }
150
151 // ----------------------------------------------------------------------------
152 // wxRendererGeneric creation
153 // ----------------------------------------------------------------------------
154
155 /* static */
156 wxRendererNative& wxRendererNative::GetGeneric()
157 {
158 return * wxRendererGeneric::DoGetGeneric();
159 }
160
161 void wxRendererGeneric::Cleanup()
162 {
163 if (sm_rendererGeneric)
164 delete sm_rendererGeneric;
165
166 sm_rendererGeneric = NULL;
167 }
168
169 wxRendererGeneric* wxRendererGeneric::sm_rendererGeneric = NULL;
170
171 wxRendererGeneric::wxRendererGeneric()
172 : m_penBlack(wxSystemSettings::GetColour(wxSYS_COLOUR_3DDKSHADOW)),
173 m_penDarkGrey(wxSystemSettings::GetColour(wxSYS_COLOUR_3DSHADOW)),
174 m_penLightGrey(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)),
175 m_penHighlight(wxSystemSettings::GetColour(wxSYS_COLOUR_3DHIGHLIGHT))
176 {
177 }
178
179 // ----------------------------------------------------------------------------
180 // wxRendererGeneric helpers
181 // ----------------------------------------------------------------------------
182
183 void
184 wxRendererGeneric::DrawShadedRect(wxDC& dc,
185 wxRect *rect,
186 const wxPen& pen1,
187 const wxPen& pen2)
188 {
189 // draw the rectangle
190 dc.SetPen(pen1);
191 dc.DrawLine(rect->GetLeft(), rect->GetTop(),
192 rect->GetLeft(), rect->GetBottom());
193 dc.DrawLine(rect->GetLeft() + 1, rect->GetTop(),
194 rect->GetRight(), rect->GetTop());
195 dc.SetPen(pen2);
196 dc.DrawLine(rect->GetRight(), rect->GetTop(),
197 rect->GetRight(), rect->GetBottom());
198 dc.DrawLine(rect->GetLeft(), rect->GetBottom(),
199 rect->GetRight() + 1, rect->GetBottom());
200
201 // adjust the rect
202 rect->Inflate(-1);
203 }
204
205 // ----------------------------------------------------------------------------
206 // tree/list ctrl drawing
207 // ----------------------------------------------------------------------------
208
209 int
210 wxRendererGeneric::DrawHeaderButton(wxWindow* win,
211 wxDC& dc,
212 const wxRect& rect,
213 int flags,
214 wxHeaderSortIconType sortArrow,
215 wxHeaderButtonParams* params)
216 {
217 const int CORNER = 1;
218
219 const wxCoord x = rect.x,
220 y = rect.y,
221 w = rect.width,
222 h = rect.height;
223
224 dc.SetBrush(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE)));
225 dc.SetPen(*wxTRANSPARENT_PEN);
226 dc.DrawRectangle(rect);
227
228 dc.SetBrush(*wxTRANSPARENT_BRUSH);
229
230 dc.SetPen(m_penBlack);
231 dc.DrawLine( x+w-CORNER+1, y, x+w, y+h ); // right (outer)
232 dc.DrawRectangle( x, y+h, w+1, 1 ); // bottom (outer)
233
234 dc.SetPen(m_penDarkGrey);
235 dc.DrawLine( x+w-CORNER, y, x+w-1, y+h ); // right (inner)
236 dc.DrawRectangle( x+1, y+h-1, w-2, 1 ); // bottom (inner)
237
238 dc.SetPen(m_penHighlight);
239 dc.DrawRectangle( x, y, w-CORNER+1, 1 ); // top (outer)
240 dc.DrawRectangle( x, y, 1, h ); // left (outer)
241 dc.DrawLine( x, y+h-1, x+1, y+h-1 );
242 dc.DrawLine( x+w-1, y, x+w-1, y+1 );
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 wxRendererGeneric::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
639 wxDC& dc,
640 const wxRect& rect,
641 int flags)
642 {
643 wxBrush brush;
644 if ( flags & wxCONTROL_SELECTED )
645 {
646 if ( flags & wxCONTROL_FOCUSED )
647 {
648 brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
649 }
650 else // !focused
651 {
652 brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW));
653 }
654 }
655 else // !selected
656 {
657 brush = *wxTRANSPARENT_BRUSH;
658 }
659
660 dc.SetBrush(brush);
661 dc.SetPen(flags & wxCONTROL_CURRENT ? *wxBLACK_PEN : *wxTRANSPARENT_PEN);
662
663 dc.DrawRectangle( rect );
664 }
665
666 void
667 wxRendererGeneric::DrawFocusRect(wxWindow* WXUNUSED(win), wxDC& dc, const wxRect& rect, int WXUNUSED(flags))
668 {
669 // draw the pixels manually because the "dots" in wxPen with wxDOT style
670 // may be short traits and not really dots
671 //
672 // note that to behave in the same manner as DrawRect(), we must exclude
673 // the bottom and right borders from the rectangle
674 wxCoord x1 = rect.GetLeft(),
675 y1 = rect.GetTop(),
676 x2 = rect.GetRight(),
677 y2 = rect.GetBottom();
678
679 dc.SetPen(m_penBlack);
680
681 #ifdef __WXMAC__
682 dc.SetLogicalFunction(wxCOPY);
683 #else
684 // this seems to be closer than what Windows does than wxINVERT although
685 // I'm still not sure if it's correct
686 dc.SetLogicalFunction(wxAND_REVERSE);
687 #endif
688
689 wxCoord z;
690 for ( z = x1 + 1; z < x2; z += 2 )
691 dc.DrawPoint(z, rect.GetTop());
692
693 wxCoord shift = z == x2 ? 0 : 1;
694 for ( z = y1 + shift; z < y2; z += 2 )
695 dc.DrawPoint(x2, z);
696
697 shift = z == y2 ? 0 : 1;
698 for ( z = x2 - shift; z > x1; z -= 2 )
699 dc.DrawPoint(z, y2);
700
701 shift = z == x1 ? 0 : 1;
702 for ( z = y2 - shift; z > y1; z -= 2 )
703 dc.DrawPoint(x1, z);
704
705 dc.SetLogicalFunction(wxCOPY);
706 }
707
708 // ----------------------------------------------------------------------------
709 // A module to allow cleanup of generic renderer.
710 // ----------------------------------------------------------------------------
711
712 class wxGenericRendererModule: public wxModule
713 {
714 DECLARE_DYNAMIC_CLASS(wxGenericRendererModule)
715 public:
716 wxGenericRendererModule() {}
717 bool OnInit() { return true; }
718 void OnExit() { wxRendererGeneric::Cleanup(); }
719 };
720
721 IMPLEMENT_DYNAMIC_CLASS(wxGenericRendererModule, wxModule)