*** empty log message ***
authorpenk
Thu, 15 May 2003 18:11:43 +0200
changeset 4898 6205a8c28e30
parent 4897 5ccc18a82ad0
child 4899 1bde09704293
*** empty log message ***
SettingsDialog.st
--- a/SettingsDialog.st	Thu May 15 17:52:54 2003 +0200
+++ b/SettingsDialog.st	Thu May 15 18:11:43 2003 +0200
@@ -511,6 +511,19 @@
 
 !SettingsDialog methodsFor:'application list access'!
 
+addApplClass:aClass forApplication:anApplication label:aLabel expand:aBoolean
+" add a application in the to the settingsTree, take the icon from the application class defaultIcon method"
+    | class |
+
+    class := Smalltalk classNamed:aClass.
+    class isNil ifTrue:[
+        ('SettingsDialog [warning]:cant find ', aClass asString, ' for register') infoPrintCR.
+        ^ nil
+    ].
+    class autoload.
+    ^ self createItemForApplication:anApplication class:aClass label:aLabel icon:class defaultIcon expandParent:aBoolean replaceExisting:false
+!
+
 addApplClass:aClass withName:aName
 " add a application in the to the settingsTree, take the icon from the application class defaultIcon method"
 
@@ -628,12 +641,12 @@
     ^ classEntries collect:[:aItem | aItem application].
 !
 
-getItemByApplication:aApplication
+getItemByApplication:anApplication
 
     |item|
 
     self applicationList do:[:anItem |
-        item := self childrenApplicationItemFor:aApplication fromItem:anItem.
+        item := self childrenApplicationItemFor:anApplication fromItem:anItem.
         item notNil ifTrue:[ ^ item ].
     ].
     ^ ''
@@ -739,6 +752,40 @@
     ].
 !
 
+createItemForApplication:anApplication class:aClass label:aLabel icon:aIcon expandParent:expandParent replaceExisting:doReplaceExisting
+
+    " create an application item in my application list 
+    "
+    | newItem parent locIcon item|
+
+    parent := self getItemByApplication:anApplication.
+    parent isNil ifTrue:[
+        ^ nil
+    ].
+
+    doReplaceExisting ifTrue:[
+        parent children notNil ifTrue:[
+            (item := parent children detect:[ :aItem | aItem application == anApplication] ifNone:[nil]) notNil ifTrue:[
+                ^ item.
+            ]
+        ]
+    ].
+
+    newItem := self class itemClass new.  
+    "/ newItem label:(resources string:aLabel) "allBold".
+    newItem label:aLabel "allBold".
+    newItem nameString:(anApplication itemPathName , aLabel).
+    newItem applicationClass:aClass.
+    locIcon := aIcon.
+    locIcon isNil ifTrue:[ locIcon := self class defaultSettingsAppIcon].
+    newItem icon:locIcon.
+    parent add:newItem.
+    expandParent ifTrue:[
+        parent expand.
+    ].
+    ^ newItem
+!
+
 createItemName:aNameString label:aLabel class:aClass icon:aIcon
 
     ^ self createItemName:aNameString label:aLabel class:aClass icon:aIcon expandParent:false
@@ -1154,7 +1201,7 @@
 !SettingsDialog class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libtool/SettingsDialog.st,v 1.29 2003-05-15 08:18:18 mb Exp $'
+    ^ '$Header: /cvs/stx/stx/libtool/SettingsDialog.st,v 1.30 2003-05-15 16:11:43 penk Exp $'
 ! !
 
 SettingsDialog initialize!