class Inkcite::Renderer::Button::Config

Convenience class which makes it easy to retrieve the attributes for a button.

Constants

BEVEL_COLOR
BUTTON_BACKGROUND_COLOR
BUTTON_BEVEL
BUTTON_BEVEL_COLOR
BUTTON_BGCOLOR
BUTTON_BORDER
BUTTON_BORDER_RADIUS
BUTTON_COLOR
BUTTON_FLOAT
BUTTON_FONT
BUTTON_FONT_FAMILY
BUTTON_FONT_SIZE
BUTTON_FONT_WEIGHT
BUTTON_HEIGHT
BUTTON_LETTER_SPACING
BUTTON_LINE_HEIGHT
BUTTON_MARGIN_TOP
BUTTON_PADDING
BUTTON_TEXT_SHADOW
BUTTON_WIDTH

Public Class Methods

new(ctx, opt={}) click to toggle source
# File lib/inkcite/renderer/button.rb, line 9
def initialize ctx, opt={}
  @opt = opt
  @ctx = ctx
end

Public Instance Methods

bevel() click to toggle source
# File lib/inkcite/renderer/button.rb, line 26
def bevel
  (@opt[:bevel] || @ctx[BUTTON_BEVEL]).to_i
end
bevel_color() click to toggle source
# File lib/inkcite/renderer/button.rb, line 30
def bevel_color
  @opt[BEVEL_COLOR] || @ctx[BUTTON_BEVEL_COLOR]
end
bgcolor() click to toggle source
# File lib/inkcite/renderer/button.rb, line 14
def bgcolor
  hex(@opt[:bgcolor] || @ctx[BUTTON_BGCOLOR] || @ctx[BUTTON_BACKGROUND_COLOR])
end
border() click to toggle source
# File lib/inkcite/renderer/button.rb, line 18
def border
  @opt[:border] || @ctx[BUTTON_BORDER]
end
border_bottom() click to toggle source
# File lib/inkcite/renderer/button.rb, line 22
def border_bottom
  "#{Renderer.px(bevel)} solid #{bevel_color}" if bevel > 0
end
border_radius() click to toggle source
# File lib/inkcite/renderer/button.rb, line 34
def border_radius
  (@opt[Base::BORDER_RADIUS] || @ctx[BUTTON_BORDER_RADIUS]).to_i
end
color() click to toggle source
# File lib/inkcite/renderer/button.rb, line 38
def color
  hex(@opt[:color] || @ctx[BUTTON_COLOR])
end
float() click to toggle source
# File lib/inkcite/renderer/button.rb, line 42
def float
  @opt[:align] || @opt[:float] || @ctx[BUTTON_FLOAT]
end
font() click to toggle source
# File lib/inkcite/renderer/button.rb, line 46
def font
  @opt[:font] || @ctx[BUTTON_FONT]
end
font_family() click to toggle source
# File lib/inkcite/renderer/button.rb, line 50
def font_family
  @opt[Base::FONT_FAMILY] || @ctx[BUTTON_FONT_FAMILY]
end
font_size() click to toggle source
# File lib/inkcite/renderer/button.rb, line 54
def font_size
  (@opt[Base::FONT_SIZE] || @ctx[BUTTON_FONT_SIZE]).to_i
end
font_weight() click to toggle source
# File lib/inkcite/renderer/button.rb, line 58
def font_weight
  @opt[Base::FONT_WEIGHT] || @ctx[BUTTON_FONT_WEIGHT]
end
height() click to toggle source
# File lib/inkcite/renderer/button.rb, line 62
def height
  (@opt[:height] || @ctx[BUTTON_HEIGHT]).to_i
end
letter_spacing() click to toggle source
# File lib/inkcite/renderer/button.rb, line 66
def letter_spacing
  @opt[Base::LETTER_SPACING] || @ctx[BUTTON_LETTER_SPACING]
end
line_height() click to toggle source
# File lib/inkcite/renderer/button.rb, line 70
def line_height
  @opt[Base::LINE_HEIGHT] || @ctx[BUTTON_LINE_HEIGHT]
end
margin_top() click to toggle source
# File lib/inkcite/renderer/button.rb, line 74
def margin_top
  (@opt[Base::MARGIN_TOP] || @ctx[BUTTON_MARGIN_TOP]).to_i
end
padding() click to toggle source
# File lib/inkcite/renderer/button.rb, line 78
def padding
  (@opt[:padding] || @ctx[BUTTON_PADDING]).to_i
end
text_shadow() click to toggle source
# File lib/inkcite/renderer/button.rb, line 82
def text_shadow
  hex(@opt[Base::TEXT_SHADOW] || @ctx[BUTTON_TEXT_SHADOW])
end
width() click to toggle source
# File lib/inkcite/renderer/button.rb, line 86
def width
  (@opt[:width] || @ctx[BUTTON_WIDTH]).to_i
end

Private Instance Methods

hex(color) click to toggle source

Convenient

# File lib/inkcite/renderer/button.rb, line 115
def hex color
  Renderer.hex(color)
end