Trait native_windows_gui::PartialUi[][src]

pub trait PartialUi {
    fn build_partial<W: Into<ControlHandle>>(
        data: &mut Self,
        parent: Option<W>
    ) -> Result<(), NwgError>; fn process_event(
        &self,
        _evt: Event,
        _evt_data: &EventData,
        _handle: ControlHandle
    ) { ... }
fn handles<'a>(&'a self) -> Vec<&'a ControlHandle> { ... } }
Expand description

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 as it is. It will most likely be used as the 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 implement this trait.

For an example on how to implement this trait, see the Small application layout section in the NWG documentation.

Required methods

Should initialize the GUI components. Similar to NativeUi::build_ui except it doesn’t handle event binding.

Parameters:

  • data: A reference to the struct data from the parent struct
  • parent: An optional reference to the parent UI control. If this is defined, the ui controls of the partial should be children of this value.

Provided methods

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 data
  • evt: The event raised
  • evt_data: The data of the event raised
  • handle: Handle of the control that raised the event

Should return the handles of the top level parent controls (such as Windows). Those handle should be used to bind the default events handler.

Implementors