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::Container; 8 use crate::ResizeMode; 9 use crate::Widget; 10 use glib::object::Cast; 11 use glib::object::IsA; 12 use glib::translate::*; 13 use glib::StaticType; 14 use glib::ToValue; 15 use std::fmt; 16 17 glib::wrapper! { 18 #[doc(alias = "GtkFixed")] 19 pub struct Fixed(Object<ffi::GtkFixed, ffi::GtkFixedClass>) @extends Container, Widget, @implements Buildable; 20 21 match fn { 22 type_ => || ffi::gtk_fixed_get_type(), 23 } 24 } 25 26 impl Fixed { 27 #[doc(alias = "gtk_fixed_new")] new() -> Fixed28 pub fn new() -> Fixed { 29 assert_initialized_main_thread!(); 30 unsafe { Widget::from_glib_none(ffi::gtk_fixed_new()).unsafe_cast() } 31 } 32 33 // rustdoc-stripper-ignore-next 34 /// Creates a new builder-pattern struct instance to construct [`Fixed`] objects. 35 /// 36 /// This method returns an instance of [`FixedBuilder`] which can be used to create [`Fixed`] objects. builder() -> FixedBuilder37 pub fn builder() -> FixedBuilder { 38 FixedBuilder::default() 39 } 40 } 41 42 impl Default for Fixed { default() -> Self43 fn default() -> Self { 44 Self::new() 45 } 46 } 47 48 #[derive(Clone, Default)] 49 // rustdoc-stripper-ignore-next 50 /// A [builder-pattern] type to construct [`Fixed`] objects. 51 /// 52 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html 53 pub struct FixedBuilder { 54 border_width: Option<u32>, 55 child: Option<Widget>, 56 resize_mode: Option<ResizeMode>, 57 app_paintable: Option<bool>, 58 can_default: Option<bool>, 59 can_focus: Option<bool>, 60 events: Option<gdk::EventMask>, 61 expand: Option<bool>, 62 #[cfg(any(feature = "v3_20", feature = "dox"))] 63 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] 64 focus_on_click: Option<bool>, 65 halign: Option<Align>, 66 has_default: Option<bool>, 67 has_focus: Option<bool>, 68 has_tooltip: Option<bool>, 69 height_request: Option<i32>, 70 hexpand: Option<bool>, 71 hexpand_set: Option<bool>, 72 is_focus: Option<bool>, 73 margin: Option<i32>, 74 margin_bottom: Option<i32>, 75 margin_end: Option<i32>, 76 margin_start: Option<i32>, 77 margin_top: Option<i32>, 78 name: Option<String>, 79 no_show_all: Option<bool>, 80 opacity: Option<f64>, 81 parent: Option<Container>, 82 receives_default: Option<bool>, 83 sensitive: Option<bool>, 84 tooltip_markup: Option<String>, 85 tooltip_text: Option<String>, 86 valign: Option<Align>, 87 vexpand: Option<bool>, 88 vexpand_set: Option<bool>, 89 visible: Option<bool>, 90 width_request: Option<i32>, 91 } 92 93 impl FixedBuilder { 94 // rustdoc-stripper-ignore-next 95 /// Create a new [`FixedBuilder`]. new() -> Self96 pub fn new() -> Self { 97 Self::default() 98 } 99 100 // rustdoc-stripper-ignore-next 101 /// Build the [`Fixed`]. build(self) -> Fixed102 pub fn build(self) -> Fixed { 103 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 104 if let Some(ref border_width) = self.border_width { 105 properties.push(("border-width", border_width)); 106 } 107 if let Some(ref child) = self.child { 108 properties.push(("child", child)); 109 } 110 if let Some(ref resize_mode) = self.resize_mode { 111 properties.push(("resize-mode", resize_mode)); 112 } 113 if let Some(ref app_paintable) = self.app_paintable { 114 properties.push(("app-paintable", app_paintable)); 115 } 116 if let Some(ref can_default) = self.can_default { 117 properties.push(("can-default", can_default)); 118 } 119 if let Some(ref can_focus) = self.can_focus { 120 properties.push(("can-focus", can_focus)); 121 } 122 if let Some(ref events) = self.events { 123 properties.push(("events", events)); 124 } 125 if let Some(ref expand) = self.expand { 126 properties.push(("expand", expand)); 127 } 128 #[cfg(any(feature = "v3_20", feature = "dox"))] 129 if let Some(ref focus_on_click) = self.focus_on_click { 130 properties.push(("focus-on-click", focus_on_click)); 131 } 132 if let Some(ref halign) = self.halign { 133 properties.push(("halign", halign)); 134 } 135 if let Some(ref has_default) = self.has_default { 136 properties.push(("has-default", has_default)); 137 } 138 if let Some(ref has_focus) = self.has_focus { 139 properties.push(("has-focus", has_focus)); 140 } 141 if let Some(ref has_tooltip) = self.has_tooltip { 142 properties.push(("has-tooltip", has_tooltip)); 143 } 144 if let Some(ref height_request) = self.height_request { 145 properties.push(("height-request", height_request)); 146 } 147 if let Some(ref hexpand) = self.hexpand { 148 properties.push(("hexpand", hexpand)); 149 } 150 if let Some(ref hexpand_set) = self.hexpand_set { 151 properties.push(("hexpand-set", hexpand_set)); 152 } 153 if let Some(ref is_focus) = self.is_focus { 154 properties.push(("is-focus", is_focus)); 155 } 156 if let Some(ref margin) = self.margin { 157 properties.push(("margin", margin)); 158 } 159 if let Some(ref margin_bottom) = self.margin_bottom { 160 properties.push(("margin-bottom", margin_bottom)); 161 } 162 if let Some(ref margin_end) = self.margin_end { 163 properties.push(("margin-end", margin_end)); 164 } 165 if let Some(ref margin_start) = self.margin_start { 166 properties.push(("margin-start", margin_start)); 167 } 168 if let Some(ref margin_top) = self.margin_top { 169 properties.push(("margin-top", margin_top)); 170 } 171 if let Some(ref name) = self.name { 172 properties.push(("name", name)); 173 } 174 if let Some(ref no_show_all) = self.no_show_all { 175 properties.push(("no-show-all", no_show_all)); 176 } 177 if let Some(ref opacity) = self.opacity { 178 properties.push(("opacity", opacity)); 179 } 180 if let Some(ref parent) = self.parent { 181 properties.push(("parent", parent)); 182 } 183 if let Some(ref receives_default) = self.receives_default { 184 properties.push(("receives-default", receives_default)); 185 } 186 if let Some(ref sensitive) = self.sensitive { 187 properties.push(("sensitive", sensitive)); 188 } 189 if let Some(ref tooltip_markup) = self.tooltip_markup { 190 properties.push(("tooltip-markup", tooltip_markup)); 191 } 192 if let Some(ref tooltip_text) = self.tooltip_text { 193 properties.push(("tooltip-text", tooltip_text)); 194 } 195 if let Some(ref valign) = self.valign { 196 properties.push(("valign", valign)); 197 } 198 if let Some(ref vexpand) = self.vexpand { 199 properties.push(("vexpand", vexpand)); 200 } 201 if let Some(ref vexpand_set) = self.vexpand_set { 202 properties.push(("vexpand-set", vexpand_set)); 203 } 204 if let Some(ref visible) = self.visible { 205 properties.push(("visible", visible)); 206 } 207 if let Some(ref width_request) = self.width_request { 208 properties.push(("width-request", width_request)); 209 } 210 glib::Object::new::<Fixed>(&properties).expect("Failed to create an instance of Fixed") 211 } 212 border_width(mut self, border_width: u32) -> Self213 pub fn border_width(mut self, border_width: u32) -> Self { 214 self.border_width = Some(border_width); 215 self 216 } 217 child<P: IsA<Widget>>(mut self, child: &P) -> Self218 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 219 self.child = Some(child.clone().upcast()); 220 self 221 } 222 resize_mode(mut self, resize_mode: ResizeMode) -> Self223 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 224 self.resize_mode = Some(resize_mode); 225 self 226 } 227 app_paintable(mut self, app_paintable: bool) -> Self228 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 229 self.app_paintable = Some(app_paintable); 230 self 231 } 232 can_default(mut self, can_default: bool) -> Self233 pub fn can_default(mut self, can_default: bool) -> Self { 234 self.can_default = Some(can_default); 235 self 236 } 237 can_focus(mut self, can_focus: bool) -> Self238 pub fn can_focus(mut self, can_focus: bool) -> Self { 239 self.can_focus = Some(can_focus); 240 self 241 } 242 events(mut self, events: gdk::EventMask) -> Self243 pub fn events(mut self, events: gdk::EventMask) -> Self { 244 self.events = Some(events); 245 self 246 } 247 expand(mut self, expand: bool) -> Self248 pub fn expand(mut self, expand: bool) -> Self { 249 self.expand = Some(expand); 250 self 251 } 252 253 #[cfg(any(feature = "v3_20", feature = "dox"))] 254 #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))] focus_on_click(mut self, focus_on_click: bool) -> Self255 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 256 self.focus_on_click = Some(focus_on_click); 257 self 258 } 259 halign(mut self, halign: Align) -> Self260 pub fn halign(mut self, halign: Align) -> Self { 261 self.halign = Some(halign); 262 self 263 } 264 has_default(mut self, has_default: bool) -> Self265 pub fn has_default(mut self, has_default: bool) -> Self { 266 self.has_default = Some(has_default); 267 self 268 } 269 has_focus(mut self, has_focus: bool) -> Self270 pub fn has_focus(mut self, has_focus: bool) -> Self { 271 self.has_focus = Some(has_focus); 272 self 273 } 274 has_tooltip(mut self, has_tooltip: bool) -> Self275 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 276 self.has_tooltip = Some(has_tooltip); 277 self 278 } 279 height_request(mut self, height_request: i32) -> Self280 pub fn height_request(mut self, height_request: i32) -> Self { 281 self.height_request = Some(height_request); 282 self 283 } 284 hexpand(mut self, hexpand: bool) -> Self285 pub fn hexpand(mut self, hexpand: bool) -> Self { 286 self.hexpand = Some(hexpand); 287 self 288 } 289 hexpand_set(mut self, hexpand_set: bool) -> Self290 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 291 self.hexpand_set = Some(hexpand_set); 292 self 293 } 294 is_focus(mut self, is_focus: bool) -> Self295 pub fn is_focus(mut self, is_focus: bool) -> Self { 296 self.is_focus = Some(is_focus); 297 self 298 } 299 margin(mut self, margin: i32) -> Self300 pub fn margin(mut self, margin: i32) -> Self { 301 self.margin = Some(margin); 302 self 303 } 304 margin_bottom(mut self, margin_bottom: i32) -> Self305 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 306 self.margin_bottom = Some(margin_bottom); 307 self 308 } 309 margin_end(mut self, margin_end: i32) -> Self310 pub fn margin_end(mut self, margin_end: i32) -> Self { 311 self.margin_end = Some(margin_end); 312 self 313 } 314 margin_start(mut self, margin_start: i32) -> Self315 pub fn margin_start(mut self, margin_start: i32) -> Self { 316 self.margin_start = Some(margin_start); 317 self 318 } 319 margin_top(mut self, margin_top: i32) -> Self320 pub fn margin_top(mut self, margin_top: i32) -> Self { 321 self.margin_top = Some(margin_top); 322 self 323 } 324 name(mut self, name: &str) -> Self325 pub fn name(mut self, name: &str) -> Self { 326 self.name = Some(name.to_string()); 327 self 328 } 329 no_show_all(mut self, no_show_all: bool) -> Self330 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 331 self.no_show_all = Some(no_show_all); 332 self 333 } 334 opacity(mut self, opacity: f64) -> Self335 pub fn opacity(mut self, opacity: f64) -> Self { 336 self.opacity = Some(opacity); 337 self 338 } 339 parent<P: IsA<Container>>(mut self, parent: &P) -> Self340 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 341 self.parent = Some(parent.clone().upcast()); 342 self 343 } 344 receives_default(mut self, receives_default: bool) -> Self345 pub fn receives_default(mut self, receives_default: bool) -> Self { 346 self.receives_default = Some(receives_default); 347 self 348 } 349 sensitive(mut self, sensitive: bool) -> Self350 pub fn sensitive(mut self, sensitive: bool) -> Self { 351 self.sensitive = Some(sensitive); 352 self 353 } 354 tooltip_markup(mut self, tooltip_markup: &str) -> Self355 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 356 self.tooltip_markup = Some(tooltip_markup.to_string()); 357 self 358 } 359 tooltip_text(mut self, tooltip_text: &str) -> Self360 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 361 self.tooltip_text = Some(tooltip_text.to_string()); 362 self 363 } 364 valign(mut self, valign: Align) -> Self365 pub fn valign(mut self, valign: Align) -> Self { 366 self.valign = Some(valign); 367 self 368 } 369 vexpand(mut self, vexpand: bool) -> Self370 pub fn vexpand(mut self, vexpand: bool) -> Self { 371 self.vexpand = Some(vexpand); 372 self 373 } 374 vexpand_set(mut self, vexpand_set: bool) -> Self375 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 376 self.vexpand_set = Some(vexpand_set); 377 self 378 } 379 visible(mut self, visible: bool) -> Self380 pub fn visible(mut self, visible: bool) -> Self { 381 self.visible = Some(visible); 382 self 383 } 384 width_request(mut self, width_request: i32) -> Self385 pub fn width_request(mut self, width_request: i32) -> Self { 386 self.width_request = Some(width_request); 387 self 388 } 389 } 390 391 pub const NONE_FIXED: Option<&Fixed> = None; 392 393 pub trait FixedExt: 'static { 394 #[doc(alias = "gtk_fixed_move")] 395 #[doc(alias = "move")] move_<P: IsA<Widget>>(&self, widget: &P, x: i32, y: i32)396 fn move_<P: IsA<Widget>>(&self, widget: &P, x: i32, y: i32); 397 398 #[doc(alias = "gtk_fixed_put")] put<P: IsA<Widget>>(&self, widget: &P, x: i32, y: i32)399 fn put<P: IsA<Widget>>(&self, widget: &P, x: i32, y: i32); 400 } 401 402 impl<O: IsA<Fixed>> FixedExt for O { move_<P: IsA<Widget>>(&self, widget: &P, x: i32, y: i32)403 fn move_<P: IsA<Widget>>(&self, widget: &P, x: i32, y: i32) { 404 unsafe { 405 ffi::gtk_fixed_move( 406 self.as_ref().to_glib_none().0, 407 widget.as_ref().to_glib_none().0, 408 x, 409 y, 410 ); 411 } 412 } 413 put<P: IsA<Widget>>(&self, widget: &P, x: i32, y: i32)414 fn put<P: IsA<Widget>>(&self, widget: &P, x: i32, y: i32) { 415 unsafe { 416 ffi::gtk_fixed_put( 417 self.as_ref().to_glib_none().0, 418 widget.as_ref().to_glib_none().0, 419 x, 420 y, 421 ); 422 } 423 } 424 } 425 426 impl fmt::Display for Fixed { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result427 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 428 f.write_str("Fixed") 429 } 430 } 431