10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 "{ Package: 'stx:libwidg2' }" |
12 "{ Package: 'stx:libwidg2' }" |
13 |
13 |
14 ListModelView subclass:#SelectionInListModelView |
14 ListModelView subclass:#SelectionInListModelView |
15 instanceVariableNames:'selection multipleSelectOk selectOnButtonMenu actionBlock |
15 instanceVariableNames:'selection multipleSelectOk actionBlock doubleClickActionBlock |
16 doubleClickActionBlock selectConditionBlock buttonMotionAction |
16 selectConditionBlock buttonMotionAction buttonReleaseAction |
17 buttonReleaseAction highlightMode useIndex ignoreReselect |
17 highlightMode useIndex ignoreReselect toggleSelect hilightFgColor |
18 toggleSelect hilightFgColor hilightBgColor hilightFgColorNoFocus |
18 hilightBgColor hilightFgColorNoFocus hilightBgColorNoFocus |
19 hilightBgColorNoFocus hilightLevel hilightFrameColor hilightStyle |
19 hilightLevel hilightFrameColor hilightStyle dropSource editorView |
20 dropSource editorView openEditorAction closeEditorAction |
20 openEditorAction closeEditorAction highlightEnterItem enterItem |
21 highlightEnterItem enterItem cursorItem lineMask keyActionStyle |
21 cursorItem lineMask keyActionStyle returnKeyActionStyle strikeOut |
22 returnKeyActionStyle strikeOut modelChangedDuringButtonPress |
22 modelChangedDuringButtonPress selectOnButtonPress |
23 selectOnButtonPress selectOnMenuButton minimumEditorHeight |
23 selectOnMenuButton minimumEditorHeight extraSpaceAtBottomForDrop' |
24 extraSpaceAtBottomForDrop' |
|
25 classVariableNames:'DefaultHilightStyle DefaultHilightBackgroundColor |
24 classVariableNames:'DefaultHilightStyle DefaultHilightBackgroundColor |
26 DefaultHilightForegroundColor DefaultHilightLevel |
25 DefaultHilightForegroundColor DefaultHilightLevel |
27 DefaultHilightFrameColor' |
26 DefaultHilightFrameColor' |
28 poolDictionaries:'' |
27 poolDictionaries:'' |
29 category:'Views-Lists' |
28 category:'Views-Lists' |
76 but derives from the ListModelView and thus the list is kept |
75 but derives from the ListModelView and thus the list is kept |
77 in the list. |
76 in the list. |
78 |
77 |
79 [Instance variables:] |
78 [Instance variables:] |
80 |
79 |
81 selection <misc> the current selection. nil, a number or collection of numbers |
80 selection <misc> the current selection. nil, a number or collection of numbers |
82 multipleSelectOk <Boolean> allow/disallow multiple selections( default:false ) |
81 multipleSelectOk <Boolean> allow/disallow multiple selections( default:false ) |
83 selectOnButtonMenu <Boolean> enable/disable selection will change on menu pressed |
82 selectMenuButton <Boolean> enable/disable selection will change on menu pressed |
84 |
83 |
85 buttonReleaseAction <Action> called if the mouse button is released |
84 buttonReleaseAction <Action> called if the mouse button is released |
86 buttonMotionAction <Action> called during mouse motion with one argument the point |
85 buttonMotionAction <Action> called during mouse motion with one argument the point |
87 under the mouse. |
86 under the mouse. |
88 |
87 |
89 actionBlock <Block> action evaluated on single click (0/1/2 arguments) |
88 actionBlock <Block> action evaluated on single click (0/1/2 arguments) |
90 doubleClickActionBlock <Block> action evaluated on double click (0/1/2 arguments) |
89 doubleClickActionBlock <Block> action evaluated on double click (0/1/2 arguments) |
91 selectConditionBlock <Block> action evaluated before selection changed (0/1/2 arguments) |
90 selectConditionBlock <Block> action evaluated before selection changed (0/1/2 arguments) |
92 |
91 |
93 keyActionStyle <Symbol> controls how to respond to keyboard selects |
92 keyActionStyle <Symbol> controls how to respond to keyboard selects |
94 returnKeyActionStyle <Symbol> controls how to respond to return key |
93 returnKeyActionStyle <Symbol> controls how to respond to return key |
95 |
94 |
96 useIndex <Boolean> representation of the model selection |
95 useIndex <Boolean> representation of the model selection |
97 |
96 |
98 ignoreReselect <Boolean> if set, a click on an already selected entry is ignored |
97 ignoreReselect <Boolean> if set, a click on an already selected entry is ignored |
99 toggleSelect <Boolean> a click on an entry unselects it and vice versa |
98 toggleSelect <Boolean> a click on an entry unselects it and vice versa |
100 |
99 |
101 highlightMode <Symbol> how to draw the selection |
100 highlightMode <Symbol> how to draw the selection |
102 hilightFgColor <Color> foregroundColor of highlighted items |
101 hilightFgColor <Color> foregroundColor of highlighted items |
103 hilightBgColor <Color> backgroundColor of highlighted items |
102 hilightBgColor <Color> backgroundColor of highlighted items |
104 hilightLevel <Integer> level to draw selections (i.e. for 3D effect) |
103 hilightLevel <Integer> level to draw selections (i.e. for 3D effect) |
105 hilightFrameColor <Color> rectangle around highlighted items |
104 hilightFrameColor <Color> rectangle around highlighted items |
106 hilightStyle <Boolean> actions on widget are enabled/disabled |
105 hilightStyle <Boolean> actions on widget are enabled/disabled |
107 strikeOut <Boolean> turn on/off strikeOut mode |
106 strikeOut <Boolean> turn on/off strikeOut mode |
108 |
107 |
109 dropTarget <DropTarget> keeps information about the drop operation |
108 dropTarget <DropTarget> keeps information about the drop operation |
110 dropSource <DropSource> keeps information about the drag operation |
109 dropSource <DropSource> keeps information about the drag operation |
111 |
110 |
112 editorView <View> editor on current selected item |
111 editorView <View> editor on current selected item |
113 openEditorAction <Action> action to get an editor on the current selection from user |
112 openEditorAction <Action> action to get an editor on the current selection from user |
114 closeEditorAction <Action> action invoked before the editor is closed. |
113 closeEditorAction <Action> action invoked before the editor is closed. |
115 |
114 |
116 enterItem <Item/nil> item over which the mouse pointer is located |
115 enterItem <Item/nil> item over which the mouse pointer is located |
117 or nil |
116 or nil |
118 highlightEnterItem <Boolean> enable or disable highlight of enterItem |
117 highlightEnterItem <Boolean> enable or disable highlight of enterItem |
119 |
118 |
120 [author:] |
119 [author:] |
121 Claus Atzkern |
120 Claus Atzkern |
122 |
121 |
123 [see also:] |
122 [see also:] |
124 |
123 |
125 ListModelView |
124 ListModelView |
126 HierarchicalListView |
125 HierarchicalListView |
127 " |
126 " |
128 ! |
127 ! |
129 |
128 |
130 examples |
129 examples |
131 " |
130 " |
512 self selection:nil |
511 self selection:nil |
513 ]. |
512 ]. |
514 multipleSelectOk := false. |
513 multipleSelectOk := false. |
515 ! |
514 ! |
516 |
515 |
517 selectOnButtomMenu |
|
518 <resource: #obsolete> |
|
519 self obsoleteMethodWarning:'use selectOnButtonMenu'. |
|
520 ^ self selectOnButtonMenu |
|
521 ! |
|
522 |
|
523 selectOnButtomMenu:aBoolean |
|
524 <resource: #obsolete> |
|
525 self obsoleteMethodWarning:'use selectOnButtonMenu:'. |
|
526 ^ self selectOnButtonMenu:aBoolean |
|
527 ! |
|
528 |
|
529 selectOnButtonMenu |
516 selectOnButtonMenu |
530 <resource: #obsolete> |
517 <resource: #obsolete> |
531 "define the button-menu-press behavior; if true the line under the mouse |
|
532 will be selected before the menu is opened. Otherwise the menu is opened |
|
533 on the current selection." |
|
534 |
|
535 self obsoleteMethodWarning:'use selectOnMenuButton'. |
518 self obsoleteMethodWarning:'use selectOnMenuButton'. |
536 ^ self selectOnMenuButton |
519 ^ self selectOnMenuButton |
537 ! |
520 ! |
538 |
521 |
539 selectOnButtonMenu:aBoolean |
522 selectOnButtonMenu:aBoolean |
540 <resource: #obsolete> |
523 <resource: #obsolete> |
541 "define the button-menu-press behavior; if true the line under the mouse |
|
542 will be selected before the menu is opened. Otherwise the menu is opened |
|
543 on the current selection." |
|
544 |
|
545 self obsoleteMethodWarning:'use selectOnMenuButton:'. |
524 self obsoleteMethodWarning:'use selectOnMenuButton:'. |
546 self selectOnMenuButton:aBoolean. |
525 self selectOnMenuButton:aBoolean. |
547 ! |
526 ! |
548 |
527 |
549 selectOnButtonPress |
528 selectOnButtonPress |
1335 ! |
1314 ! |
1336 |
1315 |
1337 buttonMultiPress:button x:x y:y |
1316 buttonMultiPress:button x:x y:y |
1338 "button was pressed multiple - handle a doubleClick action" |
1317 "button was pressed multiple - handle a doubleClick action" |
1339 |
1318 |
1340 |lnNr item| |
1319 |lnNr| |
1341 |
1320 |
1342 buttonMotionAction := buttonReleaseAction := nil. |
1321 buttonMotionAction := buttonReleaseAction := nil. |
1343 |
1322 |
1344 enabled ifFalse:[^ self]. |
1323 enabled ifFalse:[^ self]. |
1345 |
1324 |
1346 (button == 1) ifTrue:[ |
1325 (button == 1) ifTrue:[ |
1347 ( (lnNr := self yVisibleToLineNr:y) notNil |
1326 ( (lnNr := self yVisibleToLineNr:y) notNil |
1348 and:[(item := self at:lnNr ifAbsent:nil) notNil] |
1327 and:[(self at:lnNr ifAbsent:nil) notNil] |
1349 ) ifTrue:[ |
1328 ) ifTrue:[ |
1350 self selectedIndex == lnNr ifFalse:[ |
1329 self selectedIndex == lnNr ifFalse:[ |
1351 self breakPoint:#ca |
1330 self breakPoint:#ca |
1352 ]. |
1331 ]. |
1353 self doubleClicked. |
1332 self doubleClicked. |