khora_editor/widgets/controls.rs
1// Copyright 2025 eraflo
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15//! Field-level controls used inside Inspector cards and panel toolbars.
16//!
17//! The meter bar itself lives in `khora_tool_ui::widgets`; this is a thin
18//! adapter that keeps the editor's `(origin, width)` calling convention so the
19//! panels don't all have to change. There is one implementation of the bar,
20//! shared with the hub.
21
22use khora_sdk::editor_ui::{UiBuilder, UiTheme};
23
24/// A thin horizontal meter bar (used by the DCC summary + agent rows).
25pub fn paint_meter_bar(
26 ui: &mut dyn UiBuilder,
27 origin: [f32; 2],
28 width: f32,
29 fraction: f32,
30 fill_color: [f32; 4],
31 theme: &UiTheme,
32) {
33 khora_tool_ui::widgets::meter_bar(
34 ui,
35 theme,
36 [origin[0], origin[1], width, 3.0],
37 fraction,
38 fill_color,
39 );
40}