UIGalleryView.st
author Claus Gittinger <cg@exept.de>
Thu, 24 Jun 1999 19:05:33 +0200
changeset 1149 00b17864e6ef
parent 1142 f5b47cc3e563
child 1337 546e42b47b41
permissions -rw-r--r--
checkin from browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
     1
"
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
     2
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
     3
	      All Rights Reserved
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
     4
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
     5
 This software is furnished under a license and may be used
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    10
 hereby transferred.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    11
"
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    12
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    13
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    14
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    15
NoteBookView subclass:#UIGalleryView
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    16
	instanceVariableNames:'majorKey minorKeys minorKeysHolder'
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    17
	classVariableNames:''
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    18
	poolDictionaries:''
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    19
	category:'Interface-UIPainter'
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    20
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    21
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    22
View subclass:#Canvas
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    23
	instanceVariableNames:'dragMode clientSpecHolder inputView selection specification
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    24
		lastClickPoint menuSelector raiseMenuSelector uiBuilder'
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    25
	classVariableNames:''
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    26
	poolDictionaries:''
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    27
	privateIn:UIGalleryView
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    28
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    29
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    30
DropObject subclass:#DropSpec
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    31
	instanceVariableNames:''
247
b4d3f54f2128 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 240
diff changeset
    32
	classVariableNames:''
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    33
	poolDictionaries:''
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    34
	privateIn:UIGalleryView::Canvas
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    35
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    36
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    37
!UIGalleryView class methodsFor:'documentation'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    38
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    39
copyright
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    40
"
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    41
 COPYRIGHT (c) 1997 by Claus Gittinger / eXept Software AG
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
    42
	      All Rights Reserved
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    43
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    44
 This software is furnished under a license and may be used
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    45
 only in accordance with the terms of that license and with the
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    46
 inclusion of the above copyright notice.   This software may not
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    47
 be provided or otherwise made available to, or used by, any
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    48
 other person.  No title to or ownership of the software is
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    49
 hereby transferred.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    50
"
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    51
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    52
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    53
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    54
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    55
documentation
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    56
"
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    57
    implements a selection panel, keeping widgets which could be placed
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    58
    into other components by drag & drop or copy @ paste. The objects
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    59
    which are draged/droped must be kind of UISpecification's.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    60
    The UISelectionPanel used by the UIPainter is implemented in this way.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    61
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    62
    [author:]
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
    63
	Claus Gittinger
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
    64
	Claus Atzkern
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    65
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    66
    [see also:]
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
    67
	UIPainter
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
    68
	UISelectionPanel
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    69
"
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    70
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    71
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    72
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    73
examples
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    74
"
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    75
    opens a gallery
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    76
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
    77
									[exBegin]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    78
    |top sel|
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    79
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    80
    top := StandardSystemView new label:'gallery'; extent:500@300.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    81
    sel := UIGalleryView origin:0.0 @ 0.0 corner:1.0 @ 1.0 in:top.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    82
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    83
    sel labels:#(    'Buttons'
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
    84
		     'Panels'
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
    85
		     'Text'
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
    86
		   ).
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    87
191
2f66509899a0 change standart to standard
ca
parents: 181
diff changeset
    88
    sel minorKeys:#( #standardButtonToggle
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
    89
		     #standardPanels
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
    90
		     #standardText
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
    91
		   ).
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    92
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    93
    sel majorKey:UISelectionPanel.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    94
    top open.
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
    95
									[exEnd]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    96
"
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    97
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    98
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
    99
!UIGalleryView methodsFor:'accessing'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   100
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   101
builder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   102
    "get the builder used to setup a window from a specification (or nil in case
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   103
     of using a new builder)
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   104
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   105
  ^ canvas builder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   106
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   107
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   108
builder:aBuilderOrNil
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   109
    "set the builder used to setup a window from a specification (or nil in case
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   110
     of using a new builder)
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   111
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   112
    canvas builder:aBuilderOrNil
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   113
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   114
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   115
canvas:aCanvas
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   116
    ^ self
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   117
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   118
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   119
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   120
labels:listOfLabels minorKeys:listOfMinorKeys majorKey:aMajorKey
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   121
    "setup for labels, selectors and class provider
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   122
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   123
    self labels:listOfLabels.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   124
    minorKeys := listOfMinorKeys.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   125
    majorKey  := aMajorKey.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   126
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   127
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   128
majorKey
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   129
    "get the class providing the window specifications
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   130
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   131
  ^ majorKey
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   132
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   133
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   134
majorKey:aKey
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   135
    "get the class providing the window specifications
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   136
    "
