Class: HandyToolbox::Ui
- Inherits:
-
Object
- Object
- HandyToolbox::Ui
- Defined in:
- lib/handy_toolbox/ui.rb
Class Method Summary collapse
- .attr_off(value) ⇒ Object
- .attr_on(value) ⇒ Object
- .bold(condition = true) ⇒ Object
- .bold_off ⇒ Object
- .bold_on ⇒ Object
- .dim(condition = true) ⇒ Object
- .dim_off ⇒ Object
- .dim_on ⇒ Object
- .hide_cursor ⇒ Object
- .highlight(condition = true) ⇒ Object
- .highlight_off ⇒ Object
- .highlight_on ⇒ Object
- .pos(x, y) ⇒ Object
- .reverse ⇒ Object
- .scroll_by(val) ⇒ Object
- .text(str) ⇒ Object
- .text_at(x, y, str) ⇒ Object
Class Method Details
.attr_off(value) ⇒ Object
76 77 78 |
# File 'lib/handy_toolbox/ui.rb', line 76 def self.attr_off(value) Curses.attroff(value) end |
.attr_on(value) ⇒ Object
72 73 74 |
# File 'lib/handy_toolbox/ui.rb', line 72 def self.attr_on(value) Curses.attron(value) end |
.bold(condition = true) ⇒ Object
62 63 64 65 66 |
# File 'lib/handy_toolbox/ui.rb', line 62 def self.bold(condition = true) bold_on if condition yield bold_off if condition end |
.bold_off ⇒ Object
58 59 60 |
# File 'lib/handy_toolbox/ui.rb', line 58 def self.bold_off attr_off Curses::A_BOLD end |
.bold_on ⇒ Object
54 55 56 |
# File 'lib/handy_toolbox/ui.rb', line 54 def self.bold_on attr_on Curses::A_BOLD end |
.dim(condition = true) ⇒ Object
48 49 50 51 52 |
# File 'lib/handy_toolbox/ui.rb', line 48 def self.dim(condition = true) dim_on if condition yield dim_off if condition end |
.dim_off ⇒ Object
44 45 46 |
# File 'lib/handy_toolbox/ui.rb', line 44 def self.dim_off attr_off Curses::A_DIM end |
.dim_on ⇒ Object
40 41 42 |
# File 'lib/handy_toolbox/ui.rb', line 40 def self.dim_on attr_on Curses::A_DIM end |
.hide_cursor ⇒ Object
68 69 70 |
# File 'lib/handy_toolbox/ui.rb', line 68 def self.hide_cursor Curses.curs_set(0) end |
.highlight(condition = true) ⇒ Object
28 29 30 31 32 |
# File 'lib/handy_toolbox/ui.rb', line 28 def self.highlight(condition = true) highlight_on if condition yield highlight_off if condition end |
.highlight_off ⇒ Object
24 25 26 |
# File 'lib/handy_toolbox/ui.rb', line 24 def self.highlight_off attr_off Curses::A_STANDOUT end |
.highlight_on ⇒ Object
20 21 22 |
# File 'lib/handy_toolbox/ui.rb', line 20 def self.highlight_on attr_on Curses::A_STANDOUT end |
.pos(x, y) ⇒ Object
7 8 9 |
# File 'lib/handy_toolbox/ui.rb', line 7 def self.pos(x, y) Curses.setpos(y, x) end |
.reverse ⇒ Object
34 35 36 37 38 |
# File 'lib/handy_toolbox/ui.rb', line 34 def self.reverse attr_on Curses::A_REVERSE yield attr_off Curses::A_REVERSE end |
.scroll_by(val) ⇒ Object
80 81 82 |
# File 'lib/handy_toolbox/ui.rb', line 80 def self.scroll_by(val) Curses.scrl(val) end |
.text(str) ⇒ Object
11 12 13 |
# File 'lib/handy_toolbox/ui.rb', line 11 def self.text(str) Curses.addstr(str) end |
.text_at(x, y, str) ⇒ Object
15 16 17 18 |
# File 'lib/handy_toolbox/ui.rb', line 15 def self.text_at(x, y, str) pos(x, y) text(str) end |