]> git.saurik.com Git - wxWidgets.git/blame - samples/mobile/styles/styles.cpp
compilo
[wxWidgets.git] / samples / mobile / styles / styles.cpp
CommitLineData
5ebcf581
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: styles.cpp
3// Author: Robert Roebling
4// Created: 04/07/02
925e9792 5// Copyright:
5ebcf581
RR
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
a1f9e3ec
GD
19#include "wx/image.h"
20
5ebcf581
RR
21// Include private headers
22#include "styles.h"
23
24//------------------------------------------------------------------------------
25// MyFrame
26//------------------------------------------------------------------------------
27
28BEGIN_EVENT_TABLE(MyFrame,wxFrame)
29 EVT_MENU(ID_ABOUT, MyFrame::OnAbout)
30 EVT_MENU(ID_QUIT, MyFrame::OnQuit)
31 EVT_CLOSE(MyFrame::OnCloseWindow)
32END_EVENT_TABLE()
33
34MyFrame::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();
8520f137 40#if wxUSE_STATUSBAR
5ebcf581 41 CreateStatusBar(1);
9687fdee 42 SetStatusText( _T("Welcome to Styles!") );
8520f137 43#endif // wxUSE_STATUSBAR
925e9792 44
5ebcf581 45 wxImage image;
9687fdee 46 image.LoadFile( _T("marble.jpg"), wxBITMAP_TYPE_JPEG );
925e9792 47
5ebcf581 48 wxBitmap bitmap( image );
b261fbf3 49#ifdef __WXUNIVERSAL__
5ebcf581 50 SetBackground( bitmap, 0, wxTILE );
b261fbf3 51#endif
925e9792 52
1bc53066 53 new wxStaticText( this, wxID_ANY, _T("This is text"), wxPoint( 20,50 ) );
925e9792 54
1bc53066 55 new wxCheckBox( this, wxID_ANY, _T("This is a checkbox"), wxPoint( 20,70 ) );
5ebcf581
RR
56}
57
58void MyFrame::CreateMyMenuBar()
59{
60 wxMenu *file_menu = new wxMenu;
9687fdee 61 file_menu->Append( ID_ABOUT, _T("About..."), _T("Program info") );
5ebcf581 62 file_menu->AppendSeparator();
9687fdee 63 file_menu->Append( ID_QUIT, _T("Quit..."), _T("Quit program") );
5ebcf581
RR
64
65 wxMenuBar *menu_bar = new wxMenuBar();
9687fdee 66 menu_bar->Append( file_menu, _T("&File") );
925e9792 67
5ebcf581
RR
68 SetMenuBar( menu_bar );
69}
70
256b8649 71void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
5ebcf581
RR
72{
73}
74
256b8649 75void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
5ebcf581 76{
1bc53066 77 Close( true );
5ebcf581
RR
78}
79
256b8649 80void MyFrame::OnCloseWindow( wxCloseEvent &WXUNUSED(event) )
5ebcf581
RR
81{
82 Destroy();
83}
84
85//------------------------------------------------------------------------------
86// MyApp
87//------------------------------------------------------------------------------
88
89IMPLEMENT_APP(MyApp)
90
5ebcf581
RR
91bool MyApp::OnInit()
92{
93 wxInitAllImageHandlers();
94
9687fdee
JS
95 SetVendorName(_T("Free world"));
96 SetAppName(_T("Styles"));
925e9792 97
1bc53066
WS
98 MyFrame *frame = new MyFrame( NULL, wxID_ANY, _T("Styles"), wxPoint(20,20), wxSize(500,340) );
99 frame->Show( true );
925e9792 100
1bc53066 101 return true;
5ebcf581
RR
102}
103
104int MyApp::OnExit()
105{
106 return 0;
107}
108