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::Actionable; 6 use crate::Align; 7 use crate::Bin; 8 use crate::Buildable; 9 use crate::Container; 10 use crate::Menu; 11 use crate::MenuItem; 12 use crate::ResizeMode; 13 use crate::Widget; 14 use glib::object::Cast; 15 use glib::object::IsA; 16 use glib::translate::*; 17 use glib::StaticType; 18 use glib::ToValue; 19 use std::fmt; 20 21 glib::wrapper! { 22 #[doc(alias = "GtkSeparatorMenuItem")] 23 pub struct SeparatorMenuItem(Object<ffi::GtkSeparatorMenuItem, ffi::GtkSeparatorMenuItemClass>) @extends MenuItem, Bin, Container, Widget, @implements Buildable, Actionable; 24 25 match fn { 26 type_ => || ffi::gtk_separator_menu_item_get_type(), 27 } 28 } 29 30 impl SeparatorMenuItem { 31 #[doc(alias = "gtk_separator_menu_item_new")] new() -> SeparatorMenuItem32 pub fn new() -> SeparatorMenuItem { 33 assert_initialized_main_thread!(); 34 unsafe { Widget::from_glib_none(ffi::gtk_separator_menu_item_new()).unsafe_cast() } 35 } 36 37 // rustdoc-stripper-ignore-next 38 /// Creates a new builder-pattern struct instance to construct [`SeparatorMenuItem`] objects. 39 /// 40 /// This method returns an instance of [`SeparatorMenuItemBuilder`] which can be used to create [`SeparatorMenuItem`] objects. builder() -> SeparatorMenuItemBuilder41 pub fn builder() -> SeparatorMenuItemBuilder { 42 SeparatorMenuItemBuilder::default() 43 } 44 } 45 46 impl Default for SeparatorMenuItem { default() -> Self47 fn default() -> Self { 48 Self::new() 49 } 50 } 51 52 #[derive(Clone, Default)] 53 // rustdoc-stripper-ignore-next 54 /// A [builder-pattern] type to construct [`SeparatorMenuItem`] objects. 55 /// 56 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 57 pub struct SeparatorMenuItemBuilder { 58 accel_path: Option<String>, 59 label: Option<String>, 60 right_justified: Option<bool>, 61 submenu: Option<Menu>, 62 use_underline: Option<bool>, 63 border_width: Option<u32>, 64 child: Option<Widget>, 65 resize_mode: Option<ResizeMode>, 66 app_paintable: Option<bool>, 67 can_default: Option<bool>, 68 can_focus: Option<bool>, 69 events: Option<gdk::EventMask>, 70 expand: Option<bool>, 71 #[cfg(any(feature = "v3_20", feature = "dox"))] 72 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 73 focus_on_click: Option<bool>, 74 halign: Option<Align>, 75 has_default: Option<bool>, 76 has_focus: Option<bool>, 77 has_tooltip: Option<bool>, 78 height_request: Option<i32>, 79 hexpand: Option<bool>, 80 hexpand_set: Option<bool>, 81 is_focus: Option<bool>, 82 margin: Option<i32>, 83 margin_bottom: Option<i32>, 84 margin_end: Option<i32>, 85 margin_start: Option<i32>, 86 margin_top: Option<i32>, 87 name: Option<String>, 88 no_show_all: Option<bool>, 89 opacity: Option<f64>, 90 parent: Option<Container>, 91 receives_default: Option<bool>, 92 sensitive: Option<bool>, 93 tooltip_markup: Option<String>, 94 tooltip_text: Option<String>, 95 valign: Option<Align>, 96 vexpand: Option<bool>, 97 vexpand_set: Option<bool>, 98 visible: Option<bool>, 99 width_request: Option<i32>, 100 action_name: Option<String>, 101 action_target: Option<glib::Variant>, 102 } 103 104 impl SeparatorMenuItemBuilder { 105 // rustdoc-stripper-ignore-next 106 /// Create a new [`SeparatorMenuItemBuilder`]. new() -> Self107 pub fn new() -> Self { 108 Self::default() 109 } 110 111 // rustdoc-stripper-ignore-next 112 /// Build the [`SeparatorMenuItem`]. build(self) -> SeparatorMenuItem113 pub fn build(self) -> SeparatorMenuItem { 114 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 115 if let Some(ref accel_path) = self.accel_path { 116 properties.push(("accel-path", accel_path)); 117 } 118 if let Some(ref label) = self.label { 119 properties.push(("label", label)); 120 } 121 if let Some(ref right_justified) = self.right_justified { 122 properties.push(("right-justified", right_justified)); 123 } 124 if let Some(ref submenu) = self.submenu { 125 properties.push(("submenu", submenu)); 126 } 127 if let Some(ref use_underline) = self.use_underline { 128 properties.push(("use-underline", use_underline)); 129 } 130 if let Some(ref border_width) = self.border_width { 131 properties.push(("border-width", border_width)); 132 } 133 if let Some(ref child) = self.child { 134 properties.push(("child", child)); 135 } 136 if let Some(ref resize_mode) = self.resize_mode { 137 properties.push(("resize-mode", resize_mode)); 138 } 139 if let Some(ref app_paintable) = self.app_paintable { 140 properties.push(("app-paintable", app_paintable)); 141 } 142 if let Some(ref can_default) = self.can_default { 143 properties.push(("can-default", can_default)); 144 } 145 if let Some(ref can_focus) = self.can_focus { 146 properties.push(("can-focus", can_focus)); 147 } 148 if let Some(ref events) = self.events { 149 properties.push(("events", events)); 150 } 151 if let Some(ref expand) = self.expand { 152 properties.push(("expand", expand)); 153 } 154 #[cfg(any(feature = "v3_20", feature = "dox"))] 155 if let Some(ref focus_on_click) = self.focus_on_click { 156 properties.push(("focus-on-click", focus_on_click)); 157 } 158 if let Some(ref halign) = self.halign { 159 properties.push(("halign", halign)); 160 } 161 if let Some(ref has_default) = self.has_default { 162 properties.push(("has-default", has_default)); 163 } 164 if let Some(ref has_focus) = self.has_focus { 165 properties.push(("has-focus", has_focus)); 166 } 167 if let Some(ref has_tooltip) = self.has_tooltip { 168 properties.push(("has-tooltip", has_tooltip)); 169 } 170 if let Some(ref height_request) = self.height_request { 171 properties.push(("height-request", height_request)); 172 } 173 if let Some(ref hexpand) = self.hexpand { 174 properties.push(("hexpand", hexpand)); 175 } 176 if let Some(ref hexpand_set) = self.hexpand_set { 177 properties.push(("hexpand-set", hexpand_set)); 178 } 179 if let Some(ref is_focus) = self.is_focus { 180 properties.push(("is-focus", is_focus)); 181 } 182 if let Some(ref margin) = self.margin { 183 properties.push(("margin", margin)); 184 } 185 if let Some(ref margin_bottom) = self.margin_bottom { 186 properties.push(("margin-bottom", margin_bottom)); 187 } 188 if let Some(ref margin_end) = self.margin_end { 189 properties.push(("margin-end", margin_end)); 190 } 191 if let Some(ref margin_start) = self.margin_start { 192 properties.push(("margin-start", margin_start)); 193 } 194 if let Some(ref margin_top) = self.margin_top { 195 properties.push(("margin-top", margin_top)); 196 } 197 if let Some(ref name) = self.name { 198 properties.push(("name", name)); 199 } 200 if let Some(ref no_show_all) = self.no_show_all { 201 properties.push(("no-show-all", no_show_all)); 202 } 203 if let Some(ref opacity) = self.opacity { 204 properties.push(("opacity", opacity)); 205 } 206 if let Some(ref parent) = self.parent { 207 properties.push(("parent", parent)); 208 } 209 if let Some(ref receives_default) = self.receives_default { 210 properties.push(("receives-default", receives_default)); 211 } 212 if let Some(ref sensitive) = self.sensitive { 213 properties.push(("sensitive", sensitive)); 214 } 215 if let Some(ref tooltip_markup) = self.tooltip_markup { 216 properties.push(("tooltip-markup", tooltip_markup)); 217 } 218 if let Some(ref tooltip_text) = self.tooltip_text { 219 properties.push(("tooltip-text", tooltip_text)); 220 } 221 if let Some(ref valign) = self.valign { 222 properties.push(("valign", valign)); 223 } 224 if let Some(ref vexpand) = self.vexpand { 225 properties.push(("vexpand", vexpand)); 226 } 227 if let Some(ref vexpand_set) = self.vexpand_set { 228 properties.push(("vexpand-set", vexpand_set)); 229 } 230 if let Some(ref visible) = self.visible { 231 properties.push(("visible", visible)); 232 } 233 if let Some(ref width_request) = self.width_request { 234 properties.push(("width-request", width_request)); 235 } 236 if let Some(ref action_name) = self.action_name { 237 properties.push(("action-name", action_name)); 238 } 239 if let Some(ref action_target) = self.action_target { 240 properties.push(("action-target", action_target)); 241 } 242 glib::Object::new::<SeparatorMenuItem>(&properties) 243 .expect("Failed to create an instance of SeparatorMenuItem") 244 } 245 accel_path(mut self, accel_path: &str) -> Self246 pub fn accel_path(mut self, accel_path: &str) -> Self { 247 self.accel_path = Some(accel_path.to_string()); 248 self 249 } 250 label(mut self, label: &str) -> Self251 pub fn label(mut self, label: &str) -> Self { 252 self.label = Some(label.to_string()); 253 self 254 } 255 right_justified(mut self, right_justified: bool) -> Self256 pub fn right_justified(mut self, right_justified: bool) -> Self { 257 self.right_justified = Some(right_justified); 258 self 259 } 260 submenu<P: IsA<Menu>>(mut self, submenu: &P) -> Self261 pub fn submenu<P: IsA<Menu>>(mut self, submenu: &P) -> Self { 262 self.submenu = Some(submenu.clone().upcast()); 263 self 264 } 265 use_underline(mut self, use_underline: bool) -> Self266 pub fn use_underline(mut self, use_underline: bool) -> Self { 267 self.use_underline = Some(use_underline); 268 self 269 } 270 border_width(mut self, border_width: u32) -> Self271 pub fn border_width(mut self, border_width: u32) -> Self { 272 self.border_width = Some(border_width); 273 self 274 } 275 child<P: IsA<Widget>>(mut self, child: &P) -> Self276 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 277 self.child = Some(child.clone().upcast()); 278 self 279 } 280 resize_mode(mut self, resize_mode: ResizeMode) -> Self281 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 282 self.resize_mode = Some(resize_mode); 283 self 284 } 285 app_paintable(mut self, app_paintable: bool) -> Self286 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 287 self.app_paintable = Some(app_paintable); 288 self 289 } 290 can_default(mut self, can_default: bool) -> Self291 pub fn can_default(mut self, can_default: bool) -> Self { 292 self.can_default = Some(can_default); 293 self 294 } 295 can_focus(mut self, can_focus: bool) -> Self296 pub fn can_focus(mut self, can_focus: bool) -> Self { 297 self.can_focus = Some(can_focus); 298 self 299 } 300 events(mut self, events: gdk::EventMask) -> Self301 pub fn events(mut self, events: gdk::EventMask) -> Self { 302 self.events = Some(events); 303 self 304 } 305 expand(mut self, expand: bool) -> Self306 pub fn expand(mut self, expand: bool) -> Self { 307 self.expand = Some(expand); 308 self 309 } 310 311 #[cfg(any(feature = "v3_20", feature = "dox"))] 312 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self313 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 314 self.focus_on_click = Some(focus_on_click); 315 self 316 } 317 halign(mut self, halign: Align) -> Self318 pub fn halign(mut self, halign: Align) -> Self { 319 self.halign = Some(halign); 320 self 321 } 322 has_default(mut self, has_default: bool) -> Self323 pub fn has_default(mut self, has_default: bool) -> Self { 324 self.has_default = Some(has_default); 325 self 326 } 327 has_focus(mut self, has_focus: bool) -> Self328 pub fn has_focus(mut self, has_focus: bool) -> Self { 329 self.has_focus = Some(has_focus); 330 self 331 } 332 has_tooltip(mut self, has_tooltip: bool) -> Self333 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 334 self.has_tooltip = Some(has_tooltip); 335 self 336 } 337 height_request(mut self, height_request: i32) -> Self338 pub fn height_request(mut self, height_request: i32) -> Self { 339 self.height_request = Some(height_request); 340 self 341 } 342 hexpand(mut self, hexpand: bool) -> Self343 pub fn hexpand(mut self, hexpand: bool) -> Self { 344 self.hexpand = Some(hexpand); 345 self 346 } 347 hexpand_set(mut self, hexpand_set: bool) -> Self348 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 349 self.hexpand_set = Some(hexpand_set); 350 self 351 } 352 is_focus(mut self, is_focus: bool) -> Self353 pub fn is_focus(mut self, is_focus: bool) -> Self { 354 self.is_focus = Some(is_focus); 355 self 356 } 357 margin(mut self, margin: i32) -> Self358 pub fn margin(mut self, margin: i32) -> Self { 359 self.margin = Some(margin); 360 self 361 } 362 margin_bottom(mut self, margin_bottom: i32) -> Self363 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 364 self.margin_bottom = Some(margin_bottom); 365 self 366 } 367 margin_end(mut self, margin_end: i32) -> Self368 pub fn margin_end(mut self, margin_end: i32) -> Self { 369 self.margin_end = Some(margin_end); 370 self 371 } 372 margin_start(mut self, margin_start: i32) -> Self373 pub fn margin_start(mut self, margin_start: i32) -> Self { 374 self.margin_start = Some(margin_start); 375 self 376 } 377 margin_top(mut self, margin_top: i32) -> Self378 pub fn margin_top(mut self, margin_top: i32) -> Self { 379 self.margin_top = Some(margin_top); 380 self 381 } 382 name(mut self, name: &str) -> Self383 pub fn name(mut self, name: &str) -> Self { 384 self.name = Some(name.to_string()); 385 self 386 } 387 no_show_all(mut self, no_show_all: bool) -> Self388 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 389 self.no_show_all = Some(no_show_all); 390 self 391 } 392 opacity(mut self, opacity: f64) -> Self393 pub fn opacity(mut self, opacity: f64) -> Self { 394 self.opacity = Some(opacity); 395 self 396 } 397 parent<P: IsA<Container>>(mut self, parent: &P) -> Self398 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 399 self.parent = Some(parent.clone().upcast()); 400 self 401 } 402 receives_default(mut self, receives_default: bool) -> Self403 pub fn receives_default(mut self, receives_default: bool) -> Self { 404 self.receives_default = Some(receives_default); 405 self 406 } 407 sensitive(mut self, sensitive: bool) -> Self408 pub fn sensitive(mut self, sensitive: bool) -> Self { 409 self.sensitive = Some(sensitive); 410 self 411 } 412 tooltip_markup(mut self, tooltip_markup: &str) -> Self413 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 414 self.tooltip_markup = Some(tooltip_markup.to_string()); 415 self 416 } 417 tooltip_text(mut self, tooltip_text: &str) -> Self418 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 419 self.tooltip_text = Some(tooltip_text.to_string()); 420 self 421 } 422 valign(mut self, valign: Align) -> Self423 pub fn valign(mut self, valign: Align) -> Self { 424 self.valign = Some(valign); 425 self 426 } 427 vexpand(mut self, vexpand: bool) -> Self428 pub fn vexpand(mut self, vexpand: bool) -> Self { 429 self.vexpand = Some(vexpand); 430 self 431 } 432 vexpand_set(mut self, vexpand_set: bool) -> Self433 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 434 self.vexpand_set = Some(vexpand_set); 435 self 436 } 437 visible(mut self, visible: bool) -> Self438 pub fn visible(mut self, visible: bool) -> Self { 439 self.visible = Some(visible); 440 self 441 } 442 width_request(mut self, width_request: i32) -> Self443 pub fn width_request(mut self, width_request: i32) -> Self { 444 self.width_request = Some(width_request); 445 self 446 } 447 action_name(mut self, action_name: &str) -> Self448 pub fn action_name(mut self, action_name: &str) -> Self { 449 self.action_name = Some(action_name.to_string()); 450 self 451 } 452 action_target(mut self, action_target: &glib::Variant) -> Self453 pub fn action_target(mut self, action_target: &glib::Variant) -> Self { 454 self.action_target = Some(action_target.clone()); 455 self 456 } 457 } 458 459 pub const NONE_SEPARATOR_MENU_ITEM: Option<&SeparatorMenuItem> = None; 460 461 impl fmt::Display for SeparatorMenuItem { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result462 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 463 f.write_str("SeparatorMenuItem") 464 } 465 } 466