2020-03-13 06:33:41 +11:00
|
|
|
//! This module contains a wrapper for `NSToolbar`, one of the standard UI elements in a native
|
|
|
|
//! Cocoa application. To customize it and provide options, you should implement a
|
|
|
|
//! `ToolbarController` for your desired struct, and instantiate your `Toolbar` with it. For
|
|
|
|
//! example:
|
|
|
|
//!
|
|
|
|
//! ```
|
|
|
|
//! use appkit::prelude::*;
|
|
|
|
//!
|
|
|
|
//! #[derive(Default)]
|
|
|
|
//! struct WindowToolbar;
|
|
|
|
//!
|
|
|
|
//! impl ToolbarController for WindowToolbar {
|
|
|
|
//! /* Your trait implementation here */
|
|
|
|
//! }
|
|
|
|
//!
|
|
|
|
//! ```
|
|
|
|
//!
|
|
|
|
//! And then, wherever your window is:
|
|
|
|
//!
|
|
|
|
//! ```
|
|
|
|
//! #[derive(Default)]
|
|
|
|
//! struct AppWindow {
|
|
|
|
//! pub toolbar: Toolbar<WindowToolbar>
|
|
|
|
//! }
|
|
|
|
//!
|
|
|
|
//! impl WindowController for AppWindow {
|
|
|
|
//! fn did_load(&mut self, window: WindowHandle) {
|
|
|
|
//! window.set_toolbar(&self.toolbar);
|
|
|
|
//! }
|
|
|
|
//! }
|
|
|
|
//! ```
|
|
|
|
|
|
|
|
pub(crate) mod class;
|
|
|
|
|
|
|
|
pub mod handle;
|
|
|
|
pub use handle::ToolbarHandle;
|
2020-02-28 13:34:34 +11:00
|
|
|
|
|
|
|
pub mod item;
|
|
|
|
pub use item::ToolbarItem;
|
2020-03-12 13:45:35 +11:00
|
|
|
|
|
|
|
pub mod traits;
|
|
|
|
pub use traits::ToolbarController;
|
|
|
|
|
|
|
|
pub mod toolbar;
|
|
|
|
pub use toolbar::Toolbar;
|
2020-03-13 06:33:41 +11:00
|
|
|
|
|
|
|
pub mod types;
|
|
|
|
pub use types::*;
|