context 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/Rakefile.rb +107 -0
- data/coverage/-usr-local-lib-site_ruby-1_8-atk_rb.html +612 -0
- data/coverage/-usr-local-lib-site_ruby-1_8-gdk_pixbuf2_rb.html +637 -0
- data/coverage/-usr-local-lib-site_ruby-1_8-glib2_rb.html +829 -0
- data/coverage/-usr-local-lib-site_ruby-1_8-gtk2-base_rb.html +709 -0
- data/coverage/-usr-local-lib-site_ruby-1_8-gtk2_rb.html +623 -0
- data/coverage/-usr-local-lib-site_ruby-1_8-pango_rb.html +665 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-color_rb.html +865 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-colors_rb.html +1266 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-constants_rb.html +632 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-blur_rb.html +655 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-circle_rb.html +619 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-color_rb.html +621 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-path_rb.html +726 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-rectangle_rb.html +643 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context-triangle_rb.html +622 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-context_rb.html +639 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-paper_rb.html +793 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-papers_rb.html +651 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-path_rb.html +625 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo-point_rb.html +617 -0
- data/coverage/-var-lib-gems-1_8-gems-cairo-1_7_0-src-lib-cairo_rb.html +756 -0
- data/coverage/index.html +1170 -0
- data/coverage/lib-Context-Bridge_rb.html +673 -0
- data/coverage/lib-Context-Context_rb.html +756 -0
- data/coverage/lib-Context-EnumeratedType_rb.html +661 -0
- data/coverage/lib-Context-ExecutionProxy_rb.html +671 -0
- data/coverage/lib-Context-Gtk-App_rb.html +638 -0
- data/coverage/lib-Context-Gtk-Key_rb.html +664 -0
- data/coverage/lib-Context-Gtk-Widget_rb.html +667 -0
- data/coverage/lib-Context-KeyAssignment_rb.html +641 -0
- data/coverage/lib-Context-KeyMap_rb.html +653 -0
- data/coverage/lib-Context-Key_rb.html +667 -0
- data/coverage/lib-Context-View_rb.html +659 -0
- data/coverage/lib-Context-Views-Gtk-PageView_rb.html +660 -0
- data/coverage/lib-Context-Views-PageView_rb.html +627 -0
- data/coverage/lib-Context-Widget_rb.html +650 -0
- data/coverage/lib-Context-require_all_rb.html +623 -0
- data/doc/classes/Context.html +174 -0
- data/doc/classes/Context/Bridge.html +296 -0
- data/doc/classes/Context/Context.html +564 -0
- data/doc/classes/Context/EnumeratedType.html +283 -0
- data/doc/classes/Context/ExecutionProxy.html +228 -0
- data/doc/classes/Context/Gtk.html +126 -0
- data/doc/classes/Context/Gtk/App.html +217 -0
- data/doc/classes/Context/Gtk/Key.html +292 -0
- data/doc/classes/Context/Gtk/PageView.html +245 -0
- data/doc/classes/Context/Gtk/PageView/MainWindow.html +200 -0
- data/doc/classes/Context/Gtk/Widget.html +311 -0
- data/doc/classes/Context/Key.html +305 -0
- data/doc/classes/Context/Key/Modifier.html +117 -0
- data/doc/classes/Context/KeyAssignment.html +234 -0
- data/doc/classes/Context/KeyMap.html +273 -0
- data/doc/classes/Context/PageView.html +180 -0
- data/doc/classes/Context/View.html +334 -0
- data/doc/classes/Context/Widget.html +298 -0
- data/doc/classes/Kernel.html +148 -0
- data/doc/classes/Object.html +196 -0
- data/doc/created.rid +1 -0
- data/doc/files/lib/Context/Bridge_rb.html +108 -0
- data/doc/files/lib/Context/Context_rb.html +109 -0
- data/doc/files/lib/Context/EnumeratedType_rb.html +101 -0
- data/doc/files/lib/Context/ExecutionProxy_rb.html +101 -0
- data/doc/files/lib/Context/Gtk/App_rb.html +110 -0
- data/doc/files/lib/Context/Gtk/Key_rb.html +109 -0
- data/doc/files/lib/Context/Gtk/Widget_rb.html +109 -0
- data/doc/files/lib/Context/KeyAssignment_rb.html +108 -0
- data/doc/files/lib/Context/KeyMap_rb.html +109 -0
- data/doc/files/lib/Context/Key_rb.html +108 -0
- data/doc/files/lib/Context/Version_rb.html +101 -0
- data/doc/files/lib/Context/View_rb.html +101 -0
- data/doc/files/lib/Context/Views/Gtk/PageView_rb.html +111 -0
- data/doc/files/lib/Context/Views/PageView_rb.html +108 -0
- data/doc/files/lib/Context/Widget_rb.html +101 -0
- data/doc/files/lib/Context/require_all_rb.html +101 -0
- data/doc/fr_class_index.html +46 -0
- data/doc/fr_file_index.html +42 -0
- data/doc/fr_method_index.html +103 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/lib/Context/Bridge.rb +63 -0
- data/lib/Context/Context.rb +146 -0
- data/lib/Context/EnumeratedType.rb +51 -0
- data/lib/Context/ExecutionProxy.rb +61 -0
- data/lib/Context/Gtk/App.rb +28 -0
- data/lib/Context/Gtk/Key.rb +54 -0
- data/lib/Context/Gtk/Widget.rb +57 -0
- data/lib/Context/Key.rb +57 -0
- data/lib/Context/KeyAssignment.rb +31 -0
- data/lib/Context/KeyMap.rb +43 -0
- data/lib/Context/Version.rb +5 -0
- data/lib/Context/View.rb +49 -0
- data/lib/Context/Views/Gtk/PageView.rb +50 -0
- data/lib/Context/Views/PageView.rb +17 -0
- data/lib/Context/Widget.rb +40 -0
- data/lib/Context/require_all.rb +13 -0
- data/spec/Context/Bridge_spec.rb +40 -0
- data/spec/Context/Context_spec.rb +102 -0
- data/spec/Context/EnumeratedType_spec.rb +51 -0
- data/spec/Context/ExecutionProxy_spec.rb +28 -0
- data/spec/Context/Gtk/App_spec.rb +24 -0
- data/spec/Context/Gtk/Key_spec.rb +45 -0
- data/spec/Context/Gtk/Widget_spec.rb +44 -0
- data/spec/Context/KeyAssignment_spec.rb +26 -0
- data/spec/Context/KeyMap_spec.rb +64 -0
- data/spec/Context/Key_spec.rb +22 -0
- data/spec/Context/View_spec.rb +62 -0
- data/spec/Context/Views/Gtk/PageView_spec.rb +44 -0
- data/spec/Context/Views/PageView_spec.rb +20 -0
- data/spec/Context/Widget_spec.rb +15 -0
- data/spec/Context/require_all_spec.rb +13 -0
- data/test_results.html +343 -0
- metadata +179 -0
|
@@ -0,0 +1,564 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
2
|
+
<!DOCTYPE html
|
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
5
|
+
|
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
7
|
+
<head>
|
|
8
|
+
<title>Class: Context::Context</title>
|
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
|
11
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
|
12
|
+
<script type="text/javascript">
|
|
13
|
+
// <![CDATA[
|
|
14
|
+
|
|
15
|
+
function popupCode( url ) {
|
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function toggleCode( id ) {
|
|
20
|
+
if ( document.getElementById )
|
|
21
|
+
elem = document.getElementById( id );
|
|
22
|
+
else if ( document.all )
|
|
23
|
+
elem = eval( "document.all." + id );
|
|
24
|
+
else
|
|
25
|
+
return false;
|
|
26
|
+
|
|
27
|
+
elemStyle = elem.style;
|
|
28
|
+
|
|
29
|
+
if ( elemStyle.display != "block" ) {
|
|
30
|
+
elemStyle.display = "block"
|
|
31
|
+
} else {
|
|
32
|
+
elemStyle.display = "none"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Make codeblocks hidden by default
|
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
|
40
|
+
|
|
41
|
+
// ]]>
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
</head>
|
|
45
|
+
<body>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<div id="classHeader">
|
|
50
|
+
<table class="header-table">
|
|
51
|
+
<tr class="top-aligned-row">
|
|
52
|
+
<td><strong>Class</strong></td>
|
|
53
|
+
<td class="class-name-in-header">Context::Context</td>
|
|
54
|
+
</tr>
|
|
55
|
+
<tr class="top-aligned-row">
|
|
56
|
+
<td><strong>In:</strong></td>
|
|
57
|
+
<td>
|
|
58
|
+
<a href="../../files/lib/Context/Context_rb.html">
|
|
59
|
+
lib/Context/Context.rb
|
|
60
|
+
</a>
|
|
61
|
+
<br />
|
|
62
|
+
</td>
|
|
63
|
+
</tr>
|
|
64
|
+
|
|
65
|
+
<tr class="top-aligned-row">
|
|
66
|
+
<td><strong>Parent:</strong></td>
|
|
67
|
+
<td>
|
|
68
|
+
<a href="../Object.html">
|
|
69
|
+
Object
|
|
70
|
+
</a>
|
|
71
|
+
</td>
|
|
72
|
+
</tr>
|
|
73
|
+
</table>
|
|
74
|
+
</div>
|
|
75
|
+
<!-- banner header -->
|
|
76
|
+
|
|
77
|
+
<div id="bodyContent">
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
<div id="contextContent">
|
|
82
|
+
|
|
83
|
+
<div id="description">
|
|
84
|
+
<p>
|
|
85
|
+
The <a href="Context.html">Context</a> is the Presenter in the Model, <a
|
|
86
|
+
href="View.html">View</a>, Presentor (MVP) model. It is an object that
|
|
87
|
+
holds the logic for the UI scenario that the application is currently in.
|
|
88
|
+
<a href="Context.html">Context</a> is an abstract class.
|
|
89
|
+
</p>
|
|
90
|
+
<p>
|
|
91
|
+
A <a href="Context.html">Context</a> is made up of views, model objects and
|
|
92
|
+
other sub-contexts. One of the views should be a UI widget container that
|
|
93
|
+
contains all of the views for the <a href="Context.html">Context</a>. The
|
|
94
|
+
concrete classes should define the logic for the <a
|
|
95
|
+
href="Context.html">Context</a> that is either called by <a
|
|
96
|
+
href="Context.html#M000040">enter</a>() or called from one of the contained
|
|
97
|
+
views.
|
|
98
|
+
</p>
|
|
99
|
+
<p>
|
|
100
|
+
Note that views are usually only instantiated in <a
|
|
101
|
+
href="Context.html#M000035">createViews</a>, which is called on <a
|
|
102
|
+
href="Context.html#M000040">enter</a>(), not on <a
|
|
103
|
+
href="Context.html">Context</a> creation. However, there is no requirement
|
|
104
|
+
for this.
|
|
105
|
+
</p>
|
|
106
|
+
|
|
107
|
+
</div>
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div id="method-list">
|
|
113
|
+
<h3 class="section-bar">Methods</h3>
|
|
114
|
+
|
|
115
|
+
<div class="name-list">
|
|
116
|
+
<a href="#M000039">addView</a>
|
|
117
|
+
<a href="#M000035">createViews</a>
|
|
118
|
+
<a href="#M000038">destroyViews</a>
|
|
119
|
+
<a href="#M000040">enter</a>
|
|
120
|
+
<a href="#M000042">exit</a>
|
|
121
|
+
<a href="#M000044">getKeyBinding</a>
|
|
122
|
+
<a href="#M000041">isEntered?</a>
|
|
123
|
+
<a href="#M000034">new</a>
|
|
124
|
+
<a href="#M000045">notifyKey</a>
|
|
125
|
+
<a href="#M000037">peekAtView</a>
|
|
126
|
+
<a href="#M000043">setKeyBinding</a>
|
|
127
|
+
<a href="#M000036">setupViews</a>
|
|
128
|
+
</div>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
</div>
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
<!-- if includes -->
|
|
135
|
+
|
|
136
|
+
<div id="section">
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
<div id="attribute-list">
|
|
143
|
+
<h3 class="section-bar">Attributes</h3>
|
|
144
|
+
|
|
145
|
+
<div class="name-list">
|
|
146
|
+
<table>
|
|
147
|
+
<tr class="top-aligned-row context-row">
|
|
148
|
+
<td class="context-item-name">mainView</td>
|
|
149
|
+
<td class="context-item-value"> [W] </td>
|
|
150
|
+
<td class="context-item-desc"></td>
|
|
151
|
+
</tr>
|
|
152
|
+
<tr class="top-aligned-row context-row">
|
|
153
|
+
<td class="context-item-name">mainView</td>
|
|
154
|
+
<td class="context-item-value"> [R] </td>
|
|
155
|
+
<td class="context-item-desc"></td>
|
|
156
|
+
</tr>
|
|
157
|
+
<tr class="top-aligned-row context-row">
|
|
158
|
+
<td class="context-item-name">parent</td>
|
|
159
|
+
<td class="context-item-value"> [R] </td>
|
|
160
|
+
<td class="context-item-desc"></td>
|
|
161
|
+
</tr>
|
|
162
|
+
</table>
|
|
163
|
+
</div>
|
|
164
|
+
</div>
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
<!-- if method_list -->
|
|
169
|
+
<div id="methods">
|
|
170
|
+
<h3 class="section-bar">Public Class methods</h3>
|
|
171
|
+
|
|
172
|
+
<div id="method-M000034" class="method-detail">
|
|
173
|
+
<a name="M000034"></a>
|
|
174
|
+
|
|
175
|
+
<div class="method-heading">
|
|
176
|
+
<a href="#M000034" class="method-signature">
|
|
177
|
+
<span class="method-name">new</span><span class="method-args">(viewBridge)</span>
|
|
178
|
+
</a>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
<div class="method-description">
|
|
182
|
+
<p>
|
|
183
|
+
Create a <a href="Context.html#M000034">new</a> <a
|
|
184
|
+
href="Context.html">Context</a>. Takes a <a href="Bridge.html">Bridge</a>
|
|
185
|
+
that is used to create the <a href="View.html">View</a> s in using the
|
|
186
|
+
correct namespace.
|
|
187
|
+
</p>
|
|
188
|
+
<p><a class="source-toggle" href="#"
|
|
189
|
+
onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
|
|
190
|
+
<div class="method-source-code" id="M000034-source">
|
|
191
|
+
<pre>
|
|
192
|
+
<span class="ruby-comment cmt"># File lib/Context/Context.rb, line 26</span>
|
|
193
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">viewBridge</span>)
|
|
194
|
+
<span class="ruby-ivar">@parent</span> = <span class="ruby-keyword kw">nil</span>
|
|
195
|
+
<span class="ruby-ivar">@mainView</span> = <span class="ruby-keyword kw">nil</span>
|
|
196
|
+
<span class="ruby-ivar">@viewBridge</span> = <span class="ruby-identifier">viewBridge</span>
|
|
197
|
+
<span class="ruby-ivar">@keyMap</span> = <span class="ruby-constant">KeyMap</span>.<span class="ruby-identifier">new</span>
|
|
198
|
+
<span class="ruby-ivar">@entered</span> = <span class="ruby-keyword kw">false</span>
|
|
199
|
+
<span class="ruby-keyword kw">end</span>
|
|
200
|
+
</pre>
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
</div>
|
|
204
|
+
|
|
205
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
|
206
|
+
|
|
207
|
+
<div id="method-M000039" class="method-detail">
|
|
208
|
+
<a name="M000039"></a>
|
|
209
|
+
|
|
210
|
+
<div class="method-heading">
|
|
211
|
+
<a href="#M000039" class="method-signature">
|
|
212
|
+
<span class="method-name">addView</span><span class="method-args">(view)</span>
|
|
213
|
+
</a>
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
<div class="method-description">
|
|
217
|
+
<p>
|
|
218
|
+
Adds a view to the mainView Since the mainView is intended to be a UI
|
|
219
|
+
container that contains all the views, this method is called by a
|
|
220
|
+
sub-context‘s <a href="Context.html#M000040">enter</a>() method to
|
|
221
|
+
allow the parent‘s mainView to contain the sub-context‘s views.
|
|
222
|
+
</p>
|
|
223
|
+
<p><a class="source-toggle" href="#"
|
|
224
|
+
onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
|
|
225
|
+
<div class="method-source-code" id="M000039-source">
|
|
226
|
+
<pre>
|
|
227
|
+
<span class="ruby-comment cmt"># File lib/Context/Context.rb, line 72</span>
|
|
228
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">addView</span>(<span class="ruby-identifier">view</span>)
|
|
229
|
+
<span class="ruby-ivar">@mainView</span>.<span class="ruby-identifier">addView</span>(<span class="ruby-identifier">view</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@mainView</span>.<span class="ruby-identifier">nil?</span>
|
|
230
|
+
<span class="ruby-keyword kw">end</span>
|
|
231
|
+
</pre>
|
|
232
|
+
</div>
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
|
|
236
|
+
<div id="method-M000035" class="method-detail">
|
|
237
|
+
<a name="M000035"></a>
|
|
238
|
+
|
|
239
|
+
<div class="method-heading">
|
|
240
|
+
<a href="#M000035" class="method-signature">
|
|
241
|
+
<span class="method-name">createViews</span><span class="method-args">()</span>
|
|
242
|
+
</a>
|
|
243
|
+
</div>
|
|
244
|
+
|
|
245
|
+
<div class="method-description">
|
|
246
|
+
<p>
|
|
247
|
+
Creates the views for the context. This method is called automatically by
|
|
248
|
+
<a href="Context.html#M000040">enter</a>() and probably should not be
|
|
249
|
+
called otherwise. This method should be overriden by the concrete class. It
|
|
250
|
+
should instantiate all the views and set @mainView
|
|
251
|
+
</p>
|
|
252
|
+
<p><a class="source-toggle" href="#"
|
|
253
|
+
onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
|
|
254
|
+
<div class="method-source-code" id="M000035-source">
|
|
255
|
+
<pre>
|
|
256
|
+
<span class="ruby-comment cmt"># File lib/Context/Context.rb, line 38</span>
|
|
257
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">createViews</span>
|
|
258
|
+
<span class="ruby-comment cmt"># Nothing to do here</span>
|
|
259
|
+
<span class="ruby-keyword kw">end</span>
|
|
260
|
+
</pre>
|
|
261
|
+
</div>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
|
|
265
|
+
<div id="method-M000038" class="method-detail">
|
|
266
|
+
<a name="M000038"></a>
|
|
267
|
+
|
|
268
|
+
<div class="method-heading">
|
|
269
|
+
<a href="#M000038" class="method-signature">
|
|
270
|
+
<span class="method-name">destroyViews</span><span class="method-args">()</span>
|
|
271
|
+
</a>
|
|
272
|
+
</div>
|
|
273
|
+
|
|
274
|
+
<div class="method-description">
|
|
275
|
+
<p>
|
|
276
|
+
Destroys the views for the context. This method is called automatically by
|
|
277
|
+
<a href="Context.html#M000042">exit</a>() and probably should not be called
|
|
278
|
+
otherwise. This method should be overriden by the concrete class. It should
|
|
279
|
+
destroy all the views and set @mainView to nil
|
|
280
|
+
</p>
|
|
281
|
+
<p><a class="source-toggle" href="#"
|
|
282
|
+
onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
|
|
283
|
+
<div class="method-source-code" id="M000038-source">
|
|
284
|
+
<pre>
|
|
285
|
+
<span class="ruby-comment cmt"># File lib/Context/Context.rb, line 63</span>
|
|
286
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">destroyViews</span>
|
|
287
|
+
<span class="ruby-ivar">@mainView</span> = <span class="ruby-keyword kw">nil</span>
|
|
288
|
+
<span class="ruby-keyword kw">end</span>
|
|
289
|
+
</pre>
|
|
290
|
+
</div>
|
|
291
|
+
</div>
|
|
292
|
+
</div>
|
|
293
|
+
|
|
294
|
+
<div id="method-M000040" class="method-detail">
|
|
295
|
+
<a name="M000040"></a>
|
|
296
|
+
|
|
297
|
+
<div class="method-heading">
|
|
298
|
+
<a href="#M000040" class="method-signature">
|
|
299
|
+
<span class="method-name">enter</span><span class="method-args">(parent)</span>
|
|
300
|
+
</a>
|
|
301
|
+
</div>
|
|
302
|
+
|
|
303
|
+
<div class="method-description">
|
|
304
|
+
<p>
|
|
305
|
+
Enters the <a href="Context.html">Context</a>. After it is called, the <a
|
|
306
|
+
href="Context.html">Context</a> is then active and can be interacted with.
|
|
307
|
+
This method automatically calls <a
|
|
308
|
+
href="Context.html#M000035">createViews</a>() and adds the mainView to the
|
|
309
|
+
parent‘s view.
|
|
310
|
+
</p>
|
|
311
|
+
<p>
|
|
312
|
+
Usually this method will be overriden by the concrete class. However, it
|
|
313
|
+
should be careful to call super() in the appropriate place.
|
|
314
|
+
</p>
|
|
315
|
+
<p><a class="source-toggle" href="#"
|
|
316
|
+
onclick="toggleCode('M000040-source');return false;">[Source]</a></p>
|
|
317
|
+
<div class="method-source-code" id="M000040-source">
|
|
318
|
+
<pre>
|
|
319
|
+
<span class="ruby-comment cmt"># File lib/Context/Context.rb, line 83</span>
|
|
320
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">enter</span>(<span class="ruby-identifier">parent</span>)
|
|
321
|
+
<span class="ruby-ivar">@parent</span> = <span class="ruby-identifier">parent</span>
|
|
322
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-ivar">@parent</span> <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>)
|
|
323
|
+
<span class="ruby-ivar">@entered</span> = <span class="ruby-keyword kw">true</span>
|
|
324
|
+
<span class="ruby-identifier">setupViews</span>
|
|
325
|
+
<span class="ruby-identifier">parent</span>.<span class="ruby-identifier">addView</span>(<span class="ruby-ivar">@mainView</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@mainView</span>.<span class="ruby-identifier">nil?</span>
|
|
326
|
+
<span class="ruby-keyword kw">end</span>
|
|
327
|
+
<span class="ruby-keyword kw">end</span>
|
|
328
|
+
</pre>
|
|
329
|
+
</div>
|
|
330
|
+
</div>
|
|
331
|
+
</div>
|
|
332
|
+
|
|
333
|
+
<div id="method-M000042" class="method-detail">
|
|
334
|
+
<a name="M000042"></a>
|
|
335
|
+
|
|
336
|
+
<div class="method-heading">
|
|
337
|
+
<a href="#M000042" class="method-signature">
|
|
338
|
+
<span class="method-name">exit</span><span class="method-args">()</span>
|
|
339
|
+
</a>
|
|
340
|
+
</div>
|
|
341
|
+
|
|
342
|
+
<div class="method-description">
|
|
343
|
+
<p>
|
|
344
|
+
Exits the <a href="Context.html">Context</a>. After it is called, the
|
|
345
|
+
context is no longer active and can‘t be interacted with. This method
|
|
346
|
+
automatically removes the mainView from the parent‘s view and calls
|
|
347
|
+
<a href="Context.html#M000038">destroyViews</a>().
|
|
348
|
+
</p>
|
|
349
|
+
<p>
|
|
350
|
+
Usually this method will be overriden by the concrete class. However, it
|
|
351
|
+
should be careful to call super() in the appropriate place.
|
|
352
|
+
</p>
|
|
353
|
+
<p><a class="source-toggle" href="#"
|
|
354
|
+
onclick="toggleCode('M000042-source');return false;">[Source]</a></p>
|
|
355
|
+
<div class="method-source-code" id="M000042-source">
|
|
356
|
+
<pre>
|
|
357
|
+
<span class="ruby-comment cmt"># File lib/Context/Context.rb, line 106</span>
|
|
358
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exit</span>()
|
|
359
|
+
<span class="ruby-ivar">@entered</span> = <span class="ruby-keyword kw">false</span>
|
|
360
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@parent</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-operator">&&</span> <span class="ruby-operator">!</span><span class="ruby-ivar">@parent</span>.<span class="ruby-identifier">mainView</span>.<span class="ruby-identifier">nil?</span>
|
|
361
|
+
<span class="ruby-ivar">@parent</span>.<span class="ruby-identifier">mainView</span>.<span class="ruby-identifier">removeView</span>(<span class="ruby-ivar">@mainView</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@mainView</span>.<span class="ruby-identifier">nil?</span>
|
|
362
|
+
<span class="ruby-keyword kw">end</span>
|
|
363
|
+
<span class="ruby-identifier">destroyViews</span>
|
|
364
|
+
<span class="ruby-keyword kw">end</span>
|
|
365
|
+
</pre>
|
|
366
|
+
</div>
|
|
367
|
+
</div>
|
|
368
|
+
</div>
|
|
369
|
+
|
|
370
|
+
<div id="method-M000044" class="method-detail">
|
|
371
|
+
<a name="M000044"></a>
|
|
372
|
+
|
|
373
|
+
<div class="method-heading">
|
|
374
|
+
<a href="#M000044" class="method-signature">
|
|
375
|
+
<span class="method-name">getKeyBinding</span><span class="method-args">(key)</span>
|
|
376
|
+
</a>
|
|
377
|
+
</div>
|
|
378
|
+
|
|
379
|
+
<div class="method-description">
|
|
380
|
+
<p>
|
|
381
|
+
Returns the existing binding for a key.
|
|
382
|
+
</p>
|
|
383
|
+
<p>
|
|
384
|
+
Warning: This key binding mechanism is likely to be depracated, or at least
|
|
385
|
+
heavily modified soon.
|
|
386
|
+
</p>
|
|
387
|
+
<p><a class="source-toggle" href="#"
|
|
388
|
+
onclick="toggleCode('M000044-source');return false;">[Source]</a></p>
|
|
389
|
+
<div class="method-source-code" id="M000044-source">
|
|
390
|
+
<pre>
|
|
391
|
+
<span class="ruby-comment cmt"># File lib/Context/Context.rb, line 131</span>
|
|
392
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">getKeyBinding</span>(<span class="ruby-identifier">key</span>)
|
|
393
|
+
<span class="ruby-identifier">a</span> = <span class="ruby-ivar">@keyMap</span>.<span class="ruby-identifier">findKey</span>(<span class="ruby-identifier">key</span>)
|
|
394
|
+
<span class="ruby-identifier">a</span>.<span class="ruby-identifier">unless_nil</span>.<span class="ruby-identifier">action</span>
|
|
395
|
+
<span class="ruby-keyword kw">end</span>
|
|
396
|
+
</pre>
|
|
397
|
+
</div>
|
|
398
|
+
</div>
|
|
399
|
+
</div>
|
|
400
|
+
|
|
401
|
+
<div id="method-M000041" class="method-detail">
|
|
402
|
+
<a name="M000041"></a>
|
|
403
|
+
|
|
404
|
+
<div class="method-heading">
|
|
405
|
+
<a href="#M000041" class="method-signature">
|
|
406
|
+
<span class="method-name">isEntered?</span><span class="method-args">()</span>
|
|
407
|
+
</a>
|
|
408
|
+
</div>
|
|
409
|
+
|
|
410
|
+
<div class="method-description">
|
|
411
|
+
<p>
|
|
412
|
+
Returns true if the context has been entered, but not exited. Returns false
|
|
413
|
+
if the context has never been entered, or if it has been entered and then
|
|
414
|
+
exited.
|
|
415
|
+
</p>
|
|
416
|
+
<p><a class="source-toggle" href="#"
|
|
417
|
+
onclick="toggleCode('M000041-source');return false;">[Source]</a></p>
|
|
418
|
+
<div class="method-source-code" id="M000041-source">
|
|
419
|
+
<pre>
|
|
420
|
+
<span class="ruby-comment cmt"># File lib/Context/Context.rb, line 95</span>
|
|
421
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">isEntered?</span>
|
|
422
|
+
<span class="ruby-ivar">@entered</span>
|
|
423
|
+
<span class="ruby-keyword kw">end</span>
|
|
424
|
+
</pre>
|
|
425
|
+
</div>
|
|
426
|
+
</div>
|
|
427
|
+
</div>
|
|
428
|
+
|
|
429
|
+
<div id="method-M000045" class="method-detail">
|
|
430
|
+
<a name="M000045"></a>
|
|
431
|
+
|
|
432
|
+
<div class="method-heading">
|
|
433
|
+
<a href="#M000045" class="method-signature">
|
|
434
|
+
<span class="method-name">notifyKey</span><span class="method-args">(view, key)</span>
|
|
435
|
+
</a>
|
|
436
|
+
</div>
|
|
437
|
+
|
|
438
|
+
<div class="method-description">
|
|
439
|
+
<p>
|
|
440
|
+
Called by the view to indicated that a key has been pressed. Runs the
|
|
441
|
+
binding in the keymap, or returns nil if there isn‘t one.
|
|
442
|
+
</p>
|
|
443
|
+
<p>
|
|
444
|
+
Warning: This key binding mechanism is likely to be depracated, or at least
|
|
445
|
+
heavily modified soon.
|
|
446
|
+
</p>
|
|
447
|
+
<p><a class="source-toggle" href="#"
|
|
448
|
+
onclick="toggleCode('M000045-source');return false;">[Source]</a></p>
|
|
449
|
+
<div class="method-source-code" id="M000045-source">
|
|
450
|
+
<pre>
|
|
451
|
+
<span class="ruby-comment cmt"># File lib/Context/Context.rb, line 142</span>
|
|
452
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">notifyKey</span>(<span class="ruby-identifier">view</span>, <span class="ruby-identifier">key</span>)
|
|
453
|
+
<span class="ruby-ivar">@keyMap</span>.<span class="ruby-identifier">unless_nil</span> <span class="ruby-keyword kw">do</span> <span class="ruby-identifier">press</span>(<span class="ruby-identifier">key</span>) <span class="ruby-keyword kw">end</span>
|
|
454
|
+
<span class="ruby-keyword kw">end</span>
|
|
455
|
+
</pre>
|
|
456
|
+
</div>
|
|
457
|
+
</div>
|
|
458
|
+
</div>
|
|
459
|
+
|
|
460
|
+
<div id="method-M000037" class="method-detail">
|
|
461
|
+
<a name="M000037"></a>
|
|
462
|
+
|
|
463
|
+
<div class="method-heading">
|
|
464
|
+
<a href="#M000037" class="method-signature">
|
|
465
|
+
<span class="method-name">peekAtView</span><span class="method-args">()</span>
|
|
466
|
+
</a>
|
|
467
|
+
</div>
|
|
468
|
+
|
|
469
|
+
<div class="method-description">
|
|
470
|
+
<p>
|
|
471
|
+
Creates views and returns the main <a href="View.html">View</a>. This is
|
|
472
|
+
intended to be used by test code where entering the context executes code
|
|
473
|
+
and you need to know what the view will be ahead of time. I can think of no
|
|
474
|
+
reason to use this in production code.
|
|
475
|
+
</p>
|
|
476
|
+
<p><a class="source-toggle" href="#"
|
|
477
|
+
onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
|
|
478
|
+
<div class="method-source-code" id="M000037-source">
|
|
479
|
+
<pre>
|
|
480
|
+
<span class="ruby-comment cmt"># File lib/Context/Context.rb, line 54</span>
|
|
481
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">peekAtView</span>
|
|
482
|
+
<span class="ruby-identifier">setupViews</span>
|
|
483
|
+
<span class="ruby-ivar">@mainView</span>
|
|
484
|
+
<span class="ruby-keyword kw">end</span>
|
|
485
|
+
</pre>
|
|
486
|
+
</div>
|
|
487
|
+
</div>
|
|
488
|
+
</div>
|
|
489
|
+
|
|
490
|
+
<div id="method-M000043" class="method-detail">
|
|
491
|
+
<a name="M000043"></a>
|
|
492
|
+
|
|
493
|
+
<div class="method-heading">
|
|
494
|
+
<a href="#M000043" class="method-signature">
|
|
495
|
+
<span class="method-name">setKeyBinding</span><span class="method-args">(key, &binding)</span>
|
|
496
|
+
</a>
|
|
497
|
+
</div>
|
|
498
|
+
|
|
499
|
+
<div class="method-description">
|
|
500
|
+
<p>
|
|
501
|
+
Sets a binding for a key. Whenever a key is pressed, the context is
|
|
502
|
+
notified. This sets up a binding between the key and the block passed in.
|
|
503
|
+
After that point, the block will be called everytime the key is pressed.
|
|
504
|
+
</p>
|
|
505
|
+
<p>
|
|
506
|
+
Warning: This key binding mechanism is likely to be depracated, or at least
|
|
507
|
+
heavily modified soon.
|
|
508
|
+
</p>
|
|
509
|
+
<p><a class="source-toggle" href="#"
|
|
510
|
+
onclick="toggleCode('M000043-source');return false;">[Source]</a></p>
|
|
511
|
+
<div class="method-source-code" id="M000043-source">
|
|
512
|
+
<pre>
|
|
513
|
+
<span class="ruby-comment cmt"># File lib/Context/Context.rb, line 122</span>
|
|
514
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setKeyBinding</span>(<span class="ruby-identifier">key</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">binding</span>)
|
|
515
|
+
<span class="ruby-identifier">a</span> = <span class="ruby-constant">KeyAssignment</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">key</span>, <span class="ruby-operator">&</span><span class="ruby-identifier">binding</span>)
|
|
516
|
+
<span class="ruby-ivar">@keyMap</span>.<span class="ruby-identifier">add</span>(<span class="ruby-identifier">a</span>)
|
|
517
|
+
<span class="ruby-keyword kw">end</span>
|
|
518
|
+
</pre>
|
|
519
|
+
</div>
|
|
520
|
+
</div>
|
|
521
|
+
</div>
|
|
522
|
+
|
|
523
|
+
<div id="method-M000036" class="method-detail">
|
|
524
|
+
<a name="M000036"></a>
|
|
525
|
+
|
|
526
|
+
<div class="method-heading">
|
|
527
|
+
<a href="#M000036" class="method-signature">
|
|
528
|
+
<span class="method-name">setupViews</span><span class="method-args">()</span>
|
|
529
|
+
</a>
|
|
530
|
+
</div>
|
|
531
|
+
|
|
532
|
+
<div class="method-description">
|
|
533
|
+
<p>
|
|
534
|
+
This is intended to be private (how do I do that again?) Just so that it
|
|
535
|
+
doesn‘t create a view if it is already created
|
|
536
|
+
</p>
|
|
537
|
+
<p><a class="source-toggle" href="#"
|
|
538
|
+
onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
|
|
539
|
+
<div class="method-source-code" id="M000036-source">
|
|
540
|
+
<pre>
|
|
541
|
+
<span class="ruby-comment cmt"># File lib/Context/Context.rb, line 44</span>
|
|
542
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">setupViews</span>
|
|
543
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@mainView</span>.<span class="ruby-identifier">nil?</span>
|
|
544
|
+
<span class="ruby-identifier">createViews</span>
|
|
545
|
+
<span class="ruby-keyword kw">end</span>
|
|
546
|
+
<span class="ruby-keyword kw">end</span>
|
|
547
|
+
</pre>
|
|
548
|
+
</div>
|
|
549
|
+
</div>
|
|
550
|
+
</div>
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
</div>
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
</div>
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
<div id="validator-badges">
|
|
560
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
|
561
|
+
</div>
|
|
562
|
+
|
|
563
|
+
</body>
|
|
564
|
+
</html>
|