Method: Muby::Style.extract

Defined in:
lib/muby/style.rb

.extract(window) ⇒ Object

Get a Style instance from a window (so we can save it and restore it)



75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/muby/style.rb', line 75

def self.extract(window)
  tmp = []
  oldAttributes = []
  oldAttribute = 0
  oldColorPair = []
  oldColor1 = []
  oldColor2 = []

  window.wattr_get(oldAttributes,oldColorPair,tmp)
  oldAttribute = oldAttributes[0] ^ Ncurses.COLOR_PAIR(oldColorPair[0])
  Ncurses.pair_content(oldColorPair[0], oldColor1, oldColor2)

  Muby::Style.new(oldAttribute, oldColor1[0], oldColor2[0])
end