Inkscape
Vector Graphics Editor
|
A replacement for GTK3ʼs Gtk::Menu, as removed in GTK4. More...
#include <popover-menu.h>
Public Member Functions | |
PopoverMenu (Gtk::PositionType position, bool has_arrow=false) | |
Create popover with CSS classes .menu & .popover-menu , positioned as requested. | |
void | attach (Gtk::Widget &child, int left_attach, int right_attach, int top_attach, int bottom_attach) |
Add child at pos as per Gtk::Menu::attach() | |
void | append (Gtk::Widget &child) |
Add new row containing child, at start/top. | |
void | prepend (Gtk::Widget &child) |
Add new row containing child, at end/bottom. | |
void | remove (Gtk::Widget &child) |
Remove added child. | |
void | remove_all () |
Remove all items. | |
void | append_section_label (Glib::ustring const &markup) |
Append label, w/ markup & the .dim-label style class. | |
void | append_separator () |
Append a horizontal separator. | |
bool | activate (Glib::ustring const &search) |
Find and active from string. | |
void | popup_at (Gtk::Widget &widget, int x_offset=0, int y_offset=0) |
Replace Gtk::Menu::popup_at_pointer. | |
void | popup_at_center (Gtk::Widget &widget) |
As popup_at() but point to center of widget. | |
std::vector< Gtk::Widget * > const & | get_items () |
Get the list of menu items (children of our grid) Take copy, not reference, if you iterate & change items! | |
void | get_children () const =delete |
This would give not the items, rather an internal Grid. Use get_items(). | |
void | get_children ()=delete |
This would give not the items, rather an internal Grid. Use get_items(). | |
Private Member Functions | |
void | check_child_invariants () |
void | set_scrolled_window_size () |
void | unset_items_focus_hover (Gtk::Widget *except_active) |
Private Attributes | |
Gtk::ScrolledWindow & | _scrolled_window |
PopoverMenuGrid & | _grid |
std::vector< Gtk::Widget * > | _items |
Gtk::Label * | _active_search = nullptr |
Friends | |
class | PopoverMenuItem |
class | CompletionPopup |
A replacement for GTK3ʼs Gtk::Menu, as removed in GTK4.
Aim is to be a minimal but mostly “drop-in” replacement for Menus, including grid and activation functionality.
Definition at line 41 of file popover-menu.h.
Inkscape::UI::Widget::PopoverMenu::PopoverMenu | ( | Gtk::PositionType | position, |
bool | has_arrow = false |
||
) |
Create popover with CSS classes .menu
& .popover-menu
, positioned as requested.
Definition at line 47 of file popover-menu.cpp.
References _grid, _scrolled_window, check_child_invariants(), set_scrolled_window_size(), and unset_items_focus_hover().
bool Inkscape::UI::Widget::PopoverMenu::activate | ( | Glib::ustring const & | search | ) |
Find and active from string.
Definition at line 163 of file popover-menu.cpp.
References _active_search, _grid, _items, Inkscape::UI::get_children(), SPItem::hide(), item, label, and mi.
Referenced by Inkscape::UI::Widget::CompletionPopup::CompletionPopup(), and Inkscape::UI::Widget::CompletionPopup::onPopoverKeyPressed().
void Inkscape::UI::Widget::PopoverMenu::append | ( | Gtk::Widget & | child | ) |
Add new row containing child, at start/top.
Definition at line 90 of file popover-menu.cpp.
References _grid, _items, check_child_invariants(), and item.
Referenced by append_section_label(), and append_separator().
void Inkscape::UI::Widget::PopoverMenu::append_section_label | ( | Glib::ustring const & | markup | ) |
Append label, w/ markup & the .dim-label style class.
Definition at line 116 of file popover-menu.cpp.
void Inkscape::UI::Widget::PopoverMenu::append_separator | ( | ) |
Append a horizontal separator.
Definition at line 126 of file popover-menu.cpp.
References append().
void Inkscape::UI::Widget::PopoverMenu::attach | ( | Gtk::Widget & | child, |
int | left_attach, | ||
int | right_attach, | ||
int | top_attach, | ||
int | bottom_attach | ||
) |
Add child at pos as per Gtk::Menu::attach()
Definition at line 78 of file popover-menu.cpp.
References _grid, _items, check_child_invariants(), Inkscape::UI::Widget::height, item, and width.
Referenced by Inkscape::UI::Dialog::DialogNotebook::build_docking_menu().
|
private |
Definition at line 147 of file popover-menu.cpp.
References _grid, _scrolled_window, and Inkscape::UI::is_descendant_of().
Referenced by append(), attach(), PopoverMenu(), and prepend().
|
delete |
This would give not the items, rather an internal Grid. Use get_items().
|
delete |
This would give not the items, rather an internal Grid. Use get_items().
std::vector< Gtk::Widget * > const & Inkscape::UI::Widget::PopoverMenu::get_items | ( | ) |
Get the list of menu items (children of our grid) Take copy, not reference, if you iterate & change items!
Definition at line 142 of file popover-menu.cpp.
References _items.
void Inkscape::UI::Widget::PopoverMenu::popup_at | ( | Gtk::Widget & | widget, |
int | x_offset = 0 , |
||
int | y_offset = 0 |
||
) |
Replace Gtk::Menu::popup_at_pointer.
If x or y offsets != 0, :pointing-to is set to {x,y,1,1} widget must be the parent passed to self constructor or a descendant.
Definition at line 131 of file popover-menu.cpp.
References Inkscape::UI::popup_at().
void Inkscape::UI::Widget::PopoverMenu::popup_at_center | ( | Gtk::Widget & | widget | ) |
As popup_at() but point to center of widget.
Definition at line 137 of file popover-menu.cpp.
References Inkscape::UI::popup_at_center().
void Inkscape::UI::Widget::PopoverMenu::prepend | ( | Gtk::Widget & | child | ) |
Add new row containing child, at end/bottom.
Definition at line 98 of file popover-menu.cpp.
References _grid, _items, check_child_invariants(), and item.
void Inkscape::UI::Widget::PopoverMenu::remove | ( | Gtk::Widget & | child | ) |
Remove added child.
Definition at line 106 of file popover-menu.cpp.
void Inkscape::UI::Widget::PopoverMenu::remove_all | ( | ) |
Remove all items.
Definition at line 222 of file popover-menu.cpp.
References _grid, _items, and item.
Referenced by Inkscape::UI::Dialog::LivePathEffectEditor::add_lpes().
|
private |
Definition at line 155 of file popover-menu.cpp.
References _scrolled_window.
Referenced by PopoverMenu().
|
private |
Definition at line 213 of file popover-menu.cpp.
Referenced by Inkscape::UI::Widget::CompletionPopup::onPopoverKeyPressed(), and PopoverMenu().
|
friend |
Definition at line 94 of file popover-menu.h.
|
friend |
Definition at line 93 of file popover-menu.h.
|
private |
Definition at line 88 of file popover-menu.h.
Referenced by activate().
|
private |
Definition at line 86 of file popover-menu.h.
Referenced by activate(), append(), attach(), check_child_invariants(), PopoverMenu(), prepend(), remove(), and remove_all().
|
private |
Definition at line 87 of file popover-menu.h.
Referenced by activate(), append(), attach(), get_items(), prepend(), remove(), remove_all(), and unset_items_focus_hover().
|
private |
Definition at line 85 of file popover-menu.h.
Referenced by check_child_invariants(), PopoverMenu(), and set_scrolled_window_size().