Inkscape
Vector Graphics Editor
Loading...
Searching...
No Matches
popup-menu.h
Go to the documentation of this file.
1// SPDX-License-Identifier: GPL-2.0-or-later
6/*
7 * Authors:
8 * Daniel Boles <dboles.src+inkscape@gmail.com>
9 *
10 * Copyright (C) 2023 Daniel Boles
11 *
12 * Released under GNU GPL v2+, read the file 'COPYING' for more information.
13 */
14
15#ifndef SEEN_UI_POPUP_MENU_H
16#define SEEN_UI_POPUP_MENU_H
17
18#include <memory>
19#include <optional>
20#include <sigc++/connection.h>
21#include <sigc++/slot.h>
22
23namespace Geom {
24class Point;
25} // namespace Geom
26
27namespace Gdk {
28class Rectangle;
29} // namespace Gdk
30
31namespace Gtk {
32class Popover;
33class Widget;
34} // namespace Gtk
35
36namespace Inkscape::UI {
37
39struct PopupMenuClick { int n_press{}; double x{}, y{}; };
41using PopupMenuOptionalClick = std::optional<PopupMenuClick>;
42
45using PopupMenuSlot = sigc::slot<bool (PopupMenuOptionalClick)>;
46
50void on_popup_menu(Gtk::Widget &widget, PopupMenuSlot slot);
51
57void popup_at(Gtk::Popover &popover, Gtk::Widget &widget,
58 double x_offset = 0.0, double y_offset = 0.0);
60void popup_at(Gtk::Popover &popover, Gtk::Widget &widget,
61 std::optional<Geom::Point> const &offset);
62
64void popup_at_center(Gtk::Popover &popover, Gtk::Widget &widget);
65
68void popup_at(Gtk::Popover &popover, Gtk::Widget &widget, Gdk::Rectangle const &rect);
69
70} // namespace Inkscape::UI
71
72#endif // SEEN_UI_POPUP_MENU_H
73
74/*
75 Local Variables:
76 mode:c++
77 c-file-style:"stroustrup"
78 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
79 indent-tabs-mode:nil
80 fill-column:99
81 End:
82*/
83// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :
pair< double, double > Point
Definition parser.cpp:7
double offset
Various utility functions.
Definition affine.h:22
Definition desktop.h:50
User interface code.
Definition desktop.h:113
void popup_at_center(Gtk::Popover &popover, Gtk::Widget &widget)
As popup_at() but point to center of widget.
void on_popup_menu(Gtk::Widget &widget, PopupMenuSlot slot)
Connect slot to a widgetʼs key and button events that traditionally trigger a popup menu,...
sigc::slot< bool(PopupMenuOptionalClick)> PopupMenuSlot
Return whether a popup was activated.
Definition popup-menu.h:45
static void popup_at(Gtk::Popover &popover, Gtk::Widget &widget, double const x_offset, double const y_offset, int width, int height)
std::optional< PopupMenuClick > PopupMenuOptionalClick
Optional: not present if popup wasnʼt triggered by click.
Definition popup-menu.h:41
Information from a GestureClick if a popup menu was opened by click.
Definition popup-menu.h:39