@@ -85,41 +85,16 @@ func (c *Context) popLayout() error {
8585
8686func (c * Context ) GridCell (f func (bounds image.Rectangle )) {
8787 _ = c .wrapEventHandlerAndError (func () (EventHandler , error ) {
88- if err := c .gridCell ( func (bounds image.Rectangle ) {
88+ if _ , err := c .widget ( emptyWidgetID , 0 , func (bounds image.Rectangle , wasFocused bool ) ( e EventHandler , err error ) {
8989 f (bounds )
90+ return nil , nil
9091 }); err != nil {
9192 return nil , err
9293 }
9394 return nil , nil
9495 })
9596}
9697
97- func (c * Context ) gridCell (f func (bounds image.Rectangle )) error {
98- _ , err := c .widget (emptyWidgetID , 0 , func (bounds image.Rectangle , wasFocused bool ) (e EventHandler , err error ) {
99- if err := c .pushLayout (bounds , image .Pt (0 , 0 ), false ); err != nil {
100- return nil , err
101- }
102- defer func () {
103- if err2 := c .popLayout (); err2 != nil && err == nil {
104- err = err2
105- }
106- }()
107- f (bounds )
108- b := & c .layoutStack [len (c .layoutStack )- 1 ]
109- // inherit position/next_row/max from child layout if they are greater
110- a := & c .layoutStack [len (c .layoutStack )- 2 ]
111- a .position .X = max (a .position .X , b .position .X + b .body .Min .X - a .body .Min .X )
112- a .nextRowY = max (a .nextRowY , b .nextRowY + b .body .Min .Y - a .body .Min .Y )
113- a .max .X = max (a .max .X , b .max .X )
114- a .max .Y = max (a .max .Y , b .max .Y )
115- return nil , nil
116- })
117- if err != nil {
118- return err
119- }
120- return nil
121- }
122-
12398func (c * Context ) layout () (* layout , error ) {
12499 if len (c .layoutStack ) == 0 {
125100 return nil , errors .New ("debugui: layout stack is empty; perhaps a window is absent" )
0 commit comments