X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6bcfd974ef26faf6f91a62cac09827e09463fd1..65baafba0e8cd74f2264b7e2f7625ff5bea84864:/docs/latex/wx/hworld.tex?ds=sidebyside diff --git a/docs/latex/wx/hworld.tex b/docs/latex/wx/hworld.tex index 13ef9285db..29e595f396 100644 --- a/docs/latex/wx/hworld.tex +++ b/docs/latex/wx/hworld.tex @@ -1,11 +1,11 @@ -\section{wxWindows "Hello World"}\label{helloworld} +\section{wxWidgets Hello World sample}\label{helloworld} As many people have requested a mini-sample to be published here -so that some quick judgments concerning syntax -and basic principles can be made, you can now look at wxWindows' +so that some quick judgment concerning syntax +and basic principles can be made, you can now look at wxWidgets' "Hello World": -You have to include wxWindows' header files, of course. This can +You have to include wxWidgets' header files, of course. This can be done on a file by file basis (such as \#include "wx/window.h") or using one global include (\#include "wx/wx.h"). This is also useful on platforms which support precompiled headers such @@ -15,7 +15,7 @@ as all major compilers on the Windows platform. // // file name: hworld.cpp // -// purpose: wxWindows "Hello world" +// purpose: wxWidgets "Hello world" // // For compilers that support precompilation, includes "wx/wx.h". @@ -94,7 +94,7 @@ BEGIN_EVENT_TABLE(MyFrame, wxFrame) END_EVENT_TABLE() \end{verbatim} -As in all programs there must be a "main" function. Under wxWindows main is implemented +As in all programs there must be a "main" function. Under wxWidgets main is implemented using this macro, which creates an application instance and starts the program. \begin{verbatim} @@ -105,15 +105,15 @@ As mentioned above, wxApp::OnInit() is called upon startup and should be used to initialize the program, maybe showing a "splash screen" and creating the main window (or several). The frame should get a title bar text ("Hello World") and a position and start-up size. One frame can also be declared to be the -top window. Returning TRUE indicates a successful initialization. +top window. Returning true indicates a successful initialization. \begin{verbatim} bool MyApp::OnInit() { MyFrame *frame = new MyFrame( "Hello World", wxPoint(50,50), wxSize(450,340) ); - frame->Show( TRUE ); + frame->Show( true ); SetTopWindow( frame ); - return TRUE; + return true; } \end{verbatim} @@ -137,19 +137,19 @@ MyFrame::MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size) SetMenuBar( menuBar ); CreateStatusBar(); - SetStatusText( "Welcome to wxWindows!" ); + SetStatusText( "Welcome to wxWidgets!" ); } \end{verbatim} Here are the actual event handlers. MyFrame::OnQuit() closes the main window -by calling Close(). The parameter TRUE indicates that other windows have no veto +by calling Close(). The parameter true indicates that other windows have no veto power such as after asking "Do you really want to close?". If there is no other main window left, the application will quit. \begin{verbatim} void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { - Close( TRUE ); + Close( true ); } \end{verbatim} @@ -159,7 +159,7 @@ case a typical "About" window with information about the program. \begin{verbatim} void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { - wxMessageBox( "This is a wxWindows' Hello world sample", + wxMessageBox( "This is a wxWidgets' Hello world sample", "About Hello World", wxOK | wxICON_INFORMATION ); } \end{verbatim}