author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Tue, 07 Jun 2011 22:56:19 +0000 | |
changeset 8 | 05cd84624a32 |
parent 4 | 385102f5bf00 |
child 11 | 9388b5fb34aa |
permissions | -rw-r--r-- |
1 | 1 |
"{ Package: 'stx:libwebkit' }" |
2 |
||
3 |
SimpleView subclass:#WebKitView |
|
4 | 4 |
instanceVariableNames:'rendererView url progress' |
1 | 5 |
classVariableNames:'' |
6 |
poolDictionaries:'' |
|
7 |
category:'Views-WebKit' |
|
8 |
! |
|
9 |
||
2 | 10 |
|
11 |
!WebKitView class methodsFor:'startup'! |
|
12 |
||
13 |
open |
|
14 |
||
15 |
|url webkitView urlView topView| |
|
16 |
||
17 |
url := 'http://www.webkit.org' asValue. |
|
18 |
||
19 |
topView := StandardSystemView new ; |
|
20 |
extent:(640 @ 480). |
|
21 |
topView label:'WebKit demo'. |
|
22 |
||
23 |
urlView := EditField in: topView. |
|
24 |
urlView layout: (LayoutFrame fractions:(0 @ 0 corner:1.0 @ 0) offsets:(0 @ 0 corner:0 @ 25)). |
|
25 |
urlView model: url. |
|
26 |
||
27 |
webkitView := self in:topView. |
|
28 |
webkitView layout: (LayoutFrame fractions:(0 @ 0 corner:1.0 @ 1.0) offsets:(0 @ 26 corner:0 @ 0)). |
|
29 |
webkitView url: url. |
|
1 | 30 |
|
2 | 31 |
topView open. |
32 |
||
33 |
^ webkitView |
|
34 |
||
35 |
" |
|
36 |
WebKitView open |
|
37 |
" |
|
38 |
||
39 |
"Modified: / 16-05-1998 / 16:53:53 / cg" |
|
40 |
"Created: / 03-06-2011 / 09:40:22 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
41 |
! ! |
|
42 |
||
3
32456ba40192
Starts uzbl process and connects to its control socket
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
43 |
!WebKitView methodsFor:'accessing'! |
32456ba40192
Starts uzbl process and connects to its control socket
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
44 |
|
32456ba40192
Starts uzbl process and connects to its control socket
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
45 |
rendererView |
32456ba40192
Starts uzbl process and connects to its control socket
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
46 |
^ rendererView |
32456ba40192
Starts uzbl process and connects to its control socket
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
47 |
! ! |
32456ba40192
Starts uzbl process and connects to its control socket
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
48 |
|
2 | 49 |
!WebKitView methodsFor:'accessing - classes'! |
50 |
||
51 |
rendererClass |
|
52 |
||
53 |
^WebKitRenderer |
|
54 |
||
55 |
"Created: / 03-06-2011 / 09:38:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
56 |
! ! |
|
1 | 57 |
|
58 |
!WebKitView methodsFor:'aspects'! |
|
59 |
||
60 |
progress |
|
61 |
"return/create the 'progress' value holder (automatically generated)" |
|
62 |
||
63 |
progress isNil ifTrue:[ |
|
64 |
progress := ValueHolder new. |
|
4 | 65 |
progress addDependent:self. |
1 | 66 |
]. |
67 |
^ progress |
|
68 |
! |
|
69 |
||
70 |
progress:something |
|
71 |
"set the 'progress' value holder (automatically generated)" |
|
72 |
||
73 |
|oldValue newValue| |
|
74 |
||
75 |
progress notNil ifTrue:[ |
|
76 |
oldValue := progress value. |
|
4 | 77 |
progress removeDependent:self. |
1 | 78 |
]. |
79 |
progress := something. |
|
80 |
progress notNil ifTrue:[ |
|
81 |
progress addDependent:self. |
|
82 |
]. |
|
83 |
newValue := progress value. |
|
84 |
oldValue ~~ newValue ifTrue:[ |
|
85 |
self update:#value with:newValue from:progress. |
|
86 |
]. |
|
87 |
! |
|
88 |
||
89 |
url |
|
90 |
"return/create the 'url' value holder (automatically generated)" |
|
91 |
||
92 |
url isNil ifTrue:[ |
|
93 |
url := ValueHolder new. |
|
94 |
url addDependent:self. |
|
95 |
]. |
|
96 |
^ url |
|
97 |
! |
|
98 |
||
99 |
url:something |
|
100 |
"set the 'url' value holder (automatically generated)" |
|
101 |
||
102 |
|oldValue newValue| |
|
103 |
||
104 |
url notNil ifTrue:[ |
|
105 |
oldValue := url value. |
|
4 | 106 |
url removeDependent:self. |
1 | 107 |
]. |
108 |
url := something. |
|
109 |
url notNil ifTrue:[ |
|
4 | 110 |
url addDependent:self. |
1 | 111 |
]. |
112 |
newValue := url value. |
|
8 | 113 |
newValue ifNil:[url setValue:(newValue := 'about:blank')]. |
1 | 114 |
oldValue ~~ newValue ifTrue:[ |
115 |
self update:#value with:newValue from:url. |
|
116 |
]. |
|
8 | 117 |
|
118 |
"Modified: / 07-06-2011 / 23:03:32 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
4 | 119 |
! ! |
1 | 120 |
|
4 | 121 |
!WebKitView methodsFor:'change & update'! |
122 |
||
123 |
update:aspect with:param from:changedObject |
|
124 |
"Invoked when an object that I depend upon sends a change notification." |
|
125 |
||
126 |
"stub code automatically generated - please change as required" |
|
127 |
||
128 |
(changedObject == url and:[aspect ~~ #valueFromEvent]) ifTrue:[ |
|
129 |
self updateUrl. |
|
130 |
^ self. |
|
131 |
]. |
|
132 |
super update:aspect with:param from:changedObject |
|
133 |
||
134 |
"Modified: / 07-06-2011 / 11:43:31 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
135 |
! |
|
136 |
||
137 |
updateUrl |
|
138 |
||
139 |
renderer setVariable: #uri to: self url value |
|
140 |
||
141 |
"Created: / 07-06-2011 / 10:18:07 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
1 | 142 |
! ! |
143 |
||
3
32456ba40192
Starts uzbl process and connects to its control socket
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
144 |
!WebKitView methodsFor:'initialization & release'! |
1 | 145 |
|
146 |
initialize |
|
147 |
super initialize. |
|
2 | 148 |
renderer := self rendererClass for:self. |
149 |
rendererView := XEmbedContainerView in: self. |
|
150 |
rendererView origin: 0.0@0.0 corner: 1.0@1.0. |
|
3
32456ba40192
Starts uzbl process and connects to its control socket
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
151 |
rendererView useWorkaround: #uzbl. |
1 | 152 |
|
153 |
"Created: / 02-06-2011 / 23:46:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
3
32456ba40192
Starts uzbl process and connects to its control socket
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
154 |
"Modified: / 06-06-2011 / 18:11:02 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1 | 155 |
! ! |
156 |
||
157 |
!WebKitView methodsFor:'realization'! |
|
158 |
||
3
32456ba40192
Starts uzbl process and connects to its control socket
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
159 |
postRealize |
32456ba40192
Starts uzbl process and connects to its control socket
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
160 |
super postRealize. |
32456ba40192
Starts uzbl process and connects to its control socket
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
161 |
renderer spawn. |
1 | 162 |
|
3
32456ba40192
Starts uzbl process and connects to its control socket
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
2
diff
changeset
|
163 |
"Created: / 06-06-2011 / 10:40:45 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
1 | 164 |
! ! |
165 |
||
166 |
!WebKitView class methodsFor:'documentation'! |
|
167 |
||
168 |
version_SVN |
|
169 |
^ '$Id$' |
|
170 |
! ! |