Class: GTK::Device

Inherits:
Object show all
Defined in:
dragon/layout.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDevice

Returns a new instance of Device.


122
123
124
125
126
127
128
129
130
# File 'dragon/layout.rb', line 122

def initialize
  @name         = ""
  @w            = 0
  @h            = 0
  @safe_area    = SafeArea.new
  @grid_area    = GridArea.new
  @control_area = ControlArea.new
  @aspect       = AspectRatio.new
end

Instance Attribute Details

#aspectObject (readonly)

Returns the value of attribute aspect


120
121
122
# File 'dragon/layout.rb', line 120

def aspect
  @aspect
end

#control_areaObject (readonly)

Returns the value of attribute control_area


120
121
122
# File 'dragon/layout.rb', line 120

def control_area
  @control_area
end

#grid_areaObject (readonly)

Returns the value of attribute grid_area


120
121
122
# File 'dragon/layout.rb', line 120

def grid_area
  @grid_area
end

#hObject (readonly)

Returns the value of attribute h


120
121
122
# File 'dragon/layout.rb', line 120

def h
  @h
end

#nameObject (readonly)

Returns the value of attribute name


120
121
122
# File 'dragon/layout.rb', line 120

def name
  @name
end

#safe_areaObject (readonly)

Returns the value of attribute safe_area


120
121
122
# File 'dragon/layout.rb', line 120

def safe_area
  @safe_area
end

#wObject (readonly)

Returns the value of attribute w


120
121
122
# File 'dragon/layout.rb', line 120

def w
  @w
end

Instance Method Details

#assert!(result, message) ⇒ Object


132
133
134
135
# File 'dragon/layout.rb', line 132

def assert! result, message
  return if result
  raise message
end

#check_math!Object


137
138
139
140
# File 'dragon/layout.rb', line 137

def check_math!
  assert! (@control_area.w + @control_area.margin.left + @control_area.margin.right) == @w, "Math for Width didn't pan out."
  assert! (@control_area.h + @control_area.margin.top + @control_area.margin.bottom) == @h, "Math for Height didn't pan out."
end

#inspectObject


154
155
156
# File 'dragon/layout.rb', line 154

def inspect
  serialize.to_s
end

#serializeObject


142
143
144
145
146
147
148
149
150
151
152
# File 'dragon/layout.rb', line 142

def serialize
  {
    name:         @name,
    w:            @w,
    h:            @h,
    aspect:       @aspect.serialize,
    safe_area:    @safe_area.serialize,
    grid_area:    @grid_area.serialize,
    control_area: @control_area.serialize
  }
end

#to_sObject


158
159
160
# File 'dragon/layout.rb', line 158

def to_s
  serialize.to_s
end