You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

156 lines
4.7 KiB
C

#ifndef SARIBBONGLOBAL_H
#define SARIBBONGLOBAL_H
#include <memory>
#include <QtGlobal>
#include <QObject>
/**
@file SARibbonGlobal.h
*/
/**
* @def ribbon {MAJ}.MIN.PAT
*/
#ifndef SA_RIBBON_BAR_VERSION_MAJ
#define SA_RIBBON_BAR_VERSION_MAJ 2
#endif
/**
* @def ribbon MAJ.{MIN}.PAT
*/
#ifndef SA_RIBBON_BAR_VERSION_MIN
#define SA_RIBBON_BAR_VERSION_MIN 0
#endif
/**
* @def ribbon MAJ.MIN.{PAT}
*/
#ifndef SA_RIBBON_BAR_VERSION_PAT
#define SA_RIBBON_BAR_VERSION_PAT 4
#endif
#ifndef SA_RIBBON_BAR_NO_EXPORT
#if defined(SA_RIBBON_BAR_MAKE_LIB) // 定义此宏将构建library
#define SA_RIBBON_EXPORT Q_DECL_EXPORT
#else
#define SA_RIBBON_EXPORT Q_DECL_IMPORT
#endif
#endif
#ifndef SA_RIBBON_EXPORT
#define SA_RIBBON_EXPORT
#endif
/**
* @def 仿Q_DECLARE_PRIVATE
*/
#ifndef SA_RIBBON_DECLARE_PRIVATE
#define SA_RIBBON_DECLARE_PRIVATE(classname) \
class PrivateData; \
friend class classname::PrivateData; \
std::unique_ptr< PrivateData > d_ptr;
#endif
/**
* @def 仿Q_DECLARE_PUBLIC
*/
#ifndef SA_RIBBON_DECLARE_PUBLIC
#define SA_RIBBON_DECLARE_PUBLIC(classname) \
friend class classname; \
classname* q_ptr { nullptr }; \
PrivateData(const PrivateData&) = delete; \
PrivateData& operator=(const PrivateData&) = delete;
#endif
/**
* @brief Ribbon
*/
enum class SARibbonAlignment
{
AlignLeft, ///< 左对齐tab栏左对齐同时category也是左对齐
AlignCenter ///< 居中对其tab栏居中对齐同时category也是居中对齐
};
/**
* @brief ribbon
*
* qssC++qss
*
* ribbon tabmarginQTabBarSARibbonContextCategory
* qssmarginSARibbonTabBar
*/
enum class SARibbonTheme
{
RibbonThemeOffice2013, ///< office2013主题
RibbonThemeOffice2016Blue, ///< office2016-蓝色主题
RibbonThemeOffice2021Blue, ///< office2021-蓝色主题
RibbonThemeWindows7, ///< win7主题
RibbonThemeDark, ///< 暗色主题
RibbonThemeDark2
};
/**
* @def @ref SARibbonCategory @ref SARibbonPannel
* booltrue@ref SARibbonCustomizeWidget SARibbonCategorySARibbonPannel
* trueSARibbonCustomizeWidget
*/
#ifndef SA_RIBBON_BAR_PROP_CAN_CUSTOMIZE
#define SA_RIBBON_BAR_PROP_CAN_CUSTOMIZE "_sa_isCanCustomize"
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
#ifndef SA_FONTMETRICS_WIDTH
#define SA_FONTMETRICS_WIDTH(fm, str) fm.horizontalAdvance(str)
#endif
#else
#ifndef SA_FONTMETRICS_WIDTH
#define SA_FONTMETRICS_WIDTH(fm, str) fm.width(str)
#endif
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#ifndef SA_MOUSEEVENT_GLOBALPOS_POINT
#define SA_MOUSEEVENT_GLOBALPOS_POINT(MouseEventPtr) MouseEventPtr->globalPosition().toPoint()
#endif
#else
#ifndef SA_MOUSEEVENT_GLOBALPOS_POINT
#define SA_MOUSEEVENT_GLOBALPOS_POINT(MouseEventPtr) MouseEventPtr->globalPos()
#endif
#endif
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
#ifndef SA_HOVEREVENT_POS_POINT
#define SA_HOVEREVENT_POS_POINT(HoverEventPtr) HoverEventPtr->position().toPoint()
#endif
#else
#ifndef SA_HOVEREVENT_POS_POINT
#define SA_HOVEREVENT_POS_POINT(HoverEventPtr) HoverEventPtr->pos()
#endif
#endif
/**
@def
*/
#ifndef SA_DEBUG_PRINT_SIZE_HINT
#define SA_DEBUG_PRINT_SIZE_HINT 0
#endif
/**
@def
*/
#ifndef SA_DEBUG_PRINT_EVENT
#define SA_DEBUG_PRINT_EVENT 0
#endif
/**
@def qDebugSARibbonBar
*/
#ifndef SA_DEBUG_PRINT_SARIBBONBAR
#define SA_DEBUG_PRINT_SARIBBONBAR 1
#endif
#endif // SARIBBONGLOBAL_H