]>
Commit | Line | Data |
---|---|---|
5ebcf581 RR |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: styles.cpp | |
3 | // Author: Robert Roebling | |
4 | // Created: 04/07/02 | |
925e9792 | 5 | // Copyright: |
5ebcf581 RR |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
5ebcf581 RR |
8 | // For compilers that support precompilation |
9 | #include "wx/wxprec.h" | |
10 | ||
11 | #ifdef __BORLANDC__ | |
12 | #pragma hdrstop | |
13 | #endif | |
14 | ||
a1f9e3ec GD |
15 | #include "wx/image.h" |
16 | ||
5ebcf581 RR |
17 | // Include private headers |
18 | #include "styles.h" | |
19 | ||
197ab43d FM |
20 | #ifndef __WXMSW__ |
21 | #include "../../sample.xpm" | |
22 | #endif | |
23 | ||
5ebcf581 RR |
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 | { | |
197ab43d FM |
38 | SetIcon(wxICON(sample)); |
39 | ||
5ebcf581 RR |
40 | // Create menu and status bar. |
41 | CreateMyMenuBar(); | |
8520f137 | 42 | #if wxUSE_STATUSBAR |
5ebcf581 | 43 | CreateStatusBar(1); |
9687fdee | 44 | SetStatusText( _T("Welcome to Styles!") ); |
8520f137 | 45 | #endif // wxUSE_STATUSBAR |
925e9792 | 46 | |
5ebcf581 | 47 | wxImage image; |
9687fdee | 48 | image.LoadFile( _T("marble.jpg"), wxBITMAP_TYPE_JPEG ); |
925e9792 | 49 | |
5ebcf581 | 50 | wxBitmap bitmap( image ); |
b261fbf3 | 51 | #ifdef __WXUNIVERSAL__ |
5ebcf581 | 52 | SetBackground( bitmap, 0, wxTILE ); |
b261fbf3 | 53 | #endif |
925e9792 | 54 | |
1bc53066 | 55 | new wxStaticText( this, wxID_ANY, _T("This is text"), wxPoint( 20,50 ) ); |
925e9792 | 56 | |
1bc53066 | 57 | new wxCheckBox( this, wxID_ANY, _T("This is a checkbox"), wxPoint( 20,70 ) ); |
5ebcf581 RR |
58 | } |
59 | ||
60 | void MyFrame::CreateMyMenuBar() | |
61 | { | |
62 | wxMenu *file_menu = new wxMenu; | |
9687fdee | 63 | file_menu->Append( ID_ABOUT, _T("About..."), _T("Program info") ); |
5ebcf581 | 64 | file_menu->AppendSeparator(); |
9687fdee | 65 | file_menu->Append( ID_QUIT, _T("Quit..."), _T("Quit program") ); |
5ebcf581 RR |
66 | |
67 | wxMenuBar *menu_bar = new wxMenuBar(); | |
9687fdee | 68 | menu_bar->Append( file_menu, _T("&File") ); |
925e9792 | 69 | |
5ebcf581 RR |
70 | SetMenuBar( menu_bar ); |
71 | } | |
72 | ||
256b8649 | 73 | void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) ) |
5ebcf581 RR |
74 | { |
75 | } | |
76 | ||
256b8649 | 77 | void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) ) |
5ebcf581 | 78 | { |
1bc53066 | 79 | Close( true ); |
5ebcf581 RR |
80 | } |
81 | ||
256b8649 | 82 | void MyFrame::OnCloseWindow( wxCloseEvent &WXUNUSED(event) ) |
5ebcf581 RR |
83 | { |
84 | Destroy(); | |
85 | } | |
86 | ||
87 | //------------------------------------------------------------------------------ | |
88 | // MyApp | |
89 | //------------------------------------------------------------------------------ | |
90 | ||
91 | IMPLEMENT_APP(MyApp) | |
92 | ||
5ebcf581 RR |
93 | bool MyApp::OnInit() |
94 | { | |
45e6e6f8 VZ |
95 | if ( !wxApp::OnInit() ) |
96 | return false; | |
97 | ||
5ebcf581 RR |
98 | wxInitAllImageHandlers(); |
99 | ||
9687fdee JS |
100 | SetVendorName(_T("Free world")); |
101 | SetAppName(_T("Styles")); | |
925e9792 | 102 | |
1bc53066 WS |
103 | MyFrame *frame = new MyFrame( NULL, wxID_ANY, _T("Styles"), wxPoint(20,20), wxSize(500,340) ); |
104 | frame->Show( true ); | |
925e9792 | 105 | |
1bc53066 | 106 | return true; |
5ebcf581 RR |
107 | } |
108 | ||
109 | int MyApp::OnExit() | |
110 | { | |
111 | return 0; | |
112 | } | |
113 |