Class: WR::Margin

Inherits:
Object
  • Object
show all
Defined in:
lib/wrb/base.rb

Overview

Controls

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Margin

Returns a new instance of Margin.

Raises:

  • (ArgumentError)


597
598
599
600
601
# File 'lib/wrb/base.rb', line 597

def initialize(*args)
  raise ArgumentError, "No arguments" if args.empty?
  self.target = args.shift if args[0].is_a? RWin::Window
  @left, @top, @right, @bottom = args
end

Instance Attribute Details

#bottomObject Also known as: b

Returns the value of attribute bottom.



591
592
593
# File 'lib/wrb/base.rb', line 591

def bottom
  @bottom
end

#hObject

Returns the value of attribute h.



590
591
592
# File 'lib/wrb/base.rb', line 590

def h
  @h
end

#leftObject Also known as: l

Returns the value of attribute left.



591
592
593
# File 'lib/wrb/base.rb', line 591

def left
  @left
end

#rightObject Also known as: r

Returns the value of attribute right.



591
592
593
# File 'lib/wrb/base.rb', line 591

def right
  @right
end

#targetObject

Returns the value of attribute target.



591
592
593
# File 'lib/wrb/base.rb', line 591

def target
  @target
end

#topObject Also known as: t

Returns the value of attribute top.



591
592
593
# File 'lib/wrb/base.rb', line 591

def top
  @top
end

#wObject

Returns the value of attribute w.



590
591
592
# File 'lib/wrb/base.rb', line 590

def w
  @w
end

#xObject

Returns the value of attribute x.



590
591
592
# File 'lib/wrb/base.rb', line 590

def x
  @x
end

#yObject

Returns the value of attribute y.



590
591
592
# File 'lib/wrb/base.rb', line 590

def y
  @y
end

Class Method Details

.[](*args) ⇒ Object



593
594
595
# File 'lib/wrb/base.rb', line 593

def self.[](*args)
  self.new(*args)
end

Instance Method Details

#move(x, y, w, h) ⇒ Object

; dpp x, y, w, h



609
610
611
# File 'lib/wrb/base.rb', line 609

def move(x, y, w, h) #; dpp x, y, w, h
  @x, @y, @w, @h = x, y, w, h
end

#originObject



646
647
648
# File 'lib/wrb/base.rb', line 646

def origin()
  [@x, @y, @w, @h]
end

#set(l, t, r, b) ⇒ Object



617
618
619
620
# File 'lib/wrb/base.rb', line 617

def set(l, t, r, b)
  @left, @top, @right, @bottom = l, t, r, b
  @target.__move(0,0,*target.parent.clientsize) if @target.parent
end

#to_aObject



642
643
644
# File 'lib/wrb/base.rb', line 642

def to_a()
  [@left, @top, @right, @bottom]
end

#to_sObject



613
614
615
# File 'lib/wrb/base.rb', line 613

def to_s()
  [@left, @top, @right, @bottom].to_s
end