1#![allow(deprecated)]
5
6use crate::{ffi, Buildable, CellArea, CellLayout, TreeIter, TreeModel};
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 #[doc(alias = "GtkEntryCompletion")]
17 pub struct EntryCompletion(Object<ffi::GtkEntryCompletion>) @implements Buildable, CellLayout;
18
19 match fn {
20 type_ => || ffi::gtk_entry_completion_get_type(),
21 }
22}
23
24impl EntryCompletion {
25 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
26 #[allow(deprecated)]
27 #[doc(alias = "gtk_entry_completion_new")]
28 pub fn new() -> EntryCompletion {
29 assert_initialized_main_thread!();
30 unsafe { from_glib_full(ffi::gtk_entry_completion_new()) }
31 }
32
33 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
34 #[allow(deprecated)]
35 #[doc(alias = "gtk_entry_completion_new_with_area")]
36 #[doc(alias = "new_with_area")]
37 pub fn with_area(area: &impl IsA<CellArea>) -> EntryCompletion {
38 skip_assert_initialized!();
39 unsafe {
40 from_glib_full(ffi::gtk_entry_completion_new_with_area(
41 area.as_ref().to_glib_none().0,
42 ))
43 }
44 }
45
46 pub fn builder() -> EntryCompletionBuilder {
51 EntryCompletionBuilder::new()
52 }
53
54 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
55 #[allow(deprecated)]
56 #[doc(alias = "gtk_entry_completion_complete")]
57 pub fn complete(&self) {
58 unsafe {
59 ffi::gtk_entry_completion_complete(self.to_glib_none().0);
60 }
61 }
62
63 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
64 #[allow(deprecated)]
65 #[doc(alias = "gtk_entry_completion_compute_prefix")]
66 pub fn compute_prefix(&self, key: &str) -> Option<glib::GString> {
67 unsafe {
68 from_glib_full(ffi::gtk_entry_completion_compute_prefix(
69 self.to_glib_none().0,
70 key.to_glib_none().0,
71 ))
72 }
73 }
74
75 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
76 #[allow(deprecated)]
77 #[doc(alias = "gtk_entry_completion_get_completion_prefix")]
78 #[doc(alias = "get_completion_prefix")]
79 pub fn completion_prefix(&self) -> Option<glib::GString> {
80 unsafe {
81 from_glib_none(ffi::gtk_entry_completion_get_completion_prefix(
82 self.to_glib_none().0,
83 ))
84 }
85 }
86
87 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
88 #[allow(deprecated)]
89 #[doc(alias = "gtk_entry_completion_get_inline_completion")]
90 #[doc(alias = "get_inline_completion")]
91 #[doc(alias = "inline-completion")]
92 pub fn is_inline_completion(&self) -> bool {
93 unsafe {
94 from_glib(ffi::gtk_entry_completion_get_inline_completion(
95 self.to_glib_none().0,
96 ))
97 }
98 }
99
100 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
101 #[allow(deprecated)]
102 #[doc(alias = "gtk_entry_completion_get_inline_selection")]
103 #[doc(alias = "get_inline_selection")]
104 #[doc(alias = "inline-selection")]
105 pub fn is_inline_selection(&self) -> bool {
106 unsafe {
107 from_glib(ffi::gtk_entry_completion_get_inline_selection(
108 self.to_glib_none().0,
109 ))
110 }
111 }
112
113 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
114 #[allow(deprecated)]
115 #[doc(alias = "gtk_entry_completion_get_minimum_key_length")]
116 #[doc(alias = "get_minimum_key_length")]
117 #[doc(alias = "minimum-key-length")]
118 pub fn minimum_key_length(&self) -> i32 {
119 unsafe { ffi::gtk_entry_completion_get_minimum_key_length(self.to_glib_none().0) }
120 }
121
122 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
123 #[allow(deprecated)]
124 #[doc(alias = "gtk_entry_completion_get_model")]
125 #[doc(alias = "get_model")]
126 pub fn model(&self) -> Option<TreeModel> {
127 unsafe { from_glib_none(ffi::gtk_entry_completion_get_model(self.to_glib_none().0)) }
128 }
129
130 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
131 #[allow(deprecated)]
132 #[doc(alias = "gtk_entry_completion_get_popup_completion")]
133 #[doc(alias = "get_popup_completion")]
134 #[doc(alias = "popup-completion")]
135 pub fn is_popup_completion(&self) -> bool {
136 unsafe {
137 from_glib(ffi::gtk_entry_completion_get_popup_completion(
138 self.to_glib_none().0,
139 ))
140 }
141 }
142
143 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
144 #[allow(deprecated)]
145 #[doc(alias = "gtk_entry_completion_get_popup_set_width")]
146 #[doc(alias = "get_popup_set_width")]
147 #[doc(alias = "popup-set-width")]
148 pub fn is_popup_set_width(&self) -> bool {
149 unsafe {
150 from_glib(ffi::gtk_entry_completion_get_popup_set_width(
151 self.to_glib_none().0,
152 ))
153 }
154 }
155
156 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
157 #[allow(deprecated)]
158 #[doc(alias = "gtk_entry_completion_get_popup_single_match")]
159 #[doc(alias = "get_popup_single_match")]
160 #[doc(alias = "popup-single-match")]
161 pub fn is_popup_single_match(&self) -> bool {
162 unsafe {
163 from_glib(ffi::gtk_entry_completion_get_popup_single_match(
164 self.to_glib_none().0,
165 ))
166 }
167 }
168
169 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
170 #[allow(deprecated)]
171 #[doc(alias = "gtk_entry_completion_get_text_column")]
172 #[doc(alias = "get_text_column")]
173 #[doc(alias = "text-column")]
174 pub fn text_column(&self) -> i32 {
175 unsafe { ffi::gtk_entry_completion_get_text_column(self.to_glib_none().0) }
176 }
177
178 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
179 #[allow(deprecated)]
180 #[doc(alias = "gtk_entry_completion_insert_prefix")]
181 pub fn insert_prefix(&self) {
182 unsafe {
183 ffi::gtk_entry_completion_insert_prefix(self.to_glib_none().0);
184 }
185 }
186
187 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
188 #[allow(deprecated)]
189 #[doc(alias = "gtk_entry_completion_set_inline_completion")]
190 #[doc(alias = "inline-completion")]
191 pub fn set_inline_completion(&self, inline_completion: bool) {
192 unsafe {
193 ffi::gtk_entry_completion_set_inline_completion(
194 self.to_glib_none().0,
195 inline_completion.into_glib(),
196 );
197 }
198 }
199
200 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
201 #[allow(deprecated)]
202 #[doc(alias = "gtk_entry_completion_set_inline_selection")]
203 #[doc(alias = "inline-selection")]
204 pub fn set_inline_selection(&self, inline_selection: bool) {
205 unsafe {
206 ffi::gtk_entry_completion_set_inline_selection(
207 self.to_glib_none().0,
208 inline_selection.into_glib(),
209 );
210 }
211 }
212
213 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
214 #[allow(deprecated)]
215 #[doc(alias = "gtk_entry_completion_set_match_func")]
216 pub fn set_match_func<P: Fn(&EntryCompletion, &str, &TreeIter) -> bool + 'static>(
217 &self,
218 func: P,
219 ) {
220 let func_data: Box_<P> = Box_::new(func);
221 unsafe extern "C" fn func_func<
222 P: Fn(&EntryCompletion, &str, &TreeIter) -> bool + 'static,
223 >(
224 completion: *mut ffi::GtkEntryCompletion,
225 key: *const std::ffi::c_char,
226 iter: *mut ffi::GtkTreeIter,
227 user_data: glib::ffi::gpointer,
228 ) -> glib::ffi::gboolean {
229 let completion = from_glib_borrow(completion);
230 let key: Borrowed<glib::GString> = from_glib_borrow(key);
231 let iter = from_glib_borrow(iter);
232 let callback = &*(user_data as *mut P);
233 (*callback)(&completion, key.as_str(), &iter).into_glib()
234 }
235 let func = Some(func_func::<P> as _);
236 unsafe extern "C" fn func_notify_func<
237 P: Fn(&EntryCompletion, &str, &TreeIter) -> bool + 'static,
238 >(
239 data: glib::ffi::gpointer,
240 ) {
241 let _callback = Box_::from_raw(data as *mut P);
242 }
243 let destroy_call3 = Some(func_notify_func::<P> as _);
244 let super_callback0: Box_<P> = func_data;
245 unsafe {
246 ffi::gtk_entry_completion_set_match_func(
247 self.to_glib_none().0,
248 func,
249 Box_::into_raw(super_callback0) as *mut _,
250 destroy_call3,
251 );
252 }
253 }
254
255 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
256 #[allow(deprecated)]
257 #[doc(alias = "gtk_entry_completion_set_minimum_key_length")]
258 #[doc(alias = "minimum-key-length")]
259 pub fn set_minimum_key_length(&self, length: i32) {
260 unsafe {
261 ffi::gtk_entry_completion_set_minimum_key_length(self.to_glib_none().0, length);
262 }
263 }
264
265 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
266 #[allow(deprecated)]
267 #[doc(alias = "gtk_entry_completion_set_model")]
268 #[doc(alias = "model")]
269 pub fn set_model(&self, model: Option<&impl IsA<TreeModel>>) {
270 unsafe {
271 ffi::gtk_entry_completion_set_model(
272 self.to_glib_none().0,
273 model.map(|p| p.as_ref()).to_glib_none().0,
274 );
275 }
276 }
277
278 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
279 #[allow(deprecated)]
280 #[doc(alias = "gtk_entry_completion_set_popup_completion")]
281 #[doc(alias = "popup-completion")]
282 pub fn set_popup_completion(&self, popup_completion: bool) {
283 unsafe {
284 ffi::gtk_entry_completion_set_popup_completion(
285 self.to_glib_none().0,
286 popup_completion.into_glib(),
287 );
288 }
289 }
290
291 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
292 #[allow(deprecated)]
293 #[doc(alias = "gtk_entry_completion_set_popup_set_width")]
294 #[doc(alias = "popup-set-width")]
295 pub fn set_popup_set_width(&self, popup_set_width: bool) {
296 unsafe {
297 ffi::gtk_entry_completion_set_popup_set_width(
298 self.to_glib_none().0,
299 popup_set_width.into_glib(),
300 );
301 }
302 }
303
304 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
305 #[allow(deprecated)]
306 #[doc(alias = "gtk_entry_completion_set_popup_single_match")]
307 #[doc(alias = "popup-single-match")]
308 pub fn set_popup_single_match(&self, popup_single_match: bool) {
309 unsafe {
310 ffi::gtk_entry_completion_set_popup_single_match(
311 self.to_glib_none().0,
312 popup_single_match.into_glib(),
313 );
314 }
315 }
316
317 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
318 #[allow(deprecated)]
319 #[doc(alias = "gtk_entry_completion_set_text_column")]
320 #[doc(alias = "text-column")]
321 pub fn set_text_column(&self, column: i32) {
322 unsafe {
323 ffi::gtk_entry_completion_set_text_column(self.to_glib_none().0, column);
324 }
325 }
326
327 #[doc(alias = "cell-area")]
328 pub fn cell_area(&self) -> Option<CellArea> {
329 ObjectExt::property(self, "cell-area")
330 }
331
332 #[doc(alias = "cursor-on-match")]
333 pub fn connect_cursor_on_match<
334 F: Fn(&Self, &TreeModel, &TreeIter) -> glib::Propagation + 'static,
335 >(
336 &self,
337 f: F,
338 ) -> SignalHandlerId {
339 unsafe extern "C" fn cursor_on_match_trampoline<
340 F: Fn(&EntryCompletion, &TreeModel, &TreeIter) -> glib::Propagation + 'static,
341 >(
342 this: *mut ffi::GtkEntryCompletion,
343 model: *mut ffi::GtkTreeModel,
344 iter: *mut ffi::GtkTreeIter,
345 f: glib::ffi::gpointer,
346 ) -> glib::ffi::gboolean {
347 let f: &F = &*(f as *const F);
348 f(
349 &from_glib_borrow(this),
350 &from_glib_borrow(model),
351 &from_glib_borrow(iter),
352 )
353 .into_glib()
354 }
355 unsafe {
356 let f: Box_<F> = Box_::new(f);
357 connect_raw(
358 self.as_ptr() as *mut _,
359 c"cursor-on-match".as_ptr() as *const _,
360 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
361 cursor_on_match_trampoline::<F> as *const (),
362 )),
363 Box_::into_raw(f),
364 )
365 }
366 }
367
368 #[doc(alias = "insert-prefix")]
369 pub fn connect_insert_prefix<F: Fn(&Self, &str) -> glib::Propagation + 'static>(
370 &self,
371 f: F,
372 ) -> SignalHandlerId {
373 unsafe extern "C" fn insert_prefix_trampoline<
374 F: Fn(&EntryCompletion, &str) -> glib::Propagation + 'static,
375 >(
376 this: *mut ffi::GtkEntryCompletion,
377 prefix: *mut std::ffi::c_char,
378 f: glib::ffi::gpointer,
379 ) -> glib::ffi::gboolean {
380 let f: &F = &*(f as *const F);
381 f(
382 &from_glib_borrow(this),
383 &glib::GString::from_glib_borrow(prefix),
384 )
385 .into_glib()
386 }
387 unsafe {
388 let f: Box_<F> = Box_::new(f);
389 connect_raw(
390 self.as_ptr() as *mut _,
391 c"insert-prefix".as_ptr() as *const _,
392 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
393 insert_prefix_trampoline::<F> as *const (),
394 )),
395 Box_::into_raw(f),
396 )
397 }
398 }
399
400 #[doc(alias = "match-selected")]
401 pub fn connect_match_selected<
402 F: Fn(&Self, &TreeModel, &TreeIter) -> glib::Propagation + 'static,
403 >(
404 &self,
405 f: F,
406 ) -> SignalHandlerId {
407 unsafe extern "C" fn match_selected_trampoline<
408 F: Fn(&EntryCompletion, &TreeModel, &TreeIter) -> glib::Propagation + 'static,
409 >(
410 this: *mut ffi::GtkEntryCompletion,
411 model: *mut ffi::GtkTreeModel,
412 iter: *mut ffi::GtkTreeIter,
413 f: glib::ffi::gpointer,
414 ) -> glib::ffi::gboolean {
415 let f: &F = &*(f as *const F);
416 f(
417 &from_glib_borrow(this),
418 &from_glib_borrow(model),
419 &from_glib_borrow(iter),
420 )
421 .into_glib()
422 }
423 unsafe {
424 let f: Box_<F> = Box_::new(f);
425 connect_raw(
426 self.as_ptr() as *mut _,
427 c"match-selected".as_ptr() as *const _,
428 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
429 match_selected_trampoline::<F> as *const (),
430 )),
431 Box_::into_raw(f),
432 )
433 }
434 }
435
436 #[doc(alias = "no-matches")]
437 pub fn connect_no_matches<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
438 unsafe extern "C" fn no_matches_trampoline<F: Fn(&EntryCompletion) + 'static>(
439 this: *mut ffi::GtkEntryCompletion,
440 f: glib::ffi::gpointer,
441 ) {
442 let f: &F = &*(f as *const F);
443 f(&from_glib_borrow(this))
444 }
445 unsafe {
446 let f: Box_<F> = Box_::new(f);
447 connect_raw(
448 self.as_ptr() as *mut _,
449 c"no-matches".as_ptr() as *const _,
450 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
451 no_matches_trampoline::<F> as *const (),
452 )),
453 Box_::into_raw(f),
454 )
455 }
456 }
457
458 #[doc(alias = "inline-completion")]
459 pub fn connect_inline_completion_notify<F: Fn(&Self) + 'static>(
460 &self,
461 f: F,
462 ) -> SignalHandlerId {
463 unsafe extern "C" fn notify_inline_completion_trampoline<
464 F: Fn(&EntryCompletion) + 'static,
465 >(
466 this: *mut ffi::GtkEntryCompletion,
467 _param_spec: glib::ffi::gpointer,
468 f: glib::ffi::gpointer,
469 ) {
470 let f: &F = &*(f as *const F);
471 f(&from_glib_borrow(this))
472 }
473 unsafe {
474 let f: Box_<F> = Box_::new(f);
475 connect_raw(
476 self.as_ptr() as *mut _,
477 c"notify::inline-completion".as_ptr() as *const _,
478 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
479 notify_inline_completion_trampoline::<F> as *const (),
480 )),
481 Box_::into_raw(f),
482 )
483 }
484 }
485
486 #[doc(alias = "inline-selection")]
487 pub fn connect_inline_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
488 unsafe extern "C" fn notify_inline_selection_trampoline<
489 F: Fn(&EntryCompletion) + 'static,
490 >(
491 this: *mut ffi::GtkEntryCompletion,
492 _param_spec: glib::ffi::gpointer,
493 f: glib::ffi::gpointer,
494 ) {
495 let f: &F = &*(f as *const F);
496 f(&from_glib_borrow(this))
497 }
498 unsafe {
499 let f: Box_<F> = Box_::new(f);
500 connect_raw(
501 self.as_ptr() as *mut _,
502 c"notify::inline-selection".as_ptr() as *const _,
503 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
504 notify_inline_selection_trampoline::<F> as *const (),
505 )),
506 Box_::into_raw(f),
507 )
508 }
509 }
510
511 #[doc(alias = "minimum-key-length")]
512 pub fn connect_minimum_key_length_notify<F: Fn(&Self) + 'static>(
513 &self,
514 f: F,
515 ) -> SignalHandlerId {
516 unsafe extern "C" fn notify_minimum_key_length_trampoline<
517 F: Fn(&EntryCompletion) + 'static,
518 >(
519 this: *mut ffi::GtkEntryCompletion,
520 _param_spec: glib::ffi::gpointer,
521 f: glib::ffi::gpointer,
522 ) {
523 let f: &F = &*(f as *const F);
524 f(&from_glib_borrow(this))
525 }
526 unsafe {
527 let f: Box_<F> = Box_::new(f);
528 connect_raw(
529 self.as_ptr() as *mut _,
530 c"notify::minimum-key-length".as_ptr() as *const _,
531 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
532 notify_minimum_key_length_trampoline::<F> as *const (),
533 )),
534 Box_::into_raw(f),
535 )
536 }
537 }
538
539 #[doc(alias = "model")]
540 pub fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
541 unsafe extern "C" fn notify_model_trampoline<F: Fn(&EntryCompletion) + 'static>(
542 this: *mut ffi::GtkEntryCompletion,
543 _param_spec: glib::ffi::gpointer,
544 f: glib::ffi::gpointer,
545 ) {
546 let f: &F = &*(f as *const F);
547 f(&from_glib_borrow(this))
548 }
549 unsafe {
550 let f: Box_<F> = Box_::new(f);
551 connect_raw(
552 self.as_ptr() as *mut _,
553 c"notify::model".as_ptr() as *const _,
554 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
555 notify_model_trampoline::<F> as *const (),
556 )),
557 Box_::into_raw(f),
558 )
559 }
560 }
561
562 #[doc(alias = "popup-completion")]
563 pub fn connect_popup_completion_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
564 unsafe extern "C" fn notify_popup_completion_trampoline<
565 F: Fn(&EntryCompletion) + 'static,
566 >(
567 this: *mut ffi::GtkEntryCompletion,
568 _param_spec: glib::ffi::gpointer,
569 f: glib::ffi::gpointer,
570 ) {
571 let f: &F = &*(f as *const F);
572 f(&from_glib_borrow(this))
573 }
574 unsafe {
575 let f: Box_<F> = Box_::new(f);
576 connect_raw(
577 self.as_ptr() as *mut _,
578 c"notify::popup-completion".as_ptr() as *const _,
579 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
580 notify_popup_completion_trampoline::<F> as *const (),
581 )),
582 Box_::into_raw(f),
583 )
584 }
585 }
586
587 #[doc(alias = "popup-set-width")]
588 pub fn connect_popup_set_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
589 unsafe extern "C" fn notify_popup_set_width_trampoline<
590 F: Fn(&EntryCompletion) + 'static,
591 >(
592 this: *mut ffi::GtkEntryCompletion,
593 _param_spec: glib::ffi::gpointer,
594 f: glib::ffi::gpointer,
595 ) {
596 let f: &F = &*(f as *const F);
597 f(&from_glib_borrow(this))
598 }
599 unsafe {
600 let f: Box_<F> = Box_::new(f);
601 connect_raw(
602 self.as_ptr() as *mut _,
603 c"notify::popup-set-width".as_ptr() as *const _,
604 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
605 notify_popup_set_width_trampoline::<F> as *const (),
606 )),
607 Box_::into_raw(f),
608 )
609 }
610 }
611
612 #[doc(alias = "popup-single-match")]
613 pub fn connect_popup_single_match_notify<F: Fn(&Self) + 'static>(
614 &self,
615 f: F,
616 ) -> SignalHandlerId {
617 unsafe extern "C" fn notify_popup_single_match_trampoline<
618 F: Fn(&EntryCompletion) + 'static,
619 >(
620 this: *mut ffi::GtkEntryCompletion,
621 _param_spec: glib::ffi::gpointer,
622 f: glib::ffi::gpointer,
623 ) {
624 let f: &F = &*(f as *const F);
625 f(&from_glib_borrow(this))
626 }
627 unsafe {
628 let f: Box_<F> = Box_::new(f);
629 connect_raw(
630 self.as_ptr() as *mut _,
631 c"notify::popup-single-match".as_ptr() as *const _,
632 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
633 notify_popup_single_match_trampoline::<F> as *const (),
634 )),
635 Box_::into_raw(f),
636 )
637 }
638 }
639
640 #[doc(alias = "text-column")]
641 pub fn connect_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
642 unsafe extern "C" fn notify_text_column_trampoline<F: Fn(&EntryCompletion) + 'static>(
643 this: *mut ffi::GtkEntryCompletion,
644 _param_spec: glib::ffi::gpointer,
645 f: glib::ffi::gpointer,
646 ) {
647 let f: &F = &*(f as *const F);
648 f(&from_glib_borrow(this))
649 }
650 unsafe {
651 let f: Box_<F> = Box_::new(f);
652 connect_raw(
653 self.as_ptr() as *mut _,
654 c"notify::text-column".as_ptr() as *const _,
655 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
656 notify_text_column_trampoline::<F> as *const (),
657 )),
658 Box_::into_raw(f),
659 )
660 }
661 }
662}
663
664impl Default for EntryCompletion {
665 fn default() -> Self {
666 Self::new()
667 }
668}
669
670#[must_use = "The builder must be built to be used"]
675pub struct EntryCompletionBuilder {
676 builder: glib::object::ObjectBuilder<'static, EntryCompletion>,
677}
678
679impl EntryCompletionBuilder {
680 fn new() -> Self {
681 Self {
682 builder: glib::object::Object::builder(),
683 }
684 }
685
686 pub fn cell_area(self, cell_area: &impl IsA<CellArea>) -> Self {
687 Self {
688 builder: self
689 .builder
690 .property("cell-area", cell_area.clone().upcast()),
691 }
692 }
693
694 pub fn inline_completion(self, inline_completion: bool) -> Self {
695 Self {
696 builder: self
697 .builder
698 .property("inline-completion", inline_completion),
699 }
700 }
701
702 pub fn inline_selection(self, inline_selection: bool) -> Self {
703 Self {
704 builder: self.builder.property("inline-selection", inline_selection),
705 }
706 }
707
708 pub fn minimum_key_length(self, minimum_key_length: i32) -> Self {
709 Self {
710 builder: self
711 .builder
712 .property("minimum-key-length", minimum_key_length),
713 }
714 }
715
716 pub fn model(self, model: &impl IsA<TreeModel>) -> Self {
717 Self {
718 builder: self.builder.property("model", model.clone().upcast()),
719 }
720 }
721
722 pub fn popup_completion(self, popup_completion: bool) -> Self {
723 Self {
724 builder: self.builder.property("popup-completion", popup_completion),
725 }
726 }
727
728 pub fn popup_set_width(self, popup_set_width: bool) -> Self {
729 Self {
730 builder: self.builder.property("popup-set-width", popup_set_width),
731 }
732 }
733
734 pub fn popup_single_match(self, popup_single_match: bool) -> Self {
735 Self {
736 builder: self
737 .builder
738 .property("popup-single-match", popup_single_match),
739 }
740 }
741
742 pub fn text_column(self, text_column: i32) -> Self {
743 Self {
744 builder: self.builder.property("text-column", text_column),
745 }
746 }
747
748 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
751 pub fn build(self) -> EntryCompletion {
752 assert_initialized_main_thread!();
753 self.builder.build()
754 }
755}