335
9f048ededd7d resolveName:
ca
parents: 331
diff changeset
   137
    |appl|
9f048ededd7d resolveName:
ca
parents: 331
diff changeset
   138
9f048ededd7d resolveName:
ca
parents: 331
diff changeset
   139
    appl := self application.
9f048ededd7d resolveName:
ca
parents: 331
diff changeset
   140
9f048ededd7d resolveName:
ca
parents: 331
diff changeset
   141
    appl notNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   142
	majorKey := appl resolveName:aKey
335
9f048ededd7d resolveName:
ca
parents: 331
diff changeset
   143
    ] ifFalse:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   144
	majorKey := Smalltalk resolveName:aKey inClass:self class
335
9f048ededd7d resolveName:
ca
parents: 331
diff changeset
   145
    ].
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   146
    self selection:nil
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   147
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   148
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   149
minorKeys
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   150
    "get the list of selector keys
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   151
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   152
  ^ minorKeys
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   153
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   154
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   155
minorKeys:aListOfSelectors
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   156
    "set the list of selectors
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   157
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   158
    minorKeys := aListOfSelectors.
1140
d0dee47ac385 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
   159
    self selection:nil.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   160
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   161
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   162
!UIGalleryView methodsFor:'accessing holders'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   163
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   164
clientSpecHolder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   165
    "get the holder which keeps the current selection or in case of
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   166
     no selection the specification under the cursor
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   167
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   168
  ^ canvas clientSpecHolder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   169
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   170
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   171
clientSpecHolder:aHolder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   172
    "set the holder which keeps the current selection or in case of
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   173
     no selection the specification under the cursor
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   174
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   175
    canvas clientSpecHolder:aHolder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   176
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   177
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   178
menuSelector
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   179
    ^ canvas menuSelector
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   180
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   182
menuSelector:aSelector
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   183
    ^ canvas menuSelector:aSelector
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   184
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   185
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   186
minorKeysHolder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   187
    "get the holder keeping the minor keys; the selectors to access
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   188
     specifications from a class associated with the majorKey.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   189
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   190
  ^ minorKeysHolder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   191
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   192
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   193
minorKeysHolder:aValueHolder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   194
    "set the holder keeping the minor keys; the selectors to access
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   195
     specifications from a class associated with the majorKey.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   196
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   197
    minorKeysHolder notNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   198
	minorKeysHolder removeDependent:self. 
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   199
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   200
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   201
    (minorKeysHolder := aValueHolder) notNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   202
	minorKeysHolder addDependent:self.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   203
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   204
    self minorKeys:(minorKeysHolder value)
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   205
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   206
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   207
!UIGalleryView methodsFor:'change & update'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   208
1142
f5b47cc3e563 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
   209
