File: overview_helloworld.html

package info (click to toggle)
wxpython3.0 3.0.2.0%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 482,760 kB
  • ctags: 518,293
  • sloc: cpp: 2,127,226; python: 294,045; makefile: 51,942; ansic: 19,033; sh: 3,013; xml: 1,629; perl: 17
file content (240 lines) | stat: -rw-r--r-- 31,050 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wxWidgets: Hello World Example</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="page_container">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" style="width: 100%;">
 <tbody>
 <tr>
  <td id="projectlogo">
    <a href="http://www.wxwidgets.org/" target="_new">
      <img alt="wxWidgets" src="logo.png"/>
    </a>
  </td>
  <td style="padding-left: 0.5em; text-align: right;">
   <span id="projectnumber">Version: 3.0.2</span>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.2 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li class="current"><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Categories</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="index.html">Documentation</a></li><li class="navelem"><a class="el" href="page_topics.html">Programming Guides</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Hello World Example </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>This page shows a very simple wxWidgets program that can be used as a skeleton for your own code.</p>
<p>While it does nothing very useful, it introduces a couple of important concepts and explains how to write a working wxWidgets application.</p>
<p>First, you have to include wxWidgets' header files, of course. This can be done on a file by file basis (such as <code><a class="el" href="window_8h.html">wx/window.h</a></code>) or using one global include (<code>wx/wx.h</code>) which includes most of the commonly needed headers (although not all of them as there are simply too many wxWidgets headers to pull in all of them). For the platforms with support for precompiled headers, as indicated by <code>WX_PRECOMP</code>, this global header is already included by <code>wx/wxprec.h</code> so we only include it for the other ones:</p>
<div class="fragment"><div class="line"><span class="comment">// wxWidgets &quot;Hello world&quot; Program</span></div>
<div class="line"></div>
<div class="line"><span class="comment">// For compilers that support precompilation, includes &quot;wx/wx.h&quot;.</span></div>
<div class="line"><span class="preprocessor">#include &lt;wx/wxprec.h&gt;</span></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#ifndef WX_PRECOMP</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">    #include &lt;wx/wx.h&gt;</span></div>
<div class="line"><span class="preprocessor">#endif</span></div>
</div><!-- fragment --><p>Practically every app should define a new class derived from <a class="el" href="classwx_app.html" title="The wxApp class represents the application itself when wxUSE_GUI=1.">wxApp</a>. By overriding <a class="el" href="classwx_app.html" title="The wxApp class represents the application itself when wxUSE_GUI=1.">wxApp</a>'s OnInit() virtual method the program can be initialized, e.g. by creating a new main window.</p>
<div class="fragment"><div class="line"><span class="keyword">class </span>MyApp: <span class="keyword">public</span> <a class="code" href="classwx_app.html" title="The wxApp class represents the application itself when wxUSE_GUI=1.">wxApp</a></div>
<div class="line">{</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line">    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classwx_app_console.html#a99953775a2fd83fa2456e390779afe15" title="This must be provided by the application, and will usually create the application&#39;s main window...">OnInit</a>();</div>
<div class="line">};</div>
</div><!-- fragment --><p>The main window is created by deriving a class from <a class="el" href="classwx_frame.html" title="A frame is a window whose size and position can (usually) be changed by the user.">wxFrame</a> and giving it a menu and a status bar in its constructor. Also, any class that wishes to respond to any "event" (such as mouse clicks or messages from the menu or a button) must declare an event table using the macro below.</p>
<p>Finally, the way to react to such events must be done in "handlers". In our sample, we react to three menu items, one for our custom menu command and two for the standard "Exit" and "About" commands (any program should normally implement the latter two). Notice that these handlers don't need to be neither virtual nor public.</p>
<div class="fragment"><div class="line"><span class="keyword">class </span>MyFrame: <span class="keyword">public</span> <a class="code" href="classwx_frame.html" title="A frame is a window whose size and position can (usually) be changed by the user.">wxFrame</a></div>
<div class="line">{</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line">    MyFrame(<span class="keyword">const</span> <a class="code" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a>&amp; title, <span class="keyword">const</span> <a class="code" href="classwx_point.html" title="A wxPoint is a useful data structure for graphics operations.">wxPoint</a>&amp; pos, <span class="keyword">const</span> <a class="code" href="classwx_size.html" title="A wxSize is a useful data structure for graphics operations.">wxSize</a>&amp; size);</div>
<div class="line"></div>
<div class="line"><span class="keyword">private</span>:</div>
<div class="line">    <span class="keywordtype">void</span> OnHello(<a class="code" href="classwx_command_event.html" title="This event class contains information about command events, which originate from a variety of simple ...">wxCommandEvent</a>&amp; event);</div>
<div class="line">    <span class="keywordtype">void</span> OnExit(<a class="code" href="classwx_command_event.html" title="This event class contains information about command events, which originate from a variety of simple ...">wxCommandEvent</a>&amp; event);</div>
<div class="line">    <span class="keywordtype">void</span> OnAbout(<a class="code" href="classwx_command_event.html" title="This event class contains information about command events, which originate from a variety of simple ...">wxCommandEvent</a>&amp; event);</div>
<div class="line"></div>
<div class="line">    <a class="code" href="group__group__funcmacro__events.html#gab6eca03fad44ec10b75d3cb82e9219e3" title="Use this macro inside a class declaration to declare a static event table for that class...">wxDECLARE_EVENT_TABLE</a>();</div>
<div class="line">};</div>
</div><!-- fragment --><p>In order to be able to react to a menu command, it must be given a unique identifier which can be defined as a const variable or an enum element. The latter is often used because typically many such constants will be needed:</p>
<div class="fragment"><div class="line"><span class="keyword">enum</span></div>
<div class="line">{</div>
<div class="line">    ID_Hello = 1</div>
<div class="line">};</div>
</div><!-- fragment --><p>Notice that you don't need to define identifiers for the "About" and "Exit". We then proceed to actually implement an event table in which the events are routed to their respective handler functions in the class MyFrame.</p>
<p>There are predefined macros for routing all common events, ranging from the selection of a list box entry to a resize event when a user resizes a window on the screen. If <code>wxID_ANY</code> is given as the ID, the given handler will be invoked for any event of the specified type, so that you could add just one entry in the event table for all menu commands or all button commands etc.</p>
<p>The origin of the event can still be distinguished in the event handler as the (only) parameter in an event handler is a reference to a <a class="el" href="classwx_event.html" title="An event is a structure holding information about an event passed to a callback or member function...">wxEvent</a> object, which holds various information about the event (such as the ID of and a pointer to the class, which emitted the event).</p>
<div class="fragment"><div class="line"><a class="code" href="group__group__funcmacro__events.html#ga736930efaab4d7e445e9e8e520c7b74d" title="Use this macro in a source file to start listing static event handlers for a specific class...">wxBEGIN_EVENT_TABLE</a>(MyFrame, <a class="code" href="classwx_frame.html" title="A frame is a window whose size and position can (usually) be changed by the user.">wxFrame</a>)</div>
<div class="line">    EVT_MENU(ID_Hello,   MyFrame::OnHello)</div>
<div class="line">    EVT_MENU(wxID_EXIT,  MyFrame::OnExit)</div>
<div class="line">    EVT_MENU(<a class="code" href="defs_8h.html#ac66d0a09761e7d86b2ac0b2e0c6a8cbba777a4075af4d1bfbbdb6ecfeaa9e8957">wxID_ABOUT</a>, MyFrame::OnAbout)</div>
<div class="line"><a class="code" href="group__group__funcmacro__events.html#ga383fad2a46e1d6c220fbe03ecfbc9c17" title="Use this macro in a source file to end listing static event handlers for a specific class...">wxEND_EVENT_TABLE</a>()</div>
</div><!-- fragment --><p>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.</p>
<div class="fragment"><div class="line"><a class="code" href="group__group__funcmacro__rtti.html#ga967aafaa261481fe2d2e1cf599e3e003" title="This is used in the application class implementation file to make the application class known to wxWi...">wxIMPLEMENT_APP</a>(MyApp)</div>
</div><!-- fragment --><p>As mentioned above, <a class="el" href="classwx_app_console.html#a99953775a2fd83fa2456e390779afe15" title="This must be provided by the application, and will usually create the application&#39;s main window...">wxApp::OnInit()</a> 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 <span class="literal">true</span> indicates a successful initialization.</p>
<div class="fragment"><div class="line"><span class="keywordtype">bool</span> MyApp::OnInit()</div>
<div class="line">{</div>
<div class="line">    MyFrame *frame = <span class="keyword">new</span> MyFrame( <span class="stringliteral">&quot;Hello World&quot;</span>, <a class="code" href="classwx_point.html" title="A wxPoint is a useful data structure for graphics operations.">wxPoint</a>(50, 50), <a class="code" href="classwx_size.html" title="A wxSize is a useful data structure for graphics operations.">wxSize</a>(450, 340) );</div>
<div class="line">    frame-&gt;Show( <span class="keyword">true</span> );</div>
<div class="line">    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line">}</div>
</div><!-- fragment --><p>In the constructor of the main window (or later on) we create a menu with our menu items as well as a status bar to be shown at the bottom of the main window. Both have to be associated with the frame with respective calls.</p>
<div class="fragment"><div class="line">MyFrame::MyFrame(<span class="keyword">const</span> <a class="code" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a>&amp; title, <span class="keyword">const</span> <a class="code" href="classwx_point.html" title="A wxPoint is a useful data structure for graphics operations.">wxPoint</a>&amp; pos, <span class="keyword">const</span> <a class="code" href="classwx_size.html" title="A wxSize is a useful data structure for graphics operations.">wxSize</a>&amp; size)</div>
<div class="line">        : <a class="code" href="classwx_frame.html" title="A frame is a window whose size and position can (usually) be changed by the user.">wxFrame</a>(NULL, <a class="code" href="defs_8h.html#ac66d0a09761e7d86b2ac0b2e0c6a8cbba1f375b01ea03a713bbb7e32a36a2589c" title="Any id: means that we don&#39;t care about the id, whether when installing an event handler or when creat...">wxID_ANY</a>, title, pos, size)</div>
<div class="line">{</div>
<div class="line">    <a class="code" href="classwx_menu.html" title="A menu is a popup (or pull down) list of items, one of which may be selected before the menu goes awa...">wxMenu</a> *menuFile = <span class="keyword">new</span> <a class="code" href="classwx_menu.html" title="A menu is a popup (or pull down) list of items, one of which may be selected before the menu goes awa...">wxMenu</a>;</div>
<div class="line">    menuFile-&gt;<a class="code" href="classwx_menu.html#ab8b9fe9baabeb67cf3eaa70df072f7c9" title="Adds a menu item.">Append</a>(ID_Hello, <span class="stringliteral">&quot;&amp;Hello...\tCtrl-H&quot;</span>,</div>
<div class="line">                     <span class="stringliteral">&quot;Help string shown in status bar for this menu item&quot;</span>);</div>
<div class="line">    menuFile-&gt;<a class="code" href="classwx_menu.html#ac4027fc18854f535171ea32f416fc667" title="Adds a separator to the end of the menu.">AppendSeparator</a>();</div>
<div class="line">    menuFile-&gt;<a class="code" href="classwx_menu.html#ab8b9fe9baabeb67cf3eaa70df072f7c9" title="Adds a menu item.">Append</a>(wxID_EXIT);</div>
<div class="line"></div>
<div class="line">    <a class="code" href="classwx_menu.html" title="A menu is a popup (or pull down) list of items, one of which may be selected before the menu goes awa...">wxMenu</a> *menuHelp = <span class="keyword">new</span> <a class="code" href="classwx_menu.html" title="A menu is a popup (or pull down) list of items, one of which may be selected before the menu goes awa...">wxMenu</a>;</div>
<div class="line">    menuHelp-&gt;<a class="code" href="classwx_menu.html#ab8b9fe9baabeb67cf3eaa70df072f7c9" title="Adds a menu item.">Append</a>(wxID_ABOUT);</div>
<div class="line"></div>
<div class="line">    <a class="code" href="classwx_menu_bar.html" title="A menu bar is a series of menus accessible from the top of a frame.">wxMenuBar</a> *menuBar = <span class="keyword">new</span> <a class="code" href="classwx_menu_bar.html" title="A menu bar is a series of menus accessible from the top of a frame.">wxMenuBar</a>;</div>
<div class="line">    menuBar-&gt;<a class="code" href="classwx_menu_bar.html#a342fec5ec2d96789cfc7b82557dfa646" title="Adds the item to the end of the menu bar.">Append</a>( menuFile, <span class="stringliteral">&quot;&amp;File&quot;</span> );</div>
<div class="line">    menuBar-&gt;<a class="code" href="classwx_menu_bar.html#a342fec5ec2d96789cfc7b82557dfa646" title="Adds the item to the end of the menu bar.">Append</a>( menuHelp, <span class="stringliteral">&quot;&amp;Help&quot;</span> );</div>
<div class="line"></div>
<div class="line">    SetMenuBar( menuBar );</div>
<div class="line"></div>
<div class="line">    CreateStatusBar();</div>
<div class="line">    SetStatusText( <span class="stringliteral">&quot;Welcome to wxWidgets!&quot;</span> );</div>
<div class="line">}</div>
</div><!-- fragment --><p>Notice that we don't need to specify the labels for the standard menu items <code>wxID_ABOUT</code> and <code>wxID_EXIT</code>, they will be given standard (even correctly translated) labels and also standard accelerators correct for the current platform making your program behaviour more native. For this reason you should prefer reusing the standard ids (see <a class="el" href="page_stockitems.html">Stock Items</a>) if possible.</p>
<p>Here are the standard event handlers implementations. MyFrame::OnExit() closes the main window by calling Close(). The parameter <span class="literal">true</span> 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.</p>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> MyFrame::OnExit(<a class="code" href="classwx_command_event.html" title="This event class contains information about command events, which originate from a variety of simple ...">wxCommandEvent</a>&amp; event)</div>
<div class="line">{</div>
<div class="line">    Close( <span class="keyword">true</span> );</div>
<div class="line">}</div>
</div><!-- fragment --><p>MyFrame::OnAbout() will display a small window with some text in it. In this case a typical "About" window with information about the program.</p>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> MyFrame::OnAbout(<a class="code" href="classwx_command_event.html" title="This event class contains information about command events, which originate from a variety of simple ...">wxCommandEvent</a>&amp; event)</div>
<div class="line">{</div>
<div class="line">    <a class="code" href="group__group__funcmacro__dialog.html#ga193c64ed4802e379799cdb42de252647" title="Show a general purpose message dialog.">wxMessageBox</a>( <span class="stringliteral">&quot;This is a wxWidgets&#39; Hello world sample&quot;</span>,</div>
<div class="line">                  <span class="stringliteral">&quot;About Hello World&quot;</span>, <a class="code" href="defs_8h.html#a9c40266b61a27f0124a69a699753889a">wxOK</a> | <a class="code" href="defs_8h.html#a6ad4380c48ee0854f49c171b1a2514eb">wxICON_INFORMATION</a> );</div>
<div class="line">}</div>
</div><!-- fragment --><p>The implementation of custom menu command handler may perform whatever task your program needs to do, in this case we will simply show a message from it as befits a hello world example:</p>
<div class="fragment"><div class="line"><span class="keywordtype">void</span> MyFrame::OnHello(<a class="code" href="classwx_command_event.html" title="This event class contains information about command events, which originate from a variety of simple ...">wxCommandEvent</a>&amp; event)</div>
<div class="line">{</div>
<div class="line">    <a class="code" href="group__group__funcmacro__log.html#ga249358701f3c2d410088ddf7a61d8564" title="For all normal, informational messages.">wxLogMessage</a>(<span class="stringliteral">&quot;Hello world from wxWidgets!&quot;</span>);</div>
<div class="line">}</div>
</div><!-- fragment --><p>Here is the entire program that can be copied and pasted:</p>
<div class="fragment"><div class="line"><span class="comment">// wxWidgets &quot;Hello world&quot; Program</span></div>
<div class="line"></div>
<div class="line"><span class="comment">// For compilers that support precompilation, includes &quot;wx/wx.h&quot;.</span></div>
<div class="line"><span class="preprocessor">#include &lt;wx/wxprec.h&gt;</span></div>
<div class="line"></div>
<div class="line"><span class="preprocessor">#ifndef WX_PRECOMP</span></div>
<div class="line"><span class="preprocessor"></span><span class="preprocessor">    #include &lt;wx/wx.h&gt;</span></div>
<div class="line"><span class="preprocessor">#endif</span></div>
<div class="line"><span class="preprocessor"></span></div>
<div class="line"><span class="keyword">class </span>MyApp: <span class="keyword">public</span> <a class="code" href="classwx_app.html" title="The wxApp class represents the application itself when wxUSE_GUI=1.">wxApp</a></div>
<div class="line">{</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line">    <span class="keyword">virtual</span> <span class="keywordtype">bool</span> <a class="code" href="classwx_app_console.html#a99953775a2fd83fa2456e390779afe15" title="This must be provided by the application, and will usually create the application&#39;s main window...">OnInit</a>();</div>
<div class="line">};</div>
<div class="line"></div>
<div class="line"><span class="keyword">class </span>MyFrame: <span class="keyword">public</span> <a class="code" href="classwx_frame.html" title="A frame is a window whose size and position can (usually) be changed by the user.">wxFrame</a></div>
<div class="line">{</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line">    MyFrame(<span class="keyword">const</span> <a class="code" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a>&amp; title, <span class="keyword">const</span> <a class="code" href="classwx_point.html" title="A wxPoint is a useful data structure for graphics operations.">wxPoint</a>&amp; pos, <span class="keyword">const</span> <a class="code" href="classwx_size.html" title="A wxSize is a useful data structure for graphics operations.">wxSize</a>&amp; size);</div>
<div class="line"></div>
<div class="line"><span class="keyword">private</span>:</div>
<div class="line">    <span class="keywordtype">void</span> OnHello(<a class="code" href="classwx_command_event.html" title="This event class contains information about command events, which originate from a variety of simple ...">wxCommandEvent</a>&amp; event);</div>
<div class="line">    <span class="keywordtype">void</span> OnExit(<a class="code" href="classwx_command_event.html" title="This event class contains information about command events, which originate from a variety of simple ...">wxCommandEvent</a>&amp; event);</div>
<div class="line">    <span class="keywordtype">void</span> OnAbout(<a class="code" href="classwx_command_event.html" title="This event class contains information about command events, which originate from a variety of simple ...">wxCommandEvent</a>&amp; event);</div>
<div class="line"></div>
<div class="line">    <a class="code" href="group__group__funcmacro__events.html#gab6eca03fad44ec10b75d3cb82e9219e3" title="Use this macro inside a class declaration to declare a static event table for that class...">wxDECLARE_EVENT_TABLE</a>();</div>
<div class="line">};</div>
<div class="line"></div>
<div class="line"><span class="keyword">enum</span></div>
<div class="line">{</div>
<div class="line">    ID_Hello = 1</div>
<div class="line">};</div>
<div class="line"></div>
<div class="line"><a class="code" href="group__group__funcmacro__events.html#ga736930efaab4d7e445e9e8e520c7b74d" title="Use this macro in a source file to start listing static event handlers for a specific class...">wxBEGIN_EVENT_TABLE</a>(MyFrame, <a class="code" href="classwx_frame.html" title="A frame is a window whose size and position can (usually) be changed by the user.">wxFrame</a>)</div>
<div class="line">    EVT_MENU(ID_Hello,   MyFrame::OnHello)</div>
<div class="line">    EVT_MENU(wxID_EXIT,  MyFrame::OnExit)</div>
<div class="line">    EVT_MENU(wxID_ABOUT, MyFrame::OnAbout)</div>
<div class="line"><a class="code" href="group__group__funcmacro__events.html#ga383fad2a46e1d6c220fbe03ecfbc9c17" title="Use this macro in a source file to end listing static event handlers for a specific class...">wxEND_EVENT_TABLE</a>()</div>
<div class="line"></div>
<div class="line"><a class="code" href="group__group__funcmacro__rtti.html#ga967aafaa261481fe2d2e1cf599e3e003" title="This is used in the application class implementation file to make the application class known to wxWi...">wxIMPLEMENT_APP</a>(MyApp);</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">bool</span> MyApp::OnInit()</div>
<div class="line">{</div>
<div class="line">    MyFrame *frame = <span class="keyword">new</span> MyFrame( <span class="stringliteral">&quot;Hello World&quot;</span>, <a class="code" href="classwx_point.html" title="A wxPoint is a useful data structure for graphics operations.">wxPoint</a>(50, 50), <a class="code" href="classwx_size.html" title="A wxSize is a useful data structure for graphics operations.">wxSize</a>(450, 340) );</div>
<div class="line">    frame-&gt;Show( <span class="keyword">true</span> );</div>
<div class="line">    <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line">MyFrame::MyFrame(<span class="keyword">const</span> <a class="code" href="classwx_string.html" title="String class for passing textual data to or receiving it from wxWidgets.">wxString</a>&amp; title, <span class="keyword">const</span> <a class="code" href="classwx_point.html" title="A wxPoint is a useful data structure for graphics operations.">wxPoint</a>&amp; pos, <span class="keyword">const</span> <a class="code" href="classwx_size.html" title="A wxSize is a useful data structure for graphics operations.">wxSize</a>&amp; size)</div>
<div class="line">        : <a class="code" href="classwx_frame.html" title="A frame is a window whose size and position can (usually) be changed by the user.">wxFrame</a>(NULL, <a class="code" href="defs_8h.html#ac66d0a09761e7d86b2ac0b2e0c6a8cbba1f375b01ea03a713bbb7e32a36a2589c" title="Any id: means that we don&#39;t care about the id, whether when installing an event handler or when creat...">wxID_ANY</a>, title, pos, size)</div>
<div class="line">{</div>
<div class="line">    <a class="code" href="classwx_menu.html" title="A menu is a popup (or pull down) list of items, one of which may be selected before the menu goes awa...">wxMenu</a> *menuFile = <span class="keyword">new</span> <a class="code" href="classwx_menu.html" title="A menu is a popup (or pull down) list of items, one of which may be selected before the menu goes awa...">wxMenu</a>;</div>
<div class="line">    menuFile-&gt;<a class="code" href="classwx_menu.html#ab8b9fe9baabeb67cf3eaa70df072f7c9" title="Adds a menu item.">Append</a>(ID_Hello, <span class="stringliteral">&quot;&amp;Hello...\tCtrl-H&quot;</span>,</div>
<div class="line">                     <span class="stringliteral">&quot;Help string shown in status bar for this menu item&quot;</span>);</div>
<div class="line">    menuFile-&gt;<a class="code" href="classwx_menu.html#ac4027fc18854f535171ea32f416fc667" title="Adds a separator to the end of the menu.">AppendSeparator</a>();</div>
<div class="line">    menuFile-&gt;<a class="code" href="classwx_menu.html#ab8b9fe9baabeb67cf3eaa70df072f7c9" title="Adds a menu item.">Append</a>(wxID_EXIT);</div>
<div class="line"></div>
<div class="line">    <a class="code" href="classwx_menu.html" title="A menu is a popup (or pull down) list of items, one of which may be selected before the menu goes awa...">wxMenu</a> *menuHelp = <span class="keyword">new</span> <a class="code" href="classwx_menu.html" title="A menu is a popup (or pull down) list of items, one of which may be selected before the menu goes awa...">wxMenu</a>;</div>
<div class="line">    menuHelp-&gt;<a class="code" href="classwx_menu.html#ab8b9fe9baabeb67cf3eaa70df072f7c9" title="Adds a menu item.">Append</a>(wxID_ABOUT);</div>
<div class="line"></div>
<div class="line">    <a class="code" href="classwx_menu_bar.html" title="A menu bar is a series of menus accessible from the top of a frame.">wxMenuBar</a> *menuBar = <span class="keyword">new</span> <a class="code" href="classwx_menu_bar.html" title="A menu bar is a series of menus accessible from the top of a frame.">wxMenuBar</a>;</div>
<div class="line">    menuBar-&gt;<a class="code" href="classwx_menu_bar.html#a342fec5ec2d96789cfc7b82557dfa646" title="Adds the item to the end of the menu bar.">Append</a>( menuFile, <span class="stringliteral">&quot;&amp;File&quot;</span> );</div>
<div class="line">    menuBar-&gt;<a class="code" href="classwx_menu_bar.html#a342fec5ec2d96789cfc7b82557dfa646" title="Adds the item to the end of the menu bar.">Append</a>( menuHelp, <span class="stringliteral">&quot;&amp;Help&quot;</span> );</div>
<div class="line"></div>
<div class="line">    SetMenuBar( menuBar );</div>
<div class="line"></div>
<div class="line">    CreateStatusBar();</div>
<div class="line">    SetStatusText( <span class="stringliteral">&quot;Welcome to wxWidgets!&quot;</span> );</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">void</span> MyFrame::OnExit(<a class="code" href="classwx_command_event.html" title="This event class contains information about command events, which originate from a variety of simple ...">wxCommandEvent</a>&amp; event)</div>
<div class="line">{</div>
<div class="line">    Close( <span class="keyword">true</span> );</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">void</span> MyFrame::OnAbout(<a class="code" href="classwx_command_event.html" title="This event class contains information about command events, which originate from a variety of simple ...">wxCommandEvent</a>&amp; event)</div>
<div class="line">{</div>
<div class="line">    <a class="code" href="group__group__funcmacro__dialog.html#ga193c64ed4802e379799cdb42de252647" title="Show a general purpose message dialog.">wxMessageBox</a>( <span class="stringliteral">&quot;This is a wxWidgets&#39; Hello world sample&quot;</span>,</div>
<div class="line">                  <span class="stringliteral">&quot;About Hello World&quot;</span>, <a class="code" href="defs_8h.html#a9c40266b61a27f0124a69a699753889a">wxOK</a> | <a class="code" href="defs_8h.html#a6ad4380c48ee0854f49c171b1a2514eb">wxICON_INFORMATION</a> );</div>
<div class="line">}</div>
<div class="line"></div>
<div class="line"><span class="keywordtype">void</span> MyFrame::OnHello(<a class="code" href="classwx_command_event.html" title="This event class contains information about command events, which originate from a variety of simple ...">wxCommandEvent</a>&amp; event)</div>
<div class="line">{</div>
<div class="line">    <a class="code" href="group__group__funcmacro__log.html#ga249358701f3c2d410088ddf7a61d8564" title="For all normal, informational messages.">wxLogMessage</a>(<span class="stringliteral">&quot;Hello world from wxWidgets!&quot;</span>);</div>
<div class="line">}</div>
</div><!-- fragment --> </div></div><!-- contents -->

<address class="footer">
	<small>
		Generated on Thu Nov 27 2014 13:46:42 for wxWidgets by <a href="http://www.doxygen.org/index.html" target="_new">Doxygen</a> 1.8.2
	</small>
</address>
<script src="wxwidgets.js" type="text/javascript"></script>
</div><!-- #page_container -->
</body>
</html>