rbcurse 1.4.1 → 1.5.0.pre1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (192) hide show
  1. data/CHANGELOG +31 -0
  2. data/README.markdown +69 -11
  3. data/VERSION +1 -1
  4. data/lib/rbcurse.rb +5 -5
  5. metadata +10 -198
  6. data/Makefile +0 -21
  7. data/Manifest.txt +0 -91
  8. data/TODO +0 -372
  9. data/TODO2.txt +0 -118
  10. data/examples/README.txt +0 -67
  11. data/examples/abasiclist.rb +0 -33
  12. data/examples/alpmenu.rb +0 -42
  13. data/examples/app.rb +0 -859
  14. data/examples/app.sample +0 -10
  15. data/examples/appdirtree.rb +0 -75
  16. data/examples/appemail.rb +0 -191
  17. data/examples/appemaillb.rb +0 -308
  18. data/examples/appgcompose.rb +0 -315
  19. data/examples/atree.rb +0 -64
  20. data/examples/common/file.rb +0 -40
  21. data/examples/common/rmail.rb +0 -257
  22. data/examples/data.txt +0 -683
  23. data/examples/data/README.markdown +0 -9
  24. data/examples/data/brew.txt +0 -38
  25. data/examples/data/color.2 +0 -37
  26. data/examples/data/gemlist.txt +0 -60
  27. data/examples/data/lotr.txt +0 -12
  28. data/examples/data/ports.txt +0 -136
  29. data/examples/data/tasks.txt +0 -27
  30. data/examples/data/todocsv.csv +0 -28
  31. data/examples/data/unix1.txt +0 -21
  32. data/examples/data/unix2.txt +0 -11
  33. data/examples/dbdemo.rb +0 -495
  34. data/examples/deprecated/appgmail.rb +0 -952
  35. data/examples/deprecated/splitp.rb +0 -56
  36. data/examples/deprecated/testscrolllb.rb +0 -86
  37. data/examples/deprecated/testscrollp.rb +0 -88
  38. data/examples/deprecated/testscrollta.rb +0 -80
  39. data/examples/deprecated/testscrolltable.rb +0 -165
  40. data/examples/deprecated/testsplit.rb +0 -87
  41. data/examples/deprecated/testsplit2.rb +0 -123
  42. data/examples/deprecated/testsplit3.rb +0 -215
  43. data/examples/deprecated/testsplit3_1.rb +0 -244
  44. data/examples/deprecated/testsplit3a.rb +0 -215
  45. data/examples/deprecated/testsplit3b.rb +0 -237
  46. data/examples/deprecated/testsplitta.rb +0 -148
  47. data/examples/deprecated/testsplittv.rb +0 -142
  48. data/examples/deprecated/testsplittvv.rb +0 -144
  49. data/examples/deprecated/testtpane.rb +0 -215
  50. data/examples/deprecated/testtpane2.rb +0 -145
  51. data/examples/deprecated/testtpanetable.rb +0 -203
  52. data/examples/dirtree.rb +0 -88
  53. data/examples/experimental/resultsetdemo.rb +0 -280
  54. data/examples/experimental/testmform.rb +0 -35
  55. data/examples/experimental/testscroller.rb +0 -117
  56. data/examples/experimental/teststackflow.rb +0 -111
  57. data/examples/menu1.rb +0 -112
  58. data/examples/multispl.rb +0 -86
  59. data/examples/newmessagebox.rb +0 -130
  60. data/examples/newtabbedwindow.rb +0 -100
  61. data/examples/newtesttabp.rb +0 -121
  62. data/examples/qdfilechooser.rb +0 -68
  63. data/examples/rfe.rb +0 -1195
  64. data/examples/rfe_renderer.rb +0 -121
  65. data/examples/sqlc.rb +0 -454
  66. data/examples/sqlm.rb +0 -437
  67. data/examples/sqlt.rb +0 -408
  68. data/examples/status.txt +0 -68
  69. data/examples/table1.rb +0 -24
  70. data/examples/term2.rb +0 -84
  71. data/examples/test1.rb +0 -239
  72. data/examples/test2.rb +0 -674
  73. data/examples/testapp.rb +0 -44
  74. data/examples/testapp2.rb +0 -58
  75. data/examples/testchars.rb +0 -137
  76. data/examples/testcombo.rb +0 -91
  77. data/examples/testkeypress.rb +0 -66
  78. data/examples/testlistbox.rb +0 -113
  79. data/examples/testmenu.rb +0 -101
  80. data/examples/testmulticomp.rb +0 -70
  81. data/examples/testmulticontainer.rb +0 -94
  82. data/examples/testmultispl.rb +0 -199
  83. data/examples/testree.rb +0 -106
  84. data/examples/testtable.rb +0 -263
  85. data/examples/testtabp.rb +0 -107
  86. data/examples/testtodo.rb +0 -584
  87. data/examples/testvimsplit.rb +0 -112
  88. data/examples/testwsshortcuts.rb +0 -64
  89. data/examples/testwsshortcuts2.rb +0 -126
  90. data/examples/todo.db +0 -0
  91. data/examples/todo.yml +0 -191
  92. data/examples/viewtodo.rb +0 -574
  93. data/lib/rbcurse/action.rb +0 -40
  94. data/lib/rbcurse/app.rb +0 -1374
  95. data/lib/rbcurse/applicationheader.rb +0 -102
  96. data/lib/rbcurse/celleditor.rb +0 -112
  97. data/lib/rbcurse/checkboxcellrenderer.rb +0 -57
  98. data/lib/rbcurse/colormap.rb +0 -159
  99. data/lib/rbcurse/comboboxcellrenderer.rb +0 -30
  100. data/lib/rbcurse/common/ansiparser.rb +0 -117
  101. data/lib/rbcurse/common/appmethods.rb +0 -112
  102. data/lib/rbcurse/common/basestack.rb +0 -407
  103. data/lib/rbcurse/common/bordertitle.rb +0 -41
  104. data/lib/rbcurse/common/chunk.rb +0 -177
  105. data/lib/rbcurse/common/colorparser.rb +0 -71
  106. data/lib/rbcurse/common/keydefs.rb +0 -30
  107. data/lib/rbcurse/common/widgetshortcuts.rb +0 -302
  108. data/lib/rbcurse/defaultlistselectionmodel.rb +0 -79
  109. data/lib/rbcurse/deprecated/README.markdown +0 -12
  110. data/lib/rbcurse/deprecated/rscrollpane.rb +0 -512
  111. data/lib/rbcurse/deprecated/rsplitpane.rb +0 -894
  112. data/lib/rbcurse/deprecated/rsplitpane2.rb +0 -1009
  113. data/lib/rbcurse/deprecated/rviewport.rb +0 -204
  114. data/lib/rbcurse/experimental/README.markdown +0 -14
  115. data/lib/rbcurse/experimental/resultsettextview.rb +0 -585
  116. data/lib/rbcurse/experimental/stackflow.rb +0 -478
  117. data/lib/rbcurse/extras/bottomline.rb +0 -1850
  118. data/lib/rbcurse/extras/box.rb +0 -58
  119. data/lib/rbcurse/extras/directorylist.rb +0 -467
  120. data/lib/rbcurse/extras/directorytree.rb +0 -69
  121. data/lib/rbcurse/extras/divider.rb +0 -310
  122. data/lib/rbcurse/extras/focusmanager.rb +0 -31
  123. data/lib/rbcurse/extras/horizlist.rb +0 -203
  124. data/lib/rbcurse/extras/listselectable.rb +0 -264
  125. data/lib/rbcurse/extras/masterdetail.rb +0 -166
  126. data/lib/rbcurse/extras/menutree.rb +0 -63
  127. data/lib/rbcurse/extras/multiform.rb +0 -330
  128. data/lib/rbcurse/extras/multilinelabel.rb +0 -142
  129. data/lib/rbcurse/extras/newmessagebox.rb +0 -328
  130. data/lib/rbcurse/extras/newtabbedpane.rb +0 -612
  131. data/lib/rbcurse/extras/newtabbedwindow.rb +0 -68
  132. data/lib/rbcurse/extras/padreader.rb +0 -189
  133. data/lib/rbcurse/extras/rcomboedit.rb +0 -256
  134. data/lib/rbcurse/extras/resultsetbrowser.rb +0 -281
  135. data/lib/rbcurse/extras/rlink.rb +0 -27
  136. data/lib/rbcurse/extras/rmenulink.rb +0 -21
  137. data/lib/rbcurse/extras/scrollbar.rb +0 -143
  138. data/lib/rbcurse/extras/statusline.rb +0 -94
  139. data/lib/rbcurse/extras/stdscrwindow.rb +0 -309
  140. data/lib/rbcurse/extras/tableextended.rb +0 -40
  141. data/lib/rbcurse/extras/tabular.rb +0 -264
  142. data/lib/rbcurse/extras/tabularwidget.rb +0 -1150
  143. data/lib/rbcurse/extras/textpad.rb +0 -516
  144. data/lib/rbcurse/extras/viewer.rb +0 -136
  145. data/lib/rbcurse/io.rb +0 -850
  146. data/lib/rbcurse/keylabelprinter.rb +0 -178
  147. data/lib/rbcurse/listcellrenderer.rb +0 -140
  148. data/lib/rbcurse/listeditable.rb +0 -310
  149. data/lib/rbcurse/listkeys.rb +0 -37
  150. data/lib/rbcurse/listscrollable.rb +0 -564
  151. data/lib/rbcurse/listselectable.rb +0 -142
  152. data/lib/rbcurse/mapper.rb +0 -130
  153. data/lib/rbcurse/orderedhash.rb +0 -77
  154. data/lib/rbcurse/ractionevent.rb +0 -67
  155. data/lib/rbcurse/rbasiclistbox.rb +0 -768
  156. data/lib/rbcurse/rchangeevent.rb +0 -27
  157. data/lib/rbcurse/rcombo.rb +0 -238
  158. data/lib/rbcurse/rcommandwindow.rb +0 -587
  159. data/lib/rbcurse/rcontainer.rb +0 -415
  160. data/lib/rbcurse/rdialogs.rb +0 -451
  161. data/lib/rbcurse/rinputdataevent.rb +0 -47
  162. data/lib/rbcurse/rlistbox.rb +0 -1196
  163. data/lib/rbcurse/rmenu.rb +0 -939
  164. data/lib/rbcurse/rmessagebox.rb +0 -348
  165. data/lib/rbcurse/rmulticontainer.rb +0 -304
  166. data/lib/rbcurse/rmultisplit.rb +0 -722
  167. data/lib/rbcurse/rmultitextview.rb +0 -306
  168. data/lib/rbcurse/rpopupmenu.rb +0 -755
  169. data/lib/rbcurse/rprogress.rb +0 -118
  170. data/lib/rbcurse/rscrollform.rb +0 -418
  171. data/lib/rbcurse/rtabbedpane.rb +0 -1158
  172. data/lib/rbcurse/rtabbedwindow.rb +0 -167
  173. data/lib/rbcurse/rtable.rb +0 -1718
  174. data/lib/rbcurse/rtextarea.rb +0 -920
  175. data/lib/rbcurse/rtextview.rb +0 -761
  176. data/lib/rbcurse/rtree.rb +0 -780
  177. data/lib/rbcurse/rvimsplit.rb +0 -763
  178. data/lib/rbcurse/rwidget.rb +0 -2915
  179. data/lib/rbcurse/scrollable.rb +0 -301
  180. data/lib/rbcurse/table/tablecellrenderer.rb +0 -86
  181. data/lib/rbcurse/table/tabledatecellrenderer.rb +0 -98
  182. data/lib/rbcurse/tree/treecellrenderer.rb +0 -150
  183. data/lib/rbcurse/tree/treemodel.rb +0 -428
  184. data/lib/rbcurse/undomanager.rb +0 -188
  185. data/lib/rbcurse/vieditable.rb +0 -144
  186. data/lib/ver/keyboard.rb +0 -150
  187. data/lib/ver/keyboard2.rb +0 -170
  188. data/lib/ver/ncurses.rb +0 -218
  189. data/lib/ver/panel.rb +0 -162
  190. data/lib/ver/rpad.rb +0 -375
  191. data/lib/ver/window.rb +0 -882
  192. data/test/test_rbcurse.rb +0 -0
