Class: Wx::Window

Inherits:
Object
  • Object
show all
Defined in:
lib/wx/classes/window.rb

Overview

The base class for all things displayed on screen

Instance Method Summary collapse

Instance Method Details

#__old_evt_paintObject



35
# File 'lib/wx/classes/window.rb', line 35

alias :__old_evt_paint :evt_paint

#evt_paint(meth = nil, &block) ⇒ Object

This modified version of evt_paint sets a variable indicating that a paint event is being handled just before running the event handler. This ensures that any call to Window#paint within the handler will supply a Wx::PaintDC (see swig/Window.i).



40
41
42
43
44
45
46
47
48
# File 'lib/wx/classes/window.rb', line 40

def evt_paint(meth = nil, &block)
  paint_proc = acquire_handler(meth, block)
  wrapped_block = proc do | event |
    instance_variable_set("@__painting__", true)
    paint_proc.call(event)
    remove_instance_variable("@__painting__")
  end
  __old_evt_paint(&wrapped_block)
end

#find_window_by_id(an_id) ⇒ Object

Recursively searches all windows below self and returns the first window which has the id an_id. This corresponds to the find_window method method in WxWidgets when called with an integer.



18
19
20
# File 'lib/wx/classes/window.rb', line 18

def find_window_by_id(an_id)
  Wx::Window.find_window_by_id(an_id, self)
end

#find_window_by_label(a_label) ⇒ Object

Searches all windows below self and returns the first window which has the label a_label.



31
32
33
# File 'lib/wx/classes/window.rb', line 31

def find_window_by_label(a_label)
  Wx:Window.find_window_by_label(a_label, self)
end

#find_window_by_name(a_name) ⇒ Object

Searches all windows below self and returns the first window which has the name a_name This corresponds to the find_window method method in WxWidgets when called with an string.



25
26
27
# File 'lib/wx/classes/window.rb', line 25

def find_window_by_name(a_name)
  Wx::Window.find_window_by_name(a_name, self)
end