Sha256: 76b48518fc4924d40f65362005214237186bdc7f2070a00eb4872ed21be6d1ae

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

# ------------------------------------------------------------ #
#         File: box.rb
#  Description: draws a box around some group of items
#       Author: rkumar http://github.com/rkumar/rbcurse/
#         Date: 06.11.11 - 18:22
#  Last update: 06.11.11 - 19:53
# ------------------------------------------------------------ #
#
require 'rbhex/core'
require 'rbhex/core/include/bordertitle'
include RubyCurses
#include RubyCurses::BorderTitle

# @example
#
# At a later stage, we will integrate this with lists and tables, so it will happen automatically.
#
# @since 1.4.1    UNTESTED
module RubyCurses
  class Box < Widget

    include BorderTitle

    # margin for placing widgets inside
    # This is not used inside here, but is used by stacks.
    # @see widgetshortcuts.rb
    dsl_accessor :margin_left, :margin_top

    def initialize form, config={}, &block

      bordertitle_init
      super
      @window = form.window if @form
      @editable = false
      @focusable = false
      #@height += 1 # for that silly -1 that happens
      @repaint_required = true
    end

    ##
    # repaint the scrollbar
    def repaint
      return unless @repaint_required
      bc = $datacolor
      bordercolor = @border_color || bc
      borderatt = @border_attrib || Ncurses::A_NORMAL
      @window.print_border row, col, height, width, bordercolor, borderatt
      #print_borders
      print_title
      @repaint_required = false
    end
    ##
    ##
    # ADD HERE
  end
end
if __FILE__ == $PROGRAM_NAME
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rbhex-core-1.1.0.alpha3 lib/rbhex/core/widgets/box.rb