@@ -293,9 +293,13 @@ impl GridAlignment {
293
293
/// Informs a `LayoutGrid` as to position a control.
294
294
#[ derive( Clone , Copy , PartialEq ) ]
295
295
pub enum GridInsertionStrategy {
296
+ /// Place control to left of existing control, align tops
296
297
Leading ,
298
+ /// Place control above existing control, align left edges
297
299
Top ,
300
+ /// Place control to right of existing control, align tops
298
301
Trailing ,
302
+ /// Place control below existing control, align left edges
299
303
Bottom
300
304
}
301
305
@@ -362,5 +366,27 @@ impl LayoutGrid {
362
366
) ;
363
367
}
364
368
}
365
- }
366
369
370
+ /// Inserts a control in to the `LayoutGrid` relative to an existing control.
371
+ pub fn insert_at < T : Into < Control > , U : Into < Control > > ( & mut self , _ctx : & UI ,
372
+ control : T , existing : U , at : GridInsertionStrategy ,
373
+ left : i32 , height : i32 ,
374
+ xspan : i32 , yspan : i32 ,
375
+ expand : GridExpand ,
376
+ halign : GridAlignment , valign : GridAlignment ) {
377
+
378
+ let ( hexpand, vexpand) = match expand {
379
+ GridExpand :: Neither => ( 0 , 0 ) ,
380
+ GridExpand :: Horizontal => ( 1 , 0 ) ,
381
+ GridExpand :: Vertical => ( 0 , 1 ) ,
382
+ GridExpand :: Both => ( 1 , 1 ) ,
383
+ } ;
384
+ unsafe {
385
+ ui_sys:: uiGridInsertAt (
386
+ self . uiGrid , control. into ( ) . ui_control , existing. into ( ) . ui_control ,
387
+ at. into_ui_at ( ) , left, height, xspan, yspan,
388
+ hexpand, halign. into_ui_align ( ) , vexpand, valign. into_ui_align ( )
389
+ ) ;
390
+ }
391
+ }
392
+ }
0 commit comments