selectionHasChanged
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   210
    "selection changed
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   211
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   212
    |specification selector selection application|
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   213
1140
d0dee47ac385 total redeisign
Claus Gittinger <cg@exept.de>
parents: 1130
diff changeset
   214
    selection := self listIndexOf:(self selection).
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   215
683
648ba2c8536e whenever selection changed; reread minorKeys from
ca
parents: 661
diff changeset
   216
    minorKeysHolder notNil ifTrue:[
1128
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   217
        minorKeys := minorKeysHolder value.
683
648ba2c8536e whenever selection changed; reread minorKeys from
ca
parents: 661
diff changeset
   218
    ].
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   219
    (selection notNil and:[minorKeys size >= selection]) ifTrue:[
1128
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   220
        selector := minorKeys at:selection.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   221
1128
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   222
        (majorKey respondsTo:selector) ifTrue:[
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   223
            specification := majorKey perform:selector
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   224
        ] ifFalse:[
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   225
            (application := self application) notNil ifTrue:[
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   226
                Object messageNotUnderstoodSignal handle:[:ex|
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   227
                    (application class respondsTo:selector) ifTrue:[
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   228
                        specification := application class perform:selector
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   229
                    ]
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   230
                ] do:[
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   231
                    specification := application aspectFor:selector
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   232
                ]
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   233
            ]
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   234
        ]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   235
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   236
    canvas specification:specification.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   237
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   238
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   239
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   240
update
1142
f5b47cc3e563 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
   241
    self selectionHasChanged.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   242
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   243
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   244
update:something with:aParameter from:changedObject
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   245
    "one of my models changed its value
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   246
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   247
    changedObject == minorKeysHolder ifTrue:[
1128
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   248
        ^ self minorKeys:( minorKeysHolder value)
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   249
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   250
    super update:something with:aParameter from:changedObject.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   251
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   252
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   253
1113
aec10e7dbe80 category change
Claus Gittinger <cg@exept.de>
parents: 1040
diff changeset
   254
!UIGalleryView methodsFor:'initialize / release'!
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   255
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   256
destroy
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   257
    minorKeysHolder notNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   258
	minorKeysHolder removeDependent:self. 
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   259
	minorKeysHolder := nil.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   260
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   261
    super destroy.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   262
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   263
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   264
initialize
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   265
    "setup default attributes
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   266
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   267
    canvas := Canvas.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   268
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   269
    super initialize.
683
648ba2c8536e whenever selection changed; reread minorKeys from
ca
parents: 661
diff changeset
   270
1142
f5b47cc3e563 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1140
diff changeset
   271
    self action:[:something| self selectionHasChanged ].
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   272
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   273
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   274
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   275
!UIGalleryView::Canvas methodsFor:'accessing'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   276
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   277
builder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   278
    "get the builder used to setup a window from a specification (or nil in case
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   279
     of using a new builder)
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   280
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   281
  ^ uiBuilder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   282
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   283
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   284
builder:something
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   285
    "set the builder used to setup a window from a specification (or nil in case
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   286
     of using a new builder)
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   287
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   288
    uiBuilder := something.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   289
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   290
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   291
clientSpecHolder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   292
    "get the holder which keeps the current selection or in case of
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   293
     no selection the specification under the cursor
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   294
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   295
    ^ clientSpecHolder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   296
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   297
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   298
clientSpecHolder:aHolder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   299
    "set the holder which keeps the current selection or in case of
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   300
     no selection the specification under the cursor
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   301
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   302
    (clientSpecHolder := aHolder) notNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   303
	clientSpecHolder value:selection
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   304
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   305
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   306
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   307
menuSelector
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   308
    "return the value of the instance variable 'menuSelector' (automatically generated)"
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   309
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   310
    ^ menuSelector!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   311
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   312
menuSelector:something
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   313
    "set the value of the instance variable 'menuSelector' (automatically generated)"
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   314
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   315
    menuSelector := something.!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   316
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   317
specification
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   318
    "get current specification
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   319
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   320
   ^ specification
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   321
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   322
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   323
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   324
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   325
specification:aSpecOrSpecArray
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   326
    "set a new specification
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   327
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   328
    |builder|
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   329
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   330
    self selection:nil.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   331
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   332
    self subViews copy do:[:aSubView|
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   333
	aSubView ~~ inputView ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   334
	    aSubView destroy
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   335
	]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   336
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   337
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   338
    aSpecOrSpecArray notNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   339
	specification := UISpecification from:aSpecOrSpecArray.
205
1188254dcbfc bug fix:
ca
parents: 191
diff changeset
   340
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   341
	(specification respondsTo:#buildViewFor:in:) ifFalse:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   342
	    specification := nil.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   343
	  ^ self
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   344
	].
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   345
	(builder := uiBuilder) isNil ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   346
	    builder := UIBuilder new isEditing:true.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   347
	    builder showDefaults:true.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   348
	].
