6#ifndef iwidgets_CMultiPageWidget_included
7#define iwidgets_CMultiPageWidget_included
11#include <QtCore/QSize>
13#include <QtCore/QtGlobal>
15#include <QtWidgets/QWidget>
85 QWidget* parentWidgetPtr =
nullptr,
88 Qt::Orientation orientation = Qt::Vertical);
132 QWidget* pageWidgetPtr,
133 const QString& pageTitle,
224 template<
class DelegateImpl>
243 typedef std::shared_ptr<IMultiPageWidgetDelegate> MultiPageWidgetDelegatePtr;
248 bool CreateContainerGui();
253 MultiPageWidgetDelegatePtr GetCurrentDelegate()
const;
256 typedef QMap<int, MultiPageWidgetDelegatePtr> ContainerWidgetDelegateMap;
258 ContainerWidgetDelegateMap m_containerWidgetDelegateMap;
263 std::unique_ptr<QWidget> m_guiContainerPtr;
267 int m_containerGuiFlags;
269 Qt::Orientation m_orientation;
271 QSize m_pageIconSize;
276 bool m_pageSwitchingBlocked;
280template<
class DelegateImpl>
283 MultiPageWidgetDelegatePtr delegatePtr = MultiPageWidgetDelegatePtr(
new DelegateImpl);
285 m_containerWidgetDelegateMap[uiMode] = delegatePtr;
Implementation of the widget, which is represented as a set of pages.
virtual QIcon GetPageIcon(int pageIndex) const
Get the page icon.
void OnPageIndexChanged(int pageIndex)
void SetLayoutOrientation(Qt::Orientation orientation)
Set layout orientation for the pages in the container UI.
virtual bool SetPageVisible(int pageIndex, bool isPageVisible=true)
Set page visible/hidden.
virtual bool IsPageVisible(int pageIndex) const
Get if the page visible/hidden.
virtual QSize GetPageIconSize() const
Get the size page icon.
void SetContainerGuiFlags(int containerGuiFlags)
Set flags for container behavior.
void RegisterMultiPageWidgetDelegate(int uiMode)
Register your own page widget delegate objects for the given UI mode.
virtual bool SetCurrentPage(int pageIndex)
Set active page in the container.
virtual bool SetPageEnabled(int pageIndex, bool isPageEnabled=true)
Set page enabled/disabled.
virtual QWidget * GetPageWidgetPtr(int pageIndex) const
Get page's widget from the container.
virtual bool IsPageEnabled(int pageIndex) const
Get if the page enabled/disabled.
virtual void SetPageTitle(int pageIndex, const QString &pageTitle)
Set the page title.
void EmitPageIndexChanged(int pageIndex)
Signal will be emitted whenever the currently selected page will be changed.
virtual QString GetPageTitle(int pageIndex) const
Get the title of the given page.
void SetDesignMode(int designMode)
Set design mode.
virtual void SetPageHeaderPosition(PageHeaderPosition pageHeaderPosition)
Set the position of the page header on the container UI.
virtual void ResetPages()
Remove all pages from the container widget.
CMultiPageWidget(QWidget *parentWidgetPtr=nullptr, int designMode=DT_SIMPLE, int containerGuiFlags=IMultiPageWidgetDelegate::CGF_NONE, Qt::Orientation orientation=Qt::Vertical)
Construct the multi page widget.
virtual void SetPageToolTip(int pageIndex, const QString &pageToolTip)
Set the page tool tip.
virtual bool SetPageIconSize(const QSize &pageIconSize)
Set the size of the icon for all pages in the container.
virtual int GetCurrentPage() const
Get currently active page in the container.
virtual QString GetPageToolTip(int pageIndex) const
Get the page tool tip.
virtual void SetPageIcon(int pageIndex, const QIcon &pageIcon)
Set the page icon.
virtual int InsertPage(QWidget *pageWidgetPtr, const QString &pageTitle, int pageIndex=-1)
Add a new page to the container.
virtual void RemovePage(int pageIndex)
Remove the page from the container.
@ DT_SIMPLE
The pages will be placed simple beside each other.
@ DT_TOOL_BOX
The pages are grouped in a tool box.
@ DT_TAB_WIDGET
The pages are grouped in a tab widget.
@ DT_STACK
The pages are grouped in a stack layout.
@ DT_COLLAPSIBLE_GROUPS
The pages will be placed into collapsible panels.
@ DT_USER
User defined container implementation.
@ DT_MINI_WIDGETS
The pages will be placed into a mini-widget container.
@ DT_SPLITTER
The same as DT_SIMPLE but a splitter manager is used for lay-outing of the pages.
IMultiPageWidgetDelegate::PageHeaderPosition PageHeaderPosition
virtual int GetPagesCount() const
Get the number of the pages in the container.
static bool IsPageIndexChangeSupported(int designMode)
Check if switching of pages is supported for this UI mode.
virtual QWidget * GetContainerWidgetPtr() const
Get page container widget.
@ CGF_NONE
Default behavior of the UI container.
PageHeaderPosition
Enum for describing of page header bar position on the container widget.