[−][src]Trait native_windows_gui::PartialUi
A structure that implements this trait is considered a GUI structure. The structure will hold GUI components and possibly user data.
A structure that implements PartialUi must be part of another UI structure and cannot be used at it is. It will most likely used
as a struct member of another struct that implements NativeUi.
The goal of NativeUi and PartialUi is to provide a common way to define NWG applications.
Native-windows-derive can automatically implements this trait.
For an example on how to implement this trait, see the Small application layout section in the NWG documentation.
Required methods
fn build_partial<W: Into<ControlHandle>>(
data: &mut Self,
parent: Option<W>
) -> Result<(), NwgError>
data: &mut Self,
parent: Option<W>
) -> Result<(), NwgError>
Should initializes the GUI components. Similar to NativeUi::build_ui except it doesn't handle events binding.
Parameters:
data: A reference to the struct data from the parent structparent: An optional reference to the parent UI control. If this is defined, ui controls of the partial should be children of this value.
Provided methods
fn process_event(
&self,
_evt: Event,
_evt_data: &EventData,
_handle: ControlHandle
)
&self,
_evt: Event,
_evt_data: &EventData,
_handle: ControlHandle
)
Should process the events of the partial. This method will probably be called from an event handler bound in the parent GUI structure.
Parameters:
base: A reference to the parent struct dataevt: The event raisedevt_data: The data of the event raisedhandle: Handle of the control that raised the event
fn handles<'a>(&'a self) -> Vec<&'a ControlHandle>
Should return the handles of the top level parent controls (such as Windows). Those handle should be used to bind the default events handler.