1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: shows and tests wxDC features
4 // Author: Robert Roebling
8 // Copyright: (c) Robert Roebling
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "drawing.cpp"
22 #pragma interface "drawing.cpp"
25 // For compilers that support precompilation, includes "wx/wx.h".
26 #include "wx/wxprec.h"
32 // for all others, include the necessary headers (this file is usually all you
33 // need because it includes almost all "standard" wxWindows headers
38 #include "wx/colordlg.h"
41 // ----------------------------------------------------------------------------
43 // ----------------------------------------------------------------------------
45 // the application icon
46 #if defined(__WXGTK__) || defined(__WXMOTIF__)
47 #include "mondrian.xpm"
50 // ----------------------------------------------------------------------------
52 // ----------------------------------------------------------------------------
54 // what do we show on screen (there are too many shapes to put them all on
55 // screen simultaneously)
68 // ----------------------------------------------------------------------------
70 // ----------------------------------------------------------------------------
72 static wxBitmap
*gs_bmpNoMask
= NULL
,
73 *gs_bmpWithColMask
= NULL
,
75 *gs_bmpWithMask
= NULL
,
80 // ----------------------------------------------------------------------------
82 // ----------------------------------------------------------------------------
84 // Define a new application type, each program should derive a class from wxApp
85 class MyApp
: public wxApp
88 // override base class virtuals
89 // ----------------------------
91 // this one is called on application startup and is a good place for the app
92 // initialization (doing it here and not in the ctor allows to have an error
93 // return: if OnInit() returns false, the application terminates)
94 virtual bool OnInit();
96 virtual int OnExit() { DeleteBitmaps(); return 0; }
106 // Define a new frame type: this is going to be our main frame
107 class MyFrame
: public wxFrame
111 MyFrame(const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
);
113 // event handlers (these functions should _not_ be virtual)
114 void OnQuit(wxCommandEvent
& event
);
115 void OnAbout(wxCommandEvent
& event
);
116 void OnShow(wxCommandEvent
&event
);
117 void OnOption(wxCommandEvent
&event
);
119 wxColour
SelectColour();
120 void PrepareDC(wxDC
& dc
);
122 int m_backgroundMode
;
123 int m_textureBackground
;
127 int m_xLogicalOrigin
;
128 int m_yLogicalOrigin
;
129 bool m_xAxisReversed
,
131 wxColour m_colourForeground
, // these are _text_ colours
133 wxBrush m_backgroundBrush
;
137 // any class wishing to process wxWindows events must use this macro
138 DECLARE_EVENT_TABLE()
141 // define a scrollable canvas for drawing onto
142 class MyCanvas
: public wxScrolledWindow
145 MyCanvas( MyFrame
*parent
);
147 void OnPaint(wxPaintEvent
&event
);
148 void OnMouseMove(wxMouseEvent
&event
);
150 void Show(ScreenToShow show
) { m_show
= show
; Refresh(); }
153 void DrawTestPoly( int x
, int y
, wxDC
&dc
,int transparent
);
154 void DrawTestLines( int x
, int y
, int width
, wxDC
&dc
);
155 void DrawText(wxDC
& dc
);
156 void DrawImages(wxDC
& dc
);
157 void DrawWithLogicalOps(wxDC
& dc
);
158 void DrawRegions(wxDC
& dc
);
159 void DrawCircles(wxDC
& dc
);
160 void DrawDefault(wxDC
& dc
);
166 wxBitmap m_smile_bmp
;
169 DECLARE_EVENT_TABLE()
172 // ----------------------------------------------------------------------------
174 // ----------------------------------------------------------------------------
176 // IDs for the controls and the menu commands
184 File_ShowDefault
= MenuShow_First
,
192 MenuShow_Last
= File_ShowCircles
,
196 MapMode_Text
= MenuOption_First
,
202 UserScale_StretchHoriz
,
203 UserScale_ShrinkHoriz
,
204 UserScale_StretchVertic
,
205 UserScale_ShrinkVertic
,
211 LogicalOrigin_MoveDown
,
212 LogicalOrigin_MoveUp
,
213 LogicalOrigin_MoveLeft
,
214 LogicalOrigin_MoveRight
,
216 Colour_TextForeground
,
217 Colour_TextBackground
,
219 Colour_BackgroundMode
,
220 Colour_TextureBackgound
,
222 MenuOption_Last
= Colour_TextureBackgound
225 // ----------------------------------------------------------------------------
226 // event tables and other macros for wxWindows
227 // ----------------------------------------------------------------------------
230 // Create a new application object: this macro will allow wxWindows to create
231 // the application object during program execution (it's better than using a
232 // static object for many reasons) and also declares the accessor function
233 // wxGetApp() which will return the reference of the right type (i.e. MyApp and
237 // ============================================================================
239 // ============================================================================
241 // ----------------------------------------------------------------------------
242 // the application class
243 // ----------------------------------------------------------------------------
245 bool MyApp::LoadImages()
247 gs_bmpNoMask
= new wxBitmap
;
248 gs_bmpWithColMask
= new wxBitmap
;
249 gs_bmpMask
= new wxBitmap
;
250 gs_bmpWithMask
= new wxBitmap
;
251 gs_bmp4
= new wxBitmap
;
252 gs_bmp4_mono
= new wxBitmap
;
253 gs_bmp36
= new wxBitmap
;
259 wxString path
= pathList
.FindValidPath("pat4.bmp");
263 /* 4 colour bitmap */
264 gs_bmp4
->LoadFile(path
, wxBITMAP_TYPE_BMP
);
265 /* turn into mono-bitmap */
266 gs_bmp4_mono
->LoadFile(path
, wxBITMAP_TYPE_BMP
);
267 wxMask
* mask4
= new wxMask(*gs_bmp4_mono
, *wxBLACK
);
268 gs_bmp4_mono
->SetMask(mask4
);
270 path
= pathList
.FindValidPath("pat36.bmp");
273 gs_bmp36
->LoadFile(path
, wxBITMAP_TYPE_BMP
);
274 wxMask
* mask36
= new wxMask(*gs_bmp36
, *wxBLACK
);
275 gs_bmp36
->SetMask(mask36
);
277 path
= pathList
.FindValidPath("image.bmp");
280 gs_bmpNoMask
->LoadFile(path
, wxBITMAP_TYPE_BMP
);
281 gs_bmpWithMask
->LoadFile(path
, wxBITMAP_TYPE_BMP
);
282 gs_bmpWithColMask
->LoadFile(path
, wxBITMAP_TYPE_BMP
);
284 path
= pathList
.FindValidPath("mask.bmp");
287 gs_bmpMask
->LoadFile(path
, wxBITMAP_TYPE_BMP
);
289 wxMask
*mask
= new wxMask(*gs_bmpMask
, *wxBLACK
);
290 gs_bmpWithMask
->SetMask(mask
);
292 mask
= new wxMask(*gs_bmpWithColMask
, *wxWHITE
);
293 gs_bmpWithColMask
->SetMask(mask
);
298 // `Main program' equivalent: the program execution "starts" here
301 // Create the main application window
302 MyFrame
*frame
= new MyFrame("Drawing sample",
303 wxPoint(50, 50), wxSize(550, 340));
305 // Show it and tell the application that it's our main window
311 wxLogError("Can't load one of the bitmap files needed for this sample "
312 "from the current or parent directory, please copy them "
325 void MyApp::DeleteBitmaps()
328 delete gs_bmpWithColMask
;
330 delete gs_bmpWithMask
;
336 // ----------------------------------------------------------------------------
338 // ----------------------------------------------------------------------------
340 // the event tables connect the wxWindows events with the functions (event
341 // handlers) which process them.
342 BEGIN_EVENT_TABLE(MyCanvas
, wxScrolledWindow
)
343 EVT_PAINT (MyCanvas::OnPaint
)
344 EVT_MOTION (MyCanvas::OnMouseMove
)
349 MyCanvas::MyCanvas(MyFrame
*parent
)
350 : wxScrolledWindow(parent
, -1, wxDefaultPosition
, wxDefaultSize
,
351 wxHSCROLL
| wxVSCROLL
| wxNO_FULL_REPAINT_ON_RESIZE
)
354 m_show
= Show_Default
;
355 m_smile_bmp
= wxBitmap(smile_xpm
);
356 m_std_icon
= wxTheApp
->GetStdIcon(wxICON_INFORMATION
);
359 // Draw a polygon and an overlapping rectangle
360 // If transparent is 1, the fill pattern is made transparent.
361 // If transparent is 2, the fill pattern is made transparent but inversed
362 // If is transparent is 0 the text for and background color will be used to represent/map
363 // the colors of the monochrome bitmap pixels to the fillpattern
365 // I abused the the menu items for setting so called back and fore ground color
366 // just to show how the those colors do influence the fillpatterns just play
367 // with those, and with the code variations are endless using other logical
370 void MyCanvas::DrawTestPoly( int x
, int y
,wxDC
&dc
,int transparent
)
372 // wxBrush* brush4 = new wxBrush(*gs_bmp4);
373 wxBrush
* brush4
= new wxBrush(*wxBLACK
,wxFDIAGONAL_HATCH
);
374 wxBrush
* brush4_mono
= new wxBrush(*gs_bmp4_mono
);
375 wxBrush
* brush36
= new wxBrush(*gs_bmp36
);
378 todraw
[0].x
=(long)x
+100;
379 todraw
[0].y
=(long)y
+100;
380 todraw
[1].x
=(long)x
+300;
381 todraw
[1].y
=(long)y
+100;
382 todraw
[2].x
=(long)x
+300;
383 todraw
[2].y
=(long)y
+300;
384 todraw
[3].x
=(long)x
+150;
385 todraw
[3].y
=(long)y
+350;
386 todraw
[4].x
=(long)x
+100;
387 todraw
[4].y
=(long)y
+300;
405 dc
.SetLogicalFunction(wxCOPY
);
407 dc
.SetPen( wxPen( "black", 4, wxSOLID
) );
408 dc
.SetBrush( *brush4
);
409 dc
.DrawPolygon(5,todraw
,0,0,wxWINDING_RULE
);
411 dc
.SetPen( wxPen( "red", 4, wxSOLID
) );
412 dc
.SetBrush( *brush36
);
413 dc
.SetTextForeground(*wxCYAN
);
414 dc
.SetTextBackground(m_owner
->m_colourBackground
);
415 dc
.DrawRectangle( x
+10, y
+10, 200, 200 );
417 dc
.SetPen( wxPen( "green", 4, wxSOLID
) );
418 dc
.SetBrush( *brush4_mono
);
419 dc
.SetTextForeground(*wxCYAN
);
420 dc
.SetTextBackground(m_owner
->m_colourBackground
);
421 dc
.DrawRectangle( x
+50, y
+50, 200, 200 );
423 dc
.DrawCircle( x
+400, y
+50, 130 );
425 dc
.SetBrush(wxNullBrush
);
426 dc
.SetPen(wxNullPen
);
429 case 1: //now with transparent fillpatterns
432 wxBitmap
* bmpBlit
= new wxBitmap(600,400);
433 wxMemoryDC
* memDC
= new wxMemoryDC();
434 // wxBrush _clearbrush(*wxGREEN,wxSOLID);
435 wxBrush
_clearbrush(*wxBLACK
,wxSOLID
);
436 memDC
->SelectObject(*bmpBlit
);
437 memDC
->BeginDrawing();
438 memDC
->SetBackground(_clearbrush
);
440 memDC
->SetBackground(wxNullBrush
);
442 memDC
->SetPen( wxPen( "black", 4, wxSOLID
) );
443 memDC
->SetBrush( wxNullBrush
);
444 memDC
->SetBrush( *brush4
);
445 memDC
->SetTextForeground(*wxBLACK
); // 0s --> 0x000000 (black)
446 memDC
->SetTextBackground(*wxWHITE
); // 1s --> 0xFFFFFF (white)
447 memDC
->SetLogicalFunction(wxAND_INVERT
);
449 // BLACK OUT the opaque pixels and leave the rest as is
450 memDC
->DrawPolygon(5,todraw2
,0,0,wxWINDING_RULE
);
452 // Set background and foreground colors for fill pattern
453 //the previous blacked out pixels are now merged with the layer color
454 //while the non blacked out pixels stay as they are.
455 memDC
->SetTextForeground(*wxBLACK
); // 0s --> 0x000000 (black)
457 //now define what will be the color of the fillpattern parts that are not transparent
458 // memDC->SetTextBackground(*wxBLUE);
459 memDC
->SetTextBackground(m_owner
->m_colourForeground
);
460 memDC
->SetLogicalFunction(wxOR
);
463 //don't understand how but the outline is also depending on logicalfunction
464 memDC
->SetPen( wxPen( "red", 4, wxSOLID
) );
465 memDC
->DrawPolygon(5,todraw2
,0,0,wxWINDING_RULE
);
467 memDC
->SetLogicalFunction(wxCOPY
);
469 memDC
->SetPen( wxPen( "black", 4, wxSOLID
) );
470 memDC
->SetBrush( wxNullBrush
);
471 memDC
->SetBrush( *brush36
);
472 memDC
->SetTextForeground(*wxBLACK
); // 0s --> 0x000000 (black)
473 memDC
->SetTextBackground(*wxWHITE
); // 1s --> 0xFFFFFF (white)
474 memDC
->SetLogicalFunction(wxAND_INVERT
);
476 memDC
->DrawRectangle( 10, 10, 200, 200 );
478 // Set background and foreground colors for fill pattern
479 //the previous blacked out pixels are now merged with the layer color
480 //while the non blacked out pixels stay as they are.
481 memDC
->SetTextForeground(*wxBLACK
); // 0s --> 0x000000 (black)
482 //now define what will be the color of the fillpattern parts that are not transparent
483 // memDC->SetTextBackground(*wxRED);
484 memDC
->SetTextBackground(m_owner
->m_colourBackground
);
485 memDC
->SetLogicalFunction(wxOR
);
487 //don't understand how but the outline is also depending on logicalfunction
488 memDC
->SetPen( wxPen( "yellow", 4, wxSOLID
) );
489 memDC
->DrawRectangle( 10, 10, 200, 200 );
491 memDC
->SetBrush(wxNullBrush
);
492 memDC
->SetPen(wxNullPen
);
495 dc
.Blit(x
,y
,600,400,memDC
,0,0,wxCOPY
);
500 case 2: //now with transparent inversed fillpatterns
502 wxBitmap
* bmpBlit
= new wxBitmap(600,400);
503 wxMemoryDC
* memDC
= new wxMemoryDC();
504 wxBrush
_clearbrush(*wxWHITE
,wxSOLID
);
505 memDC
->SelectObject(*bmpBlit
);
506 memDC
->BeginDrawing();
507 memDC
->SetBackground(_clearbrush
);
509 memDC
->SetBackground(wxNullBrush
);
511 memDC
->SetPen( wxPen( "black", 4, wxSOLID
) );
512 memDC
->SetBrush( *brush4
);
513 memDC
->SetTextBackground(*wxBLACK
); // 0s --> 0x000000 (black)
514 memDC
->SetTextForeground(*wxWHITE
); // 1s --> 0xFFFFFF (white)
515 memDC
->SetLogicalFunction(wxAND_INVERT
);
517 // BLACK OUT the opaque pixels and leave the rest as is
518 memDC
->DrawPolygon(5,todraw2
,0,0,wxWINDING_RULE
);
520 // Set background and foreground colors for fill pattern
521 //the previous blacked out pixels are now merged with the layer color
522 //while the non blacked out pixels stay as they are.
523 memDC
->SetTextBackground(*wxBLACK
); // 0s --> 0x000000 (black)
525 //now define what will be the color of the fillpattern parts that are not transparent
526 memDC
->SetTextForeground(m_owner
->m_colourForeground
);
527 memDC
->SetLogicalFunction(wxOR
);
530 //don't understand how but the outline is also depending on logicalfunction
531 memDC
->SetPen( wxPen( "red", 4, wxSOLID
) );
532 memDC
->DrawPolygon(5,todraw2
,0,0,wxWINDING_RULE
);
534 memDC
->SetLogicalFunction(wxCOPY
);
536 memDC
->SetPen( wxPen( "black", 4, wxSOLID
) );
537 memDC
->SetBrush( *brush36
);
538 memDC
->SetTextBackground(*wxBLACK
); // 0s --> 0x000000 (black)
539 memDC
->SetTextForeground(*wxWHITE
); // 1s --> 0xFFFFFF (white)
540 memDC
->SetLogicalFunction(wxAND_INVERT
);
542 memDC
->DrawRectangle( 10,10, 200, 200 );
544 // Set background and foreground colors for fill pattern
545 //the previous blacked out pixels are now merged with the layer color
546 //while the non blacked out pixels stay as they are.
547 memDC
->SetTextBackground(*wxBLACK
); // 0s --> 0x000000 (black)
548 //now define what will be the color of the fillpattern parts that are not transparent
549 memDC
->SetTextForeground(m_owner
->m_colourBackground
);
550 memDC
->SetLogicalFunction(wxOR
);
552 //don't understand how but the outline is also depending on logicalfunction
553 memDC
->SetPen( wxPen( "yellow", 4, wxSOLID
) );
554 memDC
->DrawRectangle( 10, 10, 200, 200 );
556 memDC
->SetBrush(wxNullBrush
);
557 memDC
->SetPen(wxNullPen
);
558 dc
.Blit(x
,y
,600,400,memDC
,0,0,wxCOPY
);
569 void MyCanvas::DrawTestLines( int x
, int y
, int width
, wxDC
&dc
)
571 dc
.SetPen( wxPen( "black", width
, wxSOLID
) );
572 dc
.SetBrush( *wxRED_BRUSH
);
573 dc
.DrawText(wxString::Format("Testing lines of width %d", width
), x
+ 10, y
- 10);
574 dc
.DrawRectangle( x
+10, y
+10, 100, 190 );
576 dc
.DrawText("Solid/dot/short dash/long dash/dot dash", x
+ 150, y
+ 10);
577 dc
.SetPen( wxPen( "black", width
, wxSOLID
) );
578 dc
.DrawLine( x
+20, y
+20, 100, y
+20 );
579 dc
.SetPen( wxPen( "black", width
, wxDOT
) );
580 dc
.DrawLine( x
+20, y
+30, 100, y
+30 );
581 dc
.SetPen( wxPen( "black", width
, wxSHORT_DASH
) );
582 dc
.DrawLine( x
+20, y
+40, 100, y
+40 );
583 dc
.SetPen( wxPen( "black", width
, wxLONG_DASH
) );
584 dc
.DrawLine( x
+20, y
+50, 100, y
+50 );
585 dc
.SetPen( wxPen( "black", width
, wxDOT_DASH
) );
586 dc
.DrawLine( x
+20, y
+60, 100, y
+60 );
588 dc
.DrawText("Misc hatches", x
+ 150, y
+ 70);
589 dc
.SetPen( wxPen( "black", width
, wxBDIAGONAL_HATCH
) );
590 dc
.DrawLine( x
+20, y
+70, 100, y
+70 );
591 dc
.SetPen( wxPen( "black", width
, wxCROSSDIAG_HATCH
) );
592 dc
.DrawLine( x
+20, y
+80, 100, y
+80 );
593 dc
.SetPen( wxPen( "black", width
, wxFDIAGONAL_HATCH
) );
594 dc
.DrawLine( x
+20, y
+90, 100, y
+90 );
595 dc
.SetPen( wxPen( "black", width
, wxCROSS_HATCH
) );
596 dc
.DrawLine( x
+20, y
+100, 100, y
+100 );
597 dc
.SetPen( wxPen( "black", width
, wxHORIZONTAL_HATCH
) );
598 dc
.DrawLine( x
+20, y
+110, 100, y
+110 );
599 dc
.SetPen( wxPen( "black", width
, wxVERTICAL_HATCH
) );
600 dc
.DrawLine( x
+20, y
+120, 100, y
+120 );
602 dc
.DrawText("User dash", x
+ 150, y
+ 140);
603 wxPen
ud( "black", width
, wxUSER_DASH
);
606 ud
.SetDashes( 1, dash1
);
607 dc
.DrawLine( x
+20, y
+140, 100, y
+140 );
609 ud
.SetDashes( 1, dash1
);
610 dc
.DrawLine( x
+20, y
+150, 100, y
+150 );
612 ud
.SetDashes( 1, dash1
);
613 dc
.DrawLine( x
+20, y
+160, 100, y
+160 );
615 ud
.SetDashes( 1, dash1
);
616 dc
.DrawLine( x
+20, y
+170, 100, y
+170 );
619 void MyCanvas::DrawDefault(wxDC
& dc
)
622 dc
.DrawCircle(0, 0, 10);
623 #if !(defined __WXGTK__) && !(defined __WXMOTIF__)
624 // not implemented in wxGTK or wxMOTIF :-(
625 dc
.FloodFill(0, 0, wxColour(255, 0, 0));
628 dc
.DrawCheckMark(5, 80, 15, 15);
629 dc
.DrawCheckMark(25, 80, 30, 30);
630 dc
.DrawCheckMark(60, 80, 60, 60);
632 // this is the test for "blitting bitmap into DC damages selected brush" bug
633 wxCoord rectSize
= m_std_icon
.GetWidth() + 10;
635 dc
.SetPen(*wxTRANSPARENT_PEN
);
636 dc
.SetBrush( *wxGREEN_BRUSH
);
637 dc
.DrawRectangle(x
, 10, rectSize
, rectSize
);
638 dc
.DrawBitmap(m_std_icon
, x
+ 5, 15, TRUE
);
640 dc
.DrawRectangle(x
, 10, rectSize
, rectSize
);
641 dc
.DrawIcon(m_std_icon
, x
+ 5, 15);
643 dc
.DrawRectangle(x
, 10, rectSize
, rectSize
);
645 // test for "transparent" bitmap drawing (it intersects with the last
647 //dc.SetBrush( *wxTRANSPARENT_BRUSH );
649 if (m_smile_bmp
.Ok())
650 dc
.DrawBitmap(m_smile_bmp
, x
+ rectSize
- 20, rectSize
- 10, TRUE
);
652 dc
.SetBrush( *wxBLACK_BRUSH
);
653 dc
.DrawRectangle( 0, 160, 1000, 300 );
656 wxBitmap
bitmap(20,70);
658 memdc
.SelectObject( bitmap
);
659 memdc
.SetBrush( *wxBLACK_BRUSH
);
660 memdc
.SetPen( *wxWHITE_PEN
);
661 memdc
.DrawRectangle(0,0,20,70);
662 memdc
.DrawLine( 10,0,10,70 );
665 wxPen pen
= *wxRED_PEN
;
667 memdc
.DrawLine( 10, 5,10, 5 );
668 memdc
.DrawLine( 10,10,11,10 );
669 memdc
.DrawLine( 10,15,12,15 );
670 memdc
.DrawLine( 10,20,13,20 );
673 memdc.SetPen(*wxRED_PEN);
674 memdc.DrawLine( 12, 5,12, 5 );
675 memdc.DrawLine( 12,10,13,10 );
676 memdc.DrawLine( 12,15,14,15 );
677 memdc.DrawLine( 12,20,15,20 );
681 memdc
.DrawLine( 10,25,10,25 );
682 memdc
.DrawLine( 10,30, 9,30 );
683 memdc
.DrawLine( 10,35, 8,35 );
684 memdc
.DrawLine( 10,40, 7,40 );
687 dc
.SetPen(*wxWHITE_PEN
);
688 memdc
.SetLogicalFunction( wxINVERT
);
689 memdc
.SetPen( *wxWHITE_PEN
);
690 memdc
.DrawLine( 10,50,10,50 );
691 memdc
.DrawLine( 10,55,11,55 );
692 memdc
.DrawLine( 10,60,12,60 );
693 memdc
.DrawLine( 10,65,13,65 );
695 memdc
.DrawLine( 12,50,12,50 );
696 memdc
.DrawLine( 12,55,13,55 );
697 memdc
.DrawLine( 12,60,14,60 );
698 memdc
.DrawLine( 12,65,15,65 );
700 memdc
.SelectObject( wxNullBitmap
);
701 dc
.DrawBitmap( bitmap
, 10, 170 );
702 wxImage
image( bitmap
);
703 image
.Rescale( 60,210 );
704 bitmap
= image
.ConvertToBitmap();
705 dc
.DrawBitmap( bitmap
, 50, 170 );
707 // test the rectangle outline drawing - there should be one pixel between
708 // the rect and the lines
709 dc
.SetPen(*wxWHITE_PEN
);
710 dc
.SetBrush( *wxTRANSPARENT_BRUSH
);
711 dc
.DrawRectangle(150, 170, 49, 29);
712 dc
.DrawRectangle(200, 170, 49, 29);
713 dc
.SetPen(*wxWHITE_PEN
);
714 dc
.DrawLine(250, 210, 250, 170);
715 dc
.DrawLine(260, 200, 150, 200);
717 // test the rectangle filled drawing - there should be one pixel between
718 // the rect and the lines
719 dc
.SetPen(*wxTRANSPARENT_PEN
);
720 dc
.SetBrush( *wxWHITE_BRUSH
);
721 dc
.DrawRectangle(300, 170, 49, 29);
722 dc
.DrawRectangle(350, 170, 49, 29);
723 dc
.SetPen(*wxWHITE_PEN
);
724 dc
.DrawLine(400, 170, 400, 210);
725 dc
.DrawLine(300, 200, 410, 200);
727 // a few more tests of this kind
728 dc
.SetPen(*wxRED_PEN
);
729 dc
.SetBrush( *wxWHITE_BRUSH
);
730 dc
.DrawRectangle(300, 220, 1, 1);
731 dc
.DrawRectangle(310, 220, 2, 2);
732 dc
.DrawRectangle(320, 220, 3, 3);
733 dc
.DrawRectangle(330, 220, 4, 4);
735 dc
.SetPen(*wxTRANSPARENT_PEN
);
736 dc
.SetBrush( *wxWHITE_BRUSH
);
737 dc
.DrawRectangle(300, 230, 1, 1);
738 dc
.DrawRectangle(310, 230, 2, 2);
739 dc
.DrawRectangle(320, 230, 3, 3);
740 dc
.DrawRectangle(330, 230, 4, 4);
742 // and now for filled rect with outline
743 dc
.SetPen(*wxRED_PEN
);
744 dc
.SetBrush( *wxWHITE_BRUSH
);
745 dc
.DrawRectangle(500, 170, 49, 29);
746 dc
.DrawRectangle(550, 170, 49, 29);
747 dc
.SetPen(*wxWHITE_PEN
);
748 dc
.DrawLine(600, 170, 600, 210);
749 dc
.DrawLine(500, 200, 610, 200);
751 // test the rectangle outline drawing - there should be one pixel between
752 // the rect and the lines
753 dc
.SetPen(*wxWHITE_PEN
);
754 dc
.SetBrush( *wxTRANSPARENT_BRUSH
);
755 dc
.DrawRoundedRectangle(150, 270, 49, 29, 6);
756 dc
.DrawRoundedRectangle(200, 270, 49, 29, 6);
757 dc
.SetPen(*wxWHITE_PEN
);
758 dc
.DrawLine(250, 270, 250, 310);
759 dc
.DrawLine(150, 300, 260, 300);
761 // test the rectangle filled drawing - there should be one pixel between
762 // the rect and the lines
763 dc
.SetPen(*wxTRANSPARENT_PEN
);
764 dc
.SetBrush( *wxWHITE_BRUSH
);
765 dc
.DrawRoundedRectangle(300, 270, 49, 29, 6);
766 dc
.DrawRoundedRectangle(350, 270, 49, 29, 6);
767 dc
.SetPen(*wxWHITE_PEN
);
768 dc
.DrawLine(400, 270, 400, 310);
769 dc
.DrawLine(300, 300, 410, 300);
771 // Added by JACS to demonstrate bizarre behaviour.
772 // With a size of 70, we get a missing red RHS,
773 // and the hight is too small, so we get yellow
774 // showing. With a size of 40, it draws as expected:
775 // it just shows a white rectangle with red outline.
777 int totalHeight
= 70;
778 wxBitmap
bitmap2(totalWidth
, totalHeight
);
781 memdc2
.SelectObject(bitmap2
);
783 wxBrush
yellowBrush(wxColour(255, 255, 0), wxSOLID
);
784 memdc2
.SetBackground(yellowBrush
);
787 wxPen
yellowPen(wxColour(255, 255, 0), 1, wxSOLID
);
789 // Now draw a white rectangle with red outline. It should
790 // entirely eclipse the yellow background.
791 memdc2
.SetPen(*wxRED_PEN
);
792 memdc2
.SetBrush(*wxWHITE_BRUSH
);
794 memdc2
.DrawRectangle(0, 0, totalWidth
, totalHeight
);
796 memdc2
.SetPen(wxNullPen
);
797 memdc2
.SetBrush(wxNullBrush
);
798 memdc2
.SelectObject(wxNullBitmap
);
800 dc
.DrawBitmap(bitmap2
, 500, 270);
802 // Repeat, but draw directly on dc
803 // Draw a yellow rectangle filling the bitmap
805 x
= 600; int y
= 270;
806 dc
.SetPen(yellowPen
);
807 dc
.SetBrush(yellowBrush
);
808 dc
.DrawRectangle(x
, y
, totalWidth
, totalHeight
);
810 // Now draw a white rectangle with red outline. It should
811 // entirely eclipse the yellow background.
812 dc
.SetPen(*wxRED_PEN
);
813 dc
.SetBrush(*wxWHITE_BRUSH
);
815 dc
.DrawRectangle(x
, y
, totalWidth
, totalHeight
);
818 void MyCanvas::DrawText(wxDC
& dc
)
820 // set underlined font for testing
821 dc
.SetFont( wxFont(12, wxMODERN
, wxNORMAL
, wxNORMAL
, TRUE
) );
822 dc
.DrawText( "This is text", 110, 10 );
823 dc
.DrawRotatedText( "That is text", 20, 10, -45 );
825 dc
.SetFont( *wxNORMAL_FONT
);
828 dc
.SetBackgroundMode(wxTRANSPARENT
);
830 for ( int n
= -180; n
< 180; n
+= 30 )
832 text
.Printf(" %d rotated text", n
);
833 dc
.DrawRotatedText(text
, 400, 400, n
);
836 dc
.SetFont( wxFont( 18, wxSWISS
, wxNORMAL
, wxNORMAL
) );
838 dc
.DrawText( "This is Swiss 18pt text.", 110, 40 );
843 dc
.GetTextExtent( "This is Swiss 18pt text.", &length
, &height
, &descent
);
844 text
.Printf( "Dimensions are length %ld, height %ld, descent %ld", length
, height
, descent
);
845 dc
.DrawText( text
, 110, 80 );
847 text
.Printf( "CharHeight() returns: %d", dc
.GetCharHeight() );
848 dc
.DrawText( text
, 110, 120 );
850 dc
.DrawRectangle( 100, 40, 4, height
);
852 // test the logical function effect
854 dc
.SetLogicalFunction(wxINVERT
);
855 dc
.DrawText( "There should be no text below", 110, 150 );
856 dc
.DrawRectangle( 110, y
, 100, height
);
858 // twice drawn inverted should result in invisible
860 dc
.DrawText( "Invisible text", 110, y
);
861 dc
.DrawRectangle( 110, y
, 100, height
);
862 dc
.DrawText( "Invisible text", 110, y
);
863 dc
.DrawRectangle( 110, y
, 100, height
);
864 dc
.SetLogicalFunction(wxCOPY
);
867 dc
.DrawRectangle( 110, y
, 100, height
);
868 dc
.DrawText( "Visible text", 110, y
);
875 } rasterOperations
[] =
878 { "wxAND_INVERT", wxAND_INVERT
},
879 { "wxAND_REVERSE", wxAND_REVERSE
},
880 { "wxCLEAR", wxCLEAR
},
881 { "wxCOPY", wxCOPY
},
882 { "wxEQUIV", wxEQUIV
},
883 { "wxINVERT", wxINVERT
},
884 { "wxNAND", wxNAND
},
885 { "wxNO_OP", wxNO_OP
},
887 { "wxOR_INVERT", wxOR_INVERT
},
888 { "wxOR_REVERSE", wxOR_REVERSE
},
890 { "wxSRC_INVERT", wxSRC_INVERT
},
894 void MyCanvas::DrawImages(wxDC
& dc
)
896 dc
.DrawText("original image", 0, 0);
897 dc
.DrawBitmap(*gs_bmpNoMask
, 0, 20, 0);
898 dc
.DrawText("with colour mask", 0, 100);
899 dc
.DrawBitmap(*gs_bmpWithColMask
, 0, 120, TRUE
);
900 dc
.DrawText("the mask image", 0, 200);
901 dc
.DrawBitmap(*gs_bmpMask
, 0, 220, 0);
902 dc
.DrawText("masked image", 0, 300);
903 dc
.DrawBitmap(*gs_bmpWithMask
, 0, 320, TRUE
);
905 int cx
= gs_bmpWithColMask
->GetWidth(),
906 cy
= gs_bmpWithColMask
->GetHeight();
909 for ( size_t n
= 0; n
< WXSIZEOF(rasterOperations
); n
++ )
911 wxCoord x
= 120 + 150*(n%4
),
914 dc
.DrawText(rasterOperations
[n
].name
, x
, y
- 20);
915 memDC
.SelectObject(*gs_bmpWithColMask
);
916 dc
.Blit(x
, y
, cx
, cy
, &memDC
, 0, 0, rasterOperations
[n
].rop
, TRUE
);
920 void MyCanvas::DrawWithLogicalOps(wxDC
& dc
)
922 static const wxCoord w
= 60;
923 static const wxCoord h
= 60;
925 // reuse the text colour here
926 dc
.SetPen(wxPen(m_owner
->m_colourForeground
, 1, wxSOLID
));
927 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
930 for ( n
= 0; n
< WXSIZEOF(rasterOperations
); n
++ )
932 wxCoord x
= 20 + 150*(n%4
),
935 dc
.DrawText(rasterOperations
[n
].name
, x
, y
- 20);
936 dc
.SetLogicalFunction(rasterOperations
[n
].rop
);
937 dc
.DrawRectangle(x
, y
, w
, h
);
938 dc
.DrawLine(x
, y
, x
+ w
, y
+ h
);
939 dc
.DrawLine(x
+ w
, y
, x
, y
+ h
);
942 // now some filled rectangles
943 dc
.SetBrush(wxBrush(m_owner
->m_colourForeground
, wxSOLID
));
945 for ( n
= 0; n
< WXSIZEOF(rasterOperations
); n
++ )
947 wxCoord x
= 20 + 150*(n%4
),
950 dc
.DrawText(rasterOperations
[n
].name
, x
, y
- 20);
951 dc
.SetLogicalFunction(rasterOperations
[n
].rop
);
952 dc
.DrawRectangle(x
, y
, w
, h
);
956 void MyCanvas::DrawCircles(wxDC
& dc
)
962 dc
.DrawText("Some circles", 0, y
);
963 dc
.DrawCircle(x
, y
, r
);
964 dc
.DrawCircle(x
+ 2*r
, y
, r
);
965 dc
.DrawCircle(x
+ 4*r
, y
, r
);
968 dc
.DrawText("And ellipses", 0, y
);
969 dc
.DrawEllipse(x
- r
, y
, 2*r
, r
);
970 dc
.DrawEllipse(x
+ r
, y
, 2*r
, r
);
971 dc
.DrawEllipse(x
+ 3*r
, y
, 2*r
, r
);
974 dc
.DrawText("And arcs", 0, y
);
975 dc
.DrawArc(x
- r
, y
, x
+ r
, y
, x
, y
);
976 dc
.DrawArc(x
+ 4*r
, y
, x
+ 2*r
, y
, x
+ 3*r
, y
);
977 dc
.DrawArc(x
+ 5*r
, y
, x
+ 5*r
, y
, x
+ 6*r
, y
);
980 dc
.DrawEllipticArc(x
- r
, y
, 2*r
, r
, 0, 90);
981 dc
.DrawEllipticArc(x
+ r
, y
, 2*r
, r
, 90, 180);
982 dc
.DrawEllipticArc(x
+ 3*r
, y
, 2*r
, r
, 180, 270);
983 dc
.DrawEllipticArc(x
+ 5*r
, y
, 2*r
, r
, 270, 360);
986 void MyCanvas::DrawRegions(wxDC
& dc
)
988 dc
.DrawText("You should see a red rect partly covered by a cyan one "
989 "on the left", 10, 5);
990 dc
.DrawText("and 5 smileys from which 4 are partially clipped on the "
991 "right", 10, 5 + dc
.GetCharHeight());
993 dc
.SetBrush( *wxWHITE_BRUSH
);
994 dc
.SetPen( *wxTRANSPARENT_PEN
);
995 dc
.DrawRectangle( 10,50,310,310 );
997 dc
.SetClippingRegion( 20,60,100,270 );
999 dc
.SetBrush( *wxRED_BRUSH
);
1000 dc
.DrawRectangle( 10,50,310,310 );
1002 dc
.SetClippingRegion( 20,60,100,100 );
1004 dc
.SetBrush( *wxCYAN_BRUSH
);
1005 dc
.DrawRectangle( 10,50,310,310 );
1007 dc
.DestroyClippingRegion();
1008 dc
.SetClippingRegion( 120,70,100,270 );
1010 dc
.SetBrush( *wxGREY_BRUSH
);
1011 dc
.DrawRectangle( 10,50,310,310 );
1013 if (m_smile_bmp
.Ok())
1015 dc
.DrawBitmap( m_smile_bmp
, 160, 200, TRUE
);
1016 dc
.DrawBitmap( m_smile_bmp
, 140, 60, TRUE
);
1017 dc
.DrawBitmap( m_smile_bmp
, 140, 330, TRUE
);
1018 dc
.DrawBitmap( m_smile_bmp
, 110, 120, TRUE
);
1019 dc
.DrawBitmap( m_smile_bmp
, 210, 120, TRUE
);
1023 void MyCanvas::OnPaint(wxPaintEvent
&WXUNUSED(event
))
1028 m_owner
->PrepareDC(dc
);
1030 dc
.SetBackgroundMode( m_owner
->m_backgroundMode
);
1031 if ( m_owner
->m_backgroundBrush
.Ok() )
1032 dc
.SetBackground( m_owner
->m_backgroundBrush
);
1033 if ( m_owner
->m_colourForeground
.Ok() )
1034 dc
.SetTextForeground( m_owner
->m_colourForeground
);
1035 if ( m_owner
->m_colourBackground
.Ok() )
1036 dc
.SetTextBackground( m_owner
->m_colourBackground
);
1038 if ( m_owner
->m_textureBackground
) {
1039 if ( ! m_owner
->m_backgroundBrush
.Ok() ) {
1040 wxBrush
b(wxColour(0,128,0), wxSOLID
);
1041 dc
.SetBackground(b
);
1047 if ( m_owner
->m_textureBackground
) {
1048 dc
.SetPen(*wxMEDIUM_GREY_PEN
);
1049 for (int i
=0; i
<200; i
++)
1050 dc
.DrawLine(0, i
*10, i
*10, 0);
1072 DrawTestLines( 0, 100, 0, dc
);
1073 DrawTestLines( 0, 320, 1, dc
);
1074 DrawTestLines( 0, 540, 2, dc
);
1075 DrawTestLines( 0, 760, 6, dc
);
1079 DrawTestPoly( 0, 100, dc
, 0 );
1081 DrawTestPoly( 33, 500, dc, 1 );
1082 DrawTestPoly( 43, 1000, dc, 2 );
1091 DrawWithLogicalOps(dc
);
1096 dc
.SetPen( *wxBLACK_PEN
);
1097 dc
.DrawLine( 0,0,100,100 );
1103 void MyCanvas::OnMouseMove(wxMouseEvent
&event
)
1105 wxClientDC
dc(this);
1107 m_owner
->PrepareDC(dc
);
1109 wxPoint pos
= event
.GetPosition();
1110 long x
= dc
.DeviceToLogicalX( pos
.x
);
1111 long y
= dc
.DeviceToLogicalY( pos
.y
);
1113 str
.Printf( "Current mouse position: %d,%d", (int)x
, (int)y
);
1114 m_owner
->SetStatusText( str
);
1117 // ----------------------------------------------------------------------------
1119 // ----------------------------------------------------------------------------
1121 // the event tables connect the wxWindows events with the functions (event
1122 // handlers) which process them. It can be also done at run-time, but for the
1123 // simple menu events like this the static method is much simpler.
1124 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
1125 EVT_MENU (File_Quit
, MyFrame::OnQuit
)
1126 EVT_MENU (File_About
, MyFrame::OnAbout
)
1128 EVT_MENU_RANGE(MenuShow_First
, MenuShow_Last
, MyFrame::OnShow
)
1130 EVT_MENU_RANGE(MenuOption_First
, MenuOption_Last
, MyFrame::OnOption
)
1133 // frame constructor
1134 MyFrame::MyFrame(const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
)
1135 : wxFrame((wxFrame
*)NULL
, -1, title
, pos
, size
,
1136 wxDEFAULT_FRAME_STYLE
| wxNO_FULL_REPAINT_ON_RESIZE
)
1138 // set the frame icon
1139 SetIcon(wxICON(mondrian
));
1141 wxMenu
*menuFile
= new wxMenu
;
1142 menuFile
->Append(File_ShowDefault
, "&Default screen\tF1");
1143 menuFile
->Append(File_ShowText
, "&Text screen\tF2");
1144 menuFile
->Append(File_ShowLines
, "&Lines screen\tF3");
1145 menuFile
->Append(File_ShowPolygons
, "&Polygons screen\tF4");
1146 menuFile
->Append(File_ShowMask
, "wx&Mask screen\tF5");
1147 menuFile
->Append(File_ShowOps
, "&ROP screen\tF6");
1148 menuFile
->Append(File_ShowRegions
, "Re&gions screen\tF7");
1149 menuFile
->Append(File_ShowCircles
, "&Circles screen\tF8");
1150 menuFile
->AppendSeparator();
1151 menuFile
->Append(File_About
, "&About...\tCtrl-A", "Show about dialog");
1152 menuFile
->AppendSeparator();
1153 menuFile
->Append(File_Quit
, "E&xit\tAlt-X", "Quit this program");
1155 wxMenu
*menuMapMode
= new wxMenu
;
1156 menuMapMode
->Append( MapMode_Text
, "&TEXT map mode" );
1157 menuMapMode
->Append( MapMode_Lometric
, "&LOMETRIC map mode" );
1158 menuMapMode
->Append( MapMode_Twips
, "T&WIPS map mode" );
1159 menuMapMode
->Append( MapMode_Points
, "&POINTS map mode" );
1160 menuMapMode
->Append( MapMode_Metric
, "&METRIC map mode" );
1162 wxMenu
*menuUserScale
= new wxMenu
;
1163 menuUserScale
->Append( UserScale_StretchHoriz
, "Stretch horizontally\tCtrl-H" );
1164 menuUserScale
->Append( UserScale_ShrinkHoriz
, "Shrink horizontally\tCtrl-G" );
1165 menuUserScale
->Append( UserScale_StretchVertic
, "Stretch vertically\tCtrl-V" );
1166 menuUserScale
->Append( UserScale_ShrinkVertic
, "Shrink vertically\tCtrl-W" );
1167 menuUserScale
->AppendSeparator();
1168 menuUserScale
->Append( UserScale_Restore
, "Restore to normal\tCtrl-0" );
1170 wxMenu
*menuAxis
= new wxMenu
;
1171 menuAxis
->Append( AxisMirror_Horiz
, "Mirror horizontally\tCtrl-M", "", TRUE
);
1172 menuAxis
->Append( AxisMirror_Vertic
, "Mirror vertically\tCtrl-N", "", TRUE
);
1174 wxMenu
*menuLogical
= new wxMenu
;
1175 menuLogical
->Append( LogicalOrigin_MoveDown
, "Move &down\tCtrl-D" );
1176 menuLogical
->Append( LogicalOrigin_MoveUp
, "Move &up\tCtrl-U" );
1177 menuLogical
->Append( LogicalOrigin_MoveLeft
, "Move &right\tCtrl-L" );
1178 menuLogical
->Append( LogicalOrigin_MoveRight
, "Move &left\tCtrl-R" );
1180 wxMenu
*menuColour
= new wxMenu
;
1181 menuColour
->Append( Colour_TextForeground
, "Text foreground..." );
1182 menuColour
->Append( Colour_TextBackground
, "Text background..." );
1183 menuColour
->Append( Colour_Background
, "Background colour..." );
1184 menuColour
->Append( Colour_BackgroundMode
, "Opaque/transparent\tCtrl-B", "", TRUE
);
1185 menuColour
->Append( Colour_TextureBackgound
, "Draw textured background\tCtrl-T", "", TRUE
);
1187 // now append the freshly created menu to the menu bar...
1188 wxMenuBar
*menuBar
= new wxMenuBar
;
1189 menuBar
->Append(menuFile
, "&File");
1190 menuBar
->Append(menuMapMode
, "&MapMode");
1191 menuBar
->Append(menuUserScale
, "&UserScale");
1192 menuBar
->Append(menuAxis
, "&Axis");
1193 menuBar
->Append(menuLogical
, "&LogicalOrigin");
1194 menuBar
->Append(menuColour
, "&Colours");
1196 // ... and attach this menu bar to the frame
1197 SetMenuBar(menuBar
);
1199 // create a status bar just for fun (by default with 1 pane only)
1201 SetStatusText("Welcome to wxWindows!");
1203 m_mapMode
= wxMM_TEXT
;
1206 m_xLogicalOrigin
= 0;
1207 m_yLogicalOrigin
= 0;
1209 m_yAxisReversed
= FALSE
;
1210 m_backgroundMode
= wxSOLID
;
1211 m_colourForeground
= *wxRED
;
1212 m_colourBackground
= *wxBLUE
;
1213 m_textureBackground
= FALSE
;
1215 m_canvas
= new MyCanvas( this );
1216 m_canvas
->SetScrollbars( 10, 10, 100, 240 );
1221 void MyFrame::OnQuit(wxCommandEvent
& WXUNUSED(event
))
1223 // TRUE is to force the frame to close
1227 void MyFrame::OnAbout(wxCommandEvent
& WXUNUSED(event
))
1230 msg
.Printf( wxT("This is the about dialog of the drawing sample.\n")
1231 wxT("This sample tests various primitive drawing functions\n")
1232 wxT("without any tests to prevent flicker.\n")
1233 wxT("Copyright (c) Robert Roebling 1999")
1236 wxMessageBox(msg
, "About Drawing", wxOK
| wxICON_INFORMATION
, this);
1239 void MyFrame::OnShow(wxCommandEvent
& event
)
1241 m_canvas
->Show((ScreenToShow
)(event
.GetId() - MenuShow_First
));
1244 void MyFrame::OnOption(wxCommandEvent
& event
)
1246 switch (event
.GetId())
1249 m_mapMode
= wxMM_TEXT
;
1251 case MapMode_Lometric
:
1252 m_mapMode
= wxMM_LOMETRIC
;
1255 m_mapMode
= wxMM_TWIPS
;
1257 case MapMode_Points
:
1258 m_mapMode
= wxMM_POINTS
;
1260 case MapMode_Metric
:
1261 m_mapMode
= wxMM_METRIC
;
1264 case LogicalOrigin_MoveDown
:
1265 m_yLogicalOrigin
+= 10;
1267 case LogicalOrigin_MoveUp
:
1268 m_yLogicalOrigin
-= 10;
1270 case LogicalOrigin_MoveLeft
:
1271 m_xLogicalOrigin
+= 10;
1273 case LogicalOrigin_MoveRight
:
1274 m_xLogicalOrigin
-= 10;
1277 case UserScale_StretchHoriz
:
1278 m_xUserScale
*= 1.10;
1280 case UserScale_ShrinkHoriz
:
1281 m_xUserScale
/= 1.10;
1283 case UserScale_StretchVertic
:
1284 m_yUserScale
*= 1.10;
1286 case UserScale_ShrinkVertic
:
1287 m_yUserScale
/= 1.10;
1289 case UserScale_Restore
:
1294 case AxisMirror_Vertic
:
1295 m_yAxisReversed
= !m_yAxisReversed
;
1297 case AxisMirror_Horiz
:
1298 m_xAxisReversed
= !m_xAxisReversed
;
1301 case Colour_TextForeground
:
1302 m_colourForeground
= SelectColour();
1304 case Colour_TextBackground
:
1305 m_colourBackground
= SelectColour();
1307 case Colour_Background
:
1309 wxColour col
= SelectColour();
1312 m_backgroundBrush
.SetColour(col
);
1316 case Colour_BackgroundMode
:
1317 m_backgroundMode
= m_backgroundMode
== wxSOLID
? wxTRANSPARENT
1321 case Colour_TextureBackgound
:
1322 m_textureBackground
= ! m_textureBackground
;
1330 m_canvas
->Refresh();
1333 void MyFrame::PrepareDC(wxDC
& dc
)
1335 dc
.SetMapMode( m_mapMode
);
1336 dc
.SetUserScale( m_xUserScale
, m_yUserScale
);
1337 dc
.SetLogicalOrigin( m_xLogicalOrigin
, m_yLogicalOrigin
);
1338 dc
.SetAxisOrientation( !m_xAxisReversed
, m_yAxisReversed
);
1341 wxColour
MyFrame::SelectColour()
1345 wxColourDialog
dialog(this, &data
);
1347 if ( dialog
.ShowModal() == wxID_OK
)
1349 col
= dialog
.GetColourData().GetColour();