Class: Uh::Display
- Inherits:
-
Object
- Object
- Uh::Display
- Defined in:
- lib/uh/display.rb,
ext/uh/uh.c
Instance Attribute Summary collapse
- #name ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
- #check! ⇒ Object
- #close ⇒ Object
- #color_by_name(color_name) ⇒ Object
- #create_image(width, height, image) ⇒ Object
- #create_pixmap(width, height) ⇒ Object
- #create_subwindow(geo) ⇒ Object
- #create_window(geo) ⇒ Object
- #each_event ⇒ Object
- #fileno ⇒ Object
- #flush ⇒ Object
- #font ⇒ Object
- #grab_key ⇒ Object
- #listen_events ⇒ Object
- #next_event ⇒ Object
- #open ⇒ Object
- #opened? ⇒ Boolean
- #pending ⇒ Object
- #pending? ⇒ Boolean
- #query_font ⇒ Object
- #root ⇒ Object
- #screens ⇒ Object
- #sync ⇒ Object
- #to_s ⇒ Object
- #window(**opts) ⇒ Object
Instance Attribute Details
#name ⇒ Object (readonly)
Class Method Details
.on_error ⇒ Object
Instance Method Details
#check! ⇒ Object
7 8 9 |
# File 'lib/uh/display.rb', line 7 def check! fail DisplayError, 'display not opened' unless opened? end |
#close ⇒ Object
#color_by_name(color_name) ⇒ Object
11 12 13 |
# File 'lib/uh/display.rb', line 11 def color_by_name color_name Color.new self, color_name end |
#create_image(width, height, image) ⇒ Object
15 16 17 |
# File 'lib/uh/display.rb', line 15 def create_image width, height, image Image.new self, width, height, image end |
#create_pixmap(width, height) ⇒ Object
19 20 21 |
# File 'lib/uh/display.rb', line 19 def create_pixmap width, height Pixmap.new self, width, height end |
#create_subwindow(geo) ⇒ Object
27 28 29 |
# File 'lib/uh/display.rb', line 27 def create_subwindow geo root.create_sub geo end |
#create_window(geo) ⇒ Object
23 24 25 |
# File 'lib/uh/display.rb', line 23 def create_window geo root.create geo end |
#each_event ⇒ Object
#fileno ⇒ Object
#flush ⇒ Object
#font ⇒ Object
31 32 33 |
# File 'lib/uh/display.rb', line 31 def font @font ||= query_font end |
#grab_key ⇒ Object
#listen_events ⇒ Object
#next_event ⇒ Object
#open ⇒ Object
#opened? ⇒ Boolean
#pending ⇒ Object
#pending? ⇒ Boolean
35 36 37 |
# File 'lib/uh/display.rb', line 35 def pending? pending > 0 end |
#query_font ⇒ Object
39 40 41 |
# File 'lib/uh/display.rb', line 39 def query_font Font.new self end |
#root ⇒ Object
#screens ⇒ Object
#sync ⇒ Object
#to_s ⇒ Object
3 4 5 |
# File 'lib/uh/display.rb', line 3 def to_s ENV['DISPLAY'] end |
#window(**opts) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/uh/display.rb', line 43 def window **opts window = create_window Geo.new 0, 0, 320, 240 listen_events window, opts[:events] if opts.key? :events window.cursor opts[:cursor] if opts.key? :cursor window.map begin yield window ensure window.unmap window.destroy end end |