]> git.saurik.com Git - wxWidgets.git/blob - samples/mobile/styles/styles.cpp
offset version by 1 to avoid having compatibility_version of 0.0.0 under Darwin:...
[wxWidgets.git] / samples / mobile / styles / styles.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: styles.cpp
3 // Author: Robert Roebling
4 // Created: 04/07/02
5 // Copyright:
6 /////////////////////////////////////////////////////////////////////////////
7
8 // For compilers that support precompilation
9 #include "wx/wxprec.h"
10
11 #ifdef __BORLANDC__
12 #pragma hdrstop
13 #endif
14
15 #include "wx/image.h"
16
17 // Include private headers
18 #include "styles.h"
19
20 //------------------------------------------------------------------------------
21 // MyFrame
22 //------------------------------------------------------------------------------
23
24 BEGIN_EVENT_TABLE(MyFrame,wxFrame)
25 EVT_MENU(ID_ABOUT, MyFrame::OnAbout)
26 EVT_MENU(ID_QUIT, MyFrame::OnQuit)
27 EVT_CLOSE(MyFrame::OnCloseWindow)
28 END_EVENT_TABLE()
29
30 MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
31 const wxPoint &position, const wxSize& size, long style ) :
32 wxFrame( parent, id, title, position, size, style )
33 {
34 // Create menu and status bar.
35 CreateMyMenuBar();
36 #if wxUSE_STATUSBAR
37 CreateStatusBar(1);
38 SetStatusText( _T("Welcome to Styles!") );
39 #endif // wxUSE_STATUSBAR
40
41 wxImage image;
42 image.LoadFile( _T("marble.jpg"), wxBITMAP_TYPE_JPEG );
43
44 wxBitmap bitmap( image );
45 #ifdef __WXUNIVERSAL__
46 SetBackground( bitmap, 0, wxTILE );
47 #endif
48
49 new wxStaticText( this, wxID_ANY, _T("This is text"), wxPoint( 20,50 ) );
50
51 new wxCheckBox( this, wxID_ANY, _T("This is a checkbox"), wxPoint( 20,70 ) );
52 }
53
54 void MyFrame::CreateMyMenuBar()
55 {
56 wxMenu *file_menu = new wxMenu;
57 file_menu->Append( ID_ABOUT, _T("About..."), _T("Program info") );
58 file_menu->AppendSeparator();
59 file_menu->Append( ID_QUIT, _T("Quit..."), _T("Quit program") );
60
61 wxMenuBar *menu_bar = new wxMenuBar();
62 menu_bar->Append( file_menu, _T("&File") );
63
64 SetMenuBar( menu_bar );
65 }
66
67 void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
68 {
69 }
70
71 void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
72 {
73 Close( true );
74 }
75
76 void MyFrame::OnCloseWindow( wxCloseEvent &WXUNUSED(event) )
77 {
78 Destroy();
79 }
80
81 //------------------------------------------------------------------------------
82 // MyApp
83 //------------------------------------------------------------------------------
84
85 IMPLEMENT_APP(MyApp)
86
87 bool MyApp::OnInit()
88 {
89 wxInitAllImageHandlers();
90
91 SetVendorName(_T("Free world"));
92 SetAppName(_T("Styles"));
93
94 MyFrame *frame = new MyFrame( NULL, wxID_ANY, _T("Styles"), wxPoint(20,20), wxSize(500,340) );
95 frame->Show( true );
96
97 return true;
98 }
99
100 int MyApp::OnExit()
101 {
102 return 0;
103 }
104