Class: Uh::Display

Inherits:
Object
  • Object
show all
Defined in:
lib/uh/display.rb,
ext/uh/uh.c

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

Class Method Details

.on_errorObject

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

#closeObject

#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_eventObject

#filenoObject

#flushObject

#fontObject



31
32
33
# File 'lib/uh/display.rb', line 31

def font
  @font ||= query_font
end

#grab_keyObject

#listen_eventsObject

#next_eventObject

#openObject

#opened?Boolean

Returns:

  • (Boolean)

#pendingObject

#pending?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/uh/display.rb', line 35

def pending?
  pending > 0
end

#query_fontObject



39
40
41
# File 'lib/uh/display.rb', line 39

def query_font
  Font.new self
end

#rootObject

#screensObject

#syncObject

#to_sObject



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