UIGalleryView.st
author Claus Gittinger <cg@exept.de>
Mon, 06 Mar 2006 09:49:01 +0100
changeset 2022 746cc87a768e
parent 1895 b7d6683ebaca
child 2199 c542a84adeb6
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
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
    25
	instanceVariableNames:'clientSpecHolder selection specification lastClickPoint
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
    26
		menuSelector uiBuilder hiddenCounter'
181
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
    "
1729
cf1c2f488ba8 oops - do not mix class & instance in canvas-slot
Claus Gittinger <cg@exept.de>
parents: 1675
diff changeset
   262
    canvas := Canvas in:self.
181
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 ].
1582
912fdf2e44a8 destroy - release
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   267
!
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
release
912fdf2e44a8 destroy - release
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   270
    minorKeysHolder notNil ifTrue:[
912fdf2e44a8 destroy - release
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   271
        minorKeysHolder removeDependent:self. 
912fdf2e44a8 destroy - release
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   272
        minorKeysHolder := nil.
912fdf2e44a8 destroy - release
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   273
    ].
912fdf2e44a8 destroy - release
Claus Gittinger <cg@exept.de>
parents: 1576
diff changeset
   274
    super release.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   275
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   276
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   277
!UIGalleryView::Canvas methodsFor:'accessing'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   278
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   279
builder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   280
    "get the builder used to setup a window from a specification (or nil in case
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   281
     of using a new builder)
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   282
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   283
  ^ uiBuilder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   284
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   285
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   286
builder:something
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   287
    "set the builder used to setup a window from a specification (or nil in case
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   288
     of using a new builder)
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   289
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   290
    uiBuilder := something.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   291
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   292
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   293
clientSpecHolder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   294
    "get the holder which keeps the current selection or in case of
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   295
     no selection the specification under the cursor
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   296
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   297
    ^ clientSpecHolder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   298
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   299
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   300
clientSpecHolder:aHolder
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   301
    "set the holder which keeps the current selection or in case of
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   302
     no selection the specification under the cursor
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   303
    "
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   304
    |spec|
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   305
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   306
    spec := clientSpecHolder value.
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   307
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   308
    aHolder notNil ifTrue:[ clientSpecHolder := aHolder ]
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   309
                  ifFalse:[ clientSpecHolder := nil asValue ].
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   310
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   311
    clientSpecHolder value:spec.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   312
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   313
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   314
menuSelector
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   315
    "return the value of the instance variable 'menuSelector' (automatically generated)"
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   316
1455
5d4d3c5ca76c Button select is identical to button 1.
Stefan Vogel <sv@exept.de>
parents: 1399
diff changeset
   317
    ^ menuSelector
5d4d3c5ca76c Button select is identical to button 1.
Stefan Vogel <sv@exept.de>
parents: 1399
diff changeset
   318
!
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   319
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   320
menuSelector:something
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   321
    "set the value of the instance variable 'menuSelector' (automatically generated)"
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   322
1455
5d4d3c5ca76c Button select is identical to button 1.
Stefan Vogel <sv@exept.de>
parents: 1399
diff changeset
   323
    menuSelector := something.
5d4d3c5ca76c Button select is identical to button 1.
Stefan Vogel <sv@exept.de>
parents: 1399
diff changeset
   324
