# HG changeset patch # User Claus Gittinger # Date 1571057325 -7200 # Node ID eb827930328bda951dfcb9620a53f2e5cfd9293e # Parent f6654cc100717e18e3388e8e5b406d0622acb070 initial checkin diff -r f6654cc10071 -r eb827930328b ShowMeHowItWorksRunner.st --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ShowMeHowItWorksRunner.st Mon Oct 14 14:48:45 2019 +0200 @@ -0,0 +1,436 @@ +"{ Package: 'stx:libtool2' }" + +"{ NameSpace: Smalltalk }" + +ApplicationModel subclass:#ShowMeHowItWorksRunner + instanceVariableNames:'showMe script root listModel listHolder listSelectionHolder + actionQueue' + classVariableNames:'' + poolDictionaries:'' + category:'Interface-Help' +! + +!ShowMeHowItWorksRunner class methodsFor:'documentation'! + +documentation +" + documentation to be added. + + class: + + + responsibilities: + + + collaborators: + + + API: + + + example: + + + implementation: + + + [author:] + exept MBP + + [instance variables:] + + [class variables:] + + [see also:] + +" +! + +examples +" + Notice that everything between [exBegin] and [exEnd] is extracted by the html-doc generator + to create nicely formatted and clickable executable examples in the generated html-doc. + (see the browser's class-documentation menu items for more) + + opening the application: + [exBegin] + ShowMeHowItWorksRunner open + [exEnd] + + opening the application on some model: + [exBegin] + ShowMeHowItWorksRunner openOn:aModel + [exEnd] +" +! ! + +!ShowMeHowItWorksRunner class methodsFor:'help specs'! + +helpSpec + "This resource specification was automatically generated + by the UIHelpTool of ST/X." + + "Do not manually edit this!! If it is corrupted, + the UIHelpTool may not be able to read the specification." + + " + UIHelpTool openOnClass:ShowMeHowItWorksRunner + " + + + + ^ super helpSpec addPairsFrom:#( + +#menuDeleteAction +'Delete the current action from the sequence' + +#menuEditAction +'Edit the current action' + +#menuInsertAction +'Add a new action to the sequence' + +#menuPause +'Pause the presentation' + +#menuRun +'Run/Continue the presentation' + +#menuStep +'Execute the next action' + +) +! ! + +!ShowMeHowItWorksRunner class methodsFor:'interface specs'! + +windowSpec + "This resource specification was automatically generated + by the UIPainter of ST/X." + + "Do not manually edit this!! If it is corrupted, + the UIPainter may not be able to read the specification." + + " + UIPainter new openOnClass:ShowMeHowItWorksRunner andSelector:#windowSpec + ShowMeHowItWorksRunner new openInterface:#windowSpec + ShowMeHowItWorksRunner open + " + + + + ^ + #(FullSpec + name: windowSpec + uuid: '0c43911e-ee7c-11e9-b0b5-10ddb1cc5928' + window: + (WindowSpec + label: 'ShowMeHowItWorksRunner' + name: 'ShowMeHowItWorksRunner' + uuid: 'e69fd518-ee7a-11e9-b0b5-10ddb1cc5928' + min: (Point 10 10) bounds: (Rectangle 0 0 573 132) menu: mainMenu + ) component: + (SpecCollection + collection: ( + (MenuPanelSpec + name: 'ToolBar1' + layout: (LayoutFrame 0 0.0 0 0 0 1.0 36 0) uuid: 'e69fd9a0-ee7a-11e9-b0b5-10ddb1cc5928' + menu: toolbarMenu + textDefault: true + ) + (ViewSpec + name: 'Box1' + layout: (LayoutFrame 1 0 36 0 0 1 -26 1) uuid: 'e69fdd06-ee7a-11e9-b0b5-10ddb1cc5928' + level: 1 + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'Hello World' + name: 'Contents' + layout: (LayoutFrame 0 0 0 0 0 1 0 1) uuid: 'e69fdf54-ee7a-11e9-b0b5-10ddb1cc5928' + translateLabel: true + ) + ) + ) + ) + (ViewSpec + name: 'Box2' + layout: (LayoutFrame 0 0 -26 1 0 1 0 1) uuid: 'e69fe242-ee7a-11e9-b0b5-10ddb1cc5928' + level: 1 + component: + (SpecCollection + collection: ( + (LabelSpec + label: 'InfoLabel' + name: 'Label2' + layout: (LayoutFrame 0 0 -26 1 -1 1 0 1) uuid: 'e69fe3fa-ee7a-11e9-b0b5-10ddb1cc5928' + level: -1 + translateLabel: true + labelChannel: infoLabelHolder + adjust: left + ) + ) + ) + ) + ) + ) + ) +! ! + +!ShowMeHowItWorksRunner class methodsFor:'menu specs'! + +mainMenu + "This resource specification was automatically generated by the CodeGeneratorTool." + + "Do not manually edit this!! If it is corrupted, + the MenuEditor may not be able to read the specification." + + " + MenuEditor new openOnClass:ShowMeHowItWorksRunner andSelector:#mainMenu + " + + + + ^ #(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)))) +! + +toolbarMenu + "This resource specification was automatically generated + by the MenuEditor of ST/X." + + "Do not manually edit this!! If it is corrupted, + the MenuEditor may not be able to read the specification." + + + " + MenuEditor new openOnClass:ShowMeHowItWorksRunner andSelector:#toolbarMenu + (Menu new fromLiteralArrayEncoding:(ShowMeHowItWorksRunner toolbarMenu)) startUp + " + + + + ^ + #(Menu + (MenuItem + activeHelpKey: menuRun + label: 'Run' + itemValue: menuRun + labelImage: (ResourceRetriever #'Expecco::ExpeccoIconLibrary' startExecutionIcon) isButton: true + ) + (MenuItem + activeHelpKey: menuPause + label: 'Pause' + itemValue: menuPause + labelImage: (ResourceRetriever #'Expecco::ExpeccoIconLibrary' pauseExecutionIcon) + ) + (MenuItem + activeHelpKey: menuStep + label: 'Step' + itemValue: menuStep + labelImage: (ResourceRetriever #'Expecco::ExpeccoIconLibrary' stepExecutionIcon) + ) + (MenuItem + activeHelpKey: menuInsertAction + label: 'InsertAction' + itemValue: menuInsertAction + startGroup: right + labelImage: (ResourceRetriever #'Expecco::ExpeccoIconLibrary' addActionIcon) + ) + (MenuItem + activeHelpKey: menuDeleteAction + label: 'DeleteAction' + itemValue: menuDeleteAction + startGroup: right + labelImage: (ResourceRetriever #'Expecco::ExpeccoIconLibrary' removeActionIcon) + ) + (MenuItem + activeHelpKey: menuEditAction + label: 'EditAction' + itemValue: menuEditAction + startGroup: right + labelImage: (ResourceRetriever ToolbarIconLibrary edit16x16Icon) + ) + ) +! ! + +!ShowMeHowItWorksRunner class methodsFor:'startup'! + +openOn:showMeInstance + ^ self new + showMe:showMeInstance; + open; + yourself +! ! + +!ShowMeHowItWorksRunner methodsFor:'accessing'! + +showMe + ^ showMe +! + +showMe:something + showMe := something. + self updateCurrentAction. +! + +updateCurrentAction + self halt. +! ! + +!ShowMeHowItWorksRunner methodsFor:'initialization & release'! + +closeDownViews + "This is a hook method generated by the Browser/CodeGeneratorTool. + It will be invoked when your app/dialog-window is really closed. + See also #closeDownViews, which is invoked before and may suppress the close + or ask the user for confirmation." + + "/ change the code below as required ... + "/ This should cleanup any leftover resources + "/ (for example, temporary files) + "/ super closeRequest will initiate the closeDown + + "/ add your code here + + "/ do not remove the one below ... + ^ super closeDownViews +! + +closeRequest + "This is a hook method generated by the Browser/CodeGeneratorTool. + It will be invoked when your app/dialog-window is about to be + closed (this method has a chance to suppress the close). + See also #closeDownViews, which is invoked when the close is really done." + + "/ change the code below as required ... + "/ Closing can be suppressed, by simply returning. + "/ The 'super closeRequest' at the end will initiate the real closeDown + + self hasUnsavedChanges ifTrue:[ + (self confirm:(resources string:'Close without saving ?')) ifFalse:[ + ^ self + ] + ]. + + ^ super closeRequest +! + +postBuildWith:aBuilder + "This is a hook method generated by the Browser/CodeGeneratorTool. + It will be invoked during the initialization of your app/dialog, + after all of the visual components have been built, + but BEFORE the top window is made visible. + Add any app-specific actions here (reading files, setting up values etc.) + See also #postOpenWith:, which is invoked after opening." + + "/ add any code here ... + + ^ super postBuildWith:aBuilder +! + +postOpenWith:aBuilder + "This is a hook method generated by the Browser/CodeGeneratorTool. + It will be invoked right after the applications window has been opened. + Add any app-specific actions here (starting background processes etc.). + See also #postBuildWith:, which is invoked before opening." + + "/ add any code here ... + + ^ super postOpenWith:aBuilder +! ! + +!ShowMeHowItWorksRunner methodsFor:'menu actions'! + +doSaveAs + "This method was generated by the Browser/CodeGeneratorTool. + It will be invoked when the menu-item 'save/saveAs' is selected." + + "/ change below and add any actions as required here ... + self warn:'no action for ''save/saveAs'' defined.'. +! + +menuNew + "This method was generated by the Browser/CodeGeneratorTool. + It will be invoked when the menu-item 'new' is selected." + + "/ change below and add any actions as required here ... + self warn:'no action for ''new'' defined.'. +! + +menuOpen + "This method was generated by the Browser/CodeGeneratorTool. + It will be invoked when the menu-item 'open' is selected." + + "/ change below and add any actions as required here ... + self warn:'no action for ''open'' defined.'. +! + +menuReload + "This method was generated by the Browser/CodeGeneratorTool. + It will be invoked when the menu-item 'reload' is selected." + + "/ change below and add any actions as required here ... + self warn:'no action for ''reload'' defined.'. +! + +menuSave + "This method was generated by the Browser/CodeGeneratorTool. + It will be invoked when the menu-item 'save' is selected." + + "/ change below and add any actions as required here ... + self warn:'no action for ''save'' defined.'. +! + +menuSaveAs + "This method was generated by the Browser/CodeGeneratorTool. + It will be invoked when the menu-item 'saveAs' is selected." + + "/ change below as required... (see examples in Dialog class for more options) + Dialog + requestSaveFileName:(resources string:'Save') + default:'foo.txt' + fromDirectory:nil + action:[:fileName | self doSaveAs:fileName] + appendAction:nil. +! + +openAboutThisApplication + "This method was generated by the Browser/CodeGeneratorTool. + It will be invoked when the menu-item 'help-about' is selected." + + "/ could open a customized aboutBox here ... + super openAboutThisApplication +! + +openDocumentation + "This method was generated by the Browser/CodeGeneratorTool. + It will be invoked when the menu-item 'help-documentation' is selected." + + "/ change below as required ... + + "/ to open an HTML viewer on some document (under 'doc/online//' ): + self openDocumentationFile:'TOP.html'. + + "/ add application-specific help files under the 'doc/online//help/appName' + "/ directory, and open a viewer with: + "/ self openDocumentationFile:'help//TOP.html'. +! ! + +!ShowMeHowItWorksRunner methodsFor:'private queries'! + +hasUnsavedChanges + "Return true, if any unsaved changes are present + (i.e. the contents needs to be saved or else will be lost)" + + "/ add real code as required (or remove the halt and always return false)... + "/ self halt:'check this code'. + ^ false. +! ! + +!ShowMeHowItWorksRunner class methodsFor:'documentation'! + +version_CVS + ^ '$Header$' +! ! +