1/* GDK - The GIMP Drawing Kit
2 * Copyright (C) 2020 Red Hat
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 *
17 */
18
19#ifndef __GDK_POPUP_LAYOUT_H__
20#define __GDK_POPUP_LAYOUT_H__
21
22#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
23#error "Only <gdk/gdk.h> can be included directly."
24#endif
25
26#include <gdk/gdkenums.h>
27#include <gdk/gdktypes.h>
28#include <gdk/gdkversionmacros.h>
29
30G_BEGIN_DECLS
31
32/**
33 * GdkAnchorHints:
34 * @GDK_ANCHOR_FLIP_X: allow flipping anchors horizontally
35 * @GDK_ANCHOR_FLIP_Y: allow flipping anchors vertically
36 * @GDK_ANCHOR_SLIDE_X: allow sliding surface horizontally
37 * @GDK_ANCHOR_SLIDE_Y: allow sliding surface vertically
38 * @GDK_ANCHOR_RESIZE_X: allow resizing surface horizontally
39 * @GDK_ANCHOR_RESIZE_Y: allow resizing surface vertically
40 * @GDK_ANCHOR_FLIP: allow flipping anchors on both axes
41 * @GDK_ANCHOR_SLIDE: allow sliding surface on both axes
42 * @GDK_ANCHOR_RESIZE: allow resizing surface on both axes
43 *
44 * Positioning hints for aligning a surface relative to a rectangle.
45 *
46 * These hints determine how the surface should be positioned in the case that
47 * the surface would fall off-screen if placed in its ideal position.
48 *
49 * For example, %GDK_ANCHOR_FLIP_X will replace %GDK_GRAVITY_NORTH_WEST with
50 * %GDK_GRAVITY_NORTH_EAST and vice versa if the surface extends beyond the left
51 * or right edges of the monitor.
52 *
53 * If %GDK_ANCHOR_SLIDE_X is set, the surface can be shifted horizontally to fit
54 * on-screen. If %GDK_ANCHOR_RESIZE_X is set, the surface can be shrunken
55 * horizontally to fit.
56 *
57 * In general, when multiple flags are set, flipping should take precedence over
58 * sliding, which should take precedence over resizing.
59 */
60typedef enum
61{
62 GDK_ANCHOR_FLIP_X = 1 << 0,
63 GDK_ANCHOR_FLIP_Y = 1 << 1,
64 GDK_ANCHOR_SLIDE_X = 1 << 2,
65 GDK_ANCHOR_SLIDE_Y = 1 << 3,
66 GDK_ANCHOR_RESIZE_X = 1 << 4,
67 GDK_ANCHOR_RESIZE_Y = 1 << 5,
68 GDK_ANCHOR_FLIP = GDK_ANCHOR_FLIP_X | GDK_ANCHOR_FLIP_Y,
69 GDK_ANCHOR_SLIDE = GDK_ANCHOR_SLIDE_X | GDK_ANCHOR_SLIDE_Y,
70 GDK_ANCHOR_RESIZE = GDK_ANCHOR_RESIZE_X | GDK_ANCHOR_RESIZE_Y,
71} GdkAnchorHints;
72
73typedef struct _GdkPopupLayout GdkPopupLayout;
74
75#define GDK_TYPE_POPUP_LAYOUT (gdk_popup_layout_get_type ())
76
77GDK_AVAILABLE_IN_ALL
78GType gdk_popup_layout_get_type (void);
79
80GDK_AVAILABLE_IN_ALL
81GdkPopupLayout * gdk_popup_layout_new (const GdkRectangle *anchor_rect,
82 GdkGravity rect_anchor,
83 GdkGravity surface_anchor);
84
85GDK_AVAILABLE_IN_ALL
86GdkPopupLayout * gdk_popup_layout_ref (GdkPopupLayout *layout);
87
88GDK_AVAILABLE_IN_ALL
89void gdk_popup_layout_unref (GdkPopupLayout *layout);
90
91GDK_AVAILABLE_IN_ALL
92GdkPopupLayout * gdk_popup_layout_copy (GdkPopupLayout *layout);
93
94GDK_AVAILABLE_IN_ALL
95gboolean gdk_popup_layout_equal (GdkPopupLayout *layout,
96 GdkPopupLayout *other);
97
98GDK_AVAILABLE_IN_ALL
99void gdk_popup_layout_set_anchor_rect (GdkPopupLayout *layout,
100 const GdkRectangle *anchor_rect);
101
102GDK_AVAILABLE_IN_ALL
103const GdkRectangle * gdk_popup_layout_get_anchor_rect (GdkPopupLayout *layout);
104
105GDK_AVAILABLE_IN_ALL
106void gdk_popup_layout_set_rect_anchor (GdkPopupLayout *layout,
107 GdkGravity anchor);
108
109GDK_AVAILABLE_IN_ALL
110GdkGravity gdk_popup_layout_get_rect_anchor (GdkPopupLayout *layout);
111
112GDK_AVAILABLE_IN_ALL
113void gdk_popup_layout_set_surface_anchor (GdkPopupLayout *layout,
114 GdkGravity anchor);
115
116GDK_AVAILABLE_IN_ALL
117GdkGravity gdk_popup_layout_get_surface_anchor (GdkPopupLayout *layout);
118
119GDK_AVAILABLE_IN_ALL
120void gdk_popup_layout_set_anchor_hints (GdkPopupLayout *layout,
121 GdkAnchorHints anchor_hints);
122
123GDK_AVAILABLE_IN_ALL
124GdkAnchorHints gdk_popup_layout_get_anchor_hints (GdkPopupLayout *layout);
125
126GDK_AVAILABLE_IN_ALL
127void gdk_popup_layout_set_offset (GdkPopupLayout *layout,
128 int dx,
129 int dy);
130
131GDK_AVAILABLE_IN_ALL
132void gdk_popup_layout_get_offset (GdkPopupLayout *layout,
133 int *dx,
134 int *dy);
135
136GDK_AVAILABLE_IN_4_2
137void gdk_popup_layout_set_shadow_width (GdkPopupLayout *layout,
138 int left,
139 int right,
140 int top,
141 int bottom);
142GDK_AVAILABLE_IN_4_2
143void gdk_popup_layout_get_shadow_width (GdkPopupLayout *layout,
144 int *left,
145 int *right,
146 int *top,
147 int *bottom);
148
149
150G_END_DECLS
151
152#endif /* __GDK_POPUP_LAYOUT_H__ */
153

source code of gtk/gdk/gdkpopuplayout.h