]>
Commit | Line | Data |
---|---|---|
5ebcf581 RR |
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 | ||
a1f9e3ec GD |
19 | #include "wx/image.h" |
20 | ||
5ebcf581 RR |
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); | |
9687fdee | 41 | SetStatusText( _T("Welcome to Styles!") ); |
5ebcf581 | 42 | |
5ebcf581 | 43 | wxImage image; |
9687fdee | 44 | image.LoadFile( _T("marble.jpg"), wxBITMAP_TYPE_JPEG ); |
5ebcf581 RR |
45 | |
46 | wxBitmap bitmap( image ); | |
b261fbf3 | 47 | #ifdef __WXUNIVERSAL__ |
5ebcf581 | 48 | SetBackground( bitmap, 0, wxTILE ); |
b261fbf3 | 49 | #endif |
5ebcf581 | 50 | |
9687fdee | 51 | new wxStaticText( this, -1, _T("This is text"), wxPoint( 20,50 ) ); |
5ebcf581 | 52 | |
9687fdee | 53 | new wxCheckBox( this, -1, _T("This is a checkbox"), wxPoint( 20,70 ) ); |
5ebcf581 RR |
54 | } |
55 | ||
56 | void MyFrame::CreateMyMenuBar() | |
57 | { | |
58 | wxMenu *file_menu = new wxMenu; | |
9687fdee | 59 | file_menu->Append( ID_ABOUT, _T("About..."), _T("Program info") ); |
5ebcf581 | 60 | file_menu->AppendSeparator(); |
9687fdee | 61 | file_menu->Append( ID_QUIT, _T("Quit..."), _T("Quit program") ); |
5ebcf581 RR |
62 | |
63 | wxMenuBar *menu_bar = new wxMenuBar(); | |
9687fdee | 64 | menu_bar->Append( file_menu, _T("&File") ); |
5ebcf581 RR |
65 | |
66 | SetMenuBar( menu_bar ); | |
67 | } | |
68 | ||
256b8649 | 69 | void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) ) |
5ebcf581 RR |
70 | { |
71 | } | |
72 | ||
256b8649 | 73 | void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) ) |
5ebcf581 RR |
74 | { |
75 | Close( TRUE ); | |
76 | } | |
77 | ||
256b8649 | 78 | void MyFrame::OnCloseWindow( wxCloseEvent &WXUNUSED(event) ) |
5ebcf581 RR |
79 | { |
80 | Destroy(); | |
81 | } | |
82 | ||
83 | //------------------------------------------------------------------------------ | |
84 | // MyApp | |
85 | //------------------------------------------------------------------------------ | |
86 | ||
87 | IMPLEMENT_APP(MyApp) | |
88 | ||
89 | MyApp::MyApp() | |
90 | { | |
91 | } | |
92 | ||
93 | bool MyApp::OnInit() | |
94 | { | |
95 | wxInitAllImageHandlers(); | |
96 | ||
9687fdee JS |
97 | SetVendorName(_T("Free world")); |
98 | SetAppName(_T("Styles")); | |
5ebcf581 | 99 | |
9687fdee | 100 | MyFrame *frame = new MyFrame( NULL, -1, _T("Styles"), wxPoint(20,20), wxSize(500,340) ); |
5ebcf581 RR |
101 | frame->Show( TRUE ); |
102 | ||
103 | return TRUE; | |
104 | } | |
105 | ||
106 | int MyApp::OnExit() | |
107 | { | |
108 | return 0; | |
109 | } | |
110 |