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(unused_imports)]
132mod auto;
133
134#[macro_use]
135pub mod subclass;
136#[macro_use]
137mod expression;
138
139pub mod builders;
140pub mod prelude;
141
142pub use auto::*;
143pub use rt::*;
144
145pub mod accessible;
146#[cfg(feature = "v4_14")]
147#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
148mod accessible_text_range;
149mod actionable;
150mod application;
151mod assistant;
152mod bitset_iter;
153mod bookmark_list;
154mod border;
155mod builder;
156mod builder_cscope;
157mod builder_rust_scope;
158mod calendar;
159mod callback_action;
160mod cell_area;
161mod cell_layout;
162mod closure_expression;
163mod color_chooser;
164mod combo_box;
165mod constant_expression;
166mod constraint_guide;
167mod constraint_layout;
168mod css_location;
169mod custom_filter;
170mod custom_sorter;
171mod dialog;
172mod directory_list;
173mod drawing_area;
174mod drop_target;
175mod editable;
176mod editable_label;
177mod entry;
178mod entry_buffer;
179mod entry_completion;
180mod enums;
181mod event_controller_key;
182mod expression_watch;
183mod file_chooser;
184mod file_chooser_dialog;
185mod flow_box;
186mod font_chooser;
187#[cfg(feature = "v4_10")]
188#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
189mod font_dialog;
190mod functions;
191mod gesture_stylus;
192mod icon_theme;
193mod im_context_simple;
194mod info_bar;
195mod keyval_trigger;
196mod label;
197mod list_box;
198mod list_store;
199mod map_list_model;
200mod media_stream;
201mod menu_button;
202mod message_dialog;
203mod mnemonic_trigger;
204mod native_dialog;
205mod notebook;
206mod object_expression;
207mod overlay;
208mod pad_action_entry;
209mod page_range;
210mod param_spec_expression;
211#[cfg(target_os = "linux")]
212#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))]
213mod print_job;
214mod print_operation;
215mod print_settings;
216mod property_expression;
217mod recent_data;
218mod requisition;
219mod response_type;
220mod scale;
221mod shortcut;
222mod shortcut_trigger;
223mod shortcuts_section;
224mod signal_list_item_factory;
225mod snapshot;
226mod spin_button;
227mod string_list;
228mod string_object;
229mod style_context;
230mod text;
231mod text_buffer;
232mod tree_model;
233mod tree_model_filter;
234mod tree_path;
235mod tree_row_reference;
236mod tree_selection;
237mod tree_sortable;
238mod tree_store;
239mod tree_view;
240mod tree_view_column;
241mod widget;
242
243#[cfg(feature = "v4_14")]
244#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
245pub use accessible_text_range::AccessibleTextRange;
246pub use bitset_iter::BitsetIter;
247pub use border::Border;
248pub use builder_cscope::BuilderCScope;
249pub use builder_rust_scope::BuilderRustScope;
250pub use css_location::CssLocation;
251pub use enums::Align;
252pub use expression_watch::ExpressionWatch;
253pub use functions::*;
254pub use keyval_trigger::KeyvalTrigger;
255pub use mnemonic_trigger::MnemonicTrigger;
256pub use pad_action_entry::PadActionEntry;
257pub use page_range::PageRange;
258pub use recent_data::RecentData;
259pub use response_type::ResponseType;
260pub use subclass::widget::TemplateChild;
261pub use tree_sortable::SortColumn;
262pub use widget::TickCallbackId;