diff options
Diffstat (limited to 'module/topmenumenubarimpl.h')
-rw-r--r-- | module/topmenumenubarimpl.h | 71 |
1 files changed, 71 insertions, 0 deletions
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 <QtCore/QCoreApplication> +#include <QtCore/QDateTime> +#include <QtCore/QHash> +#include <QtCore/QTimer> +#include <QtGui/QAction> +#include <QtGui/QShortcut> +#include <QtGui/QX11Info> +#include <QtGui/private/qabstractplatformmenubar_p.h> +#include <QtGui/private/qt_x11_p.h> + +#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<QAction*> m_rootitems; + + AppMenu *m_appmenu; + + bool m_disable : 1; + bool m_visible : 1; +}; + +#endif // TOPMENUMENUBARIMPL_H |