Class: TkWrapper::Widgets::Base::Padding
- Inherits:
-
Object
- Object
- TkWrapper::Widgets::Base::Padding
- Defined in:
- lib/widgets/base/padding.rb
Instance Method Summary collapse
- #bottom ⇒ Object
- #bottom=(bottom) ⇒ Object
- #get ⇒ Object
-
#initialize(widget) ⇒ Padding
constructor
A new instance of Padding.
- #left ⇒ Object
- #left=(left) ⇒ Object
- #right ⇒ Object
- #right=(right) ⇒ Object
- #set(left: nil, top: nil, right: nil, bottom: nil) ⇒ Object
- #top ⇒ Object
- #top=(top) ⇒ Object
Constructor Details
#initialize(widget) ⇒ Padding
Returns a new instance of Padding.
4 5 6 |
# File 'lib/widgets/base/padding.rb', line 4 def initialize() @widget = end |
Instance Method Details
#bottom ⇒ Object
41 42 43 |
# File 'lib/widgets/base/padding.rb', line 41 def bottom get[:bottom] end |
#bottom=(bottom) ⇒ Object
57 58 59 |
# File 'lib/widgets/base/padding.rb', line 57 def bottom=(bottom) set(bottom: bottom) end |
#get ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/widgets/base/padding.rb', line 18 def get (left, top, right, bottom) = @widget..padding.split { left: left || 0, top: top || left || 0, right: right || left || 0, bottom: bottom || top || left || 0 } end |
#left ⇒ Object
29 30 31 |
# File 'lib/widgets/base/padding.rb', line 29 def left get[:left] end |
#left=(left) ⇒ Object
45 46 47 |
# File 'lib/widgets/base/padding.rb', line 45 def left=(left) set(left: left) end |
#right ⇒ Object
37 38 39 |
# File 'lib/widgets/base/padding.rb', line 37 def right get[:right] end |
#right=(right) ⇒ Object
53 54 55 |
# File 'lib/widgets/base/padding.rb', line 53 def right=(right) set(right: right) end |
#set(left: nil, top: nil, right: nil, bottom: nil) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/widgets/base/padding.rb', line 8 def set(left: nil, top: nil, right: nil, bottom: nil) values = get @widget..padding = [ left || values.left, top || values.top, right || values.right, bottom || values.bottom ] end |
#top ⇒ Object
33 34 35 |
# File 'lib/widgets/base/padding.rb', line 33 def top get[:top] end |
#top=(top) ⇒ Object
49 50 51 |
# File 'lib/widgets/base/padding.rb', line 49 def top=(top) set(top: top) end |