1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
//! Data models used for sending events to the config.
//!
//! This module provides everything necessary for sending events from the bar frontend to the
//! configuration. Implementing all of these events is necessary to make sure that all components
//! will function properly.
//!
//! # Examples
//!
//! Here's a minimal example for sending events to the config:
//! ```
//! use bar_config::event::{Event, Point};
//! use bar_config::Bar;
//! use std::io::Cursor;
//!
//! let config_file = Cursor::new(String::from(
//! "height: 30\n\
//! monitors:\n\
//! - { name: \"DVI-1\" }"
//! ));
//!
//! let mut bar = Bar::load(config_file).unwrap();
//! bar.notify(Event::MouseMotion(Point { x: 0, y: 0 }));
//! ```
use crateComponentID;
/// Event which can be transmitted to the components.
///
/// This event needs to be created from the frontend and can then be sent to the bar using
/// the [`Bar::notify`] method. Every component has the choice to use an event or ignore it.
///
/// [`Bar::notify`]: struct.Bar.html#method.notify
/// Button on the mouse.
///
/// This is required for the [`Click`] event.
///
/// [`Click`]: enum.Event.html#variant.Click
/// Mouse button states.
///
/// This is required for the [`Click`] event.
///
/// [`Click`]: enum.Event.html#variant.Click
/// Exact position of a component on the screen.
///
/// This must be used in the [`PositionChange`] event which notifies components about their position
/// on the screen.
///
/// [`PositionChange`]: enum.Event.html#variant.PositionChange
/// Point on the screen.