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