396
e15b7b5bb81b checkin from browser
ca
parents: 335
diff changeset
   349
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   350
	specification buildViewFor:builder in:self.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   351
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   352
	subViews do:[:v|
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   353
	    (v ~~ inputView and:[(self findSpecFor:v) notNil]) ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   354
		v borderWidth:1.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   355
	    ]
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   356
	].
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   357
	self shown ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   358
	    self realizeAllSubViews.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   359
	    inputView raise
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   360
	]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   361
    ] ifFalse:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   362
	specification := nil
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   363
    ]
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   364
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   365
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   366
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   367
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   368
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   369
!UIGalleryView::Canvas methodsFor:'building'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   370
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   371
buildSpecFrom:aSpec
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   372
    "build spec out of spec
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   373
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   374
    |spec comp coll|
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   375
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   376
    (aSpec notNil and:[aSpec canUIDrag]) ifFalse:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   377
	^ nil
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   378
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   379
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   380
    spec := aSpec copy.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   381
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   382
    (aSpec class supportsSubComponents and:[aSpec component notNil]) ifFalse:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   383
	^ spec
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   384
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   385
    comp := aSpec component.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   386
    spec component:nil.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   387
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   388
    comp canUIDrag ifFalse:[
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   389
      ^ spec
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   390
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   391
    coll := OrderedCollection new.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   392
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   393
    comp do:[:anEntry||spc|
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   394
	(spc := self buildSpecFrom:anEntry) notNil ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   395
	    coll add:spc
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   396
	]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   397
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   398
    coll isEmpty ifTrue:[
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   399
      ^ spec
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   400
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   401
    comp := comp copy.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   402
    comp collection:coll.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   403
    spec component:comp.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   404
  ^ spec
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   405
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   406
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   407
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   408
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   409
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   410
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   411
!UIGalleryView::Canvas methodsFor:'drag & drop'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   412
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   413
startDrag
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   414
    "start drag of selection
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   415
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   416
    |dragObj spec name|
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   417
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   418
    spec := self findSpecFor:selection.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   419
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   420
    spec notNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   421
	spec := self buildSpecFrom:spec.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   422
	name := spec className asString.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   423
	name := name copyFrom:1 to:(name size - ('Spec' size) + 1). 
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   424
	name at:1 put:(name at:1) asLowercase.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   425
	name at:(name size) put:$1.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   426
	spec name:name.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   427
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   428
	self showUnselected.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   429
	dragObj := DropSpec for:selection specification:spec.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   430
	"/ self showSelected.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   431
	DragAndDropManager startDrag:dragObj from:inputView.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   432
    ]
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   433
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   434
!
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   435
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   436
startDragWithOffset:offs
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   437
    "start drag of selection
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   438
    "
720
7f228c9cde2e show default widgets for the UISelectionPanel
tz
parents: 683
diff changeset
   439
    |dragObj spec o|
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   440
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   441
    spec := self findSpecFor:selection.
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   442
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   443
    spec notNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   444
	spec := self buildSpecFrom:spec.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   445
	spec name:(spec copy userFriendlyName, $1).
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   446
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   447
	self showUnselected.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   448
	dragObj := DropSpec for:selection specification:spec.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   449
	"/ self showSelected.
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   450
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   451
	o := lastClickPoint - selection origin.
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   452
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   453
	DragAndDropManager 
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   454
	    startDrag:dragObj 
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   455
	    from:inputView
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   456
	    offset:o.
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   457
    ]
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   458
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   459
    "Created: 11.8.1997 / 00:44:17 / cg"
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   460
    "Modified: 11.8.1997 / 00:48:35 / cg"
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   461
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   462
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   463
!UIGalleryView::Canvas methodsFor:'event handling'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   464
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   465
buttonMotion:state x:x y:y
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   466
    "start a drag on selection
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   467
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   468
    |sensor|
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   469
289
7bbe22b39d9b check state for 0 during button motion
ca
parents: 278
diff changeset
   470
    (state ~~ 0 and:[lastClickPoint notNil and:[selection notNil]]) ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   471
	sensor := self sensor.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   472
	sensor anyButtonPressed ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   473
	    (lastClickPoint dist:(x@y)) > 10.0 ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   474
		^ self startDragWithOffset:(x@y) - lastClickPoint
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   475
	    ]
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   476
	]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   477
    ]
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   478
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   479
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   480
buttonPress:button x:x y:y
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   481
    "change selection
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   482
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   483
    |application|
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   484
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   485
    button == 1 ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   486
	lastClickPoint := Point x:x y:y.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   487
	self selection:(self findObjectAtX:x y:y).
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   488
    ]  ifFalse:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   489
	lastClickPoint := nil.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   490
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   491
	(menuSelector notNil and:[(application := self application) notNil]) ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   492
	    Object messageNotUnderstoodSignal handle:[:ex|
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   493
	    ] do:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   494
		application aspectFor:menuSelector
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   495
	    ]
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   496
	]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   497
    ]
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   498
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   499
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   500
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   501
exposeX:x y:y width:w height:h
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   502
    "handle an expose event from device; redraw selection
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   503
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   504
    super exposeX:x y:y width:w height:h.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   505
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   506
    (selection notNil and:[self sensor hasExposeEventFor:selection]) ifFalse:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   507
	self showSelected.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   508
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   509
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   510
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   511
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   512
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   513
!UIGalleryView::Canvas methodsFor:'initialization'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   514
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   515
initialize
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   516
    super initialize.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   517
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   518
    inputView := InputView origin:0.0@0.0 extent:1.0@1.0 in:self.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   519
    inputView eventReceiver:self.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   520
    inputView enableButtonEvents.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   521
    inputView enableButtonMotionEvents.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   522
    inputView enableMotionEvents.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   523
