MCPcopy Index your code
hub / github.com/RizeCrime/linuxblaster_control / nav_pane

Function nav_pane

src/app.rs:139–188  ·  view source on GitHub ↗

## Navigation Pane Args**: - `blaster`: the BlasterXG6 instance - `ui`: the egui::Ui instance - `pane_name`: Display Name - `feature_id`: the FeatureId of the feature to be toggled - `with_selector`: for when the Feature requires its own pane

(
    blaster: &BlasterXG6, 
    ui: &mut egui::Ui, 
    pane_name: &str,
    feature_id: Option<FeatureId>, 
    with_selector: bool,
)

Source from the content-addressed store, hash-verified

137/// - `feature_id`: the FeatureId of the feature to be toggled
138/// - `with_selector`: for when the Feature requires its own pane
139fn nav_pane(
140 blaster: &BlasterXG6,
141 ui: &mut egui::Ui,
142 pane_name: &str,
143 feature_id: Option<FeatureId>,
144 with_selector: bool,
145) {
146 let feature = feature_id.map(|id| blaster.feature(id));
147
148 ui.vertical_centered_justified(|ui| {
149 ui.set_width(160.0);
150
151 ui.label(RichText::new(pane_name).strong());
152
153 ui.horizontal(|ui| {
154 #[allow(clippy::collapsible_if)]
155 if let Some(feature) = feature {
156 let feature_value = feature.as_bool();
157 if toggle_button!(ui, feature_value).clicked() {
158 if blaster.set_feature(feature.id, None).is_err() {
159 error!("Failed to set feature: {:?}", feature.id);
160 }
161 }
162 }
163
164 if with_selector {
165 ui.with_layout(Layout::right_to_left(Align::Center), |ui| {
166 let current_selection = *UI_SELECTED.lock().unwrap();
167 let is_selected = current_selection == pane_name;
168 let selector_button = Button::selectable(
169 is_selected,
170 RichText::new("➡"),
171 )
172 .min_size(Vec2::new(32.0, 24.0))
173 .frame_when_inactive(true);
174
175 if ui.add(selector_button).clicked() {
176 let mut selected = UI_SELECTED.lock().unwrap();
177 if *selected == pane_name {
178 *selected = "";
179 }
180 }
181 });
182 }
183 });
184
185 ui.separator();
186
187 });
188}
189
190fn sbx_pane(blaster: &BlasterXG6, ui: &mut egui::Ui) {
191 ui.columns(2, |columns| {

Callers 1

updateMethod · 0.85

Calls 3

featureMethod · 0.80
as_boolMethod · 0.80
set_featureMethod · 0.80

Tested by

no test coverage detected