class Gdk::PopupLayout

Overview

The Gdk::PopupLayout struct contains information that is necessary position a Gdk::Popup relative to its parent.

The positioning requires a negotiation with the windowing system, since it depends on external constraints, such as the position of the parent surface, and the screen dimensions.

The basic ingredients are a rectangle on the parent surface, and the anchor on both that rectangle and the popup. The anchors specify a side or corner to place next to each other.

Popup anchors

For cases where placing the anchors next to each other would make the popup extend offscreen, the layout includes some hints for how to resolve this problem. The hints may suggest to flip the anchor position to the other side, or to 'slide' the popup along a side, or to resize it.

Flipping popups

Sliding popups

These hints may be combined.

Ultimatively, it is up to the windowing system to determine the position and size of the popup. You can learn about the result by calling Gdk::Popup#position_x, Gdk::Popup#position_y, Gdk::Popup#rect_anchor and Gdk::Popup#surface_anchor after the popup has been presented. This can be used to adjust the rendering. For example, Gtk::Popover changes its arrow position accordingly. But you have to be careful avoid changing the size of the popover, or it has to be presented again.

Defined in:

lib/gi-crystal/src/auto/gdk-4.0/popup_layout.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(anchor_rect : Gdk::Rectangle, rect_anchor : Gdk::Gravity, surface_anchor : Gdk::Gravity) : self #

[View source]
def self.new(pointer : Pointer(Void), transfer : GICrystal::Transfer) #

[View source]

Class Method Detail

def self.g_type : UInt64 #

Returns the type id (GType) registered in GLib type system.


[View source]

Instance Method Detail

def anchor_hints : Gdk::AnchorHints #

[View source]
def anchor_hints=(anchor_hints : Gdk::AnchorHints) : Nil #

[View source]
def anchor_rect : Gdk::Rectangle #

[View source]
def anchor_rect=(anchor_rect : Gdk::Rectangle) : Nil #

[View source]
def copy : Gdk::PopupLayout #

[View source]
def equal(other : Gdk::PopupLayout) : Bool #

[View source]
def finalize #

[View source]
def offset(dx : Int32, dy : Int32) : Nil #

[View source]
def rect_anchor : Gdk::Gravity #

[View source]
def rect_anchor=(anchor : Gdk::Gravity) : Nil #

[View source]
def ref : Gdk::PopupLayout #

[View source]
def set_offset(dx : Int32, dy : Int32) : Nil #

[View source]
def set_shadow_width(left : Int32, right : Int32, top : Int32, bottom : Int32) : Nil #

[View source]
def shadow_width(left : Int32, right : Int32, top : Int32, bottom : Int32) : Nil #

[View source]
def surface_anchor : Gdk::Gravity #

[View source]
def surface_anchor=(anchor : Gdk::Gravity) : Nil #

[View source]
def to_unsafe : Pointer(Void) #

[View source]
def unref : Nil #

[View source]