author | Claus Gittinger <cg@exept.de> |
Wed, 13 Feb 2019 23:39:57 +0100 | |
changeset 18587 | dc3e84f464fc |
parent 18449 | 12de5f12886f |
child 18588 | 9790ae89ebee |
permissions | -rw-r--r-- |
18315 | 1 |
"{ Encoding: utf8 }" |
2 |
||
12908 | 3 |
" |
4 |
COPYRIGHT (c) 2013 by Claus Gittinger |
|
5 |
All Rights Reserved |
|
6 |
||
7 |
This software is furnished under a license and may be used |
|
8 |
only in accordance with the terms of that license and with the |
|
9 |
inclusion of the above copyright notice. This software may not |
|
10 |
be provided or otherwise made available to, or used by, any |
|
11 |
other person. No title to or ownership of the software is |
|
12 |
hereby transferred. |
|
13 |
" |
|
14 |
"{ Package: 'stx:libtool' }" |
|
15 |
||
18315 | 16 |
"{ NameSpace: Smalltalk }" |
17 |
||
12908 | 18 |
View subclass:#CodeCompletionHelpView |
18320 | 19 |
instanceVariableNames:'myView editView delayedCloseAction' |
12908 | 20 |
classVariableNames:'' |
21 |
poolDictionaries:'' |
|
22 |
category:'Interface-Help' |
|
23 |
! |
|
24 |
||
25 |
!CodeCompletionHelpView class methodsFor:'documentation'! |
|
26 |
||
27 |
copyright |
|
28 |
" |
|
29 |
COPYRIGHT (c) 2013 by Claus Gittinger |
|
30 |
All Rights Reserved |
|
31 |
||
32 |
This software is furnished under a license and may be used |
|
33 |
only in accordance with the terms of that license and with the |
|
34 |
inclusion of the above copyright notice. This software may not |
|
35 |
be provided or otherwise made available to, or used by, any |
|
36 |
other person. No title to or ownership of the software is |
|
37 |
hereby transferred. |
|
38 |
" |
|
39 |
! |
|
40 |
||
41 |
documentation |
|
42 |
" |
|
13479 | 43 |
used with code completion suggestions |
12908 | 44 |
|
45 |
[author:] |
|
46 |
Claus Gittinger |
|
47 |
||
48 |
[See also:] |
|
13479 | 49 |
ActiveHelp Workspace::CodeCompletionService |
12908 | 50 |
" |
51 |
! ! |
|
52 |
||
53 |
!CodeCompletionHelpView class methodsFor:'instance creation'! |
|
54 |
||
55 |
with:aView |
|
56 |
"create a talking-view wrapping some other view" |
|
57 |
||
58 |
^ self new withView:aView |
|
59 |
||
60 |
" |
|
61 |
(ActiveHelpView with:(TextView new)) realize |
|
62 |
(ActiveHelpView with:(TextView new)) open |
|
63 |
(ActiveHelpView with:(Button label:'ok')) open |
|
64 |
" |
|
65 |
||
66 |
"Modified: 27.4.1996 / 15:14:18 / cg" |
|
67 |
! ! |
|
68 |
||
69 |
!CodeCompletionHelpView methodsFor:'accessing'! |
|
70 |
||
14152
b13faf727c2c
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13670
diff
changeset
|
71 |
editView:aView |
b13faf727c2c
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13670
diff
changeset
|
72 |
editView := aView |
b13faf727c2c
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13670
diff
changeset
|
73 |
! |
b13faf727c2c
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13670
diff
changeset
|
74 |
|
12908 | 75 |
withView:aView |
76 |
"set the component view" |
|
77 |
||
78 |
|fg| |
|
79 |
||
80 |
(aView isKindOf:Label) ifTrue:[ |
|
81 |
aView viewBackground:viewBackground. |
|
82 |
aView backgroundColor:viewBackground. |
|
83 |
(fg := styleSheet colorAt:#'activeHelp.foregroundColor' default:nil) notNil ifTrue:[ |
|
84 |
aView foregroundColor:fg. |
|
85 |
]. |
|
86 |
]. |
|
87 |
self addSubView:aView. |
|
88 |
myView := aView. |
|
89 |
myView borderWidth:0. |
|
90 |
myView origin:(0.0@0.0) corner:(1.0@1.0). |
|
91 |
||
92 |
"Modified: 27.4.1996 / 15:16:46 / cg" |
|
93 |
! ! |
|
94 |
||
18315 | 95 |
!CodeCompletionHelpView methodsFor:'event handling'! |
96 |
||
18320 | 97 |
delayedClose |
98 |
self delayedUnmap |
|
99 |
||
100 |
"Created: / 05-08-2018 / 03:16:26 / Claus Gittinger" |
|
101 |
! |
|
102 |
||
18319 | 103 |
delayedDestroy |
104 |
(subViews notEmptyOrNil) ifTrue:[ |
|
105 |
self topView destroy |
|
106 |
]. |
|
107 |
^ true |
|
108 |
||
109 |
"Created: / 04-08-2018 / 21:25:48 / Claus Gittinger" |
|
110 |
! |
|
111 |
||
18320 | 112 |
delayedUnmap |
113 |
(subViews notEmptyOrNil) ifTrue:[ |
|
114 |
self topView unmap |
|
115 |
]. |
|
116 |
^ true |
|
117 |
||
118 |
"Created: / 05-08-2018 / 03:12:39 / Claus Gittinger" |
|
119 |
! |
|
120 |
||
18315 | 121 |
focusOut |
18320 | 122 |
self installDelayedClose. |
18315 | 123 |
|
124 |
"Created: / 04-08-2018 / 10:41:59 / Claus Gittinger" |
|
18320 | 125 |
"Modified: / 05-08-2018 / 03:12:58 / Claus Gittinger" |
18315 | 126 |
! |
127 |
||
18316 | 128 |
handlesButtonMotion:state inView:aView |
129 |
^ false |
|
130 |
||
131 |
"Created: / 04-08-2018 / 16:55:09 / Claus Gittinger" |
|
132 |
! |
|
133 |
||
134 |
handlesButtonPress:state inView:aView |
|
135 |
^ false |
|
136 |
||
137 |
"Created: / 04-08-2018 / 16:55:20 / Claus Gittinger" |
|
138 |
! |
|
139 |
||
140 |
handlesButtonRelease:state inView:aView |
|
141 |
^ false |
|
142 |
||
143 |
"Created: / 04-08-2018 / 16:55:24 / Claus Gittinger" |
|
144 |
! |
|
145 |
||
146 |
handlesKeyPress:key inView:aView |
|
147 |
^ true |
|
148 |
||
149 |
"Created: / 04-08-2018 / 16:54:44 / Claus Gittinger" |
|
150 |
! |
|
151 |
||
152 |
handlesKeyRelease:key inView:aView |
|
153 |
^ false |
|
154 |
||
155 |
"Created: / 04-08-2018 / 16:54:54 / Claus Gittinger" |
|
156 |
! |
|
157 |
||
158 |
handlesPointerEnter:state inView:aView |
|
159 |
^ true |
|
160 |
||
161 |
"Created: / 04-08-2018 / 16:55:49 / Claus Gittinger" |
|
162 |
! |
|
163 |
||
164 |
handlesPointerLeave:state inView:aView |
|
165 |
^ true |
|
166 |
||
167 |
"Created: / 04-08-2018 / 16:55:53 / Claus Gittinger" |
|
168 |
! |
|
169 |
||
18320 | 170 |
installDelayedClose |
171 |
delayedCloseAction notNil ifTrue:[ |
|
172 |
Processor removeTimedBlock:delayedCloseAction. |
|
18319 | 173 |
]. |
18320 | 174 |
delayedCloseAction := [ self delayedClose ]. |
18587 | 175 |
Processor addTimedBlock:delayedCloseAction for:nil after:0.5. |
18315 | 176 |
|
18320 | 177 |
"Created: / 05-08-2018 / 03:13:23 / Claus Gittinger" |
18587 | 178 |
"Modified: / 13-02-2019 / 23:39:47 / Claus Gittinger" |
18316 | 179 |
! |
180 |
||
181 |
keyPress:key x:x y:y view:aView |
|
18319 | 182 |
key == #Escape ifTrue:[ |
18449 | 183 |
self delayedClose. |
184 |
^ true. |
|
185 |
]. |
|
186 |
( #( CursorUp CursorDown Return ) includes:key) ifFalse:[ |
|
18320 | 187 |
self installDelayedClose. |
18319 | 188 |
^ true. |
18449 | 189 |
]. |
190 |
||
18319 | 191 |
"/ (subViews notNil and:[aView == (subViews firstIfEmpty:nil)]) ifTrue:[ |
192 |
"/ self topView destroy |
|
193 |
"/ ]. |
|
194 |
^ false |
|
18316 | 195 |
|
196 |
"Created: / 04-08-2018 / 17:00:33 / Claus Gittinger" |
|
18449 | 197 |
"Modified: / 08-10-2018 / 08:36:52 / Claus Gittinger" |
18316 | 198 |
! |
199 |
||
200 |
pointerEnter:state x:x y:y view:view |
|
18320 | 201 |
delayedCloseAction notNil ifTrue:[ |
202 |
Processor removeTimedBlock:delayedCloseAction. |
|
18316 | 203 |
]. |
204 |
^ false |
|
205 |
||
206 |
"Created: / 04-08-2018 / 17:01:39 / Claus Gittinger" |
|
207 |
! |
|
208 |
||
209 |
pointerLeave:state view:view |
|
18320 | 210 |
self installDelayedClose. |
18316 | 211 |
^ false |
212 |
||
213 |
"Created: / 04-08-2018 / 16:57:18 / Claus Gittinger" |
|
18320 | 214 |
"Modified: / 05-08-2018 / 03:13:46 / Claus Gittinger" |
18315 | 215 |
! ! |
216 |
||
12908 | 217 |
!CodeCompletionHelpView methodsFor:'initialization'! |
218 |
||
219 |
initStyle |
|
220 |
"setup viewStyle specifics" |
|
221 |
||
13670
43d2d7c37e61
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
222 |
<resource: #style ( |
43d2d7c37e61
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
223 |
"/ #'activeHelp.backgroundColor' |
12908 | 224 |
#'activeHelp.borderWidth' |
13670
43d2d7c37e61
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
225 |
"/ #'activeHelp.font' |
43d2d7c37e61
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
226 |
)> |
12908 | 227 |
|
228 |
|defaultFont| |
|
229 |
||
230 |
super initStyle. |
|
231 |
||
13670
43d2d7c37e61
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
232 |
"/ defaultFont := styleSheet fontAt:#'activeHelp.font' default:nil. |
43d2d7c37e61
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
233 |
"/ defaultFont notNil ifTrue:[ |
43d2d7c37e61
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
234 |
"/ self font:defaultFont |
43d2d7c37e61
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
235 |
"/ ]. |
12908 | 236 |
|
237 |
self borderWidth:(styleSheet at:#'activeHelp.borderWidth' default:1). |
|
238 |
||
239 |
"Modified: / 26.10.1997 / 17:02:09 / cg" |
|
240 |
! |
|
241 |
||
242 |
realize |
|
243 |
self create. |
|
244 |
"/ self computeShape. |
|
245 |
self enableMotionEvents. |
|
246 |
self enableButtonMotionEvents. |
|
18315 | 247 |
self enableFocusEvents. |
18316 | 248 |
self subViews do:[:eachView | |
249 |
eachView delegate:self. |
|
250 |
]. |
|
12908 | 251 |
super realize |
18315 | 252 |
|
18316 | 253 |
"Modified: / 04-08-2018 / 16:53:13 / Claus Gittinger" |
12908 | 254 |
! ! |
255 |
||
256 |
!CodeCompletionHelpView methodsFor:'private'! |
|
257 |
||
258 |
resizeToFit |
|
259 |
"resize myself to make the component view fit" |
|
260 |
||
13448
8f3c88862f5a
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
12908
diff
changeset
|
261 |
|pref bw| |
12908 | 262 |
|
263 |
pref := myView preferredExtent. |
|
13670
43d2d7c37e61
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13479
diff
changeset
|
264 |
myView extent:pref. |
13448
8f3c88862f5a
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
12908
diff
changeset
|
265 |
bw := self borderWidth. |
8f3c88862f5a
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
12908
diff
changeset
|
266 |
self extent:(pref + (bw * 2)). |
8f3c88862f5a
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
12908
diff
changeset
|
267 |
myView origin:(bw asPoint). |
12908 | 268 |
|
269 |
"Modified: 28.6.1997 / 14:23:49 / cg" |
|
270 |
! ! |
|
271 |
||
272 |
!CodeCompletionHelpView methodsFor:'queries'! |
|
273 |
||
274 |
isPopUpView |
|
275 |
"return true - I am a popUp type of view (no decoration, pop-to-top)" |
|
276 |
||
277 |
^ true |
|
278 |
||
279 |
"Modified: 12.5.1996 / 21:58:12 / cg" |
|
13448
8f3c88862f5a
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
12908
diff
changeset
|
280 |
! |
8f3c88862f5a
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
12908
diff
changeset
|
281 |
|
8f3c88862f5a
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
12908
diff
changeset
|
282 |
wantsFocusWithButtonPress |
8f3c88862f5a
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
12908
diff
changeset
|
283 |
"DEFINITELY not, because if we do so, |
13476
9e09d2a0bf7c
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13448
diff
changeset
|
284 |
the editView looses focus on click, and sends me to hell in its lost focus handling!! |
13448
8f3c88862f5a
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
12908
diff
changeset
|
285 |
So I will be terminated by a buttonPress, before I get a chance to handle the buttonRelease |
8f3c88862f5a
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
12908
diff
changeset
|
286 |
(in which I fire my action)" |
8f3c88862f5a
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
12908
diff
changeset
|
287 |
|
8f3c88862f5a
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
12908
diff
changeset
|
288 |
^ false |
13476
9e09d2a0bf7c
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13448
diff
changeset
|
289 |
! |
9e09d2a0bf7c
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13448
diff
changeset
|
290 |
|
9e09d2a0bf7c
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13448
diff
changeset
|
291 |
wantsFocusWithPointerEnter |
9e09d2a0bf7c
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13448
diff
changeset
|
292 |
"DEFINITELY not, because if we do so, |
9e09d2a0bf7c
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13448
diff
changeset
|
293 |
the editView looses focus on entry, and sends me to hell in its lost focus handling!! |
9e09d2a0bf7c
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13448
diff
changeset
|
294 |
So I will be terminated by a motion" |
9e09d2a0bf7c
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13448
diff
changeset
|
295 |
|
9e09d2a0bf7c
class: CodeCompletionHelpView
Claus Gittinger <cg@exept.de>
parents:
13448
diff
changeset
|
296 |
^ false |
12908 | 297 |
! ! |
298 |
||
299 |
!CodeCompletionHelpView class methodsFor:'documentation'! |
|
300 |
||
301 |
version |
|
18315 | 302 |
^ '$Header$' |
12908 | 303 |
! |
304 |
||
305 |
version_CVS |
|
18315 | 306 |
^ '$Header$' |
12908 | 307 |
! ! |
308 |