897
43f9bdc12ae4 make certain inputView is on top when restarting from a snapshot
Claus Gittinger <cg@exept.de>
parents: 806
diff changeset
   524
    "Modified: / 20.7.1998 / 18:12:38 / cg"
1128
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   525
!
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   526
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   527
mapped
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   528
    super mapped.
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   529
    inputView raise.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   530
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   531
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   532
!UIGalleryView::Canvas methodsFor:'searching'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   533
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   534
findObjectAtX:x y:y
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   535
    "find the origin/corner of the currentWidget
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   536
    "
239
ce46eb6f92a5 do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   537
    |point id p|
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   538
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   539
    point := Point x:x y:y.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   540
    id    := inputView id.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   541
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   542
    subViews do:[:v|
239
ce46eb6f92a5 do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   543
	|pX pY|
ce46eb6f92a5 do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   544
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   545
	v ~~ inputView ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   546
	    p := device translatePoint:point from:id to:(v id).
239
ce46eb6f92a5 do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   547
	    pX := p x.
ce46eb6f92a5 do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   548
	    pY := p y.
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   549
	    (     pX >= 0 and:[pX <= v width
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   550
	     and:[pY >= 0 and:[pY <= v height
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   551
	     and:[(self findSpecFor:v) notNil]]]]
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   552
	    ) ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   553
		^ v
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   554
	    ]
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   555
	]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   556
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   557
  ^ nil
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   558
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   559
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   560
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   561
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   562
findSpecFor:anObject
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   563
    "returns subspec assigned to instance or nil
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   564
    "
