class GPhoto2::CameraWidget
@abstract
Public Class Methods
factory(ptr, parent = nil)
click to toggle source
@param [FFI::GPhoto2::CameraWidget] ptr @param [GPhoto2::CameraWidget] parent
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 9 def self.factory(ptr, parent = nil) # ptr fields are supposed to be private, but we ignore that here type = ptr[:type].to_s.split('_').last.capitalize klass = GPhoto2.const_get("#{type}CameraWidget") klass.new(ptr, parent) end
new(ptr, parent = nil)
click to toggle source
@param [FFI::GPhoto2::CameraWidget] ptr @param [GPhoto2::CameraWidget] parent
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 18 def initialize(ptr, parent = nil) @ptr = ptr @parent = parent end
Public Instance Methods
children()
click to toggle source
@return [Array<GPhoto2::CameraWidget>]
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 56 def children count_children.times.map { |i| get_child(i) } end
finalize()
click to toggle source
@return [void]
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 24 def finalize free end
Also aliased as: close
flatten(map = {})
click to toggle source
@param [Hash<String,GPhoto2::CameraWidget>] map @return [Hash<String,GPhoto2::CameraWidget>]
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 62 def flatten(map = {}) case type when :window, :section children.each { |child| child.flatten(map) } else map[name] = self end map end
label()
click to toggle source
@return [String]
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 30 def label get_label end
name()
click to toggle source
@return [String]
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 35 def name get_name end
to_s()
click to toggle source
@return [String]
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 74 def to_s value.to_s end
type()
click to toggle source
@return [CameraWidgetType]
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 51 def type get_type end
value()
click to toggle source
@return [Object]
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 40 def value get_value end
value=(value)
click to toggle source
@return [Object]
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 45 def value=(value) set_value(value) value end
Protected Instance Methods
get_value()
click to toggle source
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 80 def get_value raise NotImplementedError end
set_value(value)
click to toggle source
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 84 def set_value(value) raise NotImplementedError end
Private Instance Methods
count_children()
click to toggle source
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 123 def count_children count = rc = gp_widget_count_children(ptr) GPhoto2.check!(rc) count end
free()
click to toggle source
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 90 def free rc = gp_widget_free(ptr) GPhoto2.check!(rc) end
get_child(index)
click to toggle source
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 129 def get_child(index) widget_ptr = FFI::MemoryPointer.new(:pointer) rc = gp_widget_get_child(ptr, index, widget_ptr) GPhoto2.check!(rc) widget = FFI::GPhoto2::CameraWidget.new(widget_ptr.read_pointer) CameraWidget.factory(widget, self) end
get_label()
click to toggle source
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 113 def get_label str_ptr = FFI::MemoryPointer.new(:pointer) rc = gp_widget_get_label(ptr, str_ptr) GPhoto2.check!(rc) str_ptr = str_ptr.read_pointer str_ptr.null? ? nil : str_ptr.read_string end
get_name()
click to toggle source
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 95 def get_name str_ptr = FFI::MemoryPointer.new(:pointer) rc = gp_widget_get_name(ptr, str_ptr) GPhoto2.check!(rc) str_ptr = str_ptr.read_pointer str_ptr.null? ? nil : str_ptr.read_string end
get_type()
click to toggle source
# File lib/gphoto2/camera_widgets/camera_widget.rb, line 105 def get_type # assume CameraWidgetType is an int type = FFI::MemoryPointer.new(:int) rc = gp_widget_get_type(ptr, type) GPhoto2.check!(rc) CameraWidgetType[type.read_int] end