--- a/ui/qt/menu.h Wed Mar 26 20:27:20 2025 +0100 +++ b/ui/qt/menu.h Wed Mar 26 20:39:04 2025 +0100 @@ -30,105 +30,13 @@ #define MENU_H #include "../ui/menu.h" -#include <ucx/list.h> #include <QMainWindow> #include <QMenu> #include <QMenuBar> #include <QContextMenuEvent> -class UiMenuItemI { -public: - virtual void addTo(UiObject *obj, QMenuBar *menubar, QMenu *menu) = 0; -}; -class UiMenu : public UiMenuItemI { -public: - - UcxList *items; - char *label; - - UiMenu(char *label); - - void addMenuItem(UiMenuItemI *item); - - virtual void addTo(UiObject *obj, QMenuBar *menubar, QMenu *menu); -}; - -class UiMenuItem : public UiMenuItemI { - char *label; - ui_callback callback; - void *userdata; - UcxList *groups; - bool checkable = false; - -public: - UiMenuItem(char *label, ui_callback f, void *userdata); - void addGroup(int group); - void setCheckable(bool c); - - virtual void addTo(UiObject *obj, QMenuBar *menubar, QMenu *menu); -}; - -class UiStMenuItem : public UiMenuItemI { - char *stockid; - ui_callback callback; - void *userdata; - UcxList *groups; - -public: - UiStMenuItem(char *stockid, ui_callback f, void *userdata); - void addGroup(int group); - - virtual void addTo(UiObject *obj, QMenuBar *menubar, QMenu *menu); -}; - -class UiMenuSeparator : public UiMenuItemI { -public: - virtual void addTo(UiObject *obj, QMenuBar *menubar, QMenu *menu); -}; - -class UiCheckItemNV : public UiMenuItemI { - char *label; - char *varname; - -public: - UiCheckItemNV(char *label, char *varname); - virtual void addTo(UiObject *obj, QMenuBar *menubar, QMenu *menu); -}; - - -class UiAction : public QAction { - Q_OBJECT - - UiObject *obj; - ui_callback callback; - void *userdata; - -public: - UiAction(UiObject *obj, QString &label, ui_callback f, void *userdata); - -private slots: - void trigger(); -}; - -void ui_add_menus(UiObject *obj, QMainWindow *window); - -extern "C" int ui_checkitem_get(UiInteger *i); -extern "C" void ui_checkitem_set(UiInteger *i, int value); - -class UiContextMenuHandler : public QObject { - Q_OBJECT - - QWidget *widget; - QMenu *menu; - -public: - UiContextMenuHandler(QWidget *widget, QMenu *menu); - -public slots: - void contextMenuEvent(const QPoint & pos); -}; #endif /* MENU_H */