Class: RubyCurses::ApplicationHeader

Inherits:
Widget show all
Defined in:
lib/rbcurse/applicationheader.rb

Overview

Since:

  • 1.2.0 UNTESTED

Constant Summary

Constants included from Io

Io::ERROR_COLOR_PAIR, Io::FOOTER_COLOR_PAIR, Io::LINEONE, Io::MAIN_WINDOW_COLOR_PAIR

Instance Attribute Summary

Attributes inherited from Widget

#_object_created, #col_offset, #cols_panned, #config, #curpos, #focussed, #form, #id, #parent_component, #row_offset, #rows_panned, #state

Instance Method Summary collapse

Methods inherited from Widget

#changed, #click, #destroy, #enter, #event_list, #focus, #get_preferred_size, #getvalue_for_paint, #handle_key, #height, #height=, #hide, #init_vars, #leave, #modified?, #move, #on_enter, #on_leave, #override_graphic, #printstring, #process_key, #remove, #repaint_all, #repaint_required, #rowcol, #set_buffer_modified, #set_buffering, #set_form, #set_form_col, #set_form_row, #set_modified, #setformrowcol, #setrowcol, #show, #text_variable, #unbind_key, #width, #width=

Methods included from Io

#askchoice, #askyesno, #askyesnocancel, #clear_error, #clear_this, #get_string, #newaskyesno, #old_print_header, #old_print_top_right, #print_action, #print_error, #print_footer_help, #print_headers, #print_help, #print_help_page, #print_in_middle, #print_key_labels, #print_key_labels_row, #print_screen_labels, #print_status, #print_this, #rbgetstr, #warn

Methods included from Utils

#_process_key, #bind_key, #clean_string!, #get_color, #keycode_tos, #repeatm, #view, #wrap_text

Methods included from ConfigSetup

#cget, #config_setup, #configure, #variable_set

Methods included from EventHandler

#bind, #fire_handler, #fire_property_change

Constructor Details

#initialize(form, text1, config = {}, &block) ⇒ ApplicationHeader

Returns a new instance of ApplicationHeader.

Since:

  • 1.2.0 UNTESTED



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rbcurse/applicationheader.rb', line 12

def initialize form, text1, config={}, &block

  @text1 = text1
  # setting default first or else Widget will place its BW default
  @color, @bgcolor = ColorMap.get_colors_for_pair $bottomcolor
  super form, config, &block
  @color_pair = get_color $bottomcolor, @color, @bgcolor
  @window = form.window
  @editable = false
  @focusable = false
  @cols ||= Ncurses.COLS-1
  @row ||= 0
  @col ||= 0
  @repaint_required = true
  #@color_pair ||= $bottomcolor  # XXX this was forcing the color
  #pair
  @text2 ||= ""
  @text_center ||= ""
  @text_right ||= ""
end

Instance Method Details

#getvalueObject

Since:

  • 1.2.0 UNTESTED



32
33
34
# File 'lib/rbcurse/applicationheader.rb', line 32

def getvalue
  @text1
end

Since:

  • 1.2.0 UNTESTED



46
47
48
49
50
51
# File 'lib/rbcurse/applicationheader.rb', line 46

def print_header(htext, r = 0, c = 0)
$log.debug " def print_header(#{htext}, posy = 0, posx = 0)"
  win = @window
  len = Ncurses.COLS-0
  @form.window.printstring r, c, "%-*s" % [len, htext], @color_pair, @attr
end

Since:

  • 1.2.0 UNTESTED



52
53
54
55
56
57
# File 'lib/rbcurse/applicationheader.rb', line 52

def print_top_right(htext)
$log.debug " def print_top_right(#{htext})"
  hlen = htext.length
  len = Ncurses.COLS-1
  @form.window.printstring 0, len-hlen, htext, @color_pair, @attr
end

#repaintObject

XXX need to move wrapping etc up and done once.

Since:

  • 1.2.0 UNTESTED



38
39
40
41
42
43
44
45
# File 'lib/rbcurse/applicationheader.rb', line 38

def repaint
  return unless @repaint_required
 
  #print_header(htext, posy = 0, posx = 0)
  print_header(@text1 + " %15s " % @text2 + " %20s" % @text_center , posy=0, posx=0)
  print_top_right(@text_right)
  @repaint_required = false
end