Module: GraphicContext

Included in:
Curses::Geometry
Defined in:
lib/curses/geometry/graphic_context.rb

Constant Summary collapse

@@graphic_context =
{ :color_pairs  => {},
:stroke_glyph => 's',
:fill_glyph   => 'f' }

Instance Method Summary collapse

Instance Method Details

#get_fill_glyphObject



28
29
30
# File 'lib/curses/geometry/graphic_context.rb', line 28

def get_fill_glyph
  @@graphic_context[:fill_glyph]
end

#get_graphic_contextObject



6
7
8
# File 'lib/curses/geometry/graphic_context.rb', line 6

def get_graphic_context
  @@graphic_context
end

#get_stroke_glyphObject



20
21
22
# File 'lib/curses/geometry/graphic_context.rb', line 20

def get_stroke_glyph
  @@graphic_context[:stroke_glyph]
end

#register_color_pair(name, front_color, back_color) ⇒ Object



10
11
12
13
14
# File 'lib/curses/geometry/graphic_context.rb', line 10

def register_color_pair(name, front_color, back_color)
  new_pair_index = @@graphic_context[:color_pairs].length + 1
  init_pair(new_pair_index, front_color, back_color)
  @@graphic_context[:color_pairs][name] = new_pair_index
end

#set_color_pair(name) ⇒ Object



16
17
18
# File 'lib/curses/geometry/graphic_context.rb', line 16

def set_color_pair(name)
  attron color_pair(@@graphic_context[:color_pairs][name])
end

#set_fill_glyph(glyph) ⇒ Object



32
33
34
# File 'lib/curses/geometry/graphic_context.rb', line 32

def set_fill_glyph(glyph)
  @@graphic_context[:fill_glyph]    = glyph
end

#set_stroke_glyph(glyph) ⇒ Object



24
25
26
# File 'lib/curses/geometry/graphic_context.rb', line 24

def set_stroke_glyph(glyph)
  @@graphic_context[:stroke_glyph]  = glyph
end