1use crate::{ffi, Widget};
6use glib::{
7 prelude::*,
8 signal::{connect_raw, SignalHandlerId},
9 translate::*,
10};
11use std::boxed::Box as Box_;
12
13glib::wrapper! {
14 #[doc(alias = "GtkNotebookPage")]
82 pub struct NotebookPage(Object<ffi::GtkNotebookPage>);
83
84 match fn {
85 type_ => || ffi::gtk_notebook_page_get_type(),
86 }
87}
88
89impl NotebookPage {
90 #[doc(alias = "gtk_notebook_page_get_child")]
96 #[doc(alias = "get_child")]
97 pub fn child(&self) -> Widget {
98 unsafe { from_glib_none(ffi::gtk_notebook_page_get_child(self.to_glib_none().0)) }
99 }
100
101 pub fn is_detachable(&self) -> bool {
103 ObjectExt::property(self, "detachable")
104 }
105
106 pub fn set_detachable(&self, detachable: bool) {
108 ObjectExt::set_property(self, "detachable", detachable)
109 }
110
111 pub fn menu(&self) -> Option<Widget> {
113 ObjectExt::property(self, "menu")
114 }
115
116 #[doc(alias = "menu-label")]
118 pub fn menu_label(&self) -> Option<glib::GString> {
119 ObjectExt::property(self, "menu-label")
120 }
121
122 #[doc(alias = "menu-label")]
124 pub fn set_menu_label(&self, menu_label: Option<&str>) {
125 ObjectExt::set_property(self, "menu-label", menu_label)
126 }
127
128 pub fn position(&self) -> i32 {
130 ObjectExt::property(self, "position")
131 }
132
133 pub fn set_position(&self, position: i32) {
135 ObjectExt::set_property(self, "position", position)
136 }
137
138 pub fn is_reorderable(&self) -> bool {
140 ObjectExt::property(self, "reorderable")
141 }
142
143 pub fn set_reorderable(&self, reorderable: bool) {
145 ObjectExt::set_property(self, "reorderable", reorderable)
146 }
147
148 pub fn tab(&self) -> Option<Widget> {
150 ObjectExt::property(self, "tab")
151 }
152
153 #[doc(alias = "tab-expand")]
155 pub fn is_tab_expand(&self) -> bool {
156 ObjectExt::property(self, "tab-expand")
157 }
158
159 #[doc(alias = "tab-expand")]
161 pub fn set_tab_expand(&self, tab_expand: bool) {
162 ObjectExt::set_property(self, "tab-expand", tab_expand)
163 }
164
165 #[doc(alias = "tab-fill")]
167 pub fn is_tab_fill(&self) -> bool {
168 ObjectExt::property(self, "tab-fill")
169 }
170
171 #[doc(alias = "tab-fill")]
173 pub fn set_tab_fill(&self, tab_fill: bool) {
174 ObjectExt::set_property(self, "tab-fill", tab_fill)
175 }
176
177 #[doc(alias = "tab-label")]
179 pub fn tab_label(&self) -> Option<glib::GString> {
180 ObjectExt::property(self, "tab-label")
181 }
182
183 #[doc(alias = "tab-label")]
185 pub fn set_tab_label(&self, tab_label: Option<&str>) {
186 ObjectExt::set_property(self, "tab-label", tab_label)
187 }
188
189 #[doc(alias = "detachable")]
190 pub fn connect_detachable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
191 unsafe extern "C" fn notify_detachable_trampoline<F: Fn(&NotebookPage) + 'static>(
192 this: *mut ffi::GtkNotebookPage,
193 _param_spec: glib::ffi::gpointer,
194 f: glib::ffi::gpointer,
195 ) {
196 let f: &F = &*(f as *const F);
197 f(&from_glib_borrow(this))
198 }
199 unsafe {
200 let f: Box_<F> = Box_::new(f);
201 connect_raw(
202 self.as_ptr() as *mut _,
203 b"notify::detachable\0".as_ptr() as *const _,
204 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
205 notify_detachable_trampoline::<F> as *const (),
206 )),
207 Box_::into_raw(f),
208 )
209 }
210 }
211
212 #[doc(alias = "menu-label")]
213 pub fn connect_menu_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
214 unsafe extern "C" fn notify_menu_label_trampoline<F: Fn(&NotebookPage) + 'static>(
215 this: *mut ffi::GtkNotebookPage,
216 _param_spec: glib::ffi::gpointer,
217 f: glib::ffi::gpointer,
218 ) {
219 let f: &F = &*(f as *const F);
220 f(&from_glib_borrow(this))
221 }
222 unsafe {
223 let f: Box_<F> = Box_::new(f);
224 connect_raw(
225 self.as_ptr() as *mut _,
226 b"notify::menu-label\0".as_ptr() as *const _,
227 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
228 notify_menu_label_trampoline::<F> as *const (),
229 )),
230 Box_::into_raw(f),
231 )
232 }
233 }
234
235 #[doc(alias = "position")]
236 pub fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
237 unsafe extern "C" fn notify_position_trampoline<F: Fn(&NotebookPage) + 'static>(
238 this: *mut ffi::GtkNotebookPage,
239 _param_spec: glib::ffi::gpointer,
240 f: glib::ffi::gpointer,
241 ) {
242 let f: &F = &*(f as *const F);
243 f(&from_glib_borrow(this))
244 }
245 unsafe {
246 let f: Box_<F> = Box_::new(f);
247 connect_raw(
248 self.as_ptr() as *mut _,
249 b"notify::position\0".as_ptr() as *const _,
250 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
251 notify_position_trampoline::<F> as *const (),
252 )),
253 Box_::into_raw(f),
254 )
255 }
256 }
257
258 #[doc(alias = "reorderable")]
259 pub fn connect_reorderable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
260 unsafe extern "C" fn notify_reorderable_trampoline<F: Fn(&NotebookPage) + 'static>(
261 this: *mut ffi::GtkNotebookPage,
262 _param_spec: glib::ffi::gpointer,
263 f: glib::ffi::gpointer,
264 ) {
265 let f: &F = &*(f as *const F);
266 f(&from_glib_borrow(this))
267 }
268 unsafe {
269 let f: Box_<F> = Box_::new(f);
270 connect_raw(
271 self.as_ptr() as *mut _,
272 b"notify::reorderable\0".as_ptr() as *const _,
273 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
274 notify_reorderable_trampoline::<F> as *const (),
275 )),
276 Box_::into_raw(f),
277 )
278 }
279 }
280
281 #[doc(alias = "tab-expand")]
282 pub fn connect_tab_expand_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
283 unsafe extern "C" fn notify_tab_expand_trampoline<F: Fn(&NotebookPage) + 'static>(
284 this: *mut ffi::GtkNotebookPage,
285 _param_spec: glib::ffi::gpointer,
286 f: glib::ffi::gpointer,
287 ) {
288 let f: &F = &*(f as *const F);
289 f(&from_glib_borrow(this))
290 }
291 unsafe {
292 let f: Box_<F> = Box_::new(f);
293 connect_raw(
294 self.as_ptr() as *mut _,
295 b"notify::tab-expand\0".as_ptr() as *const _,
296 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
297 notify_tab_expand_trampoline::<F> as *const (),
298 )),
299 Box_::into_raw(f),
300 )
301 }
302 }
303
304 #[doc(alias = "tab-fill")]
305 pub fn connect_tab_fill_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
306 unsafe extern "C" fn notify_tab_fill_trampoline<F: Fn(&NotebookPage) + 'static>(
307 this: *mut ffi::GtkNotebookPage,
308 _param_spec: glib::ffi::gpointer,
309 f: glib::ffi::gpointer,
310 ) {
311 let f: &F = &*(f as *const F);
312 f(&from_glib_borrow(this))
313 }
314 unsafe {
315 let f: Box_<F> = Box_::new(f);
316 connect_raw(
317 self.as_ptr() as *mut _,
318 b"notify::tab-fill\0".as_ptr() as *const _,
319 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
320 notify_tab_fill_trampoline::<F> as *const (),
321 )),
322 Box_::into_raw(f),
323 )
324 }
325 }
326
327 #[doc(alias = "tab-label")]
328 pub fn connect_tab_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
329 unsafe extern "C" fn notify_tab_label_trampoline<F: Fn(&NotebookPage) + 'static>(
330 this: *mut ffi::GtkNotebookPage,
331 _param_spec: glib::ffi::gpointer,
332 f: glib::ffi::gpointer,
333 ) {
334 let f: &F = &*(f as *const F);
335 f(&from_glib_borrow(this))
336 }
337 unsafe {
338 let f: Box_<F> = Box_::new(f);
339 connect_raw(
340 self.as_ptr() as *mut _,
341 b"notify::tab-label\0".as_ptr() as *const _,
342 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
343 notify_tab_label_trampoline::<F> as *const (),
344 )),
345 Box_::into_raw(f),
346 )
347 }
348 }
349}