Method: CDK::VIEWER#drawButtons

Defined in:
lib/cdk/components/viewer.rb

#drawButtonsObject

This redraws the viewer buttons.



648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
# File 'lib/cdk/components/viewer.rb', line 648

def drawButtons
  # No buttons, no drawing
  if @button_count == 0
    return
  end

  # Redraw the buttons.
  (0...@button_count).each do |x|
    Draw.writeChtype(@win, @button_pos[x], @box_height - 2,
        @button[x], CDK::HORIZONTAL, 0, @button_len[x])
  end

  # Highlight the current button.
  (0...@button_len[@current_button]).each do |x|
    # Strip the character of any extra attributes.
    character = charOf(@button[@current_button][x])

    # Add the character into the window.
    @win.mvwaddch(@box_height - 2, @button_pos[@current_button] + x,
        character.ord | @button_highlight)
  end

  # Refresh the window.
  wrefresh
end