1 // This file was generated by gir (https://github.com/gtk-rs/gir) 2 // from gir-files (https://github.com/gtk-rs/gir-files) 3 // DO NOT EDIT 4 5 use crate::Align; 6 use crate::Bin; 7 use crate::Buildable; 8 use crate::CellArea; 9 use crate::CellEditable; 10 use crate::CellLayout; 11 use crate::Container; 12 use crate::ResizeMode; 13 use crate::ScrollType; 14 use crate::SensitivityType; 15 use crate::TreeIter; 16 use crate::TreeModel; 17 use crate::Widget; 18 use glib::object::Cast; 19 use glib::object::IsA; 20 use glib::object::ObjectExt; 21 use glib::signal::connect_raw; 22 use glib::signal::SignalHandlerId; 23 use glib::translate::*; 24 use glib::StaticType; 25 use glib::ToValue; 26 use std::boxed::Box as Box_; 27 use std::fmt; 28 use std::mem::transmute; 29 30 glib::wrapper! { 31 #[doc(alias = "GtkComboBox")] 32 pub struct ComboBox(Object<ffi::GtkComboBox, ffi::GtkComboBoxClass>) @extends Bin, Container, Widget, @implements Buildable, CellEditable, CellLayout; 33 34 match fn { 35 type_ => || ffi::gtk_combo_box_get_type(), 36 } 37 } 38 39 impl ComboBox { 40 #[doc(alias = "gtk_combo_box_new")] new() -> ComboBox41 pub fn new() -> ComboBox { 42 assert_initialized_main_thread!(); 43 unsafe { Widget::from_glib_none(ffi::gtk_combo_box_new()).unsafe_cast() } 44 } 45 46 #[doc(alias = "gtk_combo_box_new_with_area")] 47 #[doc(alias = "new_with_area")] with_area<P: IsA<CellArea>>(area: &P) -> ComboBox48 pub fn with_area<P: IsA<CellArea>>(area: &P) -> ComboBox { 49 skip_assert_initialized!(); 50 unsafe { 51 Widget::from_glib_none(ffi::gtk_combo_box_new_with_area( 52 area.as_ref().to_glib_none().0, 53 )) 54 .unsafe_cast() 55 } 56 } 57 58 #[doc(alias = "gtk_combo_box_new_with_area_and_entry")] 59 #[doc(alias = "new_with_area_and_entry")] with_area_and_entry<P: IsA<CellArea>>(area: &P) -> ComboBox60 pub fn with_area_and_entry<P: IsA<CellArea>>(area: &P) -> ComboBox { 61 skip_assert_initialized!(); 62 unsafe { 63 Widget::from_glib_none(ffi::gtk_combo_box_new_with_area_and_entry( 64 area.as_ref().to_glib_none().0, 65 )) 66 .unsafe_cast() 67 } 68 } 69 70 #[doc(alias = "gtk_combo_box_new_with_entry")] 71 #[doc(alias = "new_with_entry")] with_entry() -> ComboBox72 pub fn with_entry() -> ComboBox { 73 assert_initialized_main_thread!(); 74 unsafe { Widget::from_glib_none(ffi::gtk_combo_box_new_with_entry()).unsafe_cast() } 75 } 76 77 #[doc(alias = "gtk_combo_box_new_with_model")] 78 #[doc(alias = "new_with_model")] with_model<P: IsA<TreeModel>>(model: &P) -> ComboBox79 pub fn with_model<P: IsA<TreeModel>>(model: &P) -> ComboBox { 80 skip_assert_initialized!(); 81 unsafe { 82 Widget::from_glib_none(ffi::gtk_combo_box_new_with_model( 83 model.as_ref().to_glib_none().0, 84 )) 85 .unsafe_cast() 86 } 87 } 88 89 #[doc(alias = "gtk_combo_box_new_with_model_and_entry")] 90 #[doc(alias = "new_with_model_and_entry")] with_model_and_entry<P: IsA<TreeModel>>(model: &P) -> ComboBox91 pub fn with_model_and_entry<P: IsA<TreeModel>>(model: &P) -> ComboBox { 92 skip_assert_initialized!(); 93 unsafe { 94 Widget::from_glib_none(ffi::gtk_combo_box_new_with_model_and_entry( 95 model.as_ref().to_glib_none().0, 96 )) 97 .unsafe_cast() 98 } 99 } 100 101 // rustdoc-stripper-ignore-next 102 /// Creates a new builder-pattern struct instance to construct [`ComboBox`] objects. 103 /// 104 /// This method returns an instance of [`ComboBoxBuilder`] which can be used to create [`ComboBox`] objects. builder() -> ComboBoxBuilder105 pub fn builder() -> ComboBoxBuilder { 106 ComboBoxBuilder::default() 107 } 108 } 109 110 impl Default for ComboBox { default() -> Self111 fn default() -> Self { 112 Self::new() 113 } 114 } 115 116 #[derive(Clone, Default)] 117 // rustdoc-stripper-ignore-next 118 /// A [builder-pattern] type to construct [`ComboBox`] objects. 119 /// 120 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 121 pub struct ComboBoxBuilder { 122 active: Option<i32>, 123 active_id: Option<String>, 124 button_sensitivity: Option<SensitivityType>, 125 cell_area: Option<CellArea>, 126 column_span_column: Option<i32>, 127 entry_text_column: Option<i32>, 128 has_entry: Option<bool>, 129 has_frame: Option<bool>, 130 id_column: Option<i32>, 131 model: Option<TreeModel>, 132 popup_fixed_width: Option<bool>, 133 row_span_column: Option<i32>, 134 wrap_width: Option<i32>, 135 border_width: Option<u32>, 136 child: Option<Widget>, 137 resize_mode: Option<ResizeMode>, 138 app_paintable: Option<bool>, 139 can_default: Option<bool>, 140 can_focus: Option<bool>, 141 events: Option<gdk::EventMask>, 142 expand: Option<bool>, 143 #[cfg(any(feature = "v3_20", feature = "dox"))] 144 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 145 focus_on_click: Option<bool>, 146 halign: Option<Align>, 147 has_default: Option<bool>, 148 has_focus: Option<bool>, 149 has_tooltip: Option<bool>, 150 height_request: Option<i32>, 151 hexpand: Option<bool>, 152 hexpand_set: Option<bool>, 153 is_focus: Option<bool>, 154 margin: Option<i32>, 155 margin_bottom: Option<i32>, 156 margin_end: Option<i32>, 157 margin_start: Option<i32>, 158 margin_top: Option<i32>, 159 name: Option<String>, 160 no_show_all: Option<bool>, 161 opacity: Option<f64>, 162 parent: Option<Container>, 163 receives_default: Option<bool>, 164 sensitive: Option<bool>, 165 tooltip_markup: Option<String>, 166 tooltip_text: Option<String>, 167 valign: Option<Align>, 168 vexpand: Option<bool>, 169 vexpand_set: Option<bool>, 170 visible: Option<bool>, 171 width_request: Option<i32>, 172 editing_canceled: Option<bool>, 173 } 174 175 impl ComboBoxBuilder { 176 // rustdoc-stripper-ignore-next 177 /// Create a new [`ComboBoxBuilder`]. new() -> Self178 pub fn new() -> Self { 179 Self::default() 180 } 181 182 // rustdoc-stripper-ignore-next 183 /// Build the [`ComboBox`]. build(self) -> ComboBox184 pub fn build(self) -> ComboBox { 185 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 186 if let Some(ref active) = self.active { 187 properties.push(("active", active)); 188 } 189 if let Some(ref active_id) = self.active_id { 190 properties.push(("active-id", active_id)); 191 } 192 if let Some(ref button_sensitivity) = self.button_sensitivity { 193 properties.push(("button-sensitivity", button_sensitivity)); 194 } 195 if let Some(ref cell_area) = self.cell_area { 196 properties.push(("cell-area", cell_area)); 197 } 198 if let Some(ref column_span_column) = self.column_span_column { 199 properties.push(("column-span-column", column_span_column)); 200 } 201 if let Some(ref entry_text_column) = self.entry_text_column { 202 properties.push(("entry-text-column", entry_text_column)); 203 } 204 if let Some(ref has_entry) = self.has_entry { 205 properties.push(("has-entry", has_entry)); 206 } 207 if let Some(ref has_frame) = self.has_frame { 208 properties.push(("has-frame", has_frame)); 209 } 210 if let Some(ref id_column) = self.id_column { 211 properties.push(("id-column", id_column)); 212 } 213 if let Some(ref model) = self.model { 214 properties.push(("model", model)); 215 } 216 if let Some(ref popup_fixed_width) = self.popup_fixed_width { 217 properties.push(("popup-fixed-width", popup_fixed_width)); 218 } 219 if let Some(ref row_span_column) = self.row_span_column { 220 properties.push(("row-span-column", row_span_column)); 221 } 222 if let Some(ref wrap_width) = self.wrap_width { 223 properties.push(("wrap-width", wrap_width)); 224 } 225 if let Some(ref border_width) = self.border_width { 226 properties.push(("border-width", border_width)); 227 } 228 if let Some(ref child) = self.child { 229 properties.push(("child", child)); 230 } 231 if let Some(ref resize_mode) = self.resize_mode { 232 properties.push(("resize-mode", resize_mode)); 233 } 234 if let Some(ref app_paintable) = self.app_paintable { 235 properties.push(("app-paintable", app_paintable)); 236 } 237 if let Some(ref can_default) = self.can_default { 238 properties.push(("can-default", can_default)); 239 } 240 if let Some(ref can_focus) = self.can_focus { 241 properties.push(("can-focus", can_focus)); 242 } 243 if let Some(ref events) = self.events { 244 properties.push(("events", events)); 245 } 246 if let Some(ref expand) = self.expand { 247 properties.push(("expand", expand)); 248 } 249 #[cfg(any(feature = "v3_20", feature = "dox"))] 250 if let Some(ref focus_on_click) = self.focus_on_click { 251 properties.push(("focus-on-click", focus_on_click)); 252 } 253 if let Some(ref halign) = self.halign { 254 properties.push(("halign", halign)); 255 } 256 if let Some(ref has_default) = self.has_default { 257 properties.push(("has-default", has_default)); 258 } 259 if let Some(ref has_focus) = self.has_focus { 260 properties.push(("has-focus", has_focus)); 261 } 262 if let Some(ref has_tooltip) = self.has_tooltip { 263 properties.push(("has-tooltip", has_tooltip)); 264 } 265 if let Some(ref height_request) = self.height_request { 266 properties.push(("height-request", height_request)); 267 } 268 if let Some(ref hexpand) = self.hexpand { 269 properties.push(("hexpand", hexpand)); 270 } 271 if let Some(ref hexpand_set) = self.hexpand_set { 272 properties.push(("hexpand-set", hexpand_set)); 273 } 274 if let Some(ref is_focus) = self.is_focus { 275 properties.push(("is-focus", is_focus)); 276 } 277 if let Some(ref margin) = self.margin { 278 properties.push(("margin", margin)); 279 } 280 if let Some(ref margin_bottom) = self.margin_bottom { 281 properties.push(("margin-bottom", margin_bottom)); 282 } 283 if let Some(ref margin_end) = self.margin_end { 284 properties.push(("margin-end", margin_end)); 285 } 286 if let Some(ref margin_start) = self.margin_start { 287 properties.push(("margin-start", margin_start)); 288 } 289 if let Some(ref margin_top) = self.margin_top { 290 properties.push(("margin-top", margin_top)); 291 } 292 if let Some(ref name) = self.name { 293 properties.push(("name", name)); 294 } 295 if let Some(ref no_show_all) = self.no_show_all { 296 properties.push(("no-show-all", no_show_all)); 297 } 298 if let Some(ref opacity) = self.opacity { 299 properties.push(("opacity", opacity)); 300 } 301 if let Some(ref parent) = self.parent { 302 properties.push(("parent", parent)); 303 } 304 if let Some(ref receives_default) = self.receives_default { 305 properties.push(("receives-default", receives_default)); 306 } 307 if let Some(ref sensitive) = self.sensitive { 308 properties.push(("sensitive", sensitive)); 309 } 310 if let Some(ref tooltip_markup) = self.tooltip_markup { 311 properties.push(("tooltip-markup", tooltip_markup)); 312 } 313 if let Some(ref tooltip_text) = self.tooltip_text { 314 properties.push(("tooltip-text", tooltip_text)); 315 } 316 if let Some(ref valign) = self.valign { 317 properties.push(("valign", valign)); 318 } 319 if let Some(ref vexpand) = self.vexpand { 320 properties.push(("vexpand", vexpand)); 321 } 322 if let Some(ref vexpand_set) = self.vexpand_set { 323 properties.push(("vexpand-set", vexpand_set)); 324 } 325 if let Some(ref visible) = self.visible { 326 properties.push(("visible", visible)); 327 } 328 if let Some(ref width_request) = self.width_request { 329 properties.push(("width-request", width_request)); 330 } 331 if let Some(ref editing_canceled) = self.editing_canceled { 332 properties.push(("editing-canceled", editing_canceled)); 333 } 334 glib::Object::new::<ComboBox>(&properties) 335 .expect("Failed to create an instance of ComboBox") 336 } 337 active(mut self, active: i32) -> Self338 pub fn active(mut self, active: i32) -> Self { 339 self.active = Some(active); 340 self 341 } 342 active_id(mut self, active_id: &str) -> Self343 pub fn active_id(mut self, active_id: &str) -> Self { 344 self.active_id = Some(active_id.to_string()); 345 self 346 } 347 button_sensitivity(mut self, button_sensitivity: SensitivityType) -> Self348 pub fn button_sensitivity(mut self, button_sensitivity: SensitivityType) -> Self { 349 self.button_sensitivity = Some(button_sensitivity); 350 self 351 } 352 cell_area<P: IsA<CellArea>>(mut self, cell_area: &P) -> Self353 pub fn cell_area<P: IsA<CellArea>>(mut self, cell_area: &P) -> Self { 354 self.cell_area = Some(cell_area.clone().upcast()); 355 self 356 } 357 column_span_column(mut self, column_span_column: i32) -> Self358 pub fn column_span_column(mut self, column_span_column: i32) -> Self { 359 self.column_span_column = Some(column_span_column); 360 self 361 } 362 entry_text_column(mut self, entry_text_column: i32) -> Self363 pub fn entry_text_column(mut self, entry_text_column: i32) -> Self { 364 self.entry_text_column = Some(entry_text_column); 365 self 366 } 367 has_entry(mut self, has_entry: bool) -> Self368 pub fn has_entry(mut self, has_entry: bool) -> Self { 369 self.has_entry = Some(has_entry); 370 self 371 } 372 has_frame(mut self, has_frame: bool) -> Self373 pub fn has_frame(mut self, has_frame: bool) -> Self { 374 self.has_frame = Some(has_frame); 375 self 376 } 377 id_column(mut self, id_column: i32) -> Self378 pub fn id_column(mut self, id_column: i32) -> Self { 379 self.id_column = Some(id_column); 380 self 381 } 382 model<P: IsA<TreeModel>>(mut self, model: &P) -> Self383 pub fn model<P: IsA<TreeModel>>(mut self, model: &P) -> Self { 384 self.model = Some(model.clone().upcast()); 385 self 386 } 387 popup_fixed_width(mut self, popup_fixed_width: bool) -> Self388 pub fn popup_fixed_width(mut self, popup_fixed_width: bool) -> Self { 389 self.popup_fixed_width = Some(popup_fixed_width); 390 self 391 } 392 row_span_column(mut self, row_span_column: i32) -> Self393 pub fn row_span_column(mut self, row_span_column: i32) -> Self { 394 self.row_span_column = Some(row_span_column); 395 self 396 } 397 wrap_width(mut self, wrap_width: i32) -> Self398 pub fn wrap_width(mut self, wrap_width: i32) -> Self { 399 self.wrap_width = Some(wrap_width); 400 self 401 } 402 border_width(mut self, border_width: u32) -> Self403 pub fn border_width(mut self, border_width: u32) -> Self { 404 self.border_width = Some(border_width); 405 self 406 } 407 child<P: IsA<Widget>>(mut self, child: &P) -> Self408 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 409 self.child = Some(child.clone().upcast()); 410 self 411 } 412 resize_mode(mut self, resize_mode: ResizeMode) -> Self413 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 414 self.resize_mode = Some(resize_mode); 415 self 416 } 417 app_paintable(mut self, app_paintable: bool) -> Self418 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 419 self.app_paintable = Some(app_paintable); 420 self 421 } 422 can_default(mut self, can_default: bool) -> Self423 pub fn can_default(mut self, can_default: bool) -> Self { 424 self.can_default = Some(can_default); 425 self 426 } 427 can_focus(mut self, can_focus: bool) -> Self428 pub fn can_focus(mut self, can_focus: bool) -> Self { 429 self.can_focus = Some(can_focus); 430 self 431 } 432 events(mut self, events: gdk::EventMask) -> Self433 pub fn events(mut self, events: gdk::EventMask) -> Self { 434 self.events = Some(events); 435 self 436 } 437 expand(mut self, expand: bool) -> Self438 pub fn expand(mut self, expand: bool) -> Self { 439 self.expand = Some(expand); 440 self 441 } 442 443 #[cfg(any(feature = "v3_20", feature = "dox"))] 444 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self445 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 446 self.focus_on_click = Some(focus_on_click); 447 self 448 } 449 halign(mut self, halign: Align) -> Self450 pub fn halign(mut self, halign: Align) -> Self { 451 self.halign = Some(halign); 452 self 453 } 454 has_default(mut self, has_default: bool) -> Self455 pub fn has_default(mut self, has_default: bool) -> Self { 456 self.has_default = Some(has_default); 457 self 458 } 459 has_focus(mut self, has_focus: bool) -> Self460 pub fn has_focus(mut self, has_focus: bool) -> Self { 461 self.has_focus = Some(has_focus); 462 self 463 } 464 has_tooltip(mut self, has_tooltip: bool) -> Self465 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 466 self.has_tooltip = Some(has_tooltip); 467 self 468 } 469 height_request(mut self, height_request: i32) -> Self470 pub fn height_request(mut self, height_request: i32) -> Self { 471 self.height_request = Some(height_request); 472 self 473 } 474 hexpand(mut self, hexpand: bool) -> Self475 pub fn hexpand(mut self, hexpand: bool) -> Self { 476 self.hexpand = Some(hexpand); 477 self 478 } 479 hexpand_set(mut self, hexpand_set: bool) -> Self480 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 481 self.hexpand_set = Some(hexpand_set); 482 self 483 } 484 is_focus(mut self, is_focus: bool) -> Self485 pub fn is_focus(mut self, is_focus: bool) -> Self { 486 self.is_focus = Some(is_focus); 487 self 488 } 489 margin(mut self, margin: i32) -> Self490 pub fn margin(mut self, margin: i32) -> Self { 491 self.margin = Some(margin); 492 self 493 } 494 margin_bottom(mut self, margin_bottom: i32) -> Self495 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 496 self.margin_bottom = Some(margin_bottom); 497 self 498 } 499 margin_end(mut self, margin_end: i32) -> Self500 pub fn margin_end(mut self, margin_end: i32) -> Self { 501 self.margin_end = Some(margin_end); 502 self 503 } 504 margin_start(mut self, margin_start: i32) -> Self505 pub fn margin_start(mut self, margin_start: i32) -> Self { 506 self.margin_start = Some(margin_start); 507 self 508 } 509 margin_top(mut self, margin_top: i32) -> Self510 pub fn margin_top(mut self, margin_top: i32) -> Self { 511 self.margin_top = Some(margin_top); 512 self 513 } 514 name(mut self, name: &str) -> Self515 pub fn name(mut self, name: &str) -> Self { 516 self.name = Some(name.to_string()); 517 self 518 } 519 no_show_all(mut self, no_show_all: bool) -> Self520 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 521 self.no_show_all = Some(no_show_all); 522 self 523 } 524 opacity(mut self, opacity: f64) -> Self525 pub fn opacity(mut self, opacity: f64) -> Self { 526 self.opacity = Some(opacity); 527 self 528 } 529 parent<P: IsA<Container>>(mut self, parent: &P) -> Self530 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 531 self.parent = Some(parent.clone().upcast()); 532 self 533 } 534 receives_default(mut self, receives_default: bool) -> Self535 pub fn receives_default(mut self, receives_default: bool) -> Self { 536 self.receives_default = Some(receives_default); 537 self 538 } 539 sensitive(mut self, sensitive: bool) -> Self540 pub fn sensitive(mut self, sensitive: bool) -> Self { 541 self.sensitive = Some(sensitive); 542 self 543 } 544 tooltip_markup(mut self, tooltip_markup: &str) -> Self545 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 546 self.tooltip_markup = Some(tooltip_markup.to_string()); 547 self 548 } 549 tooltip_text(mut self, tooltip_text: &str) -> Self550 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 551 self.tooltip_text = Some(tooltip_text.to_string()); 552 self 553 } 554 valign(mut self, valign: Align) -> Self555 pub fn valign(mut self, valign: Align) -> Self { 556 self.valign = Some(valign); 557 self 558 } 559 vexpand(mut self, vexpand: bool) -> Self560 pub fn vexpand(mut self, vexpand: bool) -> Self { 561 self.vexpand = Some(vexpand); 562 self 563 } 564 vexpand_set(mut self, vexpand_set: bool) -> Self565 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 566 self.vexpand_set = Some(vexpand_set); 567 self 568 } 569 visible(mut self, visible: bool) -> Self570 pub fn visible(mut self, visible: bool) -> Self { 571 self.visible = Some(visible); 572 self 573 } 574 width_request(mut self, width_request: i32) -> Self575 pub fn width_request(mut self, width_request: i32) -> Self { 576 self.width_request = Some(width_request); 577 self 578 } 579 editing_canceled(mut self, editing_canceled: bool) -> Self580 pub fn editing_canceled(mut self, editing_canceled: bool) -> Self { 581 self.editing_canceled = Some(editing_canceled); 582 self 583 } 584 } 585 586 pub const NONE_COMBO_BOX: Option<&ComboBox> = None; 587 588 pub trait ComboBoxExt: 'static { 589 #[doc(alias = "gtk_combo_box_get_active_id")] 590 #[doc(alias = "get_active_id")] active_id(&self) -> Option<glib::GString>591 fn active_id(&self) -> Option<glib::GString>; 592 593 #[doc(alias = "gtk_combo_box_get_active_iter")] 594 #[doc(alias = "get_active_iter")] active_iter(&self) -> Option<TreeIter>595 fn active_iter(&self) -> Option<TreeIter>; 596 597 #[doc(alias = "gtk_combo_box_get_button_sensitivity")] 598 #[doc(alias = "get_button_sensitivity")] button_sensitivity(&self) -> SensitivityType599 fn button_sensitivity(&self) -> SensitivityType; 600 601 #[doc(alias = "gtk_combo_box_get_column_span_column")] 602 #[doc(alias = "get_column_span_column")] column_span_column(&self) -> i32603 fn column_span_column(&self) -> i32; 604 605 #[doc(alias = "gtk_combo_box_get_entry_text_column")] 606 #[doc(alias = "get_entry_text_column")] entry_text_column(&self) -> i32607 fn entry_text_column(&self) -> i32; 608 609 #[cfg_attr(feature = "v3_20", deprecated = "Since 3.20")] 610 #[cfg(any(not(feature = "v3_20"), feature = "dox"))] 611 #[cfg_attr(feature = "dox", doc(cfg(not(feature = "v3_20"))))] 612 #[doc(alias = "gtk_combo_box_get_focus_on_click")] 613 #[doc(alias = "get_focus_on_click")] gets_focus_on_click(&self) -> bool614 fn gets_focus_on_click(&self) -> bool; 615 616 #[doc(alias = "gtk_combo_box_get_has_entry")] 617 #[doc(alias = "get_has_entry")] has_entry(&self) -> bool618 fn has_entry(&self) -> bool; 619 620 #[doc(alias = "gtk_combo_box_get_id_column")] 621 #[doc(alias = "get_id_column")] id_column(&self) -> i32622 fn id_column(&self) -> i32; 623 624 #[doc(alias = "gtk_combo_box_get_model")] 625 #[doc(alias = "get_model")] model(&self) -> Option<TreeModel>626 fn model(&self) -> Option<TreeModel>; 627 628 #[doc(alias = "gtk_combo_box_get_popup_accessible")] 629 #[doc(alias = "get_popup_accessible")] popup_accessible(&self) -> Option<atk::Object>630 fn popup_accessible(&self) -> Option<atk::Object>; 631 632 #[doc(alias = "gtk_combo_box_get_popup_fixed_width")] 633 #[doc(alias = "get_popup_fixed_width")] is_popup_fixed_width(&self) -> bool634 fn is_popup_fixed_width(&self) -> bool; 635 636 //#[doc(alias = "gtk_combo_box_get_row_separator_func")] 637 //#[doc(alias = "get_row_separator_func")] 638 //fn row_separator_func(&self) -> Option<Box_<dyn Fn(&TreeModel, &TreeIter) -> bool + 'static>>; 639 640 #[doc(alias = "gtk_combo_box_get_row_span_column")] 641 #[doc(alias = "get_row_span_column")] row_span_column(&self) -> i32642 fn row_span_column(&self) -> i32; 643 644 #[doc(alias = "gtk_combo_box_get_wrap_width")] 645 #[doc(alias = "get_wrap_width")] wrap_width(&self) -> i32646 fn wrap_width(&self) -> i32; 647 648 #[doc(alias = "gtk_combo_box_popdown")] popdown(&self)649 fn popdown(&self); 650 651 #[doc(alias = "gtk_combo_box_popup")] popup(&self)652 fn popup(&self); 653 654 #[doc(alias = "gtk_combo_box_popup_for_device")] popup_for_device(&self, device: &gdk::Device)655 fn popup_for_device(&self, device: &gdk::Device); 656 657 #[doc(alias = "gtk_combo_box_set_active_id")] set_active_id(&self, active_id: Option<&str>) -> bool658 fn set_active_id(&self, active_id: Option<&str>) -> bool; 659 660 #[doc(alias = "gtk_combo_box_set_active_iter")] set_active_iter(&self, iter: Option<&TreeIter>)661 fn set_active_iter(&self, iter: Option<&TreeIter>); 662 663 #[doc(alias = "gtk_combo_box_set_button_sensitivity")] set_button_sensitivity(&self, sensitivity: SensitivityType)664 fn set_button_sensitivity(&self, sensitivity: SensitivityType); 665 666 #[doc(alias = "gtk_combo_box_set_column_span_column")] set_column_span_column(&self, column_span: i32)667 fn set_column_span_column(&self, column_span: i32); 668 669 #[doc(alias = "gtk_combo_box_set_entry_text_column")] set_entry_text_column(&self, text_column: i32)670 fn set_entry_text_column(&self, text_column: i32); 671 672 #[cfg_attr(feature = "v3_20", deprecated = "Since 3.20")] 673 #[cfg(any(not(feature = "v3_20"), feature = "dox"))] 674 #[cfg_attr(feature = "dox", doc(cfg(not(feature = "v3_20"))))] 675 #[doc(alias = "gtk_combo_box_set_focus_on_click")] set_focus_on_click(&self, focus_on_click: bool)676 fn set_focus_on_click(&self, focus_on_click: bool); 677 678 #[doc(alias = "gtk_combo_box_set_id_column")] set_id_column(&self, id_column: i32)679 fn set_id_column(&self, id_column: i32); 680 681 #[doc(alias = "gtk_combo_box_set_model")] set_model<P: IsA<TreeModel>>(&self, model: Option<&P>)682 fn set_model<P: IsA<TreeModel>>(&self, model: Option<&P>); 683 684 #[doc(alias = "gtk_combo_box_set_popup_fixed_width")] set_popup_fixed_width(&self, fixed: bool)685 fn set_popup_fixed_width(&self, fixed: bool); 686 687 #[doc(alias = "gtk_combo_box_set_row_separator_func")] set_row_separator_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(&self, func: P)688 fn set_row_separator_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(&self, func: P); 689 690 #[doc(alias = "gtk_combo_box_set_row_span_column")] set_row_span_column(&self, row_span: i32)691 fn set_row_span_column(&self, row_span: i32); 692 693 #[doc(alias = "gtk_combo_box_set_wrap_width")] set_wrap_width(&self, width: i32)694 fn set_wrap_width(&self, width: i32); 695 696 #[doc(alias = "cell-area")] cell_area(&self) -> Option<CellArea>697 fn cell_area(&self) -> Option<CellArea>; 698 699 #[doc(alias = "has-frame")] has_frame(&self) -> bool700 fn has_frame(&self) -> bool; 701 702 #[doc(alias = "has-frame")] set_has_frame(&self, has_frame: bool)703 fn set_has_frame(&self, has_frame: bool); 704 705 #[doc(alias = "popup-shown")] is_popup_shown(&self) -> bool706 fn is_popup_shown(&self) -> bool; 707 708 #[doc(alias = "changed")] connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId709 fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 710 711 #[doc(alias = "format-entry-text")] connect_format_entry_text<F: Fn(&Self, &str) -> String + 'static>( &self, f: F, ) -> SignalHandlerId712 fn connect_format_entry_text<F: Fn(&Self, &str) -> String + 'static>( 713 &self, 714 f: F, 715 ) -> SignalHandlerId; 716 717 #[doc(alias = "move-active")] connect_move_active<F: Fn(&Self, ScrollType) + 'static>(&self, f: F) -> SignalHandlerId718 fn connect_move_active<F: Fn(&Self, ScrollType) + 'static>(&self, f: F) -> SignalHandlerId; 719 emit_move_active(&self, scroll_type: ScrollType)720 fn emit_move_active(&self, scroll_type: ScrollType); 721 722 #[doc(alias = "popdown")] connect_popdown<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId723 fn connect_popdown<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId; 724 emit_popdown(&self) -> bool725 fn emit_popdown(&self) -> bool; 726 727 #[doc(alias = "popup")] connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId728 fn connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 729 emit_popup(&self)730 fn emit_popup(&self); 731 732 #[doc(alias = "active")] connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId733 fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 734 735 #[doc(alias = "active-id")] connect_active_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId736 fn connect_active_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 737 738 #[doc(alias = "button-sensitivity")] connect_button_sensitivity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId739 fn connect_button_sensitivity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 740 741 #[doc(alias = "column-span-column")] connect_column_span_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId742 fn connect_column_span_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 743 744 #[doc(alias = "entry-text-column")] connect_entry_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId745 fn connect_entry_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 746 747 #[doc(alias = "has-frame")] connect_has_frame_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId748 fn connect_has_frame_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 749 750 #[doc(alias = "id-column")] connect_id_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId751 fn connect_id_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 752 753 #[doc(alias = "model")] connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId754 fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 755 756 #[doc(alias = "popup-fixed-width")] connect_popup_fixed_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId757 fn connect_popup_fixed_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 758 759 #[doc(alias = "popup-shown")] connect_popup_shown_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId760 fn connect_popup_shown_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 761 762 #[doc(alias = "row-span-column")] connect_row_span_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId763 fn connect_row_span_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 764 765 #[doc(alias = "wrap-width")] connect_wrap_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId766 fn connect_wrap_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 767 } 768 769 impl<O: IsA<ComboBox>> ComboBoxExt for O { active_id(&self) -> Option<glib::GString>770 fn active_id(&self) -> Option<glib::GString> { 771 unsafe { 772 from_glib_none(ffi::gtk_combo_box_get_active_id( 773 self.as_ref().to_glib_none().0, 774 )) 775 } 776 } 777 active_iter(&self) -> Option<TreeIter>778 fn active_iter(&self) -> Option<TreeIter> { 779 unsafe { 780 let mut iter = TreeIter::uninitialized(); 781 let ret = from_glib(ffi::gtk_combo_box_get_active_iter( 782 self.as_ref().to_glib_none().0, 783 iter.to_glib_none_mut().0, 784 )); 785 if ret { 786 Some(iter) 787 } else { 788 None 789 } 790 } 791 } 792 button_sensitivity(&self) -> SensitivityType793 fn button_sensitivity(&self) -> SensitivityType { 794 unsafe { 795 from_glib(ffi::gtk_combo_box_get_button_sensitivity( 796 self.as_ref().to_glib_none().0, 797 )) 798 } 799 } 800 column_span_column(&self) -> i32801 fn column_span_column(&self) -> i32 { 802 unsafe { ffi::gtk_combo_box_get_column_span_column(self.as_ref().to_glib_none().0) } 803 } 804 entry_text_column(&self) -> i32805 fn entry_text_column(&self) -> i32 { 806 unsafe { ffi::gtk_combo_box_get_entry_text_column(self.as_ref().to_glib_none().0) } 807 } 808 809 #[cfg(any(not(feature = "v3_20"), feature = "dox"))] 810 #[cfg_attr(feature = "dox", doc(cfg(not(feature = "v3_20"))))] gets_focus_on_click(&self) -> bool811 fn gets_focus_on_click(&self) -> bool { 812 unsafe { 813 from_glib(ffi::gtk_combo_box_get_focus_on_click( 814 self.as_ref().to_glib_none().0, 815 )) 816 } 817 } 818 has_entry(&self) -> bool819 fn has_entry(&self) -> bool { 820 unsafe { 821 from_glib(ffi::gtk_combo_box_get_has_entry( 822 self.as_ref().to_glib_none().0, 823 )) 824 } 825 } 826 id_column(&self) -> i32827 fn id_column(&self) -> i32 { 828 unsafe { ffi::gtk_combo_box_get_id_column(self.as_ref().to_glib_none().0) } 829 } 830 model(&self) -> Option<TreeModel>831 fn model(&self) -> Option<TreeModel> { 832 unsafe { from_glib_none(ffi::gtk_combo_box_get_model(self.as_ref().to_glib_none().0)) } 833 } 834 popup_accessible(&self) -> Option<atk::Object>835 fn popup_accessible(&self) -> Option<atk::Object> { 836 unsafe { 837 from_glib_none(ffi::gtk_combo_box_get_popup_accessible( 838 self.as_ref().to_glib_none().0, 839 )) 840 } 841 } 842 is_popup_fixed_width(&self) -> bool843 fn is_popup_fixed_width(&self) -> bool { 844 unsafe { 845 from_glib(ffi::gtk_combo_box_get_popup_fixed_width( 846 self.as_ref().to_glib_none().0, 847 )) 848 } 849 } 850 851 //fn row_separator_func(&self) -> Option<Box_<dyn Fn(&TreeModel, &TreeIter) -> bool + 'static>> { 852 // unsafe { TODO: call ffi:gtk_combo_box_get_row_separator_func() } 853 //} 854 row_span_column(&self) -> i32855 fn row_span_column(&self) -> i32 { 856 unsafe { ffi::gtk_combo_box_get_row_span_column(self.as_ref().to_glib_none().0) } 857 } 858 wrap_width(&self) -> i32859 fn wrap_width(&self) -> i32 { 860 unsafe { ffi::gtk_combo_box_get_wrap_width(self.as_ref().to_glib_none().0) } 861 } 862 popdown(&self)863 fn popdown(&self) { 864 unsafe { 865 ffi::gtk_combo_box_popdown(self.as_ref().to_glib_none().0); 866 } 867 } 868 popup(&self)869 fn popup(&self) { 870 unsafe { 871 ffi::gtk_combo_box_popup(self.as_ref().to_glib_none().0); 872 } 873 } 874 popup_for_device(&self, device: &gdk::Device)875 fn popup_for_device(&self, device: &gdk::Device) { 876 unsafe { 877 ffi::gtk_combo_box_popup_for_device( 878 self.as_ref().to_glib_none().0, 879 device.to_glib_none().0, 880 ); 881 } 882 } 883 set_active_id(&self, active_id: Option<&str>) -> bool884 fn set_active_id(&self, active_id: Option<&str>) -> bool { 885 unsafe { 886 from_glib(ffi::gtk_combo_box_set_active_id( 887 self.as_ref().to_glib_none().0, 888 active_id.to_glib_none().0, 889 )) 890 } 891 } 892 set_active_iter(&self, iter: Option<&TreeIter>)893 fn set_active_iter(&self, iter: Option<&TreeIter>) { 894 unsafe { 895 ffi::gtk_combo_box_set_active_iter( 896 self.as_ref().to_glib_none().0, 897 mut_override(iter.to_glib_none().0), 898 ); 899 } 900 } 901 set_button_sensitivity(&self, sensitivity: SensitivityType)902 fn set_button_sensitivity(&self, sensitivity: SensitivityType) { 903 unsafe { 904 ffi::gtk_combo_box_set_button_sensitivity( 905 self.as_ref().to_glib_none().0, 906 sensitivity.into_glib(), 907 ); 908 } 909 } 910 set_column_span_column(&self, column_span: i32)911 fn set_column_span_column(&self, column_span: i32) { 912 unsafe { 913 ffi::gtk_combo_box_set_column_span_column(self.as_ref().to_glib_none().0, column_span); 914 } 915 } 916 set_entry_text_column(&self, text_column: i32)917 fn set_entry_text_column(&self, text_column: i32) { 918 unsafe { 919 ffi::gtk_combo_box_set_entry_text_column(self.as_ref().to_glib_none().0, text_column); 920 } 921 } 922 923 #[cfg(any(not(feature = "v3_20"), feature = "dox"))] 924 #[cfg_attr(feature = "dox", doc(cfg(not(feature = "v3_20"))))] set_focus_on_click(&self, focus_on_click: bool)925 fn set_focus_on_click(&self, focus_on_click: bool) { 926 unsafe { 927 ffi::gtk_combo_box_set_focus_on_click( 928 self.as_ref().to_glib_none().0, 929 focus_on_click.into_glib(), 930 ); 931 } 932 } 933 set_id_column(&self, id_column: i32)934 fn set_id_column(&self, id_column: i32) { 935 unsafe { 936 ffi::gtk_combo_box_set_id_column(self.as_ref().to_glib_none().0, id_column); 937 } 938 } 939 set_model<P: IsA<TreeModel>>(&self, model: Option<&P>)940 fn set_model<P: IsA<TreeModel>>(&self, model: Option<&P>) { 941 unsafe { 942 ffi::gtk_combo_box_set_model( 943 self.as_ref().to_glib_none().0, 944 model.map(|p| p.as_ref()).to_glib_none().0, 945 ); 946 } 947 } 948 set_popup_fixed_width(&self, fixed: bool)949 fn set_popup_fixed_width(&self, fixed: bool) { 950 unsafe { 951 ffi::gtk_combo_box_set_popup_fixed_width( 952 self.as_ref().to_glib_none().0, 953 fixed.into_glib(), 954 ); 955 } 956 } 957 set_row_separator_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(&self, func: P)958 fn set_row_separator_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(&self, func: P) { 959 let func_data: Box_<P> = Box_::new(func); 960 unsafe extern "C" fn func_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>( 961 model: *mut ffi::GtkTreeModel, 962 iter: *mut ffi::GtkTreeIter, 963 data: glib::ffi::gpointer, 964 ) -> glib::ffi::gboolean { 965 let model = from_glib_borrow(model); 966 let iter = from_glib_borrow(iter); 967 let callback: &P = &*(data as *mut _); 968 let res = (*callback)(&model, &iter); 969 res.into_glib() 970 } 971 let func = Some(func_func::<P> as _); 972 unsafe extern "C" fn destroy_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>( 973 data: glib::ffi::gpointer, 974 ) { 975 let _callback: Box_<P> = Box_::from_raw(data as *mut _); 976 } 977 let destroy_call3 = Some(destroy_func::<P> as _); 978 let super_callback0: Box_<P> = func_data; 979 unsafe { 980 ffi::gtk_combo_box_set_row_separator_func( 981 self.as_ref().to_glib_none().0, 982 func, 983 Box_::into_raw(super_callback0) as *mut _, 984 destroy_call3, 985 ); 986 } 987 } 988 set_row_span_column(&self, row_span: i32)989 fn set_row_span_column(&self, row_span: i32) { 990 unsafe { 991 ffi::gtk_combo_box_set_row_span_column(self.as_ref().to_glib_none().0, row_span); 992 } 993 } 994 set_wrap_width(&self, width: i32)995 fn set_wrap_width(&self, width: i32) { 996 unsafe { 997 ffi::gtk_combo_box_set_wrap_width(self.as_ref().to_glib_none().0, width); 998 } 999 } 1000 cell_area(&self) -> Option<CellArea>1001 fn cell_area(&self) -> Option<CellArea> { 1002 unsafe { 1003 let mut value = glib::Value::from_type(<CellArea as StaticType>::static_type()); 1004 glib::gobject_ffi::g_object_get_property( 1005 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 1006 b"cell-area\0".as_ptr() as *const _, 1007 value.to_glib_none_mut().0, 1008 ); 1009 value 1010 .get() 1011 .expect("Return Value for property `cell-area` getter") 1012 } 1013 } 1014 has_frame(&self) -> bool1015 fn has_frame(&self) -> bool { 1016 unsafe { 1017 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 1018 glib::gobject_ffi::g_object_get_property( 1019 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 1020 b"has-frame\0".as_ptr() as *const _, 1021 value.to_glib_none_mut().0, 1022 ); 1023 value 1024 .get() 1025 .expect("Return Value for property `has-frame` getter") 1026 } 1027 } 1028 set_has_frame(&self, has_frame: bool)1029 fn set_has_frame(&self, has_frame: bool) { 1030 unsafe { 1031 glib::gobject_ffi::g_object_set_property( 1032 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 1033 b"has-frame\0".as_ptr() as *const _, 1034 has_frame.to_value().to_glib_none().0, 1035 ); 1036 } 1037 } 1038 is_popup_shown(&self) -> bool1039 fn is_popup_shown(&self) -> bool { 1040 unsafe { 1041 let mut value = glib::Value::from_type(<bool as StaticType>::static_type()); 1042 glib::gobject_ffi::g_object_get_property( 1043 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject, 1044 b"popup-shown\0".as_ptr() as *const _, 1045 value.to_glib_none_mut().0, 1046 ); 1047 value 1048 .get() 1049 .expect("Return Value for property `popup-shown` getter") 1050 } 1051 } 1052 connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1053 fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1054 unsafe extern "C" fn changed_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>( 1055 this: *mut ffi::GtkComboBox, 1056 f: glib::ffi::gpointer, 1057 ) { 1058 let f: &F = &*(f as *const F); 1059 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1060 } 1061 unsafe { 1062 let f: Box_<F> = Box_::new(f); 1063 connect_raw( 1064 self.as_ptr() as *mut _, 1065 b"changed\0".as_ptr() as *const _, 1066 Some(transmute::<_, unsafe extern "C" fn()>( 1067 changed_trampoline::<Self, F> as *const (), 1068 )), 1069 Box_::into_raw(f), 1070 ) 1071 } 1072 } 1073 connect_format_entry_text<F: Fn(&Self, &str) -> String + 'static>( &self, f: F, ) -> SignalHandlerId1074 fn connect_format_entry_text<F: Fn(&Self, &str) -> String + 'static>( 1075 &self, 1076 f: F, 1077 ) -> SignalHandlerId { 1078 unsafe extern "C" fn format_entry_text_trampoline< 1079 P: IsA<ComboBox>, 1080 F: Fn(&P, &str) -> String + 'static, 1081 >( 1082 this: *mut ffi::GtkComboBox, 1083 path: *mut libc::c_char, 1084 f: glib::ffi::gpointer, 1085 ) -> *mut libc::c_char { 1086 let f: &F = &*(f as *const F); 1087 f( 1088 ComboBox::from_glib_borrow(this).unsafe_cast_ref(), 1089 &glib::GString::from_glib_borrow(path), 1090 ) 1091 .to_glib_full() 1092 } 1093 unsafe { 1094 let f: Box_<F> = Box_::new(f); 1095 connect_raw( 1096 self.as_ptr() as *mut _, 1097 b"format-entry-text\0".as_ptr() as *const _, 1098 Some(transmute::<_, unsafe extern "C" fn()>( 1099 format_entry_text_trampoline::<Self, F> as *const (), 1100 )), 1101 Box_::into_raw(f), 1102 ) 1103 } 1104 } 1105 connect_move_active<F: Fn(&Self, ScrollType) + 'static>(&self, f: F) -> SignalHandlerId1106 fn connect_move_active<F: Fn(&Self, ScrollType) + 'static>(&self, f: F) -> SignalHandlerId { 1107 unsafe extern "C" fn move_active_trampoline< 1108 P: IsA<ComboBox>, 1109 F: Fn(&P, ScrollType) + 'static, 1110 >( 1111 this: *mut ffi::GtkComboBox, 1112 scroll_type: ffi::GtkScrollType, 1113 f: glib::ffi::gpointer, 1114 ) { 1115 let f: &F = &*(f as *const F); 1116 f( 1117 ComboBox::from_glib_borrow(this).unsafe_cast_ref(), 1118 from_glib(scroll_type), 1119 ) 1120 } 1121 unsafe { 1122 let f: Box_<F> = Box_::new(f); 1123 connect_raw( 1124 self.as_ptr() as *mut _, 1125 b"move-active\0".as_ptr() as *const _, 1126 Some(transmute::<_, unsafe extern "C" fn()>( 1127 move_active_trampoline::<Self, F> as *const (), 1128 )), 1129 Box_::into_raw(f), 1130 ) 1131 } 1132 } 1133 emit_move_active(&self, scroll_type: ScrollType)1134 fn emit_move_active(&self, scroll_type: ScrollType) { 1135 let _ = unsafe { 1136 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 1137 .emit_by_name("move-active", &[&scroll_type]) 1138 .unwrap() 1139 }; 1140 } 1141 connect_popdown<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId1142 fn connect_popdown<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId { 1143 unsafe extern "C" fn popdown_trampoline<P: IsA<ComboBox>, F: Fn(&P) -> bool + 'static>( 1144 this: *mut ffi::GtkComboBox, 1145 f: glib::ffi::gpointer, 1146 ) -> glib::ffi::gboolean { 1147 let f: &F = &*(f as *const F); 1148 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()).into_glib() 1149 } 1150 unsafe { 1151 let f: Box_<F> = Box_::new(f); 1152 connect_raw( 1153 self.as_ptr() as *mut _, 1154 b"popdown\0".as_ptr() as *const _, 1155 Some(transmute::<_, unsafe extern "C" fn()>( 1156 popdown_trampoline::<Self, F> as *const (), 1157 )), 1158 Box_::into_raw(f), 1159 ) 1160 } 1161 } 1162 emit_popdown(&self) -> bool1163 fn emit_popdown(&self) -> bool { 1164 let res = unsafe { 1165 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 1166 .emit_by_name("popdown", &[]) 1167 .unwrap() 1168 }; 1169 res.unwrap().get().expect("Return Value for `emit_popdown`") 1170 } 1171 connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1172 fn connect_popup<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1173 unsafe extern "C" fn popup_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>( 1174 this: *mut ffi::GtkComboBox, 1175 f: glib::ffi::gpointer, 1176 ) { 1177 let f: &F = &*(f as *const F); 1178 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1179 } 1180 unsafe { 1181 let f: Box_<F> = Box_::new(f); 1182 connect_raw( 1183 self.as_ptr() as *mut _, 1184 b"popup\0".as_ptr() as *const _, 1185 Some(transmute::<_, unsafe extern "C" fn()>( 1186 popup_trampoline::<Self, F> as *const (), 1187 )), 1188 Box_::into_raw(f), 1189 ) 1190 } 1191 } 1192 emit_popup(&self)1193 fn emit_popup(&self) { 1194 let _ = unsafe { 1195 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 1196 .emit_by_name("popup", &[]) 1197 .unwrap() 1198 }; 1199 } 1200 connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1201 fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1202 unsafe extern "C" fn notify_active_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>( 1203 this: *mut ffi::GtkComboBox, 1204 _param_spec: glib::ffi::gpointer, 1205 f: glib::ffi::gpointer, 1206 ) { 1207 let f: &F = &*(f as *const F); 1208 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1209 } 1210 unsafe { 1211 let f: Box_<F> = Box_::new(f); 1212 connect_raw( 1213 self.as_ptr() as *mut _, 1214 b"notify::active\0".as_ptr() as *const _, 1215 Some(transmute::<_, unsafe extern "C" fn()>( 1216 notify_active_trampoline::<Self, F> as *const (), 1217 )), 1218 Box_::into_raw(f), 1219 ) 1220 } 1221 } 1222 connect_active_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1223 fn connect_active_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1224 unsafe extern "C" fn notify_active_id_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>( 1225 this: *mut ffi::GtkComboBox, 1226 _param_spec: glib::ffi::gpointer, 1227 f: glib::ffi::gpointer, 1228 ) { 1229 let f: &F = &*(f as *const F); 1230 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1231 } 1232 unsafe { 1233 let f: Box_<F> = Box_::new(f); 1234 connect_raw( 1235 self.as_ptr() as *mut _, 1236 b"notify::active-id\0".as_ptr() as *const _, 1237 Some(transmute::<_, unsafe extern "C" fn()>( 1238 notify_active_id_trampoline::<Self, F> as *const (), 1239 )), 1240 Box_::into_raw(f), 1241 ) 1242 } 1243 } 1244 connect_button_sensitivity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1245 fn connect_button_sensitivity_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1246 unsafe extern "C" fn notify_button_sensitivity_trampoline< 1247 P: IsA<ComboBox>, 1248 F: Fn(&P) + 'static, 1249 >( 1250 this: *mut ffi::GtkComboBox, 1251 _param_spec: glib::ffi::gpointer, 1252 f: glib::ffi::gpointer, 1253 ) { 1254 let f: &F = &*(f as *const F); 1255 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1256 } 1257 unsafe { 1258 let f: Box_<F> = Box_::new(f); 1259 connect_raw( 1260 self.as_ptr() as *mut _, 1261 b"notify::button-sensitivity\0".as_ptr() as *const _, 1262 Some(transmute::<_, unsafe extern "C" fn()>( 1263 notify_button_sensitivity_trampoline::<Self, F> as *const (), 1264 )), 1265 Box_::into_raw(f), 1266 ) 1267 } 1268 } 1269 connect_column_span_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1270 fn connect_column_span_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1271 unsafe extern "C" fn notify_column_span_column_trampoline< 1272 P: IsA<ComboBox>, 1273 F: Fn(&P) + 'static, 1274 >( 1275 this: *mut ffi::GtkComboBox, 1276 _param_spec: glib::ffi::gpointer, 1277 f: glib::ffi::gpointer, 1278 ) { 1279 let f: &F = &*(f as *const F); 1280 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1281 } 1282 unsafe { 1283 let f: Box_<F> = Box_::new(f); 1284 connect_raw( 1285 self.as_ptr() as *mut _, 1286 b"notify::column-span-column\0".as_ptr() as *const _, 1287 Some(transmute::<_, unsafe extern "C" fn()>( 1288 notify_column_span_column_trampoline::<Self, F> as *const (), 1289 )), 1290 Box_::into_raw(f), 1291 ) 1292 } 1293 } 1294 connect_entry_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1295 fn connect_entry_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1296 unsafe extern "C" fn notify_entry_text_column_trampoline< 1297 P: IsA<ComboBox>, 1298 F: Fn(&P) + 'static, 1299 >( 1300 this: *mut ffi::GtkComboBox, 1301 _param_spec: glib::ffi::gpointer, 1302 f: glib::ffi::gpointer, 1303 ) { 1304 let f: &F = &*(f as *const F); 1305 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1306 } 1307 unsafe { 1308 let f: Box_<F> = Box_::new(f); 1309 connect_raw( 1310 self.as_ptr() as *mut _, 1311 b"notify::entry-text-column\0".as_ptr() as *const _, 1312 Some(transmute::<_, unsafe extern "C" fn()>( 1313 notify_entry_text_column_trampoline::<Self, F> as *const (), 1314 )), 1315 Box_::into_raw(f), 1316 ) 1317 } 1318 } 1319 connect_has_frame_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1320 fn connect_has_frame_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1321 unsafe extern "C" fn notify_has_frame_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>( 1322 this: *mut ffi::GtkComboBox, 1323 _param_spec: glib::ffi::gpointer, 1324 f: glib::ffi::gpointer, 1325 ) { 1326 let f: &F = &*(f as *const F); 1327 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1328 } 1329 unsafe { 1330 let f: Box_<F> = Box_::new(f); 1331 connect_raw( 1332 self.as_ptr() as *mut _, 1333 b"notify::has-frame\0".as_ptr() as *const _, 1334 Some(transmute::<_, unsafe extern "C" fn()>( 1335 notify_has_frame_trampoline::<Self, F> as *const (), 1336 )), 1337 Box_::into_raw(f), 1338 ) 1339 } 1340 } 1341 connect_id_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1342 fn connect_id_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1343 unsafe extern "C" fn notify_id_column_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>( 1344 this: *mut ffi::GtkComboBox, 1345 _param_spec: glib::ffi::gpointer, 1346 f: glib::ffi::gpointer, 1347 ) { 1348 let f: &F = &*(f as *const F); 1349 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1350 } 1351 unsafe { 1352 let f: Box_<F> = Box_::new(f); 1353 connect_raw( 1354 self.as_ptr() as *mut _, 1355 b"notify::id-column\0".as_ptr() as *const _, 1356 Some(transmute::<_, unsafe extern "C" fn()>( 1357 notify_id_column_trampoline::<Self, F> as *const (), 1358 )), 1359 Box_::into_raw(f), 1360 ) 1361 } 1362 } 1363 connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1364 fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1365 unsafe extern "C" fn notify_model_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>( 1366 this: *mut ffi::GtkComboBox, 1367 _param_spec: glib::ffi::gpointer, 1368 f: glib::ffi::gpointer, 1369 ) { 1370 let f: &F = &*(f as *const F); 1371 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1372 } 1373 unsafe { 1374 let f: Box_<F> = Box_::new(f); 1375 connect_raw( 1376 self.as_ptr() as *mut _, 1377 b"notify::model\0".as_ptr() as *const _, 1378 Some(transmute::<_, unsafe extern "C" fn()>( 1379 notify_model_trampoline::<Self, F> as *const (), 1380 )), 1381 Box_::into_raw(f), 1382 ) 1383 } 1384 } 1385 connect_popup_fixed_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1386 fn connect_popup_fixed_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1387 unsafe extern "C" fn notify_popup_fixed_width_trampoline< 1388 P: IsA<ComboBox>, 1389 F: Fn(&P) + 'static, 1390 >( 1391 this: *mut ffi::GtkComboBox, 1392 _param_spec: glib::ffi::gpointer, 1393 f: glib::ffi::gpointer, 1394 ) { 1395 let f: &F = &*(f as *const F); 1396 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1397 } 1398 unsafe { 1399 let f: Box_<F> = Box_::new(f); 1400 connect_raw( 1401 self.as_ptr() as *mut _, 1402 b"notify::popup-fixed-width\0".as_ptr() as *const _, 1403 Some(transmute::<_, unsafe extern "C" fn()>( 1404 notify_popup_fixed_width_trampoline::<Self, F> as *const (), 1405 )), 1406 Box_::into_raw(f), 1407 ) 1408 } 1409 } 1410 connect_popup_shown_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1411 fn connect_popup_shown_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1412 unsafe extern "C" fn notify_popup_shown_trampoline< 1413 P: IsA<ComboBox>, 1414 F: Fn(&P) + 'static, 1415 >( 1416 this: *mut ffi::GtkComboBox, 1417 _param_spec: glib::ffi::gpointer, 1418 f: glib::ffi::gpointer, 1419 ) { 1420 let f: &F = &*(f as *const F); 1421 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1422 } 1423 unsafe { 1424 let f: Box_<F> = Box_::new(f); 1425 connect_raw( 1426 self.as_ptr() as *mut _, 1427 b"notify::popup-shown\0".as_ptr() as *const _, 1428 Some(transmute::<_, unsafe extern "C" fn()>( 1429 notify_popup_shown_trampoline::<Self, F> as *const (), 1430 )), 1431 Box_::into_raw(f), 1432 ) 1433 } 1434 } 1435 connect_row_span_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1436 fn connect_row_span_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1437 unsafe extern "C" fn notify_row_span_column_trampoline< 1438 P: IsA<ComboBox>, 1439 F: Fn(&P) + 'static, 1440 >( 1441 this: *mut ffi::GtkComboBox, 1442 _param_spec: glib::ffi::gpointer, 1443 f: glib::ffi::gpointer, 1444 ) { 1445 let f: &F = &*(f as *const F); 1446 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1447 } 1448 unsafe { 1449 let f: Box_<F> = Box_::new(f); 1450 connect_raw( 1451 self.as_ptr() as *mut _, 1452 b"notify::row-span-column\0".as_ptr() as *const _, 1453 Some(transmute::<_, unsafe extern "C" fn()>( 1454 notify_row_span_column_trampoline::<Self, F> as *const (), 1455 )), 1456 Box_::into_raw(f), 1457 ) 1458 } 1459 } 1460 connect_wrap_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId1461 fn connect_wrap_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 1462 unsafe extern "C" fn notify_wrap_width_trampoline<P: IsA<ComboBox>, F: Fn(&P) + 'static>( 1463 this: *mut ffi::GtkComboBox, 1464 _param_spec: glib::ffi::gpointer, 1465 f: glib::ffi::gpointer, 1466 ) { 1467 let f: &F = &*(f as *const F); 1468 f(ComboBox::from_glib_borrow(this).unsafe_cast_ref()) 1469 } 1470 unsafe { 1471 let f: Box_<F> = Box_::new(f); 1472 connect_raw( 1473 self.as_ptr() as *mut _, 1474 b"notify::wrap-width\0".as_ptr() as *const _, 1475 Some(transmute::<_, unsafe extern "C" fn()>( 1476 notify_wrap_width_trampoline::<Self, F> as *const (), 1477 )), 1478 Box_::into_raw(f), 1479 ) 1480 } 1481 } 1482 } 1483 1484 impl fmt::Display for ComboBox { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result1485 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 1486 f.write_str("ComboBox") 1487 } 1488 } 1489