]> git.saurik.com Git - wxWidgets.git/blame - samples/wxtest/test.cpp
added IsVisible() test
[wxWidgets.git] / samples / wxtest / test.cpp
CommitLineData
c5e4ef4e
RR
1/////////////////////////////////////////////////////////////////////////////
2// Name: test.cpp
3// Author: XX
4// Created: XX/XX/XX
5// Copyright:
6/////////////////////////////////////////////////////////////////////////////
7
8#ifdef __GNUG__
9 #pragma implementation "test.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 "test.h"
21
22// WDR: class implementations
23
24//----------------------------------------------------------------------------
25// MyDialog
26//----------------------------------------------------------------------------
27
28// WDR: event table for MyDialog
29
30BEGIN_EVENT_TABLE(MyDialog,wxDialog)
31END_EVENT_TABLE()
32
33MyDialog::MyDialog( wxWindow *parent, wxWindowID id, const wxString &title,
34 const wxPoint &position, const wxSize& size, long style ) :
35 wxDialog( parent, id, title, position, size, style|wxRESIZE_BORDER )
36{
37 MyDialogFunc( this, TRUE );
38
39 CentreOnParent();
40}
41
42bool MyDialog::Validate()
43{
44 return TRUE;
45}
46
47bool MyDialog::TransferDataToWindow()
48{
49 return TRUE;
50}
51
52bool MyDialog::TransferDataFromWindow()
53{
54 return TRUE;
55}
56
57// WDR: handler implementations for MyDialog
58
59
60//------------------------------------------------------------------------------
61// MyFrame
62//------------------------------------------------------------------------------
63
64// WDR: event table for MyFrame
65
66BEGIN_EVENT_TABLE(MyFrame,wxFrame)
67 EVT_MENU(ID_ABOUT, MyFrame::OnAbout)
68 EVT_MENU(ID_QUIT, MyFrame::OnQuit)
69 EVT_CLOSE(MyFrame::OnCloseWindow)
70 EVT_MENU( ID_TEST, MyFrame::OnTest )
71END_EVENT_TABLE()
72
73MyFrame::MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
74 const wxPoint &position, const wxSize& size, long style ) :
75 wxFrame( parent, id, title, position, size, style )
76{
77 CreateMyMenuBar();
78
79 CreateStatusBar(1);
87728739 80 SetStatusText( _T("Welcome!") );
c5e4ef4e
RR
81
82 // insert main window here
83}
84
85void MyFrame::CreateMyMenuBar()
86{
87#ifdef __WXMAC__
88 wxApp::s_macAboutMenuItemId = ID_ABOUT;
89#endif
90
91 SetMenuBar( MyMenuBarFunc() );
92}
93
94// WDR: handler implementations for MyFrame
95
87728739 96void MyFrame::OnTest( wxCommandEvent &WXUNUSED(event) )
c5e4ef4e 97{
87728739 98 MyDialog dialog( this, -1, _T("Test") );
c5e4ef4e
RR
99 dialog.ShowModal();
100}
101
87728739 102void MyFrame::OnAbout( wxCommandEvent &WXUNUSED(event) )
c5e4ef4e 103{
87728739
MB
104 wxMessageDialog dialog( this, _T("Welcome to SuperApp 1.0\n(C)opyright Joe Hacker"),
105 _T("About SuperApp"), wxOK|wxICON_INFORMATION );
c5e4ef4e
RR
106 dialog.ShowModal();
107}
108
87728739 109void MyFrame::OnQuit( wxCommandEvent &WXUNUSED(event) )
c5e4ef4e
RR
110{
111 Close( TRUE );
112}
113
87728739 114void MyFrame::OnCloseWindow( wxCloseEvent &WXUNUSED(event) )
c5e4ef4e
RR
115{
116 // if ! saved changes -> return
117
118 Destroy();
119}
120
121//------------------------------------------------------------------------------
122// MyApp
123//------------------------------------------------------------------------------
124
125IMPLEMENT_APP(MyApp)
126
127MyApp::MyApp()
128{
129}
130
131bool MyApp::OnInit()
132{
87728739 133 MyFrame *frame = new MyFrame( NULL, -1, _T("SuperApp"), wxPoint(20,20), wxSize(500,340) );
c5e4ef4e
RR
134 frame->Show( TRUE );
135
136 return TRUE;
137}
138
139int MyApp::OnExit()
140{
141 return 0;
142}
143