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 gdk; 6 use glib::object::Cast; 7 use glib::object::IsA; 8 use glib::translate::*; 9 use glib::StaticType; 10 use glib::ToValue; 11 use gtk_sys; 12 use std::fmt; 13 use Adjustment; 14 use Align; 15 use Buildable; 16 use Container; 17 use Orientable; 18 use Orientation; 19 use Range; 20 use SensitivityType; 21 use Widget; 22 23 glib_wrapper! { 24 pub struct Scrollbar(Object<gtk_sys::GtkScrollbar, gtk_sys::GtkScrollbarClass, ScrollbarClass>) @extends Range, Widget, @implements Buildable, Orientable; 25 26 match fn { 27 get_type => || gtk_sys::gtk_scrollbar_get_type(), 28 } 29 } 30 31 impl Scrollbar { new<P: IsA<Adjustment>>(orientation: Orientation, adjustment: Option<&P>) -> Scrollbar32 pub fn new<P: IsA<Adjustment>>(orientation: Orientation, adjustment: Option<&P>) -> Scrollbar { 33 assert_initialized_main_thread!(); 34 unsafe { 35 Widget::from_glib_none(gtk_sys::gtk_scrollbar_new( 36 orientation.to_glib(), 37 adjustment.map(|p| p.as_ref()).to_glib_none().0, 38 )) 39 .unsafe_cast() 40 } 41 } 42 } 43 44 #[derive(Clone, Default)] 45 pub struct ScrollbarBuilder { 46 adjustment: Option<Adjustment>, 47 fill_level: Option<f64>, 48 inverted: Option<bool>, 49 lower_stepper_sensitivity: Option<SensitivityType>, 50 restrict_to_fill_level: Option<bool>, 51 round_digits: Option<i32>, 52 show_fill_level: Option<bool>, 53 upper_stepper_sensitivity: Option<SensitivityType>, 54 app_paintable: Option<bool>, 55 can_default: Option<bool>, 56 can_focus: Option<bool>, 57 events: Option<gdk::EventMask>, 58 expand: Option<bool>, 59 #[cfg(any(feature = "v3_20", feature = "dox"))] 60 focus_on_click: Option<bool>, 61 halign: Option<Align>, 62 has_default: Option<bool>, 63 has_focus: Option<bool>, 64 has_tooltip: Option<bool>, 65 height_request: Option<i32>, 66 hexpand: Option<bool>, 67 hexpand_set: Option<bool>, 68 is_focus: Option<bool>, 69 margin: Option<i32>, 70 margin_bottom: Option<i32>, 71 margin_end: Option<i32>, 72 margin_start: Option<i32>, 73 margin_top: Option<i32>, 74 name: Option<String>, 75 no_show_all: Option<bool>, 76 opacity: Option<f64>, 77 parent: Option<Container>, 78 receives_default: Option<bool>, 79 sensitive: Option<bool>, 80 tooltip_markup: Option<String>, 81 tooltip_text: Option<String>, 82 valign: Option<Align>, 83 vexpand: Option<bool>, 84 vexpand_set: Option<bool>, 85 visible: Option<bool>, 86 width_request: Option<i32>, 87 orientation: Option<Orientation>, 88 } 89 90 impl ScrollbarBuilder { new() -> Self91 pub fn new() -> Self { 92 Self::default() 93 } 94 build(self) -> Scrollbar95 pub fn build(self) -> Scrollbar { 96 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 97 if let Some(ref adjustment) = self.adjustment { 98 properties.push(("adjustment", adjustment)); 99 } 100 if let Some(ref fill_level) = self.fill_level { 101 properties.push(("fill-level", fill_level)); 102 } 103 if let Some(ref inverted) = self.inverted { 104 properties.push(("inverted", inverted)); 105 } 106 if let Some(ref lower_stepper_sensitivity) = self.lower_stepper_sensitivity { 107 properties.push(("lower-stepper-sensitivity", lower_stepper_sensitivity)); 108 } 109 if let Some(ref restrict_to_fill_level) = self.restrict_to_fill_level { 110 properties.push(("restrict-to-fill-level", restrict_to_fill_level)); 111 } 112 if let Some(ref round_digits) = self.round_digits { 113 properties.push(("round-digits", round_digits)); 114 } 115 if let Some(ref show_fill_level) = self.show_fill_level { 116 properties.push(("show-fill-level", show_fill_level)); 117 } 118 if let Some(ref upper_stepper_sensitivity) = self.upper_stepper_sensitivity { 119 properties.push(("upper-stepper-sensitivity", upper_stepper_sensitivity)); 120 } 121 if let Some(ref app_paintable) = self.app_paintable { 122 properties.push(("app-paintable", app_paintable)); 123 } 124 if let Some(ref can_default) = self.can_default { 125 properties.push(("can-default", can_default)); 126 } 127 if let Some(ref can_focus) = self.can_focus { 128 properties.push(("can-focus", can_focus)); 129 } 130 if let Some(ref events) = self.events { 131 properties.push(("events", events)); 132 } 133 if let Some(ref expand) = self.expand { 134 properties.push(("expand", expand)); 135 } 136 #[cfg(any(feature = "v3_20", feature = "dox"))] 137 { 138 if let Some(ref focus_on_click) = self.focus_on_click { 139 properties.push(("focus-on-click", focus_on_click)); 140 } 141 } 142 if let Some(ref halign) = self.halign { 143 properties.push(("halign", halign)); 144 } 145 if let Some(ref has_default) = self.has_default { 146 properties.push(("has-default", has_default)); 147 } 148 if let Some(ref has_focus) = self.has_focus { 149 properties.push(("has-focus", has_focus)); 150 } 151 if let Some(ref has_tooltip) = self.has_tooltip { 152 properties.push(("has-tooltip", has_tooltip)); 153 } 154 if let Some(ref height_request) = self.height_request { 155 properties.push(("height-request", height_request)); 156 } 157 if let Some(ref hexpand) = self.hexpand { 158 properties.push(("hexpand", hexpand)); 159 } 160 if let Some(ref hexpand_set) = self.hexpand_set { 161 properties.push(("hexpand-set", hexpand_set)); 162 } 163 if let Some(ref is_focus) = self.is_focus { 164 properties.push(("is-focus", is_focus)); 165 } 166 if let Some(ref margin) = self.margin { 167 properties.push(("margin", margin)); 168 } 169 if let Some(ref margin_bottom) = self.margin_bottom { 170 properties.push(("margin-bottom", margin_bottom)); 171 } 172 if let Some(ref margin_end) = self.margin_end { 173 properties.push(("margin-end", margin_end)); 174 } 175 if let Some(ref margin_start) = self.margin_start { 176 properties.push(("margin-start", margin_start)); 177 } 178 if let Some(ref margin_top) = self.margin_top { 179 properties.push(("margin-top", margin_top)); 180 } 181 if let Some(ref name) = self.name { 182 properties.push(("name", name)); 183 } 184 if let Some(ref no_show_all) = self.no_show_all { 185 properties.push(("no-show-all", no_show_all)); 186 } 187 if let Some(ref opacity) = self.opacity { 188 properties.push(("opacity", opacity)); 189 } 190 if let Some(ref parent) = self.parent { 191 properties.push(("parent", parent)); 192 } 193 if let Some(ref receives_default) = self.receives_default { 194 properties.push(("receives-default", receives_default)); 195 } 196 if let Some(ref sensitive) = self.sensitive { 197 properties.push(("sensitive", sensitive)); 198 } 199 if let Some(ref tooltip_markup) = self.tooltip_markup { 200 properties.push(("tooltip-markup", tooltip_markup)); 201 } 202 if let Some(ref tooltip_text) = self.tooltip_text { 203 properties.push(("tooltip-text", tooltip_text)); 204 } 205 if let Some(ref valign) = self.valign { 206 properties.push(("valign", valign)); 207 } 208 if let Some(ref vexpand) = self.vexpand { 209 properties.push(("vexpand", vexpand)); 210 } 211 if let Some(ref vexpand_set) = self.vexpand_set { 212 properties.push(("vexpand-set", vexpand_set)); 213 } 214 if let Some(ref visible) = self.visible { 215 properties.push(("visible", visible)); 216 } 217 if let Some(ref width_request) = self.width_request { 218 properties.push(("width-request", width_request)); 219 } 220 if let Some(ref orientation) = self.orientation { 221 properties.push(("orientation", orientation)); 222 } 223 glib::Object::new(Scrollbar::static_type(), &properties) 224 .expect("object new") 225 .downcast() 226 .expect("downcast") 227 } 228 adjustment<P: IsA<Adjustment>>(mut self, adjustment: &P) -> Self229 pub fn adjustment<P: IsA<Adjustment>>(mut self, adjustment: &P) -> Self { 230 self.adjustment = Some(adjustment.clone().upcast()); 231 self 232 } 233 fill_level(mut self, fill_level: f64) -> Self234 pub fn fill_level(mut self, fill_level: f64) -> Self { 235 self.fill_level = Some(fill_level); 236 self 237 } 238 inverted(mut self, inverted: bool) -> Self239 pub fn inverted(mut self, inverted: bool) -> Self { 240 self.inverted = Some(inverted); 241 self 242 } 243 lower_stepper_sensitivity(mut self, lower_stepper_sensitivity: SensitivityType) -> Self244 pub fn lower_stepper_sensitivity(mut self, lower_stepper_sensitivity: SensitivityType) -> Self { 245 self.lower_stepper_sensitivity = Some(lower_stepper_sensitivity); 246 self 247 } 248 restrict_to_fill_level(mut self, restrict_to_fill_level: bool) -> Self249 pub fn restrict_to_fill_level(mut self, restrict_to_fill_level: bool) -> Self { 250 self.restrict_to_fill_level = Some(restrict_to_fill_level); 251 self 252 } 253 round_digits(mut self, round_digits: i32) -> Self254 pub fn round_digits(mut self, round_digits: i32) -> Self { 255 self.round_digits = Some(round_digits); 256 self 257 } 258 show_fill_level(mut self, show_fill_level: bool) -> Self259 pub fn show_fill_level(mut self, show_fill_level: bool) -> Self { 260 self.show_fill_level = Some(show_fill_level); 261 self 262 } 263 upper_stepper_sensitivity(mut self, upper_stepper_sensitivity: SensitivityType) -> Self264 pub fn upper_stepper_sensitivity(mut self, upper_stepper_sensitivity: SensitivityType) -> Self { 265 self.upper_stepper_sensitivity = Some(upper_stepper_sensitivity); 266 self 267 } 268 app_paintable(mut self, app_paintable: bool) -> Self269 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 270 self.app_paintable = Some(app_paintable); 271 self 272 } 273 can_default(mut self, can_default: bool) -> Self274 pub fn can_default(mut self, can_default: bool) -> Self { 275 self.can_default = Some(can_default); 276 self 277 } 278 can_focus(mut self, can_focus: bool) -> Self279 pub fn can_focus(mut self, can_focus: bool) -> Self { 280 self.can_focus = Some(can_focus); 281 self 282 } 283 events(mut self, events: gdk::EventMask) -> Self284 pub fn events(mut self, events: gdk::EventMask) -> Self { 285 self.events = Some(events); 286 self 287 } 288 expand(mut self, expand: bool) -> Self289 pub fn expand(mut self, expand: bool) -> Self { 290 self.expand = Some(expand); 291 self 292 } 293 294 #[cfg(any(feature = "v3_20", feature = "dox"))] focus_on_click(mut self, focus_on_click: bool) -> Self295 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 296 self.focus_on_click = Some(focus_on_click); 297 self 298 } 299 halign(mut self, halign: Align) -> Self300 pub fn halign(mut self, halign: Align) -> Self { 301 self.halign = Some(halign); 302 self 303 } 304 has_default(mut self, has_default: bool) -> Self305 pub fn has_default(mut self, has_default: bool) -> Self { 306 self.has_default = Some(has_default); 307 self 308 } 309 has_focus(mut self, has_focus: bool) -> Self310 pub fn has_focus(mut self, has_focus: bool) -> Self { 311 self.has_focus = Some(has_focus); 312 self 313 } 314 has_tooltip(mut self, has_tooltip: bool) -> Self315 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 316 self.has_tooltip = Some(has_tooltip); 317 self 318 } 319 height_request(mut self, height_request: i32) -> Self320 pub fn height_request(mut self, height_request: i32) -> Self { 321 self.height_request = Some(height_request); 322 self 323 } 324 hexpand(mut self, hexpand: bool) -> Self325 pub fn hexpand(mut self, hexpand: bool) -> Self { 326 self.hexpand = Some(hexpand); 327 self 328 } 329 hexpand_set(mut self, hexpand_set: bool) -> Self330 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 331 self.hexpand_set = Some(hexpand_set); 332 self 333 } 334 is_focus(mut self, is_focus: bool) -> Self335 pub fn is_focus(mut self, is_focus: bool) -> Self { 336 self.is_focus = Some(is_focus); 337 self 338 } 339 margin(mut self, margin: i32) -> Self340 pub fn margin(mut self, margin: i32) -> Self { 341 self.margin = Some(margin); 342 self 343 } 344 margin_bottom(mut self, margin_bottom: i32) -> Self345 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 346 self.margin_bottom = Some(margin_bottom); 347 self 348 } 349 margin_end(mut self, margin_end: i32) -> Self350 pub fn margin_end(mut self, margin_end: i32) -> Self { 351 self.margin_end = Some(margin_end); 352 self 353 } 354 margin_start(mut self, margin_start: i32) -> Self355 pub fn margin_start(mut self, margin_start: i32) -> Self { 356 self.margin_start = Some(margin_start); 357 self 358 } 359 margin_top(mut self, margin_top: i32) -> Self360 pub fn margin_top(mut self, margin_top: i32) -> Self { 361 self.margin_top = Some(margin_top); 362 self 363 } 364 name(mut self, name: &str) -> Self365 pub fn name(mut self, name: &str) -> Self { 366 self.name = Some(name.to_string()); 367 self 368 } 369 no_show_all(mut self, no_show_all: bool) -> Self370 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 371 self.no_show_all = Some(no_show_all); 372 self 373 } 374 opacity(mut self, opacity: f64) -> Self375 pub fn opacity(mut self, opacity: f64) -> Self { 376 self.opacity = Some(opacity); 377 self 378 } 379 parent<P: IsA<Container>>(mut self, parent: &P) -> Self380 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 381 self.parent = Some(parent.clone().upcast()); 382 self 383 } 384 receives_default(mut self, receives_default: bool) -> Self385 pub fn receives_default(mut self, receives_default: bool) -> Self { 386 self.receives_default = Some(receives_default); 387 self 388 } 389 sensitive(mut self, sensitive: bool) -> Self390 pub fn sensitive(mut self, sensitive: bool) -> Self { 391 self.sensitive = Some(sensitive); 392 self 393 } 394 tooltip_markup(mut self, tooltip_markup: &str) -> Self395 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 396 self.tooltip_markup = Some(tooltip_markup.to_string()); 397 self 398 } 399 tooltip_text(mut self, tooltip_text: &str) -> Self400 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 401 self.tooltip_text = Some(tooltip_text.to_string()); 402 self 403 } 404 valign(mut self, valign: Align) -> Self405 pub fn valign(mut self, valign: Align) -> Self { 406 self.valign = Some(valign); 407 self 408 } 409 vexpand(mut self, vexpand: bool) -> Self410 pub fn vexpand(mut self, vexpand: bool) -> Self { 411 self.vexpand = Some(vexpand); 412 self 413 } 414 vexpand_set(mut self, vexpand_set: bool) -> Self415 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 416 self.vexpand_set = Some(vexpand_set); 417 self 418 } 419 visible(mut self, visible: bool) -> Self420 pub fn visible(mut self, visible: bool) -> Self { 421 self.visible = Some(visible); 422 self 423 } 424 width_request(mut self, width_request: i32) -> Self425 pub fn width_request(mut self, width_request: i32) -> Self { 426 self.width_request = Some(width_request); 427 self 428 } 429 orientation(mut self, orientation: Orientation) -> Self430 pub fn orientation(mut self, orientation: Orientation) -> Self { 431 self.orientation = Some(orientation); 432 self 433 } 434 } 435 436 pub const NONE_SCROLLBAR: Option<&Scrollbar> = None; 437 438 impl fmt::Display for Scrollbar { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result439 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 440 write!(f, "Scrollbar") 441 } 442 } 443