// ----------------------------------------------------------------------------
// the application icon
-#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXMAC__) || defined(__WXMGL__) || defined(__WXX11__)
- #include "mondrian.xpm"
+#if !defined(__WXMSW__) && !defined(__WXPM__)
+ #include "../sample.xpm"
#endif
// ----------------------------------------------------------------------------
MyFrame *frame = new MyFrame(wxT("Drawing sample"),
wxDefaultPosition, wxSize(550, 840));
- // Show it and tell the application that it's our main window
+ // Show it
frame->Show(true);
- SetTopWindow(frame);
if ( !LoadImages() )
{
void MyApp::DeleteBitmaps()
{
- delete gs_bmpNoMask;
- delete gs_bmpWithColMask;
- delete gs_bmpMask;
- delete gs_bmpWithMask;
- delete gs_bmp4;
- delete gs_bmp4_mono;
- delete gs_bmp36;
-
- gs_bmpNoMask = NULL;
- gs_bmpWithColMask = NULL;
- gs_bmpMask = NULL;
- gs_bmpWithMask = NULL;
- gs_bmp4 = NULL;
- gs_bmp4_mono = NULL;
- gs_bmp36 = NULL;
+ wxDELETE(gs_bmpNoMask);
+ wxDELETE(gs_bmpWithColMask);
+ wxDELETE(gs_bmpMask);
+ wxDELETE(gs_bmpWithMask);
+ wxDELETE(gs_bmp4);
+ wxDELETE(gs_bmp4_mono);
+ wxDELETE(gs_bmp36);
}
// ----------------------------------------------------------------------------
y += HEIGHT;
dc.SetBrush(wxBrush(*wxRED, wxCROSSDIAG_HATCH));
dc.DrawRectangle(x, y, WIDTH, HEIGHT);
- dc.DrawText(wxT("Hatched red"), x + 10, y + 10);
+ dc.DrawText(wxT("Diagonally hatched red"), x + 10, y + 10);
+
+ y += HEIGHT;
+ dc.SetBrush(wxBrush(*wxBLUE, wxCROSS_HATCH));
+ dc.DrawRectangle(x, y, WIDTH, HEIGHT);
+ dc.DrawText(wxT("Cross hatched blue"), x + 10, y + 10);
+
+ y += HEIGHT;
+ dc.SetBrush(wxBrush(*wxCYAN, wxVERTICAL_HATCH));
+ dc.DrawRectangle(x, y, WIDTH, HEIGHT);
+ dc.DrawText(wxT("Vertically hatched cyan"), x + 10, y + 10);
+
+ y += HEIGHT;
+ dc.SetBrush(wxBrush(*wxBLACK, wxHORIZONTAL_HATCH));
+ dc.DrawRectangle(x, y, WIDTH, HEIGHT);
+ dc.DrawText(wxT("Horizontally hatched black"), x + 10, y + 10);
y += HEIGHT;
dc.SetBrush(wxBrush(*gs_bmpMask));
wxCoord height;
wxCoord descent;
dc.GetTextExtent( wxT("This is Swiss 18pt text."), &length, &height, &descent );
- text.Printf( wxT("Dimensions are length %ld, height %ld, descent %ld"), length, height, descent );
+ text.Printf( wxT("Dimensions are length %d, height %d, descent %d"), length, height, descent );
dc.DrawText( text, 110, 80 );
text.Printf( wxT("CharHeight() returns: %d"), dc.GetCharHeight() );
y += height;
dc.DrawRectangle( 110, y, 100, height );
dc.DrawText( wxT("Another visible text"), 110, y );
+
+ y += height;
+ dc.DrawText("And\nmore\ntext on\nmultiple\nlines", 110, y);
}
static const struct
m_overlay.Reset();
m_rubberBand = false;
- int x,y,xx,yy ;
- event.GetPosition(&x,&y);
- CalcUnscrolledPosition( x, y, &xx, &yy );
-
- wxString str;
- str.Printf( wxT("Rectangle selection from %d,%d to %d,%d"),
- m_anchorpoint.x, m_anchorpoint.y , (int)xx, (int)yy );
- wxMessageBox( str , wxT("Rubber-Banding") );
+ wxPoint endpoint = CalcUnscrolledPosition(event.GetPosition());
+ // Don't pop up the message box if nothing was actually selected.
+ if ( endpoint != m_anchorpoint )
+ {
+ wxLogMessage("Selected rectangle from (%d, %d) to (%d, %d)",
+ m_anchorpoint.x, m_anchorpoint.y,
+ endpoint.x, endpoint.y);
+ }
}
}
wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE)
{
// set the frame icon
- SetIcon(wxICON(mondrian));
+ SetIcon(wxICON(sample));
wxMenu *menuFile = new wxMenu;
menuFile->Append(File_ShowDefault, wxT("&Default screen\tF1"));