@@ -134,6 +134,14 @@ pub fn toolbar_system(
134134}
135135
136136/// Settings panel — displayed as a tab in the tile layout.
137+ /// A custom section to inject into the Settings panel.
138+ pub struct SettingsSection {
139+ /// Section heading.
140+ pub label : String ,
141+ /// UI rendering callback.
142+ pub ui_fn : Box < dyn FnMut ( & mut egui:: Ui ) + Send + Sync > ,
143+ }
144+
137145pub struct SettingsPanel {
138146 /// Edited scale value (not yet saved).
139147 pub edited_scale : f32 ,
@@ -151,6 +159,8 @@ pub struct SettingsPanel {
151159 pub edited_font_path : Option < String > ,
152160 /// Set to true when user clicks Save.
153161 pub save_requested : bool ,
162+ /// Custom settings sections injected by downstream applications.
163+ pub custom_sections : Vec < SettingsSection > ,
154164}
155165
156166impl Default for SettingsPanel {
@@ -164,6 +174,7 @@ impl Default for SettingsPanel {
164174 edited_locale : crate :: i18n:: Locale :: default ( ) ,
165175 edited_font_path : None ,
166176 save_requested : false ,
177+ custom_sections : Vec :: new ( ) ,
167178 }
168179 }
169180}
@@ -546,6 +557,13 @@ fn settings_panel_ui(panel: &mut SettingsPanel, ui: &mut egui::Ui) {
546557 if ui. button ( "Save" ) . clicked ( ) {
547558 panel. save_requested = true ;
548559 }
560+
561+ // Custom settings sections
562+ for section in & mut panel. custom_sections {
563+ ui. separator ( ) ;
564+ ui. heading ( & section. label ) ;
565+ ( section. ui_fn ) ( ui) ;
566+ }
549567}
550568
551569/// Handles key recording for the keybindings panel, extracted to reduce nesting.
0 commit comments