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