gtkmm: Gdk::Popup Class Reference

gtkmm 4.4.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

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:
[legend]

## Public Member Functions
| Popup (Popup && src) noexcept
Popup & | operator= (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< Surface > | get_parent ()
| Returns the parent surface of a popup. More...
Glib::RefPtr< const Surface > | get_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...
Public Member Functions inherited from Glib::Interface
| Interface ()
| Interface (Interface &&src) noexcept
Interface & | operator= (Interface &&src) noexcept
| Interface (const Glib::Interface_Class &interface_class)
| Interface (GObject *castitem)
| ~Interface () noexcept override
| Interface (const Interface &)=delete
Interface & | operator= (const Interface &)=delete
GObject * | gobj ()
const GObject * | gobj () const
Public Member Functions inherited from Glib::ObjectBase
| ObjectBase (const ObjectBase &)=delete
ObjectBase & | operator= (const ObjectBase &)=delete
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value)
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const
void | set_property (const Glib::ustring &property_name, const PropertyType &value)
void | get_property (const Glib::ustring &property_name, PropertyType &value) const
PropertyType | get_property (const Glib::ustring &property_name) const
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot)
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot)
void | freeze_notify ()
void | thaw_notify ()
virtual void | reference () const
virtual void | unreference () const
GObject * | gobj ()
const GObject * | gobj () const
GObject * | gobj_copy () const
Public Member Functions inherited from sigc::trackable
| trackable () noexcept
| trackable (const trackable &src) noexcept
| trackable (trackable &&src) noexcept
| ~trackable ()
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const
void | notify_callbacks ()
trackable & | operator= (const trackable &src)
trackable & | operator= (trackable &&src) noexcept
void | remove_destroy_notify_callback (notifiable *data) const

## 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...
Protected Member Functions inherited from Glib::ObjectBase
| ObjectBase ()
| ObjectBase (const char *custom_type_name)
| ObjectBase (const std::type_info &custom_type_info)
| ObjectBase (ObjectBase &&src) noexcept
ObjectBase & | operator= (ObjectBase &&src) noexcept
virtual | ~ObjectBase () noexcept=0
void | initialize (GObject *castitem)
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper)

## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gdk::Popup > | wrap (GdkPopup * object, bool take_copy=false)
| A Glib::wrap() method for this object. More...

## Additional Inherited Members
Public Types inherited from sigc::trackable
typedef internal::func_destroy_notify | func_destroy_notify
Public Types inherited from sigc::notifiable
typedef internal::func_destroy_notify | func_destroy_notify

## 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

Gdk::Popup::Popup | ( |  | ) |
| protected

You should derive from this class to use it.

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

Gdk::Popup::~Popup | ( |  | ) |
| overridenoexcept

## Member Function Documentation

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

bool Gdk::Popup::get_autohide | ( |  | ) | const

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

Returns
  `true` if popup will autohide.

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

Returns the parent surface of a popup.

Returns
  The parent surface.

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

Returns the parent surface of a popup.

Returns
  The parent surface.

int Gdk::Popup::get_position_x | ( |  | ) | const

Obtains the position of the popup relative to its parent.

Returns
  The X coordinate of popup position.

int Gdk::Popup::get_position_y | ( |  | ) | const

Obtains the position of the popup relative to its parent.

Returns
  The Y coordinate of popup position.

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.

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.

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

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

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

Provides access to the underlying C GObject.

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

Provides access to the underlying C GObject.

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

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

  width | The unconstrained popup width to layout.
  height | The unconstrained popup height to layout.
  layout | The `Gdk::PopupLayout` object used to layout.

Returns
  `false` if it failed to be presented, otherwise `true`.

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.

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

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

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

Parameters

  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.

Returns
  A C++ instance that wraps this C instance.