Struct Cx

Source
pub struct Cx {
Show 21 fields pub in_makepad_studio: bool, pub demo_time_repaint: bool, pub null_texture: Texture, pub windows: CxWindowPool, pub passes: CxPassPool, pub draw_lists: CxDrawListPool, pub draw_matrices: CxDrawMatrixPool, pub textures: CxTexturePool, pub draw_shaders: CxDrawShaders, pub new_draw_event: DrawEvent, pub redraw_id: u64, pub keyboard: CxKeyboard, pub fingers: CxFingers, pub new_actions: ActionsBuf, pub live_registry: Rc<RefCell<LiveRegistry>>, pub shader_registry: ShaderRegistry, pub os: CxOs, pub display_context: DisplayContext, pub debug: Debug, pub performance_stats: PerformanceStats, pub widget_query_invalidation_event: Option<u64>, /* private fields */
}

Fields§

§in_makepad_studio: bool§demo_time_repaint: bool§null_texture: Texture§windows: CxWindowPool§passes: CxPassPool§draw_lists: CxDrawListPool§draw_matrices: CxDrawMatrixPool§textures: CxTexturePool§draw_shaders: CxDrawShaders§new_draw_event: DrawEvent§redraw_id: u64§keyboard: CxKeyboard§fingers: CxFingers§new_actions: ActionsBuf§live_registry: Rc<RefCell<LiveRegistry>>§shader_registry: ShaderRegistry§os: CxOs§display_context: DisplayContext§debug: Debug§performance_stats: PerformanceStats§widget_query_invalidation_event: Option<u64>

Event ID that triggered a widget query cache invalidation. When Some(event_id), indicates that widgets should clear their query caches on the next event loop cycle. This ensures all views process the cache clear before it’s reset to None.

This is primarily used when adaptive views change their active variant, as the widget hierarchy changes require parent views to rebuild their widget queries.

Implementations§

Source§

impl Cx

Source§

impl Cx

Source

pub fn handle_triggers(&mut self)

Source

pub fn handle_actions(&mut self)

Source§

impl Cx

Source

pub fn draw_pass_to_window( &mut self, pass_id: PassId, opengl_window: &mut OpenglWindow, )

Source

pub fn share_texture_for_presentable_image( &mut self, texture: &Texture, ) -> Image<OwnedFd>

Source§

impl Cx

Source§

impl Cx

Source

pub fn stdin_event_loop(&mut self)

Source§

impl Cx

Source

pub fn set_default_depth_and_blend_mode(gl: &LibGl)

Source

pub fn setup_render_pass(&mut self, pass_id: PassId) -> Option<(DVec2, f64)>

Source

pub fn draw_pass_to_texture( &mut self, pass_id: PassId, override_pass_texture: Option<&Texture>, )

Source

pub fn opengl_compile_shaders(&mut self)

Source§

impl Cx

Source

pub fn new(event_handler: Box<dyn FnMut(&mut Cx, &Event)>) -> Self

Source§

impl Cx

Source

pub fn in_draw_event(&self) -> bool

Source

pub fn xr_capabilities(&self) -> &XrCapabilities

Source

pub fn get_ref(&self) -> CxRef

Source

pub fn take_dependency(&mut self, path: &str) -> Result<Rc<Vec<u8>>, String>

Source

pub fn get_dependency(&self, path: &str) -> Result<Rc<Vec<u8>>, String>

Source

pub fn null_texture(&self) -> Texture

Source

pub fn redraw_id(&self) -> u64

Source

pub fn os_type(&self) -> &OsType

Source

pub fn in_makepad_studio(&self) -> bool

Source

pub fn cpu_cores(&self) -> usize

Source

pub fn gpu_info(&self) -> &GpuInfo

Source

pub fn update_macos_menu(&mut self, menu: MacosMenu)

Source

pub fn xr_start_presenting(&mut self)

Source

pub fn xr_advertise_anchor(&mut self, anchor: XrAnchor)

Source

pub fn xr_set_local_anchor(&mut self, anchor: XrAnchor)

