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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#![deny(missing_copy_implementations)]
#![warn(missing_docs)]
extern crate time;
extern crate daggy;
extern crate graphics;
extern crate num;
extern crate input;
extern crate rand;
extern crate vecmath;
pub use widget::primitive::line::Line;
pub use widget::primitive::point_path::PointPath;
pub use widget::primitive::shape::circle::Circle;
pub use widget::primitive::shape::framed_rectangle::FramedRectangle;
pub use widget::primitive::shape::polygon::Polygon;
pub use widget::primitive::shape::oval::Oval;
pub use widget::primitive::shape::rectangle::Rectangle;
pub use widget::primitive::text::{Text, Wrap as TextWrap};
pub use widget::button::Button;
pub use widget::canvas::Canvas;
pub use widget::drop_down_list::DropDownList;
pub use widget::envelope_editor::EnvelopeEditor;
pub use widget::envelope_editor::EnvelopePoint;
pub use widget::matrix::Matrix as WidgetMatrix;
pub use widget::number_dialer::NumberDialer;
pub use widget::slider::Slider;
pub use widget::tabs::Tabs;
pub use widget::text_box::TextBox;
pub use widget::title_bar::TitleBar;
pub use widget::toggle::Toggle;
pub use widget::xy_pad::XYPad;
pub use widget::primitive::line::Style as LineStyle;
pub use widget::primitive::shape::Style as ShapeStyle;
pub use widget::primitive::shape::framed_rectangle::Style as FramedRectangleStyle;
pub use widget::primitive::text::Style as TextStyle;
pub use widget::button::Style as ButtonStyle;
pub use widget::canvas::Style as CanvasStyle;
pub use widget::drop_down_list::Style as DropDownListStyle;
pub use widget::envelope_editor::Style as EnvelopeEditorStyle;
pub use widget::number_dialer::Style as NumberDialerStyle;
pub use widget::slider::Style as SliderStyle;
pub use widget::tabs::Style as TabsStyle;
pub use widget::text_box::Style as TextBoxStyle;
pub use widget::title_bar::Style as TitleBarStyle;
pub use widget::toggle::Style as ToggleStyle;
pub use widget::xy_pad::Style as XYPadStyle;
pub use backend::{CharacterCache, Graphics};
pub use background::Background;
pub use color::{Color, Colorable};
pub use frame::{Framing, Frameable};
pub use glyph_cache::{GlyphCache, LineBreak};
pub use graph::NodeIndex;
pub use label::{FontSize, Labelable};
pub use mouse::Mouse;
pub use mouse::ButtonState as MouseButtonState;
pub use mouse::ButtonPosition as MouseButtonPosition;
pub use mouse::Scroll as MouseScroll;
pub use position::{Align, Axis, Corner, Depth, Direction, Dimension, Dimensions, Edge, Margin,
Padding, Place, Point, Position, Positionable, Range, Rect, Scalar, Sizeable};
pub use position::Matrix as PositionMatrix;
pub use theme::Theme;
pub use ui::{Ui, UserInput};
pub use widget::{default_x_dimension, default_y_dimension};
pub use widget::{drag, scroll};
pub use widget::{CommonBuilder, CommonState, CommonStyle, Floating, IndexSlot, MaybeParent, UiCell,
UpdateArgs, Widget};
pub use widget::{KidArea, KidAreaArgs};
pub use widget::CommonState as WidgetCommonState;
pub use widget::Id as WidgetId;
pub use widget::Index as WidgetIndex;
pub use widget::Kind as WidgetKind;
pub use widget::State as WidgetState;
pub mod backend;
mod background;
pub mod color;
mod frame;
pub mod glyph_cache;
pub mod graph;
mod label;
mod mouse;
mod position;
pub mod theme;
mod ui;
pub mod utils;
mod widget;
#[macro_export]
macro_rules! widget_ids {
( $widget_id:ident , $($rest:tt)* ) => (
const $widget_id: $crate::WidgetId = $crate::WidgetId(0);
widget_ids!($widget_id.0 => $($rest)*);
);
( $widget_id:ident with $step:expr , $($rest:tt)* ) => (
const $widget_id: $crate::WidgetId = $crate::WidgetId(0);
widget_ids!($widget_id.0 + $step => $($rest)*);
);
( $prev_id:expr => $widget_id:ident , $($rest:tt)* ) => (
const $widget_id: $crate::WidgetId = $crate::WidgetId($prev_id + 1);
widget_ids!($widget_id.0 => $($rest)*);
);
( $prev_id:expr => $widget_id:ident with $step:expr , $($rest:tt)* ) => (
const $widget_id: $crate::WidgetId = $crate::WidgetId($prev_id + 1);
widget_ids!($widget_id.0 + $step => $($rest)*);
);
() => ();
( $prev_id:expr => ) => ();
( $widget_id:ident ) => (
const $widget_id: $crate::WidgetId = $crate::WidgetId(0);
);
( $widget_id:ident with $step:expr ) => (
const $widget_id: $crate::WidgetId = $crate::WidgetId(0);
);
( $prev_id:expr => $widget_id:ident ) => (
const $widget_id: $crate::WidgetId = $crate::WidgetId($prev_id + 1);
);
( $prev_id:expr => $widget_id:ident with $step:expr ) => (
const $widget_id: $crate::WidgetId = $crate::WidgetId($prev_id + 1);
);
}
#[test]
fn test() {
widget_ids! {
A,
B with 64,
C with 32,
D,
E with 8,
}
assert_eq!(A, WidgetId(0));
assert_eq!(B, WidgetId(1));
assert_eq!(C, WidgetId(66));
assert_eq!(D, WidgetId(99));
assert_eq!(E, WidgetId(100));
}