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
165
166
167
168
169
use crate::AnchorHints;
use crate::Gravity;
use crate::Rectangle;
use glib::translate::*;
#[cfg(any(feature = "v4_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v4_2")))]
use std::mem;
glib::wrapper! {
#[derive(Debug, PartialOrd, Ord, Hash)]
pub struct PopupLayout(Shared<ffi::GdkPopupLayout>);
match fn {
ref => |ptr| ffi::gdk_popup_layout_ref(ptr),
unref => |ptr| ffi::gdk_popup_layout_unref(ptr),
type_ => || ffi::gdk_popup_layout_get_type(),
}
}
impl PopupLayout {
#[doc(alias = "gdk_popup_layout_new")]
pub fn new(
anchor_rect: &Rectangle,
rect_anchor: Gravity,
surface_anchor: Gravity,
) -> PopupLayout {
assert_initialized_main_thread!();
unsafe {
from_glib_full(ffi::gdk_popup_layout_new(
anchor_rect.to_glib_none().0,
rect_anchor.into_glib(),
surface_anchor.into_glib(),
))
}
}
#[doc(alias = "gdk_popup_layout_copy")]
#[must_use]
pub fn copy(&self) -> PopupLayout {
unsafe { from_glib_full(ffi::gdk_popup_layout_copy(self.to_glib_none().0)) }
}
#[doc(alias = "gdk_popup_layout_equal")]
fn equal(&self, other: &PopupLayout) -> bool {
unsafe {
from_glib(ffi::gdk_popup_layout_equal(
self.to_glib_none().0,
other.to_glib_none().0,
))
}
}
#[doc(alias = "gdk_popup_layout_get_anchor_hints")]
#[doc(alias = "get_anchor_hints")]
pub fn anchor_hints(&self) -> AnchorHints {
unsafe {
from_glib(ffi::gdk_popup_layout_get_anchor_hints(
self.to_glib_none().0,
))
}
}
#[doc(alias = "gdk_popup_layout_get_anchor_rect")]
#[doc(alias = "get_anchor_rect")]
pub fn anchor_rect(&self) -> Rectangle {
unsafe { from_glib_none(ffi::gdk_popup_layout_get_anchor_rect(self.to_glib_none().0)) }
}
#[doc(alias = "gdk_popup_layout_get_rect_anchor")]
#[doc(alias = "get_rect_anchor")]
pub fn rect_anchor(&self) -> Gravity {
unsafe { from_glib(ffi::gdk_popup_layout_get_rect_anchor(self.to_glib_none().0)) }
}
#[cfg(any(feature = "v4_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v4_2")))]
#[doc(alias = "gdk_popup_layout_get_shadow_width")]
#[doc(alias = "get_shadow_width")]
pub fn shadow_width(&self) -> (i32, i32, i32, i32) {
unsafe {
let mut left = mem::MaybeUninit::uninit();
let mut right = mem::MaybeUninit::uninit();
let mut top = mem::MaybeUninit::uninit();
let mut bottom = mem::MaybeUninit::uninit();
ffi::gdk_popup_layout_get_shadow_width(
self.to_glib_none().0,
left.as_mut_ptr(),
right.as_mut_ptr(),
top.as_mut_ptr(),
bottom.as_mut_ptr(),
);
let left = left.assume_init();
let right = right.assume_init();
let top = top.assume_init();
let bottom = bottom.assume_init();
(left, right, top, bottom)
}
}
#[doc(alias = "gdk_popup_layout_get_surface_anchor")]
#[doc(alias = "get_surface_anchor")]
pub fn surface_anchor(&self) -> Gravity {
unsafe {
from_glib(ffi::gdk_popup_layout_get_surface_anchor(
self.to_glib_none().0,
))
}
}
#[doc(alias = "gdk_popup_layout_set_anchor_hints")]
pub fn set_anchor_hints(&self, anchor_hints: AnchorHints) {
unsafe {
ffi::gdk_popup_layout_set_anchor_hints(self.to_glib_none().0, anchor_hints.into_glib());
}
}
#[doc(alias = "gdk_popup_layout_set_anchor_rect")]
pub fn set_anchor_rect(&self, anchor_rect: &Rectangle) {
unsafe {
ffi::gdk_popup_layout_set_anchor_rect(
self.to_glib_none().0,
anchor_rect.to_glib_none().0,
);
}
}
#[doc(alias = "gdk_popup_layout_set_offset")]
pub fn set_offset(&self, dx: i32, dy: i32) {
unsafe {
ffi::gdk_popup_layout_set_offset(self.to_glib_none().0, dx, dy);
}
}
#[doc(alias = "gdk_popup_layout_set_rect_anchor")]
pub fn set_rect_anchor(&self, anchor: Gravity) {
unsafe {
ffi::gdk_popup_layout_set_rect_anchor(self.to_glib_none().0, anchor.into_glib());
}
}
#[cfg(any(feature = "v4_2", feature = "dox"))]
#[cfg_attr(feature = "dox", doc(cfg(feature = "v4_2")))]
#[doc(alias = "gdk_popup_layout_set_shadow_width")]
pub fn set_shadow_width(&self, left: i32, right: i32, top: i32, bottom: i32) {
unsafe {
ffi::gdk_popup_layout_set_shadow_width(self.to_glib_none().0, left, right, top, bottom);
}
}
#[doc(alias = "gdk_popup_layout_set_surface_anchor")]
pub fn set_surface_anchor(&self, anchor: Gravity) {
unsafe {
ffi::gdk_popup_layout_set_surface_anchor(self.to_glib_none().0, anchor.into_glib());
}
}
}
impl PartialEq for PopupLayout {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.equal(other)
}
}
impl Eq for PopupLayout {}