Source

pub fn xr_discover_anchor(&mut self, id: u8)

Source

pub fn quit(&mut self)

Source

pub fn show_in_dock(&mut self, show: bool)

Source

pub fn push_unique_platform_op(&mut self, op: CxOsOp)

Source

pub fn show_text_ime(&mut self, area: Area, pos: DVec2)

Source

pub fn hide_text_ime(&mut self)

Source

pub fn text_ime_was_dismissed(&mut self)

Source

pub fn show_clipboard_actions(&mut self, selected: String)

Source

pub fn copy_to_clipboard(&mut self, content: &str)

Copies the given string to the clipboard.

Due to lack of platform clipboard support, it does not work on Web or tvOS.

Source

pub fn start_dragging(&mut self, items: Vec<DragItem>)

Source

pub fn set_cursor(&mut self, cursor: MouseCursor)

Source

pub fn sweep_lock(&mut self, value: Area)

Source

pub fn sweep_unlock(&mut self, value: Area)

Source

pub fn start_timeout(&mut self, interval: f64) -> Timer

Source

pub fn start_interval(&mut self, interval: f64) -> Timer

Source

pub fn stop_timer(&mut self, timer: Timer)

Source

pub fn get_dpi_factor_of(&mut self, area: &Area) -> f64

Source

pub fn get_pass_window_id(&self, pass_id: PassId) -> Option<WindowId>

Source

pub fn get_delegated_dpi_factor(&mut self, pass_id: PassId) -> f64

Source

pub fn redraw_pass_and_parent_passes(&mut self, pass_id: PassId)

Source

pub fn get_pass_rect(&self, pass_id: PassId, dpi: f64) -> Option<Rect>

Source

pub fn get_pass_name(&self, pass_id: PassId) -> &str

Source

pub fn repaint_pass(&mut self, pass_id: PassId)

Source

pub fn repaint_pass_and_child_passes(&mut self, pass_id: PassId)

Source

pub fn redraw_pass_and_child_passes(&mut self, pass_id: PassId)

Source

pub fn redraw_all(&mut self)

Source

pub fn redraw_area(&mut self, area: Area)

Source

pub fn redraw_area_in_draw(&mut self, area: Area)

Source

pub fn redraw_area_and_children(&mut self, area: Area)

Source

pub fn redraw_list(&mut self, draw_list_id: DrawListId)

Source

pub fn redraw_list_in_draw(&mut self, draw_list_id: DrawListId)

Source

pub fn redraw_list_and_children(&mut self, draw_list_id: DrawListId)

Source

pub fn get_ime_area_rect(&self) -> Rect

Source

pub fn update_area_refs(&mut self, old_area: Area, new_area: Area) -> Area

Source

pub fn set_key_focus(&mut self, focus_area: Area)

Source

pub fn revert_key_focus(&mut self)

Source

pub fn has_key_focus(&self, focus_area: Area) -> bool

Source

pub fn new_next_frame(&mut self) -> NextFrame

Source

pub fn send_trigger(&mut self, area: Area, trigger: Trigger)

Source

pub fn set_global<T: 'static + Any + Sized>(&mut self, value: T)

Source

pub fn get_global<T: 'static + Any>(&mut self) -> &mut T

Source

pub fn has_global<T: 'static + Any>(&mut self) -> bool

Source

pub fn global<T: 'static + Any + Default>(&mut self) -> &mut T

Source

pub fn spawner(&self) -> &Spawner

Source

pub fn http_request(&mut self, request_id: LiveId, request: HttpRequest)

Source

pub fn cancel_http_request(&mut self, request_id: LiveId)

Source

pub fn prepare_video_playback( &mut self, video_id: LiveId, source: VideoSource, external_texture_id: u32, autoplay: bool, should_loop: bool, )

Source

pub fn begin_video_playback(&mut self, video_id: LiveId)

Source

pub fn pause_video_playback(&mut self, video_id: LiveId)

Source

pub fn resume_video_playback(&mut self, video_id: LiveId)

Source

