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