forked from gtk-rs/gtk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
alignment.rs
164 lines (141 loc) · 5.75 KB
/
alignment.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
// This file was generated by gir (b7f5189) from gir-files (71d73f0)
// DO NOT EDIT
use Bin;
use Container;
use Widget;
use ffi;
use glib::Value;
use glib::object::Downcast;
use glib::translate::*;
use gobject_ffi;
use std::mem;
glib_wrapper! {
pub struct Alignment(Object<ffi::GtkAlignment>): Bin, Container, Widget;
match fn {
get_type => || ffi::gtk_alignment_get_type(),
}
}
impl Alignment {
pub fn new(xalign: f32, yalign: f32, xscale: f32, yscale: f32) -> Alignment {
assert_initialized_main_thread!();
unsafe {
Widget::from_glib_none(ffi::gtk_alignment_new(xalign, yalign, xscale, yscale)).downcast_unchecked()
}
}
pub fn get_padding(&self) -> (u32, u32, u32, u32) {
unsafe {
let mut padding_top = mem::uninitialized();
let mut padding_bottom = mem::uninitialized();
let mut padding_left = mem::uninitialized();
let mut padding_right = mem::uninitialized();
ffi::gtk_alignment_get_padding(self.to_glib_none().0, &mut padding_top, &mut padding_bottom, &mut padding_left, &mut padding_right);
(padding_top, padding_bottom, padding_left, padding_right)
}
}
pub fn set(&self, xalign: f32, yalign: f32, xscale: f32, yscale: f32) {
unsafe {
ffi::gtk_alignment_set(self.to_glib_none().0, xalign, yalign, xscale, yscale);
}
}
pub fn set_padding(&self, padding_top: u32, padding_bottom: u32, padding_left: u32, padding_right: u32) {
unsafe {
ffi::gtk_alignment_set_padding(self.to_glib_none().0, padding_top, padding_bottom, padding_left, padding_right);
}
}
pub fn get_property_bottom_padding(&self) -> u32 {
let mut value = Value::from(&0u32);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "bottom-padding".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
pub fn set_property_bottom_padding(&self, bottom_padding: u32) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "bottom-padding".to_glib_none().0, Value::from(&bottom_padding).to_glib_none().0);
}
}
pub fn get_property_left_padding(&self) -> u32 {
let mut value = Value::from(&0u32);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "left-padding".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
pub fn set_property_left_padding(&self, left_padding: u32) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "left-padding".to_glib_none().0, Value::from(&left_padding).to_glib_none().0);
}
}
pub fn get_property_right_padding(&self) -> u32 {
let mut value = Value::from(&0u32);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "right-padding".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
pub fn set_property_right_padding(&self, right_padding: u32) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "right-padding".to_glib_none().0, Value::from(&right_padding).to_glib_none().0);
}
}
pub fn get_property_top_padding(&self) -> u32 {
let mut value = Value::from(&0u32);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "top-padding".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
pub fn set_property_top_padding(&self, top_padding: u32) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "top-padding".to_glib_none().0, Value::from(&top_padding).to_glib_none().0);
}
}
pub fn get_property_xalign(&self) -> f32 {
let mut value = Value::from(&0f32);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "xalign".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
pub fn set_property_xalign(&self, xalign: f32) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "xalign".to_glib_none().0, Value::from(&xalign).to_glib_none().0);
}
}
pub fn get_property_xscale(&self) -> f32 {
let mut value = Value::from(&0f32);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "xscale".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
pub fn set_property_xscale(&self, xscale: f32) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "xscale".to_glib_none().0, Value::from(&xscale).to_glib_none().0);
}
}
pub fn get_property_yalign(&self) -> f32 {
let mut value = Value::from(&0f32);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "yalign".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
pub fn set_property_yalign(&self, yalign: f32) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "yalign".to_glib_none().0, Value::from(&yalign).to_glib_none().0);
}
}
pub fn get_property_yscale(&self) -> f32 {
let mut value = Value::from(&0f32);
unsafe {
gobject_ffi::g_object_get_property(self.to_glib_none().0, "yscale".to_glib_none().0, value.to_glib_none_mut().0);
}
value.get().unwrap()
}
pub fn set_property_yscale(&self, yscale: f32) {
unsafe {
gobject_ffi::g_object_set_property(self.to_glib_none().0, "yscale".to_glib_none().0, Value::from(&yscale).to_glib_none().0);
}
}
}