Class: GPhoto2::CameraWidget Abstract

Inherits:
Object
  • Object
show all
Includes:
FFI::GPhoto2, Struct
Defined in:
lib/gphoto2/camera_widgets/camera_widget.rb

Overview

This class is abstract.

Constant Summary

Constants included from FFI::GPhoto2

FFI::GPhoto2::CameraCaptureType, FFI::GPhoto2::CameraDriverStatus, FFI::GPhoto2::CameraEventType, FFI::GPhoto2::CameraFileAccessType, FFI::GPhoto2::CameraFileInfoFields, FFI::GPhoto2::CameraFileOperation, FFI::GPhoto2::CameraFilePermissions, FFI::GPhoto2::CameraFileStatus, FFI::GPhoto2::CameraFileType, FFI::GPhoto2::CameraFolderOperation, FFI::GPhoto2::CameraOperation, FFI::GPhoto2::CameraWidgetType, FFI::GPhoto2::GphotoDeviceType

Instance Attribute Summary

Attributes included from Struct

#ptr

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Struct

#to_ptr

Constructor Details

#initialize(ptr, parent = nil) ⇒ CameraWidget

Returns a new instance of CameraWidget.

Parameters:



18
19
20
21
# File 'lib/gphoto2/camera_widgets/camera_widget.rb', line 18

def initialize(ptr, parent = nil)
  @ptr = ptr
  @parent = parent
end

Class Method Details

.factory(ptr, parent = nil) ⇒ Object

Parameters:



9
10
11
12
13
14
# 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

Instance Method Details

#childrenArray<GPhoto2::CameraWidget>

Returns:



56
57
58
# File 'lib/gphoto2/camera_widgets/camera_widget.rb', line 56

def children
  count_children.times.map { |i| get_child(i) }
end

#finalizevoid Also known as: close

This method returns an undefined value.



24
25
26
# File 'lib/gphoto2/camera_widgets/camera_widget.rb', line 24

def finalize
  free
end

#flatten(map = {}) ⇒ Hash<String,GPhoto2::CameraWidget>

Parameters:

Returns:



62
63
64
65
66
67
68
69
70
71
# 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

#labelString

Returns:

  • (String)


30
31
32
# File 'lib/gphoto2/camera_widgets/camera_widget.rb', line 30

def label
  get_label
end

#nameString

Returns:

  • (String)


35
36
37
# File 'lib/gphoto2/camera_widgets/camera_widget.rb', line 35

def name
  get_name
end

#to_sString

Returns:

  • (String)


74
75
76
# File 'lib/gphoto2/camera_widgets/camera_widget.rb', line 74

def to_s
  value.to_s
end

#typeCameraWidgetType

Returns:



51
52
53
# File 'lib/gphoto2/camera_widgets/camera_widget.rb', line 51

def type
  get_type
end

#valueObject

Returns:

  • (Object)


40
41
42
# File 'lib/gphoto2/camera_widgets/camera_widget.rb', line 40

def value
  get_value
end

#value=(value) ⇒ Object

Returns:

  • (Object)


45
46
47
48
# File 'lib/gphoto2/camera_widgets/camera_widget.rb', line 45

def value=(value)
  set_value(value)
  value
end