1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
use crate::{
	DataProcessor,
	NativeWidget,
	WidgetGenerator,
};

/// Minimal UI element.
///
/// Widget represents minimal UI element. Most common widgets is Button and TextEdit.
pub trait Widget: DataProcessor {
	/// Generate native widget
	fn to_native(
		&mut self,
		_widget_generator: &mut dyn WidgetGenerator,
	) -> Result<NativeWidget, ()>;

	/// Allows drawing on top of generated NativeWidget
	fn draw(&mut self) {
	}
}