gtk4/auto/cell_renderer_combo.rs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT
#![allow(deprecated)]
use crate::{ffi, CellRenderer, CellRendererMode, CellRendererText, TreeIter, TreeModel, TreePath};
use glib::{
prelude::*,
signal::{connect_raw, SignalHandlerId},
translate::*,
};
use std::boxed::Box as Box_;
glib::wrapper! {
/// List views use widgets to display their contents. You
/// should use [`DropDown`][crate::DropDown] instead
/// Renders a combobox in a cell
///
/// [`CellRendererCombo`][crate::CellRendererCombo] renders text in a cell like [`CellRendererText`][crate::CellRendererText] from
/// which it is derived. But while [`CellRendererText`][crate::CellRendererText] offers a simple entry to
/// edit the text, [`CellRendererCombo`][crate::CellRendererCombo] offers a [`ComboBox`][crate::ComboBox]
/// widget to edit the text. The values to display in the combo box are taken from
/// the tree model specified in the [`CellRendererCombo`][crate::CellRendererCombo]:model property.
///
/// The combo cell renderer takes care of adding a text cell renderer to the combo
/// box and sets it to display the column specified by its
/// [`CellRendererCombo`][crate::CellRendererCombo]:text-column property. Further properties of the combo box
/// can be set in a handler for the `GtkCellRenderer::editing-started` signal.
///
/// ## Properties
///
///
/// #### `has-entry`
/// If [`true`], the cell renderer will include an entry and allow to enter
/// values other than the ones in the popup list.
///
/// Readable | Writeable
///
///
/// #### `model`
/// Holds a tree model containing the possible values for the combo box.
/// Use the text_column property to specify the column holding the values.
///
/// Readable | Writeable
///
///
/// #### `text-column`
/// Specifies the model column which holds the possible values for the
/// combo box.
///
/// Note that this refers to the model specified in the model property,
/// not the model backing the tree view to which
/// this cell renderer is attached.
///
/// [`CellRendererCombo`][crate::CellRendererCombo] automatically adds a text cell renderer for
/// this column to its combo box.
///
/// Readable | Writeable
/// <details><summary><h4>CellRendererText</h4></summary>
///
///
/// #### `align-set`
/// Readable | Writeable
///
///
/// #### `alignment`
/// Specifies how to align the lines of text with respect to each other.
///
/// Note that this property describes how to align the lines of text in
/// case there are several of them. The "xalign" property of [`CellRenderer`][crate::CellRenderer],
/// on the other hand, sets the horizontal alignment of the whole text.
///
/// Readable | Writeable
///
///
/// #### `attributes`
/// Readable | Writeable
///
///
/// #### `background`
/// Writeable
///
///
/// #### `background-rgba`
/// Background color as a [`gdk::RGBA`][crate::gdk::RGBA]
///
/// Readable | Writeable
///
///
/// #### `background-set`
/// Readable | Writeable
///
///
/// #### `editable`
/// Readable | Writeable
///
///
/// #### `editable-set`
/// Readable | Writeable
///
///
/// #### `ellipsize`
/// Specifies the preferred place to ellipsize the string, if the cell renderer
/// does not have enough room to display the entire string. Setting it to
/// [`pango::EllipsizeMode::None`][crate::pango::EllipsizeMode::None] turns off ellipsizing. See the wrap-width property
/// for another way of making the text fit into a given width.
///
/// Readable | Writeable
///
///
/// #### `ellipsize-set`
/// Readable | Writeable
///
///
/// #### `family`
/// Readable | Writeable
///
///
/// #### `family-set`
/// Readable | Writeable
///
///
/// #### `font`
/// Readable | Writeable
///
///
/// #### `font-desc`
/// Readable | Writeable
///
///
/// #### `foreground`
/// Writeable
///
///
/// #### `foreground-rgba`
/// Foreground color as a [`gdk::RGBA`][crate::gdk::RGBA]
///
/// Readable | Writeable
///
///
/// #### `foreground-set`
/// Readable | Writeable
///
///
/// #### `language`
/// Readable | Writeable
///
///
/// #### `language-set`
/// Readable | Writeable
///
///
/// #### `markup`
/// Writeable
///
///
/// #### `max-width-chars`
/// The desired maximum width of the cell, in characters. If this property
/// is set to -1, the width will be calculated automatically.
///
/// For cell renderers that ellipsize or wrap text; this property
/// controls the maximum reported width of the cell. The
/// cell should not receive any greater allocation unless it is
/// set to expand in its [`CellLayout`][crate::CellLayout] and all of the cell's siblings
/// have received their natural width.
///
/// Readable | Writeable
///
///
/// #### `placeholder-text`
/// The text that will be displayed in the [`CellRenderer`][crate::CellRenderer] if
/// `GtkCellRendererText:editable` is [`true`] and the cell is empty.
///
/// Readable | Writeable
///
///
/// #### `rise`
/// Readable | Writeable
///
///
/// #### `rise-set`
/// Readable | Writeable
///
///
/// #### `scale`
/// Readable | Writeable
///
///
/// #### `scale-set`
/// Readable | Writeable
///
///
/// #### `single-paragraph-mode`
/// Readable | Writeable
///
///
/// #### `size`
/// Readable | Writeable
///
///
/// #### `size-points`
/// Readable | Writeable
///
///
/// #### `size-set`
/// Readable | Writeable
///
///
/// #### `stretch`
/// Readable | Writeable
///
///
/// #### `stretch-set`
/// Readable | Writeable
///
///
/// #### `strikethrough`
/// Readable | Writeable
///
///
/// #### `strikethrough-set`
/// Readable | Writeable
///
///
/// #### `style`
/// Readable | Writeable
///
///
/// #### `style-set`
/// Readable | Writeable
///
///
/// #### `text`
/// Readable | Writeable
///
///
/// #### `underline`
/// Readable | Writeable
///
///
/// #### `underline-set`
/// Readable | Writeable
///
///
/// #### `variant`
/// Readable | Writeable
///
///
/// #### `variant-set`
/// Readable | Writeable
///
///
/// #### `weight`
/// Readable | Writeable
///
///
/// #### `weight-set`
/// Readable | Writeable
///
///
/// #### `width-chars`
/// The desired width of the cell, in characters. If this property is set to
/// -1, the width will be calculated automatically, otherwise the cell will
/// request either 3 characters or the property value, whichever is greater.
///
/// Readable | Writeable
///
///
/// #### `wrap-mode`
/// Specifies how to break the string into multiple lines, if the cell
/// renderer does not have enough room to display the entire string.
/// This property has no effect unless the wrap-width property is set.
///
/// Readable | Writeable
///
///
/// #### `wrap-width`
/// Specifies the minimum width at which the text is wrapped. The wrap-mode property can
/// be used to influence at what character positions the line breaks can be placed.
/// Setting wrap-width to -1 turns wrapping off.
///
/// Readable | Writeable
/// </details>
/// <details><summary><h4>CellRenderer</h4></summary>
///
///
/// #### `cell-background`
/// Writeable
///
///
/// #### `cell-background-rgba`
/// Cell background as a [`gdk::RGBA`][crate::gdk::RGBA]
///
/// Readable | Writeable
///
///
/// #### `cell-background-set`
/// Readable | Writeable
///
///
/// #### `editing`
/// Readable
///
///
/// #### `height`
/// Readable | Writeable
///
///
/// #### `is-expanded`
/// Readable | Writeable
///
///
/// #### `is-expander`
/// Readable | Writeable
///
///
/// #### `mode`
/// Readable | Writeable
///
///
/// #### `sensitive`
/// Readable | Writeable
///
///
/// #### `visible`
/// Readable | Writeable
///
///
/// #### `width`
/// Readable | Writeable
///
///
/// #### `xalign`
/// Readable | Writeable
///
///
/// #### `xpad`
/// Readable | Writeable
///
///
/// #### `yalign`
/// Readable | Writeable
///
///
/// #### `ypad`
/// Readable | Writeable
/// </details>
///
/// ## Signals
///
///
/// #### `changed`
/// This signal is emitted each time after the user selected an item in
/// the combo box, either by using the mouse or the arrow keys. Contrary
/// to GtkComboBox, GtkCellRendererCombo::changed is not emitted for
/// changes made to a selected item in the entry. The argument @new_iter
/// corresponds to the newly selected item in the combo box and it is relative
/// to the GtkTreeModel set via the model property on GtkCellRendererCombo.
///
/// Note that as soon as you change the model displayed in the tree view,
/// the tree view will immediately cease the editing operating. This
/// means that you most probably want to refrain from changing the model
/// until the combo cell renderer emits the edited or editing_canceled signal.
///
///
/// <details><summary><h4>CellRendererText</h4></summary>
///
///
/// #### `edited`
/// This signal is emitted after @renderer has been edited.
///
/// It is the responsibility of the application to update the model
/// and store @new_text at the position indicated by @path.
///
///
/// </details>
/// <details><summary><h4>CellRenderer</h4></summary>
///
///
/// #### `editing-canceled`
/// This signal gets emitted when the user cancels the process of editing a
/// cell. For example, an editable cell renderer could be written to cancel
/// editing when the user presses Escape.
///
/// See also: gtk_cell_renderer_stop_editing().
///
///
///
///
/// #### `editing-started`
/// This signal gets emitted when a cell starts to be edited.
/// The intended use of this signal is to do special setup
/// on @editable, e.g. adding a [`EntryCompletion`][crate::EntryCompletion] or setting
/// up additional columns in a [`ComboBox`][crate::ComboBox].
///
/// See gtk_cell_editable_start_editing() for information on the lifecycle of
/// the @editable and a way to do setup that doesn’t depend on the @renderer.
///
/// Note that GTK doesn't guarantee that cell renderers will
/// continue to use the same kind of widget for editing in future
/// releases, therefore you should check the type of @editable
/// before doing any specific setup, as in the following example:
///
///
/// **⚠️ The following code is in C ⚠️**
///
/// ```C
/// static void
/// text_editing_started (GtkCellRenderer *cell,
/// GtkCellEditable *editable,
/// const char *path,
/// gpointer data)
/// {
/// if (GTK_IS_ENTRY (editable))
/// {
/// GtkEntry *entry = GTK_ENTRY (editable);
///
/// // ... create a GtkEntryCompletion
///
/// gtk_entry_set_completion (entry, completion);
/// }
/// }
/// ```
///
///
/// </details>
///
/// # Implements
///
/// [`CellRendererTextExt`][trait@crate::prelude::CellRendererTextExt], [`CellRendererExt`][trait@crate::prelude::CellRendererExt], [`trait@glib::ObjectExt`], [`CellRendererExtManual`][trait@crate::prelude::CellRendererExtManual]
#[doc(alias = "GtkCellRendererCombo")]
pub struct CellRendererCombo(Object<ffi::GtkCellRendererCombo>) @extends CellRendererText, CellRenderer;
match fn {
type_ => || ffi::gtk_cell_renderer_combo_get_type(),
}
}
impl CellRendererCombo {
/// Creates a new [`CellRendererCombo`][crate::CellRendererCombo].
/// Adjust how text is drawn using object properties.
/// Object properties can be set globally (with g_object_set()).
/// Also, with [`TreeViewColumn`][crate::TreeViewColumn], you can bind a property to a value
/// in a [`TreeModel`][crate::TreeModel]. For example, you can bind the “text” property
/// on the cell renderer to a string value in the model, thus rendering
/// a different string in each row of the [`TreeView`][crate::TreeView].
///
/// # Deprecated since 4.10
///
///
/// # Returns
///
/// the new cell renderer
#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
#[doc(alias = "gtk_cell_renderer_combo_new")]
pub fn new() -> CellRendererCombo {
assert_initialized_main_thread!();
unsafe { CellRenderer::from_glib_none(ffi::gtk_cell_renderer_combo_new()).unsafe_cast() }
}
// rustdoc-stripper-ignore-next
/// Creates a new builder-pattern struct instance to construct [`CellRendererCombo`] objects.
///
/// This method returns an instance of [`CellRendererComboBuilder`](crate::builders::CellRendererComboBuilder) which can be used to create [`CellRendererCombo`] objects.
pub fn builder() -> CellRendererComboBuilder {
CellRendererComboBuilder::new()
}
/// If [`true`], the cell renderer will include an entry and allow to enter
/// values other than the ones in the popup list.
#[doc(alias = "has-entry")]
pub fn has_entry(&self) -> bool {
ObjectExt::property(self, "has-entry")
}
/// If [`true`], the cell renderer will include an entry and allow to enter
/// values other than the ones in the popup list.
#[doc(alias = "has-entry")]
pub fn set_has_entry(&self, has_entry: bool) {
ObjectExt::set_property(self, "has-entry", has_entry)
}
/// Holds a tree model containing the possible values for the combo box.
/// Use the text_column property to specify the column holding the values.
pub fn model(&self) -> Option<TreeModel> {
ObjectExt::property(self, "model")
}
/// Holds a tree model containing the possible values for the combo box.
/// Use the text_column property to specify the column holding the values.
pub fn set_model<P: IsA<TreeModel>>(&self, model: Option<&P>) {
ObjectExt::set_property(self, "model", model)
}
/// Specifies the model column which holds the possible values for the
/// combo box.
///
/// Note that this refers to the model specified in the model property,
/// not the model backing the tree view to which
/// this cell renderer is attached.
///
/// [`CellRendererCombo`][crate::CellRendererCombo] automatically adds a text cell renderer for
/// this column to its combo box.
#[doc(alias = "text-column")]
pub fn text_column(&self) -> i32 {
ObjectExt::property(self, "text-column")
}
/// Specifies the model column which holds the possible values for the
/// combo box.
///
/// Note that this refers to the model specified in the model property,
/// not the model backing the tree view to which
/// this cell renderer is attached.
///
/// [`CellRendererCombo`][crate::CellRendererCombo] automatically adds a text cell renderer for
/// this column to its combo box.
#[doc(alias = "text-column")]
pub fn set_text_column(&self, text_column: i32) {
ObjectExt::set_property(self, "text-column", text_column)
}
/// This signal is emitted each time after the user selected an item in
/// the combo box, either by using the mouse or the arrow keys. Contrary
/// to GtkComboBox, GtkCellRendererCombo::changed is not emitted for
/// changes made to a selected item in the entry. The argument @new_iter
/// corresponds to the newly selected item in the combo box and it is relative
/// to the GtkTreeModel set via the model property on GtkCellRendererCombo.
///
/// Note that as soon as you change the model displayed in the tree view,
/// the tree view will immediately cease the editing operating. This
/// means that you most probably want to refrain from changing the model
/// until the combo cell renderer emits the edited or editing_canceled signal.
/// ## `path_string`
/// a string of the path identifying the edited cell
/// (relative to the tree view model)
/// ## `new_iter`
/// the new iter selected in the combo box
/// (relative to the combo box model)
#[doc(alias = "changed")]
pub fn connect_changed<F: Fn(&Self, TreePath, &TreeIter) + 'static>(
&self,
f: F,
) -> SignalHandlerId {
unsafe extern "C" fn changed_trampoline<
F: Fn(&CellRendererCombo, TreePath, &TreeIter) + 'static,
>(
this: *mut ffi::GtkCellRendererCombo,
path_string: *mut std::ffi::c_char,
new_iter: *mut ffi::GtkTreeIter,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
let path = from_glib_full(crate::ffi::gtk_tree_path_new_from_string(path_string));
f(&from_glib_borrow(this), path, &from_glib_borrow(new_iter))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"changed\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
changed_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "has-entry")]
pub fn connect_has_entry_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_has_entry_trampoline<F: Fn(&CellRendererCombo) + 'static>(
this: *mut ffi::GtkCellRendererCombo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::has-entry\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_has_entry_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "model")]
pub fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_model_trampoline<F: Fn(&CellRendererCombo) + 'static>(
this: *mut ffi::GtkCellRendererCombo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::model\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_model_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
#[doc(alias = "text-column")]
pub fn connect_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
unsafe extern "C" fn notify_text_column_trampoline<F: Fn(&CellRendererCombo) + 'static>(
this: *mut ffi::GtkCellRendererCombo,
_param_spec: glib::ffi::gpointer,
f: glib::ffi::gpointer,
) {
let f: &F = &*(f as *const F);
f(&from_glib_borrow(this))
}
unsafe {
let f: Box_<F> = Box_::new(f);
connect_raw(
self.as_ptr() as *mut _,
b"notify::text-column\0".as_ptr() as *const _,
Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
notify_text_column_trampoline::<F> as *const (),
)),
Box_::into_raw(f),
)
}
}
}
impl Default for CellRendererCombo {
fn default() -> Self {
Self::new()
}
}
// rustdoc-stripper-ignore-next
/// A [builder-pattern] type to construct [`CellRendererCombo`] objects.
///
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct CellRendererComboBuilder {
builder: glib::object::ObjectBuilder<'static, CellRendererCombo>,
}
impl CellRendererComboBuilder {
fn new() -> Self {
Self {
builder: glib::object::Object::builder(),
}
}
/// If [`true`], the cell renderer will include an entry and allow to enter
/// values other than the ones in the popup list.
pub fn has_entry(self, has_entry: bool) -> Self {
Self {
builder: self.builder.property("has-entry", has_entry),
}
}
/// Holds a tree model containing the possible values for the combo box.
/// Use the text_column property to specify the column holding the values.
pub fn model(self, model: &impl IsA<TreeModel>) -> Self {
Self {
builder: self.builder.property("model", model.clone().upcast()),
}
}
/// Specifies the model column which holds the possible values for the
/// combo box.
///
/// Note that this refers to the model specified in the model property,
/// not the model backing the tree view to which
/// this cell renderer is attached.
///
/// [`CellRendererCombo`][crate::CellRendererCombo] automatically adds a text cell renderer for
/// this column to its combo box.
pub fn text_column(self, text_column: i32) -> Self {
Self {
builder: self.builder.property("text-column", text_column),
}
}
pub fn align_set(self, align_set: bool) -> Self {
Self {
builder: self.builder.property("align-set", align_set),
}
}
/// Specifies how to align the lines of text with respect to each other.
///
/// Note that this property describes how to align the lines of text in
/// case there are several of them. The "xalign" property of [`CellRenderer`][crate::CellRenderer],
/// on the other hand, sets the horizontal alignment of the whole text.
pub fn alignment(self, alignment: pango::Alignment) -> Self {
Self {
builder: self.builder.property("alignment", alignment),
}
}
pub fn attributes(self, attributes: &pango::AttrList) -> Self {
Self {
builder: self.builder.property("attributes", attributes.clone()),
}
}
pub fn background(self, background: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("background", background.into()),
}
}
/// Background color as a [`gdk::RGBA`][crate::gdk::RGBA]
pub fn background_rgba(self, background_rgba: &gdk::RGBA) -> Self {
Self {
builder: self.builder.property("background-rgba", background_rgba),
}
}
pub fn background_set(self, background_set: bool) -> Self {
Self {
builder: self.builder.property("background-set", background_set),
}
}
pub fn editable(self, editable: bool) -> Self {
Self {
builder: self.builder.property("editable", editable),
}
}
pub fn editable_set(self, editable_set: bool) -> Self {
Self {
builder: self.builder.property("editable-set", editable_set),
}
}
/// Specifies the preferred place to ellipsize the string, if the cell renderer
/// does not have enough room to display the entire string. Setting it to
/// [`pango::EllipsizeMode::None`][crate::pango::EllipsizeMode::None] turns off ellipsizing. See the wrap-width property
/// for another way of making the text fit into a given width.
pub fn ellipsize(self, ellipsize: pango::EllipsizeMode) -> Self {
Self {
builder: self.builder.property("ellipsize", ellipsize),
}
}
pub fn ellipsize_set(self, ellipsize_set: bool) -> Self {
Self {
builder: self.builder.property("ellipsize-set", ellipsize_set),
}
}
pub fn family(self, family: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("family", family.into()),
}
}
pub fn family_set(self, family_set: bool) -> Self {
Self {
builder: self.builder.property("family-set", family_set),
}
}
pub fn font(self, font: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("font", font.into()),
}
}
pub fn font_desc(self, font_desc: &pango::FontDescription) -> Self {
Self {
builder: self.builder.property("font-desc", font_desc),
}
}
pub fn foreground(self, foreground: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("foreground", foreground.into()),
}
}
/// Foreground color as a [`gdk::RGBA`][crate::gdk::RGBA]
pub fn foreground_rgba(self, foreground_rgba: &gdk::RGBA) -> Self {
Self {
builder: self.builder.property("foreground-rgba", foreground_rgba),
}
}
pub fn foreground_set(self, foreground_set: bool) -> Self {
Self {
builder: self.builder.property("foreground-set", foreground_set),
}
}
pub fn language(self, language: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("language", language.into()),
}
}
pub fn language_set(self, language_set: bool) -> Self {
Self {
builder: self.builder.property("language-set", language_set),
}
}
pub fn markup(self, markup: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("markup", markup.into()),
}
}
/// The desired maximum width of the cell, in characters. If this property
/// is set to -1, the width will be calculated automatically.
///
/// For cell renderers that ellipsize or wrap text; this property
/// controls the maximum reported width of the cell. The
/// cell should not receive any greater allocation unless it is
/// set to expand in its [`CellLayout`][crate::CellLayout] and all of the cell's siblings
/// have received their natural width.
pub fn max_width_chars(self, max_width_chars: i32) -> Self {
Self {
builder: self.builder.property("max-width-chars", max_width_chars),
}
}
/// The text that will be displayed in the [`CellRenderer`][crate::CellRenderer] if
/// `GtkCellRendererText:editable` is [`true`] and the cell is empty.
pub fn placeholder_text(self, placeholder_text: impl Into<glib::GString>) -> Self {
Self {
builder: self
.builder
.property("placeholder-text", placeholder_text.into()),
}
}
pub fn rise(self, rise: i32) -> Self {
Self {
builder: self.builder.property("rise", rise),
}
}
pub fn rise_set(self, rise_set: bool) -> Self {
Self {
builder: self.builder.property("rise-set", rise_set),
}
}
pub fn scale(self, scale: f64) -> Self {
Self {
builder: self.builder.property("scale", scale),
}
}
pub fn scale_set(self, scale_set: bool) -> Self {
Self {
builder: self.builder.property("scale-set", scale_set),
}
}
pub fn single_paragraph_mode(self, single_paragraph_mode: bool) -> Self {
Self {
builder: self
.builder
.property("single-paragraph-mode", single_paragraph_mode),
}
}
pub fn size(self, size: i32) -> Self {
Self {
builder: self.builder.property("size", size),
}
}
pub fn size_points(self, size_points: f64) -> Self {
Self {
builder: self.builder.property("size-points", size_points),
}
}
pub fn size_set(self, size_set: bool) -> Self {
Self {
builder: self.builder.property("size-set", size_set),
}
}
pub fn stretch(self, stretch: pango::Stretch) -> Self {
Self {
builder: self.builder.property("stretch", stretch),
}
}
pub fn stretch_set(self, stretch_set: bool) -> Self {
Self {
builder: self.builder.property("stretch-set", stretch_set),
}
}
pub fn strikethrough(self, strikethrough: bool) -> Self {
Self {
builder: self.builder.property("strikethrough", strikethrough),
}
}
pub fn strikethrough_set(self, strikethrough_set: bool) -> Self {
Self {
builder: self
.builder
.property("strikethrough-set", strikethrough_set),
}
}
pub fn style(self, style: pango::Style) -> Self {
Self {
builder: self.builder.property("style", style),
}
}
pub fn style_set(self, style_set: bool) -> Self {
Self {
builder: self.builder.property("style-set", style_set),
}
}
pub fn text(self, text: impl Into<glib::GString>) -> Self {
Self {
builder: self.builder.property("text", text.into()),
}
}
pub fn underline(self, underline: pango::Underline) -> Self {
Self {
builder: self.builder.property("underline", underline),
}
}
pub fn underline_set(self, underline_set: bool) -> Self {
Self {
builder: self.builder.property("underline-set", underline_set),
}
}
pub fn variant(self, variant: pango::Variant) -> Self {
Self {
builder: self.builder.property("variant", variant),
}
}
pub fn variant_set(self, variant_set: bool) -> Self {
Self {
builder: self.builder.property("variant-set", variant_set),
}
}
pub fn weight(self, weight: i32) -> Self {
Self {
builder: self.builder.property("weight", weight),
}
}
pub fn weight_set(self, weight_set: bool) -> Self {
Self {
builder: self.builder.property("weight-set", weight_set),
}
}
/// The desired width of the cell, in characters. If this property is set to
/// -1, the width will be calculated automatically, otherwise the cell will
/// request either 3 characters or the property value, whichever is greater.
pub fn width_chars(self, width_chars: i32) -> Self {
Self {
builder: self.builder.property("width-chars", width_chars),
}
}
/// Specifies how to break the string into multiple lines, if the cell
/// renderer does not have enough room to display the entire string.
/// This property has no effect unless the wrap-width property is set.
pub fn wrap_mode(self, wrap_mode: pango::WrapMode) -> Self {
Self {
builder: self.builder.property("wrap-mode", wrap_mode),
}
}
/// Specifies the minimum width at which the text is wrapped. The wrap-mode property can
/// be used to influence at what character positions the line breaks can be placed.
/// Setting wrap-width to -1 turns wrapping off.
pub fn wrap_width(self, wrap_width: i32) -> Self {
Self {
builder: self.builder.property("wrap-width", wrap_width),
}
}
pub fn cell_background(self, cell_background: impl Into<glib::GString>) -> Self {
Self {
builder: self
.builder
.property("cell-background", cell_background.into()),
}
}
/// Cell background as a [`gdk::RGBA`][crate::gdk::RGBA]
pub fn cell_background_rgba(self, cell_background_rgba: &gdk::RGBA) -> Self {
Self {
builder: self
.builder
.property("cell-background-rgba", cell_background_rgba),
}
}
pub fn cell_background_set(self, cell_background_set: bool) -> Self {
Self {
builder: self
.builder
.property("cell-background-set", cell_background_set),
}
}
pub fn height(self, height: i32) -> Self {
Self {
builder: self.builder.property("height", height),
}
}
pub fn is_expanded(self, is_expanded: bool) -> Self {
Self {
builder: self.builder.property("is-expanded", is_expanded),
}
}
pub fn is_expander(self, is_expander: bool) -> Self {
Self {
builder: self.builder.property("is-expander", is_expander),
}
}
pub fn mode(self, mode: CellRendererMode) -> Self {
Self {
builder: self.builder.property("mode", mode),
}
}
pub fn sensitive(self, sensitive: bool) -> Self {
Self {
builder: self.builder.property("sensitive", sensitive),
}
}
pub fn visible(self, visible: bool) -> Self {
Self {
builder: self.builder.property("visible", visible),
}
}
pub fn width(self, width: i32) -> Self {
Self {
builder: self.builder.property("width", width),
}
}
pub fn xalign(self, xalign: f32) -> Self {
Self {
builder: self.builder.property("xalign", xalign),
}
}
pub fn xpad(self, xpad: u32) -> Self {
Self {
builder: self.builder.property("xpad", xpad),
}
}
pub fn yalign(self, yalign: f32) -> Self {
Self {
builder: self.builder.property("yalign", yalign),
}
}
pub fn ypad(self, ypad: u32) -> Self {
Self {
builder: self.builder.property("ypad", ypad),
}
}
// rustdoc-stripper-ignore-next
/// Build the [`CellRendererCombo`].
#[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
pub fn build(self) -> CellRendererCombo {
self.builder.build()
}
}