ShowMeHowItWorksRunner.st
author anharman
Thu, 05 Mar 2020 10:40:13 +0100
changeset 3873 f1fc298be9f5
parent 3785 eb827930328b
permissions -rw-r--r--
#UI_ENHANCEMENT by exept class: ProjectBuilderAssistantApplication class changed: #helpSpec

"{ 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:
        <a short class summary here, describing what instances represent>

    responsibilities:    
        <describing what my main role is>

    collaborators:    
        <describing with whom and how I talk to>

    API:
        <public api and main messages>
        
    example:
        <a one-line examples on how to use - can also be in a separate example method>

    implementation:
        <implementation points>

    [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
    "

    <resource: #help>

    ^ 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
    "

    <resource: #canvas>

    ^ 
    #(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
    "

    <resource: #menu>

    ^ #(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
    "

    <resource: #menu>

    ^ 
     #(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/<language>/' ):
    self openDocumentationFile:'TOP.html'.

    "/ add application-specific help files under the 'doc/online/<language>/help/appName'
    "/ directory, and open a viewer with:
    "/ self openDocumentationFile:'help/<MyApplication>/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$'
! !