]>
git.saurik.com Git - wxWidgets.git/blob - mobile/wxedit/wxedit.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Author: Robert Roebling
6 /////////////////////////////////////////////////////////////////////////////
9 #pragma implementation "wxedit.cpp"
12 // For compilers that support precompilation
13 #include "wx/wxprec.h"
19 // Include private headers
22 //------------------------------------------------------------------------------
24 //------------------------------------------------------------------------------
26 BEGIN_EVENT_TABLE(MyFrame
,wxFrame
)
27 EVT_MENU(ID_ABOUT
, MyFrame::OnAbout
)
28 EVT_MENU(ID_NEW
, MyFrame::OnNew
)
29 EVT_MENU(ID_OPEN
, MyFrame::OnOpen
)
30 EVT_MENU(ID_SAVE
, MyFrame::OnSave
)
31 EVT_MENU(ID_SAVEAS
, MyFrame::OnSaveAs
)
32 EVT_MENU(ID_QUIT
, MyFrame::OnQuit
)
33 EVT_CLOSE(MyFrame::OnCloseWindow
)
36 MyFrame::MyFrame( wxWindow
*parent
, wxWindowID id
, const wxString
&title
,
37 const wxPoint
&position
, const wxSize
& size
, long style
) :
38 wxFrame( parent
, id
, title
, position
, size
, style
)
43 SetStatusText( "Welcome!" );
45 m_text
= new wxTextCtrl( this, -1, "", wxDefaultPosition
, wxDefaultSize
, wxTE_MULTILINE
);
48 void MyFrame::CreateMyMenuBar()
50 wxMenu
*file_menu
= new wxMenu
;
51 file_menu
->Append( ID_ABOUT
, "About...", "Program info" );
52 file_menu
->AppendSeparator();
53 file_menu
->Append( ID_NEW
, "New...", "New text" );
54 file_menu
->Append( ID_OPEN
, "Open...", "Open text" );
55 file_menu
->Append( ID_SAVE
, "Save", "Save text" );
56 file_menu
->Append( ID_SAVEAS
, "Save as...", "Save text as..." );
57 file_menu
->AppendSeparator();
58 file_menu
->Append( ID_QUIT
, "Quit...", "Quit program" );
60 wxMenuBar
*menu_bar
= new wxMenuBar();
61 menu_bar
->Append( file_menu
, "File" );
63 SetMenuBar( menu_bar
);
66 void MyFrame::OnNew( wxCommandEvent
&event
)
71 void MyFrame::OnOpen( wxCommandEvent
&event
)
73 wxFileDialog
dialog( this, "Open text", "", "",
74 "Text file (*.txt)|*.txt|"
76 wxOPEN
|wxFILE_MUST_EXIST
);
80 void MyFrame::OnSave( wxCommandEvent
&event
)
84 void MyFrame::OnSaveAs( wxCommandEvent
&event
)
88 void MyFrame::OnAbout( wxCommandEvent
&event
)
90 wxMessageDialog
dialog( this, "Welcome to SuperApp 1.0\n(C)opyright Joe Hacker",
91 "About SuperApp", wxOK
|wxICON_INFORMATION
);
95 void MyFrame::OnQuit( wxCommandEvent
&event
)
100 void MyFrame::OnCloseWindow( wxCloseEvent
&event
)
102 // if ! saved changes -> return
107 //------------------------------------------------------------------------------
109 //------------------------------------------------------------------------------
119 MyFrame
*frame
= new MyFrame( NULL
, -1, "SuperApp", wxPoint(20,20), wxSize(500,340) );