Skip to main content

ccf_gpui_widgets/widgets/
mod.rs

1//! GPUI widgets
2
3mod cursor_blink;
4mod editing_core;
5mod text_input;
6mod tooltip;
7mod checkbox;
8mod dropdown;
9mod number_stepper;
10mod radio_group;
11mod checkbox_group;
12mod color_swatch;
13mod collapsible;
14mod focus_navigation;
15mod button;
16mod password_input;
17mod tab_bar;
18mod repeatable_text_input;
19mod toggle_switch;
20mod slider;
21mod progress_bar;
22mod spinner;
23mod confirmation_dialog;
24mod scrollbar;
25mod scrollable;
26mod segmented_control;
27mod sidebar_nav;
28mod selection;
29
30#[cfg(feature = "file-picker")]
31mod path_display;
32
33#[cfg(feature = "secure-password")]
34mod sensitive_string;
35
36#[cfg(feature = "file-picker")]
37mod file_picker;
38#[cfg(feature = "file-picker")]
39mod directory_picker;
40#[cfg(feature = "file-picker")]
41mod repeatable_file_picker;
42#[cfg(feature = "file-picker")]
43mod repeatable_directory_picker;
44
45// Re-exports
46pub use text_input::{TextInput, TextInputEvent, register_keybindings as register_text_input_keybindings};
47pub use tooltip::Tooltip;
48pub use checkbox::{Checkbox, CheckboxEvent};
49pub use dropdown::{Dropdown, DropdownEvent, register_keybindings as register_dropdown_keybindings};
50pub use number_stepper::{NumberStepper, NumberStepperEvent};
51pub use radio_group::{RadioGroup, RadioGroupEvent};
52pub use checkbox_group::{CheckboxGroup, CheckboxGroupEvent};
53pub use color_swatch::{ColorSwatch, ColorSwatchEvent, PickerMode, register_keybindings as register_color_swatch_keybindings};
54pub use collapsible::{Collapsible, CollapsibleEvent};
55pub use focus_navigation::{FocusNext, FocusPrev, register_keybindings as register_focus_navigation_keybindings, with_focus_actions, EnabledCursorExt, repeatable_add_button, repeatable_remove_button};
56pub use button::{primary_button, secondary_button, danger_button, register_keybindings as register_button_keybindings};
57pub use toggle_switch::{ToggleSwitch, ToggleSwitchEvent, LabelPosition};
58pub use slider::{Slider, SliderEvent};
59pub use progress_bar::{ProgressBar, ProgressBarEvent};
60pub use spinner::{Spinner, SpinnerSize};
61pub use confirmation_dialog::{ConfirmationDialog, ConfirmationDialogEvent, DialogStyle, DialogButton};
62pub use password_input::{PasswordInput, PasswordInputEvent};
63pub use scrollable::{Scrollable, scrollable_vertical, scrollable_horizontal, scrollable_both};
64pub use scrollbar::ScrollbarAxis;
65pub use segmented_control::{SegmentedControl, SegmentedControlEvent, SegmentOption};
66#[cfg(feature = "secure-password")]
67pub use secrecy::SecretString;
68pub use tab_bar::{TabBar, TabBarEvent, register_keybindings as register_tab_bar_keybindings};
69pub use sidebar_nav::{SidebarNav, SidebarNavEvent, register_keybindings as register_sidebar_nav_keybindings};
70pub use selection::{SelectionItem, StringItem};
71pub use repeatable_text_input::{RepeatableTextInput, RepeatableTextInputEvent, ActivateButton as RepeatableActivateButton, register_keybindings as register_repeatable_text_input_keybindings};
72
73#[cfg(feature = "file-picker")]
74pub use file_picker::{
75    FilePicker, FilePickerEvent, FileMode, MissingDirectories,
76    FilePickerValidation, ValidationDisplay, validate_file_path,
77    register_keybindings as register_file_picker_keybindings,
78};
79#[cfg(feature = "file-picker")]
80pub use directory_picker::{
81    DirectoryPicker, DirectoryPickerEvent,
82    DirectoryPickerValidation, ValidationDisplay as DirectoryValidationDisplay,
83    validate_directory_path,
84    register_keybindings as register_directory_picker_keybindings,
85};
86#[cfg(feature = "file-picker")]
87pub use repeatable_file_picker::{RepeatableFilePicker, RepeatableFilePickerEvent};
88#[cfg(feature = "file-picker")]
89pub use repeatable_directory_picker::{RepeatableDirectoryPicker, RepeatableDirectoryPickerEvent};
90
91/// Register all widget keybindings
92///
93/// Call this once at application startup to enable keyboard shortcuts
94/// for all widgets that require them.
95///
96/// ```ignore
97/// use ccf_gpui_widgets::widgets::register_all_keybindings;
98///
99/// Application::new().run(|cx: &mut App| {
100///     register_all_keybindings(cx);
101///     // ... rest of your initialization
102/// });
103/// ```
104pub fn register_all_keybindings(cx: &mut gpui::App) {
105    register_text_input_keybindings(cx);
106    register_dropdown_keybindings(cx);
107    register_color_swatch_keybindings(cx);
108    register_focus_navigation_keybindings(cx);
109    register_tab_bar_keybindings(cx);
110    register_sidebar_nav_keybindings(cx);
111    register_repeatable_text_input_keybindings(cx);
112    register_button_keybindings(cx);
113    #[cfg(feature = "file-picker")]
114    {
115        register_file_picker_keybindings(cx);
116        register_directory_picker_keybindings(cx);
117    }
118}