gtkmm 4.16.0
|
Interface for toplevel surfaces. More...
#include <gdkmm/toplevel.h>
Public Types | |
enum class | State { State::MINIMIZED = 1 << 0 , State::MAXIMIZED = 1 << 1 , State::STICKY = 1 << 2 , State::FULLSCREEN = 1 << 3 , State::ABOVE = 1 << 4 , State::BELOW = 1 << 5 , State::FOCUSED = 1 << 6 , State::TILED = 1 << 7 , State::TOP_TILED = 1 << 8 , State::TOP_RESIZABLE = 1 << 9 , State::RIGHT_TILED = 1 << 10 , State::RIGHT_RESIZABLE = 1 << 11 , State::BOTTOM_TILED = 1 << 12 , State::BOTTOM_RESIZABLE = 1 << 13 , State::LEFT_TILED = 1 << 14 , State::LEFT_RESIZABLE = 1 << 15 , State::SUSPENDED = 1 << 16 } |
Specifies the state of a toplevel surface. More... | |
Public Member Functions | |
Toplevel (Toplevel &&src) noexcept | |
Toplevel & | operator= (Toplevel &&src) noexcept |
~Toplevel () noexcept override | |
GdkToplevel * | gobj () |
Provides access to the underlying C GObject. | |
const GdkToplevel * | gobj () const |
Provides access to the underlying C GObject. | |
void | present (const Glib::RefPtr< ToplevelLayout > &layout) |
Present toplevel after having processed the Gdk::ToplevelLayout rules. | |
bool | minimize () |
Asks to minimize the toplevel. | |
bool | lower () |
Asks to lower the toplevel below other windows. | |
void | focus (guint32 timestamp) |
Sets keyboard focus to surface. | |
State | get_state () const |
Gets the bitwise or of the currently active surface state flags, from the Gdk::Toplevel::State enumeration. | |
void | set_title (const Glib::ustring &title) |
Sets the title of a toplevel surface. | |
void | set_startup_id (const Glib::ustring &startup_id) |
Sets the startup notification ID. | |
void | set_transient_for (const Glib::RefPtr< Surface > & parent) |
Sets a transient-for parent. | |
void | set_modal (bool modal=true) |
Sets the toplevel to be modal. | |
void | set_icon_list (const std::vector< Glib::RefPtr< Texture > > &surfaces) |
Sets a list of icons for the surface. | |
bool | show_window_menu (const Glib::RefPtr< Event > & event) |
Asks the windowing system to show the window menu. | |
void | set_decorated (bool decorated=true) |
Sets the toplevel to be decorated. | |
void | set_deletable (bool deletable=true) |
Sets the toplevel to be deletable. | |
bool | supports_edge_constraints () const |
Returns whether the desktop environment supports tiled window states. | |
void | inhibit_system_shortcuts (const Glib::RefPtr< Event > & event) |
Requests that the toplevel inhibit the system shortcuts. | |
void | restore_system_shortcuts () |
Restore default system keyboard shortcuts which were previously inhibited. | |
void | begin_resize (SurfaceEdge edge, const Glib::RefPtr< Device > &device, int button, double x, double y, guint32 timestamp) |
Begins an interactive resize operation. | |
void | begin_move (const Glib::RefPtr< Device > &device, int button, double x, double y, guint32 timestamp) |
Begins an interactive move operation. | |
Glib::SignalProxy< void(ToplevelSize &)> | signal_compute_size () |
Glib::PropertyProxy_ReadOnly< State > | property_state () const |
The state of the toplevel. | |
Glib::PropertyProxy< Glib::ustring > | property_title () |
The title of the surface. | |
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_title () const |
The title of the surface. | |
Glib::PropertyProxy< Glib::ustring > | property_startup_id () |
The startup ID of the surface. | |
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_startup_id () const |
The startup ID of the surface. | |
Glib::PropertyProxy< Glib::RefPtr< Surface > > | property_transient_for () |
The transient parent of the surface. | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Surface > > | property_transient_for () const |
The transient parent of the surface. | |
Glib::PropertyProxy< bool > | property_modal () |
Whether the surface is modal. | |
Glib::PropertyProxy_ReadOnly< bool > | property_modal () const |
Whether the surface is modal. | |
Glib::PropertyProxy< bool > | property_decorated () |
Whether the window manager should add decorations. | |
Glib::PropertyProxy_ReadOnly< bool > | property_decorated () const |
Whether the window manager should add decorations. | |
Glib::PropertyProxy< bool > | property_deletable () |
Whether the window manager should allow to close the surface. | |
Glib::PropertyProxy_ReadOnly< bool > | property_deletable () const |
Whether the window manager should allow to close the surface. | |
Glib::PropertyProxy< FullscreenMode > | property_fullscreen_mode () |
The fullscreen mode of the surface. | |
Glib::PropertyProxy_ReadOnly< FullscreenMode > | property_fullscreen_mode () const |
The fullscreen mode of the surface. | |
Glib::PropertyProxy_ReadOnly< bool > | property_shortcuts_inhibited () const |
Whether the surface should inhibit keyboard shortcuts. | |
Static Public Member Functions | |
static void | add_interface (GType gtype_implementer) |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. | |
Protected Member Functions | |
Toplevel () | |
You should derive from this class to use it. | |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Gdk::Toplevel > | wrap (GdkToplevel *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
Interface for toplevel surfaces.
A Gdk::Toplevel is a freestanding toplevel surface.
The Gdk::Toplevel interface provides useful APIs for interacting with the windowing system, such as controlling maximization and size of the surface, setting icons and transient parents for dialogs.
|
protected |
You should derive from this class to use it.
|
noexcept |
|
overridenoexcept |
void Gdk::Toplevel::begin_move | ( | const Glib::RefPtr< Device > & | device, |
int | button, | ||
double | x, | ||
double | y, | ||
guint32 | timestamp | ||
) |
Begins an interactive move operation.
You might use this function to implement draggable titlebars.
device | The device used for the operation. |
button | The button being used to drag, or 0 for a keyboard-initiated drag. |
x | Surface X coordinate of mouse click that began the drag. |
y | Surface Y coordinate of mouse click that began the drag. |
timestamp | Timestamp of mouse click that began the drag (use Gdk::Event::get_time()). |
void Gdk::Toplevel::begin_resize | ( | SurfaceEdge | edge, |
const Glib::RefPtr< Device > & | device, | ||
int | button, | ||
double | x, | ||
double | y, | ||
guint32 | timestamp | ||
) |
Begins an interactive resize operation.
You might use this function to implement a “window resize grip.”
edge | The edge or corner from which the drag is started. |
device | The device used for the operation. |
button | The button being used to drag, or 0 for a keyboard-initiated drag. |
x | Surface X coordinate of mouse click that began the drag. |
y | Surface Y coordinate of mouse click that began the drag. |
timestamp | Timestamp of mouse click that began the drag (use Gdk::Event::get_time()). |
Sets keyboard focus to surface.
In most cases, gtk_window_present_with_time() should be used on a GtkWindow, rather than calling this function.
timestamp | Timestamp of the event triggering the surface focus. |
State Gdk::Toplevel::get_state | ( | ) | const |
Gets the bitwise or of the currently active surface state flags, from the Gdk::Toplevel::State
enumeration.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
Requests that the toplevel inhibit the system shortcuts.
This is asking the desktop environment/windowing system to let all keyboard events reach the surface, as long as it is focused, instead of triggering system actions.
If granted, the rerouting remains active until the default shortcuts processing is restored with restore_system_shortcuts(), or the request is revoked by the desktop environment, windowing system or the user.
A typical use case for this API is remote desktop or virtual machine viewers which need to inhibit the default system keyboard shortcuts so that the remote session or virtual host gets those instead of the local environment.
The windowing system or desktop environment may ask the user to grant or deny the request or even choose to ignore the request entirely.
The caller can be notified whenever the request is granted or revoked by listening to the property_shortcuts_inhibited() property.
event | The Gdk::Event that is triggering the inhibit request, or nullptr if none is available. |
bool Gdk::Toplevel::lower | ( | ) |
Asks to lower the toplevel below other windows.
The windowing system may choose to ignore the request.
true
if the surface was lowered. bool Gdk::Toplevel::minimize | ( | ) |
Asks to minimize the toplevel.
The windowing system may choose to ignore the request.
true
if the surface was minimized. void Gdk::Toplevel::present | ( | const Glib::RefPtr< ToplevelLayout > & | layout | ) |
Present toplevel after having processed the Gdk::ToplevelLayout
rules.
If the toplevel was previously not showing, it will be showed, otherwise it will change layout according to layout.
GDK may emit the signal_compute_size() signal to let the user of this toplevel compute the preferred size of the toplevel surface.
Presenting is asynchronous and the specified layout parameters are not guaranteed to be respected.
layout | The Gdk::ToplevelLayout object used to layout. |
Glib::PropertyProxy< bool > Gdk::Toplevel::property_decorated | ( | ) |
Whether the window manager should add decorations.
Default value: false
Glib::PropertyProxy_ReadOnly< bool > Gdk::Toplevel::property_decorated | ( | ) | const |
Whether the window manager should add decorations.
Default value: false
Glib::PropertyProxy< bool > Gdk::Toplevel::property_deletable | ( | ) |
Whether the window manager should allow to close the surface.
Default value: false
Glib::PropertyProxy_ReadOnly< bool > Gdk::Toplevel::property_deletable | ( | ) | const |
Whether the window manager should allow to close the surface.
Default value: false
Glib::PropertyProxy< FullscreenMode > Gdk::Toplevel::property_fullscreen_mode | ( | ) |
The fullscreen mode of the surface.
Default value: Gdk::FullscreenMode::ON_CURRENT_MONITOR
Glib::PropertyProxy_ReadOnly< FullscreenMode > Gdk::Toplevel::property_fullscreen_mode | ( | ) | const |
The fullscreen mode of the surface.
Default value: Gdk::FullscreenMode::ON_CURRENT_MONITOR
Glib::PropertyProxy< bool > Gdk::Toplevel::property_modal | ( | ) |
Whether the surface is modal.
Default value: false
Glib::PropertyProxy_ReadOnly< bool > Gdk::Toplevel::property_modal | ( | ) | const |
Whether the surface is modal.
Default value: false
Glib::PropertyProxy_ReadOnly< bool > Gdk::Toplevel::property_shortcuts_inhibited | ( | ) | const |
Whether the surface should inhibit keyboard shortcuts.
Default value: false
Glib::PropertyProxy< Glib::ustring > Gdk::Toplevel::property_startup_id | ( | ) |
The startup ID of the surface.
See Gdk::AppLaunchContext for more information about startup feedback.
Default value: ""
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gdk::Toplevel::property_startup_id | ( | ) | const |
The startup ID of the surface.
See Gdk::AppLaunchContext for more information about startup feedback.
Default value: ""
Glib::PropertyProxy_ReadOnly< State > Gdk::Toplevel::property_state | ( | ) | const |
The state of the toplevel.
Default value: 0
Glib::PropertyProxy< Glib::ustring > Gdk::Toplevel::property_title | ( | ) |
The title of the surface.
Default value: ""
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gdk::Toplevel::property_title | ( | ) | const |
The title of the surface.
Default value: ""
Glib::PropertyProxy< Glib::RefPtr< Surface > > Gdk::Toplevel::property_transient_for | ( | ) |
The transient parent of the surface.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Surface > > Gdk::Toplevel::property_transient_for | ( | ) | const |
The transient parent of the surface.
void Gdk::Toplevel::restore_system_shortcuts | ( | ) |
Restore default system keyboard shortcuts which were previously inhibited.
This undoes the effect of inhibit_system_shortcuts().
Sets the toplevel to be decorated.
Setting decorated to false
hints the desktop environment that the surface has its own, client-side decorations and does not need to have window decorations added.
decorated | true to request decorations. |
Sets the toplevel to be deletable.
Setting deletable to true
hints the desktop environment that it should offer the user a way to close the surface.
deletable | true to request a delete button. |
void Gdk::Toplevel::set_icon_list | ( | const std::vector< Glib::RefPtr< Texture > > & | surfaces | ) |
Sets a list of icons for the surface.
One of these will be used to represent the surface in iconic form. The icon may be shown in window lists or task bars. Which icon size is shown depends on the window manager. The window manager can scale the icon but setting several size icons can give better image quality.
Note that some platforms don't support surface icons.
surfaces | A list of textures to use as icon, of different sizes. |
Sets the toplevel to be modal.
The application can use this hint to tell the window manager that a certain surface has modal behaviour. The window manager can use this information to handle modal surfaces in a special way.
You should only use this on surfaces for which you have previously called set_transient_for().
modal | true if the surface is modal, false otherwise. |
Sets the startup notification ID.
When using GTK, typically you should use gtk_window_set_startup_id() instead of this low-level function.
startup_id | A string with startup-notification identifier. |
Sets the title of a toplevel surface.
The title maybe be displayed in the titlebar, in lists of windows, etc.
title | Title of surface. |
Sets a transient-for parent.
Indicates to the window manager that surface is a transient dialog associated with the application surface parent. This allows the window manager to do things like center surface on parent and keep surface above parent.
See gtk_window_set_transient_for() if you’re using GtkWindow.
parent | Another toplevel Gdk::Surface . |
Asks the windowing system to show the window menu.
The window menu is the menu shown when right-clicking the titlebar on traditional windows managed by the window manager. This is useful for windows using client-side decorations, activating it with a right-click on the window decorations.
event | A Gdk::Event to show the menu for. |
true
if the window menu was shown and false
otherwise. Glib::SignalProxy< void(ToplevelSize &)> Gdk::Toplevel::signal_compute_size | ( | ) |
void on_my_compute_size(ToplevelSize& size)
Flags: Run Last
Emitted when the size for the surface needs to be computed, when it is present.
This signal will normally be emitted during or after a call to Gdk::Toplevel::present(), depending on the configuration received by the windowing system. It may also be emitted at any other point in time, in response to the windowing system spontaneously changing the configuration of the toplevel surface.
It is the responsibility of the toplevel user to handle this signal and compute the desired size of the toplevel, given the information passed via the Gdk::ToplevelSize object. Failing to do so will result in an arbitrary size being used as a result.
size | A Gdk::ToplevelSize . |
bool Gdk::Toplevel::supports_edge_constraints | ( | ) | const |
Returns whether the desktop environment supports tiled window states.
true
if the desktop environment supports tiled window states.
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |