@@ -38,7 +38,7 @@ pub type IconPainter = Box<dyn FnOnce(&Ui, Rect, &WidgetVisuals, bool, AboveOrBe
38
38
/// ```
39
39
#[ must_use = "You should call .show*" ]
40
40
pub struct ComboBox {
41
- id_source : Id ,
41
+ id_salt : Id ,
42
42
label : Option < WidgetText > ,
43
43
selected_text : WidgetText ,
44
44
width : Option < f32 > ,
@@ -49,9 +49,9 @@ pub struct ComboBox {
49
49
50
50
impl ComboBox {
51
51
/// Create new [`ComboBox`] with id and label
52
- pub fn new ( id_source : impl std:: hash:: Hash , label : impl Into < WidgetText > ) -> Self {
52
+ pub fn new ( id_salt : impl std:: hash:: Hash , label : impl Into < WidgetText > ) -> Self {
53
53
Self {
54
- id_source : Id :: new ( id_source ) ,
54
+ id_salt : Id :: new ( id_salt ) ,
55
55
label : Some ( label. into ( ) ) ,
56
56
selected_text : Default :: default ( ) ,
57
57
width : None ,
@@ -65,7 +65,7 @@ impl ComboBox {
65
65
pub fn from_label ( label : impl Into < WidgetText > ) -> Self {
66
66
let label = label. into ( ) ;
67
67
Self {
68
- id_source : Id :: new ( label. text ( ) ) ,
68
+ id_salt : Id :: new ( label. text ( ) ) ,
69
69
label : Some ( label) ,
70
70
selected_text : Default :: default ( ) ,
71
71
width : None ,
@@ -76,9 +76,9 @@ impl ComboBox {
76
76
}
77
77
78
78
/// Without label.
79
- pub fn from_id_source ( id_source : impl std:: hash:: Hash ) -> Self {
79
+ pub fn from_id_salt ( id_salt : impl std:: hash:: Hash ) -> Self {
80
80
Self {
81
- id_source : Id :: new ( id_source ) ,
81
+ id_salt : Id :: new ( id_salt ) ,
82
82
label : Default :: default ( ) ,
83
83
selected_text : Default :: default ( ) ,
84
84
width : None ,
@@ -88,6 +88,12 @@ impl ComboBox {
88
88
}
89
89
}
90
90
91
+ /// Without label.
92
+ #[ deprecated = "Renamed id_salt" ]
93
+ pub fn from_id_source ( id_salt : impl std:: hash:: Hash ) -> Self {
94
+ Self :: from_id_salt ( id_salt)
95
+ }
96
+
91
97
/// Set the outer width of the button and menu.
92
98
///
93
99
/// Default is [`Spacing::combo_width`].
@@ -138,7 +144,7 @@ impl ComboBox {
138
144
/// ));
139
145
/// }
140
146
///
141
- /// egui::ComboBox::from_id_source ("my-combobox")
147
+ /// egui::ComboBox::from_id_salt ("my-combobox")
142
148
/// .selected_text(text)
143
149
/// .icon(filled_triangle)
144
150
/// .show_ui(ui, |_ui| {});
@@ -195,7 +201,7 @@ impl ComboBox {
195
201
menu_contents : Box < dyn FnOnce ( & mut Ui ) -> R + ' c > ,
196
202
) -> InnerResponse < Option < R > > {
197
203
let Self {
198
- id_source ,
204
+ id_salt ,
199
205
label,
200
206
selected_text,
201
207
width,
@@ -204,7 +210,7 @@ impl ComboBox {
204
210
wrap_mode,
205
211
} = self ;
206
212
207
- let button_id = ui. make_persistent_id ( id_source ) ;
213
+ let button_id = ui. make_persistent_id ( id_salt ) ;
208
214
209
215
ui. horizontal ( |ui| {
210
216
let mut ir = combo_box_dyn (
0 commit comments