CreateMyMenuBar();
CreateStatusBar(1);
- SetStatusText( "Welcome!" );
+ SetStatusText( "Welcome to wxCanvas sample!" );
SetIcon(wxICON(mondrian));
- // wxCanvas from here
-
+ // Create wxCanvasAdmin and wxCanvas.
m_admin = new wxCanvasAdmin;
wxCanvas *canvas = new wxCanvas( m_admin, this, -1 );
+
+ canvas->SetScrollbars( 10, 10, 40, 40 );
+
+ // The wxCanvasAdmin need to know about all Admin wxCanvas objects.
m_admin->Append( canvas );
+
+ // One wxCanvas is the active one (current rendering and current
+ // world coordinates).
m_admin->SetActive( canvas );
-
+ // One object group is the root in every canvas.
wxCanvasObjectGroup *root = new wxCanvasObjectGroup(0,0);
root->DeleteContents( TRUE );
- wxCanvasRect *rect;
-
- rect = new wxCanvasRect( 120,10,120,140 );
- rect->SetBrush( *wxRED_BRUSH );
- root->Append( rect );
-
-/*
+ // Bunch of rects and images.
wxBitmap bitmap( smile_xpm );
wxImage image( bitmap );
m_smile1 = new wxCanvasImage( image, 0,70,32,32 );
root->Append( m_smile1 );
+ wxCanvasRect *rect = new wxCanvasRect( 20,20,100,100 );
+ rect->SetBrush( *wxRED_BRUSH );
+ root->Append( rect );
+
+/*
int i;
for (i = 10; i < 300; i+=10)
{
r->SetBrush( *wxRED_BRUSH );
root->Append( r );
}
+*/
m_smile2 = new wxCanvasImage( image, 0,110,32,32 );
root->Append( m_smile2 );
+/*
for (i = 15; i < 300; i+=10)
{
wxCanvasRect *r = new wxCanvasRect( i,50,3,140 );
}
*/
+ // This will call all object and children recursivly so
+ // all know what their wxCanvasAdmin is. Call at the end.
+ root->SetAdmin( m_admin );
+
+ // One object group is the root object.
canvas->SetRoot( root );
}