{ import: Frame } { include "SDL/SDL.h" } "----------------------------------------------------------------" Box drawOn: aContext [ | bg bd fg | bg := self drawBackgroundOn: aContext. fg := self drawForegroundOn: aContext. bd := self drawBorderOn: aContext. (bg or: [fg or: [bd or: [self notEmpty]]]) ifFalse: [self drawInvalidOn: aContext]. ] Box drawContentsOn: aContext [ ^contents ifTrue: [aContext saveTransform; translate: position. self doBackToFront: [:box | (self contentContains: box) ifTrue: [box drawOn: aContext]]. aContext restoreTransform] ] Box contentContains: aBox [ ^ 0, 0 < aBox position and: [aBox position + aBox extent <= self extent] ] TextBox contentContains: aBox [^true] Window boxLayoutExample [ | box | box := Box new. 512 timesRepeat: [box add: (Box new extent: 8,8)]. box layout: SimpleLayout; extent: 300,200; border: ColorWhite; background: ColorGray25. self addFront: ((FrameBox with: box title: 'Box Layout') position: hand position). ] [ | window | window := Window new: 600,480. window add: ((Box newButton: 'Hello' action: [:ev | ev window boxLayoutExample]) position: 200,100). window damaged. window mainLoop. ]