rndk 0.0.1 → 0.1.0
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.
- checksums.yaml +4 -4
- data/demos/appointment.rb +40 -25
- data/demos/clock.rb +22 -11
- data/demos/fileview.rb +141 -0
- data/examples/01-hello-world.rb +1 -2
- data/examples/02-colors.rb +58 -0
- data/examples/03-markup.rb +70 -0
- data/examples/04-quick-widgets.rb +72 -0
- data/examples/05-position-widget.rb +3 -6
- data/examples/calendar.rb +104 -0
- data/examples/scroll.rb +106 -0
- data/lib/rndk/alphalist.rb +14 -14
- data/lib/rndk/button.rb +21 -21
- data/lib/rndk/buttonbox.rb +18 -18
- data/lib/rndk/calendar.rb +333 -240
- data/lib/rndk/core/color.rb +136 -0
- data/lib/rndk/core/display.rb +23 -12
- data/lib/rndk/core/draw.rb +32 -26
- data/lib/rndk/core/markup.rb +561 -0
- data/lib/rndk/core/quick_widgets.rb +232 -12
- data/lib/rndk/core/screen.rb +16 -17
- data/lib/rndk/core/utils.rb +143 -0
- data/lib/rndk/core/widget.rb +133 -92
- data/lib/rndk/dialog.rb +17 -17
- data/lib/rndk/entry.rb +21 -21
- data/lib/rndk/fselect.rb +16 -16
- data/lib/rndk/graph.rb +10 -10
- data/lib/rndk/histogram.rb +10 -10
- data/lib/rndk/itemlist.rb +20 -20
- data/lib/rndk/label.rb +66 -45
- data/lib/rndk/marquee.rb +10 -10
- data/lib/rndk/matrix.rb +27 -27
- data/lib/rndk/mentry.rb +22 -22
- data/lib/rndk/menu.rb +14 -14
- data/lib/rndk/radio.rb +19 -19
- data/lib/rndk/scale.rb +21 -21
- data/lib/rndk/scroll.rb +19 -19
- data/lib/rndk/scroller.rb +2 -0
- data/lib/rndk/selection.rb +20 -20
- data/lib/rndk/slider.rb +21 -21
- data/lib/rndk/swindow.rb +20 -20
- data/lib/rndk/template.rb +21 -21
- data/lib/rndk/version.rb +1 -1
- data/lib/rndk/viewer.rb +18 -18
- data/lib/rndk.rb +99 -777
- data/rndk.gemspec +1 -1
- metadata +12 -3
data/lib/rndk/mentry.rb
CHANGED
@@ -13,7 +13,7 @@ module RNDK
|
|
13
13
|
field_width = f_width
|
14
14
|
field_rows = f_rows
|
15
15
|
|
16
|
-
self.
|
16
|
+
self.set_box(box)
|
17
17
|
|
18
18
|
# If the field_width is a negative value, the field_width will be
|
19
19
|
# COLS-field_width, otherwise the field_width will be the given width.
|
@@ -38,7 +38,7 @@ module RNDK
|
|
38
38
|
box_width = @label_len + field_width + 2
|
39
39
|
|
40
40
|
old_width = box_width
|
41
|
-
box_width = self.
|
41
|
+
box_width = self.set_title(title, box_width)
|
42
42
|
horizontal_adjust = (box_width - old_width) / 2
|
43
43
|
|
44
44
|
box_height += @title_lines
|
@@ -117,7 +117,7 @@ module RNDK
|
|
117
117
|
# creating a new function and calling that one the mentry activation.
|
118
118
|
mentry_callback = lambda do |mentry, character|
|
119
119
|
cursor_pos = mentry.getCursorPos
|
120
|
-
newchar = Display.
|
120
|
+
newchar = Display.filter_by_display_type(mentry.disp_type, character)
|
121
121
|
|
122
122
|
if newchar == Ncurses::ERR
|
123
123
|
RNDK.beep
|
@@ -188,7 +188,7 @@ module RNDK
|
|
188
188
|
end
|
189
189
|
|
190
190
|
# Set the exit type and exit.
|
191
|
-
self.
|
191
|
+
self.set_exit_type(0)
|
192
192
|
return 0
|
193
193
|
end
|
194
194
|
|
@@ -241,7 +241,7 @@ module RNDK
|
|
241
241
|
complete = false
|
242
242
|
|
243
243
|
# Set the exit type.
|
244
|
-
self.
|
244
|
+
self.set_exit_type(0)
|
245
245
|
|
246
246
|
# Refresh the field.
|
247
247
|
self.drawField
|
@@ -388,15 +388,15 @@ module RNDK
|
|
388
388
|
if @info.size < @min + 1
|
389
389
|
RNDK.beep
|
390
390
|
else
|
391
|
-
self.
|
391
|
+
self.set_exit_type(input)
|
392
392
|
ret = @info
|
393
393
|
complete = true
|
394
394
|
end
|
395
395
|
when Ncurses::ERR
|
396
|
-
self.
|
396
|
+
self.set_exit_type(input)
|
397
397
|
complete = true
|
398
398
|
when RNDK::KEY_ESC
|
399
|
-
self.
|
399
|
+
self.set_exit_type(input)
|
400
400
|
complete = true
|
401
401
|
when RNDK::REFRESH
|
402
402
|
@screen.erase
|
@@ -424,7 +424,7 @@ module RNDK
|
|
424
424
|
end
|
425
425
|
|
426
426
|
if !complete
|
427
|
-
self.
|
427
|
+
self.set_exit_type(0)
|
428
428
|
end
|
429
429
|
|
430
430
|
@result_data = ret
|
@@ -451,7 +451,7 @@ module RNDK
|
|
451
451
|
(0...@rows).each do |x|
|
452
452
|
(0...@field_width).each do |y|
|
453
453
|
if currchar < lastpos
|
454
|
-
if Display.
|
454
|
+
if Display.is_hidden_display_type(@disp_type)
|
455
455
|
Ncurses.mvwaddch(@field_win, x, y, @filler)
|
456
456
|
else
|
457
457
|
Ncurses.mvwaddch(@field_win, x, y, @info[currchar].ord | @field_attr)
|
@@ -492,7 +492,7 @@ module RNDK
|
|
492
492
|
end
|
493
493
|
|
494
494
|
# This sets the background attribute of the widget.
|
495
|
-
def
|
495
|
+
def set_bg_attrib(attrib)
|
496
496
|
Ncurses.wbkgd(@win, attrib)
|
497
497
|
Ncurses.wbkgd(@field_win, attrib)
|
498
498
|
Ncurses.wbkgd(@label_win, attrib) unless @label_win.nil?
|
@@ -500,11 +500,11 @@ module RNDK
|
|
500
500
|
|
501
501
|
# This function erases the multiple line entry field from the screen.
|
502
502
|
def erase
|
503
|
-
if self.
|
504
|
-
RNDK.
|
505
|
-
RNDK.
|
506
|
-
RNDK.
|
507
|
-
RNDK.
|
503
|
+
if self.valid_widget?
|
504
|
+
RNDK.window_erase(@field_win)
|
505
|
+
RNDK.window_erase(@label_win)
|
506
|
+
RNDK.window_erase(@win)
|
507
|
+
RNDK.window_erase(@shadow_win)
|
508
508
|
end
|
509
509
|
end
|
510
510
|
|
@@ -513,13 +513,13 @@ module RNDK
|
|
513
513
|
self.cleanTitle
|
514
514
|
|
515
515
|
# Clean up the windows.
|
516
|
-
RNDK.
|
517
|
-
RNDK.
|
518
|
-
RNDK.
|
519
|
-
RNDK.
|
516
|
+
RNDK.window_delete(@field_win)
|
517
|
+
RNDK.window_delete(@label_win)
|
518
|
+
RNDK.window_delete(@shadow_win)
|
519
|
+
RNDK.window_delete(@win)
|
520
520
|
|
521
521
|
# Clean the key bindings.
|
522
|
-
self.
|
522
|
+
self.clean_bindings(:MENTRY)
|
523
523
|
|
524
524
|
# Unregister this object.
|
525
525
|
RNDK::Screen.unregister(:MENTRY, self)
|
@@ -529,7 +529,7 @@ module RNDK
|
|
529
529
|
def set(value, min, box)
|
530
530
|
self.setValue(value)
|
531
531
|
self.setMin(min)
|
532
|
-
self.
|
532
|
+
self.set_box(box)
|
533
533
|
end
|
534
534
|
|
535
535
|
# This removes the old information in the entry field and keeps the
|
data/lib/rndk/menu.rb
CHANGED
@@ -154,7 +154,7 @@ module RNDK
|
|
154
154
|
end
|
155
155
|
|
156
156
|
# Set the exit type and return.
|
157
|
-
self.
|
157
|
+
self.set_exit_type(0)
|
158
158
|
return -1
|
159
159
|
end
|
160
160
|
|
@@ -242,7 +242,7 @@ module RNDK
|
|
242
242
|
complete = false
|
243
243
|
|
244
244
|
# Set the exit type.
|
245
|
-
self.
|
245
|
+
self.set_exit_type(0)
|
246
246
|
|
247
247
|
# Check if there is a pre-process function to be called.
|
248
248
|
unless @pre_process_func.nil?
|
@@ -269,18 +269,18 @@ module RNDK
|
|
269
269
|
self.withinSubmenu(1)
|
270
270
|
when Ncurses::KEY_ENTER, RNDK::KEY_RETURN
|
271
271
|
self.cleanUpMenu
|
272
|
-
self.
|
272
|
+
self.set_exit_type(input)
|
273
273
|
@last_selection = @current_title * 100 + @current_subtitle
|
274
274
|
ret = @last_selection
|
275
275
|
complete = true
|
276
276
|
when RNDK::KEY_ESC
|
277
277
|
self.cleanUpMenu
|
278
|
-
self.
|
278
|
+
self.set_exit_type(input)
|
279
279
|
@last_selection = -1
|
280
280
|
ret = @last_selection
|
281
281
|
complete = true
|
282
282
|
when Ncurses::ERR
|
283
|
-
self.
|
283
|
+
self.set_exit_type(input)
|
284
284
|
complete = true
|
285
285
|
when RNDK::REFRESH
|
286
286
|
self.erase
|
@@ -295,7 +295,7 @@ module RNDK
|
|
295
295
|
end
|
296
296
|
|
297
297
|
if !complete
|
298
|
-
self.
|
298
|
+
self.set_exit_type(0)
|
299
299
|
end
|
300
300
|
|
301
301
|
@result_data = ret
|
@@ -349,7 +349,7 @@ module RNDK
|
|
349
349
|
|
350
350
|
# Erase a menu item subwindow
|
351
351
|
def eraseSubwin
|
352
|
-
RNDK.
|
352
|
+
RNDK.window_erase(@pull_win[@current_title])
|
353
353
|
|
354
354
|
# Redraw the sub-menu title.
|
355
355
|
self.drawTitle(@current_title)
|
@@ -376,7 +376,7 @@ module RNDK
|
|
376
376
|
end
|
377
377
|
|
378
378
|
# Set the background attribute of the widget.
|
379
|
-
def
|
379
|
+
def set_bg_attrib(attrib)
|
380
380
|
(0...@menu_items).each do |x|
|
381
381
|
@title_win[x].wbkgd(attrib)
|
382
382
|
@pull_win[x].wbkgd(attrib)
|
@@ -387,12 +387,12 @@ module RNDK
|
|
387
387
|
def destroy
|
388
388
|
# Clean up the windows
|
389
389
|
(0...@menu_items).each do |x|
|
390
|
-
RNDK.
|
391
|
-
RNDK.
|
390
|
+
RNDK.window_delete(@title_win[x])
|
391
|
+
RNDK.window_delete(@pull_win[x])
|
392
392
|
end
|
393
393
|
|
394
394
|
# Clean the key bindings.
|
395
|
-
self.
|
395
|
+
self.clean_bindings(:MENU)
|
396
396
|
|
397
397
|
# Unregister the object
|
398
398
|
RNDK::Screen.unregister(:MENU, self)
|
@@ -400,7 +400,7 @@ module RNDK
|
|
400
400
|
|
401
401
|
# Erase the menu widget from the screen.
|
402
402
|
def erase
|
403
|
-
if self.
|
403
|
+
if self.valid_widget?
|
404
404
|
(0...@menu_items).each do |x|
|
405
405
|
Ncurses.werase @title_win[x]
|
406
406
|
Ncurses.wrefresh @title_win[x]
|
@@ -412,7 +412,7 @@ module RNDK
|
|
412
412
|
|
413
413
|
def set(menu_item, submenu_item, title_highlight, subtitle_highlight)
|
414
414
|
self.setCurrentItem(menu_item, submenu_item)
|
415
|
-
self.
|
415
|
+
self.set_titleHighlight(title_highlight)
|
416
416
|
self.setSubTitleHighlight(subtitle_highlight)
|
417
417
|
end
|
418
418
|
|
@@ -429,7 +429,7 @@ module RNDK
|
|
429
429
|
end
|
430
430
|
|
431
431
|
# Set the attribute of the menu titles.
|
432
|
-
def
|
432
|
+
def set_titleHighlight(highlight)
|
433
433
|
@title_attr = highlight
|
434
434
|
end
|
435
435
|
|
data/lib/rndk/radio.rb
CHANGED
@@ -21,7 +21,7 @@ module RNDK
|
|
21
21
|
'>' => Ncurses::KEY_END,
|
22
22
|
}
|
23
23
|
|
24
|
-
self.
|
24
|
+
self.set_box(box)
|
25
25
|
|
26
26
|
# If the height is a negative value, height will be ROWS-height,
|
27
27
|
# otherwise the height will be the given height.
|
@@ -31,7 +31,7 @@ module RNDK
|
|
31
31
|
# otherwise the width will be the given width.
|
32
32
|
box_width = RNDK.setWidgetDimension(parent_width, width, 5)
|
33
33
|
|
34
|
-
box_width = self.
|
34
|
+
box_width = self.set_title(title, box_width)
|
35
35
|
|
36
36
|
# Set the box height.
|
37
37
|
if @title_lines > box_height
|
@@ -159,7 +159,7 @@ module RNDK
|
|
159
159
|
end
|
160
160
|
|
161
161
|
# Set the exit type and return
|
162
|
-
self.
|
162
|
+
self.set_exit_type(0)
|
163
163
|
return -1
|
164
164
|
end
|
165
165
|
|
@@ -170,7 +170,7 @@ module RNDK
|
|
170
170
|
complete = false
|
171
171
|
|
172
172
|
# Set the exit type
|
173
|
-
self.
|
173
|
+
self.set_exit_type(0)
|
174
174
|
|
175
175
|
# Draw the widget list
|
176
176
|
self.drawList(@box)
|
@@ -212,14 +212,14 @@ module RNDK
|
|
212
212
|
when ' '.ord
|
213
213
|
@selected_item = @current_item
|
214
214
|
when RNDK::KEY_ESC
|
215
|
-
self.
|
215
|
+
self.set_exit_type(input)
|
216
216
|
ret = -1
|
217
217
|
complete = true
|
218
218
|
when Ncurses::ERR
|
219
|
-
self.
|
219
|
+
self.set_exit_type(input)
|
220
220
|
complete = true
|
221
221
|
when RNDK::KEY_TAB, RNDK::KEY_RETURN, Ncurses::KEY_ENTER
|
222
|
-
self.
|
222
|
+
self.set_exit_type(input)
|
223
223
|
ret = @selected_item
|
224
224
|
complete = true
|
225
225
|
when RNDK::REFRESH
|
@@ -236,7 +236,7 @@ module RNDK
|
|
236
236
|
|
237
237
|
if !complete
|
238
238
|
self.drawList(@box)
|
239
|
-
self.
|
239
|
+
self.set_exit_type(0)
|
240
240
|
end
|
241
241
|
|
242
242
|
self.fixCursorPosition
|
@@ -339,7 +339,7 @@ module RNDK
|
|
339
339
|
end
|
340
340
|
|
341
341
|
# This sets the background attribute of the widget.
|
342
|
-
def
|
342
|
+
def set_bg_attrib(attrib)
|
343
343
|
Ncurses.wbkgd(@win, attrib)
|
344
344
|
Ncurses.wbkgd(@scrollbar_win, attrib) unless @scrollbar_win.nil?
|
345
345
|
end
|
@@ -354,12 +354,12 @@ module RNDK
|
|
354
354
|
self.destroyInfo
|
355
355
|
|
356
356
|
# Clean up the windows.
|
357
|
-
RNDK.
|
358
|
-
RNDK.
|
359
|
-
RNDK.
|
357
|
+
RNDK.window_delete(@scrollbar_win)
|
358
|
+
RNDK.window_delete(@shadow_win)
|
359
|
+
RNDK.window_delete(@win)
|
360
360
|
|
361
361
|
# Clean up the key bindings.
|
362
|
-
self.
|
362
|
+
self.clean_bindings(:RADIO)
|
363
363
|
|
364
364
|
# Unregister this object.
|
365
365
|
RNDK::Screen.unregister(:RADIO, self)
|
@@ -367,17 +367,17 @@ module RNDK
|
|
367
367
|
|
368
368
|
# This function erases the radio widget
|
369
369
|
def erase
|
370
|
-
if self.
|
371
|
-
RNDK.
|
372
|
-
RNDK.
|
370
|
+
if self.valid_widget?
|
371
|
+
RNDK.window_erase(@win)
|
372
|
+
RNDK.window_erase(@shadow_win)
|
373
373
|
end
|
374
374
|
end
|
375
375
|
|
376
376
|
# This sets various attributes of the radio list.
|
377
377
|
def set(highlight, choice_char, box)
|
378
|
-
self.
|
378
|
+
self.set_highlight(highlight)
|
379
379
|
self.setChoiceCHaracter(choice_char)
|
380
|
-
self.
|
380
|
+
self.set_box(box)
|
381
381
|
end
|
382
382
|
|
383
383
|
# This sets the radio list items.
|
@@ -410,7 +410,7 @@ module RNDK
|
|
410
410
|
end
|
411
411
|
|
412
412
|
# This sets the highlight bar of the radio list.
|
413
|
-
def
|
413
|
+
def set_highlight(highlight)
|
414
414
|
@highlight = highlight
|
415
415
|
end
|
416
416
|
|
data/lib/rndk/scale.rb
CHANGED
@@ -18,7 +18,7 @@ module RNDK
|
|
18
18
|
'$' => Ncurses::KEY_END,
|
19
19
|
}
|
20
20
|
|
21
|
-
self.
|
21
|
+
self.set_box(box)
|
22
22
|
|
23
23
|
box_height = @border_size * 2 + 1
|
24
24
|
box_width = field_width + 2 * @border_size
|
@@ -43,7 +43,7 @@ module RNDK
|
|
43
43
|
end
|
44
44
|
|
45
45
|
old_width = box_width
|
46
|
-
box_width = self.
|
46
|
+
box_width = self.set_title(title, box_width)
|
47
47
|
horizontal_adjust = (box_width - old_width) / 2
|
48
48
|
|
49
49
|
box_height += @title_lines
|
@@ -164,7 +164,7 @@ module RNDK
|
|
164
164
|
end
|
165
165
|
|
166
166
|
# Set the exit type and return.
|
167
|
-
self.
|
167
|
+
self.set_exit_type(0)
|
168
168
|
return ret
|
169
169
|
end
|
170
170
|
|
@@ -250,7 +250,7 @@ module RNDK
|
|
250
250
|
Ncurses.wmove(@field_win, 0, base)
|
251
251
|
Ncurses.winnstr(@field_win, temp, need)
|
252
252
|
temp << ' '
|
253
|
-
if RNDK.
|
253
|
+
if RNDK.is_char?(input) # Replace the char at the cursor
|
254
254
|
temp[col] = input.chr
|
255
255
|
elsif input == Ncurses::KEY_BACKSPACE
|
256
256
|
# delete the char before the cursor
|
@@ -295,7 +295,7 @@ module RNDK
|
|
295
295
|
complete = false
|
296
296
|
|
297
297
|
# Set the exit type.
|
298
|
-
self.
|
298
|
+
self.set_exit_type(0)
|
299
299
|
|
300
300
|
# Draw the field.
|
301
301
|
self.drawField
|
@@ -331,14 +331,14 @@ module RNDK
|
|
331
331
|
when Ncurses::KEY_END
|
332
332
|
@current = @high
|
333
333
|
when RNDK::KEY_TAB, RNDK::KEY_RETURN, Ncurses::KEY_ENTER
|
334
|
-
self.
|
334
|
+
self.set_exit_type(input)
|
335
335
|
ret = @current
|
336
336
|
complete = true
|
337
337
|
when RNDK::KEY_ESC
|
338
|
-
self.
|
338
|
+
self.set_exit_type(input)
|
339
339
|
complete = true
|
340
340
|
when Ncurses::ERR
|
341
|
-
self.
|
341
|
+
self.set_exit_type(input)
|
342
342
|
complete = true
|
343
343
|
when RNDK::REFRESH
|
344
344
|
@screen.erase
|
@@ -377,7 +377,7 @@ module RNDK
|
|
377
377
|
|
378
378
|
if !complete
|
379
379
|
self.drawField
|
380
|
-
self.
|
380
|
+
self.set_exit_type(0)
|
381
381
|
end
|
382
382
|
|
383
383
|
@result_data = ret
|
@@ -441,7 +441,7 @@ module RNDK
|
|
441
441
|
end
|
442
442
|
|
443
443
|
# This sets the background attribute of teh widget.
|
444
|
-
def
|
444
|
+
def set_bg_attrib attrib
|
445
445
|
Ncurses.wbkgd(@win, attrib)
|
446
446
|
Ncurses.wbkgd(@field_win, attrib)
|
447
447
|
Ncurses.wbkgd(@label_win, attrib) unless @label_win.nil?
|
@@ -453,13 +453,13 @@ module RNDK
|
|
453
453
|
@label = []
|
454
454
|
|
455
455
|
# Clean up the windows.
|
456
|
-
RNDK.
|
457
|
-
RNDK.
|
458
|
-
RNDK.
|
459
|
-
RNDK.
|
456
|
+
RNDK.window_delete @field_win
|
457
|
+
RNDK.window_delete @label_win
|
458
|
+
RNDK.window_delete @shadow_win
|
459
|
+
RNDK.window_delete @win
|
460
460
|
|
461
461
|
# Clean the key bindings.
|
462
|
-
self.
|
462
|
+
self.clean_bindings(self.object_type)
|
463
463
|
|
464
464
|
# Unregister this object
|
465
465
|
RNDK::Screen.unregister(self.object_type, self)
|
@@ -467,11 +467,11 @@ module RNDK
|
|
467
467
|
|
468
468
|
# This function erases the widget from the screen.
|
469
469
|
def erase
|
470
|
-
if self.
|
471
|
-
RNDK.
|
472
|
-
RNDK.
|
473
|
-
RNDK.
|
474
|
-
RNDK.
|
470
|
+
if self.valid_widget?
|
471
|
+
RNDK.window_erase @label_win
|
472
|
+
RNDK.window_erase @field_win
|
473
|
+
RNDK.window_erase @win
|
474
|
+
RNDK.window_erase @shadow_win
|
475
475
|
end
|
476
476
|
end
|
477
477
|
|
@@ -479,7 +479,7 @@ module RNDK
|
|
479
479
|
def set(low, high, value, box)
|
480
480
|
self.setLowHigh(low, high)
|
481
481
|
self.setValue(value)
|
482
|
-
self.
|
482
|
+
self.set_box(box)
|
483
483
|
end
|
484
484
|
|
485
485
|
# This sets the widget's value
|
data/lib/rndk/scroll.rb
CHANGED
@@ -24,7 +24,7 @@ module RNDK
|
|
24
24
|
'>' => Ncurses::KEY_END
|
25
25
|
}
|
26
26
|
|
27
|
-
self.
|
27
|
+
self.set_box(box)
|
28
28
|
|
29
29
|
# If the height is a negative value, the height will be ROWS-height,
|
30
30
|
# otherwise the height will be the given height
|
@@ -34,7 +34,7 @@ module RNDK
|
|
34
34
|
# otherwise the width will be the given width
|
35
35
|
box_width = RNDK.setWidgetDimension(parent_width, width, 0)
|
36
36
|
|
37
|
-
box_width = self.
|
37
|
+
box_width = self.set_title(title, box_width)
|
38
38
|
|
39
39
|
# Set the box height.
|
40
40
|
if @title_lines > box_height
|
@@ -178,7 +178,7 @@ module RNDK
|
|
178
178
|
end
|
179
179
|
|
180
180
|
# Set the exit type for the widget and return
|
181
|
-
self.
|
181
|
+
self.set_exit_type(0)
|
182
182
|
return -1
|
183
183
|
end
|
184
184
|
|
@@ -189,7 +189,7 @@ module RNDK
|
|
189
189
|
complete = false
|
190
190
|
|
191
191
|
# Set the exit type for the widget.
|
192
|
-
self.
|
192
|
+
self.set_exit_type(0)
|
193
193
|
|
194
194
|
# Draw the scrolling list
|
195
195
|
self.drawList(@box)
|
@@ -229,16 +229,16 @@ module RNDK
|
|
229
229
|
when '|'
|
230
230
|
@left_char = 0
|
231
231
|
when RNDK::KEY_ESC
|
232
|
-
self.
|
232
|
+
self.set_exit_type(input)
|
233
233
|
complete = true
|
234
234
|
when Ncurses::ERR
|
235
|
-
self.
|
235
|
+
self.set_exit_type(input)
|
236
236
|
complete = true
|
237
237
|
when RNDK::REFRESH
|
238
238
|
@screen.erase
|
239
239
|
@screen.refresh
|
240
240
|
when RNDK::KEY_TAB, Ncurses::KEY_ENTER, RNDK::KEY_RETURN
|
241
|
-
self.
|
241
|
+
self.set_exit_type(input)
|
242
242
|
ret = @current_item
|
243
243
|
complete = true
|
244
244
|
end
|
@@ -251,7 +251,7 @@ module RNDK
|
|
251
251
|
|
252
252
|
if !complete
|
253
253
|
self.drawList(@box)
|
254
|
-
self.
|
254
|
+
self.set_exit_type(0)
|
255
255
|
end
|
256
256
|
|
257
257
|
self.fixCursorPosition
|
@@ -371,7 +371,7 @@ module RNDK
|
|
371
371
|
end
|
372
372
|
|
373
373
|
# This sets the background attribute of the widget.
|
374
|
-
def
|
374
|
+
def set_bg_attrib(attrib)
|
375
375
|
Ncurses.wbkgd(@win, attrib)
|
376
376
|
Ncurses.wbkgd(@list_win, attrib)
|
377
377
|
unless @scrollbar_win.nil?
|
@@ -384,13 +384,13 @@ module RNDK
|
|
384
384
|
self.cleanTitle
|
385
385
|
|
386
386
|
# Clean up the windows.
|
387
|
-
RNDK.
|
388
|
-
RNDK.
|
389
|
-
RNDK.
|
390
|
-
RNDK.
|
387
|
+
RNDK.window_delete(@scrollbar_win)
|
388
|
+
RNDK.window_delete(@shadow_win)
|
389
|
+
RNDK.window_delete(@list_win)
|
390
|
+
RNDK.window_delete(@win)
|
391
391
|
|
392
392
|
# Clean the key bindings.
|
393
|
-
self.
|
393
|
+
self.clean_bindings(:SCROLL)
|
394
394
|
|
395
395
|
# Unregister this object
|
396
396
|
RNDK::Screen.unregister(:SCROLL, self)
|
@@ -398,8 +398,8 @@ module RNDK
|
|
398
398
|
|
399
399
|
# This function erases the scrolling list from the screen.
|
400
400
|
def erase
|
401
|
-
RNDK.
|
402
|
-
RNDK.
|
401
|
+
RNDK.window_erase(@win)
|
402
|
+
RNDK.window_erase(@shadow_win)
|
403
403
|
end
|
404
404
|
|
405
405
|
def allocListArrays(old_size, new_size)
|
@@ -476,8 +476,8 @@ module RNDK
|
|
476
476
|
# This sets certain attributes of the scrolling list.
|
477
477
|
def set(list, list_size, numbers, highlight, box)
|
478
478
|
self.setItems(list, list_size, numbers)
|
479
|
-
self.
|
480
|
-
self.
|
479
|
+
self.set_highlight(highlight)
|
480
|
+
self.set_box(box)
|
481
481
|
end
|
482
482
|
|
483
483
|
# This sets the scrolling list items
|
@@ -505,7 +505,7 @@ module RNDK
|
|
505
505
|
end
|
506
506
|
|
507
507
|
# This sets the highlight of the scrolling list.
|
508
|
-
def
|
508
|
+
def set_highlight(highlight)
|
509
509
|
@highlight = highlight
|
510
510
|
end
|
511
511
|
|