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; 7 use glib::object::Cast; 8 use glib::object::IsA; 9 use glib::translate::*; 10 use glib::StaticType; 11 use glib::ToValue; 12 use gtk_sys; 13 use std::fmt; 14 use Actionable; 15 use Align; 16 use Bin; 17 use Buildable; 18 use Container; 19 use RadioButton; 20 use ResizeMode; 21 use ToggleToolButton; 22 use ToolButton; 23 use ToolItem; 24 use Widget; 25 26 glib_wrapper! { 27 pub struct RadioToolButton(Object<gtk_sys::GtkRadioToolButton, gtk_sys::GtkRadioToolButtonClass, RadioToolButtonClass>) @extends ToggleToolButton, ToolButton, ToolItem, Bin, Container, Widget, @implements Buildable, Actionable; 28 29 match fn { 30 get_type => || gtk_sys::gtk_radio_tool_button_get_type(), 31 } 32 } 33 34 impl RadioToolButton { new_from_widget<P: IsA<RadioToolButton>>(group: &P) -> RadioToolButton35 pub fn new_from_widget<P: IsA<RadioToolButton>>(group: &P) -> RadioToolButton { 36 skip_assert_initialized!(); 37 unsafe { 38 ToolItem::from_glib_none(gtk_sys::gtk_radio_tool_button_new_from_widget( 39 group.as_ref().to_glib_none().0, 40 )) 41 .unsafe_cast() 42 } 43 } 44 } 45 46 #[derive(Clone, Default)] 47 pub struct RadioToolButtonBuilder { 48 active: Option<bool>, 49 icon_name: Option<String>, 50 icon_widget: Option<Widget>, 51 label: Option<String>, 52 label_widget: Option<Widget>, 53 use_underline: Option<bool>, 54 is_important: Option<bool>, 55 visible_horizontal: Option<bool>, 56 visible_vertical: Option<bool>, 57 border_width: Option<u32>, 58 child: Option<Widget>, 59 resize_mode: Option<ResizeMode>, 60 app_paintable: Option<bool>, 61 can_default: Option<bool>, 62 can_focus: Option<bool>, 63 events: Option<gdk::EventMask>, 64 expand: Option<bool>, 65 #[cfg(any(feature = "v3_20", feature = "dox"))] 66 focus_on_click: Option<bool>, 67 halign: Option<Align>, 68 has_default: Option<bool>, 69 has_focus: Option<bool>, 70 has_tooltip: Option<bool>, 71 height_request: Option<i32>, 72 hexpand: Option<bool>, 73 hexpand_set: Option<bool>, 74 is_focus: Option<bool>, 75 margin: Option<i32>, 76 margin_bottom: Option<i32>, 77 margin_end: Option<i32>, 78 margin_start: Option<i32>, 79 margin_top: Option<i32>, 80 name: Option<String>, 81 no_show_all: Option<bool>, 82 opacity: Option<f64>, 83 parent: Option<Container>, 84 receives_default: Option<bool>, 85 sensitive: Option<bool>, 86 tooltip_markup: Option<String>, 87 tooltip_text: Option<String>, 88 valign: Option<Align>, 89 vexpand: Option<bool>, 90 vexpand_set: Option<bool>, 91 visible: Option<bool>, 92 width_request: Option<i32>, 93 action_name: Option<String>, 94 action_target: Option<glib::Variant>, 95 } 96 97 impl RadioToolButtonBuilder { new() -> Self98 pub fn new() -> Self { 99 Self::default() 100 } 101 build(self) -> RadioToolButton102 pub fn build(self) -> RadioToolButton { 103 let mut properties: Vec<(&str, &dyn ToValue)> = vec![]; 104 if let Some(ref active) = self.active { 105 properties.push(("active", active)); 106 } 107 if let Some(ref icon_name) = self.icon_name { 108 properties.push(("icon-name", icon_name)); 109 } 110 if let Some(ref icon_widget) = self.icon_widget { 111 properties.push(("icon-widget", icon_widget)); 112 } 113 if let Some(ref label) = self.label { 114 properties.push(("label", label)); 115 } 116 if let Some(ref label_widget) = self.label_widget { 117 properties.push(("label-widget", label_widget)); 118 } 119 if let Some(ref use_underline) = self.use_underline { 120 properties.push(("use-underline", use_underline)); 121 } 122 if let Some(ref is_important) = self.is_important { 123 properties.push(("is-important", is_important)); 124 } 125 if let Some(ref visible_horizontal) = self.visible_horizontal { 126 properties.push(("visible-horizontal", visible_horizontal)); 127 } 128 if let Some(ref visible_vertical) = self.visible_vertical { 129 properties.push(("visible-vertical", visible_vertical)); 130 } 131 if let Some(ref border_width) = self.border_width { 132 properties.push(("border-width", border_width)); 133 } 134 if let Some(ref child) = self.child { 135 properties.push(("child", child)); 136 } 137 if let Some(ref resize_mode) = self.resize_mode { 138 properties.push(("resize-mode", resize_mode)); 139 } 140 if let Some(ref app_paintable) = self.app_paintable { 141 properties.push(("app-paintable", app_paintable)); 142 } 143 if let Some(ref can_default) = self.can_default { 144 properties.push(("can-default", can_default)); 145 } 146 if let Some(ref can_focus) = self.can_focus { 147 properties.push(("can-focus", can_focus)); 148 } 149 if let Some(ref events) = self.events { 150 properties.push(("events", events)); 151 } 152 if let Some(ref expand) = self.expand { 153 properties.push(("expand", expand)); 154 } 155 #[cfg(any(feature = "v3_20", feature = "dox"))] 156 { 157 if let Some(ref focus_on_click) = self.focus_on_click { 158 properties.push(("focus-on-click", focus_on_click)); 159 } 160 } 161 if let Some(ref halign) = self.halign { 162 properties.push(("halign", halign)); 163 } 164 if let Some(ref has_default) = self.has_default { 165 properties.push(("has-default", has_default)); 166 } 167 if let Some(ref has_focus) = self.has_focus { 168 properties.push(("has-focus", has_focus)); 169 } 170 if let Some(ref has_tooltip) = self.has_tooltip { 171 properties.push(("has-tooltip", has_tooltip)); 172 } 173 if let Some(ref height_request) = self.height_request { 174 properties.push(("height-request", height_request)); 175 } 176 if let Some(ref hexpand) = self.hexpand { 177 properties.push(("hexpand", hexpand)); 178 } 179 if let Some(ref hexpand_set) = self.hexpand_set { 180 properties.push(("hexpand-set", hexpand_set)); 181 } 182 if let Some(ref is_focus) = self.is_focus { 183 properties.push(("is-focus", is_focus)); 184 } 185 if let Some(ref margin) = self.margin { 186 properties.push(("margin", margin)); 187 } 188 if let Some(ref margin_bottom) = self.margin_bottom { 189 properties.push(("margin-bottom", margin_bottom)); 190 } 191 if let Some(ref margin_end) = self.margin_end { 192 properties.push(("margin-end", margin_end)); 193 } 194 if let Some(ref margin_start) = self.margin_start { 195 properties.push(("margin-start", margin_start)); 196 } 197 if let Some(ref margin_top) = self.margin_top { 198 properties.push(("margin-top", margin_top)); 199 } 200 if let Some(ref name) = self.name { 201 properties.push(("name", name)); 202 } 203 if let Some(ref no_show_all) = self.no_show_all { 204 properties.push(("no-show-all", no_show_all)); 205 } 206 if let Some(ref opacity) = self.opacity { 207 properties.push(("opacity", opacity)); 208 } 209 if let Some(ref parent) = self.parent { 210 properties.push(("parent", parent)); 211 } 212 if let Some(ref receives_default) = self.receives_default { 213 properties.push(("receives-default", receives_default)); 214 } 215 if let Some(ref sensitive) = self.sensitive { 216 properties.push(("sensitive", sensitive)); 217 } 218 if let Some(ref tooltip_markup) = self.tooltip_markup { 219 properties.push(("tooltip-markup", tooltip_markup)); 220 } 221 if let Some(ref tooltip_text) = self.tooltip_text { 222 properties.push(("tooltip-text", tooltip_text)); 223 } 224 if let Some(ref valign) = self.valign { 225 properties.push(("valign", valign)); 226 } 227 if let Some(ref vexpand) = self.vexpand { 228 properties.push(("vexpand", vexpand)); 229 } 230 if let Some(ref vexpand_set) = self.vexpand_set { 231 properties.push(("vexpand-set", vexpand_set)); 232 } 233 if let Some(ref visible) = self.visible { 234 properties.push(("visible", visible)); 235 } 236 if let Some(ref width_request) = self.width_request { 237 properties.push(("width-request", width_request)); 238 } 239 if let Some(ref action_name) = self.action_name { 240 properties.push(("action-name", action_name)); 241 } 242 if let Some(ref action_target) = self.action_target { 243 properties.push(("action-target", action_target)); 244 } 245 glib::Object::new(RadioToolButton::static_type(), &properties) 246 .expect("object new") 247 .downcast() 248 .expect("downcast") 249 } 250 active(mut self, active: bool) -> Self251 pub fn active(mut self, active: bool) -> Self { 252 self.active = Some(active); 253 self 254 } 255 icon_name(mut self, icon_name: &str) -> Self256 pub fn icon_name(mut self, icon_name: &str) -> Self { 257 self.icon_name = Some(icon_name.to_string()); 258 self 259 } 260 icon_widget<P: IsA<Widget>>(mut self, icon_widget: &P) -> Self261 pub fn icon_widget<P: IsA<Widget>>(mut self, icon_widget: &P) -> Self { 262 self.icon_widget = Some(icon_widget.clone().upcast()); 263 self 264 } 265 label(mut self, label: &str) -> Self266 pub fn label(mut self, label: &str) -> Self { 267 self.label = Some(label.to_string()); 268 self 269 } 270 label_widget<P: IsA<Widget>>(mut self, label_widget: &P) -> Self271 pub fn label_widget<P: IsA<Widget>>(mut self, label_widget: &P) -> Self { 272 self.label_widget = Some(label_widget.clone().upcast()); 273 self 274 } 275 use_underline(mut self, use_underline: bool) -> Self276 pub fn use_underline(mut self, use_underline: bool) -> Self { 277 self.use_underline = Some(use_underline); 278 self 279 } 280 is_important(mut self, is_important: bool) -> Self281 pub fn is_important(mut self, is_important: bool) -> Self { 282 self.is_important = Some(is_important); 283 self 284 } 285 visible_horizontal(mut self, visible_horizontal: bool) -> Self286 pub fn visible_horizontal(mut self, visible_horizontal: bool) -> Self { 287 self.visible_horizontal = Some(visible_horizontal); 288 self 289 } 290 visible_vertical(mut self, visible_vertical: bool) -> Self291 pub fn visible_vertical(mut self, visible_vertical: bool) -> Self { 292 self.visible_vertical = Some(visible_vertical); 293 self 294 } 295 border_width(mut self, border_width: u32) -> Self296 pub fn border_width(mut self, border_width: u32) -> Self { 297 self.border_width = Some(border_width); 298 self 299 } 300 child<P: IsA<Widget>>(mut self, child: &P) -> Self301 pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self { 302 self.child = Some(child.clone().upcast()); 303 self 304 } 305 resize_mode(mut self, resize_mode: ResizeMode) -> Self306 pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self { 307 self.resize_mode = Some(resize_mode); 308 self 309 } 310 app_paintable(mut self, app_paintable: bool) -> Self311 pub fn app_paintable(mut self, app_paintable: bool) -> Self { 312 self.app_paintable = Some(app_paintable); 313 self 314 } 315 can_default(mut self, can_default: bool) -> Self316 pub fn can_default(mut self, can_default: bool) -> Self { 317 self.can_default = Some(can_default); 318 self 319 } 320 can_focus(mut self, can_focus: bool) -> Self321 pub fn can_focus(mut self, can_focus: bool) -> Self { 322 self.can_focus = Some(can_focus); 323 self 324 } 325 events(mut self, events: gdk::EventMask) -> Self326 pub fn events(mut self, events: gdk::EventMask) -> Self { 327 self.events = Some(events); 328 self 329 } 330 expand(mut self, expand: bool) -> Self331 pub fn expand(mut self, expand: bool) -> Self { 332 self.expand = Some(expand); 333 self 334 } 335 336 #[cfg(any(feature = "v3_20", feature = "dox"))] focus_on_click(mut self, focus_on_click: bool) -> Self337 pub fn focus_on_click(mut self, focus_on_click: bool) -> Self { 338 self.focus_on_click = Some(focus_on_click); 339 self 340 } 341 halign(mut self, halign: Align) -> Self342 pub fn halign(mut self, halign: Align) -> Self { 343 self.halign = Some(halign); 344 self 345 } 346 has_default(mut self, has_default: bool) -> Self347 pub fn has_default(mut self, has_default: bool) -> Self { 348 self.has_default = Some(has_default); 349 self 350 } 351 has_focus(mut self, has_focus: bool) -> Self352 pub fn has_focus(mut self, has_focus: bool) -> Self { 353 self.has_focus = Some(has_focus); 354 self 355 } 356 has_tooltip(mut self, has_tooltip: bool) -> Self357 pub fn has_tooltip(mut self, has_tooltip: bool) -> Self { 358 self.has_tooltip = Some(has_tooltip); 359 self 360 } 361 height_request(mut self, height_request: i32) -> Self362 pub fn height_request(mut self, height_request: i32) -> Self { 363 self.height_request = Some(height_request); 364 self 365 } 366 hexpand(mut self, hexpand: bool) -> Self367 pub fn hexpand(mut self, hexpand: bool) -> Self { 368 self.hexpand = Some(hexpand); 369 self 370 } 371 hexpand_set(mut self, hexpand_set: bool) -> Self372 pub fn hexpand_set(mut self, hexpand_set: bool) -> Self { 373 self.hexpand_set = Some(hexpand_set); 374 self 375 } 376 is_focus(mut self, is_focus: bool) -> Self377 pub fn is_focus(mut self, is_focus: bool) -> Self { 378 self.is_focus = Some(is_focus); 379 self 380 } 381 margin(mut self, margin: i32) -> Self382 pub fn margin(mut self, margin: i32) -> Self { 383 self.margin = Some(margin); 384 self 385 } 386 margin_bottom(mut self, margin_bottom: i32) -> Self387 pub fn margin_bottom(mut self, margin_bottom: i32) -> Self { 388 self.margin_bottom = Some(margin_bottom); 389 self 390 } 391 margin_end(mut self, margin_end: i32) -> Self392 pub fn margin_end(mut self, margin_end: i32) -> Self { 393 self.margin_end = Some(margin_end); 394 self 395 } 396 margin_start(mut self, margin_start: i32) -> Self397 pub fn margin_start(mut self, margin_start: i32) -> Self { 398 self.margin_start = Some(margin_start); 399 self 400 } 401 margin_top(mut self, margin_top: i32) -> Self402 pub fn margin_top(mut self, margin_top: i32) -> Self { 403 self.margin_top = Some(margin_top); 404 self 405 } 406 name(mut self, name: &str) -> Self407 pub fn name(mut self, name: &str) -> Self { 408 self.name = Some(name.to_string()); 409 self 410 } 411 no_show_all(mut self, no_show_all: bool) -> Self412 pub fn no_show_all(mut self, no_show_all: bool) -> Self { 413 self.no_show_all = Some(no_show_all); 414 self 415 } 416 opacity(mut self, opacity: f64) -> Self417 pub fn opacity(mut self, opacity: f64) -> Self { 418 self.opacity = Some(opacity); 419 self 420 } 421 parent<P: IsA<Container>>(mut self, parent: &P) -> Self422 pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self { 423 self.parent = Some(parent.clone().upcast()); 424 self 425 } 426 receives_default(mut self, receives_default: bool) -> Self427 pub fn receives_default(mut self, receives_default: bool) -> Self { 428 self.receives_default = Some(receives_default); 429 self 430 } 431 sensitive(mut self, sensitive: bool) -> Self432 pub fn sensitive(mut self, sensitive: bool) -> Self { 433 self.sensitive = Some(sensitive); 434 self 435 } 436 tooltip_markup(mut self, tooltip_markup: &str) -> Self437 pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self { 438 self.tooltip_markup = Some(tooltip_markup.to_string()); 439 self 440 } 441 tooltip_text(mut self, tooltip_text: &str) -> Self442 pub fn tooltip_text(mut self, tooltip_text: &str) -> Self { 443 self.tooltip_text = Some(tooltip_text.to_string()); 444 self 445 } 446 valign(mut self, valign: Align) -> Self447 pub fn valign(mut self, valign: Align) -> Self { 448 self.valign = Some(valign); 449 self 450 } 451 vexpand(mut self, vexpand: bool) -> Self452 pub fn vexpand(mut self, vexpand: bool) -> Self { 453 self.vexpand = Some(vexpand); 454 self 455 } 456 vexpand_set(mut self, vexpand_set: bool) -> Self457 pub fn vexpand_set(mut self, vexpand_set: bool) -> Self { 458 self.vexpand_set = Some(vexpand_set); 459 self 460 } 461 visible(mut self, visible: bool) -> Self462 pub fn visible(mut self, visible: bool) -> Self { 463 self.visible = Some(visible); 464 self 465 } 466 width_request(mut self, width_request: i32) -> Self467 pub fn width_request(mut self, width_request: i32) -> Self { 468 self.width_request = Some(width_request); 469 self 470 } 471 action_name(mut self, action_name: &str) -> Self472 pub fn action_name(mut self, action_name: &str) -> Self { 473 self.action_name = Some(action_name.to_string()); 474 self 475 } 476 action_target(mut self, action_target: &glib::Variant) -> Self477 pub fn action_target(mut self, action_target: &glib::Variant) -> Self { 478 self.action_target = Some(action_target.clone()); 479 self 480 } 481 } 482 483 pub const NONE_RADIO_TOOL_BUTTON: Option<&RadioToolButton> = None; 484 485 pub trait RadioToolButtonExt: 'static { get_group(&self) -> Vec<RadioButton>486 fn get_group(&self) -> Vec<RadioButton>; 487 } 488 489 impl<O: IsA<RadioToolButton>> RadioToolButtonExt for O { get_group(&self) -> Vec<RadioButton>490 fn get_group(&self) -> Vec<RadioButton> { 491 unsafe { 492 FromGlibPtrContainer::from_glib_none(gtk_sys::gtk_radio_tool_button_get_group( 493 self.as_ref().to_glib_none().0, 494 )) 495 } 496 } 497 } 498 499 impl fmt::Display for RadioToolButton { fmt(&self, f: &mut fmt::Formatter) -> fmt::Result500 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { 501 write!(f, "RadioToolButton") 502 } 503 } 504