239
ce46eb6f92a5 do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   565
    |name|
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   566
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   567
    anObject notNil ifTrue:[
1127
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   568
        name := anObject name.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   569
1127
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   570
        specification do:[:aSpec|
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   571
            aSpec notNil ifTrue:[
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   572
                aSpec name = name ifTrue:[
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   573
                    aSpec canUIDrag ifTrue:[^ aSpec]
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   574
                                   ifFalse:[^ nil]
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   575
                ]
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   576
            ]
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   577
        ]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   578
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   579
    ^ nil
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   580
1127
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   581
    "Modified: / 18.5.1999 / 14:47:25 / cg"
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   582
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   583
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   584
!UIGalleryView::Canvas methodsFor:'selection'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   585
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   586
handlesOf:aComponent do:aOneArgBlock
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   587
    "evaluate the block on each handle; the argument to the block
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   588
     is a rectangle
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   589
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   590
    aComponent notNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   591
	aOneArgBlock value:(aComponent origin       - (2@2) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   592
	aOneArgBlock value:(aComponent corner       - (1@1) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   593
	aOneArgBlock value:(aComponent topRight     - (1@2) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   594
	aOneArgBlock value:(aComponent bottomLeft   - (2@1) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   595
	aOneArgBlock value:(aComponent leftCenter   - (2@0) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   596
	aOneArgBlock value:(aComponent rightCenter  - (1@0) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   597
	aOneArgBlock value:(aComponent topCenter    - (0@2) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   598
	aOneArgBlock value:(aComponent bottomCenter - (0@1) extent:6@6).
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   599
    ]
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   600
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   601
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   602
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   603
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   604
selection:anObject
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   605
    "selection changed
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   606
    "
239
ce46eb6f92a5 do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   607
    |spec|
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   608
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   609
    selection ~~ anObject ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   610
	self showUnselected.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   611
	spec := self findSpecFor:anObject.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   612
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   613
	spec notNil ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   614
	    selection := anObject.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   615
	    self showSelected
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   616
	] ifFalse:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   617
	    selection := nil
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   618
	].
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   619
	clientSpecHolder notNil ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   620
	    clientSpecHolder value:spec
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   621
	]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   622
    ]
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   623
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   624
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   625
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   626
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   627
showSelected
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   628
    "show selected
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   629
    "
994
29bfed6efe87 dont reselect after startDrag.
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
   630
    shown ifFalse:[^ self].
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   631
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   632
    selection notNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   633
	self clippedByChildren:false.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   634
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   635
	self handlesOf:selection do:[:aRectangle|
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   636
	    self fillRectangle:aRectangle
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   637
	].
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   638
	self clippedByChildren:true.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   639
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   640
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   641
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   642
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   643
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   644
showUnselected
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   645
    "show unselected
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   646
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   647
    |r currSel|
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   648
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   649
    (currSel := selection) isNil ifTrue:[
1130
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   650
        ^ self
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   651
    ].
994
29bfed6efe87 dont reselect after startDrag.
Claus Gittinger <cg@exept.de>
parents: 897
diff changeset
   652
    shown ifFalse:[^ self].
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   653
    selection := nil.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   654
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   655
    self clippedByChildren:false.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   656
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   657
    self handlesOf:currSel do:[:aRectangle|
1130
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   658
        self clearRectangle:aRectangle
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   659
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   660
    self clippedByChildren:true.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   661
    r := currSel bounds.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   662
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   663
    subViews do:[:sv|
1130
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   664
        |absOrg absFrame|
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   665
1130
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   666
        sv ~~ inputView ifTrue:[
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   667
            (sv bounds intersects:r) ifTrue:[
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   668
                sv borderColor:(Color white).           "/ to force a redraw
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   669
                sv borderColor:(Color black).
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   670
1130
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   671
                sv withAllSubViewsDo:[:v|
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   672
                    v realized ifTrue:[
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   673
                        v fill:v viewBackground.
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   674
                        v exposeX:0 y:0 width:v width height:v height.
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   675
                    ]
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   676
                ]
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   677
            ]
7ab9098da7bd redraw the border when unselecting the element
Claus Gittinger <cg@exept.de>
parents: 1129
diff changeset
   678
        ]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   679
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   680
    selection := currSel.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   681
1017
4bfffe913f94 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 994
diff changeset
   682
    "Modified: / 9.11.1998 / 12:49:57 / cg"
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   683
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   684
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   685
!UIGalleryView::Canvas::DropSpec class methodsFor:'instance creation'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   686
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   687
for:aView specification:aSpec
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   688
    "create drop object for a view derived from a specification
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   689
    "
806
4faf081e981d add displayObject for dragging
ca
parents: 720
diff changeset
   690
    |point extent root device inst displayObject|
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   691
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   692
    device := aView device.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   693
    root   := device rootView.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   694
    extent := aView extent.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   695
    point  := device translatePoint:0@0 from:(aView id) to:(root id).
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   696
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   697
    (point x > 0 and:[point y > 0]) ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   698
	point := point + extent.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   699
	(point x < root width and:[point y < root height]) ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   700
	    aView topView raise.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   701
	    device sync.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   702
	    aView invalidate.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   703
	    aView windowGroup processExposeEvents.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   704
	    displayObject := Image fromView:aView grab:false.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   705
	]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   706
    ].
806
4faf081e981d add displayObject for dragging
ca
parents: 720
diff changeset
   707
    displayObject isNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   708
	displayObject := Form extent:extent depth:1.
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   709
	displayObject colorMap:(Array with:Color white with:Color black).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   710
	displayObject fill:(Color colorId:0).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   711
	displayObject paint:(Color colorId:1).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   712
	displayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   713
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   714
    aSpec class == UISubSpecification ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   715
	aSpec layout:(LayoutOrigin fromPoint:0@0)
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   716
    ].
240
3f0dfabbb14d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
   717
806
4faf081e981d add displayObject for dragging
ca
parents: 720
diff changeset
   718
    inst := self new.
4faf081e981d add displayObject for dragging
ca
parents: 720
diff changeset
   719
    inst displayObject:displayObject.
4faf081e981d add displayObject for dragging
ca
parents: 720
diff changeset
   720
    inst theObject:aSpec.
4faf081e981d add displayObject for dragging
ca
parents: 720
diff changeset
   721
  ^ inst.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   722
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   723
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   724
!UIGalleryView class methodsFor:'documentation'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   725
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   726
version
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   727
    ^ '$Header$'
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   728
! !