canis 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +45 -0
  3. data/CHANGES +52 -0
  4. data/Gemfile +4 -0
  5. data/LICENSE.txt +22 -0
  6. data/README.md +24 -0
  7. data/Rakefile +2 -0
  8. data/canis.gemspec +25 -0
  9. data/examples/alpmenu.rb +46 -0
  10. data/examples/app.sample +19 -0
  11. data/examples/appemail.rb +191 -0
  12. data/examples/atree.rb +105 -0
  13. data/examples/bline.rb +181 -0
  14. data/examples/common/devel.rb +319 -0
  15. data/examples/common/file.rb +93 -0
  16. data/examples/data/README.markdown +9 -0
  17. data/examples/data/brew.txt +38 -0
  18. data/examples/data/color.2 +37 -0
  19. data/examples/data/gemlist.txt +59 -0
  20. data/examples/data/lotr.txt +12 -0
  21. data/examples/data/ports.txt +136 -0
  22. data/examples/data/table.txt +37 -0
  23. data/examples/data/tasks.csv +88 -0
  24. data/examples/data/tasks.txt +27 -0
  25. data/examples/data/todo.txt +16 -0
  26. data/examples/data/todocsv.csv +28 -0
  27. data/examples/data/unix1.txt +21 -0
  28. data/examples/data/unix2.txt +11 -0
  29. data/examples/dbdemo.rb +506 -0
  30. data/examples/dirtree.rb +177 -0
  31. data/examples/newtabbedwindow.rb +100 -0
  32. data/examples/newtesttabp.rb +92 -0
  33. data/examples/tabular.rb +212 -0
  34. data/examples/tasks.rb +179 -0
  35. data/examples/term2.rb +88 -0
  36. data/examples/testbuttons.rb +307 -0
  37. data/examples/testcombo.rb +102 -0
  38. data/examples/testdb.rb +182 -0
  39. data/examples/testfields.rb +208 -0
  40. data/examples/testflowlayout.rb +43 -0
  41. data/examples/testkeypress.rb +98 -0
  42. data/examples/testlistbox.rb +187 -0
  43. data/examples/testlistbox1.rb +199 -0
  44. data/examples/testmessagebox.rb +144 -0
  45. data/examples/testprogress.rb +116 -0
  46. data/examples/testree.rb +107 -0
  47. data/examples/testsplitlayout.rb +53 -0
  48. data/examples/testsplitlayout1.rb +49 -0
  49. data/examples/teststacklayout.rb +48 -0
  50. data/examples/testwsshortcuts.rb +68 -0
  51. data/examples/testwsshortcuts2.rb +129 -0
  52. data/lib/canis.rb +16 -0
  53. data/lib/canis/core/docs/index.txt +104 -0
  54. data/lib/canis/core/docs/list.txt +16 -0
  55. data/lib/canis/core/docs/style_help.yml +34 -0
  56. data/lib/canis/core/docs/tabbedpane.txt +15 -0
  57. data/lib/canis/core/docs/table.txt +31 -0
  58. data/lib/canis/core/docs/textpad.txt +48 -0
  59. data/lib/canis/core/docs/tree.txt +23 -0
  60. data/lib/canis/core/include/.DS_Store +0 -0
  61. data/lib/canis/core/include/action.rb +83 -0
  62. data/lib/canis/core/include/actionmanager.rb +49 -0
  63. data/lib/canis/core/include/appmethods.rb +179 -0
  64. data/lib/canis/core/include/bordertitle.rb +49 -0
  65. data/lib/canis/core/include/canisparser.rb +100 -0
  66. data/lib/canis/core/include/colorparser.rb +437 -0
  67. data/lib/canis/core/include/defaultfilerenderer.rb +64 -0
  68. data/lib/canis/core/include/io.rb +320 -0
  69. data/lib/canis/core/include/layouts/SplitLayout.rb +161 -0
  70. data/lib/canis/core/include/layouts/abstractlayout.rb +213 -0
  71. data/lib/canis/core/include/layouts/flowlayout.rb +104 -0
  72. data/lib/canis/core/include/layouts/stacklayout.rb +109 -0
  73. data/lib/canis/core/include/listbindings.rb +89 -0
  74. data/lib/canis/core/include/listeditable.rb +319 -0
  75. data/lib/canis/core/include/listoperations.rb +61 -0
  76. data/lib/canis/core/include/listselectionmodel.rb +388 -0
  77. data/lib/canis/core/include/multibuffer.rb +173 -0
  78. data/lib/canis/core/include/ractionevent.rb +73 -0
  79. data/lib/canis/core/include/rchangeevent.rb +27 -0
  80. data/lib/canis/core/include/rhistory.rb +95 -0
  81. data/lib/canis/core/include/rinputdataevent.rb +47 -0
  82. data/lib/canis/core/include/textdocument.rb +111 -0
  83. data/lib/canis/core/include/vieditable.rb +175 -0
  84. data/lib/canis/core/include/widgetmenu.rb +66 -0
  85. data/lib/canis/core/system/colormap.rb +165 -0
  86. data/lib/canis/core/system/keydefs.rb +32 -0
  87. data/lib/canis/core/system/ncurses.rb +237 -0
  88. data/lib/canis/core/system/panel.rb +129 -0
  89. data/lib/canis/core/system/window.rb +1081 -0
  90. data/lib/canis/core/util/ansiparser.rb +119 -0
  91. data/lib/canis/core/util/app.rb +696 -0
  92. data/lib/canis/core/util/basestack.rb +412 -0
  93. data/lib/canis/core/util/defaultcolorparser.rb +84 -0
  94. data/lib/canis/core/util/extras/README +5 -0
  95. data/lib/canis/core/util/extras/bottomline.rb +1815 -0
  96. data/lib/canis/core/util/extras/padreader.rb +192 -0
  97. data/lib/canis/core/util/focusmanager.rb +31 -0
  98. data/lib/canis/core/util/helpmanager.rb +160 -0
  99. data/lib/canis/core/util/oldwidgetshortcuts.rb +304 -0
  100. data/lib/canis/core/util/promptmenu.rb +235 -0
  101. data/lib/canis/core/util/rcommandwindow.rb +933 -0
  102. data/lib/canis/core/util/rdialogs.rb +520 -0
  103. data/lib/canis/core/util/textutils.rb +74 -0
  104. data/lib/canis/core/util/viewer.rb +238 -0
  105. data/lib/canis/core/util/widgetshortcuts.rb +508 -0
  106. data/lib/canis/core/widgets/applicationheader.rb +103 -0
  107. data/lib/canis/core/widgets/box.rb +58 -0
  108. data/lib/canis/core/widgets/divider.rb +310 -0
  109. data/lib/canis/core/widgets/extras/README.md +12 -0
  110. data/lib/canis/core/widgets/extras/rtextarea.rb +960 -0
  111. data/lib/canis/core/widgets/extras/stackflow.rb +474 -0
  112. data/lib/canis/core/widgets/keylabelprinter.rb +194 -0
  113. data/lib/canis/core/widgets/listbox.rb +326 -0
  114. data/lib/canis/core/widgets/listfooter.rb +86 -0
  115. data/lib/canis/core/widgets/rcombo.rb +210 -0
  116. data/lib/canis/core/widgets/rcontainer.rb +415 -0
  117. data/lib/canis/core/widgets/rlink.rb +30 -0
  118. data/lib/canis/core/widgets/rmenu.rb +970 -0
  119. data/lib/canis/core/widgets/rmenulink.rb +30 -0
  120. data/lib/canis/core/widgets/rmessagebox.rb +400 -0
  121. data/lib/canis/core/widgets/rprogress.rb +118 -0
  122. data/lib/canis/core/widgets/rtabbedpane.rb +631 -0
  123. data/lib/canis/core/widgets/rtabbedwindow.rb +70 -0
  124. data/lib/canis/core/widgets/rwidget.rb +3634 -0
  125. data/lib/canis/core/widgets/scrollbar.rb +147 -0
  126. data/lib/canis/core/widgets/statusline.rb +113 -0
  127. data/lib/canis/core/widgets/table.rb +1072 -0
  128. data/lib/canis/core/widgets/tabular.rb +264 -0
  129. data/lib/canis/core/widgets/textpad.rb +1674 -0
  130. data/lib/canis/core/widgets/tree.rb +690 -0
  131. data/lib/canis/core/widgets/tree/treecellrenderer.rb +150 -0
  132. data/lib/canis/core/widgets/tree/treemodel.rb +432 -0
  133. data/lib/canis/version.rb +3 -0
  134. metadata +229 -0
