aboutsummaryrefslogtreecommitdiff
path: root/module/topmenumenubarimpl.h
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2014-01-28 17:21:16 +0100
committerJavier <dev.git@javispedro.com>2014-01-28 17:21:16 +0100
commit982ebc96f2c77c1f9dbddd6a4c0a776c74b425de (patch)
tree6800326ba4da9c84dc14f0b442f088b1c2fb63bf /module/topmenumenubarimpl.h
downloadtopmenu-qt-982ebc96f2c77c1f9dbddd6a4c0a776c74b425de.tar.gz
topmenu-qt-982ebc96f2c77c1f9dbddd6a4c0a776c74b425de.zip
initial import
Diffstat (limited to 'module/topmenumenubarimpl.h')
-rw-r--r--module/topmenumenubarimpl.h71
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