lib/shoes/slot.rb in green_shoes-0.201.0 vs lib/shoes/slot.rb in green_shoes-0.207.0
- old
+ new
@@ -18,11 +18,20 @@
@parent = @app.cslot
@app.cslot = self
@contents = []
(@parent.contents << self) unless @nocontrol
if block_given?
+ if args[:hidden]
+ BASIC_ATTRIBUTES_DEFAULT.merge! hidden: true
+ SLOT_ATTRIBUTES_DEFAULT.merge! hidden: true
+ @hidden_flag = true unless @parent.instance_variable_get '@hidden'
+ end
yield
+ if @hidden_flag
+ BASIC_ATTRIBUTES_DEFAULT.delete :hidden
+ SLOT_ATTRIBUTES_DEFAULT.delete :hidden
+ end
@app.cslot = @parent
else
@left = @top = 0
end
end
@@ -99,9 +108,19 @@
def after e, &blk
n = contents.index e
n = n ? n+1 : contents.length
prepend n, &blk
+ end
+
+ def show
+ @contents.each &:show
+ self
+ end
+
+ def hide
+ @contents.each &:hide
+ self
end
end
class Stack < Slot; end
class Flow < Slot; end
\ No newline at end of file