From 982ebc96f2c77c1f9dbddd6a4c0a776c74b425de Mon Sep 17 00:00:00 2001 From: Javier Date: Tue, 28 Jan 2014 17:21:16 +0100 Subject: initial import --- module/topmenumenubarimpl.h | 71 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 module/topmenumenubarimpl.h (limited to 'module/topmenumenubarimpl.h') diff --git a/module/topmenumenubarimpl.h b/module/topmenumenubarimpl.h new file mode 100644 index 0000000..7573f76 --- /dev/null +++ b/module/topmenumenubarimpl.h @@ -0,0 +1,71 @@ +#ifndef TOPMENUMENUBARIMPL_H +#define TOPMENUMENUBARIMPL_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "menuproxy.h" + +class AppMenu; +typedef struct _TopMenuMonitor TopMenuMonitor; +typedef struct _TopMenuAppMenuBar TopMenuAppMenuBar; + +class TopMenuMenuBarImpl : public MenuProxy, public QAbstractPlatformMenuBar { + Q_OBJECT + +public: + explicit TopMenuMenuBarImpl(QObject *parent = 0); + ~TopMenuMenuBarImpl(); + + void init(QMenuBar *); + + void setVisible(bool visible); + + void actionEvent(QActionEvent*); + + void handleReparent(QWidget *oldParent, QWidget *newParent, QWidget *oldWindow, QWidget *newWindow); + + bool allowCornerWidgets() const; + + void popupAction(QAction*); + + void setNativeMenuBar(bool); + bool isNativeMenuBar() const; + + bool shortcutsHandledByNativeMenuBar() const; + bool menuBarEventFilter(QObject *, QEvent *event); + +protected: + GtkMenuItem * addAction(QAction* action, QAction* before, QMenu* parent); + void removeAction(QAction* action); + void updateAction(QAction* action); + +private: + QShortcut * createMnemonicShortcut(QAction *action, QWidget *parent); + +private slots: + void handleShortcutActivated(); + +private: + static bool staticInitialized; + static TopMenuMonitor *menuMonitor; + + QWidget *m_window; + TopMenuAppMenuBar *m_menubar; + + QList m_rootitems; + + AppMenu *m_appmenu; + + bool m_disable : 1; + bool m_visible : 1; +}; + +#endif // TOPMENUMENUBARIMPL_H -- cgit v1.2.3