Class: RubyCurses::ApplicationHeader

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

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

#col_offset, #cols_panned, #config, #curpos, #ext_col_offset, #ext_row_offset, #form, #id, #parent_component, #row_offset, #rows_panned, #should_create_buffer, #state

Instance Method Summary collapse

Methods inherited from Widget

#OLDbind_key, #buffer_to_screen, #buffer_to_window, #create_buffer, #destroy, #destroy_buffer, #focus, #get_buffer, #get_color, #get_preferred_size, #getvalue_for_paint, #handle_key, #height, #height=, #hide, #init_vars, #is_double_buffered?, #modified?, #move, #on_enter, #on_leave, #override_graphic, #printstring, #process_key, #remove, #repaint_all, #repaint_required, #rowcol, #safe_create_buffer, #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

Methods included from Utils

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

Methods included from ConfigSetup

#cget, #config_setup, #configure, #variable_set

Methods included from EventHandler

#bind, #fire_handler, #fire_property_change

Methods included from DSL

#OLD_method_missing

Constructor Details

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

Returns a new instance of ApplicationHeader.



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

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

  @text1 = text1
  super form, config, &block
  @window = form.window
  @editable = false
  @focusable = false
  @cols ||= Ncurses.COLS-1
  @row ||= 0
  @col ||= 0
  @repaint_required = true
  @color_pair ||= $bottomcolor
  @text2 ||= ""
  @text_center ||= ""
  @text_right ||= ""
end

Instance Method Details

#getvalueObject



28
29
30
# File 'lib/rbcurse/applicationheader.rb', line 28

def getvalue
  @text1
end


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

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


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

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.



34
35
36
37
38
39
40
# File 'lib/rbcurse/applicationheader.rb', line 34

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