pub fn mute_video_playback(&mut self, video_id: LiveId)

Source

pub fn unmute_video_playback(&mut self, video_id: LiveId)

Source

pub fn cleanup_video_playback_resources(&mut self, video_id: LiveId)

Source

pub fn println_resources(&self)

Source

pub fn open_system_savefile_dialog(&mut self)

Source

pub fn open_system_openfile_dialog(&mut self)

Source

pub fn open_system_savefolder_dialog(&mut self)

Source

pub fn open_system_openfolder_dialog(&mut self)

Source

pub fn event_id(&self) -> u64

Source§

impl Cx

Source

pub fn handle_action_receiver(&mut self)

Source

pub fn post_action(action: impl ActionTrait + Send)

Enqueues an action from a background thread context.

This will produce a bare action, not a widget action, so you cannot use as_widget_action() when handling this action.

Source

pub fn action(&mut self, action: impl ActionTrait)

Source

pub fn extend_actions(&mut self, actions: ActionsBuf)

Adds the given actions back into the set of existing queued actions.

This is useful when you want to allow other widgets elsewhere in the UI tree to receive the given actions, e.g., after you have previously captured them using capture_actions().

Source

pub fn map_actions<F, G, R>(&mut self, f: F, g: G) -> R
where F: FnOnce(&mut Cx) -> R, G: FnOnce(&mut Cx, ActionsBuf) -> ActionsBuf,

Source

pub fn mutate_actions<F, G, R>(&mut self, f: F, g: G) -> R
where F: FnOnce(&mut Cx) -> R, G: FnOnce(&mut [Action]),

Source

pub fn capture_actions<F>(&mut self, f: F) -> ActionsBuf
where F: FnOnce(&mut Cx),

Captures the actions emitted by the given closure f and returns them.

This allows you to handle the actions directly before they are delivered to other widgets in the UI tree, enabling you to optionally prevent some or all of the actions from being delivered to all other widgets.

If you do want some or all of the returned actions to be delivered to other widgets in the UI tree, you can call extend_actions() to enqueue them back into the set of existing actions.

Source§

impl Cx

Source

pub fn apply_error_tuple_enum_arg_not_found( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], enum_id: LiveId, base: LiveId, arg: usize, )

Source

pub fn apply_error_named_enum_invalid_prop( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], enum_id: LiveId, base: LiveId, prop: LiveId, )

Source

pub fn apply_error_wrong_enum_base( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], enum_id: LiveId, base: LiveId, )

Source

pub fn apply_error_wrong_struct_name( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], struct_id: LiveId, got_id: LiveId, )

Source

pub fn apply_error_wrong_type_for_struct( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], struct_id: LiveId, )

Source

pub fn apply_error_wrong_enum_variant( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], enum_id: LiveId, variant: LiveId, )

Source

pub fn apply_error_expected_enum( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], )

Source

pub fn apply_error_expected_array( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], )

Source

pub fn apply_error_no_matching_field( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], )

Source

pub fn apply_error_wrong_type_for_value( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], )

Source

pub fn apply_error_component_not_found( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], id: LiveId, )

Source

pub fn apply_error_wrong_value_type_for_primitive( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], prim: &str, )

Source

pub fn apply_error_animation_missing_state( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], track: LiveId, state_id: LiveId, ids: &[LiveProp], )

Source

pub fn apply_error_wrong_animation_track_used( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], id: LiveId, expect: LiveId, got: LiveId, )

Source

pub fn apply_error_animate_to_unknown_track( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], id: LiveId, state_id: LiveId, )

Source

pub fn apply_error_empty_object( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], )

Source

pub fn apply_key_frame_cannot_be_interpolated( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], a: &LiveValue, b: &LiveValue, )

Source

pub fn apply_animate_missing_apply_block( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], )

Source

pub fn apply_error_cant_find_target( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], id: LiveId, )

Source

pub fn apply_image_type_not_supported( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], path: &str, )

Source

pub fn apply_image_decoding_failed( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], path: &str, msg: &str, )

Source