!
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   325
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   326
specification
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   327
    "get current specification
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   328
    "
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   329
    ^ specification
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   330
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   331
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   332
specification:aSpecOrSpecArray
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   333
    "set a new specification
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   334
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   335
    |builder|
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   336
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   337
    self selection:nil.
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   338
    self destroySubViews.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   339
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   340
    (     aSpecOrSpecArray notNil
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   341
     and:[(specification := UISpecification from:aSpecOrSpecArray) notNil
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   342
     and:[specification respondsTo:#'buildViewFor:in:']]
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   343
    ) ifFalse:[
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   344
        specification := nil.
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   345
        ^ self
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   346
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   347
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   348
    (builder := uiBuilder) isNil ifTrue:[
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   349
        builder := UIBuilder new isEditing:true.
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   350
        builder showDefaults:true.
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   351
    ].
205
1188254dcbfc bug fix:
ca
parents: 191
diff changeset
   352
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   353
    specification buildViewFor:builder in:self.
396
e15b7b5bb81b checkin from browser
ca
parents: 335
diff changeset
   354
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   355
    subViews size ~~ 0 ifTrue:[
1561
dde6c4539acd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1501
diff changeset
   356
        subViews do:[:v|
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   357
            (self findSpecFor:v) notNil ifTrue:[
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   358
                v borderWidth:1
1561
dde6c4539acd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1501
diff changeset
   359
            ]
dde6c4539acd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1501
diff changeset
   360
        ].
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   361
        realized ifTrue:[ self realizeAllSubViews ].
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   362
    ].
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
!UIGalleryView::Canvas methodsFor:'building'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   366
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   367
buildSpecFrom:aSpec
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   368
    "build spec out of spec
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   369
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   370
    |spec comp coll|
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   371
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   372
    (aSpec notNil and:[aSpec canUIDrag]) ifFalse:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   373
	^ nil
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   374
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   375
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   376
    spec := aSpec copy.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   377
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   378
    (aSpec class supportsSubComponents and:[aSpec component notNil]) ifFalse:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   379
	^ spec
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   380
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   381
    comp := aSpec component.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   382
    spec component:nil.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   383
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   384
    comp canUIDrag ifFalse:[
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   385
      ^ spec
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   386
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   387
    coll := OrderedCollection new.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   388
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   389
    comp do:[:anEntry||spc|
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   390
	(spc := self buildSpecFrom:anEntry) notNil ifTrue:[
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   391
	    coll add:spc
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   392
	]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   393
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   394
    coll isEmpty ifTrue:[
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   395
      ^ spec
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   396
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   397
    comp := comp copy.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   398
    comp collection:coll.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   399
    spec component:comp.
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   400
  ^ spec
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   401
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   402
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   403
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   404
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   405
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   406
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   407
!UIGalleryView::Canvas methodsFor:'drag & drop'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   408
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   409
startDragFrom:evView
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   410
    "start drag at a point
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   411
    "
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   412
    |spec dragObj offset clickPos|
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   413
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   414
    clickPos := lastClickPoint.
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   415
    clickPos isNil ifTrue:[^ self].
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   416
    lastClickPoint := nil.
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   417
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   418
    spec := clientSpecHolder value.
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   419
    spec isNil ifTrue:[^ self].
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   420
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   421
    self selectionHiddenDo:[
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   422
        spec := self buildSpecFrom:spec.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   423
        spec name:nil.
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   424
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   425
        dragObj := DropSpec for:selection specification:spec.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   426
        offset  := clickPos - selection origin.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   427
    ].
278
5b7dfe33b497 drag & drop offset
Claus Gittinger <cg@exept.de>
parents: 247
diff changeset
   428
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   429
    DragAndDropManager startDrag:dragObj from:evView offset:offset.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   430
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   431
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   432
!UIGalleryView::Canvas methodsFor:'event handling'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   433
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   434
processEvent:anEvent
1895
b7d6683ebaca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   435
    "filter keyboard events.
b7d6683ebaca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   436
     Return true, if I have eaten the event"
b7d6683ebaca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1729
diff changeset
   437
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   438
    |evView p|
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   439
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   440
    evView := anEvent view.
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   441
    evView isNil ifTrue:[ ^ false ].
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   442
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   443
    evView == self ifFalse:[
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   444
        (evView isComponentOf:self) ifFalse:[ ^ false ].
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   445
    ].
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   446
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   447
    anEvent isButtonEvent ifFalse:[
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   448
        anEvent isInputEvent ifTrue:[^ true].
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   449
        anEvent isDamage ifTrue:[ self redrawSelection ].
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   450
        ^ false
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   451
    ].
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   452
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   453
    anEvent isButtonReleaseEvent ifTrue:[
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   454
        lastClickPoint := nil.
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   455
        ^ true
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   456
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   457
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   458
    anEvent isButtonMotionEvent ifTrue:[
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   459
        (lastClickPoint notNil and:[anEvent state ~~ 0]) ifTrue:[
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   460
            p := Point x:(anEvent x) y:(anEvent y).
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   461
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   462
            (lastClickPoint dist:p) > 10.0 ifTrue:[
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   463
                self startDragFrom:evView.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   464
                lastClickPoint := nil.
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   465
            ]
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   466
        ].
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   467
        ^ true
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   468
    ].
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   469
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   470
    anEvent isButtonPressEvent ifTrue:[ |button application|
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   471
        button := anEvent button.
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   472
        lastClickPoint := nil.
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   473
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   474
        (button == 1 or:[button == #select]) ifTrue:[
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   475
            p := Point x:(anEvent x) y:(anEvent y).
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   476
            p := device translatePoint:p fromView:evView toView:self.
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   477
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   478
            self selection:(self findObjectAt:p).
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   479
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   480
            selection notNil ifTrue:[
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   481
                lastClickPoint := p
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   482
            ]
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   483
        ] ifFalse:[
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   484
            (menuSelector notNil and:[(application := self application) notNil]) ifTrue:[
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   485
                MessageNotUnderstood catch:[
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   486
                    application aspectFor:menuSelector
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   487
                ]
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   488
            ]
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   489
        ].
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   490
        ^ true
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   491
    ].
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   492
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   493
    ^ true
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   494
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   495
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   496
!UIGalleryView::Canvas methodsFor:'initialization'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   497
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   498
initialize
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   499
    super initialize.
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   500
    clientSpecHolder := nil asValue.
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   501
    hiddenCounter := 0.
1128
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   502
!
69bd579838f7 mapped:
Claus Gittinger <cg@exept.de>
parents: 1127
diff changeset
   503
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   504
realize
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   505
    super realize.
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   506
    self windowGroup addPreEventHook:self.
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   507
! !
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   508
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   509
!UIGalleryView::Canvas methodsFor:'searching'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   510
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   511
findObjectAt:aPoint
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   512
    "find the origin/corner of the currentWidget
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   513
    "
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   514
    |p x y|
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   515
1673
5ec4b63a862a *** empty log message ***
ca
parents: 1671
diff changeset
   516
    subViews size == 0 ifTrue:[^ nil].
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   517
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   518
    subViews do:[:v|
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   519
        p := device translatePoint:aPoint fromView:self toView:v.
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   520
        x := p x.
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   521
        y := p y.
239
ce46eb6f92a5 do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   522
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   523
        (     x >= 0 and:[x <= v width
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   524
         and:[y >= 0 and:[y <= v height
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   525
         and:[(self findSpecFor:v) notNil]]]]
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   526
        ) ifTrue:[
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   527
            ^ v
1501
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   528
        ]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   529
    ].
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   530
    ^ nil
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   531
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   532
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   533
findSpecFor:aView
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   534
    "returns subspec assigned to instance or nil
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   535
    "
239
ce46eb6f92a5 do not clobber the global named DisplayObject - shame on ca.
Claus Gittinger <cg@exept.de>
parents: 205
diff changeset
   536
    |name|
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   537
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   538
    aView notNil ifTrue:[
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   539
        name := aView name.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   540
1127
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   541
        specification do:[:aSpec|
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   542
            (aSpec notNil and:[aSpec name = name]) ifTrue:[
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   543
                aSpec canUIDrag ifTrue:[^ aSpec ].
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   544
                ^ nil
1127
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   545
            ]
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   546
        ]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   547
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   548
    ^ nil
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   549
1127
41253026b070 ignore nil-specs, as encountered when a specClass
Claus Gittinger <cg@exept.de>
parents: 1120
diff changeset
   550
    "Modified: / 18.5.1999 / 14:47:25 / cg"
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   551
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   552
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   553
!UIGalleryView::Canvas methodsFor:'selection'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   554
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   555
handlesOf:aComponent do:aOneArgBlock
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   556
    "evaluate the block on each handle; the argument to the block
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   557
     is a rectangle
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   558
    "
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   559
    aComponent notNil ifTrue:[
1120
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   560
	aOneArgBlock value:(aComponent origin       - (2@2) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   561
	aOneArgBlock value:(aComponent corner       - (1@1) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   562
	aOneArgBlock value:(aComponent topRight     - (1@2) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   563
	aOneArgBlock value:(aComponent bottomLeft   - (2@1) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   564
	aOneArgBlock value:(aComponent leftCenter   - (2@0) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   565
	aOneArgBlock value:(aComponent rightCenter  - (1@0) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   566
	aOneArgBlock value:(aComponent topCenter    - (0@2) extent:6@6).
230fe13c4e51 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1113
diff changeset
   567
	aOneArgBlock value:(aComponent bottomCenter - (0@1) extent:6@6).
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   568
    ]
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   569
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   570
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   571
!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   572
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   573
redrawSelection
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   574
    "redraw all items selected
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   575
    "
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   576
    (shown and:[selection notNil and:[hiddenCounter == 0]]) ifTrue:[
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   577
        self clippedByChildren:false.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   578
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   579
        self handlesOf:selection do:[:aRectangle|
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   580
            self fillRectangle:aRectangle
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   581
        ].
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   582
        self clippedByChildren:true.
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   583
    ].
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   584
!
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   585
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   586
selection:aView
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   587
    "selection changed
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   588
    "
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   589
    |spec|
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   590
1674
ed8aa80a11a9 *** empty log message ***
ca
parents: 1673
diff changeset
   591
    selection == aView ifTrue:[^ self].
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   592
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   593
    self selectionHiddenDo:[
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   594
        spec := self findSpecFor:aView.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   595
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   596
        spec notNil ifTrue:[ selection := aView ]
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   597
                   ifFalse:[ selection := nil ].
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   598
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   599
        clientSpecHolder value:spec.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   600
    ].
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   601
!
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   602
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   603
selectionHiddenDo:aOneArgBlock
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   604
    |r|
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   605
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   606
    [   hiddenCounter :=  hiddenCounter + 1.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   607
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   608
        hiddenCounter == 1 ifTrue:[
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   609
            (shown and:[selection notNil]) ifTrue:[
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   610
                self clippedByChildren:false.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   611
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   612
                self handlesOf:selection do:[:aRectangle|
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   613
                    self clearRectangle:aRectangle
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   614
                ].
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   615
                self clippedByChildren:true.
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   616
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   617
                r := selection bounds.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   618
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   619
                subViews do:[:sv|
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   620
                    |absOrg absFrame|
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   621
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   622
                    (sv bounds intersects:r) ifTrue:[
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   623
                        sv borderColor:(Color white).           "/ to force a redraw
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   624
                        sv borderColor:(Color black).
1671
493e0430518e no longer use InputView
ca
parents: 1582
diff changeset
   625
1675
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   626
                        sv withAllSubViewsDo:[:v|
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   627
                            v realized ifTrue:[
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   628
                                v fill:v viewBackground.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   629
                                v exposeX:0 y:0 width:v width height:v height.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   630
                            ]
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   631
                        ]
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   632
                    ]
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   633
                ]
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   634
            ].
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   635
        ].
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   636
        aOneArgBlock value.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   637
    ] ensure:[
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   638
        hiddenCounter := hiddenCounter - 1.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   639
        self redrawSelection.
9e7465c57509 drag & drop mechanism
ca
parents: 1674
diff changeset
   640
    ].
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   641
! !
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   642
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   643
!UIGalleryView::Canvas::DropSpec class methodsFor:'instance creation'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   644
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   645
for:aView specification:aSpec
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   646
    "create drop object for a view derived from a specification
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   647
    "
1501
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   648
    |point extent rootView device inst displayObject|
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   649
1501
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   650
    device   := aView device.
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   651
    rootView := device rootView.
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   652
    extent   := aView extent.
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   653
    point    := device translatePoint:0@0 fromView:aView toView:rootView.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   654
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   655
    (point x > 0 and:[point y > 0]) ifTrue:[
1501
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   656
        point := point + extent.
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   657
        (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
   658
            aView topView raise.
1568
a9d61da29e8b no need for device sync - flush will do
Claus Gittinger <cg@exept.de>
parents: 1561
diff changeset
   659
            device flush.
1501
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   660
            aView invalidate.
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   661
            aView windowGroup processExposeEvents.
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   662
            displayObject := Image fromView:aView grab:false.
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   663
        ]
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   664
    ].
806
4faf081e981d add displayObject for dragging
ca
parents: 720
diff changeset
   665
    displayObject isNil ifTrue:[
1501
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   666
        displayObject := Form extent:extent depth:1.
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   667
        displayObject colorMap:(Array with:Color white with:Color black).
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   668
        displayObject fill:(Color colorId:0).
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   669
        displayObject paint:(Color colorId:1).
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   670
        displayObject displayRectangleX:0 y:0 width:aView extent x height:aView extent y.
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   671
    ].
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   672
    aSpec class == UISubSpecification ifTrue:[
1501
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   673
        aSpec layout:(LayoutOrigin fromPoint:0@0)
181
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   674
    ].
240
3f0dfabbb14d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 239
diff changeset
   675
806
4faf081e981d add displayObject for dragging
ca
parents: 720
diff changeset
   676
    inst := self new.
4faf081e981d add displayObject for dragging
ca
parents: 720
diff changeset
   677
    inst displayObject:displayObject.
4faf081e981d add displayObject for dragging
ca
parents: 720
diff changeset
   678
    inst theObject:aSpec.
4faf081e981d add displayObject for dragging
ca
parents: 720
diff changeset
   679
  ^ inst.
1501
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   680
f760ccab7a35 use new #translatePoint:fromView:toView:
Claus Gittinger <cg@exept.de>
parents: 1455
diff changeset
   681
    "Modified: / 10.10.2001 / 14:03:00 / 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 class methodsFor:'documentation'!
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   685
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   686
version
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   687
    ^ '$Header$'
e0a85c343cb7 intitial checkin
ca
parents:
diff changeset
   688
! !