Class: Oekaki::Event
Instance Attribute Summary
Attributes inherited from Tool
#height, #width, #window
Instance Method Summary
collapse
Methods inherited from Tool
#arc, #circle, #clear, #color, #get_pic, #get_window_size, #line, #lines, #load_pic, #point, #polygon, #rectangle, #save_pic, #show_pic, #star, #text, #timer_stop
Constructor Details
#initialize ⇒ Event
Returns a new instance of Event.
112
113
114
|
# File 'lib/oekaki.rb', line 112
def initialize
super
end
|
Instance Method Details
#draw(&bk) ⇒ Object
116
117
118
|
# File 'lib/oekaki.rb', line 116
def draw(&bk)
W.signal_connect("expose_event", &bk)
end
|
#key_in(&bk) ⇒ Object
124
125
126
|
# File 'lib/oekaki.rb', line 124
def key_in(&bk)
W.signal_connect("key_press_event", &bk)
end
|
#make_window(&bk) ⇒ Object
133
134
135
136
137
138
|
# File 'lib/oekaki.rb', line 133
def make_window(&bk)
w = Gtk::Window.new
w.instance_eval(&bk)
w.show_all
w
end
|
128
129
130
131
|
# File 'lib/oekaki.rb', line 128
def mouse_button(&bk)
W.add_events(Gdk::Event::BUTTON_PRESS_MASK)
W.signal_connect("button_press_event", &bk)
end
|
#timer(interval, &bk) ⇒ Object
120
121
122
|
# File 'lib/oekaki.rb', line 120
def timer(interval, &bk)
Gtk.timeout_add(interval, &bk)
end
|
#window_changed(&bk) ⇒ Object
140
141
142
143
144
145
|
# File 'lib/oekaki.rb', line 140
def window_changed(&bk)
W.signal_connect("configure_event") do
@width, @height = get_window_size
yield
end
end
|