module Uia::Library::ElementLayout

Public Class Methods

included(base) click to toggle source
# File lib/uia/library/element_structs.rb, line 8
def self.included(base)
  base.class_eval do
    extend StructAttributes

    layout :handle, :int,
           :runtime_id, :pointer,
           :number_of_ids, :int,
           :name, :string,
           :help_text, :string,
           :class_name, :string,
           :control_type_id, :int,
           :patterns, :pointer,
           :patterns_length, :int,
           :id, :string,
           :is_enabled, :bool,
           :is_visible, :bool,
           :has_focus, :bool,
           :bounding_rectangle, [:long, 4]

    struct_attr :id, :name, :handle, :control_type_id, :class_name, :help_text,
                [:enabled?, :is_enabled], [:visible?, :is_visible], [:focused?, :has_focus]

    def runtime_id
      self[:runtime_id].read_array_of_int(number_of_ids)
    end

    def bounding_rectangle
      self[:bounding_rectangle].to_a
    end

    def pattern_ids
      self[:patterns].read_array_of_int(self[:patterns_length])
    end

    def children
      Library.children(self)
    end

    def descendants
      Library.descendants(self)
    end

    def empty?
      to_ptr.address == 0
    end

    private
    def number_of_ids
      self[:number_of_ids]
    end
  end
end

Public Instance Methods

bounding_rectangle() click to toggle source
# File lib/uia/library/element_structs.rb, line 34
def bounding_rectangle
  self[:bounding_rectangle].to_a
end
children() click to toggle source
# File lib/uia/library/element_structs.rb, line 42
def children
  Library.children(self)
end
descendants() click to toggle source
# File lib/uia/library/element_structs.rb, line 46
def descendants
  Library.descendants(self)
end
empty?() click to toggle source
# File lib/uia/library/element_structs.rb, line 50
def empty?
  to_ptr.address == 0
end
number_of_ids() click to toggle source
# File lib/uia/library/element_structs.rb, line 55
def number_of_ids
  self[:number_of_ids]
end
pattern_ids() click to toggle source
# File lib/uia/library/element_structs.rb, line 38
def pattern_ids
  self[:patterns].read_array_of_int(self[:patterns_length])
end
runtime_id() click to toggle source
# File lib/uia/library/element_structs.rb, line 30
def runtime_id
  self[:runtime_id].read_array_of_int(number_of_ids)
end