Class: GGLib::Label

Inherits:
Widget show all
Defined in:
lib/ext/widgets.rb

Instance Attribute Summary collapse

Attributes inherited from Widget

#buttonId, #defimage, #id, #name, #sleeping, #theme, #window, #zfocus

Attributes inherited from Containable

#align, #container, #maxSize, #minSize, #offset, #padding, #valign

Attributes inherited from Tile

#id, #inclusive, #x1, #x2, #y1, #y2

Instance Method Summary collapse

Methods inherited from Widget

#acceptStickyFocus?, #acceptText?, #blur, #button, #clicked?, #del, #downevent, #event, #feedText, #focus, #hasFocus?, #hasStickyFocus?, #intDraw, #onClick, #onDelete, #onDrag, #onInitialize, #onKeyDown, #onKeyUp, #onMouseDown, #onMouseOut, #onMouseOver, #onRightClick, #onRightDrag, #onRightMouseDown, #onStickyBlur, #onStickyFocus, #over?, #sleep, #sleeping?, #stickFocus, #unstickFocus, #wakeUp

Methods inherited from Tile

#centerOn, #del, deleteAllInstances, deleteById, #each, #eachBorder, getAllInstances, getById, #height, #iTile, intersect?, #intersect?, #isInTile?, #move, #resize, setAllInstances, #setCoordinates, #setTile, #width, #xTile

Constructor Details

#initialize(name, text, x, y, theme = Themes::blank) ⇒ Label

Returns a new instance of Label.



352
353
354
355
356
# File 'lib/ext/widgets.rb', line 352

def initialize(name, text, x, y, theme = Themes::blank)
  @text = text
  @initialized = false
  super(name, x, y, x+100,y+30,theme)
end

Instance Attribute Details

#textObject

Returns the value of attribute text.



351
352
353
# File 'lib/ext/widgets.rb', line 351

def text
  @text
end

Instance Method Details

#drawObject



361
362
363
364
365
366
367
368
# File 'lib/ext/widgets.rb', line 361

def draw
  if not @initialized
    @x2 = @x1 + @theme.font.default.text_width(@text)
    @y2 = @y1 + @theme.font.default.height
    @initialized = true
  end
  @theme.font.default.draw(@text, @x1, @y1, ZOrder::Text, 1, 1, @theme.font.color)
end