flyByHelp
authorClaus Gittinger <cg@exept.de>
Sat, 08 Dec 2001 01:37:51 +0100
changeset 1538 e906245e5171
parent 1537 364eabac0aec
child 1539 210f37b16a09
flyByHelp
ApplicationModel.st
ToolApplicationModel.st
--- a/ApplicationModel.st	Sat Dec 08 01:36:32 2001 +0100
+++ b/ApplicationModel.st	Sat Dec 08 01:37:51 2001 +0100
@@ -155,6 +155,12 @@
 
 !ApplicationModel class methodsFor:'active help'!
 
+flyByHelpSpec
+    "default is: no help-spec (should be redefined by concrete class if help is wanted)."
+
+    ^ IdentityDictionary new.
+!
+
 helpSpec
     "default is: no help-spec (should be redefined by concrete class if help is wanted)."
 
@@ -891,6 +897,55 @@
     "Modified: / 18.6.1998 / 20:33:36 / cg"
 !
 
+flyByHelpTextFor:aComponent
+    "activeHelp interface: return some short help text for a widget component"
+
+    |key cls|
+
+    builder notNil ifTrue:[
+        cls := self class.
+
+        (cls respondsTo:#flyByHelpSpec) ifTrue:[
+            (key := builder helpKeyFor:aComponent) notNil ifTrue:[
+                ^ self flyByHelpTextForKey:key
+            ]
+        ]
+    ].
+    masterApplication notNil ifTrue:[
+        ^ masterApplication flyByHelpTextFor:aComponent
+    ].
+    ^ nil
+
+    "Modified: / 31.7.1998 / 23:03:10 / cg"
+!
+
+flyByHelpTextForKey:aKey
+    "flyByHelp interface: return some short help text for a key
+     key is the symbol associated with some widget or menu item.
+     (from my flyByHelpSpec); return a language variant (if available)"
+
+    |cls helpText|
+
+    cls := self class.
+
+    (cls respondsTo:#flyByHelpSpec) ifTrue:[
+        helpText := (cls flyByHelpSpec) at:aKey ifAbsent:nil
+    ].
+    helpText isNil ifTrue:[
+        masterApplication notNil ifTrue:[
+            helpText := masterApplication flyByHelpTextForKey:aKey
+        ]
+    ].
+
+    "/ translate.
+    resources notNil ifTrue:[
+        ^ resources string:helpText
+    ].
+    ^ helpText
+
+    "Modified: / 4.2.2000 / 15:30:16 / cg"
+!
+
 helpTextFor:aComponent
     "activeHelp interface: return some help text for a widget component"
 
@@ -925,9 +980,12 @@
     (cls respondsTo:#helpSpec) ifTrue:[
         helpText := (cls helpSpec) at:aKey ifAbsent:nil
     ].
-    (masterApplication notNil and:[helpText isNil]) ifTrue:[
-        helpText := masterApplication helpTextForKey:aKey
+    helpText isNil ifTrue:[
+        masterApplication notNil ifTrue:[
+            helpText := masterApplication helpTextForKey:aKey
+        ].
     ].
+
     "/ translate.
     resources notNil ifTrue:[
         ^ resources string:helpText
@@ -2533,6 +2591,6 @@
 !ApplicationModel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.163 2001-11-19 08:04:32 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ApplicationModel.st,v 1.164 2001-12-08 00:37:27 cg Exp $'
 ! !
 ApplicationModel initialize!
--- a/ToolApplicationModel.st	Sat Dec 08 01:36:32 2001 +0100
+++ b/ToolApplicationModel.st	Sat Dec 08 01:37:51 2001 +0100
@@ -201,6 +201,14 @@
 
 !ToolApplicationModel class methodsFor:'help specs'!
 
+flyByHelpSpec
+    <resource: #help>
+
+    ^ super flyByHelpSpec addPairsFrom:#(
+
+)
+!
+
 helpSpec
     "This resource specification was automatically generated
      by the UIHelpTool of ST/X."
@@ -1312,5 +1320,5 @@
 !ToolApplicationModel class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview2/ToolApplicationModel.st,v 1.104 2001-11-15 22:09:22 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview2/ToolApplicationModel.st,v 1.105 2001-12-08 00:37:51 cg Exp $'
 ! !