1#![cfg_attr(docsrs, feature(doc_cfg))]
4#![allow(deprecated)]
5#![allow(clippy::manual_c_str_literals)]
6#![doc = include_str!("../README.md")]
7
8pub use cairo;
10pub use gdk;
11pub use gdk_pixbuf;
12pub use gio;
13pub use glib;
14pub use graphene;
15pub use gsk;
16pub use gtk4_sys as ffi;
17pub use pango;
18
19#[macro_use]
20#[doc(hidden)]
21#[allow(unused_imports)]
22pub extern crate field_offset;
23#[macro_use]
24#[doc(hidden)]
25#[allow(unused_imports)]
26pub extern crate gtk4_macros;
27
28#[doc(hidden)]
29pub use field_offset::*;
30#[doc(hidden)]
31pub use gtk4_macros::*;
32
33#[doc(alias = "GTK_STYLE_PROVIDER_PRIORITY_FALLBACK")]
41pub const STYLE_PROVIDER_PRIORITY_FALLBACK: u32 = ffi::GTK_STYLE_PROVIDER_PRIORITY_FALLBACK as _;
42#[doc(alias = "GTK_STYLE_PROVIDER_PRIORITY_THEME")]
45pub const STYLE_PROVIDER_PRIORITY_THEME: u32 = ffi::GTK_STYLE_PROVIDER_PRIORITY_THEME as _;
46#[doc(alias = "GTK_STYLE_PROVIDER_PRIORITY_SETTINGS")]
52pub const STYLE_PROVIDER_PRIORITY_SETTINGS: u32 = ffi::GTK_STYLE_PROVIDER_PRIORITY_SETTINGS as _;
53#[doc(alias = "GTK_STYLE_PROVIDER_PRIORITY_APPLICATION")]
56pub const STYLE_PROVIDER_PRIORITY_APPLICATION: u32 =
57 ffi::GTK_STYLE_PROVIDER_PRIORITY_APPLICATION as _;
58#[doc(alias = "GTK_STYLE_PROVIDER_PRIORITY_USER")]
64pub const STYLE_PROVIDER_PRIORITY_USER: u32 = ffi::GTK_STYLE_PROVIDER_PRIORITY_USER as _;
65
66#[doc(alias = "GTK_ACCESSIBLE_VALUE_UNDEFINED")]
69pub const ACCESSIBLE_VALUE_UNDEFINED: i32 = ffi::GTK_ACCESSIBLE_VALUE_UNDEFINED as _;
70
71#[doc(alias = "GTK_INVALID_LIST_POSITION")]
81pub const INVALID_LIST_POSITION: u32 = ffi::GTK_INVALID_LIST_POSITION as _;
82
83#[doc(alias = "GTK_PRIORITY_RESIZE")]
89pub const PRIORITY_RESIZE: u32 = ffi::GTK_PRIORITY_RESIZE as _;
90#[doc(alias = "GTK_TEXT_VIEW_PRIORITY_VALIDATE")]
93pub const TEXT_VIEW_PRIORITY_VALIDATE: u32 = ffi::GTK_TEXT_VIEW_PRIORITY_VALIDATE as _;
94
95#[macro_use]
96mod rt;
97
98#[doc(hidden)]
99pub fn test_synced<F, R>(function: F) -> R
100where
101 F: FnOnce() -> R + Send + std::panic::UnwindSafe + 'static,
102 R: Send + 'static,
103{
104 skip_assert_initialized!();
105 static TEST_THREAD_WORKER: std::sync::OnceLock<glib::ThreadPool> = std::sync::OnceLock::new();
106 let pool = TEST_THREAD_WORKER.get_or_init(|| {
107 let pool = glib::ThreadPool::exclusive(1).unwrap();
108 pool.push(move || {
109 crate::init().expect("Tests failed to initialize gtk");
110 })
111 .expect("Failed to schedule a test call");
112 pool
113 });
114
115 use std::{panic, sync::mpsc};
116
117 let (tx, rx) = mpsc::sync_channel(1);
118 pool.push(move || {
119 tx.send(panic::catch_unwind(function))
120 .unwrap_or_else(|_| panic!("Failed to return result from thread pool"));
121 })
122 .expect("Failed to schedule a test call");
123 rx.recv()
124 .expect("Failed to receive result from thread pool")
125 .unwrap_or_else(|e| std::panic::resume_unwind(e))
126}
127
128#[allow(clippy::derived_hash_with_manual_eq)]
129#[allow(clippy::too_many_arguments)]
130#[allow(clippy::type_complexity)]
131#[allow(clippy::let_and_return)]
132#[allow(unused_imports)]
133mod auto;
134
135#[macro_use]
136pub mod subclass;
137#[macro_use]
138mod expression;
139
140pub mod builders;
141pub mod prelude;
142
143pub use auto::*;
144pub use rt::*;
145
146#[cfg(feature = "v4_10")]
147#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
148pub mod accessible;
149#[cfg(feature = "v4_14")]
150#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
151mod accessible_text_range;
152mod actionable;
153mod application;
154mod assistant;
155mod bitset_iter;
156mod bookmark_list;
157mod border;
158mod builder;
159mod builder_cscope;
160mod builder_rust_scope;
161mod calendar;
162mod callback_action;
163mod cell_area;
164mod cell_layout;
165mod closure_expression;
166mod color_chooser;
167mod combo_box;
168mod constant_expression;
169mod constraint_guide;
170mod constraint_layout;
171mod css_location;
172mod custom_filter;
173mod custom_sorter;
174mod dialog;
175mod directory_list;
176mod drawing_area;
177mod drop_target;
178mod editable;
179mod editable_label;
180mod entry;
181mod entry_buffer;
182mod entry_completion;
183mod enums;
184mod event_controller;
185mod event_controller_key;
186mod expression_watch;
187mod file_chooser;
188mod file_chooser_dialog;
189mod flow_box;
190mod font_chooser;
191#[cfg(feature = "v4_10")]
192#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
193mod font_dialog;
194mod functions;
195mod gesture_stylus;
196mod icon_theme;
197mod im_context_simple;
198mod info_bar;
199mod keyval_trigger;
200mod label;
201mod list_box;
202mod list_store;
203mod map_list_model;
204mod media_stream;
205mod menu_button;
206mod message_dialog;
207mod mnemonic_trigger;
208mod native_dialog;
209mod notebook;
210mod object_expression;
211mod overlay;
212mod pad_action_entry;
213mod page_range;
214mod param_spec_expression;
215#[cfg(target_os = "linux")]
216#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))]
217mod print_job;
218mod print_operation;
219mod print_settings;
220mod property_expression;
221mod recent_data;
222mod requisition;
223mod response_type;
224mod scale;
225mod shortcut;
226mod shortcut_trigger;
227mod shortcuts_section;
228mod signal_list_item_factory;
229mod snapshot;
230mod spin_button;
231mod string_list;
232mod string_object;
233mod style_context;
234mod text;
235mod text_buffer;
236mod tree_model;
237mod tree_model_filter;
238mod tree_path;
239mod tree_row_reference;
240mod tree_selection;
241mod tree_sortable;
242mod tree_store;
243mod tree_view;
244mod tree_view_column;
245#[cfg(feature = "v4_22")]
246#[cfg_attr(docsrs, doc(cfg(feature = "v4_22")))]
247mod try_expression;
248mod widget;
249
250#[cfg(feature = "v4_14")]
251#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
252pub use accessible_text_range::AccessibleTextRange;
253pub use bitset_iter::BitsetIter;
254pub use border::Border;
255pub use builder_cscope::BuilderCScope;
256pub use builder_rust_scope::BuilderRustScope;
257pub use css_location::CssLocation;
258pub use enums::Align;
259pub use expression_watch::ExpressionWatch;
260pub use functions::*;
261pub use keyval_trigger::KeyvalTrigger;
262pub use mnemonic_trigger::MnemonicTrigger;
263pub use pad_action_entry::PadActionEntry;
264pub use page_range::PageRange;
265pub use recent_data::RecentData;
266pub use response_type::ResponseType;
267pub use subclass::widget::TemplateChild;
268pub use tree_sortable::SortColumn;
269pub use widget::TickCallbackId;