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;
182mod event_controller_key;
183mod expression_watch;
184mod file_chooser;
185mod file_chooser_dialog;
186mod flow_box;
187mod font_chooser;
188#[cfg(feature = "v4_10")]
189#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
190mod font_dialog;
191mod functions;
192mod gesture_stylus;
193mod icon_theme;
194mod im_context_simple;
195mod info_bar;
196mod keyval_trigger;
197mod label;
198mod list_box;
199mod list_store;
200mod map_list_model;
201mod media_stream;
202mod menu_button;
203mod message_dialog;
204mod mnemonic_trigger;
205mod native_dialog;
206mod notebook;
207mod object_expression;
208mod overlay;
209mod pad_action_entry;
210mod page_range;
211mod param_spec_expression;
212#[cfg(target_os = "linux")]
213#[cfg_attr(docsrs, doc(cfg(target_os = "linux")))]
214mod print_job;
215mod print_operation;
216mod print_settings;
217mod property_expression;
218mod recent_data;
219mod requisition;
220mod response_type;
221mod scale;
222mod shortcut;
223mod shortcut_trigger;
224mod shortcuts_section;
225mod signal_list_item_factory;
226mod snapshot;
227mod spin_button;
228mod string_list;
229mod string_object;
230mod style_context;
231mod text;
232mod text_buffer;
233mod tree_model;
234mod tree_model_filter;
235mod tree_path;
236mod tree_row_reference;
237mod tree_selection;
238mod tree_sortable;
239mod tree_store;
240mod tree_view;
241mod tree_view_column;
242mod widget;
243
244#[cfg(feature = "v4_14")]
245#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
246pub use accessible_text_range::AccessibleTextRange;
247pub use bitset_iter::BitsetIter;
248pub use border::Border;
249pub use builder_cscope::BuilderCScope;
250pub use builder_rust_scope::BuilderRustScope;
251pub use css_location::CssLocation;
252pub use enums::Align;
253pub use expression_watch::ExpressionWatch;
254pub use functions::*;
255pub use keyval_trigger::KeyvalTrigger;
256pub use mnemonic_trigger::MnemonicTrigger;
257pub use pad_action_entry::PadActionEntry;
258pub use page_range::PageRange;
259pub use recent_data::RecentData;
260pub use response_type::ResponseType;
261pub use subclass::widget::TemplateChild;
262pub use tree_sortable::SortColumn;
263pub use widget::TickCallbackId;