pgLab/pglab/plugin_support/LMainWindow.h
eelke f4f2474a81 Moved definition of widget instance actions to the module so other parts of the system can no about them.
The plugin system will create the Action objects and bind them to the specified slots of the
specific widget instances.
2019-01-05 19:58:23 +01:00

58 lines
1.4 KiB
C++

#ifndef LMAINWINDOW_H
#define LMAINWINDOW_H
#include <QMainWindow>
class IPluginContentWidgetContext;
class MenuAction;
class PluginContentWidget;
namespace LMainWindow_details {
class LMainWindowContentContext;
}
class LMainWindow : public QMainWindow {
Q_OBJECT
public:
LMainWindow(QWidget *parent = nullptr);
~LMainWindow();
void initModuleMenus();
void setTabCaptionForWidget(QWidget *widget, const QString &caption, const QString &hint);
void setTabIcon(QWidget *widget, const QString &iconname);
/// Called when a newly created page is added to the QTabWidget
void addPage(PluginContentWidget* page, QString caption);
IPluginContentWidgetContext* context();
protected:
QTabWidget *m_tabWidget = nullptr;
QToolBar *m_mainToolBar = nullptr;
// Standard menu's
QMenu *m_fileMenu = nullptr;
// Standard actions
QAction *m_closeAction = nullptr;
void addModuleMenuActions();
void addModuleWidgetActionsForPage(PluginContentWidget *page);
void removeModuleWidgetActionsForPage(PluginContentWidget *page);
private:
LMainWindow_details::LMainWindowContentContext *m_context;
PluginContentWidget *m_previousPage = nullptr; ///< tracks which pages buttons were previously being displayed
void createActions();
void addMenuAction(const MenuAction &ma);
private slots:
void actionClose_triggered();
void tabWidget_tabCloseRequested(int index);
void tabWidget_currentChanged(int index);
};
#endif // LMAINWINDOW_H