--- a/Tools__ViewTreeApplication.st Tue Jul 30 07:59:42 2013 +0200
+++ b/Tools__ViewTreeApplication.st Tue Jul 30 09:45:42 2013 +0200
@@ -16,7 +16,7 @@
ToolApplicationModel subclass:#ViewTreeInspectorApplication
instanceVariableNames:'model treeView hasSingleSelectionHolder clickedItem clickedPoint
motionAction process followFocusChannel showNamesHolder
- inspectorView'
+ inspectorView inspectorModeIndexHolder'
classVariableNames:''
poolDictionaries:''
category:'Interface-Smalltalk'
@@ -280,64 +280,82 @@
<resource: #canvas>
^
- #(FullSpec
- name: windowSpec
- window:
- (WindowSpec
- label: 'View Tree Inspector'
- name: 'View Tree Inspector'
- min: (Point 10 10)
- max: (Point 1024 9999)
- bounds: (Rectangle 0 0 381 654)
- menu: menu
- )
- component:
- (SpecCollection
- collection: (
- (MenuPanelSpec
- name: 'toolbarMenu'
- layout: (LayoutFrame 0 0.0 0 0 0 1.0 40 0)
- menu: toolbarMenu
- textDefault: true
- )
- (VariableVerticalPanelSpec
- name: 'VariableVerticalPanel1'
- layout: (LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0)
- component:
- (SpecCollection
- collection: (
- (HierarchicalListViewSpec
- name: 'List'
- level: 1
- model: model
- menu: middleButtonMenu
- hasHorizontalScrollBar: true
- hasVerticalScrollBar: true
- miniScrollerHorizontal: true
- miniScrollerVertical: false
- listModel: listOfItems
- multipleSelectOk: true
- useIndex: false
- highlightMode: label
- showLeftIndicators: false
- indicatorSelector: indicatorClicked:
- useDefaultIcons: false
- postBuildCallback: postBuildTree:
- )
- (ViewSpec
- name: 'Box1'
- viewClassName: 'InspectorView'
- postBuildCallback: postBuildInspectorView:
- )
+ #(FullSpec
+ name: windowSpec
+ window:
+ (WindowSpec
+ label: 'View Tree Inspector'
+ name: 'View Tree Inspector'
+ min: (Point 10 10)
+ max: (Point 1024 9999)
+ bounds: (Rectangle 0 0 381 654)
+ menu: menu
+ )
+ component:
+ (SpecCollection
+ collection: (
+ (MenuPanelSpec
+ name: 'toolbarMenu'
+ layout: (LayoutFrame 0 0.0 0 0 0 1.0 40 0)
+ menu: toolbarMenu
+ textDefault: true
+ )
+ (VariableVerticalPanelSpec
+ name: 'VariableVerticalPanel1'
+ layout: (LayoutFrame 0 0.0 40 0.0 0 1.0 0 1.0)
+ component:
+ (SpecCollection
+ collection: (
+ (HierarchicalListViewSpec
+ name: 'List'
+ level: 1
+ model: model
+ menu: middleButtonMenu
+ hasHorizontalScrollBar: true
+ hasVerticalScrollBar: true
+ miniScrollerHorizontal: true
+ miniScrollerVertical: false
+ listModel: listOfItems
+ multipleSelectOk: true
+ useIndex: false
+ highlightMode: label
+ showLeftIndicators: false
+ indicatorSelector: indicatorClicked:
+ useDefaultIcons: false
+ postBuildCallback: postBuildTree:
)
-
- )
- handles: (Any 0.5 1.0)
- )
+ (ViewSpec
+ name: 'Box2'
+ component:
+ (SpecCollection
+ collection: (
+ (ViewSpec
+ name: 'Inspector'
+ layout: (LayoutFrame 0 0 26 0 0 1 0 1)
+ postBuildCallback: postBuildInspectorView:
+ viewClassName: 'InspectorView'
+ )
+ (TabViewSpec
+ name: 'TabHeader1'
+ layout: (LayoutFrame 0 0.0 0 0 0 1.0 25 0)
+ model: inspectorModeIndexHolder
+ menu: inspectorModes
+ useIndex: true
+ translateLabel: true
+ )
+ )
+
+ )
+ )
+ )
+
+ )
+ handles: (Any 0.5 1.0)
)
-
- )
- )
+ )
+
+ )
+ )
! !
!ViewTreeInspectorApplication class methodsFor:'menu specs'!
@@ -835,6 +853,34 @@
^ model hasTargetWidgetChannel
!
+inspectorMode
+ "what is shwn in the inspector:
+ 1->widget
+ 2->application"
+
+ ^ (inspectorModeIndexHolder value == 1)
+ ifTrue:[#widget]
+ ifFalse:[#application]
+
+ "Created: / 30-07-2013 / 07:44:59 / cg"
+!
+
+inspectorModeIndexHolder
+ "what is shwn in the inspector:
+ 1->widget
+ 2->application"
+
+ ^ inspectorModeIndexHolder
+
+ "Created: / 30-07-2013 / 07:44:07 / cg"
+!
+
+inspectorModes
+ ^ #('Widget' 'Application')
+
+ "Created: / 30-07-2013 / 09:42:16 / cg"
+!
+
listOfItems
"returns the hierarchical list of items"
@@ -872,6 +918,12 @@
!ViewTreeInspectorApplication methodsFor:'change & update'!
+inspectorModeIndexHolderChanged
+ self updateInspector
+
+ "Created: / 30-07-2013 / 09:21:51 / cg"
+!
+
selectionChanged
|info view item|
@@ -896,7 +948,9 @@
info := ''
].
hasSingleSelectionHolder value:(view notNil).
- inspectorView inspect:view.
+ self updateInspector
+
+ "Modified: / 30-07-2013 / 09:21:27 / cg"
!
update:something with:someArgument from:aModel
@@ -916,6 +970,21 @@
].
super update:something with:someArgument from:aModel.
+!
+
+updateInspector
+ |view obj|
+
+ view := self selectedView.
+ (view isNil or:[self inspectorMode == #widget]) ifTrue:[
+ obj := view.
+ ] ifFalse:[
+ obj := view application.
+ ].
+ inspectorView inspect:obj.
+ inspectorView headLineLabel:(obj class nameWithoutPrefix)
+
+ "Created: / 30-07-2013 / 09:21:16 / cg"
! !
!ViewTreeInspectorApplication methodsFor:'event processing'!
@@ -1144,6 +1213,8 @@
hasSingleSelectionHolder := false asValue.
followFocusChannel := false asValue.
+ inspectorModeIndexHolder := 1 asValue.
+ inspectorModeIndexHolder onChangeSend:#inspectorModeIndexHolderChanged to:self.
model := ViewTreeModel new.
model inputEventAction:[:ev| self processEvent:ev ].
@@ -1154,6 +1225,8 @@
showNamesHolder := false asValue.
showNamesHolder addDependent:self.
+
+ "Modified: / 30-07-2013 / 09:20:08 / cg"
!
postBuildInspectorView:anInspector