class Gdk::PopupLayout
- Gdk::PopupLayout
- Reference
- Object
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.
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.
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.crConstructors
- .new(anchor_rect : Gdk::Rectangle, rect_anchor : Gdk::Gravity, surface_anchor : Gdk::Gravity) : self
- .new(pointer : Pointer(Void), transfer : GICrystal::Transfer)
Class Method Summary
-
.g_type : UInt64
Returns the type id (GType) registered in GLib type system.
Instance Method Summary
- #anchor_hints : Gdk::AnchorHints
- #anchor_hints=(anchor_hints : Gdk::AnchorHints) : Nil
- #anchor_rect : Gdk::Rectangle
- #anchor_rect=(anchor_rect : Gdk::Rectangle) : Nil
- #copy : Gdk::PopupLayout
- #equal(other : Gdk::PopupLayout) : Bool
- #finalize
- #offset(dx : Int32, dy : Int32) : Nil
- #rect_anchor : Gdk::Gravity
- #rect_anchor=(anchor : Gdk::Gravity) : Nil
- #ref : Gdk::PopupLayout
- #set_offset(dx : Int32, dy : Int32) : Nil
- #set_shadow_width(left : Int32, right : Int32, top : Int32, bottom : Int32) : Nil
- #shadow_width(left : Int32, right : Int32, top : Int32, bottom : Int32) : Nil
- #surface_anchor : Gdk::Gravity
- #surface_anchor=(anchor : Gdk::Gravity) : Nil
- #to_unsafe : Pointer(Void)
- #unref : Nil