Sha256: 95928e34e5c003dfd30cdb54c269fbf8c07230a26eac11cfd6379c3c54f79b85

Contents?: true

Size: 1.5 KB

Versions: 5

Compression:

Stored size: 1.5 KB

Contents

# Copyright 2004-2007 by Kevin Smith
# released under the MIT-style wxruby2 license

class Wx::Window
  # Create a wx-specific name for get_id, to prevent confusion with
  # ruby's (deprecated) Object#id
  alias :wx_id :get_id

  # 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.
  def find_window_by_id(an_id)
    Wx::Window.find_window_by_id(an_id, self)
  end

  # 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.
  def find_window_by_name(a_name)
    Wx::Window.find_window_by_name(a_name, self)
  end

  # Searches all windows below +self+ and returns the first window which
  # has the label +a_label+.
  def find_window_by_label(a_label)
    Wx:Window.find_window_by_label(a_label, self)
  end

  alias :__old_evt_paint :evt_paint
  # 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).
  def evt_paint(&block)
    wrapped_block = proc do | event |
      instance_variable_set("@__painting__", true)
      block.call(event)
      remove_instance_variable("@__painting__")
    end
    __old_evt_paint(&wrapped_block)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
wxruby-1.9.1-powerpc-darwin8.3.0 lib/wx/classes/window.rb
wxruby-1.9.1-i686-linux lib/wx/classes/window.rb
wxruby-1.9.1-i686-darwin8.4.1 lib/wx/classes/window.rb
wxruby-1.9.1-i386-mswin32 lib/wx/classes/window.rb
wxruby-1.9.1-x86_64-linux lib/wx/classes/window.rb