@@ -667,10 +667,34 @@ fn organize_grid_layout(
667667 ctx : & mut ExpressionLoweringCtx ,
668668) -> llr_Expression {
669669 let cells = grid_layout_input_data ( layout, ctx) ;
670- llr_Expression:: ExtraBuiltinFunctionCall {
671- function : "organize_grid_layout" . into ( ) ,
672- arguments : vec ! [ cells] ,
673- return_ty : Type :: Array ( Type :: Int32 . into ( ) ) ,
670+
671+ if let Some ( button_roles) = & layout. dialog_button_roles {
672+ let e = crate :: typeregister:: BUILTIN . with ( |e| e. enums . DialogButtonRole . clone ( ) ) ;
673+ let roles = button_roles
674+ . iter ( )
675+ . map ( |r| {
676+ llr_Expression:: EnumerationValue ( EnumerationValue {
677+ value : e. values . iter ( ) . position ( |x| x == r) . unwrap ( ) as _ ,
678+ enumeration : e. clone ( ) ,
679+ } )
680+ } )
681+ . collect ( ) ;
682+ let roles_expr = llr_Expression:: Array {
683+ element_ty : Type :: Enumeration ( e) ,
684+ values : roles,
685+ as_model : false ,
686+ } ;
687+ llr_Expression:: ExtraBuiltinFunctionCall {
688+ function : "organize_dialog_button_layout" . into ( ) ,
689+ arguments : vec ! [ cells, roles_expr] ,
690+ return_ty : Type :: Array ( Type :: Int32 . into ( ) ) ,
691+ }
692+ } else {
693+ llr_Expression:: ExtraBuiltinFunctionCall {
694+ function : "organize_grid_layout" . into ( ) ,
695+ arguments : vec ! [ cells] ,
696+ return_ty : Type :: Array ( Type :: Int32 . into ( ) ) ,
697+ }
674698 }
675699}
676700
@@ -899,20 +923,6 @@ fn grid_layout_input_data(
899923 }
900924}
901925
902- pub ( super ) fn grid_layout_cell_data_ty ( ) -> Type {
903- Type :: Struct ( Rc :: new ( Struct {
904- fields : IntoIterator :: into_iter ( [
905- ( SmolStr :: new_static ( "col_or_row" ) , Type :: Int32 ) ,
906- ( SmolStr :: new_static ( "span" ) , Type :: Int32 ) ,
907- ( SmolStr :: new_static ( "constraint" ) , crate :: typeregister:: layout_info_type ( ) . into ( ) ) ,
908- ] )
909- . collect ( ) ,
910- name : Some ( "GridLayoutCellData" . into ( ) ) ,
911- node : None ,
912- rust_attributes : None ,
913- } ) )
914- }
915-
916926pub ( super ) fn grid_layout_input_data_ty ( ) -> Type {
917927 Type :: Struct ( Rc :: new ( Struct {
918928 fields : IntoIterator :: into_iter ( [
0 commit comments