@@ -0,0 +1,474 @@
1
+ =begin
2
+ * Name: stackflow.rb
3
+ A version of Container that uses stacks and flows and later grids
4
+ to place components
5
+ This is not a form. Thus it can be safely placed as a widget
6
+ without all the complicatinos of a form embedded inside another.
7
+ NOTE: Still experimental
8
+
9
+ TODO : make it only do layout, not behave like a container.
10
+ * Description
11
+ * Author: rkumar (http://github.com/rkumar/rbcurse/)
12
+ * Date: 23.10.11 - 19:55
13
+ * License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
14
+
15
+ * Last update: 2014-07-10 00:45
16
+
17
+ == CHANGES
18
+ Have moved most things out to a module ModStack, so this is sort of just
19
+ a skeletal container
20
+ x take care of margins
21
+ Resizing components
22
+ If window or container resized then redo the calc again.
23
+ Flow to have option of right to left orientation
24
+ == TODO
25
+ - If user specifies width, height then to be accounted when calculating weight. Also,
26
+ in such cases we must try not to overwrite h/w when calculating.
27
+ - changing an objects config not easy since it is stored in item, user may not have
28
+ handle to item
29
+ - weightx weighty
30
+ - RESET height only if expandable
31
+ - exceeding 100 will result in exceeding container.
32
+ - C-a C-e misbehaving in examples
33
+
34
+ =end
35
+
36
+ require 'canis'
37
+ require 'canis/core/include/bordertitle'
38
+ require 'canis/core/util/basestack'
39
+
40
+ include RubyCurses
41
+ module RubyCurses
42
+ extend self
43
+
44
+ # This is a more advanced version of container
45
+ # which allows user to stack or flow components, including
46
+ # embedding stacks within flows and viceversa.
47
+
48
+
49
+ class StackFlow < Widget
50
+
51
+ include BorderTitle
52
+ include ModStack
53
+ # should container stack objects ignoring users row col
54
+ # this is esp needed since App sets row and col which is too early
55
+ # This is now the default value, till i can redo things
56
+ #dsl_accessor :stack
57
+ attr_reader :current_component
58
+ attr_reader :components
59
+
60
+ def initialize form=nil, config={}, &block
61
+ @row_offset = @col_offset = 1
62
+ @focusable = false
63
+ @editable = false
64
+ @components = [] # all components
65
+ @focusables = [] # focusable components, makes checks easier
66
+ @active = []
67
+ super
68
+
69
+ init_vars
70
+ end
71
+ def init_vars
72
+ @repaint_required = true
73
+ @ctr = 0
74
+
75
+ @name ||= "a_stackflow"
76
+ #raise "NO components !" if @components.empty?
77
+ calc_weightages2(@components, self) # FIXME this needs to move to basestack
78
+
79
+ end
80
+
81
+
82
+ # NOTE this is called by basestack so it cannot be here FIXME
83
+
84
+ # NOTE: since we are handling the traversal, we delink the object from any
85
+ # form's widgets array that might have been added. Whenever a form is available,
86
+ # we set it (without adding widget to it) so it can print using the form's window.
87
+ #
88
+ # @param [Widget] to add
89
+ private
90
+ def __add *items
91
+ items.each do |c|
92
+ raise ArgumentError, "Nil component passed to add" unless c
93
+ if c.is_a? Widget
94
+ c.set_form @form unless c.form
95
+ if c.form && c.form != @form
96
+ #$log.debug " removing widget VIMSPLIT #{c.class} wr: #{c.row} row:#{@row} ht:#{@height} "
97
+ #c.form.remove_widget c
98
+ #c.form = nil
99
+ # or should i just stack them myself and screw what you've asked for
100
+ end
101
+ # take it out of form's control. We will control it.
102
+ #if c.form
103
+ #c.form.remove_widget c
104
+ #end
105
+ # shoot, what if at this point the container does not have a form
106
+ #attach_form c if @form
107
+ end
108
+ # most likely if you have created both container and widgets
109
+ # inside app, it would have given row after container
110
+
111
+ @components << c
112
+ if c.focusable
113
+ @focusables << c
114
+ @current_component ||= c # only the first else cursor falls on last on enter
115
+ end
116
+
117
+ end # items each
118
+ self
119
+ end
120
+
121
+ # When we get a form, we silently attach it to this object, without the form
122
+ # knowing. We don't want form managing this object.
123
+ def attach_form c
124
+ c.form = @form
125
+ c.override_graphic @graphic
126
+ c.parent_component = self
127
+ end
128
+ public
129
+ def widgets; @components; end
130
+ # what of by_name
131
+
132
+
133
+
134
+ # repaint object
135
+ # called by Form, and sometimes parent component (if not form).
136
+ def repaint # stackflow
137
+ my_win = @form ? @form.window : @target_window
138
+ @graphic = my_win unless @graphic
139
+ raise " #{@name} NO GRAPHIC set as yet STACKFLOW paint " unless @graphic
140
+ # actually at this level we don't have margins set -- not yet.
141
+ @margin_left ||= 0
142
+ @margin_right ||= 0
143
+ @margin_top ||= 0
144
+ @margin_bottom ||= 0
145
+ r = @row + @row_offset + @margin_top
146
+ c = @col + @col_offset + @margin_left
147
+ ht = @height-2-(@margin_top + @margin_bottom)
148
+ wd = @width -2-(@margin_left + @margin_right)
149
+ # should this not happen only if repaint_required ?
150
+ @components.each { |e|
151
+ e.parent_component = self
152
+ e.row = r
153
+ e.col = c
154
+ # check that we are not trying to print outside bounds
155
+ # by default we are stacking top level comps regardless of stack or flow
156
+ # otherwise too complicated
157
+ if e.is_a? BaseStack
158
+ # using ||= allows us to use overrides given by user
159
+ # but disallows us from calculating if size changes
160
+ e.height = (ht) * (e.weight * 0.01)
161
+ e.height = e.height.round
162
+ e.width = wd
163
+ if e.row + e.height >= @row + @height
164
+ #alert "is exceeding #{e.row} #{e.height} > #{@row} + #{@height} "
165
+ e.height = @height - e.row - 1
166
+ end
167
+ r += e.height
168
+ $log.debug "XXX: STACK r:#{e.row} e.h: #{e.height} w:#{e.weight} h: #{@height} "
169
+ #if e.type == :flow
170
+ #e.height ||= (@height-2) * (e.weight * 0.01)
171
+ #e.height = e.height.round
172
+ #e.width ||= (@width-2)
173
+ #r += e.height
174
+ #elsif e.type == :stack
175
+ #e.width ||= (@width-2) * (e.weight * 0.01)
176
+ #e.width = e.width.round
177
+ #e.height ||= (@height-2)
178
+ #c += e.width
179
+ #end
180
+ end
181
+ check_coords e
182
+ attach_form e unless e.form
183
+ } # seeme one if printing out
184
+ last = @components.last
185
+ if last.row + last.height < @row + @height
186
+ last.height += 1 # @row + @height - last.row + last.height
187
+ end
188
+
189
+ # if some major change has happened then repaint everything
190
+ # if multiple components then last row and col needs to be stored or else overlap will happen FIXME
191
+ if @repaint_required
192
+ $log.debug " STACKFLOW repaint graphic #{@graphic}, size:#{@components.size} "
193
+ print_borders unless @suppress_borders # do this once only, unless everything changes
194
+ @components.each { |e| e.repaint_all(true); e.repaint }
195
+ else
196
+ @components.each { |e| e.repaint }
197
+ end # if repaint_required
198
+
199
+ @repaint_required = false
200
+ end
201
+
202
+ private
203
+ def check_coords e # container
204
+ r = e.row
205
+ c = e.col
206
+ $log.debug " check_coords for #{e}. r:#{e.row} , h:#{e.height} , c:#{e.col} , w:#{e.width} "
207
+ if r >= @row + @height
208
+ $log.warn "XXX: WARN #{e.class} is out of bounds row #{r} "
209
+ e.visible = false
210
+ end
211
+ if c >= @col + @width
212
+ $log.warn "XXX: WARN #{e.class} is out of bounds col #{c} "
213
+ e.visible = false
214
+ end
215
+ if e.row + e.height >= @height
216
+ $log.warn "XXX: WARN #{e.class} is out of bounds row #{e.row} + h #{e.height} >= #{@height} "
217
+ #e.visible = false
218
+ end
219
+ if e.col + e.width >= @width
220
+ $log.warn "XXX: WARN #{e.class} is out of bounds col #{e.col} + w #{e.width} >= #{@width} "
221
+ #e.visible = false
222
+ end
223
+ end
224
+
225
+ public
226
+ # called by parent or form, otherwise its private
227
+ def handle_key ch
228
+ $log.debug " STACKFLOW handle_key #{ch} "
229
+ return if @components.empty?
230
+ _multiplier = ($multiplier == 0 ? 1 : $multiplier )
231
+
232
+ # should this go here 2011-10-19
233
+ unless @_entered
234
+ $log.warn "XXX WARN: calling ON_ENTER since in this situation it was not called"
235
+ on_enter
236
+ end
237
+ if ch == KEY_TAB
238
+ $log.debug "STACKFLOW GOTO NEXT TAB"
239
+ return goto_next_component
240
+ elsif ch == KEY_BTAB
241
+ return goto_prev_component
242
+ end
243
+ comp = @current_component
244
+ $log.debug " STACKFLOW handle_key #{ch}: #{comp}"
245
+ if comp
246
+ ret = comp.handle_key(ch)
247
+ $log.debug " STACKFLOW handle_key#{ch}: #{comp} returned #{ret} "
248
+ if ret != :UNHANDLED
249
+ comp.repaint # NOTE: if we don;t do this, then it won't get repainted. I will have to repaint ALL
250
+ # in repaint of this.
251
+ return ret
252
+ end
253
+ $log.debug "XXX STACKFLOW key unhandled by comp #{comp.name} "
254
+ else
255
+ $log.warn "XXX STACKFLOW key unhandled NULL comp"
256
+ end
257
+ case ch
258
+ when ?\C-c.getbyte(0)
259
+ $multiplier = 0
260
+ return 0
261
+ when ?0.getbyte(0)..?9.getbyte(0)
262
+ $log.debug " VIM coming here to set multiplier #{$multiplier} "
263
+ $multiplier *= 10 ; $multiplier += (ch-48)
264
+ return 0
265
+ end
266
+ ret = process_key ch, self
267
+ # allow user to map left and right if he wants
268
+ if ret == :UNHANDLED
269
+ case ch
270
+ when KEY_UP
271
+ # form will pick this up and do needful
272
+ return goto_prev_component #unless on_first_component?
273
+ when KEY_LEFT
274
+ # if i don't check for first component, key will go back to form,
275
+ # but not be processes. so focussed remain here, but be false.
276
+ # In case of returnign an unhandled TAB, on_leave will happen and cursor will move to
277
+ # previous component outside of this.
278
+ return goto_prev_component unless on_first_component?
279
+ when KEY_RIGHT
280
+ return goto_next_component #unless on_last_component?
281
+ when KEY_DOWN
282
+ return goto_next_component #unless on_last_component?
283
+ else
284
+ @_entered = false
285
+ return :UNHANDLED
286
+ end
287
+ end
288
+
289
+ $multiplier = 0
290
+ return 0
291
+ end
292
+ # Actually we should only go to current component if it accepted
293
+ # a key stroke. if user tabbed thru it, then no point going back to
294
+ # it. Go to first or last depending on TAB or BACKTAB otherwise.
295
+ # NOTE: if user comes in using DOWN or UP, last traversed component will get the focus
296
+ #
297
+ def on_enter
298
+ # if BTAB, the last comp XXX they must be focusable FIXME
299
+ if $current_key == KEY_BTAB || $current_key == KEY_UP
300
+ @current_component = @focusables.last
301
+ elsif $current_key == KEY_TAB || $current_key == KEY_DOWN
302
+ @current_component = @focusables.first
303
+ else
304
+ # let current component be, since an unhandled key may have resulted
305
+ # in on_enter being called again
306
+ end
307
+ return unless @current_component
308
+ $log.debug " STACKFLOW came to ON_ENTER #{@current_component} "
309
+ set_form_row
310
+ @_entered = true
311
+ end
312
+ # we cannot be sure that this will be called especially if this is embedded
313
+ # inside some other component
314
+ def on_leave
315
+ @_entered = false
316
+ super
317
+ end
318
+ def goto_next_component
319
+ if @current_component != nil
320
+ leave_current_component
321
+ if on_last_component?
322
+ #@_entered = false
323
+ return :UNHANDLED
324
+ end
325
+ @current_index = @focusables.index(@current_component)
326
+ index = @current_index + 1
327
+ f = @focusables[index]
328
+ if f
329
+ @current_index = index
330
+ @current_component = f
331
+ return set_form_row
332
+ end
333
+ end
334
+ @_entered = false
335
+ return :UNHANDLED
336
+ end
337
+ def goto_prev_component
338
+ if @current_component != nil
339
+ leave_current_component
340
+ if on_first_component?
341
+ @_entered = false
342
+ return :UNHANDLED
343
+ end
344
+ @current_index = @focusables.index(@current_component)
345
+ index = @current_index -= 1
346
+ f = @focusables[index]
347
+ if f
348
+ @current_index = index
349
+ @current_component = f
350
+ return set_form_row
351
+ end
352
+ end
353
+ return :UNHANDLED
354
+ end
355
+ # private
356
+ # XXX why are we calling 3 methods in a row, why not OE manages these 3
357
+ # There's double calling going on.
358
+ def set_form_row
359
+ return :UNHANDLED if @current_component.nil?
360
+ cc = @current_component
361
+ $log.debug "STACKFLOW #{@name} set_form_row calling sfr for #{cc.name}, r #{cc.row} c: #{cc.col} "
362
+ $log.debug " STACKFLOW on enter sfr #{@current_component.name} #{@current_component} "
363
+
364
+ @current_component.on_enter
365
+ @current_component.set_form_row # why was this missing in vimsplit. is it
366
+ $log.debug "STACKFLOW #{@name} set_form_row calling sfr for #{cc.name}, r #{cc.row} c: #{cc.col} "
367
+ # that on_enter does a set_form_row
368
+ @current_component.set_form_col # XXX
369
+ @current_component.repaint # OMG this could happen before we've set row and col
370
+ # XXX compo should do set_form_row and col if it has that
371
+ end
372
+ #
373
+ def set_form_col
374
+ # override widget
375
+ end
376
+ # leave the component we are on.
377
+ # This should be followed by all containers, so that the on_leave action
378
+ # of earlier comp can be displayed, such as dimming components selections
379
+ def leave_current_component
380
+ begin
381
+ @current_component.on_leave
382
+ rescue FieldValidationException => fve
383
+ alert fve.to_s
384
+ end
385
+ # NOTE this is required, since repaint will just not happen otherwise
386
+ # Some components are erroneously repainting all, after setting this to true so it is
387
+ # working there.
388
+ @current_component.repaint_required true
389
+ $log.debug " after on_leave STACKFLOW XXX #{@current_component.focussed} #{@current_component.name}"
390
+ @current_component.repaint
391
+ end
392
+
393
+ # is focus on first component FIXME check for focusable
394
+ def on_first_component?
395
+ @current_component == @focusables.first
396
+ end
397
+ # is focus on last component FIXME check for focusable
398
+ def on_last_component?
399
+ @current_component == @focusables.last
400
+ end
401
+ # set focus on given component
402
+ # Sometimes you have the handle to component, and you want to move focus to it
403
+ def goto_component comp
404
+ return if comp == @current_component
405
+ leave_current_component
406
+ @current_component = comp
407
+ set_form_row
408
+ end
409
+
410
+ def increase_current
411
+ c = @current_component
412
+ p = c.config[:parent]
413
+ $log.debug "XXX: INC increase current #{c} , #{p} "
414
+ p.increase c
415
+ end
416
+ def decrease_current
417
+ c = @current_component
418
+ p = c.config[:parent]
419
+ $log.debug "XXX: INC increase current #{c} , #{p} "
420
+ p.decrease c
421
+ end
422
+ # ADD HERE ABOVe
423
+ end # class
424
+
425
+ end # module
426
+
427
+ # NOTE this is now giving an error ni basestack.rb 87 reg margin_top.
428
+ # @see teststackflow.rb in examples dir
429
+ #
430
+ if __FILE__ == $PROGRAM_NAME
431
+ require 'canis/core/util/app'
432
+ App.new do
433
+
434
+ lb = List.new nil, :list => ["ruby","perl","lisp","jaava", "c-blunt"] , :name => "mylist"
435
+ lb1 = List.new nil, :list => ["roger","borg","haas","tsonga", "kolya","delpotro"] , :name => "mylist1"
436
+
437
+ lb2 = List.new nil, :list => `gem list --local`.split("\n") , :name => "mylist2"
438
+
439
+ alist = %w[ ruby perl python java jruby macruby rubinius rails rack sinatra pylons django cakephp grails]
440
+ str = "Hello people of this world.\nThis is a textbox.\nUse arrow keys, j/k/h/l/gg/G/C-a/C-e/C-n/C-p\n"
441
+ str << alist.join("\n")
442
+ tv = TextPad.new nil, :name => "text"
443
+ tv.set_content str
444
+ =begin
445
+ f1 = field "name", :maxlen => 20, :display_length => 20, :bgcolor => :white,
446
+ :color => :black, :text => "abc", :label => " Name: ", :label_color_pair => @datacolor
447
+ f2 = field "email", :display_length => 20, :bgcolor => :white,
448
+ :color => :blue, :text => "me@google.com", :label => "Email: ", :label_color_pair => @datacolor
449
+ f3 = radio :group => :grp, :text => "red", :value => "RED", :color => :red
450
+ f4 = radio :group => :grp, :text => "blue", :value => "BLUE", :color => :blue
451
+ f5 = radio :group => :grp, :text => "green", :value => "GREEN", :color => :green
452
+ =end
453
+
454
+ f1 = LabeledField.new nil, :maxlen => 20, :width => 20, :bgcolor => :white,
455
+ :color => :black, :text => "abc", :label => " Name: ", :label_color_pair => @datacolor
456
+ r = StackFlow.new @form, :row => 1, :col => 2, :width => 80, :height => 25, :title => "A container" do
457
+ stack :margin_left => 1 do
458
+ add tv, :weight => 30, :margin_left => 2
459
+ add lb, :weight => 30
460
+ flow :weight => 30 do
461
+ add lb1, :weight => 40
462
+ add lb2, :weight => 60
463
+ end
464
+ add f1
465
+ end # stack
466
+ end # r
467
+
468
+ #r.add(f1)
469
+ #r.add(f2)
470
+ #r.add(f3,f4,f5)
471
+ #sl = status_line
472
+
473
+ end # app
474
+ end # if