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