Parent

Files

Wx::Window

The base class for all things displayed on screen

Public Instance Methods

__old_evt_paint(meth = nil, &block) click to toggle source

Alias for evt_paint

construct_children(&block) click to toggle source

(Not documented)

# File wxconstructor.rb, line 11
        def construct_children(&block)
                c = WxConstructor.new(self)
                c.instance_exec(self, &block)
        end
evt_paint(meth = nil, &block) click to toggle source

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).

# File 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
Also aliased as: __old_evt_paint
find_window_by_id(an_id) click to toggle source

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.

# File 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) click to toggle source

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

# File 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) click to toggle source

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.

# File wx/classes/window.rb, line 25
  def find_window_by_name(a_name)
    Wx::Window.find_window_by_name(a_name, self)
  end
paint_buffered(buffer = nil) {|dc| ...} click to toggle source

Provides bufferd drawing facility to reduce flicker for complex drawing commands. Works similar to BufferedDC and BufferedPaintDC in the wxWidgets API, by doing drawing on an in-memory Bitmap, then copying the result in bulk to the screen.

The method may be passed an existing Wx::Bitmap as the buffer, otherwise one will be created.

Works like wxAutoBufferedDC in that additional buffering will only be done on platforms that do not already natively support buffering for the standard PaintDC / ClientDC - Windows, in particular.

# File wx/classes/window.rb, line 61
  def paint_buffered(buffer = nil)
    # OS X and GTK do double-buffering natively
    if self.double_buffered?
      paint { | dc | yield dc }
    else
      # client_size is the window area available for drawing upon
      c_size = client_size
      # Create an in-memory buffer if none supplied
      buffer ||= Wx::Bitmap.new(c_size.width, c_size.height)
      buffer.draw do | mem_dc |
        mem_dc.background = Wx::TRANSPARENT_BRUSH
        mem_dc.clear
        # Yield the bitmap for the user code to draw upon
        yield mem_dc
        paint do | dc | 
          # Copy the buffer to the window
          dc.blit(0, 0, c_size.width, c_size.height, mem_dc, 0, 0)
        end
      end
    end
  end

Disabled; run with $DEBUG to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.