|
1 "{ Package: 'stx:libtool2' }" |
|
2 |
|
3 "{ NameSpace: Smalltalk }" |
|
4 |
|
5 ApplicationModel subclass:#ShowMeHowItWorksRunner |
|
6 instanceVariableNames:'showMe script root listModel listHolder listSelectionHolder |
|
7 actionQueue' |
|
8 classVariableNames:'' |
|
9 poolDictionaries:'' |
|
10 category:'Interface-Help' |
|
11 ! |
|
12 |
|
13 !ShowMeHowItWorksRunner class methodsFor:'documentation'! |
|
14 |
|
15 documentation |
|
16 " |
|
17 documentation to be added. |
|
18 |
|
19 class: |
|
20 <a short class summary here, describing what instances represent> |
|
21 |
|
22 responsibilities: |
|
23 <describing what my main role is> |
|
24 |
|
25 collaborators: |
|
26 <describing with whom and how I talk to> |
|
27 |
|
28 API: |
|
29 <public api and main messages> |
|
30 |
|
31 example: |
|
32 <a one-line examples on how to use - can also be in a separate example method> |
|
33 |
|
34 implementation: |
|
35 <implementation points> |
|
36 |
|
37 [author:] |
|
38 exept MBP |
|
39 |
|
40 [instance variables:] |
|
41 |
|
42 [class variables:] |
|
43 |
|
44 [see also:] |
|
45 |
|
46 " |
|
47 ! |
|
48 |
|
49 examples |
|
50 " |
|
51 Notice that everything between [exBegin] and [exEnd] is extracted by the html-doc generator |
|
52 to create nicely formatted and clickable executable examples in the generated html-doc. |
|
53 (see the browser's class-documentation menu items for more) |
|
54 |
|
55 opening the application: |
|
56 [exBegin] |
|
57 ShowMeHowItWorksRunner open |
|
58 [exEnd] |
|
59 |
|
60 opening the application on some model: |
|
61 [exBegin] |
|
62 ShowMeHowItWorksRunner openOn:aModel |
|
63 [exEnd] |
|
64 " |
|
65 ! ! |
|
66 |
|
67 !ShowMeHowItWorksRunner class methodsFor:'help specs'! |
|
68 |
|
69 helpSpec |
|
70 "This resource specification was automatically generated |
|
71 by the UIHelpTool of ST/X." |
|
72 |
|
73 "Do not manually edit this!! If it is corrupted, |
|
74 the UIHelpTool may not be able to read the specification." |
|
75 |
|
76 " |
|
77 UIHelpTool openOnClass:ShowMeHowItWorksRunner |
|
78 " |
|
79 |
|
80 <resource: #help> |
|
81 |
|
82 ^ super helpSpec addPairsFrom:#( |
|
83 |
|
84 #menuDeleteAction |
|
85 'Delete the current action from the sequence' |
|
86 |
|
87 #menuEditAction |
|
88 'Edit the current action' |
|
89 |
|
90 #menuInsertAction |
|
91 'Add a new action to the sequence' |
|
92 |
|
93 #menuPause |
|
94 'Pause the presentation' |
|
95 |
|
96 #menuRun |
|
97 'Run/Continue the presentation' |
|
98 |
|
99 #menuStep |
|
100 'Execute the next action' |
|
101 |
|
102 ) |
|
103 ! ! |
|
104 |
|
105 !ShowMeHowItWorksRunner class methodsFor:'interface specs'! |
|
106 |
|
107 windowSpec |
|
108 "This resource specification was automatically generated |
|
109 by the UIPainter of ST/X." |
|
110 |
|
111 "Do not manually edit this!! If it is corrupted, |
|
112 the UIPainter may not be able to read the specification." |
|
113 |
|
114 " |
|
115 UIPainter new openOnClass:ShowMeHowItWorksRunner andSelector:#windowSpec |
|
116 ShowMeHowItWorksRunner new openInterface:#windowSpec |
|
117 ShowMeHowItWorksRunner open |
|
118 " |
|
119 |
|
120 <resource: #canvas> |
|
121 |
|
122 ^ |
|
123 #(FullSpec |
|
124 name: windowSpec |
|
125 uuid: '0c43911e-ee7c-11e9-b0b5-10ddb1cc5928' |
|
126 window: |
|
127 (WindowSpec |
|
128 label: 'ShowMeHowItWorksRunner' |
|
129 name: 'ShowMeHowItWorksRunner' |
|
130 uuid: 'e69fd518-ee7a-11e9-b0b5-10ddb1cc5928' |
|
131 min: (Point 10 10) bounds: (Rectangle 0 0 573 132) menu: mainMenu |
|
132 ) component: |
|
133 (SpecCollection |
|
134 collection: ( |
|
135 (MenuPanelSpec |
|
136 name: 'ToolBar1' |
|
137 layout: (LayoutFrame 0 0.0 0 0 0 1.0 36 0) uuid: 'e69fd9a0-ee7a-11e9-b0b5-10ddb1cc5928' |
|
138 menu: toolbarMenu |
|
139 textDefault: true |
|
140 ) |
|
141 (ViewSpec |
|
142 name: 'Box1' |
|
143 layout: (LayoutFrame 1 0 36 0 0 1 -26 1) uuid: 'e69fdd06-ee7a-11e9-b0b5-10ddb1cc5928' |
|
144 level: 1 |
|
145 component: |
|
146 (SpecCollection |
|
147 collection: ( |
|
148 (LabelSpec |
|
149 label: 'Hello World' |
|
150 name: 'Contents' |
|
151 layout: (LayoutFrame 0 0 0 0 0 1 0 1) uuid: 'e69fdf54-ee7a-11e9-b0b5-10ddb1cc5928' |
|
152 translateLabel: true |
|
153 ) |
|
154 ) |
|
155 ) |
|
156 ) |
|
157 (ViewSpec |
|
158 name: 'Box2' |
|
159 layout: (LayoutFrame 0 0 -26 1 0 1 0 1) uuid: 'e69fe242-ee7a-11e9-b0b5-10ddb1cc5928' |
|
160 level: 1 |
|
161 component: |
|
162 (SpecCollection |
|
163 collection: ( |
|
164 (LabelSpec |
|
165 label: 'InfoLabel' |
|
166 name: 'Label2' |
|
167 layout: (LayoutFrame 0 0 -26 1 -1 1 0 1) uuid: 'e69fe3fa-ee7a-11e9-b0b5-10ddb1cc5928' |
|
168 level: -1 |
|
169 translateLabel: true |
|
170 labelChannel: infoLabelHolder |
|
171 adjust: left |
|
172 ) |
|
173 ) |
|
174 ) |
|
175 ) |
|
176 ) |
|
177 ) |
|
178 ) |
|
179 ! ! |
|
180 |
|
181 !ShowMeHowItWorksRunner class methodsFor:'menu specs'! |
|
182 |
|
183 mainMenu |
|
184 "This resource specification was automatically generated by the CodeGeneratorTool." |
|
185 |
|
186 "Do not manually edit this!! If it is corrupted, |
|
187 the MenuEditor may not be able to read the specification." |
|
188 |
|
189 " |
|
190 MenuEditor new openOnClass:ShowMeHowItWorksRunner andSelector:#mainMenu |
|
191 " |
|
192 |
|
193 <resource: #menu> |
|
194 |
|
195 ^ #(Menu (MenuItem label: 'File' submenu: (Menu (MenuItem label: 'New' itemValue: menuNew) (MenuItem label: '-') (MenuItem label: 'Open...' itemValue: menuOpen) (MenuItem label: '-') (MenuItem label: 'Save' itemValue: menuSave) (MenuItem label: 'Save As...' itemValue: menuSaveAs) (MenuItem label: '-') (MenuItem label: 'Exit' itemValue: closeRequest))) (MenuItem label: 'MENU_Help' startGroup: right submenu: (Menu (MenuItem label: 'Documentation' itemValue: openDocumentation) (MenuItem label: '-') (MenuItem label: 'About this Application...' itemValue: openAboutThisApplication)))) |
|
196 ! |
|
197 |
|
198 toolbarMenu |
|
199 "This resource specification was automatically generated |
|
200 by the MenuEditor of ST/X." |
|
201 |
|
202 "Do not manually edit this!! If it is corrupted, |
|
203 the MenuEditor may not be able to read the specification." |
|
204 |
|
205 |
|
206 " |
|
207 MenuEditor new openOnClass:ShowMeHowItWorksRunner andSelector:#toolbarMenu |
|
208 (Menu new fromLiteralArrayEncoding:(ShowMeHowItWorksRunner toolbarMenu)) startUp |
|
209 " |
|
210 |
|
211 <resource: #menu> |
|
212 |
|
213 ^ |
|
214 #(Menu |
|
215 (MenuItem |
|
216 activeHelpKey: menuRun |
|
217 label: 'Run' |
|
218 itemValue: menuRun |
|
219 labelImage: (ResourceRetriever #'Expecco::ExpeccoIconLibrary' startExecutionIcon) isButton: true |
|
220 ) |
|
221 (MenuItem |
|
222 activeHelpKey: menuPause |
|
223 label: 'Pause' |
|
224 itemValue: menuPause |
|
225 labelImage: (ResourceRetriever #'Expecco::ExpeccoIconLibrary' pauseExecutionIcon) |
|
226 ) |
|
227 (MenuItem |
|
228 activeHelpKey: menuStep |
|
229 label: 'Step' |
|
230 itemValue: menuStep |
|
231 labelImage: (ResourceRetriever #'Expecco::ExpeccoIconLibrary' stepExecutionIcon) |
|
232 ) |
|
233 (MenuItem |
|
234 activeHelpKey: menuInsertAction |
|
235 label: 'InsertAction' |
|
236 itemValue: menuInsertAction |
|
237 startGroup: right |
|
238 labelImage: (ResourceRetriever #'Expecco::ExpeccoIconLibrary' addActionIcon) |
|
239 ) |
|
240 (MenuItem |
|
241 activeHelpKey: menuDeleteAction |
|
242 label: 'DeleteAction' |
|
243 itemValue: menuDeleteAction |
|
244 startGroup: right |
|
245 labelImage: (ResourceRetriever #'Expecco::ExpeccoIconLibrary' removeActionIcon) |
|
246 ) |
|
247 (MenuItem |
|
248 activeHelpKey: menuEditAction |
|
249 label: 'EditAction' |
|
250 itemValue: menuEditAction |
|
251 startGroup: right |
|
252 labelImage: (ResourceRetriever ToolbarIconLibrary edit16x16Icon) |
|
253 ) |
|
254 ) |
|
255 ! ! |
|
256 |
|
257 !ShowMeHowItWorksRunner class methodsFor:'startup'! |
|
258 |
|
259 openOn:showMeInstance |
|
260 ^ self new |
|
261 showMe:showMeInstance; |
|
262 open; |
|
263 yourself |
|
264 ! ! |
|
265 |
|
266 !ShowMeHowItWorksRunner methodsFor:'accessing'! |
|
267 |
|
268 showMe |
|
269 ^ showMe |
|
270 ! |
|
271 |
|
272 showMe:something |
|
273 showMe := something. |
|
274 self updateCurrentAction. |
|
275 ! |
|
276 |
|
277 updateCurrentAction |
|
278 self halt. |
|
279 ! ! |
|
280 |
|
281 !ShowMeHowItWorksRunner methodsFor:'initialization & release'! |
|
282 |
|
283 closeDownViews |
|
284 "This is a hook method generated by the Browser/CodeGeneratorTool. |
|
285 It will be invoked when your app/dialog-window is really closed. |
|
286 See also #closeDownViews, which is invoked before and may suppress the close |
|
287 or ask the user for confirmation." |
|
288 |
|
289 "/ change the code below as required ... |
|
290 "/ This should cleanup any leftover resources |
|
291 "/ (for example, temporary files) |
|
292 "/ super closeRequest will initiate the closeDown |
|
293 |
|
294 "/ add your code here |
|
295 |
|
296 "/ do not remove the one below ... |
|
297 ^ super closeDownViews |
|
298 ! |
|
299 |
|
300 closeRequest |
|
301 "This is a hook method generated by the Browser/CodeGeneratorTool. |
|
302 It will be invoked when your app/dialog-window is about to be |
|
303 closed (this method has a chance to suppress the close). |
|
304 See also #closeDownViews, which is invoked when the close is really done." |
|
305 |
|
306 "/ change the code below as required ... |
|
307 "/ Closing can be suppressed, by simply returning. |
|
308 "/ The 'super closeRequest' at the end will initiate the real closeDown |
|
309 |
|
310 self hasUnsavedChanges ifTrue:[ |
|
311 (self confirm:(resources string:'Close without saving ?')) ifFalse:[ |
|
312 ^ self |
|
313 ] |
|
314 ]. |
|
315 |
|
316 ^ super closeRequest |
|
317 ! |
|
318 |
|
319 postBuildWith:aBuilder |
|
320 "This is a hook method generated by the Browser/CodeGeneratorTool. |
|
321 It will be invoked during the initialization of your app/dialog, |
|
322 after all of the visual components have been built, |
|
323 but BEFORE the top window is made visible. |
|
324 Add any app-specific actions here (reading files, setting up values etc.) |
|
325 See also #postOpenWith:, which is invoked after opening." |
|
326 |
|
327 "/ add any code here ... |
|
328 |
|
329 ^ super postBuildWith:aBuilder |
|
330 ! |
|
331 |
|
332 postOpenWith:aBuilder |
|
333 "This is a hook method generated by the Browser/CodeGeneratorTool. |
|
334 It will be invoked right after the applications window has been opened. |
|
335 Add any app-specific actions here (starting background processes etc.). |
|
336 See also #postBuildWith:, which is invoked before opening." |
|
337 |
|
338 "/ add any code here ... |
|
339 |
|
340 ^ super postOpenWith:aBuilder |
|
341 ! ! |
|
342 |
|
343 !ShowMeHowItWorksRunner methodsFor:'menu actions'! |
|
344 |
|
345 doSaveAs |
|
346 "This method was generated by the Browser/CodeGeneratorTool. |
|
347 It will be invoked when the menu-item 'save/saveAs' is selected." |
|
348 |
|
349 "/ change below and add any actions as required here ... |
|
350 self warn:'no action for ''save/saveAs'' defined.'. |
|
351 ! |
|
352 |
|
353 menuNew |
|
354 "This method was generated by the Browser/CodeGeneratorTool. |
|
355 It will be invoked when the menu-item 'new' is selected." |
|
356 |
|
357 "/ change below and add any actions as required here ... |
|
358 self warn:'no action for ''new'' defined.'. |
|
359 ! |
|
360 |
|
361 menuOpen |
|
362 "This method was generated by the Browser/CodeGeneratorTool. |
|
363 It will be invoked when the menu-item 'open' is selected." |
|
364 |
|
365 "/ change below and add any actions as required here ... |
|
366 self warn:'no action for ''open'' defined.'. |
|
367 ! |
|
368 |
|
369 menuReload |
|
370 "This method was generated by the Browser/CodeGeneratorTool. |
|
371 It will be invoked when the menu-item 'reload' is selected." |
|
372 |
|
373 "/ change below and add any actions as required here ... |
|
374 self warn:'no action for ''reload'' defined.'. |
|
375 ! |
|
376 |
|
377 menuSave |
|
378 "This method was generated by the Browser/CodeGeneratorTool. |
|
379 It will be invoked when the menu-item 'save' is selected." |
|
380 |
|
381 "/ change below and add any actions as required here ... |
|
382 self warn:'no action for ''save'' defined.'. |
|
383 ! |
|
384 |
|
385 menuSaveAs |
|
386 "This method was generated by the Browser/CodeGeneratorTool. |
|
387 It will be invoked when the menu-item 'saveAs' is selected." |
|
388 |
|
389 "/ change below as required... (see examples in Dialog class for more options) |
|
390 Dialog |
|
391 requestSaveFileName:(resources string:'Save') |
|
392 default:'foo.txt' |
|
393 fromDirectory:nil |
|
394 action:[:fileName | self doSaveAs:fileName] |
|
395 appendAction:nil. |
|
396 ! |
|
397 |
|
398 openAboutThisApplication |
|
399 "This method was generated by the Browser/CodeGeneratorTool. |
|
400 It will be invoked when the menu-item 'help-about' is selected." |
|
401 |
|
402 "/ could open a customized aboutBox here ... |
|
403 super openAboutThisApplication |
|
404 ! |
|
405 |
|
406 openDocumentation |
|
407 "This method was generated by the Browser/CodeGeneratorTool. |
|
408 It will be invoked when the menu-item 'help-documentation' is selected." |
|
409 |
|
410 "/ change below as required ... |
|
411 |
|
412 "/ to open an HTML viewer on some document (under 'doc/online/<language>/' ): |
|
413 self openDocumentationFile:'TOP.html'. |
|
414 |
|
415 "/ add application-specific help files under the 'doc/online/<language>/help/appName' |
|
416 "/ directory, and open a viewer with: |
|
417 "/ self openDocumentationFile:'help/<MyApplication>/TOP.html'. |
|
418 ! ! |
|
419 |
|
420 !ShowMeHowItWorksRunner methodsFor:'private queries'! |
|
421 |
|
422 hasUnsavedChanges |
|
423 "Return true, if any unsaved changes are present |
|
424 (i.e. the contents needs to be saved or else will be lost)" |
|
425 |
|
426 "/ add real code as required (or remove the halt and always return false)... |
|
427 "/ self halt:'check this code'. |
|
428 ^ false. |
|
429 ! ! |
|
430 |
|
431 !ShowMeHowItWorksRunner class methodsFor:'documentation'! |
|
432 |
|
433 version_CVS |
|
434 ^ '$Header$' |
|
435 ! ! |
|
436 |