@@ -1,35 +0,0 @@
1
- require 'rbcurse/app'
2
- require 'rbcurse/extras/multiform'
3
-
4
- App.new do
5
- header = app_header "rbcurse #{Rbcurse::VERSION}", :text_center => "My Demo", :text_right =>"New Improved!", :color => :black, :bgcolor => :white, :attr => :bold
6
- message "Press F10 to exit from here, F1 for help, F2 for menu"
7
-
8
- stack :margin_top => 2, :margin => 5, :width => 30 do
9
-
10
- mf = MultiForm.new @form do
11
- row 2
12
- col 2
13
- height 15
14
- width 50
15
-
16
- add_form "first" do |f|
17
- f1 = Field.new f, :name => "f1", :row => 1, :col => 10, :display_length => 15, :color => :red, :bgcolor => :white
18
- f2 = Field.new f, :name => "f2", :row => 2, :col => 10, :display_length => 15, :color => :cyan, :bgcolor => :red
19
- f1.set_buffer "ABCD"
20
- f2.set_buffer "1234a"
21
- #add_to(0, f1)
22
- #add_to(0, f2)
23
- end
24
- add_form "second" do |f|
25
- f1 = Field.new f, :name => "f1", :row => 2, :col => 10, :display_length => 15, :color => :white, :bgcolor => :blue
26
- f2 = Field.new f, :name => "F2", :row => 4, :col => 10, :display_length => 15, :color => :yellow, :bgcolor => :blue
27
- f1.set_buffer "alpha"
28
- f2.set_buffer "roger"
29
- #add_to(0, f1)
30
- #add_to(0, f2)
31
- end
32
- end
33
-
34
- end # stack
35
- end # app
@@ -1,117 +0,0 @@
1
- #$LOAD_PATH << "/Users/rahul/work/projects/rbcurse/"
2
- # this program tests out various widgets.
3
- require 'rubygems'
4
- #require 'ncurses' # FFI
5
- require 'logger'
6
- require 'rbcurse'
7
- require 'rbcurse/rwidget'
8
- require 'rbcurse/rscrollform'
9
- #require 'rbcurse/rtextarea'
10
- #require 'rbcurse/rtextview'
11
- #require 'rbcurse/rmenu'
12
- #require 'rbcurse/rcombo'
13
- #require 'rbcurse/listcellrenderer'
14
- #require 'rbcurse/checkboxcellrenderer'
15
- #require 'rbcurse/comboboxcellrenderer'
16
- #require 'rbcurse/celleditor'
17
- #require 'qdfilechooser'
18
- #require 'rbcurse/rlistbox'
19
- #require 'rbcurse/rmessagebox'
20
- if $0 == __FILE__
21
- include RubyCurses
22
-
23
- begin
24
- # Initialize curses
25
- VER::start_ncurses # this is initializing colors via ColorMap.setup
26
- $log = Logger.new((File.join(ENV["LOGDIR"] || "./" ,"rbc13.log")))
27
- $log.level = Logger::DEBUG
28
-
29
- #@window = VER::Window.root_window
30
- # Initialize few color pairs
31
- # Create the window to be associated with the form
32
- # Un post form and free the memory
33
-
34
- catch(:close) do
35
- colors = Ncurses.COLORS
36
- $log.debug "START #{colors} colors testscroller.rb --------- #{@window} "
37
- @form = ScrollForm.new @window
38
- # pad coordinates - the virtual area larger than screen
39
- h = 50
40
- w = 150
41
- row = 1
42
- col = 1
43
- @form.set_pad_dimensions(row, col, h, w)
44
- # dimensions of screen area onto which pad will paint
45
- @form.should_print_border(true)
46
-
47
- #@window.print_border_only 0, 0, 20+2, 100+2, $datacolor
48
- @window.printstring 0, 30, "Demo of ScrollForm ", $normalcolor, 'reverse'
49
- r = row + 0; fc = 12;
50
- #mnemonics = %w[ n l r p]
51
- %w[ name detail descr password street city country zip hobbies homepage facebook twitter buzz gmail ].each_with_index do |w,i|
52
- field = Field.new @form do
53
- name w
54
- row r
55
- col fc
56
- display_length 30
57
- maxlen 30
58
- #set_buffer "abcd "
59
- #set_label Label.new @form, {'text' => w, 'color'=>'cyan','mnemonic'=> mnemonics[i]}
60
- set_label Label.new @form, {'text' => w, 'color'=>'cyan'}
61
- end
62
- r += 3
63
- end
64
- r = row
65
- fc = 120
66
- # XXX while typing in a field, cursor goes off in this case
67
- %w[ operating_system version application build release shell band instrument guitarist drummer ].each_with_index do |w,i|
68
- field = Field.new @form do
69
- name w
70
- row r
71
- col fc
72
- display_length 30
73
- maxlen 30
74
- bgcolor 'white'
75
- color 'black'
76
- #set_buffer "abcd "
77
- #set_label Label.new @form, {'text' => w, 'color'=>'cyan','mnemonic'=> mnemonics[i]}
78
- set_label Label.new @form, {'text' => w, 'color'=>'cyan'}
79
- end
80
- field.overwrite_mode = true
81
- r += 3
82
- end
83
-
84
- $message = Variable.new
85
- $message.value = "Message Comes Here"
86
- message_label = RubyCurses::Label.new @form, {'text_variable' => $message, "name"=>"message_label","row" => 27, "col" => 1, "display_length" => 60, "height" => 2, 'color' => 'cyan'}
87
-
88
- # a special case required since another form (combo popup also modifies)
89
- $message.update_command() { message_label.repaint }
90
-
91
- @form.by_name["detail"].set_buffer "This form has more components"
92
- @form.by_name["descr"].set_buffer "Use M-l/h and M-n/p for scrolling"
93
-
94
- # a form level event, whenever any widget is focussed
95
- @form.bind(:ENTER) { |f| f.label && f.label.bgcolor = 'red' if f.respond_to? :label}
96
- @form.bind(:LEAVE) { |f| f.label && f.label.bgcolor = 'black' if f.respond_to? :label}
97
-
98
- @form.repaint
99
- @window.wrefresh
100
- Ncurses::Panel.update_panels
101
- while((ch = @window.getchar()) != KEY_F1 )
102
- @form.handle_key(ch)
103
- @form.repaint
104
- @window.wrefresh
105
- Ncurses::Panel.update_panels
106
- end
107
- end
108
- rescue => ex
109
- ensure
110
- @window.destroy if !@window.nil?
111
- VER::stop_ncurses
112
- p ex if ex
113
- p(ex.backtrace.join("\n")) if ex
114
- $log.debug( ex) if ex
115
- $log.debug(ex.backtrace.join("\n")) if ex
116
- end
117
- end
@@ -1,111 +0,0 @@
1
- # #!/usr/bin/env ruby -w
2
- =begin
3
- * Name : teststackflow.rb
4
- * Description : to test Container2.rb (to be renamed)
5
- * :
6
- * Author : rkumar http://github.com/rkumar/rbcurse/
7
- * Date : 25.10.11 - 12:57
8
- * License :
9
- * Last update : Use ,,L to update
10
- Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
11
-
12
- =end
13
-
14
-
15
- if __FILE__ == $PROGRAM_NAME
16
- require 'rbcurse/app'
17
- require 'rbcurse/rlistbox'
18
- require 'rbcurse/experimental/stackflow'
19
- App.new do
20
-
21
- lb = Listbox.new nil, :list => ["borodin","berlioz","bernstein","balakirev", "elgar"] , :name => "mylist"
22
- lb1 = Listbox.new nil, :list => ["bach","beethoven","mozart","gorecki", "chopin","wagner","grieg","holst"] , :name => "mylist1"
23
-
24
- lb2 = Listbox.new nil, :list => `gem list --local`.split("\n") , :name => "mylist2"
25
-
26
- alist = %w[ ruby perl python java jruby macruby rubinius rails rack sinatra pylons django cakephp grails]
27
- str = "Hello, people of Earth.\nI am HAL, a textbox.\nUse arrow keys, j/k/h/l/gg/G/C-a/C-e/C-n/C-p\n"
28
- str << alist.join("\n")
29
- require 'rbcurse/rtextview'
30
- tv = TextView.new nil, :name => "text"
31
- tv.set_content str
32
- =begin
33
- f1 = field "name", :maxlen => 20, :display_length => 20, :bgcolor => :white,
34
- :color => :black, :text => "abc", :label => " Name: ", :label_color_pair => @datacolor
35
- f2 = field "email", :display_length => 20, :bgcolor => :white,
36
- :color => :blue, :text => "me@google.com", :label => "Email: ", :label_color_pair => @datacolor
37
- f3 = radio :group => :grp, :text => "red", :value => "RED", :color => :red
38
- f4 = radio :group => :grp, :text => "blue", :value => "BLUE", :color => :blue
39
- f5 = radio :group => :grp, :text => "green", :value => "GREEN", :color => :green
40
- =end
41
-
42
- f1 = Field.new nil, :maxlen => 20, :display_length => 20, :bgcolor => :white,
43
- :color => :black, :text => "abc", :label => " Name: ", :label_color_pair => @datacolor,
44
- :valid_regex => /[A-Z][a-z]*/
45
- f2 = Field.new nil, :display_length => 20, :bgcolor => :white,
46
- :color => :blue, :text => "me@google.com", :label => "Email: ", :label_color_pair => @datacolor
47
- f3 = Field.new nil, :display_length => 20, :bgcolor => :white,
48
- :color => :blue, :text => "24", :label => "Age: ", :label_color_pair => @datacolor,
49
- :valid_range => (20..100)
50
- r = StackFlow.new @form, :row => 1, :col => 2, :width => 80, :height => 25, :title => "Stack n Flow with margins" do
51
- #stack :margin_top => 2, :margin_left => 1 do
52
- flow :margin_top => 0, :margin_left => 2, :margin_right => 0, :orientation => :right do #:weight => 49 do
53
- add tv, :weight => 40
54
- add lb2 , :weight => 50
55
- end
56
- stack :margin_top => 0, :orientation => :bottom do #stack :height => 12, :width => 78 do
57
- add lb, :weight => 40, :margin_left => 1
58
- add lb1 , :weight => 40
59
- #add f1
60
- #stack :weight => 30 do
61
- #add f1
62
- #add f2
63
- #add f3
64
- end
65
- #end # stack
66
- end # r
67
- def increase_height
68
- @r.height += 1
69
- @r.repaint_all(true)
70
- end
71
- def increase_width
72
- @r.width += 1
73
- @r.repaint_all(true)
74
- end
75
- @r = r
76
- @r.bind_key(?\M-w) {increase_width}
77
- @r.bind_key(?\M-h) {increase_height}
78
- @r.bind_key(0) {
79
- f = @r.item_for tv
80
- f1 = @r.item_for lb2
81
- p = @r.parent_of tv
82
- p1 = @r.parent_of lb2
83
- $log.debug "XXX: ITEM_FOR tv is #{f}, #{f1} #{p} , #{p1} "
84
- @ctr ||= 0
85
- case @ctr
86
- when 0
87
- @r.components[0].orientation = :left
88
- when 1
89
- @r.components[0].orientation = :right
90
- when 2
91
- @r.components[1].orientation = :top
92
- when 3
93
- @r.components[1].orientation = :bottom
94
- else
95
- @ctr = -1
96
- end
97
- $status_message.value =" Flow: #{@r.components[0].orientation} | Stack #{@r.components[1].orientation}. Use C-Space to change "
98
- @r.repaint_all(true)
99
- @ctr += 1
100
-
101
- }
102
- $status_message.value =" Flow: #{@r.components[0].orientation} | Stack #{@r.components[1].orientation}. Use Ctrl-Space to change "
103
-
104
- #r.add(f1)
105
- #r.add(f2)
106
- #r.add(f3,f4,f5)
107
- #sl = status_line
108
-
109
- st = status_line
110
- end # app
111
- end # if
data/examples/menu1.rb DELETED
@@ -1,112 +0,0 @@
1
- require 'rbcurse/app'
2
-
3
- #if $0 == __FILE__
4
- App.new do
5
- #title "Demo of Menu - rbcurse"
6
- #subtitle "Hit F1 to quit, F2 for menubar toggle"
7
- header = app_header "rbcurse #{Rbcurse::VERSION}", :text_center => "Menubar Demo", :text_right =>"enabled"
8
- form = @form
9
- mylabel = "a field"
10
-
11
- # TODO accelerators and
12
- # getting a handle for later use
13
- mb = menubar do
14
- #@toggle_key=KEY_F2
15
- menu "File" do
16
- item "Open", "O" do
17
- accelerator "Ctrl-O"
18
- command do
19
- alert "HA!! you wanted to open a file?"
20
- end
21
- end
22
- menu "QuickOpen" do
23
- item_list do
24
- Dir.glob("*.rb")
25
- end
26
- command do |menuitem, text|
27
- #alert " We gots #{text} "
28
- fld = form.by_name[mylabel]
29
- fld.text =text
30
- view text
31
- end
32
- end
33
- menu "Close" do
34
- item_list do
35
- Dir.glob("t*.rb")
36
- end
37
- end
38
- item "New", "N"
39
- separator
40
- item "Exit", "x" do
41
- command do
42
- throw(:close)
43
- end
44
- end
45
- item "Cancel Menu" do
46
- accelerator "Ctrl-g"
47
- end
48
-
49
- end # menu
50
- menu "Window" do
51
- item "Tile", "T"
52
- menu "Find" do
53
- item "More", "M"
54
- $x = item "Less", "L" do
55
- #accelerator "Ctrl-X"
56
- command do
57
- alert "You clickses on Less"
58
- end
59
- end
60
- menu "Size" do
61
- item "Zoom", "Z"
62
- item "Maximize", "X"
63
- item "Minimize", "N"
64
- end
65
- end
66
- end
67
- end # menubar
68
- mb.toggle_key = FFI::NCurses::KEY_F2
69
- mb.color = :white
70
- mb.bgcolor = :blue
71
- @form.set_menu_bar mb
72
- stack :margin_top => 10, :margin => 5 do
73
- field mylabel, :attr => 'reverse', :block_event => :CHANGE do |e|
74
- message e.to_s
75
-
76
- case e.text
77
- when "d"
78
- #alert("Me gots #{e.text} disabling menu item Window:Find: ")
79
- #$x.enabled = false
80
- when "e"
81
- # TODO this alert shows data wrapped but overlaps border
82
- #alert("Me gots #{e.text} enabling menu item Window:Find: Adding accel ")
83
- #$x.enabled = true
84
- $x.accelerator = "Ctrl-X"
85
- end
86
- end
87
- @adock = nil
88
- keyarray = [
89
- ["F10" , "Exit"], nil,
90
- ["F2", "Menu"], nil,
91
- ["M-e", "Disable"], ["M-x", "XXXX"],
92
- ["C-?", "Help"], nil
93
- ]
94
- @adock = dock keyarray
95
- lbltext = "Click this to enable or disable menu option Window:Find:Less"
96
- blank 1
97
- hline :width => lbltext.length
98
- label :text => lbltext
99
- toggle :offvalue => " Enable ", :onvalue => " Disable ", :mnemonic => 'E', :value => true do |e|
100
- $x.enabled = e.item.value
101
- header.text_right = e.item.value ? "enabled" : "disabled"
102
- if e.item.value
103
- @adock.update_application_key_label "M-e", "M-e", "Disable"
104
- else
105
- @adock.update_application_key_label "M-e", "M-e", "Enable"
106
- end
107
- #@form.handle_key mb.toggle_key
108
- end
109
- link "a linkie"
110
- end # stack
111
- end # app
112
- #end
data/examples/multispl.rb DELETED
@@ -1,86 +0,0 @@
1
- require 'rbcurse/app'
2
-
3
- App.new do
4
- header = app_header "rbcurse #{Rbcurse::VERSION}", :text_center => "MultiSplit Demo", :text_right =>"ColumnBrowse pattern"
5
- #message_row(27)
6
- message "<TAB> and <BTAB> "
7
- oo = :HORIZONTAL_SPLIT
8
- oo = :VERTICAL_SPLIT
9
-
10
- stack :margin_top => 2, :margin => 1, :width => FFI::NCurses.COLS-2 do
11
- splp = multisplit "outer", :height => FFI::NCurses.LINES - 3 , :split_count => 2, :orientation => oo do |s|
12
- #s.suppress_borders = false
13
- lb = list_box "Classes",:list => `ri -f bs`.split("\n")
14
- s.add lb
15
-
16
- lb2 = list_box "Methods", :list => ["highline", "sqlite3-ruby", "thor", "ncurses"], :choose => ["thor"]
17
- #lb2.suppress_borders true
18
- s.add lb2
19
- #sc = textarea "Edit"
20
- #s.add sc
21
- end # splp
22
- c1 = splp[0]
23
- c2 = splp[1]
24
- #c1.bind_key(KEY_RETURN){
25
- # listbox now traps key ENTER and fires PRESS event
26
- c1.bind(:PRESS){
27
- #m = Object::const_get(c1.text).public_instance_methods
28
- lines = `ri -f bs #{c1.text} | tr -d ''`.split("\n")
29
- i = lines.index "= CCllaassss mmeetthhooddss::"
30
- m = nil
31
- if i
32
- lines[i] = "Class Methods:"
33
- m = lines.slice(i..-1)
34
- i = m.index "= IInnssttaannccee mmeetthhooddss::"
35
- m[i] = "Instance Methods:" if i
36
- else
37
- i = lines.index "= IInnssttaannccee mmeetthhooddss::"
38
- if i
39
- lines[i] = "Instance Methods:"
40
- m = lines.slice(i..-1)
41
- end
42
- end
43
- if m
44
- c2.remove_all
45
- c2.insert 0, *m
46
- c2.clear_selection # since we had put default value using choose
47
- end
48
- }
49
-
50
-
51
- #blank
52
- flow do
53
- #toggle :onvalue => "Vertical", :offvalue => "Horizontal", :value => true do |e|
54
- #message "pressed #{e.state}"
55
- #case e.state
56
- #when :DESELECTED
57
- #$log.debug " about to call orientation with V"
58
- #splp.orientation :VERTICAL_SPLIT
59
- ##ret = splp.reset_to_preferred_sizes
60
- #else
61
- #$log.debug " about to call orientation with H"
62
- #splp.orientation :HORIZONTAL_SPLIT
63
- ##ret = splp.reset_to_preferred_sizes
64
- #end
65
- #end
66
- fc = splp
67
- # increase split size
68
- button "+" do
69
- #splp.set_divider_location(splp.divider_location+1)
70
- #fc.set_divider_location(splp.divider_location+1)
71
- fc.increase
72
- end
73
- # decrease split size
74
- button "-" do
75
- #fc.set_divider_location(splp.divider_location-1)
76
- fc.decrease
77
- end
78
- # equalize split size
79
- button "=" do
80
- #splp.set_resize_weight(0.50)
81
- fc.same
82
- end
83
- end
84
-
85
- end # stack
86
- end # app