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::Buildable; 7 use crate::CellEditable; 8 use crate::Container; 9 use crate::Editable; 10 use crate::Entry; 11 use crate::EntryBuffer; 12 use crate::EntryCompletion; 13 use crate::InputHints; 14 use crate::InputPurpose; 15 use crate::ShadowType; 16 use crate::Widget; 17 use glib::object::Cast; 18 use glib::object::IsA; 19 use glib::object::ObjectExt; 20 use glib::signal::connect_raw; 21 use glib::signal::SignalHandlerId; 22 use glib::translate::*; 23 use glib::StaticType; 24 use glib::ToValue; 25 use std::boxed::Box as Box_; 26 use std::fmt; 27 use std::mem::transmute; 28 29 glib::wrapper! { 30 #[doc(alias = "GtkSearchEntry")] 31 pub struct SearchEntry(Object<ffi::GtkSearchEntry, ffi::GtkSearchEntryClass>) @extends Entry, Widget, @implements Buildable, CellEditable, Editable; 32 33 match fn { 34 type_ => || ffi::gtk_search_entry_get_type(), 35 } 36 } 37 38 impl SearchEntry { 39 #[doc(alias = "gtk_search_entry_new")] new() -> SearchEntry40 pub fn new() -> SearchEntry { 41 assert_initialized_main_thread!(); 42 unsafe { Widget::from_glib_none(ffi::gtk_search_entry_new()).unsafe_cast() } 43 } 44 45 // rustdoc-stripper-ignore-next 46 /// Creates a new builder-pattern struct instance to construct [`SearchEntry`] objects. 47 /// 48 /// This method returns an instance of [`SearchEntryBuilder`] which can be used to create [`SearchEntry`] objects. builder() -> SearchEntryBuilder49 pub fn builder() -> SearchEntryBuilder { 50 SearchEntryBuilder::default() 51 } 52 } 53 54 impl Default for SearchEntry { default() -> Self55 fn default() -> Self { 56 Self::new() 57 } 58 } 59 60 #[derive(Clone, Default)] 61 // rustdoc-stripper-ignore-next 62 /// A [builder-pattern] type to construct [`SearchEntry`] objects. 63 /// 64 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 65 pub struct SearchEntryBuilder { 66 activates_default: Option<bool>, 67 attributes: Option<pango::AttrList>, 68 buffer: Option<EntryBuffer>, 69 caps_lock_warning: Option<bool>, 70 completion: Option<EntryCompletion>, 71 editable: Option<bool>, 72 enable_emoji_completion: Option<bool>, 73 has_frame: Option<bool>, 74 im_module: Option<String>, 75 input_hints: Option<InputHints>, 76 input_purpose: Option<InputPurpose>, 77 invisible_char: Option<u32>, 78 invisible_char_set: Option<bool>, 79 max_length: Option<i32>, 80 max_width_chars: Option<i32>, 81 overwrite_mode: Option<bool>, 82 placeholder_text: Option<String>, 83 populate_all: Option<bool>, 84 primary_icon_activatable: Option<bool>, 85 primary_icon_gicon: Option<gio::Icon>, 86 primary_icon_name: Option<String>, 87 primary_icon_pixbuf: Option<gdk_pixbuf::Pixbuf>, 88 primary_icon_sensitive: Option<bool>, 89 primary_icon_tooltip_markup: Option<String>, 90 primary_icon_tooltip_text: Option<String>, 91 progress_fraction: Option<f64>, 92 progress_pulse_step: Option<f64>, 93 secondary_icon_activatable: Option<bool>, 94 secondary_icon_gicon: Option<gio::Icon>, 95 secondary_icon_name: Option<String>, 96 secondary_icon_pixbuf: Option<gdk_pixbuf::Pixbuf>, 97 secondary_icon_sensitive: Option<bool>, 98 secondary_icon_tooltip_markup: Option<String>, 99 secondary_icon_tooltip_text: Option<String>, 100 #[cfg_attr(feature = "v3_20", deprecated = "Since 3.20")] 101 shadow_type: Option<ShadowType>, 102 show_emoji_icon: Option<bool>, 103 tabs: Option<pango::TabArray>, 104 text: Option<String>, 105 truncate_multiline: Option<bool>, 106 visibility: Option<bool>, 107 width_chars: Option<i32>, 108 xalign: Option<f32>, 109 app_paintable: Option<bool>, 110 can_default: Option<bool>, 111 can_focus: Option<bool>, 112 events: Option<gdk::EventMask>, 113 expand: Option<bool>, 114 #[cfg(any(feature = "v3_20", feature = "dox"))] 115 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 116 focus_on_click: Option<bool>, 117 halign: Option<Align>, 118 has_default: Option<bool>, 119 has_focus: Option<bool>, 120 has_tooltip: Option<bool>, 121 height_request: Option<i32>, 122 hexpand: Option<bool>, 123 hexpand_set: Option<bool>, 124 is_focus: Option<bool>, 125 margin: Option<i32>, 126 margin_bottom: Option<i32>, 127 margin_end: Option<i32>, 128 margin_start: Option<i32>, 129 margin_top: Option<i32>, 130 name: Option<String>, 131 no_show_all: Option<bool>, 132 opacity: Option<f64>, 133 parent: Option<Container>, 134 receives_default: Option<bool>, 135 sensitive: Option<bool>, 136 tooltip_markup: Option<String>, 137 tooltip_text: Option<String>, 138 valign: Option<Align>, 139 vexpand: Option<bool>, 140 vexpand_set: Option<bool>, 141 visible: Option<bool>, 142 width_request: Option<i32>, 143 editing_canceled: Option<bool>, 144 } 145 146 impl SearchEntryBuilder { 147 // rustdoc-stripper-ignore-next 148 /// Create a new [`SearchEntryBuilder`]. new() -> Self149 pub fn new() -> Self { 150 Self::default() 151 } 152 153 // rustdoc-stripper-ignore-next 154 /// Build the [`SearchEntry`]. build(self) -> SearchEntry155 pub fn build(self) -> SearchEntry { 156 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 157 if let Some(ref activates_default) = self.activates_default { 158 properties.push(("activates-default", activates_default)); 159 } 160 if let Some(ref attributes) = self.attributes { 161 properties.push(("attributes", attributes)); 162 } 163 if let Some(ref buffer) = self.buffer { 164 properties.push(("buffer", buffer)); 165 } 166 if let Some(ref caps_lock_warning) = self.caps_lock_warning { 167 properties.push(("caps-lock-warning", caps_lock_warning)); 168 } 169 if let Some(ref completion) = self.completion { 170 properties.push(("completion", completion)); 171 } 172 if let Some(ref editable) = self.editable { 173 properties.push(("editable", editable)); 174 } 175 if let Some(ref enable_emoji_completion) = self.enable_emoji_completion { 176 properties.push(("enable-emoji-completion", enable_emoji_completion)); 177 } 178 if let Some(ref has_frame) = self.has_frame { 179 properties.push(("has-frame", has_frame)); 180 } 181 if let Some(ref im_module) = self.im_module { 182 properties.push(("im-module", im_module)); 183 } 184 if let Some(ref input_hints) = self.input_hints { 185 properties.push(("input-hints", input_hints)); 186 } 187 if let Some(ref input_purpose) = self.input_purpose { 188 properties.push(("input-purpose", input_purpose)); 189 } 190 if let Some(ref invisible_char) = self.invisible_char { 191 properties.push(("invisible-char", invisible_char)); 192 } 193 if let Some(ref invisible_char_set) = self.invisible_char_set { 194 properties.push(("invisible-char-set", invisible_char_set)); 195 } 196 if let Some(ref max_length) = self.max_length { 197 properties.push(("max-length", max_length)); 198 } 199 if let Some(ref max_width_chars) = self.max_width_chars { 200 properties.push(("max-width-chars", max_width_chars)); 201 } 202 if let Some(ref overwrite_mode) = self.overwrite_mode { 203 properties.push(("overwrite-mode", overwrite_mode)); 204 } 205 if let Some(ref placeholder_text) = self.placeholder_text { 206 properties.push(("placeholder-text", placeholder_text)); 207 } 208 if let Some(ref populate_all) = self.populate_all { 209 properties.push(("populate-all", populate_all)); 210 } 211 if let Some(ref primary_icon_activatable) = self.primary_icon_activatable { 212 properties.push(("primary-icon-activatable", primary_icon_activatable)); 213 } 214 if let Some(ref primary_icon_gicon) = self.primary_icon_gicon { 215 properties.push(("primary-icon-gicon", primary_icon_gicon)); 216 } 217 if let Some(ref primary_icon_name) = self.primary_icon_name { 218 properties.push(("primary-icon-name", primary_icon_name)); 219 } 220 if let Some(ref primary_icon_pixbuf) = self.primary_icon_pixbuf { 221 properties.push(("primary-icon-pixbuf", primary_icon_pixbuf)); 222 } 223 if let Some(ref primary_icon_sensitive) = self.primary_icon_sensitive { 224 properties.push(("primary-icon-sensitive", primary_icon_sensitive)); 225 } 226 if let Some(ref primary_icon_tooltip_markup) = self.primary_icon_tooltip_markup { 227 properties.push(("primary-icon-tooltip-markup", primary_icon_tooltip_markup)); 228 } 229 if let Some(ref primary_icon_tooltip_text) = self.primary_icon_tooltip_text { 230 properties.push(("primary-icon-tooltip-text", primary_icon_tooltip_text)); 231 } 232 if let Some(ref progress_fraction) = self.progress_fraction { 233 properties.push(("progress-fraction", progress_fraction)); 234 } 235 if let Some(ref progress_pulse_step) = self.progress_pulse_step { 236 properties.push(("progress-pulse-step", progress_pulse_step)); 237 } 238 if let Some(ref secondary_icon_activatable) = self.secondary_icon_activatable { 239 properties.push(("secondary-icon-activatable", secondary_icon_activatable)); 240 } 241 if let Some(ref secondary_icon_gicon) = self.secondary_icon_gicon { 242 properties.push(("secondary-icon-gicon", secondary_icon_gicon)); 243 } 244 if let Some(ref secondary_icon_name) = self.secondary_icon_name { 245 properties.push(("secondary-icon-name", secondary_icon_name)); 246 } 247 if let Some(ref secondary_icon_pixbuf) = self.secondary_icon_pixbuf { 248 properties.push(("secondary-icon-pixbuf", secondary_icon_pixbuf)); 249 } 250 if let Some(ref secondary_icon_sensitive) = self.secondary_icon_sensitive { 251 properties.push(("secondary-icon-sensitive", secondary_icon_sensitive)); 252 } 253 if let Some(ref secondary_icon_tooltip_markup) = self.secondary_icon_tooltip_markup { 254 properties.push(( 255 "secondary-icon-tooltip-markup", 256 secondary_icon_tooltip_markup, 257 )); 258 } 259 if let Some(ref secondary_icon_tooltip_text) = self.secondary_icon_tooltip_text { 260 properties.push(("secondary-icon-tooltip-text", secondary_icon_tooltip_text)); 261 } 262 if let Some(ref shadow_type) = self.shadow_type { 263 properties.push(("shadow-type", shadow_type)); 264 } 265 if let Some(ref show_emoji_icon) = self.show_emoji_icon { 266 properties.push(("show-emoji-icon", show_emoji_icon)); 267 } 268 if let Some(ref tabs) = self.tabs { 269 properties.push(("tabs", tabs)); 270 } 271 if let Some(ref text) = self.text { 272 properties.push(("text", text)); 273 } 274 if let Some(ref truncate_multiline) = self.truncate_multiline { 275 properties.push(("truncate-multiline", truncate_multiline)); 276 } 277 if let Some(ref visibility) = self.visibility { 278 properties.push(("visibility", visibility)); 279 } 280 if let Some(ref width_chars) = self.width_chars { 281 properties.push(("width-chars", width_chars)); 282 } 283 if let Some(ref xalign) = self.xalign { 284 properties.push(("xalign", xalign)); 285 } 286 if let Some(ref app_paintable) = self.app_paintable { 287 properties.push(("app-paintable", app_paintable)); 288 } 289 if let Some(ref can_default) = self.can_default { 290 properties.push(("can-default", can_default)); 291 } 292 if let Some(ref can_focus) = self.can_focus { 293 properties.push(("can-focus", can_focus)); 294 } 295 if let Some(ref events) = self.events { 296 properties.push(("events", events)); 297 } 298 if let Some(ref expand) = self.expand { 299 properties.push(("expand", expand)); 300 } 301 #[cfg(any(feature = "v3_20", feature = "dox"))] 302 if let Some(ref focus_on_click) = self.focus_on_click { 303 properties.push(("focus-on-click", focus_on_click)); 304 } 305 if let Some(ref halign) = self.halign { 306 properties.push(("halign", halign)); 307 } 308 if let Some(ref has_default) = self.has_default { 309 properties.push(("has-default", has_default)); 310 } 311 if let Some(ref has_focus) = self.has_focus { 312 properties.push(("has-focus", has_focus)); 313 } 314 if let Some(ref has_tooltip) = self.has_tooltip { 315 properties.push(("has-tooltip", has_tooltip)); 316 } 317 if let Some(ref height_request) = self.height_request { 318 properties.push(("height-request", height_request)); 319 } 320 if let Some(ref hexpand) = self.hexpand { 321 properties.push(("hexpand", hexpand)); 322 } 323 if let Some(ref hexpand_set) = self.hexpand_set { 324 properties.push(("hexpand-set", hexpand_set)); 325 } 326 if let Some(ref is_focus) = self.is_focus { 327 properties.push(("is-focus", is_focus)); 328 } 329 if let Some(ref margin) = self.margin { 330 properties.push(("margin", margin)); 331 } 332 if let Some(ref margin_bottom) = self.margin_bottom { 333 properties.push(("margin-bottom", margin_bottom)); 334 } 335 if let Some(ref margin_end) = self.margin_end { 336 properties.push(("margin-end", margin_end)); 337 } 338 if let Some(ref margin_start) = self.margin_start { 339 properties.push(("margin-start", margin_start)); 340 } 341 if let Some(ref margin_top) = self.margin_top { 342 properties.push(("margin-top", margin_top)); 343 } 344 if let Some(ref name) = self.name { 345 properties.push(("name", name)); 346 } 347 if let Some(ref no_show_all) = self.no_show_all { 348 properties.push(("no-show-all", no_show_all)); 349 } 350 if let Some(ref opacity) = self.opacity { 351 properties.push(("opacity", opacity)); 352 } 353 if let Some(ref parent) = self.parent { 354 properties.push(("parent", parent)); 355 } 356 if let Some(ref receives_default) = self.receives_default { 357 properties.push(("receives-default", receives_default)); 358 } 359 if let Some(ref sensitive) = self.sensitive { 360 properties.push(("sensitive", sensitive)); 361 } 362 if let Some(ref tooltip_markup) = self.tooltip_markup { 363 properties.push(("tooltip-markup", tooltip_markup)); 364 } 365 if let Some(ref tooltip_text) = self.tooltip_text { 366 properties.push(("tooltip-text", tooltip_text)); 367 } 368 if let Some(ref valign) = self.valign { 369 properties.push(("valign", valign)); 370 } 371 if let Some(ref vexpand) = self.vexpand { 372 properties.push(("vexpand", vexpand)); 373 } 374 if let Some(ref vexpand_set) = self.vexpand_set { 375 properties.push(("vexpand-set", vexpand_set)); 376 } 377 if let Some(ref visible) = self.visible { 378 properties.push(("visible", visible)); 379 } 380 if let Some(ref width_request) = self.width_request { 381 properties.push(("width-request", width_request)); 382 } 383 if let Some(ref editing_canceled) = self.editing_canceled { 384 properties.push(("editing-canceled", editing_canceled)); 385 } 386 glib::Object::new::<SearchEntry>(&properties) 387 .expect("Failed to create an instance of SearchEntry") 388 } 389 activates_default(mut self, activates_default: bool) -> Self390 pub fn activates_default(mut self, activates_default: bool) -> Self { 391 self.activates_default = Some(activates_default); 392 self 393 } 394 attributes(mut self, attributes: &pango::AttrList) -> Self395 pub fn attributes(mut self, attributes: &pango::AttrList) -> Self { 396 self.attributes = Some(attributes.clone()); 397 self 398 } 399 buffer<P: IsA<EntryBuffer>>(mut self, buffer: &P) -> Self400 pub fn buffer<P: IsA<EntryBuffer>>(mut self, buffer: &P) -> Self { 401 self.buffer = Some(buffer.clone().upcast()); 402 self 403 } 404 caps_lock_warning(mut self, caps_lock_warning: bool) -> Self405 pub fn caps_lock_warning(mut self, caps_lock_warning: bool) -> Self { 406 self.caps_lock_warning = Some(caps_lock_warning); 407 self 408 } 409 completion<P: IsA<EntryCompletion>>(mut self, completion: &P) -> Self410 pub fn completion<P: IsA<EntryCompletion>>(mut self, completion: &P) -> Self { 411 self.completion = Some(completion.clone().upcast()); 412 self 413 } 414 editable(mut self, editable: bool) -> Self415 pub fn editable(mut self, editable: bool) -> Self { 416 self.editable = Some(editable); 417 self 418 } 419 enable_emoji_completion(mut self, enable_emoji_completion: bool) -> Self420 pub fn enable_emoji_completion(mut self, enable_emoji_completion: bool) -> Self { 421 self.enable_emoji_completion = Some(enable_emoji_completion); 422 self 423 } 424 has_frame(mut self, has_frame: bool) -> Self425 pub fn has_frame(mut self, has_frame: bool) -> Self { 426 self.has_frame = Some(has_frame); 427 self 428 } 429 im_module(mut self, im_module: &str) -> Self430 pub fn im_module(mut self, im_module: &str) -> Self { 431 self.im_module = Some(im_module.to_string()); 432 self 433 } 434 input_hints(mut self, input_hints: InputHints) -> Self435 pub fn input_hints(mut self, input_hints: InputHints) -> Self { 436 self.input_hints = Some(input_hints); 437 self 438 } 439 input_purpose(mut self, input_purpose: InputPurpose) -> Self440 pub fn input_purpose(mut self, input_purpose: InputPurpose) -> Self { 441 self.input_purpose = Some(input_purpose); 442 self 443 } 444 invisible_char(mut self, invisible_char: u32) -> Self445 pub fn invisible_char(mut self, invisible_char: u32) -> Self { 446 self.invisible_char = Some(invisible_char); 447 self 448 } 449 invisible_char_set(mut self, invisible_char_set: bool) -> Self450 pub fn invisible_char_set(mut self, invisible_char_set: bool) -> Self { 451 self.invisible_char_set = Some(invisible_char_set); 452 self 453 } 454 max_length(mut self, max_length: i32) -> Self455 pub fn max_length(mut self, max_length: i32) -> Self { 456 self.max_length = Some(max_length); 457 self 458 } 459 max_width_chars(mut self, max_width_chars: i32) -> Self460 pub fn max_width_chars(mut self, max_width_chars: i32) -> Self { 461 self.max_width_chars = Some(max_width_chars); 462 self 463 } 464 overwrite_mode(mut self, overwrite_mode: bool) -> Self465 pub fn overwrite_mode(mut self, overwrite_mode: bool) -> Self { 466 self.overwrite_mode = Some(overwrite_mode); 467 self 468 } 469 placeholder_text(mut self, placeholder_text: &str) -> Self470 pub fn placeholder_text(mut self, placeholder_text: &str) -> Self { 471 self.placeholder_text = Some(placeholder_text.to_string()); 472 self 473 } 474 populate_all(mut self, populate_all: bool) -> Self475 pub fn populate_all(mut self, populate_all: bool) -> Self { 476 self.populate_all = Some(populate_all); 477 self 478 } 479 primary_icon_activatable(mut self, primary_icon_activatable: bool) -> Self480 pub fn primary_icon_activatable(mut self, primary_icon_activatable: bool) -> Self { 481 self.primary_icon_activatable = Some(primary_icon_activatable); 482 self 483 } 484 primary_icon_gicon<P: IsA<gio::Icon>>(mut self, primary_icon_gicon: &P) -> Self485 pub fn primary_icon_gicon<P: IsA<gio::Icon>>(mut self, primary_icon_gicon: &P) -> Self { 486 self.primary_icon_gicon = Some(primary_icon_gicon.clone().upcast()); 487 self 488 } 489 primary_icon_name(mut self, primary_icon_name: &str) -> Self490 pub fn primary_icon_name(mut self, primary_icon_name: &str) -> Self { 491 self.primary_icon_name = Some(primary_icon_name.to_string()); 492 self 493 } 494 primary_icon_pixbuf(mut self, primary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self495 pub fn primary_icon_pixbuf(mut self, primary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self { 496 self.primary_icon_pixbuf = Some(primary_icon_pixbuf.clone()); 497 self 498 } 499 primary_icon_sensitive(mut self, primary_icon_sensitive: bool) -> Self500 pub fn primary_icon_sensitive(mut self, primary_icon_sensitive: bool) -> Self { 501 self.primary_icon_sensitive = Some(primary_icon_sensitive); 502 self 503 } 504 primary_icon_tooltip_markup(mut self, primary_icon_tooltip_markup: &str) -> Self505 pub fn primary_icon_tooltip_markup(mut self, primary_icon_tooltip_markup: &str) -> Self { 506 self.primary_icon_tooltip_markup = Some(primary_icon_tooltip_markup.to_string()); 507 self 508 } 509 primary_icon_tooltip_text(mut self, primary_icon_tooltip_text: &str) -> Self510 pub fn primary_icon_tooltip_text(mut self, primary_icon_tooltip_text: &str) -> Self { 511 self.primary_icon_tooltip_text = Some(primary_icon_tooltip_text.to_string()); 512 self 513 } 514 progress_fraction(mut self, progress_fraction: f64) -> Self515 pub fn progress_fraction(mut self, progress_fraction: f64) -> Self { 516 self.progress_fraction = Some(progress_fraction); 517 self 518 } 519 progress_pulse_step(mut self, progress_pulse_step: f64) -> Self520 pub fn progress_pulse_step(mut self, progress_pulse_step: f64) -> Self { 521 self.progress_pulse_step = Some(progress_pulse_step); 522 self 523 } 524 secondary_icon_activatable(mut self, secondary_icon_activatable: bool) -> Self525 pub fn secondary_icon_activatable(mut self, secondary_icon_activatable: bool) -> Self { 526 self.secondary_icon_activatable = Some(secondary_icon_activatable); 527 self 528 } 529 secondary_icon_gicon<P: IsA<gio::Icon>>(mut self, secondary_icon_gicon: &P) -> Self530 pub fn secondary_icon_gicon<P: IsA<gio::Icon>>(mut self, secondary_icon_gicon: &P) -> Self { 531 self.secondary_icon_gicon = Some(secondary_icon_gicon.clone().upcast()); 532 self 533 } 534 secondary_icon_name(mut self, secondary_icon_name: &str) -> Self535 pub fn secondary_icon_name(mut self, secondary_icon_name: &str) -> Self { 536 self.secondary_icon_name = Some(secondary_icon_name.to_string()); 537 self 538 } 539 secondary_icon_pixbuf(mut self, secondary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self540 pub fn secondary_icon_pixbuf(mut self, secondary_icon_pixbuf: &gdk_pixbuf::Pixbuf) -> Self { 541 self.secondary_icon_pixbuf = Some(secondary_icon_pixbuf.clone()); 542 self 543 } 544 secondary_icon_sensitive(mut self, secondary_icon_sensitive: bool) -> Self545 pub fn secondary_icon_sensitive(mut self, secondary_icon_sensitive: bool) -> Self { 546 self.secondary_icon_sensitive = Some(secondary_icon_sensitive); 547 self 548 } 549 secondary_icon_tooltip_markup(mut self, secondary_icon_tooltip_markup: &str) -> Self550 pub fn secondary_icon_tooltip_markup(mut self, secondary_icon_tooltip_markup: &str) -> Self { 551 self.secondary_icon_tooltip_markup = Some(secondary_icon_tooltip_markup.to_string()); 552 self 553 } 554 secondary_icon_tooltip_text(mut self, secondary_icon_tooltip_text: &str) -> Self555 pub fn secondary_icon_tooltip_text(mut self, secondary_icon_tooltip_text: &str) -> Self { 556 self.secondary_icon_tooltip_text = Some(secondary_icon_tooltip_text.to_string()); 557 self 558 } 559 560 #[cfg_attr(feature = "v3_20", deprecated = "Since 3.20")] shadow_type(mut self, shadow_type: ShadowType) -> Self561 pub fn shadow_type(mut self, shadow_type: ShadowType) -> Self { 562 self.shadow_type = Some(shadow_type); 563 self 564 } 565 show_emoji_icon(mut self, show_emoji_icon: bool) -> Self566 pub fn show_emoji_icon(mut self, show_emoji_icon: bool) -> Self { 567 self.show_emoji_icon = Some(show_emoji_icon); 568 self 569 } 570 tabs(mut self, tabs: &pango::TabArray) -> Self571 pub fn tabs(mut self, tabs: &pango::TabArray) -> Self { 572 self.tabs = Some(tabs.clone()); 573 self 574 } 575 text(mut self, text: &str) -> Self576 pub fn text(mut self, text: &str) -> Self { 577 self.text = Some(text.to_string()); 578 self 579 } 580 truncate_multiline(mut self, truncate_multiline: bool) -> Self581 pub fn truncate_multiline(mut self, truncate_multiline: bool) -> Self { 582 self.truncate_multiline = Some(truncate_multiline); 583 self 584 } 585 visibility(mut self, visibility: bool) -> Self586 pub fn visibility(mut self, visibility: bool) -> Self { 587 self.visibility = Some(visibility); 588 self 589 } 590 width_chars(mut self, width_chars: i32) -> Self591 pub fn width_chars(mut self, width_chars: i32) -> Self { 592 self.width_chars = Some(width_chars); 593 self 594 } 595 xalign(mut self, xalign: f32) -> Self596 pub fn xalign(mut self, xalign: f32) -> Self { 597 self.xalign = Some(xalign); 598 self 599 } 600 app_paintable(mut self, app_paintable: bool) -> Self601 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 602 self.app_paintable = Some(app_paintable); 603 self 604 } 605 can_default(mut self, can_default: bool) -> Self606 pub fn can_default(mut self, can_default: bool) -> Self { 607 self.can_default = Some(can_default); 608 self 609 } 610 can_focus(mut self, can_focus: bool) -> Self611 pub fn can_focus(mut self, can_focus: bool) -> Self { 612 self.can_focus = Some(can_focus); 613 self 614 } 615 events(mut self, events: gdk::EventMask) -> Self616 pub fn events(mut self, events: gdk::EventMask) -> Self { 617 self.events = Some(events); 618 self 619 } 620 expand(mut self, expand: bool) -> Self621 pub fn expand(mut self, expand: bool) -> Self { 622 self.expand = Some(expand); 623 self 624 } 625 626 #[cfg(any(feature = "v3_20", feature = "dox"))] 627 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self628 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 629 self.focus_on_click = Some(focus_on_click); 630 self 631 } 632 halign(mut self, halign: Align) -> Self633 pub fn halign(mut self, halign: Align) -> Self { 634 self.halign = Some(halign); 635 self 636 } 637 has_default(mut self, has_default: bool) -> Self638 pub fn has_default(mut self, has_default: bool) -> Self { 639 self.has_default = Some(has_default); 640 self 641 } 642 has_focus(mut self, has_focus: bool) -> Self643 pub fn has_focus(mut self, has_focus: bool) -> Self { 644 self.has_focus = Some(has_focus); 645 self 646 } 647 has_tooltip(mut self, has_tooltip: bool) -> Self648 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 649 self.has_tooltip = Some(has_tooltip); 650 self 651 } 652 height_request(mut self, height_request: i32) -> Self653 pub fn height_request(mut self, height_request: i32) -> Self { 654 self.height_request = Some(height_request); 655 self 656 } 657 hexpand(mut self, hexpand: bool) -> Self658 pub fn hexpand(mut self, hexpand: bool) -> Self { 659 self.hexpand = Some(hexpand); 660 self 661 } 662 hexpand_set(mut self, hexpand_set: bool) -> Self663 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 664 self.hexpand_set = Some(hexpand_set); 665 self 666 } 667 is_focus(mut self, is_focus: bool) -> Self668 pub fn is_focus(mut self, is_focus: bool) -> Self { 669 self.is_focus = Some(is_focus); 670 self 671 } 672 margin(mut self, margin: i32) -> Self673 pub fn margin(mut self, margin: i32) -> Self { 674 self.margin = Some(margin); 675 self 676 } 677 margin_bottom(mut self, margin_bottom: i32) -> Self678 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 679 self.margin_bottom = Some(margin_bottom); 680 self 681 } 682 margin_end(mut self, margin_end: i32) -> Self683 pub fn margin_end(mut self, margin_end: i32) -> Self { 684 self.margin_end = Some(margin_end); 685 self 686 } 687 margin_start(mut self, margin_start: i32) -> Self688 pub fn margin_start(mut self, margin_start: i32) -> Self { 689 self.margin_start = Some(margin_start); 690 self 691 } 692 margin_top(mut self, margin_top: i32) -> Self693 pub fn margin_top(mut self, margin_top: i32) -> Self { 694 self.margin_top = Some(margin_top); 695 self 696 } 697 name(mut self, name: &str) -> Self698 pub fn name(mut self, name: &str) -> Self { 699 self.name = Some(name.to_string()); 700 self 701 } 702 no_show_all(mut self, no_show_all: bool) -> Self703 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 704 self.no_show_all = Some(no_show_all); 705 self 706 } 707 opacity(mut self, opacity: f64) -> Self708 pub fn opacity(mut self, opacity: f64) -> Self { 709 self.opacity = Some(opacity); 710 self 711 } 712 parent<P: IsA<Container>>(mut self, parent: &P) -> Self713 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 714 self.parent = Some(parent.clone().upcast()); 715 self 716 } 717 receives_default(mut self, receives_default: bool) -> Self718 pub fn receives_default(mut self, receives_default: bool) -> Self { 719 self.receives_default = Some(receives_default); 720 self 721 } 722 sensitive(mut self, sensitive: bool) -> Self723 pub fn sensitive(mut self, sensitive: bool) -> Self { 724 self.sensitive = Some(sensitive); 725 self 726 } 727 tooltip_markup(mut self, tooltip_markup: &str) -> Self728 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 729 self.tooltip_markup = Some(tooltip_markup.to_string()); 730 self 731 } 732 tooltip_text(mut self, tooltip_text: &str) -> Self733 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 734 self.tooltip_text = Some(tooltip_text.to_string()); 735 self 736 } 737 valign(mut self, valign: Align) -> Self738 pub fn valign(mut self, valign: Align) -> Self { 739 self.valign = Some(valign); 740 self 741 } 742 vexpand(mut self, vexpand: bool) -> Self743 pub fn vexpand(mut self, vexpand: bool) -> Self { 744 self.vexpand = Some(vexpand); 745 self 746 } 747 vexpand_set(mut self, vexpand_set: bool) -> Self748 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 749 self.vexpand_set = Some(vexpand_set); 750 self 751 } 752 visible(mut self, visible: bool) -> Self753 pub fn visible(mut self, visible: bool) -> Self { 754 self.visible = Some(visible); 755 self 756 } 757 width_request(mut self, width_request: i32) -> Self758 pub fn width_request(mut self, width_request: i32) -> Self { 759 self.width_request = Some(width_request); 760 self 761 } 762 editing_canceled(mut self, editing_canceled: bool) -> Self763 pub fn editing_canceled(mut self, editing_canceled: bool) -> Self { 764 self.editing_canceled = Some(editing_canceled); 765 self 766 } 767 } 768 769 pub const NONE_SEARCH_ENTRY: Option<&SearchEntry> = None; 770 771 pub trait SearchEntryExt: 'static { 772 #[doc(alias = "gtk_search_entry_handle_event")] handle_event(&self, event: &gdk::Event) -> bool773 fn handle_event(&self, event: &gdk::Event) -> bool; 774 775 #[doc(alias = "next-match")] connect_next_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId776 fn connect_next_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 777 emit_next_match(&self)778 fn emit_next_match(&self); 779 780 #[doc(alias = "previous-match")] connect_previous_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId781 fn connect_previous_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 782 emit_previous_match(&self)783 fn emit_previous_match(&self); 784 785 #[doc(alias = "search-changed")] connect_search_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId786 fn connect_search_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 787 788 #[doc(alias = "stop-search")] connect_stop_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId789 fn connect_stop_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; 790 emit_stop_search(&self)791 fn emit_stop_search(&self); 792 } 793 794 impl<O: IsA<SearchEntry>> SearchEntryExt for O { handle_event(&self, event: &gdk::Event) -> bool795 fn handle_event(&self, event: &gdk::Event) -> bool { 796 unsafe { 797 from_glib(ffi::gtk_search_entry_handle_event( 798 self.as_ref().to_glib_none().0, 799 mut_override(event.to_glib_none().0), 800 )) 801 } 802 } 803 connect_next_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId804 fn connect_next_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 805 unsafe extern "C" fn next_match_trampoline<P: IsA<SearchEntry>, F: Fn(&P) + 'static>( 806 this: *mut ffi::GtkSearchEntry, 807 f: glib::ffi::gpointer, 808 ) { 809 let f: &F = &*(f as *const F); 810 f(SearchEntry::from_glib_borrow(this).unsafe_cast_ref()) 811 } 812 unsafe { 813 let f: Box_<F> = Box_::new(f); 814 connect_raw( 815 self.as_ptr() as *mut _, 816 b"next-match\0".as_ptr() as *const _, 817 Some(transmute::<_, unsafe extern "C" fn()>( 818 next_match_trampoline::<Self, F> as *const (), 819 )), 820 Box_::into_raw(f), 821 ) 822 } 823 } 824 emit_next_match(&self)825 fn emit_next_match(&self) { 826 let _ = unsafe { 827 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 828 .emit_by_name("next-match", &[]) 829 .unwrap() 830 }; 831 } 832 connect_previous_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId833 fn connect_previous_match<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 834 unsafe extern "C" fn previous_match_trampoline<P: IsA<SearchEntry>, F: Fn(&P) + 'static>( 835 this: *mut ffi::GtkSearchEntry, 836 f: glib::ffi::gpointer, 837 ) { 838 let f: &F = &*(f as *const F); 839 f(SearchEntry::from_glib_borrow(this).unsafe_cast_ref()) 840 } 841 unsafe { 842 let f: Box_<F> = Box_::new(f); 843 connect_raw( 844 self.as_ptr() as *mut _, 845 b"previous-match\0".as_ptr() as *const _, 846 Some(transmute::<_, unsafe extern "C" fn()>( 847 previous_match_trampoline::<Self, F> as *const (), 848 )), 849 Box_::into_raw(f), 850 ) 851 } 852 } 853 emit_previous_match(&self)854 fn emit_previous_match(&self) { 855 let _ = unsafe { 856 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 857 .emit_by_name("previous-match", &[]) 858 .unwrap() 859 }; 860 } 861 connect_search_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId862 fn connect_search_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 863 unsafe extern "C" fn search_changed_trampoline<P: IsA<SearchEntry>, F: Fn(&P) + 'static>( 864 this: *mut ffi::GtkSearchEntry, 865 f: glib::ffi::gpointer, 866 ) { 867 let f: &F = &*(f as *const F); 868 f(SearchEntry::from_glib_borrow(this).unsafe_cast_ref()) 869 } 870 unsafe { 871 let f: Box_<F> = Box_::new(f); 872 connect_raw( 873 self.as_ptr() as *mut _, 874 b"search-changed\0".as_ptr() as *const _, 875 Some(transmute::<_, unsafe extern "C" fn()>( 876 search_changed_trampoline::<Self, F> as *const (), 877 )), 878 Box_::into_raw(f), 879 ) 880 } 881 } 882 connect_stop_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId883 fn connect_stop_search<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { 884 unsafe extern "C" fn stop_search_trampoline<P: IsA<SearchEntry>, F: Fn(&P) + 'static>( 885 this: *mut ffi::GtkSearchEntry, 886 f: glib::ffi::gpointer, 887 ) { 888 let f: &F = &*(f as *const F); 889 f(SearchEntry::from_glib_borrow(this).unsafe_cast_ref()) 890 } 891 unsafe { 892 let f: Box_<F> = Box_::new(f); 893 connect_raw( 894 self.as_ptr() as *mut _, 895 b"stop-search\0".as_ptr() as *const _, 896 Some(transmute::<_, unsafe extern "C" fn()>( 897 stop_search_trampoline::<Self, F> as *const (), 898 )), 899 Box_::into_raw(f), 900 ) 901 } 902 } 903 emit_stop_search(&self)904 fn emit_stop_search(&self) { 905 let _ = unsafe { 906 glib::Object::from_glib_borrow(self.as_ptr() as *mut glib::gobject_ffi::GObject) 907 .emit_by_name("stop-search", &[]) 908 .unwrap() 909 }; 910 } 911 } 912 913 impl fmt::Display for SearchEntry { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result914 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 915 f.write_str("SearchEntry") 916 } 917 } 918