Skip to content
Newer
Older
100644 39 lines (30 sloc) 1 KB
67fc4ff @jmlynesjr Initial Commit
authored Sep 27, 2012
1 #!/usr/bin/perl
2
3 # CppTrial-pg159B.pl
4 # Cross-Platform GUI Programming with wxWidgets - Smart, Hock, & Csomor
5 # C++ Example from pg 159B - Logical Functions - Extends pg 135 example
6 # C++ Example from pg 135 - Drawing on Windows with wxPaintDC
7 # Ported to wxPerl by James M. Lynes Jr. - Last Modified 9/24/2012
8
9 use 5.010;
10 use strict;
11 use warnings;
12 use Wx qw(:everything);
13 use Wx::Event qw(:everything);
14
15 # create the WxApplication
16 my $app = Wx::SimpleApp->new;
17 my $frame = Wx::Frame->new(undef, -1,
18 'CppTrial-pg159B.pl',
19 wxDefaultPosition, wxDefaultSize);
20 EVT_MOTION($frame,\&OnMotion,);
21 $frame->Show;
22 $app->MainLoop;
23
24 # Example specific code
25 sub OnMotion {
26 my ( $self, $event) = @_;
27
28 my $dc = Wx::PaintDC->new($self);
29
30 my $pen = Wx::Pen->new(wxBLACK,1,wxSOLID);
31 $dc->SetPen($pen);
32 my $brush=Wx::Brush->new(wxRED,wxSOLID);
33 $dc->SetBrush($brush);
34
35 $dc->SetLogicalFunction(wxINVERT); # Invert Pixels
36 $dc->DrawCircle(200, 200, 50); # Circle appears and erases as mouse moves
37
38 }
Something went wrong with that request. Please try again.