1 "{ Package: 'stx:libwebkit' }" |
1 "{ Package: 'stx:libwebkit' }" |
2 |
2 |
3 SimpleView subclass:#WebKitView |
3 SimpleView subclass:#WebKitView |
4 instanceVariableNames:'router url progress' |
4 instanceVariableNames:'url progress rendererView' |
5 classVariableNames:'' |
5 classVariableNames:'' |
6 poolDictionaries:'' |
6 poolDictionaries:'' |
7 category:'Views-WebKit' |
7 category:'Views-WebKit' |
8 ! |
8 ! |
9 |
9 |
10 Object subclass:#EventRouter |
|
11 instanceVariableNames:'view in out' |
|
12 classVariableNames:'' |
|
13 poolDictionaries:'' |
|
14 privateIn:WebKitView |
|
15 ! |
|
16 |
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. |
|
30 |
|
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 |
|
43 !WebKitView methodsFor:'accessing - classes'! |
|
44 |
|
45 rendererClass |
|
46 |
|
47 ^WebKitRenderer |
|
48 |
|
49 "Created: / 03-06-2011 / 09:38:12 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
50 ! ! |
17 |
51 |
18 !WebKitView methodsFor:'aspects'! |
52 !WebKitView methodsFor:'aspects'! |
19 |
53 |
20 progress |
54 progress |
21 "return/create the 'progress' value holder (automatically generated)" |
55 "return/create the 'progress' value holder (automatically generated)" |
22 |
56 |
23 progress isNil ifTrue:[ |
57 progress isNil ifTrue:[ |
24 progress := ValueHolder new. |
58 progress := ValueHolder new. |
25 progress addDependent:router. |
59 progress addDependent:rendererView. |
26 ]. |
60 ]. |
27 ^ progress |
61 ^ progress |
28 |
62 |
29 "Modified: / 02-06-2011 / 23:45:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
63 "Modified: / 02-06-2011 / 23:45:00 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
30 ! |
64 ! |
34 |
68 |
35 |oldValue newValue| |
69 |oldValue newValue| |
36 |
70 |
37 progress notNil ifTrue:[ |
71 progress notNil ifTrue:[ |
38 oldValue := progress value. |
72 oldValue := progress value. |
39 progress removeDependent:router. |
73 progress removeDependent:rendererView. |
40 ]. |
74 ]. |
41 progress := something. |
75 progress := something. |
42 progress notNil ifTrue:[ |
76 progress notNil ifTrue:[ |
43 progress addDependent:self. |
77 progress addDependent:self. |
44 ]. |
78 ]. |
65 |
99 |
66 |oldValue newValue| |
100 |oldValue newValue| |
67 |
101 |
68 url notNil ifTrue:[ |
102 url notNil ifTrue:[ |
69 oldValue := url value. |
103 oldValue := url value. |
70 url removeDependent:router. |
104 url removeDependent:rendererView. |
71 ]. |
105 ]. |
72 url := something. |
106 url := something. |
73 url notNil ifTrue:[ |
107 url notNil ifTrue:[ |
74 url addDependent:router. |
108 url addDependent:rendererView. |
75 ]. |
109 ]. |
76 newValue := url value. |
110 newValue := url value. |
77 oldValue ~~ newValue ifTrue:[ |
111 oldValue ~~ newValue ifTrue:[ |
78 self update:#value with:newValue from:url. |
112 self update:#value with:newValue from:url. |
79 ]. |
113 ]. |
82 ! ! |
116 ! ! |
83 |
117 |
84 !WebKitView methodsFor:'initialization'! |
118 !WebKitView methodsFor:'initialization'! |
85 |
119 |
86 initialize |
120 initialize |
87 |
|
88 super initialize. |
121 super initialize. |
89 router := EventRouter for: self. |
122 renderer := self rendererClass for:self. |
|
123 rendererView := XEmbedContainerView in: self. |
|
124 rendererView origin: 0.0@0.0 corner: 1.0@1.0. |
90 |
125 |
91 "Created: / 02-06-2011 / 23:46:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
126 "Created: / 02-06-2011 / 23:46:25 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
127 "Modified: / 03-06-2011 / 09:39:16 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
92 ! ! |
128 ! ! |
93 |
129 |
94 !WebKitView methodsFor:'realization'! |
130 !WebKitView methodsFor:'realization'! |
95 |
131 |
96 preRealize |
132 preRealize |
98 super preRealize |
134 super preRealize |
99 |
135 |
100 "Created: / 02-06-2011 / 23:33:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
136 "Created: / 02-06-2011 / 23:33:41 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
101 ! ! |
137 ! ! |
102 |
138 |
103 !WebKitView::EventRouter class methodsFor:'instance creation'! |
|
104 |
|
105 for: aWebKitView |
|
106 |
|
107 self new initializeForView: aWebKitView |
|
108 |
|
109 "Created: / 02-06-2011 / 23:38:01 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
110 ! ! |
|
111 |
|
112 !WebKitView::EventRouter methodsFor:'initialization'! |
|
113 |
|
114 initializeForView: aWebKitView |
|
115 |
|
116 view := aWebKitView. |
|
117 |
|
118 "Created: / 02-06-2011 / 23:38:09 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
119 ! ! |
|
120 |
|
121 !WebKitView::EventRouter methodsFor:'spawn/terminate renderer'! |
|
122 |
|
123 spawnRenderer |
|
124 |
|
125 | inPipe outPipe | |
|
126 inPipe := NonPositionableExternalStream makePipe. |
|
127 outPipe := NonPositionableExternalStream makePipe. |
|
128 |
|
129 self halt:'Unfinished'. |
|
130 |
|
131 OperatingSystem |
|
132 exec: '/home/jv/work/uzbl/uzbl-core' |
|
133 withArguments: #('/home/jv/work/uzbl/uzbl-core' '-c' '-' '-p' '-s') |
|
134 environment: nil |
|
135 fileDescriptors: #(1 2 3) |
|
136 fork: true |
|
137 newPgrp: false |
|
138 inDirectory: Filename defaultDirectory pathName |
|
139 |
|
140 "Created: / 02-06-2011 / 23:40:04 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
141 ! |
|
142 |
|
143 terminateRenderer |
|
144 |
|
145 "Created: / 02-06-2011 / 23:40:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
|
146 ! ! |
|
147 |
|
148 !WebKitView class methodsFor:'documentation'! |
139 !WebKitView class methodsFor:'documentation'! |
149 |
140 |
150 version_SVN |
141 version_SVN |
151 ^ '$Id$' |
142 ^ '$Id$' |
152 ! ! |
143 ! ! |