pub fn apply_resource_not_loaded( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], path: &str, msg: &str, )

Source

pub fn apply_error_eval(&mut self, err: LiveError)

Source

pub fn apply_error_resource_not_found( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], path: &str, )

Source

pub fn apply_error( &mut self, origin: LiveErrorOrigin, index: usize, nodes: &[LiveNode], message: String, )

Source

pub fn start_disk_live_file_watcher(&mut self, milis: u64)

Source

pub fn reload_ui_dsl(&mut self)

Source

pub fn set_dsl_value( &self, crate_id: LiveId, file: LiveId, node: LiveId, value: LiveValue, )

Source

pub fn handle_live_edit(&mut self) -> bool

Source

pub fn live_expand(&mut self)

Source

pub fn live_scan_dependencies(&mut self)

Source

pub fn register_live_body(&mut self, live_body: LiveBody)

Source

pub fn get_nodes_from_live_ptr<CB>(&mut self, live_ptr: LivePtr, cb: CB)
where CB: FnOnce(&mut Cx, LiveFileId, usize, &[LiveNode]) -> usize,

Source§

impl Cx

Source

pub fn flush_draw_shaders(&mut self)

Source§

impl Cx

Source

pub fn get_geometry_ref( &mut self, fingerprint: GeometryFingerprint, ) -> GeometryRef

Source§

impl Cx

Source

pub fn debug_draw_tree(&self, dump_instances: bool, draw_list_id: DrawListId)

Source§

impl Cx

Source

pub fn has_studio_web_socket() -> bool

Source

pub fn stop_studio_websocket(&mut self)

Source

pub fn init_websockets(&mut self, studio_http: &str)

Source

pub fn send_studio_message(msg: AppToStudio)

Trait Implementations§

Source§

impl CxMediaApi for Cx

Source§

fn midi_input(&mut self) -> MidiInput

Source§

fn midi_output(&mut self) -> MidiOutput

Source§

fn midi_reset(&mut self)

Source§

fn use_midi_inputs(&mut self, ports: &[MidiPortId])

Source§

fn use_midi_outputs(&mut self, ports: &[MidiPortId])

Source§

fn use_audio_inputs(&mut self, devices: &[AudioDeviceId])

Source§

fn use_audio_outputs(&mut self, devices: &[AudioDeviceId])

Source§

fn audio_output_box(&mut self, index: usize, f: AudioOutputFn)

Source§

fn audio_input_box(&mut self, index: usize, f: AudioInputFn)

Source§

fn video_input_box(&mut self, _index: usize, _f: VideoInputFn)

Source§

fn use_video_input(&mut self, _inputs: &[(VideoInputId, VideoFormatId)])

Source§

fn audio_output<F>(&mut self, index: usize, f: F)
where F: FnMut(AudioInfo, &mut AudioBuffer) + Send + 'static,

Source§

fn audio_input<F>(&mut self, index: usize, f: F)
where F: FnMut(AudioInfo, &AudioBuffer) + Send + 'static,

Source§

fn video_input<F>(&mut self, index: usize, f: F)
where F: FnMut(VideoBufferRef<'_>) + Send + 'static,

Source§

impl CxOsApi for Cx

Source§

fn init_cx_os(&mut self)

Source§

fn spawn_thread<F>(&mut self, f: F)
where F: FnOnce() + Send + 'static,

Source§

fn seconds_since_app_start(&self) -> f64

Source§

fn open_url(&mut self, _url: &str, _in_place: OpenUrlInPlace)

Source§

fn start_stdin_service(&mut self)

Source§

fn pre_start() -> bool

Source§

fn default_window_size(&self) -> DVec2

Source§

fn max_texture_width() -> usize

Source§

fn in_xr_mode(&self) -> bool

Source§

fn micro_zbias_step(&self) -> f32

Auto Trait Implementations§

§

impl Freeze for Cx

§

impl !RefUnwindSafe for Cx

§

impl !Send for Cx

§

impl !Sync for Cx

§

impl Unpin for Cx

§

impl !UnwindSafe for Cx

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.