Struct gtk4::Window [−][src]
pub struct Window(_);
Expand description
A Window
is a toplevel window which can contain other widgets.
Windows normally have decorations that are under the control of the windowing system and allow the user to manipulate the window (resize it, move it, close it,…).
GtkWindow as GtkBuildable
The Window
implementation of the Buildable
interface supports
setting a child as the titlebar by specifying “titlebar” as the “type”
attribute of a <child>
element.
CSS nodes
window.background [.csd / .solid-csd / .ssd] [.maximized / .fullscreen / .tiled]
├── <child>
╰── <titlebar child>.titlebar [.default-decoration]
Window
has a main CSS node with name window and style class .background.
Style classes that are typically used with the main CSS node are .csd (when client-side decorations are in use), .solid-csd (for client-side decorations without invisible borders), .ssd (used by mutter when rendering server-side decorations). GtkWindow also represents window states with the following style classes on the main node: .maximized, .fullscreen, .tiled (when supported, also .tiled-top, .tiled-left, .tiled-right, .tiled-bottom).
Window
subclasses often add their own discriminating style classes,
such as .dialog, .popup or .tooltip.
Generally, some CSS properties don’t make sense on the toplevel window node, such as margins or padding. When client-side decorations without invisible borders are in use (i.e. the .solid-csd style class is added to the main window node), the CSS border of the toplevel window is used for resize drags. In the .csd case, the shadow area outside of the window can be used to resize it.
Window
adds the .titlebar and .default-decoration style classes to the
widget that is added as a titlebar child.
Accessibility
Window
uses the AccessibleRole::Window
role.
Implements
GtkWindowExt
, WidgetExt
, glib::ObjectExt
, AccessibleExt
, BuildableExt
, ConstraintTargetExt
, NativeExt
, RootExt
, ShortcutManagerExt
, WidgetExtManual
, AccessibleExtManual
Implementations
Creates a new Window
.
To get an undecorated window (no window borders), use
GtkWindowExt::set_decorated()
.
All top-level windows created by new()
are stored
in an internal top-level window list. This list can be obtained
from list_toplevels()
. Due to GTK keeping a
reference to the window internally, new()
does not
return a reference to the caller.
To delete a Window
, call Gtk::
Window::destroy()``.
Returns
a new Window
.
Creates a new builder-pattern struct instance to construct Window
objects.
This method returns an instance of WindowBuilder
which can be used to create Window
objects.
Returns the fallback icon name for windows.
The returned string is owned by GTK and should not
be modified. It is only valid until the next call to
set_default_icon_name()
.
Returns
the fallback icon name for windows
Returns a list of all existing toplevel windows.
If you want to iterate through the list and perform actions involving callbacks that might destroy the widgets or add new ones, be aware that the list of toplevels will change and emit the “items-changed” signal.
Returns
the list of toplevel widgets
Returns a list of all existing toplevel windows.
The widgets in the list are not individually referenced.
If you want to iterate through the list and perform actions
involving callbacks that might destroy the widgets, you must
call g_list_foreach (result, (GFunc)g_object_ref, NULL)
first,
and then unref all the widgets afterwards.
Returns
list of toplevel widgets
Sets whether the window should request startup notification.
By default, after showing the first Window
, GTK calls
Gdk::
Display::notify_startup_complete()``. Call this function
to disable the automatic startup notification. You might do this
if your first window is a splash screen, and you want to delay
notification until after your real main window has been shown,
for example.
In that example, you would disable startup notification temporarily, show your splash screen, then re-enable it so that showing the main window would automatically result in notification.
setting
true
to automatically do startup notification
Sets an icon to be used as fallback.
The fallback icon is used for windows that
haven’t had GtkWindowExt::set_icon_name()
called on them.
name
the name of the themed icon
Opens or closes the interactive debugger.
The debugger offers access to the widget hierarchy of the application and to useful debugging tools.
enable
true
to enable interactive debugging
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Returns the type identifier of Self
.
Auto Trait Implementations
impl RefUnwindSafe for Window
impl UnwindSafe for Window
Blanket Implementations
Mutably borrows from an owned value. Read more
Upcasts an object to a superclass or interface T
. Read more
Upcasts an object to a reference of its superclass or interface T
. Read more
Tries to downcast to a subclass or interface implementor T
. Read more
Tries to downcast to a reference of its subclass or interface implementor T
. Read more
Tries to cast to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
Tries to cast to reference to an object of type T
. This handles upcasting, downcasting
and casting between interface and interface implementors. All checks are performed at
runtime, while downcast
and upcast
will do many checks at compile-time already. Read more
Casts to T
unconditionally. Read more
Casts to &T
unconditionally. Read more
Returns true
if the object is an instance of (can be cast to) T
.
pub fn set_property<'a, N, V>(
&self,
property_name: N,
value: V
) -> Result<(), BoolError> where
N: Into<&'a str>,
V: ToValue,
pub fn set_property_from_value<'a, N>(
&self,
property_name: N,
value: &Value
) -> Result<(), BoolError> where
N: Into<&'a str>,
pub fn set_properties_from_value(
&self,
property_values: &[(&str, Value)]
) -> Result<(), BoolError>
pub fn has_property<'a, N>(&self, property_name: N, type_: Option<Type>) -> bool where
N: Into<&'a str>,
pub fn find_property<'a, N>(&self, property_name: N) -> Option<ParamSpec> where
N: Into<&'a str>,
Safety Read more
Safety Read more
Safety Read more
Safety Read more
pub fn connect<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: 'static + Fn(&[Value]) -> Option<Value> + Send + Sync,
Same as connect
but takes a SignalId
instead of a signal name.
pub fn connect_local<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: 'static + Fn(&[Value]) -> Option<Value>,
Same as connect_local
but takes a SignalId
instead of a signal name.
pub unsafe fn connect_unsafe<'a, N, F>(
&self,
signal_name: N,
after: bool,
callback: F
) -> Result<SignalHandlerId, BoolError> where
N: Into<&'a str>,
F: Fn(&[Value]) -> Option<Value>,
Same as connect_unsafe
but takes a SignalId
instead of a signal name.
Emit signal by signal id.
Same as emit
but takes Value
for the arguments.
Emit signal by its name.
Same as emit_by_name
but takes Value
for the arguments.
Emit signal with details by signal id.
Same as emit_with_details
but takes Value
for the arguments.
pub fn connect_notify<F>(&self, name: Option<&str>, f: F) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec) + Send + Sync,
pub fn connect_notify_local<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: 'static + Fn(&T, &ParamSpec),
pub unsafe fn connect_notify_unsafe<F>(
&self,
name: Option<&str>,
f: F
) -> SignalHandlerId where
F: Fn(&T, &ParamSpec),
pub fn bind_property<'a, O, N, M>(
&'a self,
source_property: N,
target: &'a O,
target_property: M
) -> BindingBuilder<'a> where
O: ObjectType,
N: Into<&'a str>,
M: Into<&'a str>,
Returns a SendValue
clone of self
.