gtkmm  4.8.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions | List of all members
Gdk::Popup Class Reference

Interface for popup surfaces. More...

#include <gdkmm/popup.h>

Inheritance diagram for Gdk::Popup:
Inheritance graph
[legend]

Public Member Functions

 Popup (Popup && src) noexcept
 
Popupoperator= (Popup && src) noexcept
 
 ~Popup () noexcept override
 
GdkPopup * gobj ()
 Provides access to the underlying C GObject. More...
 
const GdkPopup * gobj () const
 Provides access to the underlying C GObject. More...
 
bool present (int width, int height, const Glib::RefPtr< PopupLayout > & layout)
 Present popup after having processed the Gdk::PopupLayout rules. More...
 
Gravity get_surface_anchor () const
 Gets the current popup surface anchor. More...
 
Gravity get_rect_anchor () const
 Gets the current popup rectangle anchor. More...
 
Glib::RefPtr< Surfaceget_parent ()
 Returns the parent surface of a popup. More...
 
Glib::RefPtr< const Surfaceget_parent () const
 Returns the parent surface of a popup. More...
 
int get_position_x () const
 Obtains the position of the popup relative to its parent. More...
 
int get_position_y () const
 Obtains the position of the popup relative to its parent. More...
 
bool get_autohide () const
 Returns whether this popup is set to hide on outside clicks. More...
 
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Surface > > property_parent () const
 The parent surface. More...
 
Glib::PropertyProxy_ReadOnly< bool > property_autohide () const
 Whether to hide on outside clicks. More...
 

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. More...
 

Protected Member Functions

 Popup ()
 You should derive from this class to use it. More...
 

Related Functions

(Note that these are not member functions.)

Glib::RefPtr< Gdk::Popupwrap (GdkPopup * object, bool take_copy=false)
 A Glib::wrap() method for this object. More...
 

Detailed Description

Interface for popup surfaces.

A Gdk::Popup is a surface that is attached to another surface, called its property_parent(), and is positioned relative to it.

Gdk::Popups are typically used to implement menus and similar popups. They can be modal, which is indicated by the property_autohide() property.

See also
Gdk::Toplevel, Gdk::Surface
Since gtkmm 3.98:

Constructor & Destructor Documentation

◆ Popup() [1/2]

Gdk::Popup::Popup ( )
protected

You should derive from this class to use it.

◆ Popup() [2/2]

Gdk::Popup::Popup ( Popup &&  src)
noexcept

◆ ~Popup()

Gdk::Popup::~Popup ( )
overridenoexcept

Member Function Documentation

◆ add_interface()

static void Gdk::Popup::add_interface ( GType  gtype_implementer)
static

◆ get_autohide()

bool Gdk::Popup::get_autohide ( ) const

Returns whether this popup is set to hide on outside clicks.

Returns
true if popup will autohide.

◆ get_parent() [1/2]

Glib::RefPtr<Surface> Gdk::Popup::get_parent ( )

Returns the parent surface of a popup.

Returns
The parent surface.

◆ get_parent() [2/2]

Glib::RefPtr<const Surface> Gdk::Popup::get_parent ( ) const

Returns the parent surface of a popup.

Returns
The parent surface.

◆ get_position_x()

int Gdk::Popup::get_position_x ( ) const

Obtains the position of the popup relative to its parent.

Returns
The X coordinate of popup position.

◆ get_position_y()

int Gdk::Popup::get_position_y ( ) const

Obtains the position of the popup relative to its parent.

Returns
The Y coordinate of popup position.

◆ get_rect_anchor()

Gravity Gdk::Popup::get_rect_anchor ( ) const

Gets the current popup rectangle anchor.

The value returned may change after calling present(), or after the Gdk::Surface::signal_layout() signal is emitted.

Returns
The current rectangle anchor value of popup.

◆ get_surface_anchor()

Gravity Gdk::Popup::get_surface_anchor ( ) const

Gets the current popup surface anchor.

The value returned may change after calling present(), or after the Gdk::Surface::signal_layout() signal is emitted.

Returns
The current surface anchor value of popup.

◆ get_type()

static GType Gdk::Popup::get_type ( )
static

Get the GType for this class, for use with the underlying GObject type system.

◆ gobj() [1/2]

GdkPopup* Gdk::Popup::gobj ( )
inline

Provides access to the underlying C GObject.

◆ gobj() [2/2]

const GdkPopup* Gdk::Popup::gobj ( ) const
inline

Provides access to the underlying C GObject.

◆ operator=()

Popup& Gdk::Popup::operator= ( Popup &&  src)
noexcept

◆ present()

bool Gdk::Popup::present ( int  width,
int  height,
const Glib::RefPtr< PopupLayout > &  layout 
)

Present popup after having processed the Gdk::PopupLayout rules.

If the popup was previously now showing, it will be showed, otherwise it will change position according to layout.

After calling this function, the result should be handled in response to the Gdk::GdkSurface::signal_layout() signal being emitted. The resulting popup position can be queried using get_position_x(), get_position_y(), and the resulting size will be sent as parameters in the layout signal. Use get_rect_anchor() and get_surface_anchor() to get the resulting anchors.

Presenting may fail, for example if the popup is set to autohide and is immediately hidden upon being presented. If presenting failed, the Gdk::Surface::signal_layout() signal will not me emitted.

Parameters
widthThe unconstrained popup width to layout.
heightThe unconstrained popup height to layout.
layoutThe Gdk::PopupLayout object used to layout.
Returns
false if it failed to be presented, otherwise true.

◆ property_autohide()

Glib::PropertyProxy_ReadOnly< bool > Gdk::Popup::property_autohide ( ) const

Whether to hide on outside clicks.

Default value: false

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

◆ property_parent()

Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Surface> > Gdk::Popup::property_parent ( ) const

The parent surface.

Returns
A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.

Friends And Related Function Documentation

◆ wrap()

Glib::RefPtr< Gdk::Popup > wrap ( GdkPopup *  object,
bool  take_copy = false 
)
related

A Glib::wrap() method for this object.

Parameters
objectThe C instance.
take_copyFalse if the result should take ownership of the C instance. True if it should take a new copy or ref.
Returns
A C++ instance that wraps this C instance.