forked from aya/aya
Initial commit
This commit is contained in:
194
third-party/QtitanRibbon/CMakeLists.txt
vendored
Normal file
194
third-party/QtitanRibbon/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTORCC ON)
|
||||
|
||||
set_source_files_properties(src/ribbondsgn/QtnRibbonStyleDsgnPlugin.cpp PROPERTIES SKIP_AUTOMOC TRUE)
|
||||
|
||||
add_library(QtitanRibbon STATIC
|
||||
src/include/QtitanDef.h
|
||||
src/include/QtitanRibbon.h
|
||||
src/include/QtnCommonStyle.h
|
||||
src/include/QtnOfficePopupColorButton.h
|
||||
src/include/QtnOfficePopupMenu.h
|
||||
src/include/QtnOfficePopupWindow.h
|
||||
src/include/QtnOfficeStyle.h
|
||||
src/include/QtnRibbonBackstageView.h
|
||||
src/include/QtnRibbonBar.h
|
||||
src/include/QtnRibbonButtonControls.h
|
||||
src/include/QtnRibbonCustomizeDialog.h
|
||||
src/include/QtnRibbonCustomizeManager.h
|
||||
src/include/QtnRibbonCustomizePage.h
|
||||
src/include/QtnRibbonDef.h
|
||||
src/include/QtnRibbonGallery.h
|
||||
src/include/QtnRibbonGalleryControls.h
|
||||
src/include/QtnRibbonGroup.h
|
||||
src/include/QtnRibbonInputControls.h
|
||||
src/include/QtnRibbonMainWindow.h
|
||||
src/include/QtnRibbonPage.h
|
||||
src/include/QtnRibbonQuickAccessBar.h
|
||||
src/include/QtnRibbonSliderPane.h
|
||||
src/include/QtnRibbonStatusBar.h
|
||||
src/include/QtnRibbonStyle.h
|
||||
src/include/QtnRibbonSystemPopupBar.h
|
||||
src/include/QtnRibbonToolTip.h
|
||||
src/include/QtnRibbonWorkspace.h
|
||||
src/include/QtnStyleHelpers.h
|
||||
|
||||
src/base/QtitanDef.h
|
||||
src/base/QtitanMSVSDebug.h
|
||||
|
||||
# Ribbon
|
||||
src/ribbon/QtnOfficeFrameHelper_win.cpp
|
||||
src/ribbon/QtnOfficeFrameHelper_win.h
|
||||
src/ribbon/QtnOfficeFrameHelper.h
|
||||
src/ribbon/QtnOfficePopupColorButton.cpp
|
||||
src/ribbon/QtnOfficePopupColorButton.h
|
||||
src/ribbon/QtnOfficePopupMenu.cpp
|
||||
src/ribbon/QtnOfficePopupMenu.h
|
||||
src/ribbon/QtnOfficePopupWindow.cpp
|
||||
src/ribbon/QtnOfficePopupWindow.h
|
||||
src/ribbon/QtnRibbonBackstageView.cpp
|
||||
src/ribbon/QtnRibbonBackstageView.h
|
||||
src/ribbon/QtnRibbonBackstageViewPrivate.h
|
||||
src/ribbon/QtnRibbonBar.cpp
|
||||
src/ribbon/QtnRibbonBar.h
|
||||
src/ribbon/QtnRibbonBarCustomizePage.ui
|
||||
src/ribbon/QtnRibbonBarPrivate.h
|
||||
src/ribbon/QtnRibbonButtonControls.cpp
|
||||
src/ribbon/QtnRibbonButtonControls.h
|
||||
src/ribbon/QtnRibbonButtonPrivate.cpp
|
||||
src/ribbon/QtnRibbonButtonPrivate.h
|
||||
src/ribbon/QtnRibbonControls.cpp
|
||||
src/ribbon/QtnRibbonControls.h
|
||||
src/ribbon/QtnRibbonControlsPrivate.h
|
||||
src/ribbon/QtnRibbonCustomizeDialog.cpp
|
||||
src/ribbon/QtnRibbonCustomizeDialog.h
|
||||
src/ribbon/QtnRibbonCustomizeDialogPrivate.h
|
||||
src/ribbon/QtnRibbonCustomizeManager.cpp
|
||||
src/ribbon/QtnRibbonCustomizeManager.h
|
||||
src/ribbon/QtnRibbonCustomizeManagerPrivate.h
|
||||
src/ribbon/QtnRibbonCustomizePage.cpp
|
||||
src/ribbon/QtnRibbonCustomizePage.h
|
||||
src/ribbon/QtnRibbonDef.cpp
|
||||
src/ribbon/QtnRibbonDef.h
|
||||
src/ribbon/QtnRibbonGallery.cpp
|
||||
src/ribbon/QtnRibbonGallery.h
|
||||
src/ribbon/QtnRibbonGalleryControls.cpp
|
||||
src/ribbon/QtnRibbonGalleryControls.h
|
||||
src/ribbon/QtnRibbonGalleryPrivate.h
|
||||
src/ribbon/QtnRibbonGroup.cpp
|
||||
src/ribbon/QtnRibbonGroup.h
|
||||
src/ribbon/QtnRibbonGroupPrivate.h
|
||||
src/ribbon/QtnRibbonInputControls.cpp
|
||||
src/ribbon/QtnRibbonInputControls.h
|
||||
src/ribbon/QtnRibbonMainWindow.cpp
|
||||
src/ribbon/QtnRibbonMainWindow.h
|
||||
src/ribbon/QtnRibbonPage.cpp
|
||||
src/ribbon/QtnRibbonPage.h
|
||||
src/ribbon/QtnRibbonPagePrivate.h
|
||||
src/ribbon/QtnRibbonPrivate.cpp
|
||||
src/ribbon/QtnRibbonPrivate.h
|
||||
src/ribbon/QtnRibbonQuickAccessBar.cpp
|
||||
src/ribbon/QtnRibbonQuickAccessBar.h
|
||||
src/ribbon/QtnRibbonQuickAccessBarCustomizePage.ui
|
||||
src/ribbon/QtnRibbonRenameDialog.ui
|
||||
src/ribbon/QtnRibbonSliderPane.cpp
|
||||
src/ribbon/QtnRibbonSliderPane.h
|
||||
src/ribbon/QtnRibbonStatusBar.cpp
|
||||
src/ribbon/QtnRibbonStatusBar.h
|
||||
src/ribbon/QtnRibbonSystemPopupBar.cpp
|
||||
src/ribbon/QtnRibbonSystemPopupBar.h
|
||||
src/ribbon/QtnRibbonTabBar.cpp
|
||||
src/ribbon/QtnRibbonTabBar.h
|
||||
src/ribbon/QtnRibbonToolTip.cpp
|
||||
src/ribbon/QtnRibbonToolTip.h
|
||||
src/ribbon/QtnRibbonWorkspace.cpp
|
||||
src/ribbon/QtnRibbonWorkspace.h
|
||||
|
||||
# Ribbon Design
|
||||
src/ribbondsgn/QtitanRibbon_Backstage_Page.ui
|
||||
src/ribbondsgn/QtitanRibbon_Main_Window.ui
|
||||
src/ribbondsgn/QtnCommandDsgn.cpp
|
||||
src/ribbondsgn/QtnCommandDsgn.h
|
||||
src/ribbondsgn/QtnMainWindowDsgnContainer.cpp
|
||||
src/ribbondsgn/QtnMainWindowDsgnContainer.h
|
||||
src/ribbondsgn/QtnMainWindowDsgnTaskMenu.cpp
|
||||
src/ribbondsgn/QtnMainWindowDsgnTaskMenu.h
|
||||
src/ribbondsgn/QtnRibbonBackstageViewDsgnPlugin.cpp
|
||||
src/ribbondsgn/QtnRibbonBackstageViewDsgnPlugin.h
|
||||
src/ribbondsgn/QtnRibbonBarDsgnPlugin.cpp
|
||||
src/ribbondsgn/QtnRibbonBarDsgnPlugin.h
|
||||
src/ribbondsgn/QtnRibbonDsgnContainer.cpp
|
||||
src/ribbondsgn/QtnRibbonDsgnContainer.h
|
||||
src/ribbondsgn/QtnRibbonDsgnPlugins.cpp
|
||||
src/ribbondsgn/QtnRibbonDsgnPlugins.h
|
||||
src/ribbondsgn/QtnRibbonDsgnTaskMenu.cpp
|
||||
src/ribbondsgn/QtnRibbonDsgnTaskMenu.h
|
||||
src/ribbondsgn/QtnRibbonGroupDsgnPlugin.cpp
|
||||
src/ribbondsgn/QtnRibbonGroupDsgnPlugin.h
|
||||
src/ribbondsgn/QtnRibbonMainWindowDsgnPlugin.cpp
|
||||
src/ribbondsgn/QtnRibbonMainWindowDsgnPlugin.h
|
||||
src/ribbondsgn/QtnRibbonPageDsgnPlugin.cpp
|
||||
src/ribbondsgn/QtnRibbonPageDsgnPlugin.h
|
||||
src/ribbondsgn/QtnRibbonStyleDsgnPlugin.cpp
|
||||
src/ribbondsgn/QtnRibbonStyleDsgnPlugin.h
|
||||
src/ribbondsgn/QtnRibbonWorkspaceDsgnPlugin.cpp
|
||||
src/ribbondsgn/QtnRibbonWorkspaceDsgnPlugin.h
|
||||
src/ribbondsgn/QtnStatusBarDsgnPlugin.cpp
|
||||
src/ribbondsgn/QtnStatusBarDsgnPlugin.h
|
||||
src/ribbondsgn/ribbondsgn.pro
|
||||
|
||||
# Ribbon Styles
|
||||
src/styles/QtnCommonPaintManager.cpp
|
||||
src/styles/QtnCommonStyle_linux.cpp
|
||||
src/styles/QtnCommonStyle_win.cpp
|
||||
src/styles/QtnCommonStyle.cpp
|
||||
src/styles/QtnCommonStyle.h
|
||||
src/styles/QtnCommonStylePrivate.h
|
||||
src/styles/QtnOfficePaintManager.cpp
|
||||
src/styles/QtnOfficeStyle.cpp
|
||||
src/styles/QtnOfficeStyle.h
|
||||
src/styles/QtnOfficeStylePrivate.h
|
||||
src/styles/QtnPopupHelpers.cpp
|
||||
src/styles/QtnPopupHelpers.h
|
||||
src/styles/QtnRibbonPaintManager.cpp
|
||||
src/styles/QtnRibbonStyle.cpp
|
||||
src/styles/QtnRibbonStyle.h
|
||||
src/styles/QtnRibbonStylePrivate.h
|
||||
src/styles/QtnStyleHelpers.cpp
|
||||
src/styles/QtnStyleHelpers.h
|
||||
src/styles/styles.pri
|
||||
)
|
||||
|
||||
# hack
|
||||
if(AYA_OS_LINUX)
|
||||
target_include_directories(QtitanRibbon PUBLIC "/usr/include/qt/QtDesigner")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(QtitanRibbon PRIVATE QTITAN_STATIC QTITAN_LIBRARY QTITAN_LIBRARY_STATIC)
|
||||
target_include_directories(QtitanRibbon
|
||||
PRIVATE
|
||||
# TODO: do we still need these two?
|
||||
${Qt6Gui_PRIVATE_INCLUDE_DIRS}
|
||||
${QtWidgets_PRIVATE_INCLUDE_DIRS}
|
||||
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/base
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/ribbon
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/ribbondsgn
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/styles
|
||||
PUBLIC
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src/include
|
||||
)
|
||||
|
||||
target_link_libraries(QtitanRibbon PRIVATE
|
||||
Qt6::Widgets
|
||||
Qt6::Core
|
||||
Qt6::Concurrent
|
||||
Qt6::Gui
|
||||
Qt6::Designer
|
||||
)
|
||||
|
||||
if(AYA_OS_WINDOWS)
|
||||
target_link_libraries(QtitanRibbon PRIVATE Comctl32.lib)
|
||||
endif()
|
||||
243
third-party/QtitanRibbon/src/base/QtitanDef.h
vendored
Normal file
243
third-party/QtitanRibbon/src/base/QtitanDef.h
vendored
Normal file
@@ -0,0 +1,243 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#ifndef QTITAN_DEF_H
|
||||
#define QTITAN_DEF_H
|
||||
|
||||
#include <QtCore/QProcess>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QObject>
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QColor>
|
||||
#include <QtGui/QPalette>
|
||||
#include <QtWidgets/QApplication>
|
||||
|
||||
#define QTITAN_NAMESPACE Qtitan
|
||||
|
||||
#if !defined(QTITAN_NAMESPACE) /*|| defined(Q_MOC_RUN)*/
|
||||
#define QTITAN_BEGIN_NAMESPACE
|
||||
#define QTITAN_END_NAMESPACE
|
||||
#define QTITAN_USE_NAMESPACE
|
||||
#define QT_PREPEND_NAMESPACE_QTITAN(name) ::name
|
||||
#else
|
||||
#define QTITAN_BEGIN_NAMESPACE \
|
||||
namespace QTITAN_NAMESPACE \
|
||||
{
|
||||
#define QTITAN_END_NAMESPACE }
|
||||
#define QTITAN_USE_NAMESPACE using namespace QTITAN_NAMESPACE;
|
||||
#define QT_PREPEND_NAMESPACE_QTITAN(name) ::QTITAN_NAMESPACE::name
|
||||
#endif
|
||||
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QTITAN_LIBRARY_STATIC
|
||||
#ifdef QTITAN_LIBRARY
|
||||
#define QTITAN_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
#define QTITAN_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
#else
|
||||
#define QTITAN_EXPORT
|
||||
#endif
|
||||
|
||||
#define QTN_QUOTE_(x) #x
|
||||
#define QTN_QUOTE(x) QTN_QUOTE_(x)
|
||||
|
||||
#define Q_NULL 0
|
||||
#define Q_MAXINT INT_MAX
|
||||
#define Q_DELETE_AND_NULL(x) \
|
||||
delete x; \
|
||||
x = Q_NULL;
|
||||
|
||||
#ifndef Q_DECL_NOTHROW
|
||||
#define Q_DECL_NOTHROW throw()
|
||||
#endif
|
||||
|
||||
#define QTN_DECLARE_PRIVATE(Class) \
|
||||
friend class Class##Private; \
|
||||
Class##Private* qtn_d_ptr; \
|
||||
Class##Private& qtn_d() \
|
||||
{ \
|
||||
return *qtn_d_ptr; \
|
||||
} \
|
||||
const Class##Private& qtn_d() const \
|
||||
{ \
|
||||
return *qtn_d_ptr; \
|
||||
}
|
||||
|
||||
#define QTN_DECLARE_PUBLIC(Class) \
|
||||
friend class Class; \
|
||||
Class* qtn_p_ptr; \
|
||||
inline void setPublic(Class* ptr) \
|
||||
{ \
|
||||
qtn_p_ptr = ptr; \
|
||||
} \
|
||||
Class& qtn_p() \
|
||||
{ \
|
||||
return *qtn_p_ptr; \
|
||||
} \
|
||||
const Class& qtn_p() const \
|
||||
{ \
|
||||
return *qtn_p_ptr; \
|
||||
}
|
||||
#define QTN_INIT_PRIVATE(Class) \
|
||||
qtn_d_ptr = new Class##Private(); \
|
||||
qtn_d_ptr->setPublic(this);
|
||||
#define QTN_D(Class) Class##Private& d = qtn_d();
|
||||
#define QTN_P(Class) Class& p = qtn_p();
|
||||
#define QTN_FINI_PRIVATE() \
|
||||
delete qtn_d_ptr; \
|
||||
qtn_d_ptr = Q_NULL;
|
||||
|
||||
#define QTN_DECLARE_EX_PRIVATE(Class) \
|
||||
friend class Class##Private; \
|
||||
Class##Private& qtn_d() \
|
||||
{ \
|
||||
return reinterpret_cast<Class##Private&>(*qtn_d_ptr); \
|
||||
} \
|
||||
const Class##Private& qtn_d() const \
|
||||
{ \
|
||||
return reinterpret_cast<const Class##Private&>(*qtn_d_ptr); \
|
||||
}
|
||||
|
||||
#define QTN_DECLARE_EX_PUBLIC(Class) \
|
||||
friend class Class; \
|
||||
Class& qtn_p() \
|
||||
{ \
|
||||
return static_cast<Class&>(*qtn_p_ptr); \
|
||||
} \
|
||||
const Class& qtn_p() const \
|
||||
{ \
|
||||
return static_cast<Class&>(*qtn_p_ptr); \
|
||||
}
|
||||
|
||||
/* BaseEventArgs */
|
||||
class QTITAN_EXPORT BaseEventArgs : public QObject
|
||||
{
|
||||
public:
|
||||
BaseEventArgs()
|
||||
: m_handled(false)
|
||||
{
|
||||
}
|
||||
bool isHandled() const
|
||||
{
|
||||
return m_handled;
|
||||
}
|
||||
void setHandled(bool handled)
|
||||
{
|
||||
m_handled = handled;
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_handled;
|
||||
};
|
||||
|
||||
inline QString create_qtitan_className(const QString& className)
|
||||
{
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
return "Qtitan::" + className;
|
||||
#else
|
||||
return className;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline QString getSystemEnvironmentVariable(const QString& key)
|
||||
{
|
||||
QStringList all = QProcess::systemEnvironment();
|
||||
for (QStringList::const_iterator it = all.constBegin(); it != all.constEnd(); ++it)
|
||||
{
|
||||
QStringList pair = it->split(QLatin1String("="));
|
||||
if (pair.size() != 2)
|
||||
continue;
|
||||
if (key.compare(pair[0], Qt::CaseInsensitive) == 0)
|
||||
return pair[1];
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
inline QString getEnvironmentVariable(QProcess* process, const QString& key)
|
||||
{
|
||||
QStringList all = process->environment();
|
||||
for (QStringList::const_iterator it = all.constBegin(); it != all.constEnd(); ++it)
|
||||
{
|
||||
QStringList pair = it->split(QLatin1String("="));
|
||||
if (pair.size() != 2)
|
||||
continue;
|
||||
if (key.compare(pair[0], Qt::CaseInsensitive) == 0)
|
||||
return pair[1];
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
inline void setEnvironmentVariable(QProcess* process, const QString& key, const QString& value)
|
||||
{
|
||||
QStringList all = process->environment();
|
||||
QStringList::iterator it = all.begin();
|
||||
for (; it != all.end(); ++it)
|
||||
{
|
||||
QStringList pair = it->split(QLatin1String("="));
|
||||
if (pair.size() != 2)
|
||||
continue;
|
||||
if (key.compare(pair[0], Qt::CaseInsensitive) == 0)
|
||||
break;
|
||||
}
|
||||
if (it != all.end())
|
||||
*it = QString::fromLatin1("%1=%2").arg(key).arg(value);
|
||||
else
|
||||
all.push_back(QString::fromLatin1("%1=%2").arg(key).arg(value));
|
||||
process->setEnvironment(all);
|
||||
}
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
inline bool isSystemDarkMode()
|
||||
{
|
||||
#if defined(Q_OS_WIN)
|
||||
// Windows 10+ system dark mode check using registry
|
||||
QSettings settings(R"(HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes\Personalize)", QSettings::NativeFormat);
|
||||
return settings.value("AppsUseLightTheme", 1).toInt() == 0;
|
||||
|
||||
#elif defined(Q_OS_MACOS)
|
||||
// macOS: Use appearanceName in Qt 6
|
||||
if (auto hints = QGuiApplication::styleHints(); hints)
|
||||
return hints->colorScheme() == Qt::ColorScheme::Dark;
|
||||
return false;
|
||||
|
||||
#else
|
||||
// Linux / Other: fallback heuristic
|
||||
QColor bg = QApplication::palette().color(QPalette::Window);
|
||||
return bg.lightness() < 128; // dark background implies dark mode
|
||||
#endif
|
||||
}
|
||||
|
||||
#define DARKMODE isSystemDarkMode()
|
||||
|
||||
#endif // QTITAN_DEF_H
|
||||
49
third-party/QtitanRibbon/src/base/QtitanMSVSDebug.h
vendored
Normal file
49
third-party/QtitanRibbon/src/base/QtitanMSVSDebug.h
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef QTITAN_MSVSDEBUG_H
|
||||
#define QTITAN_MSVSDEBUG_H
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#ifdef __AFX_H__
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
#define THIS_FILE __FILE__
|
||||
#endif
|
||||
#else // __AFX_H__
|
||||
#define _CRTDBG_MAP_ALLOC
|
||||
#include <stdlib.h>
|
||||
#include <crtdbg.h>
|
||||
#ifdef _DEBUG
|
||||
#define new new(_NORMAL_BLOCK, __FILE__, __LINE__)
|
||||
#endif
|
||||
#endif // __AFX_H__
|
||||
#endif // _MSC_VER
|
||||
|
||||
#endif //QTITAN_MSVSDEBUG_H
|
||||
|
||||
3
third-party/QtitanRibbon/src/include/QtitanDef.h
vendored
Normal file
3
third-party/QtitanRibbon/src/include/QtitanDef.h
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
#include "../base/QtitanDef.h"
|
||||
|
||||
|
||||
51
third-party/QtitanRibbon/src/include/QtitanRibbon.h
vendored
Normal file
51
third-party/QtitanRibbon/src/include/QtitanRibbon.h
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Ribbon UI for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2017 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "QtnOfficeStyle.h"
|
||||
|
||||
#include "QtnRibbonMainWindow.h"
|
||||
#include "QtnRibbonSystemPopupBar.h"
|
||||
#include "QtnRibbonSliderPane.h"
|
||||
#include "QtnRibbonBar.h"
|
||||
#include "QtnRibbonGroup.h"
|
||||
#include "QtnRibbonPage.h"
|
||||
#include "QtnRibbonStatusBar.h"
|
||||
#include "QtnRibbonStyle.h"
|
||||
#include "QtnRibbonToolTip.h"
|
||||
#include "QtnOfficePopupMenu.h"
|
||||
#include "QtnOfficePopupColorButton.h"
|
||||
#include "QtnRibbonInputControls.h"
|
||||
#include "QtnRibbonButtonControls.h"
|
||||
#include "QtnRibbonGalleryControls.h"
|
||||
#include "QtnRibbonWorkspace.h"
|
||||
#include "QtnRibbonQuickAccessBar.h"
|
||||
#include "QtnRibbonCustomizeManager.h"
|
||||
#include "QtnRibbonCustomizeDialog.h"
|
||||
#include "QtnStyleHelpers.h"
|
||||
#include "QtnRibbonBackstageView.h"
|
||||
|
||||
using namespace Qtitan;
|
||||
1
third-party/QtitanRibbon/src/include/QtnCommonStyle.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnCommonStyle.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../styles/QtnCommonStyle.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnOfficePopupColorButton.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnOfficePopupColorButton.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnOfficePopupColorButton.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnOfficePopupMenu.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnOfficePopupMenu.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnOfficePopupMenu.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnOfficePopupWindow.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnOfficePopupWindow.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnOfficePopupWindow.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnOfficeStyle.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnOfficeStyle.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../styles/QtnOfficeStyle.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonBackstageView.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonBackstageView.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonBackstageView.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonBar.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonBar.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonBar.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonButtonControls.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonButtonControls.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonButtonControls.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonCustomizeDialog.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonCustomizeDialog.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonCustomizeDialog.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonCustomizeManager.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonCustomizeManager.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonCustomizeManager.h"
|
||||
2
third-party/QtitanRibbon/src/include/QtnRibbonCustomizePage.h
vendored
Normal file
2
third-party/QtitanRibbon/src/include/QtnRibbonCustomizePage.h
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "../ribbon/QtnRibbonCustomizePage.h"
|
||||
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonDef.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonDef.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonDef.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonGallery.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonGallery.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonGallery.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonGalleryControls.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonGalleryControls.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonGalleryControls.h"
|
||||
2
third-party/QtitanRibbon/src/include/QtnRibbonGroup.h
vendored
Normal file
2
third-party/QtitanRibbon/src/include/QtnRibbonGroup.h
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "../ribbon/QtnRibbonGroup.h"
|
||||
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonInputControls.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonInputControls.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonInputControls.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonMainWindow.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonMainWindow.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonMainWindow.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonPage.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonPage.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonPage.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonQuickAccessBar.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonQuickAccessBar.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonQuickAccessBar.h"
|
||||
2
third-party/QtitanRibbon/src/include/QtnRibbonSliderPane.h
vendored
Normal file
2
third-party/QtitanRibbon/src/include/QtnRibbonSliderPane.h
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "../ribbon/QtnRibbonSliderPane.h"
|
||||
|
||||
2
third-party/QtitanRibbon/src/include/QtnRibbonStatusBar.h
vendored
Normal file
2
third-party/QtitanRibbon/src/include/QtnRibbonStatusBar.h
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
#include "../ribbon/QtnRibbonStatusBar.h"
|
||||
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonStyle.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonStyle.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../styles/QtnRibbonStyle.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonSystemPopupBar.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonSystemPopupBar.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonSystemPopupBar.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonToolTip.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonToolTip.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonToolTip.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnRibbonWorkspace.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnRibbonWorkspace.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../ribbon/QtnRibbonWorkspace.h"
|
||||
1
third-party/QtitanRibbon/src/include/QtnStyleHelpers.h
vendored
Normal file
1
third-party/QtitanRibbon/src/include/QtnStyleHelpers.h
vendored
Normal file
@@ -0,0 +1 @@
|
||||
#include "../styles/QtnStyleHelpers.h"
|
||||
90
third-party/QtitanRibbon/src/ribbon/QtnOfficeFrameHelper.h
vendored
Normal file
90
third-party/QtitanRibbon/src/ribbon/QtnOfficeFrameHelper.h
vendored
Normal file
@@ -0,0 +1,90 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_OFFICEFRAMEHELPER_H
|
||||
#define QTN_OFFICEFRAMEHELPER_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QStyle>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
class QRect;
|
||||
class QIcon;
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class ContextHeader;
|
||||
class StyleOptionTitleBar;
|
||||
|
||||
class OfficeFrameHelper
|
||||
{
|
||||
public:
|
||||
virtual ~OfficeFrameHelper()
|
||||
{
|
||||
}
|
||||
public:
|
||||
virtual void enableOfficeFrame(QWidget* parent) = 0;
|
||||
|
||||
virtual bool isDwmEnabled() const = 0;
|
||||
virtual bool isActive() const = 0;
|
||||
virtual bool isMaximize() const = 0;
|
||||
virtual bool canHideTitle() const = 0;
|
||||
|
||||
virtual int frameBorder() const = 0;
|
||||
virtual int titleBarSize() const = 0;
|
||||
virtual int tabBarHeight() const = 0;
|
||||
virtual bool clientMetrics(int& iCaptionWidth, int& iCaptionHeight) const = 0;
|
||||
|
||||
virtual void setHeaderRect(const QRect& rcHeader) = 0;
|
||||
virtual void setContextHeader(QList<ContextHeader*>* listContextHeaders) = 0;
|
||||
|
||||
virtual QPixmap getFrameSmallIcon() const = 0;
|
||||
virtual QString getSystemMenuString(uint item) const = 0;
|
||||
virtual QString getWindowText() const = 0;
|
||||
|
||||
virtual void drawTitleBar(QPainter* painter, const StyleOptionTitleBar& opt) = 0;
|
||||
virtual void fillSolidRect(QPainter* painter, const QRect& rect, const QRegion& airRegion, QColor clr) = 0;
|
||||
virtual void drawDwmCaptionText(QPainter* painter, const QRect& rect, const QString& strWindowText, const QColor& colText, bool active, bool contextTab) = 0;
|
||||
virtual QSize sizeSystemIcon(const QIcon& icon, const QRect& rect) const = 0;
|
||||
#ifdef Q_OS_WIN
|
||||
virtual HICON windowIcon(const QIcon& icon, const QRect& rect) const = 0;
|
||||
#endif // Q_OS_WIN
|
||||
virtual void resetWindowIcon() = 0;
|
||||
virtual void recalcFrameLayout() = 0;
|
||||
virtual void postRecalcFrameLayout() = 0;
|
||||
virtual void processClickedSubControl(QStyle::SubControl subControl) = 0;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
virtual bool winEvent(MSG* message, long* result) = 0;
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
|
||||
#endif // QTN_OFFICEFRAMEHELPER_H
|
||||
2292
third-party/QtitanRibbon/src/ribbon/QtnOfficeFrameHelper_win.cpp
vendored
Normal file
2292
third-party/QtitanRibbon/src/ribbon/QtnOfficeFrameHelper_win.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
192
third-party/QtitanRibbon/src/ribbon/QtnOfficeFrameHelper_win.h
vendored
Normal file
192
third-party/QtitanRibbon/src/ribbon/QtnOfficeFrameHelper_win.h
vendored
Normal file
@@ -0,0 +1,192 @@
|
||||
#ifdef AYA_OS_WINDOWS
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_OFFICEFRAMEHELPER_WIN_H
|
||||
#define QTN_OFFICEFRAMEHELPER_WIN_H
|
||||
|
||||
#include <shobjidl.h>
|
||||
|
||||
#include <QObject>
|
||||
#include <QSize>
|
||||
#include <QRect>
|
||||
#include <QTimer>
|
||||
#include <qt_Windows.h>
|
||||
|
||||
|
||||
#include "QtnOfficeFrameHelper.h"
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class StyleOptionFrame;
|
||||
class RibbonBar;
|
||||
|
||||
class OfficeFrameHelperWin : public QObject,
|
||||
public OfficeFrameHelper
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
OfficeFrameHelperWin(QWidget* parent = Q_NULL);
|
||||
virtual ~OfficeFrameHelperWin();
|
||||
|
||||
static UINT m_msgGetFrameHook;
|
||||
public:
|
||||
virtual void enableOfficeFrame(QWidget* parent);
|
||||
void disableOfficeFrame();
|
||||
|
||||
virtual bool isDwmEnabled() const;
|
||||
virtual bool isActive() const;
|
||||
virtual bool isMaximize() const;
|
||||
virtual bool canHideTitle() const;
|
||||
|
||||
virtual int frameBorder() const;
|
||||
virtual int titleBarSize() const;
|
||||
virtual int tabBarHeight() const;
|
||||
virtual bool clientMetrics(int& iCaptionWidth, int& iCaptionHeight) const;
|
||||
|
||||
virtual void setHeaderRect(const QRect& rcHeader);
|
||||
virtual void setContextHeader(QList<ContextHeader*>* listContextHeaders);
|
||||
|
||||
virtual QPixmap getFrameSmallIcon() const;
|
||||
virtual QString getSystemMenuString(uint item) const;
|
||||
virtual QString getWindowText() const;
|
||||
|
||||
virtual void drawTitleBar(QPainter* painter, const StyleOptionTitleBar& opt);
|
||||
virtual void fillSolidRect(QPainter* painter, const QRect& rect, const QRegion& airRegion, QColor clr);
|
||||
virtual void drawDwmCaptionText(QPainter* painter, const QRect& rect, const QString& strWindowText, const QColor& colText, bool active, bool contextTab);
|
||||
virtual QSize sizeSystemIcon(const QIcon& icon, const QRect& rect) const;
|
||||
virtual HICON windowIcon(const QIcon& icon, const QRect& rect) const;
|
||||
virtual void resetWindowIcon();
|
||||
virtual void recalcFrameLayout();
|
||||
virtual void postRecalcFrameLayout();
|
||||
virtual void processClickedSubControl(QStyle::SubControl subControl);
|
||||
|
||||
public:
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
void collapseTopFrame();
|
||||
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
virtual bool winEvent(MSG* message, long* result);
|
||||
|
||||
private:
|
||||
static int glowSize() { return 10; }
|
||||
static int frameSize() { return GetSystemMetrics(SM_CYSIZEFRAME); }
|
||||
static int captionSize() { return GetSystemMetrics(SM_CYCAPTION); }
|
||||
|
||||
protected:
|
||||
DWORD getStyle(bool exStyle = false) const;
|
||||
void refreshFrameStyle();
|
||||
void updateFrameRegion();
|
||||
void updateFrameRegion(const QSize& szFrameRegion, bool bUpdate);
|
||||
void updateShellAutohideBars();
|
||||
int shellAutohideBars();
|
||||
|
||||
bool isMDIMaximized() const;
|
||||
bool isTitleVisible() const;
|
||||
bool isTheme2013() const;
|
||||
bool isTheme2016() const;
|
||||
void initStyleOption(StyleOptionFrame* option);
|
||||
void redrawFrame();
|
||||
bool modifyStyle(HWND hWnd, DWORD dwRemove, DWORD dwAdd, UINT nFlags);
|
||||
bool isFrameHasStatusBar(int* statusHeight = Q_NULL) const;
|
||||
HRGN calcFrameRegion(QSize sz);
|
||||
HFONT getCaptionFont(HANDLE hTheme);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
HDC backingStoreDC(const QWidget *wizard, QPoint *offset);
|
||||
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
|
||||
bool hitTestContextHeaders(const QPoint& point) const;
|
||||
bool hitTestBackstageHeaders(const QPoint& point) const;
|
||||
|
||||
bool isCompositionEnabled();
|
||||
bool isSmallSystemBorders();
|
||||
void enableWindowAero(HWND hwnd, bool enable);
|
||||
void enableWindowShadow(HWND hwnd, bool enable);
|
||||
|
||||
bool setWindowAttribute(HWND hwnd, DWORD dwAttribute, LPCVOID pvAttribute, DWORD cbAttribute);
|
||||
bool resolveSymbols();
|
||||
void setFrameHook();
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
void saveMargins();
|
||||
void restoreMargins();
|
||||
#endif // QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
|
||||
|
||||
protected Q_SLOTS:
|
||||
void refreshFrameTimer();
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual bool eventFilter(QObject* obj, QEvent* event);
|
||||
|
||||
public:
|
||||
static bool m_allowDwm;
|
||||
|
||||
bool m_lockNCPaint;
|
||||
bool m_inUpdateFrame;
|
||||
bool m_inLayoutRequest;
|
||||
bool m_postReclalcLayout;
|
||||
bool m_active;
|
||||
|
||||
private:
|
||||
HICON m_hIcon;
|
||||
QSize m_szIcon;
|
||||
QWidget* m_frame;
|
||||
RibbonBar* m_ribbonBar;
|
||||
QList<ContextHeader*>* m_listContextHeaders;
|
||||
QSize m_szFrameRegion;
|
||||
QRect m_rcHeader;
|
||||
int m_frameBorder;
|
||||
int m_borderSizeBotton;
|
||||
HWND m_hwndFrame;
|
||||
QTimer m_refreshFrame;
|
||||
|
||||
int m_oldMarginsleft;
|
||||
int m_oldMarginstop;
|
||||
int m_oldMarginsright;
|
||||
int m_oldMarginsbottom;
|
||||
|
||||
bool m_dwmEnabled;
|
||||
bool m_skipNCPaint;
|
||||
bool m_officeFrameEnabled;
|
||||
bool m_isTransparentCaption;
|
||||
int m_shellAutohideBars;
|
||||
bool m_shellAutohideBarsInitialized;
|
||||
|
||||
bool m_wasFullScreen;
|
||||
bool m_closeWindow;
|
||||
bool m_isTheme2013;
|
||||
int m_changedSize;
|
||||
|
||||
private:
|
||||
class FrameHelperEventHook;
|
||||
Q_DISABLE_COPY(OfficeFrameHelperWin)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_OFFICEFRAMEHELPER_WIN_H
|
||||
#endif
|
||||
149
third-party/QtitanRibbon/src/ribbon/QtnOfficePopupColorButton.cpp
vendored
Normal file
149
third-party/QtitanRibbon/src/ribbon/QtnOfficePopupColorButton.cpp
vendored
Normal file
@@ -0,0 +1,149 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QStylePainter>
|
||||
#include <QStyleOption>
|
||||
#include <QMouseEvent>
|
||||
#include <QColorDialog>
|
||||
|
||||
#include "QtnOfficePopupColorButton.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
/*!
|
||||
\class PopupColorButton
|
||||
\inmodule QtitanRibbon
|
||||
\brief PopupColorButton class implements a button for the color selection.
|
||||
\image ribbon_colorbutton.png
|
||||
*/
|
||||
|
||||
/*!
|
||||
\property PopupColorButton::color
|
||||
*/
|
||||
|
||||
/*!
|
||||
\fn void PopupColorButton::colorChanged(const QColor& color);
|
||||
\brief The signal is emitted after the color has been selected. Parameter \a color contains a selected color.
|
||||
*/
|
||||
|
||||
|
||||
/*!
|
||||
\brief Constructs PopupColorButton object with the given \a parent.
|
||||
*/
|
||||
PopupColorButton::PopupColorButton(QWidget* parent)
|
||||
: QToolButton(parent)
|
||||
{
|
||||
setPopupMode(MenuButtonPopup);
|
||||
m_color = Qt::color0;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Destructor of PopupColorButton.
|
||||
*/
|
||||
PopupColorButton::~PopupColorButton()
|
||||
{
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the current selected color.
|
||||
*/
|
||||
const QColor& PopupColorButton::color() const
|
||||
{
|
||||
return m_color;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Sets the specified \a color and select specified color button.
|
||||
*/
|
||||
void PopupColorButton::setColor(const QColor& color)
|
||||
{
|
||||
if (color != m_color)
|
||||
{
|
||||
m_color = color;
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
QSize PopupColorButton::sizeHint() const
|
||||
{
|
||||
return QToolButton::sizeHint();
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void PopupColorButton::paintEvent(QPaintEvent* painter)
|
||||
{
|
||||
QToolButton::paintEvent(painter);
|
||||
|
||||
QStylePainter p(this);
|
||||
|
||||
QStyleOptionToolButton opt;
|
||||
initStyleOption(&opt);
|
||||
|
||||
if (opt.icon.isNull())
|
||||
return;
|
||||
if (!m_color.isValid())
|
||||
return;
|
||||
QRect rect(opt.rect);
|
||||
QSize sizeIcon = opt.iconSize;
|
||||
|
||||
int widthIndicator = style()->pixelMetric(QStyle::PM_MenuButtonIndicator, &opt, this);
|
||||
rect.setHeight(sizeIcon.height() / 5);
|
||||
rect.adjust(2, 0, -(widthIndicator + 4), 0);
|
||||
rect.translate(0, opt.rect.bottom()-(rect.height() + 2));
|
||||
p.fillRect(rect, m_color);
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void PopupColorButton::mousePressEvent(QMouseEvent* e)
|
||||
{
|
||||
QStyleOptionToolButton opt;
|
||||
initStyleOption(&opt);
|
||||
if (e->button() == Qt::LeftButton && (popupMode() == MenuButtonPopup))
|
||||
{
|
||||
QRect popupr = style()->subControlRect(QStyle::CC_ToolButton, &opt,
|
||||
QStyle::SC_ToolButtonMenu, this);
|
||||
if (popupr.isValid() && popupr.contains(e->pos()))
|
||||
{
|
||||
QColor col = QColorDialog::getColor(m_color, this);
|
||||
if (!col.isValid())
|
||||
return;
|
||||
|
||||
if (col != m_color)
|
||||
{
|
||||
m_color = col;
|
||||
update();
|
||||
emit colorChanged(m_color);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
QToolButton::mousePressEvent(e);
|
||||
}
|
||||
|
||||
67
third-party/QtitanRibbon/src/ribbon/QtnOfficePopupColorButton.h
vendored
Normal file
67
third-party/QtitanRibbon/src/ribbon/QtnOfficePopupColorButton.h
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_POPUPCOLORBUTTON_H
|
||||
#define QTN_POPUPCOLORBUTTON_H
|
||||
|
||||
#include <QToolButton>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
|
||||
class QStyleOption;
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
/* PopupColorButton */
|
||||
class QTITAN_EXPORT PopupColorButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QColor color READ color WRITE setColor)
|
||||
public:
|
||||
PopupColorButton(QWidget* parent = Q_NULL);
|
||||
virtual ~PopupColorButton();
|
||||
|
||||
public:
|
||||
const QColor& color() const;
|
||||
void setColor(const QColor& color);
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void colorChanged(const QColor& color);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent (QPaintEvent* event);
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
|
||||
protected:
|
||||
QColor m_color;
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_POPUPCOLORBUTTON_H
|
||||
402
third-party/QtitanRibbon/src/ribbon/QtnOfficePopupMenu.cpp
vendored
Normal file
402
third-party/QtitanRibbon/src/ribbon/QtnOfficePopupMenu.cpp
vendored
Normal file
@@ -0,0 +1,402 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QApplication>
|
||||
#include <QStyleOption>
|
||||
#include <QWidgetAction>
|
||||
#include <QPainter>
|
||||
#include <qevent.h>
|
||||
#include <QLayout>
|
||||
|
||||
#include "QtnRibbonStyle.h"
|
||||
#include "QtnOfficePopupMenu.h"
|
||||
#include "QtnRibbonGallery.h"
|
||||
#include "QtnRibbonBarPrivate.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
|
||||
/*!
|
||||
\property OfficePopupMenu::gripVisible
|
||||
*/
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class OfficePopupMenuPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(OfficePopupMenu)
|
||||
public:
|
||||
explicit OfficePopupMenuPrivate();
|
||||
|
||||
public:
|
||||
void init();
|
||||
int calcMinimumHeight(bool without = false);
|
||||
QWidget* findWidget(const char* nameWidget) const;
|
||||
void udateSizeGallery(const QSize& sz);
|
||||
|
||||
public:
|
||||
QWidget* m_widgetPopup;
|
||||
bool m_resizable : 1;
|
||||
bool m_pressSizeGrip : 1;
|
||||
bool m_showGrip : 1;
|
||||
int m_lastWidth;
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
OfficePopupMenuPrivate::OfficePopupMenuPrivate()
|
||||
{
|
||||
m_widgetPopup = Q_NULL;
|
||||
m_resizable = false;
|
||||
m_pressSizeGrip = false;
|
||||
m_showGrip = true;
|
||||
m_lastWidth = -1;
|
||||
}
|
||||
|
||||
void OfficePopupMenuPrivate::init()
|
||||
{
|
||||
QTN_P(OfficePopupMenu);
|
||||
p.setProperty(_qtn_PopupBar, true);
|
||||
p.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
p.setMouseTracking(true);
|
||||
}
|
||||
|
||||
int OfficePopupMenuPrivate::calcMinimumHeight(bool without)
|
||||
{
|
||||
QTN_P(OfficePopupMenu);
|
||||
|
||||
int height = 11;
|
||||
|
||||
QList<QAction*> listActions = p.actions();
|
||||
for (int i = 0; i < listActions.count(); i++)
|
||||
{
|
||||
if (QWidgetAction* widgetAction = qobject_cast<QWidgetAction*>(listActions.at(i)))
|
||||
{
|
||||
if (QWidget* w = widgetAction->defaultWidget())
|
||||
{
|
||||
if (!without)
|
||||
{
|
||||
int minHeight = w->minimumSizeHint().height();
|
||||
if (minHeight == -1)
|
||||
minHeight = w->sizeHint().height();
|
||||
height += minHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
height += p.actionGeometry(listActions.at(i)).height();
|
||||
}
|
||||
return height;
|
||||
}
|
||||
|
||||
QWidget* OfficePopupMenuPrivate::findWidget(const char* nameWidget) const
|
||||
{
|
||||
QTN_P(const OfficePopupMenu);
|
||||
const QObjectList& listChildren = p.children();
|
||||
for (int i = 0; i < listChildren.size(); ++i)
|
||||
{
|
||||
QWidget* w = qobject_cast<QWidget*>(listChildren.at(i));
|
||||
|
||||
if (w && w->property(nameWidget).toBool() )
|
||||
return w;
|
||||
}
|
||||
return Q_NULL;
|
||||
}
|
||||
|
||||
void OfficePopupMenuPrivate::udateSizeGallery(const QSize& sz)
|
||||
{
|
||||
QTN_P(const OfficePopupMenu);
|
||||
if (QWidget* w = findWidget(_qtn_WidgetGallery))
|
||||
{
|
||||
if (!w->isWindow() && !w->isHidden())
|
||||
{
|
||||
QSize szOld = p.sizeHint();
|
||||
QSize sizeWidget = w->geometry().size();
|
||||
int offset = szOld.height() - sz.height();
|
||||
sizeWidget.setHeight(sizeWidget.height() - offset);
|
||||
RibbonGallery* gallery = (RibbonGallery*)w;
|
||||
gallery->updatelayout();
|
||||
QRect rect(QPoint(0, 0), sizeWidget);
|
||||
w->setGeometry(rect.adjusted(1, 1, -1, 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
class OfficePopupMenu
|
||||
\brief Constructs the OfficePopupMenu object with the given \a parent.
|
||||
*/
|
||||
OfficePopupMenu::OfficePopupMenu(QWidget* parent)
|
||||
: QMenu(parent)
|
||||
{
|
||||
QTN_INIT_PRIVATE(OfficePopupMenu);
|
||||
QTN_D(OfficePopupMenu);
|
||||
d.init();
|
||||
|
||||
connect(this, SIGNAL(aboutToShow()), this, SLOT(aboutToShowBar()));
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\brief Destructor of the OfficePopupMenu object.
|
||||
*/
|
||||
OfficePopupMenu::~OfficePopupMenu()
|
||||
{
|
||||
QTN_FINI_PRIVATE();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Creates an instance of the OfficePopupMenu object with given \a parent.
|
||||
*/
|
||||
OfficePopupMenu* OfficePopupMenu::createPopupMenu(QWidget* parent)
|
||||
{
|
||||
OfficePopupMenu* popupBar = new OfficePopupMenu(parent);
|
||||
return popupBar;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Adds \a widget to the Office Popup Window and return an action associated with them.
|
||||
*/
|
||||
QAction* OfficePopupMenu::addWidget(QWidget* widget)
|
||||
{
|
||||
QTN_D(OfficePopupMenu);
|
||||
|
||||
QWidgetAction* action = new QWidgetAction(this);
|
||||
action->setDefaultWidget(widget);
|
||||
addAction(action);
|
||||
|
||||
if (widget && widget->property("isResizable").toBool())
|
||||
d.m_resizable = true;
|
||||
|
||||
if (RibbonGallery* gallery = qobject_cast<RibbonGallery*>(d.findWidget(_qtn_WidgetGallery)))
|
||||
{
|
||||
gallery->adjustSize();
|
||||
gallery->updatelayout();
|
||||
}
|
||||
// sizeHint();
|
||||
return action;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Sets visibility of the Popup Window Grip to \a visible.
|
||||
*/
|
||||
void OfficePopupMenu::setGripVisible(bool visible)
|
||||
{
|
||||
QTN_D(OfficePopupMenu);
|
||||
d.m_showGrip = visible;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the visibility of the Popup Window Grip.
|
||||
*/
|
||||
bool OfficePopupMenu::isGripVisible() const
|
||||
{
|
||||
QTN_D(const OfficePopupMenu);
|
||||
return d.m_showGrip ;
|
||||
}
|
||||
|
||||
/*! \internal */
|
||||
void OfficePopupMenu::setWidgetBar(QWidget* widget)
|
||||
{
|
||||
QTN_D(OfficePopupMenu);
|
||||
Q_ASSERT(widget != Q_NULL && d.m_widgetPopup == Q_NULL);
|
||||
d.m_widgetPopup = widget;
|
||||
}
|
||||
|
||||
/*! \internal */
|
||||
void OfficePopupMenu::aboutToShowBar()
|
||||
{
|
||||
QTN_D(OfficePopupMenu);
|
||||
|
||||
if (RibbonGallery* gallery = qobject_cast<RibbonGallery*>(d.findWidget(_qtn_WidgetGallery)))
|
||||
{
|
||||
if (!gallery->isWindow() && !gallery->isHidden())
|
||||
gallery->updatelayout();
|
||||
}
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
QSize OfficePopupMenu::sizeHint() const
|
||||
{
|
||||
QSize size = QMenu::sizeHint();
|
||||
|
||||
QTN_D(const OfficePopupMenu);
|
||||
|
||||
int height = 0;
|
||||
if (d.m_resizable)
|
||||
height = 11;
|
||||
|
||||
QSize sz;
|
||||
if (d.m_widgetPopup)
|
||||
sz = d.m_widgetPopup->geometry().size();
|
||||
else if (QWidget* w = d.findWidget(_qtn_WidgetGallery))
|
||||
{
|
||||
sz = w->geometry().size();
|
||||
if (sz.isNull())
|
||||
{
|
||||
sz = size;
|
||||
sz = QSize(qMin(size.width(), sz.width()), size.height());
|
||||
}
|
||||
}
|
||||
size.setWidth(d.m_lastWidth != -1 ? d.m_lastWidth : sz.width() + 1);
|
||||
size.setHeight(size.height() + height);
|
||||
return size;
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void OfficePopupMenu::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
QMenu::paintEvent(event);
|
||||
QTN_D(OfficePopupMenu);
|
||||
|
||||
if (d.m_resizable)
|
||||
{
|
||||
QPainter p(this);
|
||||
QStyleOptionSizeGrip opt;
|
||||
opt.initFrom(this);
|
||||
opt.rect.adjust(1, 0, -1, -1);
|
||||
opt.rect.setTop(opt.rect.bottom() - 11);
|
||||
style()->drawControl((QStyle::ControlElement)RibbonStyle::CE_PopupSizeGrip, &opt, &p, this);
|
||||
}
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void OfficePopupMenu::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
QTN_D(OfficePopupMenu);
|
||||
if (d.m_resizable)
|
||||
{
|
||||
if (event->buttons() == Qt::LeftButton)
|
||||
{
|
||||
QRect rcResizeGripper(rect());
|
||||
rcResizeGripper.setTop(rcResizeGripper.bottom()-11);
|
||||
QRect rcResizeGripperAll = rcResizeGripper;
|
||||
rcResizeGripper.setLeft(rcResizeGripper.right() - rcResizeGripper.height());
|
||||
if (rcResizeGripper.contains(event->pos()))
|
||||
{
|
||||
if (QWidget* w = d.findWidget(_qtn_WidgetGallery))
|
||||
{
|
||||
if (w && !w->isWindow() && !w->isHidden())
|
||||
w->setAttribute(Qt::WA_TransparentForMouseEvents, true);
|
||||
}
|
||||
d.m_pressSizeGrip = true;
|
||||
return;
|
||||
}
|
||||
else if (rcResizeGripperAll.contains(event->pos()))
|
||||
return;
|
||||
}
|
||||
}
|
||||
QMenu::mousePressEvent(event);
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void OfficePopupMenu::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
QTN_D(OfficePopupMenu);
|
||||
|
||||
if (QWidget* w = d.findWidget(_qtn_WidgetGallery))
|
||||
{
|
||||
QMouseEvent evPress(event->type(), event->pos(), event->globalPos(), event->button(), event->buttons(), event->modifiers());
|
||||
QApplication::sendEvent(w, &evPress);
|
||||
}
|
||||
|
||||
if (d.m_resizable)
|
||||
{
|
||||
QRect rcResizeGripper(rect());
|
||||
rcResizeGripper.setTop(rcResizeGripper.bottom()-11);
|
||||
rcResizeGripper.setLeft(rcResizeGripper.right() - rcResizeGripper.height());
|
||||
|
||||
if (d.m_pressSizeGrip || rcResizeGripper.contains(event->pos()))
|
||||
setCursor(Qt::SizeFDiagCursor);
|
||||
else
|
||||
unsetCursor();
|
||||
|
||||
if (d.m_pressSizeGrip)
|
||||
{
|
||||
QPoint np(event->globalPos());
|
||||
|
||||
QRect rect = geometry();
|
||||
rect.setRight(np.x());
|
||||
rect.setBottom(np.y());
|
||||
|
||||
d.m_lastWidth = rect.width();
|
||||
setGeometry(rect);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!d.m_pressSizeGrip)
|
||||
QMenu::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void OfficePopupMenu::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
QTN_D(OfficePopupMenu);
|
||||
d.m_pressSizeGrip = false;
|
||||
|
||||
if (QWidget* w = d.findWidget(_qtn_WidgetGallery))
|
||||
{
|
||||
if (w && !w->isWindow() && !w->isHidden())
|
||||
w->setAttribute(Qt::WA_TransparentForMouseEvents, false);
|
||||
}
|
||||
QMenu::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void OfficePopupMenu::moveEvent(QMoveEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QTN_D(OfficePopupMenu);
|
||||
if (d.m_pressSizeGrip)
|
||||
setCursor(Qt::SizeFDiagCursor);
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void OfficePopupMenu::showEvent(QShowEvent* event)
|
||||
{
|
||||
QTN_D(OfficePopupMenu);
|
||||
QMenu::showEvent(event);
|
||||
|
||||
if (d.m_widgetPopup && d.m_resizable)
|
||||
{
|
||||
setMinimumWidth(d.m_widgetPopup->geometry().width());
|
||||
setMinimumHeight(d.calcMinimumHeight());
|
||||
}
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void OfficePopupMenu::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
QTN_D(OfficePopupMenu);
|
||||
d.udateSizeGallery(event->size());
|
||||
QMenu::resizeEvent(event);
|
||||
}
|
||||
|
||||
80
third-party/QtitanRibbon/src/ribbon/QtnOfficePopupMenu.h
vendored
Normal file
80
third-party/QtitanRibbon/src/ribbon/QtnOfficePopupMenu.h
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_OFFICEPOPUPMENU_H
|
||||
#define QTN_OFFICEPOPUPMENU_H
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class OfficePopupMenuPrivate;
|
||||
|
||||
class QTITAN_EXPORT OfficePopupMenu : public QMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool gripVisible READ isGripVisible WRITE setGripVisible)
|
||||
|
||||
public:
|
||||
OfficePopupMenu(QWidget* parent = Q_NULL);
|
||||
virtual ~OfficePopupMenu();
|
||||
|
||||
static OfficePopupMenu* createPopupMenu(QWidget* parent = Q_NULL);
|
||||
|
||||
public:
|
||||
QAction* addWidget(QWidget* widget);
|
||||
|
||||
void setGripVisible(bool visible);
|
||||
bool isGripVisible() const;
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
protected:
|
||||
void setWidgetBar(QWidget* widget);
|
||||
|
||||
private Q_SLOTS:
|
||||
void aboutToShowBar();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
virtual void mouseMoveEvent(QMouseEvent* event);
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event);
|
||||
virtual void moveEvent(QMoveEvent* event);
|
||||
virtual void showEvent(QShowEvent* event);
|
||||
virtual void resizeEvent(QResizeEvent* event);
|
||||
|
||||
private:
|
||||
friend class RibbonGalleryPrivate;
|
||||
QTN_DECLARE_PRIVATE(OfficePopupMenu)
|
||||
Q_DISABLE_COPY(OfficePopupMenu)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_OFFICEPOPUPMENU_H
|
||||
1310
third-party/QtitanRibbon/src/ribbon/QtnOfficePopupWindow.cpp
vendored
Normal file
1310
third-party/QtitanRibbon/src/ribbon/QtnOfficePopupWindow.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
148
third-party/QtitanRibbon/src/ribbon/QtnOfficePopupWindow.h
vendored
Normal file
148
third-party/QtitanRibbon/src/ribbon/QtnOfficePopupWindow.h
vendored
Normal file
@@ -0,0 +1,148 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_OFFICEPOPUPWINDOW_H
|
||||
#define QTN_OFFICEPOPUPWINDOW_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QTimer>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
#include "QtnOfficeStyle.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
enum PopupLocation
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
PopupLocationNearTaskBar,
|
||||
#endif // Q_OS_WIN
|
||||
PopupLocationBottomRight,
|
||||
PopupLocationCenter
|
||||
};
|
||||
|
||||
enum PopupAnimation
|
||||
{
|
||||
PopupAnimationNone,
|
||||
PopupAnimationFade,
|
||||
PopupAnimationSlide,
|
||||
PopupAnimationUnfold
|
||||
};
|
||||
|
||||
class OfficePopupWindowPrivate;
|
||||
|
||||
class QTITAN_EXPORT OfficePopupWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS(PopupAnimation)
|
||||
Q_ENUMS(PopupLocation)
|
||||
Q_PROPERTY(PopupAnimation animation READ animation WRITE setAnimation)
|
||||
Q_PROPERTY(qreal transparency READ transparency WRITE setTransparency)
|
||||
Q_PROPERTY(int displayTime READ displayTime WRITE setDisplayTime)
|
||||
Q_PROPERTY(int animationSpeed READ animationSpeed WRITE setAnimationSpeed)
|
||||
Q_PROPERTY(QIcon titleIcon READ titleIcon WRITE setTitleIcon)
|
||||
Q_PROPERTY(QString titleText READ titleText WRITE setTitleText)
|
||||
Q_PROPERTY(QString bodyText READ bodyText WRITE setBodyText)
|
||||
Q_PROPERTY(bool titleCloseButtonVisible READ isTitleCloseButtonVisible WRITE setTitleCloseButtonVisible)
|
||||
Q_PROPERTY(PopupLocation location READ location WRITE setLocation)
|
||||
public:
|
||||
OfficePopupWindow(QWidget* parent);
|
||||
virtual ~OfficePopupWindow();
|
||||
|
||||
static void showPopup(QWidget* parent, const QIcon& titleIcon, const QString& titleText, const QString& bodyText,
|
||||
bool closeButtonVisible = true, OfficeStyle::OfficePopupDecoration decoration = OfficeStyle::PopupSystemDecoration);
|
||||
|
||||
public:
|
||||
bool showPopup();
|
||||
bool showPopup(const QPoint& pos);
|
||||
|
||||
void setCentralWidget(QWidget* widget);
|
||||
QWidget* centralWidget() const;
|
||||
|
||||
void setBodyText(const QString& text);
|
||||
const QString& bodyText() const;
|
||||
|
||||
void setTitleIcon(const QIcon& icon);
|
||||
const QIcon& titleIcon() const;
|
||||
|
||||
void setTitleText(const QString& text);
|
||||
const QString& titleText() const;
|
||||
|
||||
void setCloseButtonPixmap(const QPixmap& pm);
|
||||
const QPixmap& closeButtonPixmap() const;
|
||||
|
||||
void setTitleCloseButtonVisible(bool visible = true);
|
||||
bool isTitleCloseButtonVisible() const;
|
||||
|
||||
QPoint getPosition() const;
|
||||
void setPosition(const QPoint& pos);
|
||||
|
||||
void setAnimation(PopupAnimation popupAnimation);
|
||||
PopupAnimation animation() const;
|
||||
|
||||
void setTransparency(qreal transparency);
|
||||
qreal transparency() const;
|
||||
|
||||
void setDisplayTime(int time);
|
||||
int displayTime() const;
|
||||
|
||||
void setAnimationSpeed(int time);
|
||||
int animationSpeed() const;
|
||||
|
||||
void setDragDropEnabled(bool enabled);
|
||||
bool dragDropEnabled() const;
|
||||
|
||||
void setLocation(PopupLocation location);
|
||||
PopupLocation location() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void aboutToShow();
|
||||
void aboutToHide();
|
||||
|
||||
public Q_SLOTS:
|
||||
void closePopup();
|
||||
|
||||
protected Q_SLOTS:
|
||||
void showDelayTimer();
|
||||
void collapsingTimer();
|
||||
void expandingTimer();
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void enterEvent(QEvent* event);
|
||||
virtual void leaveEvent(QEvent* event);
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(OfficePopupWindow)
|
||||
Q_DISABLE_COPY(OfficePopupWindow)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_OFFICEPOPUPWINDOW_H
|
||||
952
third-party/QtitanRibbon/src/ribbon/QtnRibbonBackstageView.cpp
vendored
Normal file
952
third-party/QtitanRibbon/src/ribbon/QtnRibbonBackstageView.cpp
vendored
Normal file
@@ -0,0 +1,952 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QStyle>
|
||||
#include <QApplication>
|
||||
#include <QStyleOption>
|
||||
#include <QWidgetAction>
|
||||
#include <QPainter>
|
||||
#include <QStatusBar>
|
||||
#include <QBitmap>
|
||||
#include <QLayout>
|
||||
#include <qevent.h>
|
||||
|
||||
#include "QtnStyleHelpers.h"
|
||||
#include "QtnRibbonBackstageView.h"
|
||||
#include "QtnRibbonBarPrivate.h"
|
||||
#include "QtnRibbonBackstageViewPrivate.h"
|
||||
#include "QtnRibbonStyle.h"
|
||||
#include "QtnRibbonBar.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
const int commandGap = 6;
|
||||
const int textGap = 15;
|
||||
const int imageMargin = 7;
|
||||
|
||||
/* RibbonBackstageCloseButton */
|
||||
RibbonBackstageCloseButton::RibbonBackstageCloseButton(QWidget* parent)
|
||||
: QToolButton(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QSize RibbonBackstageCloseButton::sizeHint() const
|
||||
{
|
||||
QStyleOptionToolButton opt;
|
||||
initStyleOption(&opt);
|
||||
QList<QSize> sz = opt.icon.availableSizes();
|
||||
Q_ASSERT(sz.size() > 0);
|
||||
return sz[0];
|
||||
}
|
||||
|
||||
void RibbonBackstageCloseButton::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
QStyleOptionToolButton opt;
|
||||
initStyleOption(&opt);
|
||||
QPainter p(this);
|
||||
style()->drawPrimitive((QStyle::PrimitiveElement)RibbonStyle::PE_RibbonBackstageCloseButton, &opt, &p, this);
|
||||
}
|
||||
|
||||
void RibbonBackstageCloseButton::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (testAttribute(Qt::WA_UnderMouse))
|
||||
QToolButton::mousePressEvent(event);
|
||||
}
|
||||
|
||||
|
||||
/* RibbonBackstageViewMenu */
|
||||
RibbonBackstageViewMenu::RibbonBackstageViewMenu(RibbonBackstageView* backstageView, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
, m_backstageView(backstageView)
|
||||
, m_backStageCloseButton(Q_NULL)
|
||||
, m_mouseDown(false)
|
||||
, m_itemsDirty(true)
|
||||
, m_menuWidth(132)
|
||||
, m_maxIconWidth(0)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
}
|
||||
|
||||
QSize RibbonBackstageViewMenu::sizeHint() const
|
||||
{
|
||||
m_itemsDirty = true;
|
||||
updateActionRects();
|
||||
return QSize(m_menuWidth, m_backstageView->sizeHint().width());
|
||||
}
|
||||
|
||||
void RibbonBackstageViewMenu::createBackstageCloseButton()
|
||||
{
|
||||
if ((bool)style()->styleHint((QStyle::StyleHint)RibbonStyle::SH_RibbonBackstageHideTabs))
|
||||
{
|
||||
if (m_backStageCloseButton == Q_NULL)
|
||||
{
|
||||
m_backStageCloseButton = new RibbonBackstageCloseButton(this);
|
||||
QAction* actBackStageCloseButton = new QAction(this);
|
||||
actBackStageCloseButton->setIcon(QIcon(":/res/ribbonbackstageback_icon.png"));
|
||||
m_backStageCloseButton->setDefaultAction(actBackStageCloseButton);
|
||||
QSize sz = m_backStageCloseButton->sizeHint();
|
||||
m_backStageCloseButton->setGeometry(QRect(QPoint(sz.width()/2, sz.height()/2), sz));
|
||||
m_backStageCloseButton->setVisible(true);
|
||||
QObject::connect(m_backStageCloseButton, SIGNAL(pressed()), m_backstageView, SLOT(close()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
delete m_backStageCloseButton;
|
||||
m_backStageCloseButton = Q_NULL;
|
||||
}
|
||||
m_itemsDirty = true;
|
||||
}
|
||||
|
||||
QAction* RibbonBackstageViewMenu::actionAt(const QPoint& pt) const
|
||||
{
|
||||
QList<QAction*> actions = m_backstageView->actions();
|
||||
for(int i = 0; i < m_actionRects.count(); ++i)
|
||||
{
|
||||
if (m_actionRects.at(i).contains(pt))
|
||||
return actions.at(i);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
QRect RibbonBackstageViewMenu::actionRect(QAction* act) const
|
||||
{
|
||||
QList<QAction*> actions = m_backstageView->actions();
|
||||
int index = actions.indexOf(act);
|
||||
if (index == -1)
|
||||
return QRect();
|
||||
|
||||
updateActionRects();
|
||||
|
||||
//we found the action
|
||||
return m_actionRects.at(index);
|
||||
}
|
||||
|
||||
void RibbonBackstageViewMenu::resetItemsDirty()
|
||||
{
|
||||
m_itemsDirty = true;
|
||||
}
|
||||
|
||||
void RibbonBackstageViewMenu::initStyleOption(StyleOptionRibbonBackstage* opt) const
|
||||
{
|
||||
opt->initFrom(this);
|
||||
opt->menuWidth = m_menuWidth;
|
||||
opt->rect.adjust(0, 0, -1, -1);
|
||||
}
|
||||
|
||||
void RibbonBackstageViewMenu::initStyleOption(QStyleOptionMenuItem* option, const QAction* action) const
|
||||
{
|
||||
if (!option || !action)
|
||||
return;
|
||||
|
||||
option->initFrom(this);
|
||||
option->palette = palette();
|
||||
option->state = QStyle::State_None;
|
||||
|
||||
if (m_backstageView->window()->isActiveWindow())
|
||||
option->state |= QStyle::State_Active;
|
||||
if (m_backstageView->isEnabled() && action->isEnabled()
|
||||
&& (!action->menu() || action->menu()->isEnabled()))
|
||||
option->state |= QStyle::State_Enabled;
|
||||
else
|
||||
option->palette.setCurrentColorGroup(QPalette::Disabled);
|
||||
|
||||
option->font = action->font().resolve(font());
|
||||
option->fontMetrics = QFontMetrics(option->font);
|
||||
|
||||
if (m_backstageView->qtn_d().m_currentAction && m_backstageView->qtn_d().m_currentAction == action && !m_backstageView->qtn_d().m_currentAction->isSeparator())
|
||||
option->state |= QStyle::State_Selected | (m_mouseDown ? QStyle::State_Sunken : QStyle::State_None);
|
||||
|
||||
option->menuItemType = QStyleOptionMenuItem::Normal;
|
||||
if (const QWidgetAction* pageAct = qobject_cast<const QWidgetAction*>(action))
|
||||
{
|
||||
option->menuItemType = QStyleOptionMenuItem::SubMenu;
|
||||
if (pageAct->defaultWidget() == m_backstageView->getActivePage()/*m_activePage*/)
|
||||
option->state |= QStyle::State_HasFocus;
|
||||
}
|
||||
else if (action->isSeparator())
|
||||
option->menuItemType = QStyleOptionMenuItem::Separator;
|
||||
|
||||
if (action->isIconVisibleInMenu())
|
||||
option->icon = action->icon();
|
||||
QString textAndAccel = action->text();
|
||||
|
||||
#ifndef QT_NO_SHORTCUT
|
||||
if (textAndAccel.indexOf(QLatin1Char('\t')) == -1) {
|
||||
QKeySequence seq = action->shortcut();
|
||||
if (!seq.isEmpty())
|
||||
textAndAccel += QLatin1Char('\t') + seq.toString();
|
||||
}
|
||||
#endif
|
||||
option->text = textAndAccel;
|
||||
option->maxIconWidth = m_maxIconWidth;
|
||||
option->menuRect = rect();
|
||||
}
|
||||
|
||||
void RibbonBackstageViewMenu::updateActionRects() const
|
||||
{
|
||||
if (!m_itemsDirty)
|
||||
return;
|
||||
|
||||
ensurePolished();
|
||||
QList<QAction*> actions = m_backstageView->actions();
|
||||
//let's reinitialize the buffer
|
||||
m_actionRects.resize(actions.count());
|
||||
m_actionRects.fill(QRect());
|
||||
|
||||
QStyle *style = ((RibbonBackstageViewMenu*)this)->style();
|
||||
QStyleOption opt;
|
||||
opt.initFrom(this);
|
||||
|
||||
const int icone = style->pixelMetric(QStyle::PM_SmallIconSize, &opt, this);
|
||||
|
||||
QFontMetrics qfm = fontMetrics();
|
||||
|
||||
int actionHeight = 26;
|
||||
int pageHeight = qMax(37, qfm.height() + 10);
|
||||
|
||||
for (int i = 0, count = actions.count(); i < count; i++)
|
||||
{
|
||||
QAction *action = actions.at(i);
|
||||
if (action->isSeparator() || !action->isVisible() )
|
||||
continue;
|
||||
|
||||
QIcon is = action->icon();
|
||||
if (!is.isNull())
|
||||
m_maxIconWidth = qMax<uint>(m_maxIconWidth, icone + 4);
|
||||
}
|
||||
|
||||
for (int i = 0, count = actions.count(); i < count; i++)
|
||||
{
|
||||
QAction* action = actions.at(i);
|
||||
if (!action->isVisible() || action->isSeparator())
|
||||
continue; // we continue, this action will get an empty QRect
|
||||
|
||||
//let the style modify the above size..
|
||||
QStyleOptionMenuItem opt;
|
||||
initStyleOption(&opt, action);
|
||||
|
||||
const QFontMetrics& fm = opt.fontMetrics;
|
||||
|
||||
QRect br(fm.boundingRect(action->text()));
|
||||
int width = br.width() + commandGap + textGap + commandGap + 6;
|
||||
|
||||
actionHeight = qMax(actionHeight, qMax(fm.height() + 6, qfm.height() + 6));
|
||||
width += m_maxIconWidth + imageMargin;
|
||||
m_menuWidth = qMax(m_menuWidth, width);
|
||||
}
|
||||
|
||||
int top = m_backStageCloseButton ? m_backStageCloseButton->geometry().bottom() + 7 : 7;
|
||||
for (int i = 0, count = actions.count(); i < count; i++)
|
||||
{
|
||||
QAction* action = actions.at(i);
|
||||
if (!action->isVisible() /*|| action->isSeparator()*/)
|
||||
continue; // we continue, this action will get an empty QRect
|
||||
|
||||
if (qobject_cast<QWidgetAction*>(action))
|
||||
{
|
||||
m_actionRects[i] = QRect(QPoint(0, top), QPoint(m_menuWidth, top + pageHeight));
|
||||
top += pageHeight + 2;
|
||||
}
|
||||
else if (action->isSeparator())
|
||||
{
|
||||
m_actionRects[i] = QRect(QPoint(-commandGap, top), QPoint(m_menuWidth - commandGap * 2, top + actionHeight - 3));
|
||||
top += actionHeight - 3;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_actionRects[i] = QRect(QPoint(commandGap, top), QPoint(m_menuWidth - commandGap, top + actionHeight));
|
||||
top += actionHeight + 2;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_backstageView->getActivePage())
|
||||
{
|
||||
for (int i = 0, count = actions.count(); i < count; i++)
|
||||
{
|
||||
if (QWidgetAction* action = qobject_cast<QWidgetAction*>(actions.at(i)))
|
||||
{
|
||||
m_backstageView->setActivePage(action->defaultWidget());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
m_itemsDirty = false;
|
||||
}
|
||||
|
||||
void RibbonBackstageViewMenu::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
updateActionRects();
|
||||
|
||||
QPainter p(this);
|
||||
QRegion emptyArea = QRegion(rect());
|
||||
|
||||
StyleOptionRibbonBackstage optBackstage;
|
||||
if (m_backStageCloseButton == Q_NULL)
|
||||
{
|
||||
optBackstage.initFrom(m_backstageView);
|
||||
optBackstage.menuWidth = m_menuWidth;
|
||||
}
|
||||
else
|
||||
initStyleOption(&optBackstage);
|
||||
style()->drawPrimitive((QStyle::PrimitiveElement)RibbonStyle::PE_Backstage, &optBackstage, &p, m_backstageView);
|
||||
|
||||
QList<QAction*> acts = m_backstageView->actions();
|
||||
|
||||
//draw the items that need updating..
|
||||
for (int i = 0, count = acts.count(); i < count; ++i)
|
||||
{
|
||||
QAction* action = acts.at(i);
|
||||
QRect adjustedActionRect = m_actionRects.at(i);
|
||||
if (!event->rect().intersects(adjustedActionRect))
|
||||
continue;
|
||||
|
||||
//set the clip region to be extra safe (and adjust for the scrollers)
|
||||
QRegion adjustedActionReg(adjustedActionRect);
|
||||
emptyArea -= adjustedActionReg;
|
||||
p.setClipRegion(adjustedActionReg);
|
||||
|
||||
QStyleOptionMenuItem opt;
|
||||
initStyleOption(&opt, action);
|
||||
opt.rect = adjustedActionRect;
|
||||
opt.text = action->text();
|
||||
|
||||
// opt.menuItemType = QStyleOptionMenuItem::Normal;
|
||||
if (QWidgetAction* pageAct = qobject_cast<QWidgetAction*>(action))
|
||||
{
|
||||
opt.menuItemType = QStyleOptionMenuItem::SubMenu;
|
||||
if (pageAct->defaultWidget() == m_backstageView->getActivePage())
|
||||
opt.state |= QStyle::State_HasFocus;
|
||||
}
|
||||
style()->drawControl(QStyle::CE_MenuItem, &opt, &p, m_backstageView);
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonBackstageViewMenu::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
QWidget::keyPressEvent(event);
|
||||
switch(event->key())
|
||||
{
|
||||
case Qt::Key_Escape :
|
||||
m_backstageView->close();
|
||||
break;
|
||||
case Qt::Key_Up :
|
||||
break;
|
||||
case Qt::Key_Down :
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonBackstageViewMenu::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() != Qt::LeftButton)
|
||||
return;
|
||||
if (rect().contains(event->pos()))
|
||||
{
|
||||
if (QWidgetAction* act = qobject_cast<QWidgetAction*>(actionAt(event->pos())))
|
||||
{
|
||||
if (act && (act->isSeparator() || !act->isEnabled()))
|
||||
return;
|
||||
if (QWidget* w = act->defaultWidget())
|
||||
{
|
||||
m_backstageView->setActivePage(w);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonBackstageViewMenu::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
if (rect().contains(event->pos()))
|
||||
{
|
||||
QAction* action = actionAt(event->pos());
|
||||
m_backstageView->qtn_d().setCurrentAction(action ? action : Q_NULL);
|
||||
setFocus();
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonBackstageViewMenu::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() != Qt::LeftButton)
|
||||
return;
|
||||
|
||||
if (rect().contains(event->pos()))
|
||||
{
|
||||
QAction* action = actionAt(event->pos());
|
||||
|
||||
if (action && (action->isSeparator() || !action->isEnabled() || m_backstageView->qtn_d().m_widgetItems.contains(action)))
|
||||
return;
|
||||
|
||||
if (action && action == m_backstageView->qtn_d().m_currentAction)
|
||||
{
|
||||
if (!m_backstageView->isClosePrevented())
|
||||
m_backstageView->close();
|
||||
action->activate(QAction::Trigger);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonBackstageViewMenu::leaveEvent(QEvent* event)
|
||||
{
|
||||
QWidget::leaveEvent(event);
|
||||
m_backstageView->qtn_d().setCurrentAction(Q_NULL);
|
||||
}
|
||||
|
||||
|
||||
/* RibbonBackstageSeparator */
|
||||
RibbonBackstageSeparator::RibbonBackstageSeparator(QWidget* parent)
|
||||
: QFrame(parent)
|
||||
{
|
||||
setAttribute(Qt::WA_MouseNoMask);
|
||||
setFrameStyle(HLine | Sunken);
|
||||
}
|
||||
|
||||
RibbonBackstageSeparator::~RibbonBackstageSeparator()
|
||||
{
|
||||
}
|
||||
|
||||
void RibbonBackstageSeparator::setOrientation(Qt::Orientation orient)
|
||||
{
|
||||
setFrameShape(orient == Qt::Horizontal ? HLine : VLine);
|
||||
}
|
||||
|
||||
Qt::Orientation RibbonBackstageSeparator::orientation() const
|
||||
{
|
||||
return frameShape() == HLine ? Qt::Horizontal : Qt::Vertical;
|
||||
}
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonBackstageButtonPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonBackstageButton)
|
||||
public:
|
||||
explicit RibbonBackstageButtonPrivate();
|
||||
virtual ~RibbonBackstageButtonPrivate();
|
||||
public:
|
||||
bool m_tabStyle;
|
||||
bool m_flatStyle;
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
RibbonBackstageButtonPrivate::RibbonBackstageButtonPrivate()
|
||||
{
|
||||
m_tabStyle = false;
|
||||
m_flatStyle = false;
|
||||
}
|
||||
|
||||
RibbonBackstageButtonPrivate::~RibbonBackstageButtonPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
/* RibbonBackstageButton */
|
||||
RibbonBackstageButton::RibbonBackstageButton(QWidget* parent)
|
||||
: QToolButton(parent)
|
||||
{
|
||||
QTN_INIT_PRIVATE(RibbonBackstageButton);
|
||||
}
|
||||
|
||||
RibbonBackstageButton::~RibbonBackstageButton()
|
||||
{
|
||||
QTN_FINI_PRIVATE();
|
||||
}
|
||||
|
||||
bool RibbonBackstageButton::tabStyle() const
|
||||
{
|
||||
QTN_D(const RibbonBackstageButton);
|
||||
return d.m_tabStyle;
|
||||
}
|
||||
|
||||
void RibbonBackstageButton::setTabStyle(bool style)
|
||||
{
|
||||
QTN_D(RibbonBackstageButton);
|
||||
d.m_tabStyle = style;
|
||||
update();
|
||||
}
|
||||
|
||||
bool RibbonBackstageButton::flatStyle()
|
||||
{
|
||||
QTN_D(const RibbonBackstageButton);
|
||||
return d.m_flatStyle;
|
||||
}
|
||||
|
||||
void RibbonBackstageButton::setFlatStyle(bool flat)
|
||||
{
|
||||
QTN_D(RibbonBackstageButton);
|
||||
d.m_flatStyle = flat;
|
||||
update();
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void RibbonBackstageButton::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QTN_D(RibbonBackstageButton);
|
||||
|
||||
QPainter p(this);
|
||||
StyleOptionBackstageButton option;
|
||||
initStyleOption(&option);
|
||||
option.tabStyle = d.m_tabStyle;
|
||||
option.flatStyle = d.m_flatStyle;
|
||||
|
||||
style()->drawComplexControl(QStyle::CC_ToolButton, &option, &p, this);
|
||||
}
|
||||
|
||||
|
||||
/* RibbonBackstagePage */
|
||||
RibbonBackstagePage::RibbonBackstagePage(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setBackgroundRole(QPalette::Light);
|
||||
}
|
||||
|
||||
RibbonBackstagePage::~RibbonBackstagePage()
|
||||
{
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void RibbonBackstagePage::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
QPainter p(this);
|
||||
QStyleOption opt;
|
||||
opt.initFrom(this);
|
||||
p.fillRect(opt.rect, opt.palette.color(QPalette::Light));
|
||||
}
|
||||
|
||||
/*!
|
||||
\class Qtitan::RibbonBackstageViewPrivate
|
||||
\internal
|
||||
*/
|
||||
RibbonBackstageViewPrivate::RibbonBackstageViewPrivate()
|
||||
{
|
||||
m_ribbon = Q_NULL;
|
||||
m_backstageMenu = Q_NULL;
|
||||
m_tabBarPosition = RibbonBar::TabBarTopPosition;
|
||||
m_activePage = Q_NULL;
|
||||
m_currentAction = Q_NULL;
|
||||
m_closePrevented = false;
|
||||
}
|
||||
|
||||
RibbonBackstageViewPrivate::~RibbonBackstageViewPrivate()
|
||||
{
|
||||
QTN_P(RibbonBackstageView);
|
||||
QWidget* parent = p.parentWidget();
|
||||
Q_ASSERT(parent != Q_NULL);
|
||||
parent->removeEventFilter(&p);
|
||||
}
|
||||
|
||||
void RibbonBackstageViewPrivate::init(RibbonBar* ribbonBar)
|
||||
{
|
||||
QTN_P(RibbonBackstageView);
|
||||
m_ribbon = ribbonBar;
|
||||
|
||||
QWidget* parent = p.parentWidget();
|
||||
Q_ASSERT(parent != Q_NULL);
|
||||
parent->installEventFilter(&p);
|
||||
|
||||
p.setFont(QApplication::font("QMenu"));
|
||||
p.setPalette(QApplication::palette("QMenu"));
|
||||
|
||||
m_backstageMenu = new RibbonBackstageViewMenu(&p, parent);
|
||||
m_backstageMenu->setPalette(p.palette());
|
||||
m_backstageMenu->setFont(p.font());
|
||||
m_backstageMenu->setVisible(false);
|
||||
|
||||
p.setVisible(false);
|
||||
}
|
||||
|
||||
void RibbonBackstageViewPrivate::layoutBackstage()
|
||||
{
|
||||
QTN_P(RibbonBackstageView);
|
||||
if (!m_ribbon)
|
||||
return;
|
||||
|
||||
int backstageViewTop = 0;
|
||||
|
||||
m_backstageMenu->createBackstageCloseButton();
|
||||
|
||||
if (m_ribbon->isVisible() && !(bool)p.style()->styleHint((QStyle::StyleHint)RibbonStyle::SH_RibbonBackstageHideTabs))
|
||||
backstageViewTop = m_ribbon->backstageViewTop();
|
||||
|
||||
QWidget* parent = p.parentWidget();
|
||||
QRect rect = parent->rect();
|
||||
rect.setTop(rect.top() + backstageViewTop);
|
||||
QSize sz = m_backstageMenu->sizeHint();
|
||||
m_backstageMenu->setGeometry(QRect(QPoint(rect.topLeft()), QPoint(rect.left() + sz.width(), rect.bottom())));
|
||||
m_backstageMenu->raise();
|
||||
|
||||
if ((bool)p.style()->styleHint((QStyle::StyleHint)RibbonStyle::SH_RibbonBackstageHideTabs))
|
||||
{
|
||||
backstageViewTop = m_ribbon->backstageViewTop();
|
||||
rect.setTop(rect.top() + backstageViewTop);
|
||||
}
|
||||
rect.setLeft(sz.width() + 1);
|
||||
|
||||
p.setGeometry(rect);
|
||||
p.raise();
|
||||
updateGeometryPage(m_activePage);
|
||||
}
|
||||
|
||||
void RibbonBackstageViewPrivate::updateLayout()
|
||||
{
|
||||
m_backstageMenu->resetItemsDirty();
|
||||
layoutBackstage();
|
||||
}
|
||||
|
||||
void RibbonBackstageViewPrivate::updateGeometryPage(QWidget* widget)
|
||||
{
|
||||
if (widget == Q_NULL)
|
||||
return;
|
||||
|
||||
QTN_P(const RibbonBackstageView);
|
||||
QSize minimumSize = widget->minimumSize();
|
||||
int top = (bool)p.style()->styleHint((QStyle::StyleHint)RibbonStyle::SH_RibbonBackstageHideTabs) ? 0 : 2;
|
||||
|
||||
QRect rcContent(QPoint(0, top), QPoint(p.rect().right(), p.rect().bottom()));
|
||||
rcContent.setRight(qMax(rcContent.right(), rcContent.left() + minimumSize.width()));
|
||||
rcContent.setBottom(qMax(rcContent.bottom(), rcContent.top() + minimumSize.height()));
|
||||
widget->setGeometry(rcContent);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static inline bool isAncestor(const QObject* obj, const QObject* child)
|
||||
{
|
||||
while (child)
|
||||
{
|
||||
if (child == obj)
|
||||
return true;
|
||||
child = child->parent();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
void RibbonBackstageViewPrivate::setCurrentAction(QAction* action)
|
||||
{
|
||||
if (m_currentAction)
|
||||
m_backstageMenu->update(m_backstageMenu->actionRect(m_currentAction));
|
||||
|
||||
m_currentAction = action;
|
||||
|
||||
if (action)
|
||||
{
|
||||
if (!action->isSeparator())
|
||||
m_backstageMenu->update(m_backstageMenu->actionRect(action));
|
||||
}
|
||||
}
|
||||
|
||||
QAction* RibbonBackstageViewPrivate::currentAction() const
|
||||
{
|
||||
return m_currentAction;
|
||||
}
|
||||
|
||||
QWidgetAction* RibbonBackstageViewPrivate::getAction(QWidget* w) const
|
||||
{
|
||||
QTN_P(const RibbonBackstageView);
|
||||
QList<QAction*> actions = p.actions();
|
||||
for (int i = 0, count = actions.count(); i < count; i++)
|
||||
{
|
||||
QWidgetAction* action = dynamic_cast<QWidgetAction*>(actions.at(i));
|
||||
if (action && action->defaultWidget() == w)
|
||||
return action;
|
||||
}
|
||||
return Q_NULL;
|
||||
}
|
||||
|
||||
|
||||
/* RibbonBackstageView */
|
||||
RibbonBackstageView::RibbonBackstageView(RibbonBar* ribbonBar)
|
||||
: QWidget(ribbonBar->parentWidget())
|
||||
{
|
||||
QTN_INIT_PRIVATE(RibbonBackstageView);
|
||||
QTN_D(RibbonBackstageView);
|
||||
d.init(ribbonBar);
|
||||
}
|
||||
|
||||
RibbonBackstageView::~RibbonBackstageView()
|
||||
{
|
||||
QTN_FINI_PRIVATE();
|
||||
}
|
||||
|
||||
void RibbonBackstageView::showEvent(QShowEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QTN_D(RibbonBackstageView);
|
||||
d.m_tabBarPosition = d.m_ribbon->tabBarPosition();
|
||||
d.m_ribbon->setTabBarPosition(RibbonBar::TabBarTopPosition);
|
||||
d.updateLayout();
|
||||
d.m_backstageMenu->setVisible(true);
|
||||
d.m_ribbon->qtn_d().setVisibleBackstage(true);
|
||||
setFocus();
|
||||
emit aboutToShow();
|
||||
}
|
||||
|
||||
void RibbonBackstageView::hideEvent(QHideEvent * event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QTN_D(RibbonBackstageView);
|
||||
d.m_ribbon->setTabBarPosition(d.m_tabBarPosition);
|
||||
d.m_backstageMenu->setVisible(false);
|
||||
d.m_ribbon->qtn_d().setVisibleBackstage(false);
|
||||
emit aboutToHide();
|
||||
}
|
||||
|
||||
bool RibbonBackstageView::isClosePrevented() const
|
||||
{
|
||||
QTN_D(const RibbonBackstageView);
|
||||
return d.m_closePrevented;
|
||||
}
|
||||
|
||||
void RibbonBackstageView::setClosePrevented(bool prevent)
|
||||
{
|
||||
QTN_D(RibbonBackstageView);
|
||||
d.m_closePrevented = prevent;
|
||||
}
|
||||
|
||||
QAction* RibbonBackstageView::addAction(const QIcon& icon, const QString& text)
|
||||
{
|
||||
QAction* action = new QAction(icon, text, this);
|
||||
addAction(action);
|
||||
return action;
|
||||
}
|
||||
|
||||
QAction* RibbonBackstageView::addSeparator()
|
||||
{
|
||||
QAction* action = new QAction(this);
|
||||
action->setSeparator(true);
|
||||
addAction(action);
|
||||
return action;
|
||||
}
|
||||
|
||||
QAction* RibbonBackstageView::addPage(QWidget* widget)
|
||||
{
|
||||
QWidgetAction* action = new QWidgetAction(this);
|
||||
action->setDefaultWidget(widget);
|
||||
widget->setFont(font());
|
||||
action->setText(widget->windowTitle());
|
||||
addAction(action);
|
||||
return action;
|
||||
}
|
||||
|
||||
void RibbonBackstageView::setActivePage(QWidget* widget)
|
||||
{
|
||||
QTN_D(RibbonBackstageView);
|
||||
|
||||
bool find = false;
|
||||
QList<QAction*> acts = actions();
|
||||
for (int i = 0, count = acts.count(); i < count && !find; i++)
|
||||
{
|
||||
if (QWidgetAction* action = dynamic_cast<QWidgetAction*>(acts.at(i)))
|
||||
{
|
||||
if (action->defaultWidget() == widget)
|
||||
{
|
||||
if (!action->isVisible())
|
||||
{
|
||||
Q_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
find = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( !find )
|
||||
{
|
||||
Q_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (d.m_activePage)
|
||||
{
|
||||
if (QWidgetAction* act = d.getAction(d.m_activePage))
|
||||
d.m_backstageMenu->update(d.m_backstageMenu->actionRect(act));
|
||||
}
|
||||
|
||||
for (int i = 0, count = acts.count(); i < count; i++)
|
||||
{
|
||||
if (QWidgetAction* action = dynamic_cast<QWidgetAction*>(acts.at(i)))
|
||||
{
|
||||
QWidget* w = action->defaultWidget();
|
||||
if (w == widget)
|
||||
{
|
||||
d.m_activePage = widget;
|
||||
d.updateGeometryPage(widget);
|
||||
w->setVisible(true);
|
||||
}
|
||||
else
|
||||
w->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (d.m_activePage)
|
||||
{
|
||||
if (QWidgetAction* act = d.getAction(d.m_activePage))
|
||||
d.m_backstageMenu->update(d.m_backstageMenu->actionRect(act));
|
||||
}
|
||||
}
|
||||
|
||||
QWidget* RibbonBackstageView::getActivePage() const
|
||||
{
|
||||
QTN_D(const RibbonBackstageView);
|
||||
return d.m_activePage;
|
||||
}
|
||||
|
||||
QRect RibbonBackstageView::actionGeometry(QAction* act) const
|
||||
{
|
||||
QTN_D(const RibbonBackstageView);
|
||||
return d.m_backstageMenu->actionRect(act);
|
||||
}
|
||||
|
||||
QRect RibbonBackstageView::menuGeometry() const
|
||||
{
|
||||
QTN_D(const RibbonBackstageView);
|
||||
return d.m_backstageMenu->geometry();
|
||||
}
|
||||
|
||||
void RibbonBackstageView::open()
|
||||
{
|
||||
ensurePolished(); // Get the right font
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
bool RibbonBackstageView::event(QEvent* event)
|
||||
{
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::ParentChange :
|
||||
{
|
||||
if (QWidget* parent = parentWidget())
|
||||
parent->installEventFilter(this);
|
||||
}
|
||||
break;
|
||||
case QEvent::ParentAboutToChange :
|
||||
{
|
||||
if (QWidget* parent = parentWidget())
|
||||
parent->removeEventFilter(this);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
void RibbonBackstageView::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QTN_D(RibbonBackstageView);
|
||||
QPainter p(this);
|
||||
|
||||
StyleOptionRibbonBackstage opt;
|
||||
opt.initFrom(this);
|
||||
opt.menuWidth = d.m_backstageMenu->sizeHint().width();
|
||||
style()->drawPrimitive((QStyle::PrimitiveElement)RibbonStyle::PE_Backstage, &opt, &p, this);
|
||||
}
|
||||
|
||||
bool RibbonBackstageView::eventFilter(QObject* object, QEvent* event)
|
||||
{
|
||||
QTN_D(RibbonBackstageView);
|
||||
if (parentWidget() == object && isVisible())
|
||||
{
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::Resize :
|
||||
d.updateLayout();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
return QWidget::eventFilter(object, event);
|
||||
}
|
||||
|
||||
void RibbonBackstageView::actionEvent(QActionEvent* event)
|
||||
{
|
||||
QWidget::actionEvent(event);
|
||||
|
||||
QTN_D(RibbonBackstageView);
|
||||
if (event->type() == QEvent::ActionAdded)
|
||||
{
|
||||
if (QWidgetAction* wa = qobject_cast<QWidgetAction*>(event->action()))
|
||||
{
|
||||
QWidget *widget = wa->requestWidget(this);
|
||||
if (widget)
|
||||
d.m_widgetItems.insert(wa, widget);
|
||||
}
|
||||
}
|
||||
else if (event->type() == QEvent::ActionRemoved)
|
||||
{
|
||||
if (QWidgetAction* wa = qobject_cast<QWidgetAction*>(event->action()))
|
||||
{
|
||||
if (QWidget *widget = d.m_widgetItems.value(wa))
|
||||
wa->releaseWidget(widget);
|
||||
}
|
||||
d.m_widgetItems.remove(event->action());
|
||||
}
|
||||
else if (event->type() == QEvent::ActionChanged)
|
||||
{
|
||||
if (QWidgetAction* action = dynamic_cast<QWidgetAction*>(event->action()))
|
||||
{
|
||||
if (!action->isVisible() && action->defaultWidget())
|
||||
{
|
||||
action->defaultWidget()->setVisible(false);
|
||||
|
||||
if (getActivePage() == action->defaultWidget())
|
||||
{
|
||||
bool activatePage = false;
|
||||
QList<QAction*> acts = actions();
|
||||
for (int i = 0, count = acts.count(); i < count && !activatePage; i++)
|
||||
{
|
||||
if (QWidgetAction* action = dynamic_cast<QWidgetAction*>(acts.at(i)))
|
||||
{
|
||||
if (action->isVisible())
|
||||
{
|
||||
if (QWidget* widget = action->defaultWidget())
|
||||
{
|
||||
setActivePage(widget);
|
||||
activatePage = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
d.m_backstageMenu->resetItemsDirty();
|
||||
}
|
||||
}
|
||||
|
||||
142
third-party/QtitanRibbon/src/ribbon/QtnRibbonBackstageView.h
vendored
Normal file
142
third-party/QtitanRibbon/src/ribbon/QtnRibbonBackstageView.h
vendored
Normal file
@@ -0,0 +1,142 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONBACKSTAGEVIEW_H
|
||||
#define QTN_RIBBONBACKSTAGEVIEW_H
|
||||
|
||||
#include <QFrame>
|
||||
#include <QToolButton>
|
||||
|
||||
#include "QtnRibbonBar.h"
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class QTITAN_EXPORT RibbonBackstageSeparator : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation)
|
||||
public:
|
||||
RibbonBackstageSeparator(QWidget* parent);
|
||||
virtual ~RibbonBackstageSeparator();
|
||||
|
||||
public:
|
||||
void setOrientation(Qt::Orientation orient);
|
||||
Qt::Orientation orientation() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonBackstageSeparator)
|
||||
};
|
||||
|
||||
class RibbonBackstageButtonPrivate;
|
||||
/* RibbonBackstagePage */
|
||||
class QTITAN_EXPORT RibbonBackstageButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool tabStyle READ tabStyle WRITE setTabStyle)
|
||||
Q_PROPERTY(bool flatStyle READ flatStyle WRITE setFlatStyle)
|
||||
public:
|
||||
RibbonBackstageButton(QWidget* parent);
|
||||
virtual ~RibbonBackstageButton();
|
||||
|
||||
public:
|
||||
bool tabStyle() const;
|
||||
void setTabStyle(bool style);
|
||||
|
||||
bool flatStyle();
|
||||
void setFlatStyle(bool flat);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonBackstageButton)
|
||||
Q_DISABLE_COPY(RibbonBackstageButton)
|
||||
};
|
||||
|
||||
|
||||
/* RibbonBackstagePage */
|
||||
class QTITAN_EXPORT RibbonBackstagePage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RibbonBackstagePage(QWidget* parent);
|
||||
virtual ~RibbonBackstagePage();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonBackstagePage)
|
||||
};
|
||||
|
||||
|
||||
class RibbonBackstageViewPrivate;
|
||||
/* RibbonBackstageView */
|
||||
class QTITAN_EXPORT RibbonBackstageView : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonBackstageView(RibbonBar* ribbonBar);
|
||||
virtual ~RibbonBackstageView();
|
||||
public:
|
||||
bool isClosePrevented() const;
|
||||
void setClosePrevented(bool prevent);
|
||||
|
||||
QAction* addAction(const QIcon& icon, const QString& text);
|
||||
QAction* addSeparator();
|
||||
QAction* addPage(QWidget* widget);
|
||||
|
||||
void setActivePage(QWidget* widget);
|
||||
QWidget* getActivePage() const;
|
||||
|
||||
QRect actionGeometry(QAction* ) const;
|
||||
QRect menuGeometry() const;
|
||||
|
||||
using QWidget::addAction;
|
||||
|
||||
public Q_SLOTS:
|
||||
void open();
|
||||
Q_SIGNALS:
|
||||
void aboutToShow();
|
||||
void aboutToHide();
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual bool eventFilter(QObject* object, QEvent* event);
|
||||
virtual void actionEvent(QActionEvent* event);
|
||||
virtual void showEvent(QShowEvent* event);
|
||||
virtual void hideEvent(QHideEvent * event);
|
||||
private:
|
||||
friend class RibbonBackstageViewMenu;
|
||||
friend class RibbonBar;
|
||||
QTN_DECLARE_PRIVATE(RibbonBackstageView)
|
||||
Q_DISABLE_COPY(RibbonBackstageView)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONBACKSTAGEVIEW_H
|
||||
133
third-party/QtitanRibbon/src/ribbon/QtnRibbonBackstageViewPrivate.h
vendored
Normal file
133
third-party/QtitanRibbon/src/ribbon/QtnRibbonBackstageViewPrivate.h
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONBACKSTAGEPVIEWRIVATE_H
|
||||
#define QTN_RIBBONBACKSTAGEPVIEWRIVATE_H
|
||||
|
||||
#include <QToolButton>
|
||||
#include <QHash>
|
||||
|
||||
#include "QtnRibbonBackstageView.h"
|
||||
|
||||
class QStyleOptionMenuItem;
|
||||
class QWidgetAction;
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
/* RibbonBackstageCloseButton */
|
||||
class RibbonBackstageCloseButton : public QToolButton
|
||||
{
|
||||
public:
|
||||
RibbonBackstageCloseButton(QWidget* parent);
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonBackstageCloseButton)
|
||||
};
|
||||
|
||||
class StyleOptionRibbonBackstage;
|
||||
/* RibbonBackstageViewMenu */
|
||||
class RibbonBackstageViewMenu : public QWidget
|
||||
{
|
||||
public:
|
||||
RibbonBackstageViewMenu(RibbonBackstageView* backstageView, QWidget* parent = Q_NULL);
|
||||
public:
|
||||
void createBackstageCloseButton();
|
||||
QAction* actionAt(const QPoint& p) const;
|
||||
QRect actionRect(QAction* act) const;
|
||||
void resetItemsDirty();
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
protected:
|
||||
void initStyleOption(StyleOptionRibbonBackstage* opt) const;
|
||||
void initStyleOption(QStyleOptionMenuItem* option, const QAction* action) const;
|
||||
void updateActionRects() const;
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void keyPressEvent(QKeyEvent *);
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
virtual void mouseMoveEvent(QMouseEvent* event);
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event);
|
||||
virtual void leaveEvent(QEvent* event);
|
||||
private:
|
||||
RibbonBackstageView* m_backstageView;
|
||||
RibbonBackstageCloseButton* m_backStageCloseButton;
|
||||
bool m_mouseDown;
|
||||
|
||||
mutable bool m_itemsDirty;
|
||||
mutable int m_menuWidth;
|
||||
mutable int m_maxIconWidth;
|
||||
mutable QVector<QRect> m_actionRects;
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonBackstageViewMenu)
|
||||
};
|
||||
|
||||
class RibbonBar;
|
||||
class HackFilter;
|
||||
/* RibbonBackstageViewPrivate */
|
||||
class RibbonBackstageViewPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
Q_OBJECT
|
||||
QTN_DECLARE_PUBLIC(RibbonBackstageView)
|
||||
public:
|
||||
explicit RibbonBackstageViewPrivate();
|
||||
virtual ~RibbonBackstageViewPrivate();
|
||||
|
||||
public:
|
||||
void init(RibbonBar* ribbonBar);
|
||||
void layoutBackstage();
|
||||
void updateLayout();
|
||||
void updateGeometryPage(QWidget* widget);
|
||||
|
||||
void setCurrentAction(QAction *action);
|
||||
QAction* currentAction() const;
|
||||
|
||||
QWidgetAction* getAction(QWidget* w) const;
|
||||
|
||||
public:
|
||||
RibbonBar* m_ribbon;
|
||||
RibbonBackstageViewMenu* m_backstageMenu;
|
||||
RibbonBar::TabBarPosition m_tabBarPosition;
|
||||
QWidget* m_activePage;
|
||||
QAction* m_currentAction;
|
||||
|
||||
bool m_closePrevented;
|
||||
mutable QVector<QRect> m_actionRects;
|
||||
mutable QHash<QAction*, QWidget*> m_widgetItems;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonBackstageViewPrivate)
|
||||
};
|
||||
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONBACKSTAGEPVIEWRIVATE_H
|
||||
|
||||
3350
third-party/QtitanRibbon/src/ribbon/QtnRibbonBar.cpp
vendored
Normal file
3350
third-party/QtitanRibbon/src/ribbon/QtnRibbonBar.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
237
third-party/QtitanRibbon/src/ribbon/QtnRibbonBar.h
vendored
Normal file
237
third-party/QtitanRibbon/src/ribbon/QtnRibbonBar.h
vendored
Normal file
@@ -0,0 +1,237 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONBAR_H
|
||||
#define QTN_RIBBONBAR_H
|
||||
|
||||
#include <QMenuBar>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
|
||||
class QMenu;
|
||||
class QToolButton;
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonPage;
|
||||
class RibbonBarPrivate;
|
||||
class RibbonSystemButton;
|
||||
class RibbonQuickAccessBar;
|
||||
class RibbonCustomizeManager;
|
||||
class RibbonCustomizeDialog;
|
||||
|
||||
/* RibbonBar */
|
||||
class QTITAN_EXPORT RibbonBar : public QMenuBar
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS(QuickAccessBarPosition)
|
||||
Q_ENUMS(TabBarPosition)
|
||||
Q_PROPERTY(QuickAccessBarPosition quickAccessBarPosition READ quickAccessBarPosition WRITE setQuickAccessBarPosition)
|
||||
Q_PROPERTY(TabBarPosition tabBarPosition READ tabBarPosition WRITE setTabBarPosition)
|
||||
Q_PROPERTY(int currentPageIndex READ currentPageIndex WRITE setCurrentPageIndex NOTIFY currentPageIndexChanged)
|
||||
Q_PROPERTY(bool frameThemeEnabled READ isFrameThemeEnabled WRITE setFrameThemeEnabled)
|
||||
Q_PROPERTY(bool minimized READ isMinimized WRITE setMinimized NOTIFY minimizationChanged)
|
||||
Q_PROPERTY(bool titleGroupsVisible READ isTitleGroupsVisible WRITE setTitleGroupsVisible)
|
||||
|
||||
public:
|
||||
enum QuickAccessBarPosition
|
||||
{
|
||||
QATopPosition = 1,
|
||||
QABottomPosition
|
||||
};
|
||||
enum TabBarPosition
|
||||
{
|
||||
TabBarTopPosition = 1,
|
||||
TabBarBottomPosition
|
||||
};
|
||||
public:
|
||||
explicit RibbonBar(QWidget* parent = Q_NULL);
|
||||
virtual ~RibbonBar();
|
||||
|
||||
public:
|
||||
bool isVisible() const;
|
||||
|
||||
public:
|
||||
RibbonPage* addPage(const QString& text);
|
||||
void addPage(RibbonPage* page);
|
||||
|
||||
RibbonPage* insertPage(int index, const QString& text);
|
||||
void insertPage(int index, RibbonPage* page);
|
||||
|
||||
void movePage(RibbonPage* page, int newIndex);
|
||||
void movePage(int index, int newIndex);
|
||||
|
||||
void removePage(RibbonPage* page);
|
||||
void removePage(int index);
|
||||
|
||||
void detachPage(RibbonPage* page);
|
||||
void detachPage(int index);
|
||||
|
||||
void clearPages();
|
||||
|
||||
bool isKeyTipsShowing() const;
|
||||
bool keyTipsEnabled() const;
|
||||
void setKeyTipsEnable(bool enable);
|
||||
bool isKeyTipsComplement() const;
|
||||
void setKeyTipsComplement(bool complement);
|
||||
void setKeyTip(QAction* action, const QString& keyTip);
|
||||
|
||||
void setLogoPixmap(Qt::AlignmentFlag alignment, const QPixmap& logotype);
|
||||
QPixmap logoPixmap(Qt::AlignmentFlag& alignment) const;
|
||||
|
||||
void setTitleBackground(const QPixmap& px);
|
||||
const QPixmap& titleBackground() const;
|
||||
|
||||
RibbonQuickAccessBar* quickAccessBar() const;
|
||||
RibbonQuickAccessBar* getQuickAccessBar() const; // Deprecated
|
||||
|
||||
void showQuickAccess(bool show = true);
|
||||
bool isQuickAccessVisible() const;
|
||||
|
||||
void setQuickAccessBarPosition(QuickAccessBarPosition position);
|
||||
QuickAccessBarPosition quickAccessBarPosition() const;
|
||||
|
||||
void setTabBarPosition(TabBarPosition position);
|
||||
TabBarPosition tabBarPosition() const;
|
||||
|
||||
void minimize();
|
||||
bool isMinimized() const;
|
||||
void setMinimized(bool flag);
|
||||
|
||||
void maximize();
|
||||
bool isMaximized() const;
|
||||
void setMaximized(bool flag);
|
||||
|
||||
void setMinimizationEnabled(bool enabled);
|
||||
bool isMinimizationEnabled() const;
|
||||
|
||||
RibbonCustomizeManager* customizeManager();
|
||||
RibbonCustomizeDialog* customizeDialog();
|
||||
|
||||
public Q_SLOTS:
|
||||
void setCurrentPageIndex(int index);
|
||||
void showCustomizeDialog();
|
||||
|
||||
public:
|
||||
int currentPageIndex() const;
|
||||
const QList<RibbonPage *>& pages() const;
|
||||
RibbonPage* getPage(int index) const;
|
||||
int getPageCount() const;
|
||||
|
||||
static bool loadTranslation(const QString& country = QString()); //Format de_de, fr_fr, ru_ru
|
||||
static QString tr_compatible(const char *s, const char *c = 0);
|
||||
|
||||
QMenu* addMenu(const QString& text);
|
||||
QAction* addAction(const QIcon& icon, const QString& text, Qt::ToolButtonStyle style, QMenu* menu = Q_NULL);
|
||||
QAction* addAction(QAction* action, Qt::ToolButtonStyle style);
|
||||
|
||||
QAction* addSystemButton(const QString& text);
|
||||
QAction* addSystemButton(const QIcon& icon, const QString& text);
|
||||
|
||||
RibbonSystemButton* getSystemButton() const;
|
||||
|
||||
bool isBackstageVisible() const;
|
||||
|
||||
void setFrameThemeEnabled(bool enable = true);
|
||||
bool isFrameThemeEnabled() const;
|
||||
|
||||
bool isTitleBarVisible() const;
|
||||
void setTitleBarVisible(bool visible);
|
||||
|
||||
bool isTitleGroupsVisible() const;
|
||||
void setTitleGroupsVisible(bool visible);
|
||||
|
||||
int rowItemHeight() const;
|
||||
int rowItemCount() const;
|
||||
int titleBarHeight() const;
|
||||
|
||||
void updateLayout();
|
||||
|
||||
Q_SIGNALS:
|
||||
void minimizationChanged(bool minimized);
|
||||
void currentPageIndexChanged(int index);
|
||||
void currentPageChanged(RibbonPage* page);
|
||||
void keyTipsShowed(bool showed);
|
||||
void showRibbonContextMenu(QMenu* menu, QContextMenuEvent* event);
|
||||
|
||||
protected:
|
||||
int backstageViewTop() const;
|
||||
int tabBarHeight(bool isVisible = false) const;
|
||||
void setMinimizedFlag(bool flag);
|
||||
#ifdef Q_OS_WIN
|
||||
void updateWindowTitle();
|
||||
#endif
|
||||
|
||||
public:
|
||||
virtual int heightForWidth(int) const;
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual bool eventFilter(QObject* object, QEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* p);
|
||||
virtual void changeEvent(QEvent* event);
|
||||
virtual void resizeEvent(QResizeEvent* event);
|
||||
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
virtual void wheelEvent(QWheelEvent* event);
|
||||
virtual void contextMenuEvent(QContextMenuEvent* event);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
virtual bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result);
|
||||
#else
|
||||
virtual bool winEvent(MSG* message, long* result);
|
||||
#endif
|
||||
#endif // Q_OS_WIN
|
||||
private:
|
||||
friend class RibbonPage;
|
||||
friend class RibbonPagePrivate;
|
||||
friend class RibbonTabBarPrivate;
|
||||
friend class RibbonSystemPopupBar;
|
||||
friend class RibbonBackstageViewPrivate;
|
||||
friend class RibbonBackstageView;
|
||||
friend class RibbonStyle;
|
||||
friend class RibbonQuickAccessBar;
|
||||
friend class RibbonSystemButton;
|
||||
friend class RibbonTab;
|
||||
friend class RibbonTabBar;
|
||||
#ifdef Q_OS_WIN
|
||||
friend class OfficeFrameHelperWin;
|
||||
#endif // Q_OS_WIN
|
||||
QTN_DECLARE_PRIVATE(RibbonBar)
|
||||
Q_DISABLE_COPY(RibbonBar)
|
||||
};
|
||||
|
||||
extern void qtn_set_font_to_ribbon_children(QWidget* widget, const QFont& font);
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONBAR_H
|
||||
|
||||
|
||||
249
third-party/QtitanRibbon/src/ribbon/QtnRibbonBarCustomizePage.ui
vendored
Normal file
249
third-party/QtitanRibbon/src/ribbon/QtnRibbonBarCustomizePage.ui
vendored
Normal file
@@ -0,0 +1,249 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RibbonBarCustomizePage</class>
|
||||
<widget class="QWidget" name="RibbonBarCustomizePage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>380</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>600</width>
|
||||
<height>380</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Customize Ribbon</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Customize the Ribbon</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCommandsFrom">
|
||||
<property name="text">
|
||||
<string>&Choose commands from:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>comboBoxSourceCategory</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBoxSourceCategory"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeCommands">
|
||||
<property name="headerHidden">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,0,1,0">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Add > ></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>< < &Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCustomizeRibbon">
|
||||
<property name="text">
|
||||
<string>Customize the Ri&bbon:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>treeRibbon</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="switchTabsBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeRibbon">
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string notr="true">1</string>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newTabButton">
|
||||
<property name="text">
|
||||
<string>Ne&w Tab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="newGroupButton">
|
||||
<property name="text">
|
||||
<string>&New Group</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="renameButton">
|
||||
<property name="text">
|
||||
<string>Rena&me...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3" stretch="0,1">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCustomizations">
|
||||
<property name="text">
|
||||
<string>Customizations:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetButton">
|
||||
<property name="text">
|
||||
<string>Re&set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="upButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="downButton">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
199
third-party/QtitanRibbon/src/ribbon/QtnRibbonBarPrivate.h
vendored
Normal file
199
third-party/QtitanRibbon/src/ribbon/QtnRibbonBarPrivate.h
vendored
Normal file
@@ -0,0 +1,199 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONBARPRIVATE_H
|
||||
#define QTN_RIBBONBARPRIVATE_H
|
||||
|
||||
#include <QStyle>
|
||||
#include <QStack>
|
||||
#include <QLabel>
|
||||
|
||||
#include "QtnRibbonBar.h"
|
||||
#include "QtnRibbonTabBar.h"
|
||||
#include "QtnRibbonCustomizePage.h"
|
||||
#include "QtnRibbonQuickAccessBar.h"
|
||||
#include "../styles/QtnCommonStylePrivate.h"
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class LogotypeLabel : public QLabel
|
||||
{
|
||||
public:
|
||||
LogotypeLabel(QWidget* parent);
|
||||
|
||||
public:
|
||||
Qt::AlignmentFlag alignmentLogotype() const { return m_alignment; }
|
||||
void setAlignmentLogotype(Qt::AlignmentFlag alignment) { m_alignment = alignment; }
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* p);
|
||||
|
||||
private:
|
||||
Qt::AlignmentFlag m_alignment;
|
||||
};
|
||||
|
||||
class RibbonTabBar;
|
||||
class RibbonTitleButton;
|
||||
class OfficeFrameHelper;
|
||||
class StyleOptionTitleBar;
|
||||
class RibbonSystemButton;
|
||||
class RibbonBackstageCloseButton;
|
||||
class MenuMinimizedGroups;
|
||||
class RibbonKeyTip;
|
||||
class RibbonCustomizeManager;
|
||||
|
||||
class RibbonBarPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
Q_OBJECT
|
||||
QTN_DECLARE_PUBLIC(RibbonBar)
|
||||
public:
|
||||
explicit RibbonBarPrivate();
|
||||
virtual ~RibbonBarPrivate();
|
||||
|
||||
public:
|
||||
void init();
|
||||
void calcHeightItem();
|
||||
|
||||
void layoutRibbon();
|
||||
void layoutTitleButton();
|
||||
bool isExistAssociativeTabWithPage(const RibbonTab* tab);
|
||||
void layoutContextHeaders();
|
||||
void layoutCorner();
|
||||
|
||||
void removeAllContextHeaders();
|
||||
bool reduceContextHeaders();
|
||||
|
||||
void updateMinimizedModePage(RibbonPage* page);
|
||||
void swapVisiblePages(int index);
|
||||
void setVisibleBackstage(bool visible);
|
||||
|
||||
QAction* createSystemButton(const QIcon& icon, const QString& text);
|
||||
|
||||
RibbonPage* insertPage(int indTab, int index);
|
||||
void insertPage(int indTab, int index, RibbonPage* page);
|
||||
void removePage(int index, bool deletePage = true);
|
||||
int indexPage(RibbonPage* page) const;
|
||||
|
||||
bool validIndex(int index) const { return index >= 0 && index < m_listPages.count(); }
|
||||
int heightTabs() const;
|
||||
int topBorder() const;
|
||||
|
||||
void titleBarOptions(StyleOptionTitleBar& opt) const;
|
||||
QStyle::SubControl getSubControl(const QPoint& pos) const;
|
||||
|
||||
RibbonTitleButton* findTitleButton(QStyle::SubControl subControl) const;
|
||||
QAction* addTitleButton(QStyle::SubControl subControl, bool add, QRect& rcControl);
|
||||
|
||||
ContextHeader* hitTestContextHeaders(const QPoint& point) const;
|
||||
QMenu* createContextMenu();
|
||||
|
||||
void showKeyTips(QWidget* w);
|
||||
bool hideKeyTips();
|
||||
void createKeyTips();
|
||||
void createGroupKeyTips();
|
||||
void createWidgetKeyTips(RibbonGroup* group, QWidget* widget, const QString& prefix, const QRect& rcGroups, bool visible);
|
||||
bool createPopupKeyTips(QMenu* levalMenu);
|
||||
void destroyKeyTips();
|
||||
void calcPositionKeyTips();
|
||||
int rowItemHeight() const;
|
||||
int rowItemCount() const;
|
||||
int maxGroupHeight() const;
|
||||
void createCustomizeDialog();
|
||||
|
||||
private Q_SLOTS:
|
||||
void processClickedSubControl();
|
||||
void toggledCustomizeBar();
|
||||
void toggledQuickAccessBarPos();
|
||||
void toggledMinimized();
|
||||
void currentChanged(int index);
|
||||
|
||||
protected:
|
||||
bool pressTipCharEvent(const QKeyEvent* key);
|
||||
virtual bool eventFilter(QObject*, QEvent* event);
|
||||
|
||||
public:
|
||||
QRect m_rcPageArea;
|
||||
QRect m_rcTabBar;
|
||||
int m_currentIndexPage;
|
||||
int m_heightTabs;
|
||||
RibbonTabBar* m_tabBar;
|
||||
RibbonQuickAccessBar* m_quickAccessBar;
|
||||
RibbonSystemButton* m_controlSystemButton;
|
||||
QVector<QWidget*> m_visibleWidgets;
|
||||
|
||||
OfficeFrameHelper* m_frameHelper;
|
||||
QRect m_rcTitle;
|
||||
QRect m_rcHeader;
|
||||
QRect m_rcTitleText;
|
||||
QRect m_rcQuickAccess;
|
||||
|
||||
bool m_showTitleAlways;
|
||||
bool m_ribbonBarVisible;
|
||||
bool m_minimizationEnabled;
|
||||
bool m_minimized;
|
||||
bool m_keyTipsComplement;
|
||||
bool m_keyTipsEnabled;
|
||||
bool m_keyTipsShowing;
|
||||
bool m_titleGroupsVisible;
|
||||
RibbonBar::QuickAccessBarPosition m_quickAccessBarPosition;
|
||||
RibbonBar::TabBarPosition m_tabBarPosition;
|
||||
|
||||
QAction* m_actCloseButton;
|
||||
QAction* m_actNormalButton;
|
||||
QAction* m_actMaxButton;
|
||||
QAction* m_actMinButton;
|
||||
|
||||
QList<ContextHeader*> m_listContextHeaders;
|
||||
QList<RibbonKeyTip*> m_keyTips;
|
||||
QStack<QWidget*> m_levels;
|
||||
int m_countKey;
|
||||
|
||||
QStyle::SubControl m_hoveredSubControl;
|
||||
QStyle::SubControl m_activeSubControl;
|
||||
QString m_windowTitle;
|
||||
|
||||
std::unique_ptr<LogotypeLabel> m_logotypeLabel;
|
||||
|
||||
QPixmap m_pixTitleBackground;
|
||||
RibbonCustomizeManager* m_customizeManager;
|
||||
RibbonCustomizeDialog* m_customizeDialog;
|
||||
protected:
|
||||
QList<RibbonPage*> m_listPages;
|
||||
int m_rowItemHeight;
|
||||
int m_rowItemCount;
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonBarPrivate)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONPRIVATE_H
|
||||
|
||||
|
||||
286
third-party/QtitanRibbon/src/ribbon/QtnRibbonButtonControls.cpp
vendored
Normal file
286
third-party/QtitanRibbon/src/ribbon/QtnRibbonButtonControls.cpp
vendored
Normal file
@@ -0,0 +1,286 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "QtnRibbonButtonControls.h"
|
||||
#include "QtnRibbonGroup.h"
|
||||
#include "QtnRibbonButtonPrivate.h"
|
||||
#include "QtnRibbonControlsPrivate.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
|
||||
RibbonButtonControlPrivate::RibbonButtonControlPrivate()
|
||||
: m_toolButton(Q_NULL)
|
||||
{
|
||||
}
|
||||
|
||||
RibbonButtonControlPrivate::~RibbonButtonControlPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
void RibbonButtonControlPrivate::init()
|
||||
{
|
||||
QTN_P(RibbonButtonControl);
|
||||
p.sizeDefinition(RibbonControlSizeDefinition::GroupLarge)->setStretchable(false);
|
||||
p.sizeDefinition(RibbonControlSizeDefinition::GroupMedium)->setStretchable(false);
|
||||
p.sizeDefinition(RibbonControlSizeDefinition::GroupSmall)->setStretchable(false);
|
||||
p.sizeDefinition(RibbonControlSizeDefinition::GroupPopup)->setStretchable(false);
|
||||
|
||||
m_toolButton = new RibbonButton(&p);
|
||||
p.setContentWidget(m_toolButton);
|
||||
}
|
||||
|
||||
|
||||
/* RibbonButtonControl */
|
||||
RibbonButtonControl::RibbonButtonControl(RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, true)
|
||||
{
|
||||
QTN_INIT_PRIVATE(RibbonButtonControl);
|
||||
QTN_D(RibbonButtonControl);
|
||||
d.init();
|
||||
}
|
||||
|
||||
RibbonButtonControl::~RibbonButtonControl()
|
||||
{
|
||||
QTN_FINI_PRIVATE();
|
||||
}
|
||||
|
||||
const QPixmap& RibbonButtonControl::largeIcon() const
|
||||
{
|
||||
QTN_D(const RibbonButtonControl);
|
||||
return d.m_largeIcon;
|
||||
}
|
||||
|
||||
void RibbonButtonControl::setLargeIcon(const QPixmap& icon)
|
||||
{
|
||||
QTN_D(RibbonButtonControl);
|
||||
d.m_largeIcon = icon;
|
||||
}
|
||||
|
||||
const QPixmap& RibbonButtonControl::smallIcon() const
|
||||
{
|
||||
QTN_D(const RibbonButtonControl);
|
||||
return d.m_smallIcon;
|
||||
}
|
||||
|
||||
void RibbonButtonControl::setSmallIcon(const QPixmap& icon)
|
||||
{
|
||||
QTN_D(RibbonButtonControl);
|
||||
d.m_smallIcon = icon;
|
||||
}
|
||||
|
||||
const QString& RibbonButtonControl::label() const
|
||||
{
|
||||
QTN_D(const RibbonButtonControl);
|
||||
return d.m_label;
|
||||
}
|
||||
|
||||
void RibbonButtonControl::setLabel(const QString& label)
|
||||
{
|
||||
QTN_D(RibbonButtonControl);
|
||||
d.m_label = label;
|
||||
}
|
||||
|
||||
void RibbonButtonControl::setMenu(QMenu* menu)
|
||||
{
|
||||
QTN_D(RibbonButtonControl);
|
||||
d.m_toolButton->setMenu(menu);
|
||||
}
|
||||
|
||||
QMenu* RibbonButtonControl::menu() const
|
||||
{
|
||||
QTN_D(const RibbonButtonControl);
|
||||
return d.m_toolButton->menu();
|
||||
}
|
||||
|
||||
void RibbonButtonControl::setPopupMode(QToolButton::ToolButtonPopupMode mode)
|
||||
{
|
||||
QTN_D(RibbonButtonControl);
|
||||
d.m_toolButton->setPopupMode(mode);
|
||||
}
|
||||
|
||||
QToolButton::ToolButtonPopupMode RibbonButtonControl::popupMode() const
|
||||
{
|
||||
QTN_D(const RibbonButtonControl);
|
||||
return d.m_toolButton->popupMode();
|
||||
}
|
||||
|
||||
void RibbonButtonControl::setToolButtonStyle(Qt::ToolButtonStyle style)
|
||||
{
|
||||
QTN_D(RibbonButtonControl);
|
||||
d.m_toolButton->setToolButtonStyle(style);
|
||||
if (style == Qt::ToolButtonIconOnly)
|
||||
{
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupLarge)->setImageSize(RibbonControlSizeDefinition::ImageSmall);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupLarge)->setLabelVisible(false);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupMedium)->setImageSize(RibbonControlSizeDefinition::ImageSmall);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupMedium)->setLabelVisible(false);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupSmall)->setImageSize(RibbonControlSizeDefinition::ImageSmall);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupSmall)->setLabelVisible(false);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupPopup)->setImageSize(RibbonControlSizeDefinition::ImageSmall);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupPopup)->setLabelVisible(false);
|
||||
}
|
||||
else if (style == Qt::ToolButtonTextOnly)
|
||||
{
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupLarge)->setImageSize(RibbonControlSizeDefinition::ImageNone);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupLarge)->setLabelVisible(true);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupMedium)->setImageSize(RibbonControlSizeDefinition::ImageNone);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupMedium)->setLabelVisible(true);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupSmall)->setImageSize(RibbonControlSizeDefinition::ImageNone);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupSmall)->setLabelVisible(true);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupPopup)->setImageSize(RibbonControlSizeDefinition::ImageNone);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupPopup)->setLabelVisible(true);
|
||||
}
|
||||
else if (style == Qt::ToolButtonTextBesideIcon)
|
||||
{
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupLarge)->setImageSize(RibbonControlSizeDefinition::ImageSmall);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupMedium)->setImageSize(RibbonControlSizeDefinition::ImageSmall);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupSmall)->setImageSize(RibbonControlSizeDefinition::ImageSmall);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupPopup)->setImageSize(RibbonControlSizeDefinition::ImageSmall);
|
||||
}
|
||||
}
|
||||
|
||||
Qt::ToolButtonStyle RibbonButtonControl::toolButtonStyle() const
|
||||
{
|
||||
QTN_D(const RibbonButtonControl);
|
||||
return d.m_toolButton->toolButtonStyle();
|
||||
}
|
||||
|
||||
QToolButton* RibbonButtonControl::widget() const
|
||||
{
|
||||
QTN_D(const RibbonButtonControl);
|
||||
return d.m_toolButton;
|
||||
}
|
||||
|
||||
QSize RibbonButtonControl::sizeHint() const
|
||||
{
|
||||
QTN_D(const RibbonButtonControl);
|
||||
QSize sz = RibbonWidgetControl::sizeHint();
|
||||
|
||||
if (d.m_toolButton && parentGroup())
|
||||
{
|
||||
if (RibbonBar* ribbonBar = parentGroup()->ribbonBar())
|
||||
{
|
||||
Qt::ToolButtonStyle style = toolButtonStyle();
|
||||
if (style == Qt::ToolButtonTextBesideIcon || style == Qt::ToolButtonIconOnly || style == Qt::ToolButtonTextOnly)
|
||||
sz.setHeight(ribbonBar->rowItemHeight());
|
||||
else if (style == Qt::ToolButtonTextUnderIcon)
|
||||
sz.setHeight(ribbonBar->rowItemHeight() * ribbonBar->rowItemCount());
|
||||
}
|
||||
}
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
void RibbonButtonControl::sizeChanged(RibbonControlSizeDefinition::GroupSize size)
|
||||
{
|
||||
QTN_D(RibbonButtonControl);
|
||||
RibbonControl::sizeChanged(size);
|
||||
|
||||
d.m_toolButton->setDefaultAction(defaultAction());
|
||||
|
||||
if (sizeDefinition(size)->imageSize() == RibbonControlSizeDefinition::ImageLarge)
|
||||
{
|
||||
const QPixmap& px = largeIcon();
|
||||
d.m_toolButton->setIconSize(px.size());
|
||||
d.m_toolButton->setIcon(px);
|
||||
d.m_toolButton->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
}
|
||||
else if (sizeDefinition(size)->imageSize() == RibbonControlSizeDefinition::ImageSmall)
|
||||
{
|
||||
const QPixmap& px = smallIcon();
|
||||
d.m_toolButton->setIconSize(px.size());
|
||||
d.m_toolButton->setIcon(px);
|
||||
d.m_toolButton->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
|
||||
if (sizeDefinition(size)->isLabelVisible())
|
||||
d.m_toolButton->setText(label());
|
||||
else
|
||||
d.m_toolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonButtonControl::actionChanged()
|
||||
{
|
||||
const QSize bugImageSize = QSize(32, 32);
|
||||
const QSize smallImageSize = QSize(16, 16);
|
||||
|
||||
if (defaultAction() != Q_NULL)
|
||||
{
|
||||
if (!defaultAction()->iconText().isEmpty())
|
||||
setLabel(defaultAction()->iconText());
|
||||
else
|
||||
setLabel(defaultAction()->text());
|
||||
|
||||
setLargeIcon(defaultAction()->icon().pixmap(bugImageSize));
|
||||
setSmallIcon(defaultAction()->icon().pixmap(smallImageSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
setLabel("Empty");
|
||||
}
|
||||
|
||||
RibbonControl::actionChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* RibbonCheckBoxControl */
|
||||
RibbonCheckBoxControl::RibbonCheckBoxControl(const QString& text, RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, true/*ignoreActionSettings*/)
|
||||
{
|
||||
QCheckBox* checkBox = new QCheckBox(text, this);
|
||||
setContentWidget(checkBox);
|
||||
}
|
||||
|
||||
RibbonCheckBoxControl::~RibbonCheckBoxControl()
|
||||
{
|
||||
}
|
||||
|
||||
QCheckBox* RibbonCheckBoxControl::widget() const
|
||||
{
|
||||
return qobject_cast<QCheckBox*>(contentWidget());
|
||||
}
|
||||
|
||||
/* RibbonCheckBoxControl */
|
||||
RibbonRadioButtonControl::RibbonRadioButtonControl(const QString& text, RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, true/*ignoreActionSettings*/)
|
||||
{
|
||||
QRadioButton* radioButton = new QRadioButton(text, this);
|
||||
setContentWidget(radioButton);
|
||||
}
|
||||
|
||||
RibbonRadioButtonControl::~RibbonRadioButtonControl()
|
||||
{
|
||||
}
|
||||
|
||||
QRadioButton* RibbonRadioButtonControl::widget() const
|
||||
{
|
||||
return qobject_cast<QRadioButton*>(contentWidget());
|
||||
}
|
||||
115
third-party/QtitanRibbon/src/ribbon/QtnRibbonButtonControls.h
vendored
Normal file
115
third-party/QtitanRibbon/src/ribbon/QtnRibbonButtonControls.h
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONBUTTONSCONTROLS_H
|
||||
#define QTN_RIBBONBUTTONSCONTROLS_H
|
||||
|
||||
#include <QCheckBox>
|
||||
#include <QToolButton>
|
||||
#include <QRadioButton>
|
||||
#include <QMenu>
|
||||
|
||||
#include "QtnRibbonControls.h"
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonButtonControlPrivate;
|
||||
/* RibbonButtonControl */
|
||||
class QTITAN_EXPORT RibbonButtonControl : public RibbonWidgetControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonButtonControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonButtonControl();
|
||||
|
||||
public:
|
||||
const QPixmap& largeIcon() const;
|
||||
void setLargeIcon(const QPixmap& icon);
|
||||
|
||||
const QPixmap& smallIcon() const;
|
||||
void setSmallIcon(const QPixmap& icon);
|
||||
|
||||
const QString& label() const;
|
||||
void setLabel(const QString& label);
|
||||
|
||||
void setMenu(QMenu* menu);
|
||||
QMenu* menu() const;
|
||||
|
||||
void setPopupMode(QToolButton::ToolButtonPopupMode mode);
|
||||
QToolButton::ToolButtonPopupMode popupMode() const;
|
||||
|
||||
void setToolButtonStyle(Qt::ToolButtonStyle style);
|
||||
Qt::ToolButtonStyle toolButtonStyle() const;
|
||||
|
||||
QToolButton* widget() const;
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
virtual void sizeChanged(RibbonControlSizeDefinition::GroupSize size);
|
||||
virtual void actionChanged();
|
||||
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonButtonControl)
|
||||
Q_DISABLE_COPY(RibbonButtonControl)
|
||||
};
|
||||
|
||||
|
||||
/* RibbonCheckBoxControl */
|
||||
class QTITAN_EXPORT RibbonCheckBoxControl : public RibbonWidgetControl
|
||||
{
|
||||
public:
|
||||
explicit RibbonCheckBoxControl(const QString& text = QString(), RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonCheckBoxControl();
|
||||
|
||||
public:
|
||||
QCheckBox* widget() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonCheckBoxControl)
|
||||
};
|
||||
|
||||
/* RibbonRadioButtonControl */
|
||||
class QTITAN_EXPORT RibbonRadioButtonControl : public RibbonWidgetControl
|
||||
{
|
||||
public:
|
||||
explicit RibbonRadioButtonControl(const QString& text = QString(), RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonRadioButtonControl();
|
||||
|
||||
public:
|
||||
QRadioButton* widget() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonRadioButtonControl)
|
||||
};
|
||||
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
|
||||
#endif // QTN_RIBBONBUTTONSCONTROLS_H
|
||||
|
||||
|
||||
223
third-party/QtitanRibbon/src/ribbon/QtnRibbonButtonPrivate.cpp
vendored
Normal file
223
third-party/QtitanRibbon/src/ribbon/QtnRibbonButtonPrivate.cpp
vendored
Normal file
@@ -0,0 +1,223 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
|
||||
#include "QtnRibbonButtonPrivate.h"
|
||||
#include "QtnRibbonBar.h"
|
||||
#include "QtnRibbonGroup.h"
|
||||
#include "QtnRibbonControls.h"
|
||||
#include "QtnRibbonStyle.h"
|
||||
#include "QtnStyleHelpers.h"
|
||||
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
|
||||
/*!
|
||||
\class Qtitan::RibbonButton
|
||||
\internal
|
||||
*/
|
||||
RibbonButton::RibbonButton(QWidget* parent)
|
||||
: QToolButton(parent)
|
||||
, m_saveButtonStyle(Qt::ToolButtonIconOnly)
|
||||
, m_saveArrowType(Qt::NoArrow)
|
||||
{
|
||||
setAutoRaise(true);
|
||||
}
|
||||
|
||||
RibbonButton::~RibbonButton()
|
||||
{
|
||||
}
|
||||
|
||||
QSize RibbonButton::sizeHint() const
|
||||
{
|
||||
RibbonButton* thisButton = (RibbonButton*)this;
|
||||
|
||||
if (m_saveButtonStyle != toolButtonStyle())
|
||||
thisButton->m_sizeHint = QSize();
|
||||
|
||||
if (m_saveArrowType != arrowType())
|
||||
thisButton->m_sizeHint = QSize();
|
||||
|
||||
if (m_sizeHint.isValid())
|
||||
return m_sizeHint;
|
||||
|
||||
thisButton->m_saveButtonStyle = toolButtonStyle();
|
||||
thisButton->m_saveArrowType = arrowType();
|
||||
|
||||
QSize sz = QToolButton::sizeHint();
|
||||
if (RibbonControl* control = qobject_cast<RibbonControl *>(parentWidget()))
|
||||
{
|
||||
if (RibbonBar* ribbonBar = control->parentGroup()->ribbonBar())
|
||||
sz.setHeight(ribbonBar->rowItemHeight());
|
||||
}
|
||||
|
||||
int w = 0, h = 0;
|
||||
QStyleOptionToolButton opt;
|
||||
initStyleOption(&opt);
|
||||
|
||||
QString textButton = text();
|
||||
|
||||
if (opt.toolButtonStyle != Qt::ToolButtonTextOnly)
|
||||
{
|
||||
QSize icon = opt.iconSize;
|
||||
QAction* action = defaultAction();
|
||||
if (action && !action->icon().isNull())
|
||||
icon = action->icon().actualSize(opt.iconSize);
|
||||
w = icon.width();
|
||||
h = icon.height();
|
||||
}
|
||||
|
||||
|
||||
bool indicatorCenter = false;
|
||||
QToolButton::ToolButtonPopupMode mode = QToolButton::popupMode();
|
||||
|
||||
if (opt.toolButtonStyle != Qt::ToolButtonIconOnly)
|
||||
{
|
||||
if (opt.toolButtonStyle == Qt::ToolButtonTextUnderIcon)
|
||||
{
|
||||
QString strFirstRow, strSecondRow;
|
||||
CommonStyle::splitString(textButton, strFirstRow, strSecondRow);
|
||||
|
||||
QSize textFirstSize;
|
||||
if (!strFirstRow.isEmpty())
|
||||
textFirstSize = opt.fontMetrics.size(Qt::TextShowMnemonic, strFirstRow);
|
||||
|
||||
if (!strSecondRow.isEmpty())
|
||||
{
|
||||
QSize textSecondSize = opt.fontMetrics.size(Qt::TextShowMnemonic, strSecondRow);
|
||||
textFirstSize.setWidth(qMax(textFirstSize.width(), textSecondSize.width()));
|
||||
}
|
||||
|
||||
indicatorCenter = strSecondRow.isEmpty() && opt.features & QStyleOptionToolButton::HasMenu;
|
||||
|
||||
h = sz.height();
|
||||
|
||||
if (RibbonControl* control = qobject_cast<RibbonControl *>(parentWidget()))
|
||||
{
|
||||
if (RibbonBar* ribbonBar = control->parentGroup()->ribbonBar())
|
||||
h = ribbonBar->rowItemHeight() * ribbonBar->rowItemCount();
|
||||
}
|
||||
|
||||
// if the text is more than icon
|
||||
if (textFirstSize.width() > w)
|
||||
w = textFirstSize.width();
|
||||
// add pixel
|
||||
w += mode == MenuButtonPopup || mode == QToolButton::InstantPopup ? 4 : 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
QSize textSize = opt.fontMetrics.size(Qt::TextShowMnemonic, textButton);
|
||||
textSize.setWidth(textSize.width() + opt.fontMetrics.horizontalAdvance(QLatin1Char(' ')) * 2);
|
||||
h = sz.height();
|
||||
|
||||
if (opt.toolButtonStyle == Qt::ToolButtonTextBesideIcon)
|
||||
{
|
||||
w += textSize.width() + 6;
|
||||
|
||||
if (textSize.height() > h)
|
||||
h = textSize.height();
|
||||
}
|
||||
else
|
||||
w = textSize.width() + 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
h = sz.height();
|
||||
w = h;
|
||||
if ((opt.features & QStyleOptionToolButton::HasMenu) || (opt.subControls & QStyle::SC_ToolButtonMenu))
|
||||
w += 1;
|
||||
}
|
||||
|
||||
opt.rect.setSize(QSize(w, h)); // PM_MenuButtonIndicator depends on the height
|
||||
|
||||
if ((mode == MenuButtonPopup || mode == QToolButton::InstantPopup) && !indicatorCenter)
|
||||
w += style()->pixelMetric(QStyle::PM_MenuButtonIndicator, &opt, this);
|
||||
|
||||
thisButton->m_sizeHint = QSize(w, h).expandedTo(QSize(0, 0));
|
||||
return m_sizeHint;
|
||||
}
|
||||
|
||||
bool RibbonButton::event(QEvent* event)
|
||||
{
|
||||
bool result = QToolButton::event(event);
|
||||
if (event->type() == QEvent::LayoutRequest)
|
||||
m_sizeHint = QSize();
|
||||
return result;
|
||||
}
|
||||
|
||||
void RibbonButton::actionEvent(QActionEvent* event)
|
||||
{
|
||||
QToolButton::actionEvent(event);
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::ActionChanged:
|
||||
m_sizeHint = QSize();
|
||||
break;
|
||||
case QEvent::ActionAdded:
|
||||
m_sizeHint = QSize();
|
||||
break;
|
||||
case QEvent::ActionRemoved:
|
||||
m_sizeHint = QSize();
|
||||
break;
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
/* RibbonTitleButton */
|
||||
RibbonTitleButton::RibbonTitleButton(QWidget* parent, QStyle::SubControl subControl)
|
||||
: QToolButton(parent)
|
||||
{
|
||||
m_subControl = subControl;
|
||||
setAttribute(Qt::WA_Hover, true);
|
||||
}
|
||||
|
||||
RibbonTitleButton::~RibbonTitleButton()
|
||||
{
|
||||
}
|
||||
|
||||
QStyle::SubControl RibbonTitleButton::subControl() const
|
||||
{
|
||||
return m_subControl;
|
||||
}
|
||||
|
||||
void RibbonTitleButton::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
QPainter p(this);
|
||||
StyleCaptionButton opt;
|
||||
initStyleOption(&opt);
|
||||
opt.activeSubControls = m_subControl;
|
||||
style()->drawPrimitive(QStyle::PE_PanelButtonTool, &opt, &p, this);
|
||||
}
|
||||
77
third-party/QtitanRibbon/src/ribbon/QtnRibbonButtonPrivate.h
vendored
Normal file
77
third-party/QtitanRibbon/src/ribbon/QtnRibbonButtonPrivate.h
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONBUTTON_H
|
||||
#define QTN_RIBBONBUTTON_H
|
||||
|
||||
#include <QStyle>
|
||||
#include <QToolButton>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RibbonButton(QWidget* parent = Q_NULL);
|
||||
virtual ~RibbonButton();
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual void actionEvent(QActionEvent* event);
|
||||
private:
|
||||
QSize m_sizeHint;
|
||||
Qt::ToolButtonStyle m_saveButtonStyle;
|
||||
Qt::ArrowType m_saveArrowType;
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonButton)
|
||||
};
|
||||
|
||||
/* RibbonTitleButton */
|
||||
class RibbonTitleButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RibbonTitleButton(QWidget* parent, QStyle::SubControl subControl);
|
||||
virtual ~RibbonTitleButton();
|
||||
public:
|
||||
QStyle::SubControl subControl() const;
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent*);
|
||||
private:
|
||||
QStyle::SubControl m_subControl;
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonTitleButton)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONBUTTON_H
|
||||
1691
third-party/QtitanRibbon/src/ribbon/QtnRibbonControls.cpp
vendored
Normal file
1691
third-party/QtitanRibbon/src/ribbon/QtnRibbonControls.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
258
third-party/QtitanRibbon/src/ribbon/QtnRibbonControls.h
vendored
Normal file
258
third-party/QtitanRibbon/src/ribbon/QtnRibbonControls.h
vendored
Normal file
@@ -0,0 +1,258 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONCONTROLS_H
|
||||
#define QTN_RIBBONCONTROLS_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QResizeEvent>
|
||||
#include <QStyleOption>
|
||||
#include <QLabel>
|
||||
#include <QToolButton>
|
||||
#include <QWidgetAction>
|
||||
#include <QMenu>
|
||||
|
||||
#include "QtnRibbonButtonPrivate.h"
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonControl;
|
||||
class RibbonControlSizeDefinitionPrivate;
|
||||
/* RibbonControlSizeDefinition */
|
||||
class QTITAN_EXPORT RibbonControlSizeDefinition : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum GroupSize
|
||||
{
|
||||
GroupLarge = 0,
|
||||
GroupMedium = 1,
|
||||
GroupSmall = 2,
|
||||
GroupPopup = 3
|
||||
};
|
||||
|
||||
enum ControlImageSize
|
||||
{
|
||||
ImageNone,
|
||||
ImageLarge,
|
||||
ImageSmall
|
||||
};
|
||||
|
||||
public:
|
||||
explicit RibbonControlSizeDefinition(RibbonControl* parentControl, GroupSize size);
|
||||
virtual ~RibbonControlSizeDefinition();
|
||||
|
||||
public:
|
||||
ControlImageSize imageSize() const;
|
||||
void setImageSize(ControlImageSize size);
|
||||
|
||||
bool isLabelVisible() const;
|
||||
void setLabelVisible(bool visible);
|
||||
|
||||
bool isPopup() const;
|
||||
void setPopup(bool popup);
|
||||
|
||||
int visualIndex() const;
|
||||
void setVisualIndex(int index);
|
||||
|
||||
bool showSeparator() const;
|
||||
void setShowSeparator(bool showSeparator);
|
||||
|
||||
bool isVisible() const;
|
||||
void setVisible(bool visible);
|
||||
|
||||
bool isEnabled() const;
|
||||
void setEnabled(bool enabled);
|
||||
|
||||
bool isStretchable() const;
|
||||
void setStretchable(bool stretchable);
|
||||
|
||||
int minimumItemCount() const;
|
||||
void setMinimumItemCount(int count);
|
||||
|
||||
int maximumItemCount() const;
|
||||
void setMaximumItemCount(int count);
|
||||
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonControlSizeDefinition)
|
||||
Q_DISABLE_COPY(RibbonControlSizeDefinition)
|
||||
};
|
||||
|
||||
class RibbonGroup;
|
||||
class RibbonControlPrivate;
|
||||
/* RibbonControl */
|
||||
class QTITAN_EXPORT RibbonControl : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonControl();
|
||||
|
||||
public:
|
||||
RibbonGroup* parentGroup() const;
|
||||
QAction* defaultAction() const;
|
||||
void setDefaultAction(QAction* action);
|
||||
|
||||
virtual void adjustCurrentSize(bool expand);
|
||||
virtual void sizeChanged(RibbonControlSizeDefinition::GroupSize size);
|
||||
|
||||
virtual void actionChanged();
|
||||
virtual void updateLayout();
|
||||
|
||||
RibbonControlSizeDefinition::GroupSize currentSize() const;
|
||||
RibbonControlSizeDefinition* sizeDefinition(RibbonControlSizeDefinition::GroupSize size) const;
|
||||
private:
|
||||
friend class RibbonGroup;
|
||||
QTN_DECLARE_PRIVATE(RibbonControl)
|
||||
Q_DISABLE_COPY(RibbonControl)
|
||||
};
|
||||
|
||||
class RibbonWidgetControlPrivate;
|
||||
/* RibbonWidgetControl */
|
||||
class QTITAN_EXPORT RibbonWidgetControl : public RibbonControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonWidgetControl(RibbonGroup* parentGroup, bool ignoreActionSettings);
|
||||
virtual ~RibbonWidgetControl();
|
||||
|
||||
public:
|
||||
int margin() const;
|
||||
void setMargin(int margin);
|
||||
|
||||
public:
|
||||
virtual void sizeChanged(RibbonControlSizeDefinition::GroupSize size);
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
QWidget* contentWidget() const;
|
||||
void setContentWidget(QWidget* widget);
|
||||
|
||||
protected:
|
||||
virtual void childEvent(QChildEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void resizeEvent(QResizeEvent* event);
|
||||
|
||||
private:
|
||||
friend class RibbonGroup;
|
||||
friend class RibbonGroupPrivate;
|
||||
QTN_DECLARE_PRIVATE(RibbonWidgetControl)
|
||||
Q_DISABLE_COPY(RibbonWidgetControl)
|
||||
};
|
||||
|
||||
class RibbonColumnBreakControlPrivate;
|
||||
/* RibbonColumnBreakControl */
|
||||
class QTITAN_EXPORT RibbonColumnBreakControl : public RibbonWidgetControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonColumnBreakControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonColumnBreakControl();
|
||||
|
||||
public:
|
||||
Qt::Alignment alignmentText() const;
|
||||
void setAlignmentText(Qt::Alignment alignment);
|
||||
|
||||
public:
|
||||
virtual void sizeChanged(RibbonControlSizeDefinition::GroupSize size);
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent*);
|
||||
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonColumnBreakControl)
|
||||
Q_DISABLE_COPY(RibbonColumnBreakControl)
|
||||
};
|
||||
|
||||
/* RibbonLabelControl */
|
||||
class QTITAN_EXPORT RibbonLabelControl : public RibbonWidgetControl
|
||||
{
|
||||
public:
|
||||
explicit RibbonLabelControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
explicit RibbonLabelControl(const QString& text, RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonLabelControl();
|
||||
|
||||
public:
|
||||
QLabel* widget() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonLabelControl)
|
||||
};
|
||||
|
||||
class RibbonToolBarControlPrivate;
|
||||
/* RibbonToolBarControl */
|
||||
class QTITAN_EXPORT RibbonToolBarControl : public RibbonControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonToolBarControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonToolBarControl();
|
||||
|
||||
public:
|
||||
virtual void sizeChanged(RibbonControlSizeDefinition::GroupSize size);
|
||||
virtual void updateLayout();
|
||||
void clear();
|
||||
QAction* addWidget(QWidget* widget);
|
||||
QAction* addWidget(const QIcon& icon, const QString& text, QWidget* widget);
|
||||
QAction* addMenu(const QIcon& icon, const QString& text, QMenu* menu, QToolButton::ToolButtonPopupMode mode = QToolButton::MenuButtonPopup);
|
||||
QAction* addAction(QAction* action, Qt::ToolButtonStyle style, QMenu* menu = Q_NULL, QToolButton::ToolButtonPopupMode mode = QToolButton::MenuButtonPopup);
|
||||
QAction* insertAction(QAction* before, QAction* action, Qt::ToolButtonStyle style, QMenu* menu = Q_NULL, QToolButton::ToolButtonPopupMode mode = QToolButton::MenuButtonPopup);
|
||||
QAction* addAction(const QString& text);
|
||||
QAction* addAction(const QIcon& icon, const QString& text);
|
||||
QAction* addAction(const QString& text, const QObject* receiver, const char* member);
|
||||
QAction* addAction(const QIcon& icon, const QString& text, const QObject* receiver, const char * member);
|
||||
QAction* addAction(const QIcon& icon, const QString& text, Qt::ToolButtonStyle style, QMenu* menu = Q_NULL, QToolButton::ToolButtonPopupMode mode = QToolButton::MenuButtonPopup);
|
||||
QAction* addSeparator();
|
||||
virtual QSize sizeHint() const;
|
||||
void setMargin(int margin);
|
||||
int margin() const;
|
||||
QWidget* widgetByAction(QAction* action);
|
||||
using QWidget::addAction;
|
||||
using QWidget::insertAction;
|
||||
|
||||
protected:
|
||||
int rowsCount();
|
||||
void setRowsCount(int count);
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual void actionEvent(QActionEvent* event);
|
||||
virtual void changeEvent(QEvent* event);
|
||||
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonToolBarControl)
|
||||
Q_DISABLE_COPY(RibbonToolBarControl)
|
||||
};
|
||||
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
|
||||
#endif // QTN_RIBBONCONTROLS_H
|
||||
|
||||
|
||||
232
third-party/QtitanRibbon/src/ribbon/QtnRibbonControlsPrivate.h
vendored
Normal file
232
third-party/QtitanRibbon/src/ribbon/QtnRibbonControlsPrivate.h
vendored
Normal file
@@ -0,0 +1,232 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONCONTROLSPRIVATE_H
|
||||
#define QTN_RIBBONCONTROLSPRIVATE_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "QtnRibbonControls.h"
|
||||
#include "QtnRibbonButtonControls.h"
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
/* RibbonGroupPrivate */
|
||||
class RibbonControlSizeDefinitionPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonControlSizeDefinition)
|
||||
public:
|
||||
explicit RibbonControlSizeDefinitionPrivate();
|
||||
virtual ~RibbonControlSizeDefinitionPrivate();
|
||||
void init(RibbonControl* parent, RibbonControlSizeDefinition::GroupSize size);
|
||||
void updateSizeDefinition();
|
||||
|
||||
public:
|
||||
RibbonControl* m_parentControl;
|
||||
RibbonControlSizeDefinition::ControlImageSize m_imageSize;
|
||||
bool m_labelVisible : 1;
|
||||
bool m_popup : 1;
|
||||
bool m_showSeparator : 1;
|
||||
bool m_visible : 1;
|
||||
bool m_enabled : 1;
|
||||
bool m_stretchable : 1;
|
||||
int m_visualIndex;
|
||||
int m_minItemCount;
|
||||
int m_maxItemCount;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonControlSizeDefinitionPrivate)
|
||||
};
|
||||
|
||||
/* RibbonControlPrivate */
|
||||
class RibbonControlPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonControl)
|
||||
public:
|
||||
explicit RibbonControlPrivate();
|
||||
virtual ~RibbonControlPrivate();
|
||||
void init(RibbonGroup* parentGroup);
|
||||
void changed();
|
||||
|
||||
public:
|
||||
RibbonGroup* m_parentGroup;
|
||||
QList<RibbonControlSizeDefinition*> m_allSizes;
|
||||
RibbonControlSizeDefinition::GroupSize m_size;
|
||||
QAction* m_action;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonControlPrivate)
|
||||
};
|
||||
|
||||
/* RibbonWidgetControlPrivate */
|
||||
class RibbonWidgetControlPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonWidgetControl)
|
||||
public:
|
||||
explicit RibbonWidgetControlPrivate();
|
||||
virtual ~RibbonWidgetControlPrivate();
|
||||
void init(bool ignoreActionSettings);
|
||||
void initStyleOption(QStyleOptionButton* option) const;
|
||||
void clearWidget();
|
||||
|
||||
public:
|
||||
QWidget* m_widget;
|
||||
bool m_visibleText;
|
||||
bool m_ignoreActionSettings;
|
||||
int m_margin;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonWidgetControlPrivate)
|
||||
};
|
||||
|
||||
|
||||
/* RibbonColumnBreakControlPrivate */
|
||||
class RibbonColumnBreakControlPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonColumnBreakControl)
|
||||
public:
|
||||
explicit RibbonColumnBreakControlPrivate();
|
||||
virtual ~RibbonColumnBreakControlPrivate();
|
||||
void init();
|
||||
void initStyleOption(QStyleOptionGroupBox* option) const;
|
||||
|
||||
public:
|
||||
Qt::Alignment m_textAlignment;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonColumnBreakControlPrivate)
|
||||
};
|
||||
|
||||
/* RibbonButtonControlPrivate */
|
||||
class RibbonButtonControlPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonButtonControl)
|
||||
public:
|
||||
explicit RibbonButtonControlPrivate();
|
||||
virtual ~RibbonButtonControlPrivate();
|
||||
void init();
|
||||
|
||||
public:
|
||||
QToolButton* m_toolButton;
|
||||
QPixmap m_largeIcon;
|
||||
QPixmap m_smallIcon;
|
||||
QString m_label;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonButtonControlPrivate)
|
||||
};
|
||||
|
||||
/* RibbonToolBarSeparatorControlPrivate */
|
||||
class RibbonToolBarSeparatorControlPrivate : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonToolBarSeparatorControlPrivate(RibbonToolBarControl* parent);
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonToolBarSeparatorControlPrivate)
|
||||
};
|
||||
|
||||
/* RibbonToolBarControlPrivate */
|
||||
class RibbonToolBarControlPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonToolBarControl)
|
||||
struct RibbonToolBarActionGroupItem
|
||||
{
|
||||
QAction* action;
|
||||
QWidget* widget;
|
||||
RibbonToolBarActionGroupItem(QAction* act, QWidget* w) : action(act), widget(w) {}
|
||||
RibbonToolBarActionGroupItem(const RibbonToolBarActionGroupItem& other) : action(other.action), widget(other.widget) {}
|
||||
bool isEmpty() const { return action == 0 || !action->isVisible(); }
|
||||
};
|
||||
typedef QList<RibbonToolBarActionGroupItem> RibbonToolBarActionGroupItems;
|
||||
|
||||
struct RibbonToolBarActionsGroup
|
||||
{
|
||||
int row;
|
||||
QRect rect;
|
||||
RibbonToolBarActionGroupItems items;
|
||||
RibbonToolBarActionsGroup() : row(0) {}
|
||||
};
|
||||
|
||||
typedef QList<RibbonToolBarActionsGroup> RibbonToolBarActionGroupList;
|
||||
|
||||
public:
|
||||
explicit RibbonToolBarControlPrivate();
|
||||
virtual ~RibbonToolBarControlPrivate();
|
||||
|
||||
public:
|
||||
void recalcWidths(int height);
|
||||
void showDefaultButton();
|
||||
void addActionToGroup(QAction* action, QWidget* widget);
|
||||
void removeActionFromGroup(QAction* action);
|
||||
void updateGroupsGeometry(const QRect& rect);
|
||||
void updateGroupProperties(RibbonToolBarActionGroupItems& group);
|
||||
void updateGeometryWidget();
|
||||
void updateLayoutParent(bool calcLayoutParent = true);
|
||||
QSize calculateSizeHint(const RibbonToolBarActionGroupItems& group) const;
|
||||
bool isMixedWidgets() const;
|
||||
public:
|
||||
RibbonToolBarActionGroupList m_groups;
|
||||
int m_margin;
|
||||
int m_rowsCount;
|
||||
QSize m_sizeHint;
|
||||
|
||||
QVector<int> m_vecWidths;
|
||||
QMap<int, int> m_mapNonOptWidths;
|
||||
bool m_isCalcWidth;
|
||||
bool m_dirty;
|
||||
int m_calcRows;
|
||||
int m_fullWidth;
|
||||
QRect m_rect;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonToolBarControlPrivate)
|
||||
};
|
||||
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
|
||||
#endif // QTN_RIBBONCONTROLSPRIVATE_H
|
||||
|
||||
|
||||
516
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizeDialog.cpp
vendored
Normal file
516
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizeDialog.cpp
vendored
Normal file
@@ -0,0 +1,516 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
#include "QtnRibbonCustomizeDialog.h"
|
||||
#include "QtnRibbonCustomizeDialogPrivate.h"
|
||||
#include "QtnRibbonCustomizeManager.h"
|
||||
#include "QtnRibbonCustomizePage.h"
|
||||
#include "QtnRibbonBarPrivate.h"
|
||||
#include "QtnRibbonDef.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
static QWidget* qtn_WantTheFocus(QWidget* ancestor)
|
||||
{
|
||||
const int MaxIterations = 100;
|
||||
|
||||
QWidget* candidate = ancestor;
|
||||
for (int i = 0; i < MaxIterations; ++i)
|
||||
{
|
||||
candidate = candidate->nextInFocusChain();
|
||||
if (!candidate)
|
||||
break;
|
||||
|
||||
if (candidate->focusPolicy() & Qt::TabFocus)
|
||||
{
|
||||
if (candidate != ancestor && ancestor->isAncestorOf(candidate))
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* RibbonCustomizePageWidget */
|
||||
class RibbonCustomizePageWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
explicit RibbonCustomizePageWidget(QWidget* parent);
|
||||
virtual ~RibbonCustomizePageWidget();
|
||||
|
||||
public:
|
||||
QWidget* content() const;
|
||||
void setContent(QWidget* content);
|
||||
|
||||
protected:
|
||||
QHBoxLayout* m_hBoxLayout;
|
||||
QVBoxLayout* m_vBoxLayout;
|
||||
QLabel m_labelIcon;
|
||||
QLabel m_labelTitle;
|
||||
QWidget* m_content;
|
||||
|
||||
private:
|
||||
friend class RibbonCustomizeDialog;
|
||||
Q_DISABLE_COPY(RibbonCustomizePageWidget)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
|
||||
/* RibbonCustomizePageWidget */
|
||||
RibbonCustomizePageWidget::RibbonCustomizePageWidget(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
m_content = Q_NULL;
|
||||
QFont font = m_labelTitle.font();
|
||||
font.setBold(true);
|
||||
m_labelTitle.setFont(font);
|
||||
m_hBoxLayout = new QHBoxLayout();
|
||||
m_hBoxLayout->addWidget(&m_labelIcon);
|
||||
m_hBoxLayout->addWidget(&m_labelTitle, 1);
|
||||
m_vBoxLayout = new QVBoxLayout(this);
|
||||
m_vBoxLayout->addLayout(m_hBoxLayout);
|
||||
}
|
||||
|
||||
RibbonCustomizePageWidget::~RibbonCustomizePageWidget()
|
||||
{
|
||||
}
|
||||
|
||||
QWidget* RibbonCustomizePageWidget::content() const
|
||||
{
|
||||
return m_content;
|
||||
}
|
||||
|
||||
void RibbonCustomizePageWidget::setContent(QWidget* content)
|
||||
{
|
||||
if (content == Q_NULL)
|
||||
{
|
||||
Q_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
QIcon icon = content->windowIcon();
|
||||
m_labelIcon.setPixmap(icon.isNull() ? QPixmap(":/res/qtitanlogo32x32.png") : icon.pixmap(QSize(32, 32)));
|
||||
m_labelTitle.setText(content->statusTip());
|
||||
m_vBoxLayout->addWidget(content);
|
||||
m_content = content;
|
||||
}
|
||||
|
||||
/* RibbonCustomizeListWidget */
|
||||
RibbonCustomizeListWidget::RibbonCustomizeListWidget(QWidget* parent)
|
||||
: QListWidget(parent)
|
||||
{
|
||||
}
|
||||
|
||||
RibbonCustomizeListWidget::~RibbonCustomizeListWidget()
|
||||
{
|
||||
}
|
||||
|
||||
QSize RibbonCustomizeListWidget::sizeHint() const
|
||||
{
|
||||
QSize sz = QListWidget::sizeHint();
|
||||
QStyleOption opt;
|
||||
opt.initFrom(this);
|
||||
|
||||
int maxWidth = 0;
|
||||
for (int row = 0, countRow = count(); countRow > row; row++)
|
||||
{
|
||||
if (QListWidgetItem* rbItem = item(row))
|
||||
{
|
||||
QString str = rbItem->text() + QString("XX");
|
||||
int width = opt.fontMetrics.boundingRect(str).width();
|
||||
maxWidth = qMax(maxWidth, width);
|
||||
}
|
||||
}
|
||||
return QSize(maxWidth, sz.height());
|
||||
}
|
||||
|
||||
QSize RibbonCustomizeListWidget::minimumSizeHint() const
|
||||
{
|
||||
QSize sz = QListWidget::minimumSizeHint();
|
||||
sz.setWidth( sizeHint().width() );
|
||||
return sz;
|
||||
}
|
||||
|
||||
|
||||
/* RibbonCustomizeDialogPrivate */
|
||||
RibbonCustomizeDialogPrivate::RibbonCustomizeDialogPrivate()
|
||||
{
|
||||
m_currentPage = 0;
|
||||
m_pageVBoxLayout = Q_NULL;
|
||||
}
|
||||
|
||||
RibbonCustomizeDialogPrivate::~RibbonCustomizeDialogPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
void RibbonCustomizeDialogPrivate::init()
|
||||
{
|
||||
QTN_P(RibbonCustomizeDialog);
|
||||
p.setWindowTitle(RibbonBar::tr_compatible(QtnRibbonCustomizeDialogOptionsString));
|
||||
|
||||
p.resize(734, 465);
|
||||
m_verticalLayout = new QVBoxLayout(&p);
|
||||
m_horizontalLayout = new QHBoxLayout();
|
||||
m_horizontalLayout->setSpacing(1);
|
||||
m_listPage = new RibbonCustomizeListWidget(&p);
|
||||
QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
|
||||
sizePolicy.setHorizontalStretch(0);
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(m_listPage->sizePolicy().hasHeightForWidth());
|
||||
m_listPage->setSizePolicy(sizePolicy);
|
||||
m_listPage->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||
|
||||
m_horizontalLayout->addWidget(m_listPage, 0, Qt::AlignLeft);
|
||||
|
||||
m_pageFrame = new QFrame(&p);
|
||||
QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||
sizePolicy1.setHorizontalStretch(0);
|
||||
sizePolicy1.setVerticalStretch(0);
|
||||
sizePolicy1.setHeightForWidth(m_pageFrame->sizePolicy().hasHeightForWidth());
|
||||
m_pageFrame->setSizePolicy(sizePolicy1);
|
||||
m_pageFrame->setAutoFillBackground(false);
|
||||
m_pageFrame->setFrameShape(QFrame::StyledPanel);
|
||||
m_pageFrame->setFrameShadow(QFrame::Sunken);
|
||||
|
||||
m_horizontalLayout->addWidget(m_pageFrame);
|
||||
|
||||
m_horizontalLayout->setStretch(1, 1);
|
||||
|
||||
m_verticalLayout->addLayout(m_horizontalLayout);
|
||||
|
||||
m_buttonBox = new QDialogButtonBox(&p);
|
||||
m_buttonBox->setOrientation(Qt::Horizontal);
|
||||
m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok);
|
||||
|
||||
m_verticalLayout->addWidget(m_buttonBox);
|
||||
|
||||
QObject::connect(m_buttonBox, SIGNAL(accepted()), &p, SLOT(accept()), Qt::DirectConnection);
|
||||
QObject::connect(m_buttonBox, SIGNAL(rejected()), &p, SLOT(reject()), Qt::DirectConnection);
|
||||
|
||||
m_verticalLayout->setContentsMargins(2, 2, 2, 6);
|
||||
|
||||
m_pageVBoxLayout = new QVBoxLayout(m_pageFrame);
|
||||
m_pageVBoxLayout->setSpacing(0);
|
||||
m_pageVBoxLayout->addSpacing(0);
|
||||
QSpacerItem *spacerItem = new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding);
|
||||
m_pageVBoxLayout->addItem(spacerItem);
|
||||
connect(m_listPage, SIGNAL(currentRowChanged(int)), this, SLOT(switchToPage(int)));
|
||||
}
|
||||
|
||||
void RibbonCustomizeDialogPrivate::setCustomizeMode(bool edit)
|
||||
{
|
||||
for (int index = 0, count = m_listWidget.count(); count > index; ++index)
|
||||
{
|
||||
if (RibbonBarCustomizePage* page = qobject_cast<RibbonBarCustomizePage*>(m_listWidget.at(index)))
|
||||
{
|
||||
page->ribbonBar()->customizeManager()->setEditMode(edit);
|
||||
break;
|
||||
}
|
||||
else if (RibbonQuickAccessBarCustomizePage* page = qobject_cast<RibbonQuickAccessBarCustomizePage*>(m_listWidget.at(index)))
|
||||
{
|
||||
page->ribbonBar()->customizeManager()->setEditMode(edit);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonCustomizeDialogPrivate::addPage(RibbonCustomizePageWidget* page)
|
||||
{
|
||||
if (!page)
|
||||
{
|
||||
qWarning("RibbonCustomizeDialogPrivate::addPage: Cannot insert null page");
|
||||
return;
|
||||
}
|
||||
page->setParent(m_pageFrame);
|
||||
|
||||
int n = m_pageVBoxLayout->count();
|
||||
// disable layout to prevent layout updates while adding
|
||||
bool pageVBoxLayoutEnabled = m_pageVBoxLayout->isEnabled();
|
||||
m_pageVBoxLayout->setEnabled(false);
|
||||
|
||||
m_pageVBoxLayout->insertWidget(n - 1, page);
|
||||
|
||||
// hide new page and reset layout to old status
|
||||
page->hide();
|
||||
m_pageVBoxLayout->setEnabled(pageVBoxLayoutEnabled);
|
||||
RibbonCustomizePageItem* item = new RibbonCustomizePageItem(page->windowTitle(), page);
|
||||
m_listPage->addItem(item);
|
||||
}
|
||||
|
||||
void RibbonCustomizeDialogPrivate::insertPage(int index, RibbonCustomizePageWidget* page)
|
||||
{
|
||||
if (!page)
|
||||
{
|
||||
qWarning("RibbonCustomizeDialogPrivate::insertPage: Cannot insert null page");
|
||||
return;
|
||||
}
|
||||
|
||||
RibbonCustomizePageItem* posItem = dynamic_cast<RibbonCustomizePageItem*>(m_listPage->item(index));
|
||||
int indexItem = m_listPage->row(posItem);
|
||||
if (indexItem == -1)
|
||||
return;
|
||||
|
||||
page->setParent(m_pageFrame);
|
||||
|
||||
int n = m_pageVBoxLayout->count();
|
||||
// disable layout to prevent layout updates while adding
|
||||
bool pageVBoxLayoutEnabled = m_pageVBoxLayout->isEnabled();
|
||||
m_pageVBoxLayout->setEnabled(false);
|
||||
|
||||
m_pageVBoxLayout->insertWidget(n - 1, page);
|
||||
|
||||
// hide new page and reset layout to old status
|
||||
page->hide();
|
||||
m_pageVBoxLayout->setEnabled(pageVBoxLayoutEnabled);
|
||||
|
||||
RibbonCustomizePageItem* item = new RibbonCustomizePageItem(page->windowTitle(), page);
|
||||
m_listPage->insertItem(indexItem, item);
|
||||
}
|
||||
|
||||
void RibbonCustomizeDialogPrivate::switchToPage(int currentRow)
|
||||
{
|
||||
if (m_currentPage != currentRow)
|
||||
{
|
||||
if (RibbonCustomizePageItem* item = dynamic_cast<RibbonCustomizePageItem*>(m_listPage->item(m_currentPage)))
|
||||
{
|
||||
RibbonCustomizePageWidget* page = item->m_page;
|
||||
page->setUpdatesEnabled(false);
|
||||
page->hide();
|
||||
page->parentWidget()->repaint();
|
||||
}
|
||||
}
|
||||
|
||||
m_currentPage = currentRow;
|
||||
|
||||
if (RibbonCustomizePageItem* item = dynamic_cast<RibbonCustomizePageItem*>(m_listPage->item(m_currentPage)))
|
||||
{
|
||||
RibbonCustomizePageWidget* page = item->m_page;
|
||||
page->setUpdatesEnabled(true);
|
||||
page->show();
|
||||
|
||||
if (QWidget* candidate = qtn_WantTheFocus(page))
|
||||
candidate->setFocus();
|
||||
|
||||
bool expandPage = !page->layout();
|
||||
if (!expandPage)
|
||||
{
|
||||
const QLayoutItem *pageItem = m_pageVBoxLayout->itemAt(m_pageVBoxLayout->indexOf(page));
|
||||
expandPage = pageItem->expandingDirections() & Qt::Vertical;
|
||||
}
|
||||
QSpacerItem *bottomSpacer = m_pageVBoxLayout->itemAt(m_pageVBoxLayout->count() - 1)->spacerItem();
|
||||
Q_ASSERT(bottomSpacer);
|
||||
bottomSpacer->changeSize(0, 0, QSizePolicy::Ignored, expandPage ? QSizePolicy::Ignored : QSizePolicy::MinimumExpanding);
|
||||
m_pageVBoxLayout->invalidate();
|
||||
page->parentWidget()->repaint();
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\class RibbonCustomizeDialog
|
||||
\inmodule QtitanRibbon
|
||||
RibbonCustomizeDialog it a widget to configure actions on the RibbonBar
|
||||
*/
|
||||
RibbonCustomizeDialog::RibbonCustomizeDialog(QWidget* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
|
||||
QTN_INIT_PRIVATE(RibbonCustomizeDialog);
|
||||
QTN_D(RibbonCustomizeDialog);
|
||||
d.init();
|
||||
}
|
||||
|
||||
RibbonCustomizeDialog::~RibbonCustomizeDialog()
|
||||
{
|
||||
QTN_FINI_PRIVATE();
|
||||
}
|
||||
|
||||
/*!
|
||||
Adds a widget to the dialogue as a setting \a page.
|
||||
*/
|
||||
void RibbonCustomizeDialog::addPage(QWidget* page)
|
||||
{
|
||||
QTN_D(RibbonCustomizeDialog);
|
||||
Q_ASSERT(page != Q_NULL);
|
||||
RibbonCustomizePageWidget* pageWidget = new RibbonCustomizePageWidget(this);
|
||||
pageWidget->setContent(page);
|
||||
pageWidget->setWindowTitle(page->windowTitle());
|
||||
|
||||
if (const QMetaObject* mo = page->metaObject())
|
||||
{
|
||||
if (mo->indexOfSlot("accepted()") != -1)
|
||||
connect(this, SIGNAL(accepted()), page, SLOT(accepted()), Qt::DirectConnection);
|
||||
if (mo->indexOfSlot("rejected()") != -1)
|
||||
connect(this, SIGNAL(rejected()), page, SLOT(rejected()), Qt::DirectConnection);
|
||||
}
|
||||
|
||||
d.m_listWidget.append(page);
|
||||
d.addPage(pageWidget);
|
||||
}
|
||||
|
||||
/*!
|
||||
Inserts a widget to the dialogue in a position \a index as a setting \a page.
|
||||
*/
|
||||
void RibbonCustomizeDialog::insertPage(int index, QWidget* page)
|
||||
{
|
||||
QTN_D(RibbonCustomizeDialog);
|
||||
Q_ASSERT(page != Q_NULL);
|
||||
RibbonCustomizePageWidget* pageWidget = new RibbonCustomizePageWidget(this);
|
||||
pageWidget->setContent(page);
|
||||
pageWidget->setWindowTitle(page->windowTitle());
|
||||
connect(this, SIGNAL(accepted()), page, SLOT(accepted()));
|
||||
|
||||
d.m_listWidget.insert(index, page);
|
||||
d.insertPage(index, pageWidget);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns index of the \a page.
|
||||
*/
|
||||
int RibbonCustomizeDialog::indexOf(QWidget* page) const
|
||||
{
|
||||
QTN_D(const RibbonCustomizeDialog);
|
||||
return d.m_listWidget.indexOf(page);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a \a page that is active at the moment.
|
||||
*/
|
||||
QWidget* RibbonCustomizeDialog::currentPage() const
|
||||
{
|
||||
QTN_D(const RibbonCustomizeDialog);
|
||||
return d.m_listWidget.at(d.m_currentPage);
|
||||
}
|
||||
|
||||
/*!
|
||||
Makes the \a page an active.
|
||||
*/
|
||||
void RibbonCustomizeDialog::setCurrentPage(QWidget* page)
|
||||
{
|
||||
int index = indexOf(page);
|
||||
if (index != -1)
|
||||
setCurrentPageIndex(index);
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns an index of the page that is active at the moment.
|
||||
*/
|
||||
int RibbonCustomizeDialog::currentPageIndex() const
|
||||
{
|
||||
QTN_D(const RibbonCustomizeDialog);
|
||||
return d.m_currentPage;
|
||||
}
|
||||
|
||||
/*!
|
||||
Makes the page with the \a index an active.
|
||||
*/
|
||||
void RibbonCustomizeDialog::setCurrentPageIndex(int index)
|
||||
{
|
||||
QTN_D(RibbonCustomizeDialog);
|
||||
|
||||
if (index == -1)
|
||||
{
|
||||
Q_ASSERT(false);
|
||||
return;
|
||||
}
|
||||
d.m_currentPage = index;
|
||||
d.m_listPage->setCurrentRow(index);
|
||||
|
||||
if (RibbonCustomizePageItem* posItem = dynamic_cast<RibbonCustomizePageItem*>(d.m_listPage->item(index)))
|
||||
{
|
||||
if (posItem->m_page)
|
||||
posItem->m_page->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a count of the pages in the dialogue.
|
||||
*/
|
||||
int RibbonCustomizeDialog::pageCount() const
|
||||
{
|
||||
QTN_D(const RibbonCustomizeDialog);
|
||||
return d.m_listWidget.count();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns a page by its \a index.
|
||||
*/
|
||||
QWidget* RibbonCustomizeDialog::pageByIndex(int index) const
|
||||
{
|
||||
QTN_D(const RibbonCustomizeDialog);
|
||||
return d.m_listWidget[index];
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void RibbonCustomizeDialog::accept()
|
||||
{
|
||||
QTN_D(RibbonCustomizeDialog);
|
||||
QDialog::accept();
|
||||
d.setCustomizeMode(false);
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void RibbonCustomizeDialog::reject()
|
||||
{
|
||||
QTN_D(RibbonCustomizeDialog);
|
||||
QDialog::reject();
|
||||
d.setCustomizeMode(false);
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void RibbonCustomizeDialog::showEvent(QShowEvent* event)
|
||||
{
|
||||
QDialog::showEvent(event);
|
||||
QTN_D(RibbonCustomizeDialog);
|
||||
d.setCustomizeMode(true);
|
||||
if (d.m_currentPage != -1)
|
||||
setCurrentPageIndex(d.m_currentPage);
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void RibbonCustomizeDialog::hideEvent(QHideEvent* event)
|
||||
{
|
||||
QTN_D(RibbonCustomizeDialog);
|
||||
QDialog::hideEvent(event);
|
||||
for (int index = 0, count = d.m_listPage->count(); count > index; ++index)
|
||||
{
|
||||
if (RibbonCustomizePageItem* posItem = dynamic_cast<RibbonCustomizePageItem*>(d.m_listPage->item(index)))
|
||||
{
|
||||
if (posItem->m_page)
|
||||
posItem->m_page->setVisible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
78
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizeDialog.h
vendored
Normal file
78
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizeDialog.h
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_OFFICEOPTIONSDIALOG_H
|
||||
#define QTN_OFFICEOPTIONSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "QtitanDef.h"
|
||||
|
||||
class QAbstractButton;
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonBar;
|
||||
class RibbonCustomizeDialogPrivate;
|
||||
|
||||
/* RibbonCustomizeDialog */
|
||||
class QTITAN_EXPORT RibbonCustomizeDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonCustomizeDialog(QWidget* parent = Q_NULL);
|
||||
virtual ~RibbonCustomizeDialog();
|
||||
|
||||
public:
|
||||
void addPage(QWidget* page);
|
||||
void insertPage(int index, QWidget* page);
|
||||
|
||||
int indexOf(QWidget* page) const;
|
||||
|
||||
QWidget* currentPage() const;
|
||||
void setCurrentPage(QWidget* page);
|
||||
|
||||
int currentPageIndex() const;
|
||||
void setCurrentPageIndex(int index);
|
||||
|
||||
int pageCount() const;
|
||||
QWidget* pageByIndex(int index) const;
|
||||
|
||||
public:
|
||||
virtual void accept();
|
||||
virtual void reject();
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent* event);
|
||||
virtual void hideEvent(QHideEvent* event);
|
||||
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonCustomizeDialog)
|
||||
Q_DISABLE_COPY(RibbonCustomizeDialog)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_OFFICEOPTIONSDIALOG_H
|
||||
276
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizeDialogPrivate.h
vendored
Normal file
276
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizeDialogPrivate.h
vendored
Normal file
@@ -0,0 +1,276 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_OFFICEOPTIONSDIALOGPRIVATE_H
|
||||
#define QTN_OFFICEOPTIONSDIALOGPRIVATE_H
|
||||
|
||||
#include <QListWidget>
|
||||
#include <QLayout>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QStyledItemDelegate>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
#include "QtnRibbonCustomizePage.h"
|
||||
#include "ui_QtnRibbonQuickAccessBarCustomizePage.h"
|
||||
#include "ui_QtnRibbonBarCustomizePage.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonCustomizePageWidget;
|
||||
/* RibbonCustomizePageItem */
|
||||
class RibbonCustomizePageItem : public QListWidgetItem
|
||||
{
|
||||
public:
|
||||
RibbonCustomizePageWidget* m_page;
|
||||
public:
|
||||
explicit RibbonCustomizePageItem(const QString& text, RibbonCustomizePageWidget* page)
|
||||
: QListWidgetItem(text)
|
||||
, m_page(page)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/* RibbonCustomizeListWidget */
|
||||
class RibbonCustomizeListWidget : public QListWidget
|
||||
{
|
||||
public:
|
||||
explicit RibbonCustomizeListWidget(QWidget* parent = Q_NULL);
|
||||
virtual ~RibbonCustomizeListWidget();
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
virtual QSize minimumSizeHint() const;
|
||||
};
|
||||
|
||||
/* RibbonCustomizeDialogPrivate */
|
||||
class RibbonCustomizeDialogPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonCustomizeDialog)
|
||||
|
||||
public:
|
||||
explicit RibbonCustomizeDialogPrivate();
|
||||
virtual ~RibbonCustomizeDialogPrivate();
|
||||
|
||||
public:
|
||||
void init();
|
||||
void setCustomizeMode(bool edit);
|
||||
void addPage(RibbonCustomizePageWidget* page);
|
||||
void insertPage(int index, RibbonCustomizePageWidget* page);
|
||||
|
||||
public Q_SLOTS:
|
||||
void switchToPage(int currentRow);
|
||||
|
||||
public:
|
||||
QList<QWidget*> m_listWidget;
|
||||
QVBoxLayout* m_verticalLayout;
|
||||
QHBoxLayout* m_horizontalLayout;
|
||||
QListWidget* m_listPage;
|
||||
QFrame* m_pageFrame;
|
||||
QDialogButtonBox *m_buttonBox;
|
||||
|
||||
int m_currentPage;
|
||||
QVBoxLayout* m_pageVBoxLayout;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonCustomizeDialogPrivate)
|
||||
};
|
||||
|
||||
/* RibbonCustomizeStyledItemDelegate */
|
||||
class RibbonCustomizeStyledItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
public:
|
||||
explicit RibbonCustomizeStyledItemDelegate(QListWidget* listWidget);
|
||||
virtual ~RibbonCustomizeStyledItemDelegate();
|
||||
|
||||
public:
|
||||
virtual void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
|
||||
|
||||
protected:
|
||||
QListWidget* m_listWidget;
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonCustomizeStyledItemDelegate)
|
||||
};
|
||||
|
||||
|
||||
class RibbonBar;
|
||||
class RibbonPage;
|
||||
/* RibbonQuickAccessBarCustomizePagePrivate */
|
||||
class RibbonQuickAccessBarCustomizePagePrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonQuickAccessBarCustomizePage)
|
||||
enum ColumnCommand
|
||||
{
|
||||
nIconCommand = 0,
|
||||
nNameCommand,
|
||||
nViewCommand
|
||||
};
|
||||
public:
|
||||
explicit RibbonQuickAccessBarCustomizePagePrivate();
|
||||
virtual ~RibbonQuickAccessBarCustomizePagePrivate();
|
||||
|
||||
public:
|
||||
void init();
|
||||
void setupPage();
|
||||
void initListWidgetCommands();
|
||||
QIcon createIconStyleWidget(QWidget* widget);
|
||||
QPixmap createIconExStyleWidget(QWidget* widget, bool& iconView);
|
||||
|
||||
void fillActions();
|
||||
void fillStateCommands();
|
||||
void fillListCategorieCommads(const QList<QAction*>& actions);
|
||||
|
||||
void setButtons();
|
||||
|
||||
void applyClicked();
|
||||
|
||||
public Q_SLOTS:
|
||||
void setCurrentCategoryText(const QString&);
|
||||
void currentCommandChanged(QListWidgetItem* current);
|
||||
void currentQTCommandChanged(QListWidgetItem* current);
|
||||
|
||||
void addClicked();
|
||||
void removeClicked();
|
||||
void resetClicked();
|
||||
void upClicked();
|
||||
void downClicked();
|
||||
|
||||
public:
|
||||
Ui::RibbonQuickAccessBarCustomizePage m_pageUI;
|
||||
RibbonBar* m_ribbonBar;
|
||||
|
||||
QStringList m_sourceCategories;
|
||||
QAction* m_separator;
|
||||
QString m_separatorText;
|
||||
QString m_strSeparator;
|
||||
QString m_currentSourceCategory;
|
||||
|
||||
QListWidgetItem* m_currentAction;
|
||||
QMap<QAction*, QListWidgetItem*> m_actionToItem;
|
||||
QMap<QListWidgetItem*, QAction*> m_itemToAction;
|
||||
|
||||
QMap<QAction*, QListWidgetItem*> m_actionToCurrentItem;
|
||||
QMap<QListWidgetItem*, QAction*> m_currentItemToAction;
|
||||
|
||||
int m_heightRowItem;
|
||||
int m_widthColIconItem;
|
||||
int m_widthColViewItem;
|
||||
bool m_wasDisplayed;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonQuickAccessBarCustomizePagePrivate)
|
||||
};
|
||||
|
||||
class RibbonGroup;
|
||||
/* RibbonBarCustomizePagePrivate */
|
||||
class RibbonBarCustomizePagePrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonBarCustomizePage)
|
||||
public:
|
||||
explicit RibbonBarCustomizePagePrivate();
|
||||
virtual ~RibbonBarCustomizePagePrivate();
|
||||
public:
|
||||
void init();
|
||||
void setupPage();
|
||||
|
||||
void setCategoryCaptionTree(QTreeWidget* tree, const QString& strCategory);
|
||||
void clearCategoryCaptionTree(QTreeWidget* tree);
|
||||
void fillSourceCategories();
|
||||
void fillSourceActions(QList<QAction*>& actions, QTreeWidgetItem* itemParent = Q_NULL);
|
||||
void fillSourcePages(QList<RibbonPage*>& pages, const QString& strCategory);
|
||||
void fillSourceGroups(RibbonPage* page, QTreeWidgetItem* itemParent);
|
||||
void fillSourceGroupActions(RibbonGroup* group, QTreeWidgetItem* itemParent);
|
||||
|
||||
void fillStateCategories();
|
||||
void fillStateRibbon(const QString& strCategory);
|
||||
void fillStateGroups(RibbonPage* page, QTreeWidgetItem* itemParent);
|
||||
void fillStateActions(RibbonGroup* group, QTreeWidgetItem* itemParent, bool newGroup);
|
||||
|
||||
RibbonPage* addPageCustom(RibbonPage* srcPage);
|
||||
void addGroupCopy(RibbonPage* srcPage, RibbonPage* copyPage);
|
||||
void addActionGroupCustom(RibbonGroup* group, QAction* action, int index);
|
||||
void setButtons();
|
||||
|
||||
void applyClicked();
|
||||
void cancelClicked();
|
||||
|
||||
public Q_SLOTS:
|
||||
void addClicked();
|
||||
void newTabClicked();
|
||||
void newGroupClicked();
|
||||
void removeClicked();
|
||||
void resetClicked();
|
||||
void upClicked();
|
||||
void downClicked();
|
||||
void renameClicked();
|
||||
void setCurrentCategoryText(const QString&);
|
||||
void setCurrentTabsText(const QString&);
|
||||
|
||||
void currentSourceChanged(QTreeWidgetItem* itemPage);
|
||||
|
||||
void currentPageChanged(QTreeWidgetItem* itemPage);
|
||||
void itemPageChanged(QTreeWidgetItem* itemPage, int);
|
||||
|
||||
public:
|
||||
RibbonBar* m_ribbonBar;
|
||||
Ui::RibbonBarCustomizePage m_pageUI;
|
||||
|
||||
QString m_strSeparator;
|
||||
QString m_currentSourceCategory;
|
||||
|
||||
QStringList m_sourceCategories;
|
||||
QTreeWidgetItem* m_currentSourceItemPage;
|
||||
QTreeWidgetItem* m_currentSourceItemGroup;
|
||||
QTreeWidgetItem* m_currentSourceAction;
|
||||
QMap< QTreeWidgetItem*, RibbonPage* > m_currentSourceItemToPage;
|
||||
QMap< QTreeWidgetItem*, RibbonGroup* > m_currentSourceItemToGroup;
|
||||
QMap< QTreeWidgetItem*, QAction* > m_currentSourceItemToAction;
|
||||
|
||||
QTreeWidgetItem* m_currentItemPage;
|
||||
QTreeWidgetItem* m_currentItemGroup;
|
||||
QTreeWidgetItem* m_currentItemAction;
|
||||
QMap<RibbonPage*, QTreeWidgetItem*> m_pageToCurrentItem;
|
||||
QMap<QTreeWidgetItem*, RibbonPage*> m_currentItemToPage;
|
||||
|
||||
QMap< QAction*, QTreeWidgetItem* > m_actionToCurrentItem;
|
||||
QMap< QTreeWidgetItem*, QAction* > m_currentItemToAction;
|
||||
QMap< QTreeWidgetItem*, RibbonGroup* > m_currentItemToGroup;
|
||||
|
||||
QString m_sufNameCustom;
|
||||
bool m_wasDisplayed;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonBarCustomizePagePrivate)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
|
||||
#endif // QTN_OFFICEOPTIONSDIALOGPRIVATE_H
|
||||
2115
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizeManager.cpp
vendored
Normal file
2115
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizeManager.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
137
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizeManager.h
vendored
Normal file
137
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizeManager.h
vendored
Normal file
@@ -0,0 +1,137 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONCUSTOMIZEMANAGER_H
|
||||
#define QTN_RIBBONCUSTOMIZEMANAGER_H
|
||||
|
||||
#include <QList>
|
||||
#include <QAction>
|
||||
#include <QString>
|
||||
#include <QToolBar>
|
||||
|
||||
#include "QtnRibbonBar.h"
|
||||
#include "QtnRibbonPage.h"
|
||||
#include "QtnRibbonGroup.h"
|
||||
#include "QtitanDef.h"
|
||||
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonCustomizeManagerPrivate;
|
||||
/* RibbonCustomizeManager */
|
||||
class QTITAN_EXPORT RibbonCustomizeManager : public QObject
|
||||
{
|
||||
public:
|
||||
explicit RibbonCustomizeManager(RibbonBar* ribbonBar);
|
||||
virtual ~RibbonCustomizeManager();
|
||||
|
||||
public:
|
||||
QStringList categories() const;
|
||||
QList<QAction*> actionsAll() const;
|
||||
|
||||
void addToolBar(QToolBar* toolBar);
|
||||
|
||||
void addAllActionsCategory(const QString& category);
|
||||
|
||||
QList<QAction*> actionsByCategory(const QString& category) const;
|
||||
void addToCategory(const QString& category, QAction* act);
|
||||
|
||||
QList<QToolBar *> toolBarsByCategory(const QString& category) const;
|
||||
void addToCategory(const QString& category, QToolBar* toolBar);
|
||||
|
||||
QList< RibbonPage* > pagesByCategory(const QString& category) const;
|
||||
void addToCategory(const QString& category, RibbonPage* page);
|
||||
|
||||
QList< RibbonGroup* > groupsByCategory(const QString& category) const;
|
||||
void addToCategory(const QString& category, RibbonGroup* group);
|
||||
|
||||
QString actionId(QAction* action) const;
|
||||
void setActionId(QAction* action, const QString& id);
|
||||
|
||||
QString pageId(RibbonPage* page) const;
|
||||
void setPageId(RibbonPage* page, const QString& id);
|
||||
|
||||
QString groupId(RibbonGroup* group) const;
|
||||
void setGroupId(RibbonGroup* group, const QString& id);
|
||||
|
||||
void setEditMode(bool set = true);
|
||||
bool isEditMode() const;
|
||||
|
||||
void reset(QToolBar* toolBar = Q_NULL);
|
||||
void commit();
|
||||
void cancel();
|
||||
|
||||
QList< QAction* > actions(QToolBar* toolBar) const;
|
||||
void insertAction(QToolBar* toolBar, QAction* action, int index);
|
||||
void removeActionAt(QToolBar* toolBar, int index);
|
||||
bool containsAction(QToolBar* toolBar, QAction* action) const;
|
||||
|
||||
QList<RibbonPage*> pages() const;
|
||||
RibbonPage* createPage(const QString& pageName, int index = -1);
|
||||
void deletePage(RibbonPage* page);
|
||||
int pageIndex(RibbonPage* page) const;
|
||||
void movePage(int oldIndex, int newIndex);
|
||||
|
||||
QList<RibbonGroup*> pageGroups(RibbonPage* page) const;
|
||||
RibbonGroup* createGroup(RibbonPage* page, const QString& groupName, int index = -1);
|
||||
void deleteGroup(RibbonPage* page, int index);
|
||||
void moveGroup(RibbonPage* page, int oldIndex, int newIndex);
|
||||
|
||||
void insertAction(RibbonGroup* group, QAction* action, int index);
|
||||
void appendActions(RibbonGroup* group, const QList<QAction*>& actions);
|
||||
void clearActions(RibbonGroup* group);
|
||||
void removeActionAt(RibbonGroup* group, int index);
|
||||
bool containsAction(RibbonGroup* group, QAction* action) const;
|
||||
QList<QAction*> actionsGroup(RibbonGroup* group) const;
|
||||
|
||||
bool isPageHidden(RibbonPage* page) const;
|
||||
void setPageHidden(RibbonPage* page, bool hide);
|
||||
|
||||
bool isPageVisible(RibbonPage* page) const;
|
||||
void setPageVisible(RibbonPage* page, bool visible);
|
||||
|
||||
QString pageName(RibbonPage* page) const;
|
||||
void setPageName(RibbonPage* page, const QString& pageName);
|
||||
|
||||
QString groupName(RibbonGroup* group) const;
|
||||
void setGroupName(RibbonGroup* group, const QString& groupName);
|
||||
|
||||
bool saveStateToDevice(QIODevice* device);
|
||||
bool loadStateFromDevice(QIODevice* device);
|
||||
|
||||
public:
|
||||
void addDefaultStateQAccessBar();
|
||||
void addDefaultStateRibbonBar();
|
||||
private:
|
||||
friend class RibbonQuickAccessBar;
|
||||
friend class RibbonBarCustomizePagePrivate;
|
||||
QTN_DECLARE_PRIVATE(RibbonCustomizeManager)
|
||||
Q_DISABLE_COPY(RibbonCustomizeManager)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONCUSTOMIZEMANAGER_H
|
||||
262
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizeManagerPrivate.h
vendored
Normal file
262
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizeManagerPrivate.h
vendored
Normal file
@@ -0,0 +1,262 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONCUSTOMIZEMANAGERPRIVATE_H
|
||||
#define QTN_RIBBONCUSTOMIZEMANAGERPRIVATE_H
|
||||
|
||||
#include <QMap>
|
||||
#include <QSet>
|
||||
#include <QList>
|
||||
#include <QXmlStreamWriter>
|
||||
#include <QAction>
|
||||
#include <QString>
|
||||
#include <QToolBar>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
#define UserNameID 1000 // first user name id
|
||||
#define MaxUserNameID 65535 // last user name id
|
||||
|
||||
#define __qtn_Widget_Custom "WidgetCustom"
|
||||
#define __qtn_Widget_Copy "WidgetCopy"
|
||||
#define __qtn_Action_Invisible "__qtn_Action_Invisible"
|
||||
#define __qtn_Quick_Access_Button "__qtn_Quick_Access_Button"
|
||||
|
||||
/* CustomizeEngineAbstract */
|
||||
class CustomizeEngineAbstract : public QObject
|
||||
{
|
||||
public:
|
||||
explicit CustomizeEngineAbstract(QObject* parent);
|
||||
virtual ~CustomizeEngineAbstract();
|
||||
|
||||
public:
|
||||
QString categoryAllActions() const;
|
||||
QList<QAction*> actionsAll() const;
|
||||
|
||||
QList<QAction*> actionsByCategory(const QString& category) const;
|
||||
QStringList categories() const;
|
||||
|
||||
QString actionId(QAction* action) const;
|
||||
void setActionId(QAction* action, const QString& id = QString());
|
||||
|
||||
void addToCategory(const QString& category, QAction* action);
|
||||
void addAllActionsCategory(const QString& category);
|
||||
|
||||
virtual void saveState(QXmlStreamWriter& stream) const = 0;
|
||||
virtual bool restoreState(QXmlStreamReader&stream) = 0;
|
||||
|
||||
protected:
|
||||
QString generateUniqueNameIdentifier(int hint = -1);
|
||||
QString generateUniqueNameIdentifierGroup(int hint = -1);
|
||||
QString generateUniqueNameIdentifierPage(int hint = -1);
|
||||
|
||||
protected:
|
||||
QSet< int > m_setUniqueIdentifier;
|
||||
QSet< int > m_setUniqueIdentifierGroup;
|
||||
QSet< int > m_setUniqueIdentifierPage;
|
||||
|
||||
QString m_allCategoryName;
|
||||
QList< QString > m_lstCategory;
|
||||
|
||||
QMap< QString, QAction* > m_allNameToActions;
|
||||
QMap< QAction*, QString > m_allActionsToName;
|
||||
|
||||
QMap< QString, QList<QAction*> > m_categoryToActions;
|
||||
QMap< QAction*, QString > m_actionToCategory;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(CustomizeEngineAbstract)
|
||||
};
|
||||
|
||||
/* ToolBarCustomizeEngine */
|
||||
class ToolBarCustomizeEngine : public CustomizeEngineAbstract
|
||||
{
|
||||
public:
|
||||
explicit ToolBarCustomizeEngine(QObject* parent);
|
||||
virtual ~ToolBarCustomizeEngine();
|
||||
|
||||
public:
|
||||
QList<QAction*> actions(QToolBar* toolBar) const;
|
||||
QToolBar* toolBarWidgetAction(QAction* action) const;
|
||||
QToolBar* findDefaultToolBar(const QString& objectName) const;
|
||||
QMap< QToolBar*, QList<QAction*> > defaultToolBars() const;
|
||||
|
||||
void removeWidgetActions(const QMap< QToolBar*, QList<QAction*> >& actions);
|
||||
void addDefaultToolBar(QToolBar* toolBar);
|
||||
|
||||
QList<QToolBar *> toolBarsByCategory(const QString& category) const;
|
||||
void addToCategory(const QString& category, QToolBar* bar);
|
||||
|
||||
void setToolBar(QToolBar* toolBar, const QList<QAction*>& actions);
|
||||
|
||||
void saveStateQuickAccessBar(QXmlStreamWriter& stream) const;
|
||||
bool restoreStateQuickAccessBar(QXmlStreamReader& stream);
|
||||
|
||||
void saveState(QXmlStreamWriter& stream) const;
|
||||
bool restoreState(QXmlStreamReader& stream);
|
||||
|
||||
protected:
|
||||
QMap< QAction*, QToolBar* > m_widgetActions;
|
||||
QMap< QAction*, QList<QToolBar*> > m_actionToToolBars;
|
||||
|
||||
QMap< QString, QList<QToolBar*> > m_categoryToBars;
|
||||
QMap< QToolBar*, QString > m_barToCategory;
|
||||
|
||||
QMap< QToolBar*, QList<QAction*> > m_defaultToolBars;
|
||||
QMap< QToolBar*, QList<QAction*> > m_toolBarsWithSeparators;
|
||||
QMap< QToolBar*, QList<QAction*> > m_toolBars;
|
||||
QMap< QToolBar*, QList<QAction*> > m_regularToolBars;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(ToolBarCustomizeEngine)
|
||||
};
|
||||
|
||||
class RibbonPage;
|
||||
class RibbonGroup;
|
||||
/* RibbonBarCustomizeEngine */
|
||||
class RibbonBarCustomizeEngine : public ToolBarCustomizeEngine
|
||||
{
|
||||
public:
|
||||
explicit RibbonBarCustomizeEngine(QObject* parent, RibbonBar* ribbonBar);
|
||||
virtual ~RibbonBarCustomizeEngine();
|
||||
|
||||
public:
|
||||
QString pageId(RibbonPage* page) const;
|
||||
void setPageId(RibbonPage* page, const QString& id = QString());
|
||||
|
||||
QString groupId(RibbonGroup* group) const;
|
||||
void setGroupId(RibbonGroup* group, const QString& id = QString());
|
||||
|
||||
void addToCategory(const QString& category, QAction* act);
|
||||
|
||||
QList< RibbonPage* > pagesByCategory(const QString& category) const;
|
||||
void addToCategory(const QString& category, RibbonPage* page);
|
||||
|
||||
QList< RibbonGroup* > groupsByCategory(const QString& category) const;
|
||||
void addToCategory(const QString& category, RibbonGroup* group);
|
||||
|
||||
QList<RibbonGroup*> pageDefaultGroups(RibbonPage* page) const;
|
||||
QList< RibbonPage* > defaultHiddenPages() const;
|
||||
QList< RibbonPage* > editHiddenPages() const;
|
||||
|
||||
QMap< RibbonPage*, QString > defaultPagesName() const;
|
||||
QString pageDefaultName(RibbonPage* page) const;
|
||||
|
||||
QList< RibbonGroup* > regularGroups(RibbonPage* page) const;
|
||||
QMap< RibbonPage*, QList<RibbonGroup*> > defaultPageGroups() const;
|
||||
QMap< RibbonPage*, QList<RibbonGroup*> > regularPageGroups() const;
|
||||
QMap< RibbonGroup*, QString > defaultGroupsName() const;
|
||||
QString groupDefaultName(RibbonGroup* group) const;
|
||||
|
||||
QList<RibbonPage*> defaultRibbonBar() const;
|
||||
|
||||
void addDefaultPages(RibbonBar* ribbonBar);
|
||||
void addDefaultGroups(RibbonPage* page);
|
||||
void addNonContextCategories();
|
||||
|
||||
void setQuickAccessBar();
|
||||
void setRibbonBar();
|
||||
void setRibbonGroups();
|
||||
void updateRibbonBar();
|
||||
void deleteFreeGroups();
|
||||
void deleteFreePages();
|
||||
|
||||
void saveStateGroup(QXmlStreamWriter& stream, RibbonPage* page) const;
|
||||
bool restoreStateGroup(QXmlStreamReader& stream, RibbonPage* page);
|
||||
|
||||
void saveStatePage(QXmlStreamWriter& stream) const;
|
||||
bool restoreStatePage(QXmlStreamReader& stream);
|
||||
|
||||
void saveStateRibbonBar(QXmlStreamWriter& stream) const;
|
||||
bool restoreStateRibbonBar(QXmlStreamReader& stream);
|
||||
|
||||
void saveState(QXmlStreamWriter& stream) const;
|
||||
bool restoreState(QXmlStreamReader& stream);
|
||||
|
||||
protected:
|
||||
RibbonBar* m_ribbonBar;
|
||||
|
||||
QMap< QString, QList<RibbonPage*> > m_categoryToPages;
|
||||
QMap< RibbonPage*, QString > m_pageToCategory;
|
||||
|
||||
QMap< QString, QList<RibbonGroup*> > m_categoryToGroups;
|
||||
QMap< RibbonGroup*, QString > m_groupToCategory;
|
||||
|
||||
QList< RibbonPage* > m_defaultPages;
|
||||
QList< RibbonPage* > m_regularPages;
|
||||
QList< RibbonPage* > m_defaultHiddenPages;
|
||||
QList< RibbonPage* > m_regularHiddenPages;
|
||||
|
||||
QMap< RibbonPage*, QString > m_defaultPagesName;
|
||||
QMap< RibbonPage*, QString > m_regularPagesName;
|
||||
|
||||
QMap< QString, RibbonPage* > m_allNameIdToPages;
|
||||
QMap< RibbonPage*, QString > m_allPagesToNameId;
|
||||
|
||||
QMap< QString, RibbonGroup* > m_allNameIdToGroups;
|
||||
QMap< RibbonGroup*, QString > m_allGroupsToNameId;
|
||||
|
||||
QMap< RibbonPage*, QList<RibbonGroup*> > m_defaultPageGroups;
|
||||
QMap< RibbonPage*, QList<RibbonGroup*> > m_regularPageGroups;
|
||||
QMap< RibbonGroup*, QString > m_defaultNameGroups;
|
||||
QMap< RibbonGroup*, QString > m_regularNameGroups;
|
||||
|
||||
QMap< RibbonGroup*, QList<QAction*> > m_regularGroupsActions;
|
||||
|
||||
private:
|
||||
friend class RibbonCustomizeManager;
|
||||
Q_DISABLE_COPY(RibbonBarCustomizeEngine)
|
||||
};
|
||||
|
||||
|
||||
/* RibbonCustomizeManagerPrivate */
|
||||
class RibbonCustomizeManagerPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonCustomizeManager)
|
||||
|
||||
public:
|
||||
explicit RibbonCustomizeManagerPrivate();
|
||||
virtual ~RibbonCustomizeManagerPrivate();
|
||||
|
||||
public:
|
||||
void init(RibbonBar* ribbonBar);
|
||||
|
||||
public:
|
||||
bool m_editMode;
|
||||
RibbonBar* m_ribbonBar;
|
||||
RibbonBarCustomizeEngine* m_ribbonManager;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonCustomizeManagerPrivate)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONCUSTOMIZEMANAGERPRIVATE_H
|
||||
1810
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizePage.cpp
vendored
Normal file
1810
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizePage.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
87
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizePage.h
vendored
Normal file
87
third-party/QtitanRibbon/src/ribbon/QtnRibbonCustomizePage.h
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONCUSTOMIZEPAGE_H
|
||||
#define QTN_RIBBONCUSTOMIZEPAGE_H
|
||||
|
||||
#include "QtnRibbonCustomizeDialog.h"
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class RibbonBar;
|
||||
class RibbonQuickAccessBarCustomizePagePrivate;
|
||||
/* RibbonQuickAccessBarCustomizePage */
|
||||
class QTITAN_EXPORT RibbonQuickAccessBarCustomizePage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonQuickAccessBarCustomizePage(RibbonBar* ribbonBar);
|
||||
virtual ~RibbonQuickAccessBarCustomizePage();
|
||||
public:
|
||||
RibbonBar* ribbonBar() const;
|
||||
void addCustomCategory(const QString& strCategory);
|
||||
void addSeparatorCategory(const QString& strCategory = QString());
|
||||
|
||||
public Q_SLOTS:
|
||||
void accepted();
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent* event);
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonQuickAccessBarCustomizePage)
|
||||
Q_DISABLE_COPY(RibbonQuickAccessBarCustomizePage)
|
||||
};
|
||||
|
||||
class RibbonBarCustomizePagePrivate;
|
||||
/* RibbonBarCustomizePage */
|
||||
class QTITAN_EXPORT RibbonBarCustomizePage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonBarCustomizePage(RibbonBar* ribbonBar);
|
||||
virtual ~RibbonBarCustomizePage();
|
||||
public:
|
||||
RibbonBar* ribbonBar() const;
|
||||
void addCustomCategory(const QString& strCategory);
|
||||
void addSeparatorCategory(const QString& strCategory = QString());
|
||||
|
||||
public Q_SLOTS:
|
||||
void accepted();
|
||||
void rejected();
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent* event);
|
||||
virtual void hideEvent(QHideEvent* event);
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonBarCustomizePage)
|
||||
Q_DISABLE_COPY(RibbonBarCustomizePage)
|
||||
};
|
||||
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONCUSTOMIZEPAGE_H
|
||||
53
third-party/QtitanRibbon/src/ribbon/QtnRibbonDef.cpp
vendored
Normal file
53
third-party/QtitanRibbon/src/ribbon/QtnRibbonDef.cpp
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (DataGrid component for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "QtnRibbonDef.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
|
||||
const char* Qtitan::QtnRibbonCustomizeQuickAccessToolBarDotString = QT_TRANSLATE_NOOP("Qtitan::RibbonBar", "Customize Quick Access Toolbar...");
|
||||
const char* Qtitan::QtnRibbonCustomizeQuickAccessToolBarString = QT_TRANSLATE_NOOP("Qtitan::RibbonBar", "Customize Quick Access Toolbar");
|
||||
|
||||
const char* Qtitan::QtnRibbonShowQuickAccessToolBarBelowString = QT_TRANSLATE_NOOP("Qtitan::RibbonBar", "Show Quick Access Toolbar Below the Ribbon");
|
||||
const char* Qtitan::QtnRibbonShowQuickAccessToolBarAboveString = QT_TRANSLATE_NOOP("Qtitan::RibbonBar", "Show Quick Access Toolbar Above the Ribbon");
|
||||
const char* Qtitan::QtnRibbonCustomizeDialogOptionsString = QT_TRANSLATE_NOOP("Qtitan::RibbonBar", "Options");
|
||||
const char* Qtitan::QtnRibbonCustomizeActionString = QT_TRANSLATE_NOOP("Qtitan::RibbonBar", "Customize the Ribbon...");
|
||||
const char* Qtitan::QtnRibbonMinimizeActionString = QT_TRANSLATE_NOOP("Qtitan::RibbonBar", "Minimize the Ribbon");
|
||||
|
||||
const char* Qtitan::QtnRibbonRecentDocumentsString = QT_TRANSLATE_NOOP("Qtitan::RibbonBar", "Recent Documents");
|
||||
const char* Qtitan::QtnRibbonUntitledString = QT_TRANSLATE_NOOP("Qtitan::RibbonBar", "Untitled");
|
||||
const char* Qtitan::QtnRibbonSeparatorString = QT_TRANSLATE_NOOP("Qtitan::RibbonBar", "<Separator>");
|
||||
const char* Qtitan::QtnRibbonNewPageString = QT_TRANSLATE_NOOP("Qtitan::RibbonBar", "New Page");
|
||||
const char* Qtitan::QtnRibbonNewGroupString = QT_TRANSLATE_NOOP("Qtitan::RibbonBar", "New Group");
|
||||
const char* Qtitan::QtnRibbonAddCommandWarningString = QT_TRANSLATE_NOOP("Qtitan::RibbonBar", "One should add commands to custom groups. To create a group, choose page in list and press button 'Create group'.");
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
53
third-party/QtitanRibbon/src/ribbon/QtnRibbonDef.h
vendored
Normal file
53
third-party/QtitanRibbon/src/ribbon/QtnRibbonDef.h
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (DataGrid component for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBON_DEF_H
|
||||
#define QTN_RIBBON_DEF_H
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
#define QTN_VERSION_RIBBON_STR QTN_QUOTE(QTN_VERSION_RIBBON)
|
||||
|
||||
extern const char* QtnRibbonCustomizeQuickAccessToolBarDotString;
|
||||
extern const char* QtnRibbonCustomizeQuickAccessToolBarString;
|
||||
extern const char* QtnRibbonShowQuickAccessToolBarBelowString;
|
||||
extern const char* QtnRibbonShowQuickAccessToolBarAboveString;
|
||||
extern const char* QtnRibbonCustomizeDialogOptionsString;
|
||||
extern const char* QtnRibbonCustomizeActionString;
|
||||
extern const char* QtnRibbonMinimizeActionString;
|
||||
extern const char* QtnRibbonRecentDocumentsString;
|
||||
extern const char* QtnRibbonUntitledString;
|
||||
extern const char* QtnRibbonSeparatorString;
|
||||
extern const char* QtnRibbonNewPageString;
|
||||
extern const char* QtnRibbonNewGroupString;
|
||||
extern const char* QtnRibbonAddCommandWarningString;
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif //QTN_RIBBON_DEF_H
|
||||
|
||||
1801
third-party/QtitanRibbon/src/ribbon/QtnRibbonGallery.cpp
vendored
Normal file
1801
third-party/QtitanRibbon/src/ribbon/QtnRibbonGallery.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
224
third-party/QtitanRibbon/src/ribbon/QtnRibbonGallery.h
vendored
Normal file
224
third-party/QtitanRibbon/src/ribbon/QtnRibbonGallery.h
vendored
Normal file
@@ -0,0 +1,224 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONGALLERY_H
|
||||
#define QTN_RIBBONGALLERY_H
|
||||
|
||||
#include <QIcon>
|
||||
#include <QWidget>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
class QStyleOptionSlider;
|
||||
class QMenu;
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonGallery;
|
||||
class RibbonGalleryGroup;
|
||||
class RibbonGalleryItemPrivate;
|
||||
|
||||
/* RibbonGalleryItem */
|
||||
class QTITAN_EXPORT RibbonGalleryItem
|
||||
{
|
||||
public:
|
||||
RibbonGalleryItem();
|
||||
virtual ~RibbonGalleryItem();
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
void setSizeHint(const QSize& size);
|
||||
QIcon icon() const;
|
||||
void setIcon(const QIcon& icon);
|
||||
QString caption() const;
|
||||
void setCaption(const QString& caption);
|
||||
QString toolTip() const;
|
||||
void setToolTip(const QString& toolTip);
|
||||
QString statusTip() const;
|
||||
void setStatusTip(const QString& statusTip);
|
||||
int getIndex() const;
|
||||
bool isSeparator() const;
|
||||
void setSeparator(bool b);
|
||||
void setEnabled(bool enabled);
|
||||
bool isEnabled() const;
|
||||
void setVisible(bool visible);
|
||||
bool isVisible() const;
|
||||
virtual QVariant data(int role) const;
|
||||
virtual void setData(int role, const QVariant& value);
|
||||
virtual void draw(QPainter* p, RibbonGallery* gallery, QRect rectItem,
|
||||
bool enabled, bool selected, bool pressed, bool checked);
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonGalleryItem)
|
||||
Q_DISABLE_COPY(RibbonGalleryItem)
|
||||
friend class RibbonGalleryGroup;
|
||||
friend class RibbonGalleryGroupPrivate;
|
||||
};
|
||||
|
||||
class RibbonGalleryGroupPrivate;
|
||||
class OfficePopupMenu;
|
||||
/* RibbonGalleryGroup */
|
||||
class QTITAN_EXPORT RibbonGalleryGroup : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RibbonGalleryGroup(QObject* parent = Q_NULL);
|
||||
virtual ~RibbonGalleryGroup();
|
||||
|
||||
public:
|
||||
static RibbonGalleryGroup* createGalleryGroup();
|
||||
|
||||
public:
|
||||
RibbonGalleryItem* addItem(const QString& caption, const QPixmap& pixmap = QPixmap(), const QColor& transparentColor = QColor());
|
||||
RibbonGalleryItem* addItemFromMap(const QString& caption, int mapIndex, const QPixmap& map, const QSize& mapItemSize, const QColor& transparentColor = QColor());
|
||||
|
||||
void appendItem(RibbonGalleryItem* item);
|
||||
void insertItem(int index, RibbonGalleryItem* item);
|
||||
|
||||
RibbonGalleryItem* addSeparator(const QString& caption);
|
||||
|
||||
void clear();
|
||||
void remove(int index);
|
||||
|
||||
int itemCount() const;
|
||||
RibbonGalleryItem* item(int index) const;
|
||||
RibbonGalleryItem* takeItem(int index);
|
||||
|
||||
QSize size() const;
|
||||
void setSize(const QSize& size);
|
||||
public:
|
||||
void setClipItems(bool clipItems);
|
||||
|
||||
private:
|
||||
friend class RibbonGalleryItem;
|
||||
friend class RibbonGallery;
|
||||
friend class RibbonGalleryPrivate;
|
||||
QTN_DECLARE_PRIVATE(RibbonGalleryGroup)
|
||||
Q_DISABLE_COPY(RibbonGalleryGroup)
|
||||
};
|
||||
|
||||
class RibbonGalleryPrivate;
|
||||
/* RibbonGallery */
|
||||
class QTITAN_EXPORT RibbonGallery : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool isBorderVisible READ isBorderVisible WRITE setBorderVisible)
|
||||
Q_PROPERTY(int minimumColumnCount READ minimumColumnCount WRITE setMinimumColumnCount)
|
||||
Q_PROPERTY(int maximumColumnCount READ maximumColumnCount WRITE setMaximumColumnCount)
|
||||
Q_PROPERTY(Qt::ScrollBarPolicy scrollBarPolicy READ scrollBarPolicy WRITE setScrollBarPolicy)
|
||||
Q_PROPERTY(bool isResizable READ isResizable)
|
||||
Q_PROPERTY(bool autoWidth READ autoWidth WRITE setAutoWidth)
|
||||
|
||||
public:
|
||||
RibbonGallery(QWidget* parent = Q_NULL);
|
||||
virtual ~RibbonGallery();
|
||||
|
||||
public:
|
||||
void setGalleryGroup(RibbonGalleryGroup* items);
|
||||
RibbonGalleryGroup* galleryGroup() const;
|
||||
|
||||
void setBorderVisible(bool isBorderVisible);
|
||||
bool isBorderVisible() const;
|
||||
|
||||
void setLabelsVisible(bool showLabels);
|
||||
bool isLabelsVisible() const;
|
||||
|
||||
void setScrollBarPolicy(Qt::ScrollBarPolicy policy);
|
||||
Qt::ScrollBarPolicy scrollBarPolicy() const;
|
||||
|
||||
void ensureVisible(int index);
|
||||
|
||||
QAction* setPopupMenu(OfficePopupMenu* popupMenu);
|
||||
OfficePopupMenu* popupMenu() const;
|
||||
|
||||
void setMinimumColumnCount(int count);
|
||||
int minimumColumnCount() const;
|
||||
|
||||
void setMaximumColumnCount(int count);
|
||||
int maximumColumnCount() const;
|
||||
|
||||
void setColumnCount(int count);
|
||||
int columnCount() const;
|
||||
|
||||
public:
|
||||
int itemCount() const;
|
||||
|
||||
RibbonGalleryItem* item(int index) const;
|
||||
void setSelectedItem(int selected);
|
||||
int selectedItem() const;
|
||||
|
||||
void setCheckedIndex(int index);
|
||||
int checkedIndex() const;
|
||||
|
||||
void setCheckedItem(const RibbonGalleryItem* item);
|
||||
RibbonGalleryItem* checkedItem() const;
|
||||
|
||||
bool isShowAsButton() const;
|
||||
bool isItemSelected() const;
|
||||
|
||||
public:
|
||||
virtual QRect borders() const;
|
||||
QRect getDrawItemRect(int index);
|
||||
bool isResizable() const;
|
||||
|
||||
bool autoWidth() const;
|
||||
void setAutoWidth(bool width);
|
||||
|
||||
int hitTestItem(QPoint point, QRect* rect = Q_NULL) const;
|
||||
|
||||
QRect getItemsRect() const;
|
||||
void hideSelection();
|
||||
void updatelayout();
|
||||
void bestFit();
|
||||
|
||||
Q_SIGNALS:
|
||||
void itemPressed(RibbonGalleryItem* item);
|
||||
void itemClicked(RibbonGalleryItem* item);
|
||||
void itemClicking(RibbonGalleryItem* item, bool& handled);
|
||||
void currentItemChanged(RibbonGalleryItem* current, RibbonGalleryItem* previous);
|
||||
void itemSelectionChanged();
|
||||
|
||||
public:
|
||||
virtual void selectedItemChanged();
|
||||
virtual QSize sizeHint() const;
|
||||
virtual QSize minimumSizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent*);
|
||||
virtual void mousePressEvent(QMouseEvent*);
|
||||
virtual void mouseReleaseEvent(QMouseEvent*);
|
||||
virtual void mouseMoveEvent(QMouseEvent*);
|
||||
virtual void leaveEvent(QEvent*);
|
||||
virtual void focusOutEvent(QFocusEvent*);
|
||||
virtual void resizeEvent(QResizeEvent*);
|
||||
|
||||
private:
|
||||
friend class RibbonGalleryGroupPrivate;
|
||||
QTN_DECLARE_PRIVATE(RibbonGallery)
|
||||
Q_DISABLE_COPY(RibbonGallery)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONGALLERY_H
|
||||
139
third-party/QtitanRibbon/src/ribbon/QtnRibbonGalleryControls.cpp
vendored
Normal file
139
third-party/QtitanRibbon/src/ribbon/QtnRibbonGalleryControls.cpp
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "QtnRibbonGalleryControls.h"
|
||||
#include "QtnRibbonButtonPrivate.h"
|
||||
#include "QtnRibbonBarPrivate.h"
|
||||
#include "QtnRibbonGroup.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
|
||||
RibbonGalleryControl::RibbonGalleryControl(RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, true/*ignoreActionSettings*/)
|
||||
, m_marginTop(0)
|
||||
, m_marginBottom(0)
|
||||
|
||||
{
|
||||
setContentsMargins(3, 3);
|
||||
// 6 3-5 2 6
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupLarge)->setMinimumItemCount(6);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupLarge)->setMaximumItemCount(6);
|
||||
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupMedium)->setMinimumItemCount(3);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupMedium)->setMaximumItemCount(5);
|
||||
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupSmall)->setMinimumItemCount(2);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupSmall)->setMaximumItemCount(2);
|
||||
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupPopup)->setMinimumItemCount(6);
|
||||
sizeDefinition(RibbonControlSizeDefinition::GroupPopup)->setMaximumItemCount(6);
|
||||
|
||||
RibbonGallery* gallery = new RibbonGallery(this);
|
||||
gallery->setGeometry(0, 0, 0, 0);
|
||||
setContentWidget(gallery);
|
||||
widget()->updatelayout();
|
||||
}
|
||||
|
||||
RibbonGalleryControl::~RibbonGalleryControl()
|
||||
{
|
||||
}
|
||||
|
||||
RibbonGallery* RibbonGalleryControl::widget() const
|
||||
{
|
||||
return qobject_cast<RibbonGallery*>(contentWidget());
|
||||
}
|
||||
|
||||
void RibbonGalleryControl::setContentsMargins(int top, int bottom)
|
||||
{
|
||||
m_marginTop = top;
|
||||
m_marginBottom = bottom;
|
||||
}
|
||||
|
||||
QSize RibbonGalleryControl::sizeHint() const
|
||||
{
|
||||
QSize sz = RibbonWidgetControl::sizeHint();
|
||||
|
||||
if (widget() && parentGroup())
|
||||
{
|
||||
if (RibbonBar* ribbonBar = parentGroup()->ribbonBar())
|
||||
sz.setHeight(ribbonBar->rowItemHeight() * ribbonBar->rowItemCount() - (m_marginTop + m_marginBottom));
|
||||
|
||||
int count = widget()->columnCount();
|
||||
if (count > 0 && widget()->itemCount() > 0)
|
||||
{
|
||||
RibbonGalleryItem* item = widget()->item(0);
|
||||
QSize szItem = item->sizeHint();
|
||||
Q_ASSERT(!szItem.isNull());
|
||||
sz.setWidth(count * szItem.width() + widget()->borders().width() + 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
sz.rwidth() = qMin(maximumWidth(), sz.width());
|
||||
sz.rheight() = qMin(maximumHeight(), sz.height());
|
||||
sz.rwidth() = qMax(minimumWidth(), sz.width());
|
||||
sz.rheight() = qMax(minimumHeight(), sz.height());
|
||||
}
|
||||
}
|
||||
return sz;
|
||||
}
|
||||
|
||||
void RibbonGalleryControl::adjustCurrentSize(bool expand)
|
||||
{
|
||||
int min = sizeDefinition(currentSize())->minimumItemCount();
|
||||
int max = sizeDefinition(currentSize())->maximumItemCount();
|
||||
int current = widget()->columnCount();
|
||||
|
||||
if (expand)
|
||||
current++;
|
||||
else
|
||||
current--;
|
||||
current = qMin(max, current);
|
||||
current = qMax(min, current);
|
||||
widget()->setColumnCount(current);
|
||||
}
|
||||
|
||||
void RibbonGalleryControl::sizeChanged(RibbonControlSizeDefinition::GroupSize size)
|
||||
{
|
||||
int min = sizeDefinition(size)->minimumItemCount();
|
||||
int max = sizeDefinition(size)->maximumItemCount();
|
||||
|
||||
if (size > currentSize())
|
||||
widget()->setColumnCount(max);
|
||||
else
|
||||
widget()->setColumnCount(min);
|
||||
|
||||
RibbonWidgetControl::sizeChanged(size);
|
||||
}
|
||||
|
||||
void RibbonGalleryControl::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
RibbonWidgetControl::resizeEvent(event);
|
||||
widget()->updatelayout();
|
||||
}
|
||||
71
third-party/QtitanRibbon/src/ribbon/QtnRibbonGalleryControls.h
vendored
Normal file
71
third-party/QtitanRibbon/src/ribbon/QtnRibbonGalleryControls.h
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONGALLERYCONTROLS_H
|
||||
#define QTN_RIBBONGALLERYCONTROLS_H
|
||||
|
||||
#include "QtnRibbonGallery.h"
|
||||
#include "QtnRibbonControls.h"
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
/* RibbonGalleryControl */
|
||||
class QTITAN_EXPORT RibbonGalleryControl : public RibbonWidgetControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonGalleryControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonGalleryControl();
|
||||
|
||||
public:
|
||||
RibbonGallery* widget() const;
|
||||
void setContentsMargins(int top, int bottom);
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
virtual void adjustCurrentSize(bool expand);
|
||||
virtual void sizeChanged(RibbonControlSizeDefinition::GroupSize size);
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent*);
|
||||
|
||||
private:
|
||||
int m_marginTop;
|
||||
int m_marginBottom;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonGalleryControl)
|
||||
};
|
||||
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
|
||||
#endif // QTN_RIBBONGALLERYCONTROLS_H
|
||||
|
||||
|
||||
191
third-party/QtitanRibbon/src/ribbon/QtnRibbonGalleryPrivate.h
vendored
Normal file
191
third-party/QtitanRibbon/src/ribbon/QtnRibbonGalleryPrivate.h
vendored
Normal file
@@ -0,0 +1,191 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONGALLERYPRIVATE_H
|
||||
#define QTN_RIBBONGALLERYPRIVATE_H
|
||||
|
||||
#include <QRect>
|
||||
#include <QVector>
|
||||
#include <QVariant>
|
||||
#include <QBasicTimer>
|
||||
#include <QIcon>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
#include "QtnRibbonGallery.h"
|
||||
|
||||
class QPainter;
|
||||
class QScrollBar;
|
||||
class QAction;
|
||||
|
||||
class QMenu;
|
||||
class QToolButton;
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class WidgetItemData
|
||||
{
|
||||
public:
|
||||
inline WidgetItemData() : role(-1) {}
|
||||
inline WidgetItemData(int r, QVariant v) : role(r), value(v) {}
|
||||
int role;
|
||||
QVariant value;
|
||||
inline bool operator==(const WidgetItemData &other) { return role == other.role && value == other.value; }
|
||||
};
|
||||
|
||||
class RibbonGalleryItem;
|
||||
class RibbonGalleryItemPrivate: public QObject
|
||||
{
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonGalleryItem)
|
||||
public:
|
||||
explicit RibbonGalleryItemPrivate();
|
||||
public:
|
||||
void init();
|
||||
public:
|
||||
int m_index;
|
||||
QString m_descriptionText;
|
||||
RibbonGalleryGroup* m_items;
|
||||
bool m_separator : 1;
|
||||
bool m_enabled : 1;
|
||||
bool m_visible : 1;
|
||||
|
||||
QVector<WidgetItemData> m_values;
|
||||
};
|
||||
|
||||
class RibbonGalleryGroup;
|
||||
/* RibbonGalleryGroupPrivate */
|
||||
class RibbonGalleryGroupPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonGalleryGroup)
|
||||
public:
|
||||
explicit RibbonGalleryGroupPrivate();
|
||||
virtual ~RibbonGalleryGroupPrivate();
|
||||
|
||||
public:
|
||||
void init();
|
||||
void updateIndexes(int start /*= 0*/);
|
||||
void itemsChanged();
|
||||
void redrawWidget();
|
||||
|
||||
void clear();
|
||||
|
||||
public:
|
||||
bool m_clipItems;
|
||||
QSize m_sizeItem;
|
||||
QVector<RibbonGalleryItem*> m_arrItems;
|
||||
QList<QWidget*> m_viewWidgets;
|
||||
};
|
||||
|
||||
|
||||
class RibbonGallery;
|
||||
|
||||
struct qtn_galleryitem_rect
|
||||
{
|
||||
RibbonGalleryItem* item;
|
||||
QRect rect;
|
||||
bool beginRow;
|
||||
};
|
||||
|
||||
class OfficePopupMenu;
|
||||
/* RibbonGalleryPrivate */
|
||||
class RibbonGalleryPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
Q_OBJECT
|
||||
QTN_DECLARE_PUBLIC(RibbonGallery)
|
||||
public:
|
||||
explicit RibbonGalleryPrivate();
|
||||
virtual ~RibbonGalleryPrivate();
|
||||
|
||||
public:
|
||||
void init();
|
||||
void layoutItems();
|
||||
void layoutScrollBar();
|
||||
void setScrollBarValue();
|
||||
void setScrollBarPolicy(Qt::ScrollBarPolicy policy);
|
||||
Qt::ScrollBarPolicy scrollBarPolicy() const;
|
||||
QAction* setPopupMenu(OfficePopupMenu* popup);
|
||||
|
||||
void drawItems(QPainter* painter);
|
||||
void repaintItems(QRect* pRect = Q_NULL, bool bAnimate = true);
|
||||
|
||||
bool isItemChecked(RibbonGalleryItem* pItem) const;
|
||||
bool isScrollButtonEnabled(bool buttonUp);
|
||||
|
||||
int scrollWidth() const;
|
||||
|
||||
void startAnimation(int scrollPos);
|
||||
void startAnimate();
|
||||
|
||||
public Q_SLOTS:
|
||||
void setScrollPos(int nScrollPos);
|
||||
void actionTriggered(int action);
|
||||
void pressedScrollUp();
|
||||
void pressedScrollDown();
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual bool eventFilter(QObject* object, QEvent* event);
|
||||
|
||||
public:
|
||||
QScrollBar* m_scrollBar;
|
||||
QToolButton* m_buttonScrollUp;
|
||||
QToolButton* m_buttonScrollDown;
|
||||
QToolButton* m_buttonPopup;
|
||||
OfficePopupMenu* m_menuBar;
|
||||
QVector<qtn_galleryitem_rect> m_arrRects;
|
||||
|
||||
bool m_showBorders : 1;
|
||||
bool m_showLabels : 1;
|
||||
bool m_hideSelection : 1;
|
||||
bool m_keyboardSelected : 1;
|
||||
bool m_preview : 1;
|
||||
bool m_pressed : 1;
|
||||
bool m_animation : 1;
|
||||
bool m_autoWidth : 1;
|
||||
|
||||
int m_totalHeight;
|
||||
int m_scrollPos;
|
||||
int m_scrollPosTarget;
|
||||
double m_animationStep;
|
||||
int m_timerElapse;
|
||||
|
||||
int m_selected;
|
||||
RibbonGalleryItem* m_checkedItem;
|
||||
RibbonGalleryGroup* m_items;
|
||||
|
||||
QPoint m_ptPressed;
|
||||
QBasicTimer m_scrollTimer;
|
||||
|
||||
int m_minimumColumnCount;
|
||||
int m_maximumColumnCount;
|
||||
int m_currentColumnCount;
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONGALLERYPRIVATE_H
|
||||
1581
third-party/QtitanRibbon/src/ribbon/QtnRibbonGroup.cpp
vendored
Normal file
1581
third-party/QtitanRibbon/src/ribbon/QtnRibbonGroup.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
159
third-party/QtitanRibbon/src/ribbon/QtnRibbonGroup.h
vendored
Normal file
159
third-party/QtitanRibbon/src/ribbon/QtnRibbonGroup.h
vendored
Normal file
@@ -0,0 +1,159 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONGROUP_H
|
||||
#define QTN_RIBBONGROUP_H
|
||||
|
||||
#include <QToolButton>
|
||||
#include <QMenu>
|
||||
|
||||
#include "QtnRibbonControls.h"
|
||||
#include "QtnRibbonPage.h"
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonGroupPrivate;
|
||||
class QTITAN_EXPORT RibbonGroup : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool reduced READ isReduced)
|
||||
Q_PROPERTY(const QString& title READ title WRITE setTitle)
|
||||
Q_PROPERTY(const QFont& titleFont READ titleFont WRITE setTitleFont)
|
||||
Q_PROPERTY(const QColor& titleColor READ titleColor WRITE setTitleColor)
|
||||
Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
|
||||
Q_PROPERTY(bool isOptionButtonVisible READ isOptionButtonVisible WRITE setOptionButtonVisible DESIGNABLE false)
|
||||
Q_PROPERTY(Qt::Alignment contentAlignment READ contentAlignment WRITE setContentAlignment)
|
||||
Q_PROPERTY(Qt::TextElideMode titleElideMode READ titleElideMode WRITE setTitleElideMode)
|
||||
public:
|
||||
explicit RibbonGroup(QWidget* parent = Q_NULL);
|
||||
explicit RibbonGroup(RibbonPage* page, const QString& title);
|
||||
virtual ~RibbonGroup();
|
||||
|
||||
public:
|
||||
RibbonBar* ribbonBar() const;
|
||||
|
||||
bool isReduced() const;
|
||||
|
||||
const QString& title() const;
|
||||
void setTitle(const QString& title);
|
||||
|
||||
const QFont& titleFont() const;
|
||||
void setTitleFont(const QFont& font);
|
||||
|
||||
const QColor& titleColor() const;
|
||||
void setTitleColor(const QColor& color);
|
||||
|
||||
const QIcon& icon() const;
|
||||
void setIcon(const QIcon& icon);
|
||||
|
||||
bool isOptionButtonVisible() const;
|
||||
void setOptionButtonVisible(bool visible = true);
|
||||
|
||||
QAction* optionButtonAction() const;
|
||||
void setOptionButtonAction(QAction* action);
|
||||
|
||||
Qt::Alignment contentAlignment() const;
|
||||
void setContentAlignment(Qt::Alignment alignment);
|
||||
|
||||
Qt::Alignment controlsAlignment() const;
|
||||
void setControlsAlignment(Qt::Alignment alignment);
|
||||
|
||||
int controlCount() const;
|
||||
RibbonControl* controlByIndex(int index) const;
|
||||
RibbonControl* controlByAction(QAction* action) const;
|
||||
RibbonWidgetControl* controlByWidget(QWidget* widget) const;
|
||||
RibbonControlSizeDefinition::GroupSize currentSize() const;
|
||||
|
||||
void addControl(RibbonControl* control);
|
||||
void removeControl(RibbonControl* control);
|
||||
|
||||
QAction* addAction(const QIcon& icon, const QString& text, Qt::ToolButtonStyle style,
|
||||
QMenu* menu = Q_NULL, QToolButton::ToolButtonPopupMode mode = QToolButton::MenuButtonPopup);
|
||||
QAction* addAction(QAction* action, Qt::ToolButtonStyle style, QMenu* menu = Q_NULL,
|
||||
QToolButton::ToolButtonPopupMode mode = QToolButton::MenuButtonPopup);
|
||||
QAction* insertAction(QAction* before, QAction* action, Qt::ToolButtonStyle style, QMenu* menu = Q_NULL,
|
||||
QToolButton::ToolButtonPopupMode mode = QToolButton::MenuButtonPopup);
|
||||
|
||||
QAction* addWidget(QWidget* widget);
|
||||
QAction* addWidget(const QIcon& icon, const QString& text, QWidget* widget);
|
||||
QAction* addWidget(const QIcon& icon, const QString& text, bool stretch, QWidget* widget);
|
||||
QMenu* addMenu(const QIcon& icon, const QString& text, Qt::ToolButtonStyle style = Qt::ToolButtonFollowStyle);
|
||||
QAction* addSeparator();
|
||||
|
||||
void remove(QWidget* widget);
|
||||
void clear();
|
||||
|
||||
Qt::TextElideMode titleElideMode() const;
|
||||
void setTitleElideMode(Qt::TextElideMode mode);
|
||||
|
||||
public:
|
||||
void setControlsCentering(bool controlsCentering = true); //Deprecated, user setContentAlignment instead
|
||||
bool isControlsCentering() const; //Deprecated
|
||||
void setControlsGrouping(bool controlsGrouping = true); //Deprecated, user RibbonToolBarControl instead
|
||||
bool isControlsGrouping() const; //Deprecated
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
public:
|
||||
using QWidget::addAction;
|
||||
using QWidget::insertAction;
|
||||
|
||||
Q_SIGNALS:
|
||||
/*! \internal */
|
||||
void released();
|
||||
/*! \internal */
|
||||
void actionTriggered(QAction*);
|
||||
/*! \internal */
|
||||
void hidePopup();
|
||||
|
||||
Q_SIGNALS:
|
||||
void titleChanged(const QString& title);
|
||||
void titleFontChanged(const QFont& font);
|
||||
|
||||
protected Q_SLOTS:
|
||||
/*! \internal */
|
||||
void currentIndexChanged(int index);
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void actionEvent(QActionEvent* event);
|
||||
virtual void enterEvent(QEvent* event);
|
||||
virtual void leaveEvent(QEvent* event);
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
|
||||
private:
|
||||
friend class RibbonPagePrivate;
|
||||
friend class RibbonGroupPopup;
|
||||
friend class RibbonGroupPopupButton;
|
||||
|
||||
QTN_DECLARE_PRIVATE(RibbonGroup)
|
||||
Q_DISABLE_COPY(RibbonGroup)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONGROUP_H
|
||||
115
third-party/QtitanRibbon/src/ribbon/QtnRibbonGroupPrivate.h
vendored
Normal file
115
third-party/QtitanRibbon/src/ribbon/QtnRibbonGroupPrivate.h
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONGROUPPRIVATE_H
|
||||
#define QTN_RIBBONGROUPPRIVATE_H
|
||||
|
||||
#include <QIcon>
|
||||
#include "QtnRibbonGroup.h"
|
||||
#include "QtnRibbonControls.h"
|
||||
#include "QtitanDef.h"
|
||||
|
||||
class QAction;
|
||||
class QToolButton;
|
||||
class QStyleOptionGroupBox;
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonGroupOption;
|
||||
class RibbonGroupScroll;
|
||||
class RibbonControl;
|
||||
class RibbonGroupPopup;
|
||||
|
||||
/* RibbonGroupPrivate */
|
||||
class RibbonGroupPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonGroup)
|
||||
public:
|
||||
explicit RibbonGroupPrivate();
|
||||
virtual ~RibbonGroupPrivate();
|
||||
|
||||
public:
|
||||
void init();
|
||||
void clear(bool deleteControls);
|
||||
void enableGroupScroll(bool scrollLeft, bool scrollRight);
|
||||
void showGroupScroll();
|
||||
|
||||
void initStyleOption(QStyleOptionGroupBox& opt) const;
|
||||
int calcMinimumWidth(RibbonControlSizeDefinition::GroupSize size) const;
|
||||
int arrangeRowContent(QList<RibbonControl *>& row, int leftOffset, int rowItemHeight, int rowItemCount, QWidget* parent) const;
|
||||
void reposition(const QRect& rect);
|
||||
void updateOptionButtonLayout();
|
||||
QSize updateControlsLayout(QWidget* parent, int leftOffset = 0) const;
|
||||
void adjustCurrentSize(bool expand);
|
||||
void updateLayoutParent(bool first);
|
||||
QSize sizeHint() const;
|
||||
|
||||
void setReductionSize(RibbonControlSizeDefinition::GroupSize size);
|
||||
void reduce();
|
||||
void expand();
|
||||
bool canReduce();
|
||||
bool canExpand();
|
||||
|
||||
public Q_SLOTS:
|
||||
void pressLeftScrollButton();
|
||||
void pressRightScrollButton();
|
||||
void hidePopupMode(QAction* action);
|
||||
|
||||
public:
|
||||
static bool visualIndexLessThan(RibbonControl* first, RibbonControl* second);
|
||||
RibbonGroupOption* m_optionButton;
|
||||
RibbonGroupScroll* m_buttonScrollGroupLeft; // Button to draw left scroll
|
||||
RibbonGroupScroll* m_buttonScrollGroupRight; // Button to draw right scroll
|
||||
RibbonGroupPopup* m_groupPopup;
|
||||
RibbonToolBarControl* m_toolBar;
|
||||
|
||||
QList<RibbonControl*> m_controls;
|
||||
RibbonControlSizeDefinition::GroupSize m_currentSize;
|
||||
Qt::Alignment m_contentAlignment;
|
||||
Qt::Alignment m_controlsAlignment;
|
||||
|
||||
bool m_butOptionVisible;
|
||||
bool m_dirty;
|
||||
|
||||
QAction* m_actOption;
|
||||
QString m_title;
|
||||
QIcon m_icon;
|
||||
QFont* m_font;
|
||||
QColor m_color;
|
||||
int m_pageScrollPos;
|
||||
int m_groupScrollPos; // Scroll position
|
||||
Qt::TextElideMode m_titleElideMode;
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonGroupPrivate)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONGROUPPRIVATE_H
|
||||
|
||||
|
||||
226
third-party/QtitanRibbon/src/ribbon/QtnRibbonInputControls.cpp
vendored
Normal file
226
third-party/QtitanRibbon/src/ribbon/QtnRibbonInputControls.cpp
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "QtnRibbonInputControls.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
|
||||
|
||||
/* RibbonFontComboBoxControl */
|
||||
RibbonFontComboBoxControl::RibbonFontComboBoxControl(RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, false/*ignoreActionSettings*/)
|
||||
{
|
||||
setContentWidget(new QFontComboBox(this));
|
||||
}
|
||||
|
||||
RibbonFontComboBoxControl::~RibbonFontComboBoxControl()
|
||||
{
|
||||
}
|
||||
|
||||
QFontComboBox* RibbonFontComboBoxControl::widget() const
|
||||
{
|
||||
return qobject_cast<QFontComboBox*>(contentWidget());
|
||||
}
|
||||
|
||||
|
||||
/* RibbonLineEditControl */
|
||||
RibbonLineEditControl::RibbonLineEditControl(RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, false/*ignoreActionSettings*/)
|
||||
{
|
||||
setContentWidget(new QLineEdit(this));
|
||||
}
|
||||
|
||||
RibbonLineEditControl::~RibbonLineEditControl()
|
||||
{
|
||||
}
|
||||
|
||||
QLineEdit* RibbonLineEditControl::widget() const
|
||||
{
|
||||
return qobject_cast<QLineEdit*>(contentWidget());
|
||||
}
|
||||
|
||||
/* RibbonComboBoxControl */
|
||||
RibbonComboBoxControl::RibbonComboBoxControl(RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, false/*ignoreActionSettings*/)
|
||||
{
|
||||
setContentWidget(new QComboBox(this));
|
||||
}
|
||||
|
||||
RibbonComboBoxControl::~RibbonComboBoxControl()
|
||||
{
|
||||
}
|
||||
|
||||
QComboBox* RibbonComboBoxControl::widget() const
|
||||
{
|
||||
return qobject_cast<QComboBox*>(contentWidget());
|
||||
}
|
||||
|
||||
/* RibbonSpinBoxControl */
|
||||
RibbonSpinBoxControl::RibbonSpinBoxControl(RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, false/*ignoreActionSettings*/)
|
||||
{
|
||||
setContentWidget(new QSpinBox(this));
|
||||
}
|
||||
|
||||
RibbonSpinBoxControl::~RibbonSpinBoxControl()
|
||||
{
|
||||
}
|
||||
|
||||
QSpinBox* RibbonSpinBoxControl::widget() const
|
||||
{
|
||||
return qobject_cast<QSpinBox*>(contentWidget());
|
||||
}
|
||||
|
||||
/* RibbonDoubleSpinBoxControl */
|
||||
RibbonDoubleSpinBoxControl::RibbonDoubleSpinBoxControl(RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, false/*ignoreActionSettings*/)
|
||||
{
|
||||
setContentWidget(new QDoubleSpinBox(this));
|
||||
}
|
||||
|
||||
RibbonDoubleSpinBoxControl::~RibbonDoubleSpinBoxControl()
|
||||
{
|
||||
}
|
||||
|
||||
QDoubleSpinBox* RibbonDoubleSpinBoxControl::widget() const
|
||||
{
|
||||
return qobject_cast<QDoubleSpinBox*>(contentWidget());
|
||||
}
|
||||
|
||||
|
||||
/* RibbonSliderControl */
|
||||
RibbonSliderControl::RibbonSliderControl(Qt::Orientation orientation, RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, true/*ignoreActionSettings*/)
|
||||
{
|
||||
setContentWidget(new QSlider(orientation, this));
|
||||
}
|
||||
|
||||
RibbonSliderControl::~RibbonSliderControl()
|
||||
{
|
||||
}
|
||||
|
||||
QSlider* RibbonSliderControl::widget() const
|
||||
{
|
||||
return qobject_cast<QSlider*>(contentWidget());
|
||||
}
|
||||
|
||||
/* RibbonSliderPaneControl */
|
||||
RibbonSliderPaneControl::RibbonSliderPaneControl(RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, true/*ignoreActionSettings*/)
|
||||
{
|
||||
setContentWidget(new RibbonSliderPane(this));
|
||||
}
|
||||
|
||||
RibbonSliderPaneControl::~RibbonSliderPaneControl()
|
||||
{
|
||||
}
|
||||
|
||||
RibbonSliderPane* RibbonSliderPaneControl::widget() const
|
||||
{
|
||||
return qobject_cast<RibbonSliderPane*>(contentWidget());
|
||||
}
|
||||
|
||||
|
||||
/* RibbonDateTimeEditControl */
|
||||
RibbonDateTimeEditControl::RibbonDateTimeEditControl(RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, false/*ignoreActionSettings*/)
|
||||
{
|
||||
setContentWidget(new QDateTimeEdit(this));
|
||||
}
|
||||
|
||||
RibbonDateTimeEditControl::~RibbonDateTimeEditControl()
|
||||
{
|
||||
}
|
||||
|
||||
QDateTimeEdit* RibbonDateTimeEditControl::widget() const
|
||||
{
|
||||
return qobject_cast<QDateTimeEdit*>(contentWidget());
|
||||
}
|
||||
|
||||
bool RibbonDateTimeEditControl::calendarPopup() const
|
||||
{
|
||||
QDateTimeEdit* dateTimeEdit = widget();
|
||||
Q_ASSERT(dateTimeEdit != Q_NULL);
|
||||
return dateTimeEdit->calendarPopup();
|
||||
}
|
||||
|
||||
void RibbonDateTimeEditControl::setCalendarPopup(bool enable)
|
||||
{
|
||||
QDateTimeEdit* dateTimeEdit = widget();
|
||||
Q_ASSERT(dateTimeEdit != Q_NULL);
|
||||
dateTimeEdit->setCalendarPopup(enable);
|
||||
}
|
||||
|
||||
|
||||
/* RibbonTimeEditControl */
|
||||
RibbonTimeEditControl::RibbonTimeEditControl(RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, false/*ignoreActionSettings*/)
|
||||
{
|
||||
setContentWidget(new QTimeEdit(this));
|
||||
}
|
||||
|
||||
RibbonTimeEditControl::~RibbonTimeEditControl()
|
||||
{
|
||||
}
|
||||
|
||||
QTimeEdit* RibbonTimeEditControl::widget() const
|
||||
{
|
||||
return qobject_cast<QTimeEdit*>(contentWidget());
|
||||
}
|
||||
|
||||
/* RibbonDateEditControl */
|
||||
RibbonDateEditControl::RibbonDateEditControl(RibbonGroup* parentGroup)
|
||||
: RibbonWidgetControl(parentGroup, false/*ignoreActionSettings*/)
|
||||
{
|
||||
setContentWidget(new QDateEdit(this));
|
||||
}
|
||||
|
||||
RibbonDateEditControl::~RibbonDateEditControl()
|
||||
{
|
||||
}
|
||||
|
||||
QDateEdit* RibbonDateEditControl::widget() const
|
||||
{
|
||||
return qobject_cast<QDateEdit*>(contentWidget());
|
||||
}
|
||||
|
||||
bool RibbonDateEditControl::calendarPopup() const
|
||||
{
|
||||
QDateEdit* dateEdit = widget();
|
||||
Q_ASSERT(dateEdit != Q_NULL);
|
||||
return dateEdit->calendarPopup();
|
||||
}
|
||||
|
||||
void RibbonDateEditControl::setCalendarPopup(bool enable)
|
||||
{
|
||||
QDateEdit* dateEdit = widget();
|
||||
Q_ASSERT(dateEdit != Q_NULL);
|
||||
dateEdit->setCalendarPopup(enable);
|
||||
}
|
||||
197
third-party/QtitanRibbon/src/ribbon/QtnRibbonInputControls.h
vendored
Normal file
197
third-party/QtitanRibbon/src/ribbon/QtnRibbonInputControls.h
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONINPUTCONTROLS_H
|
||||
#define QTN_RIBBONINPUTCONTROLS_H
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QFontComboBox>
|
||||
#include <QLineEdit>
|
||||
#include <QSpinBox>
|
||||
#include <QSlider>
|
||||
#include <QDateTimeEdit>
|
||||
#include <QTimeEdit>
|
||||
#include <QDateEdit>
|
||||
|
||||
#include "QtnRibbonControls.h"
|
||||
#include "QtnRibbonSliderPane.h"
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
/* RibbonFontComboBoxControl */
|
||||
class QTITAN_EXPORT RibbonFontComboBoxControl : public RibbonWidgetControl
|
||||
{
|
||||
public:
|
||||
explicit RibbonFontComboBoxControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonFontComboBoxControl();
|
||||
|
||||
public:
|
||||
QFontComboBox* widget() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonFontComboBoxControl)
|
||||
};
|
||||
|
||||
|
||||
/* RibbonLineEditControl */
|
||||
class QTITAN_EXPORT RibbonLineEditControl : public RibbonWidgetControl
|
||||
{
|
||||
public:
|
||||
explicit RibbonLineEditControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonLineEditControl();
|
||||
|
||||
public:
|
||||
QLineEdit* widget() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonLineEditControl)
|
||||
};
|
||||
|
||||
/* RibbonComboBoxControl */
|
||||
class QTITAN_EXPORT RibbonComboBoxControl : public RibbonWidgetControl
|
||||
{
|
||||
public:
|
||||
explicit RibbonComboBoxControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonComboBoxControl();
|
||||
|
||||
public:
|
||||
QComboBox* widget() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonComboBoxControl)
|
||||
};
|
||||
|
||||
/* RibbonSpinBoxControl */
|
||||
class QTITAN_EXPORT RibbonSpinBoxControl : public RibbonWidgetControl
|
||||
{
|
||||
public:
|
||||
explicit RibbonSpinBoxControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonSpinBoxControl();
|
||||
|
||||
public:
|
||||
QSpinBox* widget() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonSpinBoxControl)
|
||||
};
|
||||
|
||||
/* RibbonDoubleSpinBoxControl */
|
||||
class QTITAN_EXPORT RibbonDoubleSpinBoxControl : public RibbonWidgetControl
|
||||
{
|
||||
public:
|
||||
explicit RibbonDoubleSpinBoxControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonDoubleSpinBoxControl();
|
||||
|
||||
public:
|
||||
QDoubleSpinBox* widget() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonDoubleSpinBoxControl)
|
||||
};
|
||||
|
||||
/* RibbonSliderControl */
|
||||
class QTITAN_EXPORT RibbonSliderControl : public RibbonWidgetControl
|
||||
{
|
||||
public:
|
||||
explicit RibbonSliderControl(Qt::Orientation, RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonSliderControl();
|
||||
|
||||
public:
|
||||
QSlider* widget() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonSliderControl)
|
||||
};
|
||||
|
||||
/* RibbonSliderPaneControl */
|
||||
class QTITAN_EXPORT RibbonSliderPaneControl : public RibbonWidgetControl
|
||||
{
|
||||
public:
|
||||
explicit RibbonSliderPaneControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonSliderPaneControl();
|
||||
|
||||
public:
|
||||
RibbonSliderPane* widget() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonSliderPaneControl)
|
||||
};
|
||||
|
||||
/* RibbonDateTimeEditControl */
|
||||
class QTITAN_EXPORT RibbonDateTimeEditControl : public RibbonWidgetControl
|
||||
{
|
||||
public:
|
||||
explicit RibbonDateTimeEditControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonDateTimeEditControl();
|
||||
|
||||
public:
|
||||
QDateTimeEdit* widget() const;
|
||||
bool calendarPopup() const;
|
||||
void setCalendarPopup(bool enable);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonDateTimeEditControl)
|
||||
};
|
||||
|
||||
/* RibbonTimeEditControl */
|
||||
class QTITAN_EXPORT RibbonTimeEditControl : public RibbonWidgetControl
|
||||
{
|
||||
public:
|
||||
explicit RibbonTimeEditControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonTimeEditControl();
|
||||
|
||||
public:
|
||||
QTimeEdit* widget() const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonTimeEditControl)
|
||||
};
|
||||
|
||||
/* RibbonDateEditControl */
|
||||
class QTITAN_EXPORT RibbonDateEditControl : public RibbonWidgetControl
|
||||
{
|
||||
public:
|
||||
explicit RibbonDateEditControl(RibbonGroup* parentGroup = Q_NULL);
|
||||
virtual ~RibbonDateEditControl();
|
||||
|
||||
public:
|
||||
QDateEdit* widget() const;
|
||||
bool calendarPopup() const;
|
||||
void setCalendarPopup(bool enable);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonDateEditControl)
|
||||
};
|
||||
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
|
||||
#endif // QTN_RIBBONINPUTCONTROLS_H
|
||||
|
||||
|
||||
170
third-party/QtitanRibbon/src/ribbon/QtnRibbonMainWindow.cpp
vendored
Normal file
170
third-party/QtitanRibbon/src/ribbon/QtnRibbonMainWindow.cpp
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QPainter>
|
||||
#include <QLayout>
|
||||
|
||||
#include "QtnRibbonBar.h"
|
||||
#include "QtnRibbonStyle.h"
|
||||
#include "QtnRibbonMainWindow.h"
|
||||
#include "QtnOfficeFrameHelper.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonMainWindowPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonMainWindow)
|
||||
public:
|
||||
explicit RibbonMainWindowPrivate();
|
||||
public:
|
||||
OfficeFrameHelper* m_frameHelper;
|
||||
bool m_attrOpaquePaintEvent;
|
||||
bool m_attrNoSystemBackground;
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
RibbonMainWindowPrivate::RibbonMainWindowPrivate()
|
||||
{
|
||||
m_frameHelper = Q_NULL;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\class RibbonMainWindow
|
||||
\inmodule QtitanRibbon
|
||||
\brief RibbonMainWindow class represents the main window of the application used to create the Ribbon UI.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\brief Constructs RibbonMainWindow object with the given \a parent and \a flags.
|
||||
*/
|
||||
RibbonMainWindow::RibbonMainWindow(QWidget* parent, Qt::WindowFlags flags)
|
||||
: QMainWindow(parent, flags)
|
||||
{
|
||||
RibbonBar::loadTranslation();
|
||||
QTN_INIT_PRIVATE(RibbonMainWindow);
|
||||
setObjectName("RibbonMainWindow");
|
||||
QTN_D(RibbonMainWindow);
|
||||
d.m_attrOpaquePaintEvent = testAttribute(Qt::WA_OpaquePaintEvent);
|
||||
d.m_attrNoSystemBackground = testAttribute(Qt::WA_NoSystemBackground);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Destructor of the RibbonMainWindow object.
|
||||
*/
|
||||
RibbonMainWindow::~RibbonMainWindow()
|
||||
{
|
||||
QTN_FINI_PRIVATE();
|
||||
}
|
||||
|
||||
/*
|
||||
\brief Returns a pointer to RibbonBar object. If RibbonBar does not exist, then the function will create an empty Ribbon UI panel.
|
||||
*/
|
||||
RibbonBar* RibbonMainWindow::ribbonBar() const
|
||||
{
|
||||
RibbonBar* ribbonBar = Q_NULL;
|
||||
|
||||
QWidget* menu = menuWidget();
|
||||
if (menu)
|
||||
ribbonBar = qobject_cast<RibbonBar*>(menu);
|
||||
|
||||
if (!menu && !ribbonBar)
|
||||
{
|
||||
RibbonMainWindow* self = const_cast<RibbonMainWindow*>(this);
|
||||
ribbonBar = new RibbonBar(self);
|
||||
self->setMenuWidget(ribbonBar);
|
||||
}
|
||||
return ribbonBar;
|
||||
}
|
||||
|
||||
/*
|
||||
\brief Sets the RibbonBar to the main window. Object RibbonMainWindow takes ownership of the \a ribbonBar. The method is used when needed to set the custom Ribbon Bar object, whose class, inherited from RibbonBar.
|
||||
*/
|
||||
void RibbonMainWindow::setRibbonBar(RibbonBar* ribbonBar)
|
||||
{
|
||||
setMenuWidget(ribbonBar);
|
||||
}
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
/*! \internal */
|
||||
void RibbonMainWindow::setCentralWidget(QStyle* style)
|
||||
{
|
||||
Q_UNUSED(style);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*! \internal */
|
||||
void RibbonMainWindow::setFrameHelper(OfficeFrameHelper* helper)
|
||||
{
|
||||
QTN_D(RibbonMainWindow);
|
||||
d.m_frameHelper = helper;
|
||||
|
||||
if (helper)
|
||||
{
|
||||
d.m_attrOpaquePaintEvent = testAttribute(Qt::WA_OpaquePaintEvent);
|
||||
d.m_attrNoSystemBackground = testAttribute(Qt::WA_NoSystemBackground);
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, true);
|
||||
setAttribute(Qt::WA_NoSystemBackground, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
setAttribute(Qt::WA_OpaquePaintEvent, d.m_attrOpaquePaintEvent);
|
||||
setAttribute(Qt::WA_NoSystemBackground, d.m_attrNoSystemBackground);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
bool RibbonMainWindow::nativeEvent(const QByteArray& eventType, void* message, qintptr* result)
|
||||
#else
|
||||
bool RibbonMainWindow::winEvent(MSG* message, long* result)
|
||||
#endif
|
||||
{
|
||||
QTN_D(RibbonMainWindow);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
if (d.m_frameHelper)
|
||||
{
|
||||
MSG* msg = static_cast<MSG *>(message);
|
||||
if (d.m_frameHelper->winEvent(msg, reinterpret_cast<long*>(result)))
|
||||
return true;
|
||||
}
|
||||
|
||||
return QMainWindow::nativeEvent(eventType, message, result);
|
||||
#else
|
||||
if (d.m_frameHelper)
|
||||
return d.m_frameHelper->winEvent(message, result);
|
||||
|
||||
return QMainWindow::winEvent(message, result);
|
||||
#endif
|
||||
}
|
||||
#endif // Q_OS_WIN
|
||||
77
third-party/QtitanRibbon/src/ribbon/QtnRibbonMainWindow.h
vendored
Normal file
77
third-party/QtitanRibbon/src/ribbon/QtnRibbonMainWindow.h
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONMAINWINDOW_H
|
||||
#define QTN_RIBBONMAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <qnamespace.h>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class StatusBar;
|
||||
class RibbonBar;
|
||||
class OfficeFrameHelper;
|
||||
class RibbonMainWindowPrivate;
|
||||
|
||||
class QTITAN_EXPORT RibbonMainWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonMainWindow(QWidget* parent = Q_NULL, Qt::WindowFlags flags = Qt::WindowFlags(Qt::WindowNoState));
|
||||
~RibbonMainWindow();
|
||||
|
||||
public:
|
||||
RibbonBar* ribbonBar() const;
|
||||
void setRibbonBar(RibbonBar* ribbonBar);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
using QMainWindow::setCentralWidget;
|
||||
void setCentralWidget(QStyle* style);
|
||||
#endif
|
||||
|
||||
protected:
|
||||
void setFrameHelper(OfficeFrameHelper* helper);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
virtual bool nativeEvent(const QByteArray& eventType, void *message, qintptr *result);
|
||||
#else
|
||||
virtual bool winEvent(MSG* message, long* result);
|
||||
#endif
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
private:
|
||||
friend class OfficeFrameHelperWin;
|
||||
QTN_DECLARE_PRIVATE(RibbonMainWindow)
|
||||
Q_DISABLE_COPY(RibbonMainWindow)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONMAINWINDOW_H
|
||||
1356
third-party/QtitanRibbon/src/ribbon/QtnRibbonPage.cpp
vendored
Normal file
1356
third-party/QtitanRibbon/src/ribbon/QtnRibbonPage.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
161
third-party/QtitanRibbon/src/ribbon/QtnRibbonPage.h
vendored
Normal file
161
third-party/QtitanRibbon/src/ribbon/QtnRibbonPage.h
vendored
Normal file
@@ -0,0 +1,161 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONPAGE_H
|
||||
#define QTN_RIBBONPAGE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "QtnRibbonBar.h"
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonGroup;
|
||||
class RibbonPagePrivate;
|
||||
|
||||
class QTITAN_EXPORT RibbonPage : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_ENUMS(ContextColor)
|
||||
Q_PROPERTY(const QString& title READ title WRITE setTitle)
|
||||
Q_PROPERTY(const QString& contextTitle READ contextTitle WRITE setContextTitle)
|
||||
Q_PROPERTY(int groupCount READ groupCount)
|
||||
Q_PROPERTY(ContextColor contextColor READ contextColor WRITE setContextColor)
|
||||
Q_PROPERTY(int tabWidth READ tabWidth WRITE setTabWidth)
|
||||
public:
|
||||
enum ContextColor
|
||||
{
|
||||
ContextColorNone,
|
||||
ContextColorGreen,
|
||||
ContextColorBlue,
|
||||
ContextColorRed,
|
||||
ContextColorYellow,
|
||||
ContextColorCyan,
|
||||
ContextColorPurple,
|
||||
ContextColorOrange
|
||||
};
|
||||
public:
|
||||
RibbonPage(QWidget* parent = Q_NULL);
|
||||
RibbonPage(RibbonBar* ribbonBar, const QString& title);
|
||||
virtual ~RibbonPage();
|
||||
|
||||
public:
|
||||
bool isVisible() const;
|
||||
|
||||
public:
|
||||
void addGroup(RibbonGroup* group);
|
||||
RibbonGroup* addGroup(const QString& title);
|
||||
RibbonGroup* addGroup(const QIcon& icon, const QString& title);
|
||||
|
||||
void insertGroup(int index, RibbonGroup* group);
|
||||
RibbonGroup* insertGroup(int index, const QString& title);
|
||||
RibbonGroup* insertGroup(int index, const QIcon& icon, const QString& title);
|
||||
|
||||
void removeGroup(RibbonGroup* group);
|
||||
void removeGroup(int index);
|
||||
|
||||
void detachGroup(RibbonGroup* group);
|
||||
void detachGroup(int index);
|
||||
|
||||
void clearGroups();
|
||||
|
||||
QAction* defaultAction() const;
|
||||
|
||||
int groupCount() const;
|
||||
RibbonGroup* getGroup(int index) const;
|
||||
int groupIndex(RibbonGroup* group) const;
|
||||
QList<RibbonGroup*> groups() const;
|
||||
|
||||
void setContextColor(ContextColor color);
|
||||
ContextColor contextColor() const;
|
||||
|
||||
const QString& title() const;
|
||||
const QString& contextTitle() const;
|
||||
void setContextGroupName(const QString& groupName);
|
||||
|
||||
void setTabWidth(int width);
|
||||
int tabWidth() const;
|
||||
|
||||
void updateLayout();
|
||||
|
||||
public Q_SLOTS:
|
||||
virtual void setVisible(bool visible);
|
||||
void setTitle(const QString& title);
|
||||
void setContextTitle(const QString& title);
|
||||
|
||||
Q_SIGNALS:
|
||||
void titleChanged(const QString& title);
|
||||
void activated();
|
||||
void activating(bool& allow);
|
||||
|
||||
protected Q_SLOTS:
|
||||
void released();
|
||||
void actionTriggered(QAction* action);
|
||||
|
||||
private:
|
||||
void setAssociativeTab(QWidget* widget);
|
||||
QWidget* associativeTab() const;
|
||||
void setPageVisible(bool visible);
|
||||
void popup();
|
||||
void setRibbonMinimized(bool minimized);
|
||||
|
||||
protected:
|
||||
void activatingPage(bool& allow);
|
||||
void setGroupsHeight(int height);
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void changeEvent(QEvent* event);
|
||||
virtual void resizeEvent(QResizeEvent* event);
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
virtual bool nativeEvent(const QByteArray& eventType, void* message, qintptr* result);
|
||||
#else
|
||||
virtual bool winEvent(MSG* message, long* result);
|
||||
#endif
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
private:
|
||||
friend class RibbonBar;
|
||||
friend class RibbonBarPrivate;
|
||||
friend class RibbonTabBar;
|
||||
friend class RibbonGroup;
|
||||
friend class RibbonGroupPrivate;
|
||||
friend class RibbonTab;
|
||||
friend class RibbonBarCustomizeEngine;
|
||||
|
||||
QTN_DECLARE_PRIVATE(RibbonPage)
|
||||
Q_DISABLE_COPY(RibbonPage)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONPAGE_H
|
||||
116
third-party/QtitanRibbon/src/ribbon/QtnRibbonPagePrivate.h
vendored
Normal file
116
third-party/QtitanRibbon/src/ribbon/QtnRibbonPagePrivate.h
vendored
Normal file
@@ -0,0 +1,116 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONPAGEPRIVATE_H
|
||||
#define QTN_RIBBONPAGEPRIVATE_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QBasicTimer>
|
||||
|
||||
#include "QtnRibbonPrivate.h"
|
||||
#include "QtnRibbonTabBar.h"
|
||||
#include "QtnRibbonControls.h"
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
/* RibbonPagePrivate */
|
||||
class RibbonPagePrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonPage)
|
||||
public:
|
||||
explicit RibbonPagePrivate();
|
||||
virtual ~RibbonPagePrivate();
|
||||
public:
|
||||
void init();
|
||||
bool validateGroupIndex(int index) const { return index >= 0 && index < m_listGroups.count(); }
|
||||
void removeGroup(int index, bool deleteGroup);
|
||||
int groupIndex(RibbonGroup* page) const;
|
||||
|
||||
int calcReducedGroupsWidth() const;
|
||||
void enableGroupScroll(bool scrollLeft, bool scrollRight);
|
||||
void showGroupScroll(bool onlyCalc);
|
||||
void scrollGroupAnimate();
|
||||
void startScrollGropsAnimate(int groupScrollPos, int scrollPosTarget);
|
||||
|
||||
bool calcMinimumWidth(RibbonControlSizeDefinition::GroupSize size) const;
|
||||
|
||||
virtual bool eventFilter(QObject*, QEvent* event);
|
||||
|
||||
public Q_SLOTS:
|
||||
void pressLeftScrollButton();
|
||||
void pressRightScrollButton();
|
||||
void forcedStopScrollTimer();
|
||||
|
||||
public:
|
||||
void updateLayout(bool updateScroll = true);
|
||||
int calculateGroupsWidth();
|
||||
int adjustGroups(int leftOffset, int actualWidth);
|
||||
bool isCollapseOrder();
|
||||
bool collapseGroups(int& leftOffset, int actualWidth, RibbonControlSizeDefinition::GroupSize size, bool adjust);
|
||||
bool expandGroups(int& leftOffset, int actualWidth, RibbonControlSizeDefinition::GroupSize size, bool adjust);
|
||||
RibbonControlSizeDefinition::GroupSize getMinGroupSize() const;
|
||||
RibbonControlSizeDefinition::GroupSize getMaxGroupSize() const;
|
||||
bool canReduce() const;
|
||||
|
||||
public:
|
||||
RibbonGroupScroll* m_buttonScrollGroupLeft; // Button to draw left scroll
|
||||
RibbonGroupScroll* m_buttonScrollGroupRight; // Button to draw right scroll
|
||||
|
||||
QList<RibbonGroup*> m_listGroups;
|
||||
QList<QAction*> m_listShortcuts;
|
||||
RibbonTab* m_associativeTab;
|
||||
QBasicTimer m_timer;
|
||||
QBasicTimer m_scrollTimer;
|
||||
QString m_title;
|
||||
QString m_contextTitle;
|
||||
QString m_contextGroupName;
|
||||
RibbonPage::ContextColor m_contextColor;
|
||||
Qt::LayoutDirection m_layoutDirection;
|
||||
|
||||
int m_groupsHeight;
|
||||
int m_pageScrollPos;
|
||||
int m_groupScrollPos;
|
||||
int m_scrollPosTarget;
|
||||
double m_animationStep;
|
||||
int m_timerElapse;
|
||||
|
||||
bool m_minimazeRibbon : 1;
|
||||
bool m_doVisiblePage : 1;
|
||||
bool m_allowPress : 1;
|
||||
bool m_doPopupPage : 1;
|
||||
bool m_animation : 1;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonPagePrivate)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONPAGEPRIVATE_H
|
||||
432
third-party/QtitanRibbon/src/ribbon/QtnRibbonPrivate.cpp
vendored
Normal file
432
third-party/QtitanRibbon/src/ribbon/QtnRibbonPrivate.cpp
vendored
Normal file
@@ -0,0 +1,432 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QApplication>
|
||||
#include <QStyleOption>
|
||||
#include <QResizeEvent>
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QLineEdit>
|
||||
#include <QComboBox>
|
||||
#include <QPainter>
|
||||
#include <QLayout>
|
||||
#include <QEvent>
|
||||
#include <QLabel>
|
||||
|
||||
#include "QtnRibbonPrivate.h"
|
||||
#include "QtnRibbonBarPrivate.h"
|
||||
#include "QtnStyleHelpers.h"
|
||||
#include "QtnRibbonGroupPrivate.h"
|
||||
#include "QtnRibbonGroup.h"
|
||||
#include "QtnRibbonButtonPrivate.h"
|
||||
#include "QtnRibbonStyle.h"
|
||||
#include "QtnRibbonPage.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
static int keyTipEventNumber = -1;
|
||||
static int showKeyTipEventNumber = -1;
|
||||
static int hideKeyTipEventNumber = -1;
|
||||
static int minimizedEventNumber = -1;
|
||||
|
||||
|
||||
/* RibbonGroupPopupButton */
|
||||
RibbonGroupPopupButton::RibbonGroupPopupButton(QWidget* parent, RibbonGroup* group)
|
||||
: QToolButton(parent)
|
||||
{
|
||||
m_ribbonGroup = group;
|
||||
m_eventLoop = Q_NULL;
|
||||
m_hasPopup = false;
|
||||
|
||||
m_ribbonGroup->adjustSize();
|
||||
|
||||
ensurePolished();
|
||||
|
||||
setAttribute(Qt::WA_LayoutUsesWidgetRect);
|
||||
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Maximum);
|
||||
setPopupMode(QToolButton::MenuButtonPopup);
|
||||
setText(m_ribbonGroup->title());
|
||||
|
||||
m_popupWidget = new RibbonGroupPopup(group);
|
||||
m_popupWidget->setWindowFlags(Qt::Popup);
|
||||
}
|
||||
|
||||
RibbonGroupPopup* RibbonGroupPopupButton::popupWidget()
|
||||
{
|
||||
return m_popupWidget;
|
||||
}
|
||||
|
||||
RibbonGroupPopupButton::~RibbonGroupPopupButton()
|
||||
{
|
||||
if (m_eventLoop)
|
||||
m_eventLoop->exit();
|
||||
Q_DELETE_AND_NULL(m_popupWidget);
|
||||
}
|
||||
|
||||
bool RibbonGroupPopupButton::isShowPopup() const
|
||||
{
|
||||
return m_hasPopup;
|
||||
}
|
||||
|
||||
void RibbonGroupPopupButton::setVisible(bool visible)
|
||||
{
|
||||
QToolButton::setVisible(visible);
|
||||
}
|
||||
|
||||
void RibbonGroupPopupButton::resetReducedGroup()
|
||||
{
|
||||
Q_ASSERT(false);
|
||||
if (m_ribbonGroup->isReduced())
|
||||
{
|
||||
//m_ribbonGroup->qtn_d().m_reduced = false;
|
||||
m_ribbonGroup->show();
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonGroupPopupButton::resetPopopGroup()
|
||||
{
|
||||
if (m_eventLoop)
|
||||
m_eventLoop->exit();
|
||||
// m_hasPopup = false;
|
||||
update();
|
||||
}
|
||||
|
||||
QSize RibbonGroupPopupButton::sizeHint() const
|
||||
{
|
||||
QStyleOptionToolButton opt;
|
||||
initStyleOption(&opt);
|
||||
return QSize(style()->pixelMetric((QStyle::PixelMetric)RibbonStyle::PM_RibbonReducedGroupWidth, &opt, this), 50/*m_ribbonGroup->sizeHint().height()*/);
|
||||
}
|
||||
|
||||
void RibbonGroupPopupButton::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPainter p(this );
|
||||
QStyleOptionToolButton opt;
|
||||
initStyleOption(&opt);
|
||||
if (m_hasPopup)
|
||||
opt.features |= QStyleOptionToolButton::HasMenu;
|
||||
QRect rcGroup = opt.rect;
|
||||
rcGroup.setBottom(rcGroup.bottom() - 1);
|
||||
opt.rect = rcGroup;
|
||||
style()->drawControl((QStyle::ControlElement)RibbonStyle::CE_ReducedGroup, &opt, &p, this);
|
||||
}
|
||||
|
||||
void RibbonGroupPopupButton::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (!m_ribbonGroup)
|
||||
return;
|
||||
|
||||
if (m_ribbonGroup->isReduced() /*&& !m_hasPopup*/ )
|
||||
{
|
||||
QStyleOptionToolButton opt;
|
||||
initStyleOption(&opt);
|
||||
if (event->button() == Qt::LeftButton && popupMode() == QToolButton::MenuButtonPopup)
|
||||
{
|
||||
QRect popupr = style()->subControlRect(QStyle::CC_ToolButton, &opt, QStyle::SC_ToolButtonMenu, this);
|
||||
if (popupr.isValid() && popupr.contains(event->pos()))
|
||||
{
|
||||
QPoint pnt(0, 0);
|
||||
QRect rc = rect();
|
||||
|
||||
QScreen* screenAtWidget = QGuiApplication::screenAt(this->geometry().center());
|
||||
QRect screen;
|
||||
|
||||
if (screenAtWidget) {
|
||||
screen = screenAtWidget->availableGeometry();
|
||||
} else {
|
||||
// Fallback to primary screen if no screen is found at the widget's position
|
||||
QScreen* primaryScreen = QGuiApplication::primaryScreen();
|
||||
if (primaryScreen) {
|
||||
screen = primaryScreen->availableGeometry();
|
||||
}
|
||||
}
|
||||
int h = rc.height();
|
||||
if (this->mapToGlobal(QPoint(0, rc.bottom())).y() + h <= screen.height())
|
||||
pnt = this->mapToGlobal(rc.bottomLeft());
|
||||
else
|
||||
pnt = this->mapToGlobal(rc.topLeft() - QPoint(0, h));
|
||||
|
||||
int width = m_ribbonGroup->qtn_d().updateControlsLayout(Q_NULL).width();
|
||||
QSize size = m_ribbonGroup->sizeHint();
|
||||
size.setWidth( width );
|
||||
const int desktopFrame = style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, this);
|
||||
|
||||
if (pnt.x() + size.width() - 1 > screen.right() - desktopFrame)
|
||||
pnt.setX(screen.right() - desktopFrame - size.width() + 1);
|
||||
if (pnt.x() < screen.left() + desktopFrame)
|
||||
pnt.setX(screen.left() + desktopFrame);
|
||||
|
||||
m_hasPopup = true;
|
||||
m_ribbonGroup->setGeometry(QRect(pnt, size));
|
||||
m_ribbonGroup->show();
|
||||
|
||||
QObject::connect(m_ribbonGroup, SIGNAL(hidePopup()), this, SLOT(resetPopopGroup()));
|
||||
QEventLoop eventLoop;
|
||||
m_eventLoop = &eventLoop;
|
||||
QPointer<QWidget> guard = m_ribbonGroup;
|
||||
(void) eventLoop.exec();
|
||||
if (guard.isNull())
|
||||
return;
|
||||
|
||||
m_hasPopup = false;
|
||||
QObject::disconnect(m_ribbonGroup, SIGNAL(hidePopup()), this, SLOT(resetPopopGroup()));
|
||||
m_eventLoop = Q_NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonGroupPopupButton::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
m_hasPopup = false;
|
||||
QToolButton::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
/* RibbonGroupPopup */
|
||||
RibbonGroupPopup::RibbonGroupPopup(RibbonGroup* group)
|
||||
: QMenu()
|
||||
, m_group(group)
|
||||
{
|
||||
setFont(group->font());
|
||||
setProperty(_qtn_TitleGroupsVisible, true);
|
||||
setPalette(group->palette());
|
||||
}
|
||||
|
||||
RibbonGroupPopup::~RibbonGroupPopup()
|
||||
{
|
||||
}
|
||||
|
||||
QSize RibbonGroupPopup::sizeHint() const
|
||||
{
|
||||
QSize size = m_group->qtn_d().sizeHint();
|
||||
return size.expandedTo(QSize(0, 0));
|
||||
}
|
||||
|
||||
void RibbonGroupPopup::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
QPainter p(this);
|
||||
QRect rectEvent = event->rect();
|
||||
p.setClipRect(rectEvent);
|
||||
|
||||
QStyle* ribbonStyle = style();
|
||||
|
||||
if (windowFlags() & Qt::Popup)
|
||||
{
|
||||
StyleOptionRibbon opt;
|
||||
opt.initFrom(this);
|
||||
opt.rect.adjust(-1, 0, 2, 4);
|
||||
style()->drawControl((QStyle::ControlElement)RibbonStyle::CE_RibbonGroups, &opt, &p, this);
|
||||
}
|
||||
|
||||
QStyleOptionGroupBox opt;
|
||||
m_group->qtn_d().initStyleOption(opt);
|
||||
opt.rect.setWidth(width());
|
||||
opt.rect.adjust(0, 0, 1, 1);
|
||||
if (rectEvent.intersects(opt.rect))
|
||||
ribbonStyle->drawControl((QStyle::ControlElement)RibbonStyle::CE_Group, &opt, &p, this);
|
||||
|
||||
int flags = opt.textAlignment;
|
||||
flags |= Qt::TextHideMnemonic;
|
||||
|
||||
QRect rcEntryCaption = opt.rect;
|
||||
rcEntryCaption.setTop(rcEntryCaption.bottom() - opt.lineWidth);
|
||||
|
||||
int indent = 0;
|
||||
if (m_group->qtn_d().m_optionButton->isVisible())
|
||||
indent = m_group->qtn_d().m_optionButton->width();
|
||||
|
||||
rcEntryCaption.adjust(0, -1, -indent, -2);
|
||||
opt.text = p.fontMetrics().elidedText(opt.text, m_group->titleElideMode(), rcEntryCaption.adjusted(2, 0, -2, 0).width());
|
||||
ribbonStyle->drawItemText(&p, rcEntryCaption, flags, opt.palette, opt.state & QStyle::State_Enabled, opt.text, QPalette::WindowText);
|
||||
}
|
||||
|
||||
void RibbonGroupPopup::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if ((windowFlags() & Qt::Popup) && !rect().contains(event->pos()) && m_group->isVisible())
|
||||
{
|
||||
QRect rect = m_group->rect();
|
||||
rect.moveTopLeft(m_group->mapToGlobal(rect.topLeft()));
|
||||
if (rect.contains(event->globalPos()))
|
||||
setAttribute(Qt::WA_NoMouseReplay);
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
QMenu::mousePressEvent(event);
|
||||
}
|
||||
|
||||
/* RibbonGroupOption */
|
||||
RibbonGroupOption::RibbonGroupOption(QWidget* parent)
|
||||
: QToolButton(parent)
|
||||
{
|
||||
}
|
||||
|
||||
RibbonGroupOption::~RibbonGroupOption()
|
||||
{
|
||||
}
|
||||
|
||||
QString RibbonGroupOption::text() const
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
QSize RibbonGroupOption::sizeHint() const
|
||||
{
|
||||
return QSize(15, 14);
|
||||
}
|
||||
|
||||
void RibbonGroupOption::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPainter p(this);
|
||||
QStyleOptionToolButton opt;
|
||||
initStyleOption(&opt);
|
||||
opt.iconSize = opt.icon.actualSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
|
||||
style()->drawPrimitive((QStyle::PrimitiveElement)RibbonStyle::PE_RibbonOptionButton, &opt, &p, this);
|
||||
}
|
||||
|
||||
void RibbonGroupOption::actionEvent(QActionEvent* event)
|
||||
{
|
||||
QToolButton::actionEvent(event);
|
||||
if (event->type() == QEvent::ActionChanged)
|
||||
{
|
||||
QAction* action = event->action();
|
||||
setPopupMode(action->menu() ? QToolButton::MenuButtonPopup : QToolButton::DelayedPopup);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\class Qtitan::RibbonGroupScroll
|
||||
\internal
|
||||
*/
|
||||
RibbonGroupScroll::RibbonGroupScroll(QWidget* parent, bool scrollLeft)
|
||||
: QToolButton(parent)
|
||||
, m_scrollLeft( scrollLeft )
|
||||
{
|
||||
}
|
||||
|
||||
RibbonGroupScroll::~RibbonGroupScroll()
|
||||
{
|
||||
}
|
||||
|
||||
void RibbonGroupScroll::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPainter p(this);
|
||||
QStyleOptionToolButton opt;
|
||||
initStyleOption(&opt);
|
||||
opt.arrowType = m_scrollLeft ? Qt::LeftArrow : Qt::RightArrow;
|
||||
style()->drawPrimitive((QStyle::PrimitiveElement)RibbonStyle::PE_RibbonGroupScrollButton, &opt, &p, this);
|
||||
}
|
||||
|
||||
void RibbonGroupScroll::leaveEvent(QEvent* event)
|
||||
{
|
||||
QToolButton::leaveEvent(event);
|
||||
emit stopScrollTimer();
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\class Qtitan::KeyTipEvent
|
||||
\internal
|
||||
*/
|
||||
KeyTipEvent::KeyTipEvent(RibbonKeyTip* kTip)
|
||||
: QEvent(KeyTipEvent::eventNumber())
|
||||
{
|
||||
keyTip = kTip;
|
||||
}
|
||||
|
||||
RibbonKeyTip* KeyTipEvent::getKeyTip() const
|
||||
{
|
||||
return keyTip;
|
||||
}
|
||||
|
||||
QEvent::Type KeyTipEvent::eventNumber()
|
||||
{
|
||||
if (keyTipEventNumber < 0)
|
||||
keyTipEventNumber = QEvent::registerEventType();
|
||||
return (QEvent::Type) keyTipEventNumber;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class Qtitan::ShowKeyTipEvent
|
||||
\internal
|
||||
*/
|
||||
ShowKeyTipEvent::ShowKeyTipEvent(QWidget* w)
|
||||
: QEvent(ShowKeyTipEvent::eventNumber())
|
||||
{
|
||||
m_buddy = w;
|
||||
}
|
||||
|
||||
QWidget* ShowKeyTipEvent::buddy() const
|
||||
{
|
||||
return m_buddy;
|
||||
}
|
||||
|
||||
QEvent::Type ShowKeyTipEvent::eventNumber()
|
||||
{
|
||||
if (showKeyTipEventNumber < 0)
|
||||
showKeyTipEventNumber = QEvent::registerEventType();
|
||||
return (QEvent::Type) showKeyTipEventNumber;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class Qtitan::HideKeyTipEvent
|
||||
\internal
|
||||
*/
|
||||
HideKeyTipEvent::HideKeyTipEvent()
|
||||
: QEvent(HideKeyTipEvent::eventNumber())
|
||||
{
|
||||
}
|
||||
|
||||
QEvent::Type HideKeyTipEvent::eventNumber()
|
||||
{
|
||||
if (hideKeyTipEventNumber < 0)
|
||||
hideKeyTipEventNumber = QEvent::registerEventType();
|
||||
return (QEvent::Type) hideKeyTipEventNumber;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class Qtitan::HideKeyTipEvent
|
||||
\internal
|
||||
*/
|
||||
MinimizedEvent::MinimizedEvent()
|
||||
: QEvent(MinimizedEvent::eventNumber())
|
||||
{
|
||||
}
|
||||
|
||||
QEvent::Type MinimizedEvent::eventNumber()
|
||||
{
|
||||
if (minimizedEventNumber < 0)
|
||||
minimizedEventNumber = QEvent::registerEventType();
|
||||
return (QEvent::Type) minimizedEventNumber;
|
||||
}
|
||||
197
third-party/QtitanRibbon/src/ribbon/QtnRibbonPrivate.h
vendored
Normal file
197
third-party/QtitanRibbon/src/ribbon/QtnRibbonPrivate.h
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONPRIVATE_H
|
||||
#define QTN_RIBBONPRIVATE_H
|
||||
|
||||
#include <QEvent>
|
||||
#include <QMenu>
|
||||
#include <QToolButton>
|
||||
#include <QStyleOption>
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QResizeEvent>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
class QEventLoop;
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonGroup;
|
||||
class RibbonGroupPopup;
|
||||
/* RibbonGroupPopupButton */
|
||||
class RibbonGroupPopupButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonGroupPopupButton(QWidget* parent, RibbonGroup* group);
|
||||
virtual ~RibbonGroupPopupButton();
|
||||
|
||||
public:
|
||||
bool isShowPopup() const;
|
||||
virtual void setVisible(bool visible);
|
||||
RibbonGroupPopup* popupWidget();
|
||||
|
||||
protected:
|
||||
void resetReducedGroup();
|
||||
|
||||
public Q_SLOTS:
|
||||
void resetPopopGroup();
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event);
|
||||
|
||||
private:
|
||||
bool m_hasPopup;
|
||||
QEventLoop* m_eventLoop;
|
||||
RibbonGroup* m_ribbonGroup;
|
||||
RibbonGroupPopup* m_popupWidget;
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonGroupPopupButton)
|
||||
};
|
||||
|
||||
/* RibbonGroupPopup */
|
||||
class RibbonGroupPopup : public QMenu
|
||||
{
|
||||
public:
|
||||
explicit RibbonGroupPopup(RibbonGroup* group);
|
||||
virtual ~RibbonGroupPopup();
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
private:
|
||||
RibbonGroup* m_group;
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonGroupPopup)
|
||||
};
|
||||
|
||||
/* RibbonGroupOption */
|
||||
class RibbonGroupOption : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonGroupOption(QWidget* parent);
|
||||
virtual ~RibbonGroupOption();
|
||||
|
||||
public:
|
||||
QString text() const;
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void actionEvent(QActionEvent* event);
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonGroupOption)
|
||||
};
|
||||
|
||||
/* RibbonGroupScroll */
|
||||
class RibbonGroupScroll : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonGroupScroll(QWidget* parent, bool scrollLeft);
|
||||
virtual ~RibbonGroupScroll();
|
||||
|
||||
Q_SIGNALS:
|
||||
void stopScrollTimer();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void leaveEvent(QEvent* event);
|
||||
|
||||
protected:
|
||||
bool m_scrollLeft;
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonGroupScroll)
|
||||
};
|
||||
|
||||
|
||||
class RibbonKeyTip;
|
||||
class KeyTipEvent : public QEvent
|
||||
{
|
||||
public:
|
||||
//! Constructor for the event.
|
||||
explicit KeyTipEvent(RibbonKeyTip* kTip);
|
||||
|
||||
public:
|
||||
RibbonKeyTip* getKeyTip() const;
|
||||
|
||||
public:
|
||||
// Returns the event type/number for KeyTipEvent.
|
||||
// The type is registered on first access. Use this to detect incoming
|
||||
static QEvent::Type eventNumber();
|
||||
protected:
|
||||
RibbonKeyTip* keyTip;
|
||||
};
|
||||
|
||||
class ShowKeyTipEvent : public QEvent
|
||||
{
|
||||
public:
|
||||
ShowKeyTipEvent(QWidget* w);
|
||||
QWidget* buddy() const;
|
||||
// Returns the event type/number for ShowKeyTipEvent.
|
||||
// The type is registered on first access. Use this to detect incoming
|
||||
static QEvent::Type eventNumber();
|
||||
protected:
|
||||
QWidget* m_buddy;
|
||||
};
|
||||
|
||||
class HideKeyTipEvent : public QEvent
|
||||
{
|
||||
public:
|
||||
HideKeyTipEvent();
|
||||
// Returns the event type/number for ShowKeyTipEvent.
|
||||
// The type is registered on first access. Use this to detect incoming
|
||||
static QEvent::Type eventNumber();
|
||||
};
|
||||
|
||||
/* MinimizedEvent */
|
||||
class MinimizedEvent : public QEvent
|
||||
{
|
||||
public:
|
||||
MinimizedEvent();
|
||||
// Returns the event type/number for ShowKeyTipEvent.
|
||||
// The type is registered on first access. Use this to detect incoming
|
||||
static QEvent::Type eventNumber();
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONPRIVATE_H
|
||||
|
||||
|
||||
527
third-party/QtitanRibbon/src/ribbon/QtnRibbonQuickAccessBar.cpp
vendored
Normal file
527
third-party/QtitanRibbon/src/ribbon/QtnRibbonQuickAccessBar.cpp
vendored
Normal file
@@ -0,0 +1,527 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QApplication>
|
||||
#include <QStyleOption>
|
||||
#include <QMenu>
|
||||
#include <QPainter>
|
||||
#include <QToolButton>
|
||||
#include <qevent.h>
|
||||
#include <QActionGroup>
|
||||
|
||||
#include "QtnRibbonStyle.h"
|
||||
#include "QtnRibbonBarPrivate.h"
|
||||
#include "QtnRibbonBar.h"
|
||||
#include "QtnStyleHelpers.h"
|
||||
#include "QtnRibbonQuickAccessBar.h"
|
||||
#include "QtnRibbonCustomizeManager.h"
|
||||
#include "QtnRibbonCustomizeManagerPrivate.h"
|
||||
#include "QtnRibbonDef.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonQuickAccessButton : public QToolButton
|
||||
{
|
||||
public:
|
||||
RibbonQuickAccessButton(QWidget* parent = Q_NULL);
|
||||
virtual ~RibbonQuickAccessButton();
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent*);
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonQuickAccessButton)
|
||||
};
|
||||
|
||||
class QuickAccessAction : public QAction
|
||||
{
|
||||
public:
|
||||
QuickAccessAction(QObject* p, QAction* srcAction)
|
||||
: QAction(srcAction->text(), p)
|
||||
, m_srcAction(srcAction)
|
||||
{
|
||||
setCheckable(true);
|
||||
QToolBar* toolBar = qobject_cast<QToolBar*>(parent());
|
||||
Q_ASSERT(toolBar);
|
||||
setChecked(toolBar->widgetForAction(srcAction));
|
||||
}
|
||||
void update()
|
||||
{
|
||||
QToolBar* toolBar = qobject_cast<QToolBar*>(parent());
|
||||
Q_ASSERT(toolBar);
|
||||
setChecked(toolBar->widgetForAction(m_srcAction));
|
||||
setText(m_srcAction->text());
|
||||
}
|
||||
|
||||
public:
|
||||
QAction* m_srcAction;
|
||||
private:
|
||||
Q_DISABLE_COPY(QuickAccessAction)
|
||||
};
|
||||
|
||||
class QuickAccessActionInvisible : public QAction
|
||||
{
|
||||
public:
|
||||
QuickAccessActionInvisible(QObject* p, QActionGroup* data)
|
||||
: QAction(p)
|
||||
{
|
||||
m_data = data;
|
||||
setProperty(__qtn_Action_Invisible, QLatin1String("__qtn_Action_Invisible"));
|
||||
setVisible(false);
|
||||
}
|
||||
public:
|
||||
QActionGroup* m_data;
|
||||
private:
|
||||
Q_DISABLE_COPY(QuickAccessActionInvisible)
|
||||
};
|
||||
|
||||
class RibbonQuickAccessBarPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonQuickAccessBar)
|
||||
public:
|
||||
explicit RibbonQuickAccessBarPrivate();
|
||||
virtual ~RibbonQuickAccessBarPrivate();
|
||||
|
||||
public:
|
||||
void init();
|
||||
QuickAccessAction* findQuickAccessAction(QAction* action) const;
|
||||
QAction* findBeforeAction(QAction* action) const;
|
||||
void updateAction(QAction* action);
|
||||
void updateParentLayout() const;
|
||||
void setActionVisible(QAction* action, bool visible);
|
||||
|
||||
public:
|
||||
RibbonQuickAccessButton* m_accessPopup;
|
||||
QMenu* m_menu;
|
||||
QAction* m_actionAccessPopup;
|
||||
QActionGroup* m_customizeGroupAction;
|
||||
QList<QAction*> m_actionList;
|
||||
bool m_removeAction : 1;
|
||||
bool m_customizeAction : 1;
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonQuickAccessBarPrivate)
|
||||
};
|
||||
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
/* RibbonQuickAccessButton */
|
||||
RibbonQuickAccessButton::RibbonQuickAccessButton(QWidget* parent)
|
||||
: QToolButton(parent)
|
||||
{
|
||||
setObjectName("QtnRibbonQuickAccessButton");
|
||||
}
|
||||
|
||||
RibbonQuickAccessButton::~RibbonQuickAccessButton()
|
||||
{
|
||||
}
|
||||
|
||||
QSize RibbonQuickAccessButton::sizeHint() const
|
||||
{
|
||||
QSize sz = QToolButton::sizeHint();
|
||||
if (sz.isNull())
|
||||
sz = QSize(16, 16);
|
||||
return QSize(sz.height()*13/sz.width()+1, sz.height());
|
||||
}
|
||||
|
||||
void RibbonQuickAccessButton::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
QPainter p(this);
|
||||
QStyleOptionToolButton opt;
|
||||
initStyleOption(&opt);
|
||||
style()->drawPrimitive((QStyle::PrimitiveElement)RibbonStyle::PE_RibbonQuickAccessButton, &opt, &p, this);
|
||||
}
|
||||
|
||||
/* RibbonQuickAccessBarPrivate */
|
||||
RibbonQuickAccessBarPrivate::RibbonQuickAccessBarPrivate()
|
||||
{
|
||||
m_accessPopup = Q_NULL;
|
||||
m_menu = Q_NULL;
|
||||
m_actionAccessPopup = Q_NULL;
|
||||
m_customizeGroupAction = Q_NULL;
|
||||
m_removeAction = false;
|
||||
m_customizeAction = false;
|
||||
}
|
||||
|
||||
RibbonQuickAccessBarPrivate::~RibbonQuickAccessBarPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
void RibbonQuickAccessBarPrivate::init()
|
||||
{
|
||||
QTN_P(RibbonQuickAccessBar);
|
||||
p.setIconSize(QSize(16, 16));
|
||||
m_accessPopup = new RibbonQuickAccessButton(&p);
|
||||
m_accessPopup->setPopupMode(QToolButton::InstantPopup);
|
||||
m_menu = new QMenu(&p);
|
||||
m_accessPopup->setMenu(m_menu);
|
||||
|
||||
m_actionAccessPopup = p.addWidget(m_accessPopup);
|
||||
m_actionAccessPopup->setProperty(__qtn_Quick_Access_Button, QLatin1String("__qtn_Quick_Access_Button"));
|
||||
|
||||
m_customizeGroupAction = new QActionGroup(&p);
|
||||
m_customizeGroupAction->setExclusive(false);
|
||||
QObject::connect(m_customizeGroupAction, SIGNAL(triggered(QAction*)), &p, SLOT(customizeAction(QAction*)));
|
||||
|
||||
QObject::connect(m_menu, SIGNAL(aboutToShow()), &p, SLOT(aboutToShowCustomizeMenu()));
|
||||
QObject::connect(m_menu, SIGNAL(aboutToHide()), &p, SLOT(aboutToHideCustomizeMenu()));
|
||||
|
||||
p.addAction(new QuickAccessActionInvisible(&p, m_customizeGroupAction));
|
||||
}
|
||||
|
||||
QuickAccessAction* RibbonQuickAccessBarPrivate::findQuickAccessAction(QAction* action) const
|
||||
{
|
||||
if (m_customizeGroupAction == Q_NULL)
|
||||
return Q_NULL;
|
||||
|
||||
QList<QAction*> list = m_customizeGroupAction->actions();
|
||||
for (int i = 0; i < list.count(); ++i)
|
||||
{
|
||||
QuickAccessAction* act = dynamic_cast<QuickAccessAction*>(list[i]);
|
||||
if (act && action == act->m_srcAction)
|
||||
return act;
|
||||
}
|
||||
return Q_NULL;
|
||||
}
|
||||
|
||||
QAction* RibbonQuickAccessBarPrivate::findBeforeAction(QAction* action) const
|
||||
{
|
||||
QList<QAction*> list = m_customizeGroupAction->actions();
|
||||
bool find = false;
|
||||
for (int i = 0, count = list.count(); i < count; ++i)
|
||||
{
|
||||
if (find)
|
||||
{
|
||||
if (QuickAccessAction* beforeAct = dynamic_cast<QuickAccessAction*>(list[i]))
|
||||
{
|
||||
if (beforeAct->isChecked())
|
||||
return beforeAct->m_srcAction;
|
||||
}
|
||||
}
|
||||
if (!find && action == list[i])
|
||||
find = true;
|
||||
}
|
||||
return Q_NULL;
|
||||
}
|
||||
|
||||
void RibbonQuickAccessBarPrivate::updateAction(QAction* action)
|
||||
{
|
||||
if (QuickAccessAction* wrapper = findQuickAccessAction(action))
|
||||
wrapper->update();
|
||||
}
|
||||
|
||||
void RibbonQuickAccessBarPrivate::updateParentLayout() const
|
||||
{
|
||||
QTN_P(const RibbonQuickAccessBar);
|
||||
if (!p.isVisible())
|
||||
return;
|
||||
|
||||
if (RibbonBar* ribbonBar = qobject_cast<RibbonBar*>(p.parentWidget()))
|
||||
{
|
||||
if (ribbonBar->quickAccessBarPosition() == RibbonBar::QATopPosition)
|
||||
QApplication::postEvent(ribbonBar, new QResizeEvent(ribbonBar->size(), QSize(0, 0)));
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonQuickAccessBarPrivate::setActionVisible(QAction* action, bool visible)
|
||||
{
|
||||
QTN_P(RibbonQuickAccessBar);
|
||||
if (QuickAccessAction* wrapper = findQuickAccessAction(action))
|
||||
{
|
||||
if (visible)
|
||||
{
|
||||
if (m_customizeAction)
|
||||
{
|
||||
QAction* beforeAct = findBeforeAction(wrapper);
|
||||
p.insertAction(beforeAct, action);
|
||||
}
|
||||
else
|
||||
p.addAction(action);
|
||||
}
|
||||
else
|
||||
{
|
||||
p.removeAction(action);
|
||||
m_removeAction = false;
|
||||
}
|
||||
wrapper->update();
|
||||
p.adjustSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* RibbonQuickAccessBar */
|
||||
RibbonQuickAccessBar::RibbonQuickAccessBar(QWidget* parent)
|
||||
: QToolBar(parent)
|
||||
{
|
||||
QTN_INIT_PRIVATE(RibbonQuickAccessBar);
|
||||
QTN_D(RibbonQuickAccessBar);
|
||||
d.init();
|
||||
}
|
||||
|
||||
RibbonQuickAccessBar::~RibbonQuickAccessBar()
|
||||
{
|
||||
QTN_FINI_PRIVATE();
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns a pointer to the QAction that is associated with the customize button of Ribbon's Quick Access Bar.
|
||||
*/
|
||||
QAction* RibbonQuickAccessBar::actionCustomizeButton() const
|
||||
{
|
||||
QTN_D(const RibbonQuickAccessBar);
|
||||
return d.m_actionAccessPopup;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Sets the visibility of the visual representation of action on the quick access toolbar. Parameter \a action is action, parameter \a visible is a visibility.
|
||||
*/
|
||||
void RibbonQuickAccessBar::setActionVisible(QAction* action, bool visible)
|
||||
{
|
||||
QTN_D(RibbonQuickAccessBar);
|
||||
d.setActionVisible(action, visible);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the visibility of the visual representation for the given \a action.
|
||||
*/
|
||||
bool RibbonQuickAccessBar::isActionVisible(QAction* action) const
|
||||
{
|
||||
QTN_D(const RibbonQuickAccessBar);
|
||||
if (QuickAccessAction* wrapper = d.findQuickAccessAction(action))
|
||||
return wrapper->isChecked();
|
||||
return false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the count of the elements visible on Ribbon's Quick Access Bar.
|
||||
*/
|
||||
int RibbonQuickAccessBar::visibleCount() const
|
||||
{
|
||||
QTN_D(const RibbonQuickAccessBar);
|
||||
int visibleCount = 0;
|
||||
QList<QAction*> list = d.m_customizeGroupAction->actions();
|
||||
for (int i = 0, count = list.count(); i < count; ++i)
|
||||
{
|
||||
if (QuickAccessAction* beforeAct = dynamic_cast<QuickAccessAction*>(list[i]))
|
||||
if (beforeAct->isChecked())
|
||||
visibleCount++;
|
||||
}
|
||||
return visibleCount;
|
||||
}
|
||||
|
||||
void RibbonQuickAccessBar::removeAllInstances(QAction* action)
|
||||
{
|
||||
QTN_D(RibbonQuickAccessBar);
|
||||
if (QuickAccessAction* wrapper = d.findQuickAccessAction(action))
|
||||
{
|
||||
d.m_actionList.removeAll(wrapper);
|
||||
d.m_customizeGroupAction->removeAction(wrapper);
|
||||
delete wrapper;
|
||||
}
|
||||
|
||||
QToolBar::removeAction(action);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns the recommended size for Ribbon's Quick Access Bar.
|
||||
\reimp
|
||||
*/
|
||||
QSize RibbonQuickAccessBar::sizeHint() const
|
||||
{
|
||||
RibbonBar* ribbonBar = qobject_cast<RibbonBar*>(parentWidget());
|
||||
if (ribbonBar == Q_NULL)
|
||||
return QToolBar::sizeHint();
|
||||
|
||||
int heightTabs = ribbonBar->qtn_d().heightTabs();
|
||||
return QSize(QToolBar::sizeHint().width(), heightTabs+1).expandedTo(QSize(0, 0));
|
||||
}
|
||||
|
||||
/*! \internal */
|
||||
void RibbonQuickAccessBar::customizeAction(QAction* action)
|
||||
{
|
||||
QTN_D(RibbonQuickAccessBar);
|
||||
d.m_customizeAction = true;
|
||||
if (QuickAccessAction* act = dynamic_cast<QuickAccessAction*>(action))
|
||||
{
|
||||
setActionVisible(act->m_srcAction, !widgetForAction(act->m_srcAction));
|
||||
if (RibbonBar* ribbonBar = qobject_cast<RibbonBar*>(parentWidget()))
|
||||
{
|
||||
if (RibbonCustomizeManager* manager = ribbonBar->customizeManager())
|
||||
{
|
||||
manager->setEditMode();
|
||||
manager->qtn_d().m_ribbonManager->setQuickAccessBar();
|
||||
manager->setEditMode(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
d.m_customizeAction = false;
|
||||
}
|
||||
|
||||
/*! \internal */
|
||||
void RibbonQuickAccessBar::aboutToShowCustomizeMenu()
|
||||
{
|
||||
QTN_D(RibbonQuickAccessBar);
|
||||
d.m_menu->clear();
|
||||
|
||||
d.m_menu->setSeparatorsCollapsible(false);
|
||||
d.m_menu->addSeparator()->setText(RibbonBar::tr_compatible(QtnRibbonCustomizeQuickAccessToolBarString));
|
||||
|
||||
QListIterator<QAction *> itAction(d.m_actionList);
|
||||
while (itAction.hasNext())
|
||||
{
|
||||
QAction* action = itAction.next();
|
||||
d.m_menu->addAction(action);
|
||||
}
|
||||
|
||||
emit showCustomizeMenu(d.m_menu);
|
||||
}
|
||||
|
||||
/*! \internal */
|
||||
void RibbonQuickAccessBar::aboutToHideCustomizeMenu()
|
||||
{
|
||||
QTN_D(RibbonQuickAccessBar);
|
||||
d.m_menu->clear();
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
bool RibbonQuickAccessBar::event(QEvent* event)
|
||||
{
|
||||
if ((QEvent::Hide == event->type() || QEvent::Show == event->type()) && parentWidget())
|
||||
{
|
||||
adjustSize();
|
||||
if (RibbonBar* ribbonBar = qobject_cast<RibbonBar*>(parentWidget()))
|
||||
ribbonBar->updateLayout();
|
||||
}
|
||||
return QToolBar::event(event);
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void RibbonQuickAccessBar::actionEvent(QActionEvent* event)
|
||||
{
|
||||
QTN_D(RibbonQuickAccessBar);
|
||||
|
||||
QToolBar::actionEvent(event);
|
||||
|
||||
if (d.m_actionAccessPopup)
|
||||
{
|
||||
if (event->type() == QEvent::ActionAdded)
|
||||
{
|
||||
if (!d.m_removeAction)
|
||||
removeAction(d.m_actionAccessPopup);
|
||||
|
||||
QuickAccessAction* quickAccessAction = d.findQuickAccessAction(event->action());
|
||||
if (event->action() != d.m_actionAccessPopup && !quickAccessAction &&
|
||||
!dynamic_cast<QuickAccessActionInvisible*>(event->action()))
|
||||
{
|
||||
QuickAccessAction* act = new QuickAccessAction(this, event->action());
|
||||
|
||||
bool addActionToMenu = true;
|
||||
|
||||
if (RibbonBar* ribbonBar = qobject_cast<RibbonBar*>(parentWidget()))
|
||||
{
|
||||
if (RibbonCustomizeManager* manager = ribbonBar->customizeManager())
|
||||
{
|
||||
if (manager->isEditMode())
|
||||
{
|
||||
QList< QAction* > defaultActions = manager->qtn_d().m_ribbonManager->defaultToolBars().value(this);
|
||||
if (!defaultActions.contains(event->action()))
|
||||
addActionToMenu = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (addActionToMenu)
|
||||
d.m_actionList.append(act);
|
||||
|
||||
d.m_customizeGroupAction->addAction(act);
|
||||
adjustSize();
|
||||
}
|
||||
else if (quickAccessAction)
|
||||
quickAccessAction->update();
|
||||
}
|
||||
else if (event->type() == QEvent::ActionRemoved)
|
||||
{
|
||||
if (event->action() == d.m_actionAccessPopup)
|
||||
{
|
||||
d.m_removeAction = true;
|
||||
addAction(d.m_actionAccessPopup);
|
||||
d.m_removeAction = false;
|
||||
}
|
||||
else if (QuickAccessActionInvisible* actInvisible = dynamic_cast<QuickAccessActionInvisible*>(event->action()))
|
||||
{
|
||||
d.m_actionList.clear();
|
||||
QList<QAction*> actList = actInvisible->m_data->actions();
|
||||
for (int i = actList.size()-1; i >= 0; i--)
|
||||
{
|
||||
QAction* actionWrapper = actList[i];
|
||||
d.m_customizeGroupAction->removeAction(actionWrapper);
|
||||
delete actionWrapper;
|
||||
}
|
||||
delete actInvisible;
|
||||
addAction(new QuickAccessActionInvisible(this, d.m_customizeGroupAction));
|
||||
}
|
||||
else
|
||||
d.updateAction(event->action());
|
||||
}
|
||||
else if (event->type() == QEvent::ActionChanged)
|
||||
{
|
||||
if (event->action() == d.m_actionAccessPopup)
|
||||
d.m_accessPopup->setDefaultAction(d.m_actionAccessPopup);
|
||||
else if(!dynamic_cast<QuickAccessAction*>(event->action()))
|
||||
d.updateAction(event->action());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void RibbonQuickAccessBar::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
if (RibbonBar* ribbonBar = qobject_cast<RibbonBar*>(parentWidget()))
|
||||
{
|
||||
QPainter p(this);
|
||||
StyleRibbonQuickAccessBar opt;
|
||||
opt.initFrom(this);
|
||||
opt.quickAccessBarPosition = ribbonBar->quickAccessBarPosition();
|
||||
style()->drawControl(QStyle::CE_ToolBar, &opt, &p, this);
|
||||
}
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void RibbonQuickAccessBar::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
QToolBar::resizeEvent(event);
|
||||
QTN_D(RibbonQuickAccessBar);
|
||||
d.updateParentLayout();
|
||||
}
|
||||
|
||||
74
third-party/QtitanRibbon/src/ribbon/QtnRibbonQuickAccessBar.h
vendored
Normal file
74
third-party/QtitanRibbon/src/ribbon/QtnRibbonQuickAccessBar.h
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONQUICKACCESSBAR_H
|
||||
#define QTN_RIBBONQUICKACCESSBAR_H
|
||||
|
||||
#include <QToolBar>
|
||||
#include <QMenu>
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonQuickAccessBarPrivate;
|
||||
class QTITAN_EXPORT RibbonQuickAccessBar : public QToolBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RibbonQuickAccessBar(QWidget* parent = Q_NULL);
|
||||
virtual ~RibbonQuickAccessBar();
|
||||
|
||||
public:
|
||||
QAction* actionCustomizeButton() const;
|
||||
void setActionVisible(QAction* action, bool visible);
|
||||
bool isActionVisible(QAction* action) const;
|
||||
int visibleCount() const;
|
||||
void removeAllInstances(QAction* action);
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void showCustomizeMenu(QMenu* menu);
|
||||
|
||||
private Q_SLOTS:
|
||||
void customizeAction(QAction*);
|
||||
void aboutToShowCustomizeMenu();
|
||||
void aboutToHideCustomizeMenu();
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual void actionEvent(QActionEvent*);
|
||||
virtual void paintEvent(QPaintEvent*);
|
||||
virtual void resizeEvent(QResizeEvent*);
|
||||
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonQuickAccessBar)
|
||||
Q_DISABLE_COPY(RibbonQuickAccessBar)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONQUICKACCESSBAR_H
|
||||
241
third-party/QtitanRibbon/src/ribbon/QtnRibbonQuickAccessBarCustomizePage.ui
vendored
Normal file
241
third-party/QtitanRibbon/src/ribbon/QtnRibbonQuickAccessBarCustomizePage.ui
vendored
Normal file
@@ -0,0 +1,241 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RibbonQuickAccessBarCustomizePage</class>
|
||||
<widget class="QWidget" name="RibbonQuickAccessBarCustomizePage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>380</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>600</width>
|
||||
<height>380</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Quick Access Toolbar</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Customize the Quick Access Toolbar</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,0,0,1">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3" stretch="0,1,0,0,0">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCommandsFrom">
|
||||
<property name="text">
|
||||
<string>&Choose commands from:</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::AutoText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>comboBoxSourceCategory</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBoxSourceCategory"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelCommands">
|
||||
<property name="text">
|
||||
<string>C&ommands:</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>commandsList</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QListWidget" name="commandsList"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxQATOn">
|
||||
<property name="text">
|
||||
<string>S&how Quick Access Toolbar below the Ribbon</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1,0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="addButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Add > ></string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="removeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>< < &Remove</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QListWidget" name="quickAccessBarList"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonReset">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Re&set</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="upButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="downButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>30</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
121
third-party/QtitanRibbon/src/ribbon/QtnRibbonRenameDialog.ui
vendored
Normal file
121
third-party/QtitanRibbon/src/ribbon/QtnRibbonRenameDialog.ui
vendored
Normal file
@@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>RibbonRenameDialog</class>
|
||||
<widget class="QDialog" name="RibbonRenameDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>278</width>
|
||||
<height>79</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Rename</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutTop" stretch="0,1">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetNoConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>&Display Name:</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>lineEditName</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="lineEditName">
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutBottom" stretch="0">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>RibbonRenameDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>RibbonRenameDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
||||
233
third-party/QtitanRibbon/src/ribbon/QtnRibbonSliderPane.cpp
vendored
Normal file
233
third-party/QtitanRibbon/src/ribbon/QtnRibbonSliderPane.cpp
vendored
Normal file
@@ -0,0 +1,233 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QEvent>
|
||||
#include <QMouseEvent>
|
||||
#include <QBasicTimer>
|
||||
#include <QPainter>
|
||||
#include <QPushButton>
|
||||
#include <QHBoxLayout>
|
||||
#include <QStyleOption>
|
||||
|
||||
#include "QtnRibbonSliderPane.h"
|
||||
#include "QtnRibbonStyle.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonSliderButton : public QPushButton
|
||||
{
|
||||
public:
|
||||
RibbonSliderButton(QWidget* parent, QStyle::PrimitiveElement typeBut = QStyle::PE_IndicatorArrowUp);
|
||||
~RibbonSliderButton();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
QStyle::PrimitiveElement m_typeBut;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonSliderButton)
|
||||
};
|
||||
|
||||
class RibbonSliderPanePrivate : QObject
|
||||
{
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonSliderPane)
|
||||
public:
|
||||
explicit RibbonSliderPanePrivate();
|
||||
|
||||
public:
|
||||
void initSlider();
|
||||
|
||||
public:
|
||||
QSlider* m_slider;
|
||||
RibbonSliderButton* m_buttonUp;
|
||||
RibbonSliderButton* m_buttonDown;
|
||||
QHBoxLayout* m_layout;
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
/* RibbonSliderButton */
|
||||
RibbonSliderButton::RibbonSliderButton(QWidget* parent, QStyle::PrimitiveElement typeBut)
|
||||
: QPushButton(parent)
|
||||
{
|
||||
m_typeBut = typeBut;
|
||||
}
|
||||
|
||||
RibbonSliderButton::~RibbonSliderButton()
|
||||
{
|
||||
}
|
||||
|
||||
void RibbonSliderButton::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPainter painter(this);
|
||||
QStyleOptionButton option;
|
||||
initStyleOption(&option);
|
||||
option.direction = m_typeBut == QStyle::PE_IndicatorArrowUp ? Qt::LeftToRight : Qt::RightToLeft;
|
||||
style()->drawPrimitive((QStyle::PrimitiveElement)RibbonStyle::PE_RibbonSliderButton, &option, &painter, this);
|
||||
}
|
||||
|
||||
QSize RibbonSliderButton::sizeHint() const
|
||||
{
|
||||
QSize sz(12, 12);
|
||||
QStyleOptionButton option;
|
||||
initStyleOption(&option);
|
||||
option.direction = m_typeBut == QStyle::PE_IndicatorArrowUp ? Qt::LeftToRight : Qt::RightToLeft;
|
||||
sz = style()->sizeFromContents((QStyle::ContentsType)RibbonStyle::CT_RibbonSliderButton, &option, sz, this);
|
||||
return sz;
|
||||
}
|
||||
|
||||
/* RibbonSliderPanePrivate */
|
||||
RibbonSliderPanePrivate::RibbonSliderPanePrivate()
|
||||
: m_slider(Q_NULL)
|
||||
, m_buttonUp(Q_NULL)
|
||||
, m_buttonDown(Q_NULL)
|
||||
, m_layout(Q_NULL)
|
||||
{
|
||||
}
|
||||
|
||||
void RibbonSliderPanePrivate::initSlider()
|
||||
{
|
||||
QTN_P(RibbonSliderPane);
|
||||
m_slider = new QSlider(Qt::Horizontal, &p);
|
||||
m_slider->setTickPosition(QSlider::NoTicks);
|
||||
|
||||
m_layout = new QHBoxLayout();
|
||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
||||
m_layout->setSpacing(4);
|
||||
|
||||
m_layout->addWidget(m_slider);
|
||||
p.setLayout(m_layout);
|
||||
}
|
||||
|
||||
|
||||
/* RibbonSliderPane */
|
||||
RibbonSliderPane::RibbonSliderPane(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
QTN_INIT_PRIVATE(RibbonSliderPane);
|
||||
QTN_D(RibbonSliderPane);
|
||||
d.initSlider();
|
||||
connect(d.m_slider, SIGNAL(valueChanged(int)), this, SIGNAL(valueChanged(int)));
|
||||
connect(d.m_slider, SIGNAL(sliderMoved(int)), this, SIGNAL(sliderMoved(int)));
|
||||
}
|
||||
|
||||
RibbonSliderPane::~RibbonSliderPane()
|
||||
{
|
||||
QTN_FINI_PRIVATE();
|
||||
}
|
||||
|
||||
void RibbonSliderPane::setRange(int min, int max)
|
||||
{
|
||||
QTN_D(RibbonSliderPane);
|
||||
d.m_slider->setMinimum( min ); // min - Range
|
||||
d.m_slider->setMaximum( max ); // max - Range
|
||||
}
|
||||
|
||||
void RibbonSliderPane::setScrollButtons(bool on)
|
||||
{
|
||||
QTN_D(RibbonSliderPane);
|
||||
if (on)
|
||||
{
|
||||
d.m_buttonDown = new RibbonSliderButton(this, QStyle::PE_IndicatorArrowDown );
|
||||
d.m_layout->insertWidget(0, d.m_buttonDown, 0, Qt::AlignLeft);
|
||||
d.m_buttonUp = new RibbonSliderButton(this, QStyle::PE_IndicatorArrowUp);
|
||||
d.m_layout->addWidget(d.m_buttonUp, 0, Qt::AlignRight);
|
||||
connect(d.m_buttonDown, SIGNAL(pressed()), this, SLOT(decrement()));
|
||||
connect(d.m_buttonUp, SIGNAL(pressed()), this, SLOT(increment()));
|
||||
}
|
||||
else
|
||||
{
|
||||
disconnect(d.m_buttonUp, SIGNAL(pressed()), this, SLOT(increment()));
|
||||
disconnect(d.m_buttonDown, SIGNAL(pressed()), this, SLOT(decrement()));
|
||||
delete d.m_buttonUp;
|
||||
d.m_buttonUp = NULL;
|
||||
delete d.m_buttonDown;
|
||||
d.m_buttonDown = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonSliderPane::setSliderPosition(int position)
|
||||
{
|
||||
QTN_D(RibbonSliderPane);
|
||||
d.m_slider->setSliderPosition(position);
|
||||
}
|
||||
|
||||
int RibbonSliderPane::sliderPosition() const
|
||||
{
|
||||
QTN_D(const RibbonSliderPane);
|
||||
return d.m_slider->sliderPosition();
|
||||
}
|
||||
|
||||
void RibbonSliderPane::setSingleStep(int nPos)
|
||||
{
|
||||
QTN_D(RibbonSliderPane);
|
||||
d.m_slider->setSingleStep(nPos);
|
||||
}
|
||||
|
||||
int RibbonSliderPane::singleStep() const
|
||||
{
|
||||
QTN_D(const RibbonSliderPane);
|
||||
return d.m_slider->singleStep();
|
||||
}
|
||||
|
||||
int RibbonSliderPane::value() const
|
||||
{
|
||||
QTN_D(const RibbonSliderPane);
|
||||
return d.m_slider->value();
|
||||
}
|
||||
|
||||
void RibbonSliderPane::setValue(int value)
|
||||
{
|
||||
QTN_D(RibbonSliderPane);
|
||||
d.m_slider->setValue(value);
|
||||
}
|
||||
|
||||
void RibbonSliderPane::increment()
|
||||
{
|
||||
QTN_D(RibbonSliderPane);
|
||||
int nPos = d.m_slider->sliderPosition() + d.m_slider->singleStep();
|
||||
if (nPos <= d.m_slider->maximum())
|
||||
d.m_slider->setSliderPosition(nPos);
|
||||
}
|
||||
|
||||
void RibbonSliderPane::decrement()
|
||||
{
|
||||
QTN_D(RibbonSliderPane);
|
||||
int nPos = d.m_slider->sliderPosition() - d.m_slider->singleStep();
|
||||
if (nPos >= d.m_slider->minimum())
|
||||
d.m_slider->setSliderPosition(nPos);
|
||||
}
|
||||
|
||||
78
third-party/QtitanRibbon/src/ribbon/QtnRibbonSliderPane.h
vendored
Normal file
78
third-party/QtitanRibbon/src/ribbon/QtnRibbonSliderPane.h
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONSLIDERPANE_H
|
||||
#define QTN_RIBBONSLIDERPANE_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonSliderPanePrivate;
|
||||
class QTITAN_EXPORT RibbonSliderPane : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int singleStep READ singleStep WRITE setSingleStep)
|
||||
Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged USER true)
|
||||
Q_PROPERTY(int sliderPosition READ sliderPosition WRITE setSliderPosition NOTIFY sliderMoved)
|
||||
|
||||
public:
|
||||
RibbonSliderPane(QWidget* parent = Q_NULL);
|
||||
virtual ~RibbonSliderPane();
|
||||
|
||||
public:
|
||||
void setRange(int min, int max);
|
||||
void setScrollButtons(bool on);
|
||||
|
||||
void setSliderPosition(int);
|
||||
int sliderPosition() const;
|
||||
|
||||
void setSingleStep(int);
|
||||
int singleStep() const;
|
||||
|
||||
int value() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void setValue(int);
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueChanged(int value);
|
||||
void sliderMoved(int position);
|
||||
|
||||
protected Q_SLOTS:
|
||||
void increment();
|
||||
void decrement();
|
||||
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonSliderPane)
|
||||
Q_DISABLE_COPY(RibbonSliderPane)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONSLIDERPANE_H
|
||||
550
third-party/QtitanRibbon/src/ribbon/QtnRibbonStatusBar.cpp
vendored
Normal file
550
third-party/QtitanRibbon/src/ribbon/QtnRibbonStatusBar.cpp
vendored
Normal file
@@ -0,0 +1,550 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QStyle>
|
||||
#include <QEvent>
|
||||
#include <QAction>
|
||||
#include <QLayout>
|
||||
#include <QWidgetAction>
|
||||
#include <QPainter>
|
||||
#include <QBoxLayout>
|
||||
#include <QSizeGrip>
|
||||
#include <QToolButton>
|
||||
#include <QStyleOption>
|
||||
#include <QApplication>
|
||||
#include <qevent.h>
|
||||
|
||||
#include "QtnRibbonStatusBar.h"
|
||||
#include "QtnRibbonButtonPrivate.h"
|
||||
#include "QtnRibbonBarPrivate.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
static QToolButton* findButtonByAction(const QWidget* parent, const QAction* action)
|
||||
{
|
||||
const QObjectList& childrenGroup = parent->children();
|
||||
for (int i = 0, count = childrenGroup.count(); count > i; i++)
|
||||
{
|
||||
if (QToolButton* child = qobject_cast<QToolButton*>(childrenGroup.at(i)))
|
||||
{
|
||||
if (child->defaultAction() == action)
|
||||
return child;
|
||||
}
|
||||
}
|
||||
return Q_NULL;
|
||||
}
|
||||
|
||||
static int findIndexByAction(const QWidget* parent, const QAction* action)
|
||||
{
|
||||
const QObjectList& childrenGroup = parent->children();
|
||||
for (int i = 0, count = childrenGroup.count(); count > i; i++)
|
||||
{
|
||||
if (QToolButton* child = qobject_cast<QToolButton*>(childrenGroup.at(i)))
|
||||
{
|
||||
if (child->defaultAction() == action)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
static QLayout* qtnfindLayout(QLayout* lay, QWidget* wd)
|
||||
{
|
||||
if (!lay)
|
||||
return Q_NULL;
|
||||
|
||||
for (int i = 0, count = lay->count(); count > i; i++)
|
||||
{
|
||||
QLayoutItem* item = lay->itemAt(i);
|
||||
|
||||
QWidget* widget = item->widget();
|
||||
if (widget == wd)
|
||||
return lay;
|
||||
|
||||
if (QLayout* itemLayout = item->layout())
|
||||
return qtnfindLayout(itemLayout, wd);
|
||||
}
|
||||
|
||||
return Q_NULL;
|
||||
}
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class StatusButton : public QToolButton
|
||||
{
|
||||
public:
|
||||
StatusButton(QWidget* parent = Q_NULL);
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
public:
|
||||
void initStyleOptionButton(QStyleOptionToolButton& option) const;
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual void paintEvent(QPaintEvent*);
|
||||
};
|
||||
|
||||
class StatusSeparator : public QToolButton
|
||||
{
|
||||
public:
|
||||
StatusSeparator(QWidget* parent = Q_NULL);
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
void initStyleOption(QStyleOption* option) const;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent*);
|
||||
};
|
||||
|
||||
class RibbonStatusBarSwitchGroupPrivate : public QObject
|
||||
{
|
||||
QTN_DECLARE_PUBLIC(RibbonStatusBarSwitchGroup)
|
||||
public:
|
||||
explicit RibbonStatusBarSwitchGroupPrivate();
|
||||
public:
|
||||
void init();
|
||||
StatusButton* createButton(QAction* action) const;
|
||||
void updateIndexesButtons();
|
||||
|
||||
public:
|
||||
QHBoxLayout* m_layout;
|
||||
};
|
||||
|
||||
class RibbonStatusBarPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonStatusBar)
|
||||
|
||||
public:
|
||||
explicit RibbonStatusBarPrivate();
|
||||
|
||||
public:
|
||||
QLayout* findLayout();
|
||||
void updateLayout();
|
||||
QRect childrenPermanentRect() const;
|
||||
StatusButton* createButton(QAction* action) const;
|
||||
StatusSeparator* createSeparator(QAction* action) const;
|
||||
|
||||
public:
|
||||
bool m_dirty;
|
||||
bool m_addPermanentAction;
|
||||
int m_indexGroupAction;
|
||||
QSizeGrip* m_sizeGripWidget;
|
||||
QList<QWidget*> m_widgets;
|
||||
QList<QWidget*> m_permanentWidgets;
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
/* StatusButton */
|
||||
StatusButton::StatusButton(QWidget* parent)
|
||||
: QToolButton(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QSize StatusButton::sizeHint() const
|
||||
{
|
||||
return QToolButton::sizeHint();
|
||||
}
|
||||
|
||||
void StatusButton::initStyleOptionButton(QStyleOptionToolButton& opt) const
|
||||
{
|
||||
QToolButton::initStyleOption(&opt);
|
||||
|
||||
int actualArea = opt.rect.height()*opt.rect.width();
|
||||
|
||||
int index = -1;
|
||||
int curArea = 0;
|
||||
QList<QSize> lSz = opt.icon.availableSizes();
|
||||
for (int i = 0, count = lSz.count(); count > i; i++)
|
||||
{
|
||||
QSize curSz = lSz[i];
|
||||
int area = curSz.height()*curSz.width();
|
||||
if (actualArea > area)
|
||||
{
|
||||
if (area > curArea)
|
||||
index = i;
|
||||
curArea = area;
|
||||
}
|
||||
}
|
||||
opt.iconSize = index != -1 ? opt.icon.actualSize(lSz[index]) : opt.iconSize;
|
||||
}
|
||||
|
||||
bool StatusButton::event(QEvent* event)
|
||||
{
|
||||
if (event->type() == QEvent::Enter)
|
||||
{
|
||||
enterEvent(static_cast<QEnterEvent*>(event));
|
||||
return true;
|
||||
}
|
||||
else
|
||||
return QToolButton::event(event);
|
||||
}
|
||||
|
||||
void StatusButton::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPainter p(this);
|
||||
QStyleOptionToolButton opt;
|
||||
initStyleOptionButton(opt);
|
||||
style()->drawComplexControl(QStyle::CC_ToolButton, &opt, &p, this);
|
||||
}
|
||||
|
||||
/* StatusSeparator */
|
||||
StatusSeparator::StatusSeparator(QWidget* parent)
|
||||
: QToolButton(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QSize StatusSeparator::sizeHint() const
|
||||
{
|
||||
QSize sz = QToolButton::sizeHint();
|
||||
QStyleOption opt;
|
||||
initStyleOption(&opt);
|
||||
const int extent = style()->pixelMetric(QStyle::PM_ToolBarSeparatorExtent, &opt, parentWidget());
|
||||
sz.setWidth(extent);
|
||||
return sz;
|
||||
}
|
||||
|
||||
void StatusSeparator::initStyleOption(QStyleOption* option) const
|
||||
{
|
||||
option->initFrom(this);
|
||||
option->state |= QStyle::State_Horizontal;
|
||||
}
|
||||
|
||||
void StatusSeparator::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPainter p(this);
|
||||
QStyleOption opt;
|
||||
initStyleOption(&opt);
|
||||
style()->drawPrimitive(QStyle::PE_IndicatorToolBarSeparator, &opt, &p, parentWidget());
|
||||
}
|
||||
|
||||
/* RibbonStatusBarSwitchGroupPrivate */
|
||||
RibbonStatusBarSwitchGroupPrivate::RibbonStatusBarSwitchGroupPrivate()
|
||||
{
|
||||
}
|
||||
|
||||
void RibbonStatusBarSwitchGroupPrivate::init()
|
||||
{
|
||||
QTN_P(RibbonStatusBarSwitchGroup);
|
||||
m_layout = new QHBoxLayout();
|
||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
||||
m_layout->setSpacing(0);
|
||||
|
||||
// m_layout->addWidget(m_slider);
|
||||
p.setLayout(m_layout);
|
||||
}
|
||||
|
||||
StatusButton* RibbonStatusBarSwitchGroupPrivate::createButton(QAction* action) const
|
||||
{
|
||||
StatusButton* button = new StatusButton();
|
||||
button->setAutoRaise(true);
|
||||
button->setFocusPolicy(Qt::NoFocus);
|
||||
button->setDefaultAction(action);
|
||||
return button;
|
||||
}
|
||||
|
||||
void RibbonStatusBarSwitchGroupPrivate::updateIndexesButtons()
|
||||
{
|
||||
QTN_P(RibbonStatusBarSwitchGroup)
|
||||
int index = 0;
|
||||
int switchCount = 0;
|
||||
const QObjectList& children = p.children();
|
||||
for (int i = 0, count = children.count(); count > i; i++)
|
||||
{
|
||||
if (QWidget* child = qobject_cast<QWidget*>(children.at(i)))
|
||||
{
|
||||
switchCount++;
|
||||
child->setProperty(_qtn_Index_Group, index);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
p.setProperty(_qtn_Switch_Count, switchCount);
|
||||
}
|
||||
|
||||
|
||||
/* RibbonStatusBarSwitchGroup */
|
||||
RibbonStatusBarSwitchGroup::RibbonStatusBarSwitchGroup()
|
||||
{
|
||||
QTN_INIT_PRIVATE(RibbonStatusBarSwitchGroup);
|
||||
QTN_D(RibbonStatusBarSwitchGroup);
|
||||
d.init();
|
||||
}
|
||||
|
||||
RibbonStatusBarSwitchGroup::~RibbonStatusBarSwitchGroup()
|
||||
{
|
||||
QTN_FINI_PRIVATE();
|
||||
}
|
||||
|
||||
void RibbonStatusBarSwitchGroup::actionEvent(QActionEvent* event)
|
||||
{
|
||||
QTN_D(RibbonStatusBarSwitchGroup)
|
||||
|
||||
QAction* action = event->action();
|
||||
if (event->type() == QEvent::ActionAdded)
|
||||
{
|
||||
Q_ASSERT_X(::findButtonByAction(this, action) == Q_NULL, "RibbonStatusBarSwitchGroup",
|
||||
"widgets cannot be inserted multiple times");
|
||||
|
||||
StatusButton* newButton = d.createButton(action);
|
||||
|
||||
int index = layout()->count();
|
||||
if (event->before())
|
||||
{
|
||||
int ind = ::findIndexByAction(this, event->before());
|
||||
if (ind != -1)
|
||||
index = ind;
|
||||
Q_ASSERT_X(index != -1, "RibbonStatusBarSwitchGroup::insertAction", "internal error");
|
||||
}
|
||||
|
||||
d.m_layout->insertWidget(index, newButton);
|
||||
d.updateIndexesButtons();
|
||||
}
|
||||
else if (event->type() == QEvent::ActionRemoved)
|
||||
{
|
||||
if (QToolButton* button = ::findButtonByAction(this, action))
|
||||
{
|
||||
d.m_layout->removeWidget(button);
|
||||
delete button;
|
||||
d.updateIndexesButtons();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonStatusBarSwitchGroup::clear()
|
||||
{
|
||||
QList<QAction*> acts = actions();
|
||||
for (int i = acts.size() - 1; i >= 0; --i)
|
||||
removeAction(acts.at(i));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* RibbonStatusBarPrivate */
|
||||
RibbonStatusBarPrivate::RibbonStatusBarPrivate()
|
||||
{
|
||||
m_dirty = false;
|
||||
m_addPermanentAction = false;
|
||||
m_indexGroupAction = 0;
|
||||
m_sizeGripWidget = Q_NULL;
|
||||
}
|
||||
|
||||
QLayout* RibbonStatusBarPrivate::findLayout()
|
||||
{
|
||||
QTN_P(RibbonStatusBar)
|
||||
|
||||
QLayout* l = p.layout();
|
||||
const QObjectList & children = p.children();
|
||||
for (int i = 0; i < children.size(); ++i)
|
||||
{
|
||||
if (QWidget* child = qobject_cast<QWidget *>(children.at(i)))
|
||||
{
|
||||
if (QLayout* internalLayout = ::qtnfindLayout(l, child))
|
||||
return internalLayout;
|
||||
else if (QSizeGrip* grip = qobject_cast<QSizeGrip*>(child))
|
||||
m_sizeGripWidget = grip;
|
||||
}
|
||||
}
|
||||
return Q_NULL;
|
||||
}
|
||||
|
||||
void RibbonStatusBarPrivate::updateLayout()
|
||||
{
|
||||
if (m_dirty)
|
||||
{
|
||||
if (QLayout* layoutFind = findLayout())
|
||||
{
|
||||
layoutFind->setSpacing(0);
|
||||
layoutFind->setContentsMargins(0, 0, 0, 0);
|
||||
int permanentIndex = 0;
|
||||
for (int i = layoutFind->count() - 1; i >= 0; --i)
|
||||
{
|
||||
QLayoutItem* item = layoutFind->itemAt(i);
|
||||
if (dynamic_cast<QSpacerItem*>(item))
|
||||
permanentIndex++;
|
||||
|
||||
if (QWidget* widget = item->widget())
|
||||
{
|
||||
if (permanentIndex != 2)
|
||||
m_permanentWidgets.append(widget);
|
||||
else
|
||||
m_widgets.append(widget);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_dirty = false;
|
||||
}
|
||||
}
|
||||
|
||||
QRect RibbonStatusBarPrivate::childrenPermanentRect() const
|
||||
{
|
||||
QRect permanentRect;
|
||||
for (int i = 0, count = m_permanentWidgets.count(); count > i; i++)
|
||||
permanentRect |= m_permanentWidgets.at(i)->geometry();
|
||||
|
||||
if (m_sizeGripWidget && m_sizeGripWidget->isVisible())
|
||||
permanentRect |= m_sizeGripWidget->geometry();
|
||||
return permanentRect;
|
||||
|
||||
}
|
||||
|
||||
StatusButton* RibbonStatusBarPrivate::createButton(QAction* action) const
|
||||
{
|
||||
StatusButton* button = new StatusButton();
|
||||
button->setAutoRaise(true);
|
||||
button->setFocusPolicy(Qt::NoFocus);
|
||||
button->setDefaultAction(action);
|
||||
return button;
|
||||
}
|
||||
|
||||
StatusSeparator* RibbonStatusBarPrivate::createSeparator(QAction* action) const
|
||||
{
|
||||
Q_UNUSED(action);
|
||||
StatusSeparator* sep = new StatusSeparator();
|
||||
return sep;
|
||||
}
|
||||
|
||||
/* RibbonStatusBar */
|
||||
RibbonStatusBar::RibbonStatusBar(QWidget* parent)
|
||||
: QStatusBar(parent)
|
||||
{
|
||||
QTN_INIT_PRIVATE(RibbonStatusBar);
|
||||
}
|
||||
|
||||
RibbonStatusBar::~RibbonStatusBar()
|
||||
{
|
||||
QTN_FINI_PRIVATE();
|
||||
}
|
||||
|
||||
QAction* RibbonStatusBar::addAction(const QString& text)
|
||||
{
|
||||
QAction* action = new QAction(text, this);
|
||||
QStatusBar::addAction(action);
|
||||
return action;
|
||||
}
|
||||
|
||||
QAction* RibbonStatusBar::addSeparator()
|
||||
{
|
||||
QAction* action = new QAction(this);
|
||||
action->setSeparator(true);
|
||||
QStatusBar::addAction(action);
|
||||
return action;
|
||||
}
|
||||
|
||||
void RibbonStatusBar::addPermanentAction(QAction* action)
|
||||
{
|
||||
QTN_D(RibbonStatusBar);
|
||||
d.m_addPermanentAction = true;
|
||||
QStatusBar::addAction(action);
|
||||
d.m_addPermanentAction = false;
|
||||
}
|
||||
|
||||
QRect RibbonStatusBar::childrenPermanentRect() const
|
||||
{
|
||||
QTN_D(const RibbonStatusBar);
|
||||
return d.childrenPermanentRect();
|
||||
}
|
||||
|
||||
bool RibbonStatusBar::event(QEvent* event)
|
||||
{
|
||||
QTN_D(RibbonStatusBar);
|
||||
bool result = QStatusBar::event(event);
|
||||
|
||||
if (!d.m_dirty && QEvent::ChildRemoved == event->type())
|
||||
{
|
||||
d.m_dirty = true;
|
||||
d.m_permanentWidgets.clear();
|
||||
d.m_widgets.clear();
|
||||
d.m_sizeGripWidget = Q_NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void RibbonStatusBar::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
QStatusBar::paintEvent(event);
|
||||
}
|
||||
|
||||
void RibbonStatusBar::actionEvent(QActionEvent* event)
|
||||
{
|
||||
QTN_D(RibbonStatusBar);
|
||||
QAction* action = event->action();
|
||||
if (event->type() == QEvent::ActionAdded)
|
||||
{
|
||||
Q_ASSERT_X(::findButtonByAction(this, action) == Q_NULL, "RibbonStatusBar",
|
||||
"widgets cannot be inserted multiple times");
|
||||
|
||||
int index = d.m_addPermanentAction ? d.m_permanentWidgets.count() : d.m_widgets.count();
|
||||
if (event->before())
|
||||
{
|
||||
int ind = ::findIndexByAction(this, event->before());
|
||||
if (ind != -1)
|
||||
index = ind;
|
||||
Q_ASSERT_X(index != -1, "RibbonStatusBar::insertAction", "internal error");
|
||||
}
|
||||
|
||||
if (action->isSeparator())
|
||||
{
|
||||
StatusSeparator* sep = d.createSeparator(action);
|
||||
if (!d.m_addPermanentAction)
|
||||
insertWidget(index, sep);
|
||||
else
|
||||
insertPermanentWidget(index, sep);
|
||||
}
|
||||
else
|
||||
{
|
||||
StatusButton* button = d.createButton(action);
|
||||
if (!d.m_addPermanentAction)
|
||||
insertWidget(index, button);
|
||||
else
|
||||
insertPermanentWidget(index, button);
|
||||
}
|
||||
}
|
||||
else if (event->type() == QEvent::ActionRemoved)
|
||||
{
|
||||
if (QToolButton* button = ::findButtonByAction(this, action))
|
||||
{
|
||||
removeWidget(button);
|
||||
delete button;
|
||||
d.updateLayout();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonStatusBar::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
QTN_D(RibbonStatusBar);
|
||||
QStatusBar::resizeEvent(event);
|
||||
d.updateLayout();
|
||||
}
|
||||
87
third-party/QtitanRibbon/src/ribbon/QtnRibbonStatusBar.h
vendored
Normal file
87
third-party/QtitanRibbon/src/ribbon/QtnRibbonStatusBar.h
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONSTATUSBAR_H
|
||||
#define QTN_RIBBONSTATUSBAR_H
|
||||
|
||||
#include <QStatusBar>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonStatusBarSwitchGroupPrivate;
|
||||
class QTITAN_EXPORT RibbonStatusBarSwitchGroup : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonStatusBarSwitchGroup();
|
||||
virtual ~RibbonStatusBarSwitchGroup();
|
||||
|
||||
public:
|
||||
void clear();
|
||||
|
||||
protected:
|
||||
virtual void actionEvent(QActionEvent* event);
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonStatusBarSwitchGroup)
|
||||
Q_DISABLE_COPY(RibbonStatusBarSwitchGroup)
|
||||
};
|
||||
|
||||
class RibbonStatusBarPrivate;
|
||||
/* RibbonStatusBar */
|
||||
class QTITAN_EXPORT RibbonStatusBar : public QStatusBar
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit RibbonStatusBar(QWidget* parent = Q_NULL);
|
||||
virtual ~RibbonStatusBar();
|
||||
|
||||
public:
|
||||
QAction* addAction(const QString& text);
|
||||
QAction* addSeparator();
|
||||
|
||||
void addPermanentAction(QAction* action);
|
||||
|
||||
QRect childrenPermanentRect() const;
|
||||
|
||||
public:
|
||||
using QWidget::addAction;
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void actionEvent(QActionEvent* event);
|
||||
virtual void resizeEvent(QResizeEvent *);
|
||||
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonStatusBar)
|
||||
Q_DISABLE_COPY(RibbonStatusBar)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONSTATUSBAR_H
|
||||
1397
third-party/QtitanRibbon/src/ribbon/QtnRibbonSystemPopupBar.cpp
vendored
Normal file
1397
third-party/QtitanRibbon/src/ribbon/QtnRibbonSystemPopupBar.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
179
third-party/QtitanRibbon/src/ribbon/QtnRibbonSystemPopupBar.h
vendored
Normal file
179
third-party/QtitanRibbon/src/ribbon/QtnRibbonSystemPopupBar.h
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONSYSTEMPOPUPBAR_H
|
||||
#define QTN_RIBBONSYSTEMPOPUPBAR_H
|
||||
|
||||
#include <QMenu>
|
||||
#include <QToolButton>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonBackstageView;
|
||||
class RibbonSystemButtonPrivate;
|
||||
class QTITAN_EXPORT RibbonSystemButton : public QToolButton
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle)
|
||||
public:
|
||||
explicit RibbonSystemButton(QWidget* parent);
|
||||
virtual ~RibbonSystemButton();
|
||||
|
||||
public:
|
||||
void setBackstage(RibbonBackstageView* backstage);
|
||||
RibbonBackstageView* backstage() const;
|
||||
|
||||
void setBackgroundColor(const QColor& color);
|
||||
QColor backgroundColor() const;
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonSystemButton)
|
||||
QTN_DECLARE_PRIVATE(RibbonSystemButton)
|
||||
};
|
||||
|
||||
class RibbonPageSystemRecentFileList;
|
||||
class RibbonPageSystemPopup;
|
||||
class RibbonSystemPopupBarPrivate;
|
||||
class QTITAN_EXPORT RibbonSystemPopupBar : public QMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RibbonSystemPopupBar(QWidget* parent);
|
||||
virtual ~RibbonSystemPopupBar();
|
||||
|
||||
public:
|
||||
QAction* addPopupBarAction(const QString& text);
|
||||
void addPopupBarAction(QAction* action, Qt::ToolButtonStyle style = Qt::ToolButtonTextOnly);
|
||||
|
||||
RibbonPageSystemRecentFileList* addPageRecentFile(const QString& caption);
|
||||
RibbonPageSystemPopup* addPageSystemPopup(const QString& caption, QAction* defaultAction, bool splitAction);
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event);
|
||||
virtual void keyPressEvent(QKeyEvent* event);
|
||||
virtual void resizeEvent(QResizeEvent* event);
|
||||
|
||||
private:
|
||||
friend class RibbonPageSystemPopup;
|
||||
Q_DISABLE_COPY(RibbonSystemPopupBar)
|
||||
QTN_DECLARE_PRIVATE(RibbonSystemPopupBar)
|
||||
};
|
||||
|
||||
class QTITAN_EXPORT RibbonPageSystemPopupListCaption : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RibbonPageSystemPopupListCaption(const QString& caption);
|
||||
virtual ~RibbonPageSystemPopupListCaption();
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual void drawEvent(QPaintEvent* event, QPainter* p);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
|
||||
private:
|
||||
friend class RibbonSystemPopupBar;
|
||||
Q_DISABLE_COPY(RibbonPageSystemPopupListCaption)
|
||||
};
|
||||
|
||||
class RibbonPageSystemRecentFileListPrivate;
|
||||
class QTITAN_EXPORT RibbonPageSystemRecentFileList : public RibbonPageSystemPopupListCaption
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RibbonPageSystemRecentFileList(const QString& caption);
|
||||
virtual ~RibbonPageSystemRecentFileList();
|
||||
|
||||
public:
|
||||
void setSize(int size);
|
||||
int getSize() const;
|
||||
|
||||
QAction* getCurrentAction() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateRecentFileActions(const QStringList& files);
|
||||
|
||||
Q_SIGNALS:
|
||||
void openRecentFile(const QString& file);
|
||||
|
||||
protected:
|
||||
virtual void drawEvent(QPaintEvent* event, QPainter* p);
|
||||
|
||||
protected:
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
virtual void mouseMoveEvent(QMouseEvent* event);
|
||||
virtual void mouseReleaseEvent(QMouseEvent* event);
|
||||
virtual void enterEvent(QEvent* event);
|
||||
virtual void leaveEvent(QEvent* event);
|
||||
virtual void keyPressEvent(QKeyEvent* event);
|
||||
|
||||
virtual void resizeEvent(QResizeEvent* event);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonPageSystemRecentFileList)
|
||||
QTN_DECLARE_PRIVATE(RibbonPageSystemRecentFileList)
|
||||
};
|
||||
|
||||
class RibbonPageSystemPopupPrivate;
|
||||
class QTITAN_EXPORT RibbonPageSystemPopup : public QMenu
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RibbonPageSystemPopup(const QString& caption, QWidget* parent = Q_NULL);
|
||||
virtual ~RibbonPageSystemPopup();
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void leaveEvent(QEvent* event);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonPageSystemPopup)
|
||||
QTN_DECLARE_PRIVATE(RibbonPageSystemPopup)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONSYSTEMPOPUPBAR_H
|
||||
1289
third-party/QtitanRibbon/src/ribbon/QtnRibbonTabBar.cpp
vendored
Normal file
1289
third-party/QtitanRibbon/src/ribbon/QtnRibbonTabBar.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
219
third-party/QtitanRibbon/src/ribbon/QtnRibbonTabBar.h
vendored
Normal file
219
third-party/QtitanRibbon/src/ribbon/QtnRibbonTabBar.h
vendored
Normal file
@@ -0,0 +1,219 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONTABBAR_H
|
||||
#define QTN_RIBBONTABBAR_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QMenu>
|
||||
|
||||
#include "QtitanDef.h"
|
||||
#include "QtnRibbonPage.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonTabPrivate;
|
||||
class RibbonTab;
|
||||
|
||||
class ContextHeader
|
||||
{
|
||||
public:
|
||||
ContextHeader(RibbonTab* tab);
|
||||
virtual ~ContextHeader();
|
||||
|
||||
public:
|
||||
RibbonTab* firstTab;
|
||||
RibbonTab* lastTab;
|
||||
RibbonPage::ContextColor color;
|
||||
QString strTitle;
|
||||
QString strGroupName;
|
||||
QRect rcRect;
|
||||
};
|
||||
|
||||
/* RibbonTab */
|
||||
class RibbonTab : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
protected:
|
||||
RibbonTab(const QString& text, QWidget* parent);
|
||||
virtual ~RibbonTab();
|
||||
|
||||
public:
|
||||
void setPage(RibbonPage* page);
|
||||
|
||||
void setSelect(bool);
|
||||
bool select() const;
|
||||
|
||||
int indent() const;
|
||||
void setIndent(int);
|
||||
|
||||
int margin() const;
|
||||
void setMargin(int);
|
||||
|
||||
Qt::Alignment alignment() const;
|
||||
void setAlignment(Qt::Alignment);
|
||||
|
||||
void setTextTab(const QString&);
|
||||
const QString& textTab() const;
|
||||
|
||||
void setContextTextTab(const QString&);
|
||||
const QString& contextTextTab() const;
|
||||
|
||||
void setContextGroupName(const QString&);
|
||||
const QString& contextGroupName() const;
|
||||
|
||||
void setContextTab(RibbonPage::ContextColor color);
|
||||
RibbonPage::ContextColor contextColor() const;
|
||||
|
||||
void setContextHeader(ContextHeader* contextHeaders);
|
||||
ContextHeader* getContextHeader() const;
|
||||
|
||||
void setTrackingMode(bool tracking);
|
||||
bool isTrackingMode() const;
|
||||
|
||||
void setTabWidth(int width);
|
||||
int tabWidth() const;
|
||||
|
||||
QAction* defaultAction() const;
|
||||
|
||||
protected:
|
||||
int shortcut() const;
|
||||
bool validRect() const;
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
signals:
|
||||
void pressTab(QWidget* widget);
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
|
||||
virtual QSize minimumSizeHint() const;
|
||||
|
||||
virtual void enterEvent(QEvent*);
|
||||
virtual void leaveEvent(QEvent*);
|
||||
virtual void mousePressEvent(QMouseEvent* );
|
||||
virtual void mouseReleaseEvent(QMouseEvent*);
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent*);
|
||||
|
||||
protected:
|
||||
int lastTab;
|
||||
|
||||
private:
|
||||
friend class RibbonStyle;
|
||||
friend class RibbonPage;
|
||||
friend class RibbonTabBar;
|
||||
friend class RibbonQuickAccessBar;
|
||||
friend class RibbonSystemButton;
|
||||
friend class RibbonTabBarPrivate;
|
||||
QTN_DECLARE_PRIVATE(RibbonTab)
|
||||
Q_DISABLE_COPY(RibbonTab)
|
||||
};
|
||||
|
||||
|
||||
class RibbonPage;
|
||||
class RibbonSystemPopupBar;
|
||||
class RibbonTabBarPrivate;
|
||||
/* RibbonTabBar */
|
||||
class RibbonTabBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged)
|
||||
Q_PROPERTY(SelectionBehavior selectionBehaviorOnRemove READ selectionBehaviorOnRemove WRITE setSelectionBehaviorOnRemove)
|
||||
protected:
|
||||
RibbonTabBar(QWidget* parent);
|
||||
virtual ~RibbonTabBar();
|
||||
|
||||
enum SelectionBehavior
|
||||
{
|
||||
SelectLeftTab,
|
||||
SelectRightTab,
|
||||
SelectPreviousTab
|
||||
};
|
||||
|
||||
protected:
|
||||
int addTab(const QString& text);
|
||||
int addTab(const QIcon& icon, const QString& text);
|
||||
|
||||
int insertTab(int index, const QString& text);
|
||||
int insertTab(int index, const QIcon& icon, const QString& text);
|
||||
|
||||
void moveTab(int index, int newIndex);
|
||||
void removeTab(int index);
|
||||
|
||||
int currentIndex() const;
|
||||
|
||||
RibbonTab* getTab(int nIndex) const;
|
||||
int getTabCount() const;
|
||||
int getIndex(const RibbonTab* tab) const;
|
||||
|
||||
SelectionBehavior selectionBehaviorOnRemove() const;
|
||||
void setSelectionBehaviorOnRemove(SelectionBehavior behavior);
|
||||
|
||||
void setEnabledWidgets(bool enabled);
|
||||
|
||||
protected:
|
||||
QAction* addAction(const QIcon& icon, const QString& text, Qt::ToolButtonStyle style, QMenu* menu = Q_NULL);
|
||||
QAction* addAction(QAction* action, Qt::ToolButtonStyle style);
|
||||
QMenu* addMenu(const QString& title);
|
||||
|
||||
public Q_SLOTS:
|
||||
void setCurrentIndex(int index);
|
||||
void currentNextTab(bool next);
|
||||
|
||||
private Q_SLOTS:
|
||||
void activateTab(QWidget* widget);
|
||||
|
||||
Q_SIGNALS:
|
||||
void currentChanged(int index);
|
||||
void activating(bool& allow);
|
||||
|
||||
protected:
|
||||
void layoutWidgets();
|
||||
void refresh();
|
||||
bool validWidth() const;
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void mouseDoubleClickEvent(QMouseEvent* event);
|
||||
|
||||
private:
|
||||
friend class RibbonTab;
|
||||
friend class RibbonBar;
|
||||
friend class RibbonBarPrivate;
|
||||
friend class RibbonPaintManager2013;
|
||||
QTN_DECLARE_PRIVATE(RibbonTabBar)
|
||||
Q_DISABLE_COPY(RibbonTabBar)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONTABBAR_H
|
||||
889
third-party/QtitanRibbon/src/ribbon/QtnRibbonToolTip.cpp
vendored
Normal file
889
third-party/QtitanRibbon/src/ribbon/QtnRibbonToolTip.cpp
vendored
Normal file
@@ -0,0 +1,889 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QApplication>
|
||||
#include <QGuiApplication>
|
||||
#include <QScreen>
|
||||
#include <QHash>
|
||||
#include <QStylePainter>
|
||||
#include <QTextDocument>
|
||||
#include <QToolTip>
|
||||
#include <QMouseEvent>
|
||||
#include <QBitmap>
|
||||
|
||||
#include "QtnRibbonToolTip.h"
|
||||
#include "QtnRibbonStyle.h"
|
||||
#include "QtnRibbonPrivate.h"
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
struct QEffects
|
||||
{
|
||||
enum Direction {
|
||||
LeftScroll = 0x0001,
|
||||
RightScroll = 0x0002,
|
||||
UpScroll = 0x0004,
|
||||
DownScroll = 0x0008
|
||||
};
|
||||
|
||||
typedef uint DirFlags;
|
||||
};
|
||||
|
||||
extern void Q_GUI_EXPORT qScrollEffect(QWidget*, QEffects::DirFlags dir = QEffects::DownScroll, int time = -1);
|
||||
extern void Q_GUI_EXPORT qFadeEffect(QWidget*, int time = -1);
|
||||
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonToolTipPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonToolTip)
|
||||
public:
|
||||
explicit RibbonToolTipPrivate();
|
||||
|
||||
public:
|
||||
void updateTool();
|
||||
|
||||
public:
|
||||
int m_margin;
|
||||
int m_indent;
|
||||
int m_maxTipWidth;
|
||||
QBasicTimer m_hideTimer, m_expireTimer;
|
||||
bool m_fadingOut;
|
||||
QWidget* m_widget;
|
||||
QRect m_rect;
|
||||
QString m_text;
|
||||
QString m_textTitle;
|
||||
QIcon m_icon;
|
||||
static RibbonToolTip* m_instance;
|
||||
static RibbonToolTip::WrapMode m_wrapMode;
|
||||
static bool m_showIcon;
|
||||
QLabel* m_label;
|
||||
|
||||
};
|
||||
|
||||
class RibbonKeyTipPrivate : public QObject
|
||||
{
|
||||
public:
|
||||
QTN_DECLARE_PUBLIC(RibbonKeyTip)
|
||||
public:
|
||||
explicit RibbonKeyTipPrivate();
|
||||
public:
|
||||
QString strTip_;
|
||||
QString strCaption_;
|
||||
QString strPrefix_;
|
||||
QWidget* owner_;
|
||||
QAction* action_;
|
||||
QPoint pt_;
|
||||
bool enabled_;
|
||||
bool visible_;
|
||||
QWidget* bars_;
|
||||
uint align_;
|
||||
bool explicit_;
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
RibbonToolTip* RibbonToolTipPrivate::m_instance = Q_NULL;
|
||||
RibbonToolTip::WrapMode RibbonToolTipPrivate::m_wrapMode = RibbonToolTip::NoWrap;
|
||||
bool RibbonToolTipPrivate::m_showIcon = true;
|
||||
RibbonToolTipPrivate::RibbonToolTipPrivate()
|
||||
{
|
||||
m_margin = 0;
|
||||
m_fadingOut = false;
|
||||
m_widget = Q_NULL;
|
||||
m_indent = -1;
|
||||
m_maxTipWidth = 160;
|
||||
m_label = Q_NULL;
|
||||
}
|
||||
|
||||
void RibbonToolTipPrivate::updateTool()
|
||||
{
|
||||
QTN_P(RibbonToolTip);
|
||||
if (m_label)
|
||||
{
|
||||
m_label->setText(m_text);
|
||||
m_label->setWordWrap(/*Qt::mightBeRichText(m_text)*/true);
|
||||
m_label->adjustSize();
|
||||
}
|
||||
|
||||
p.updateGeometry();
|
||||
p.update(p.contentsRect());
|
||||
}
|
||||
|
||||
|
||||
/* RibbonToolTip */
|
||||
/*!
|
||||
\brief Constructs RibbonToolTip object with the given \a parent. Parameter \a title - is a title of the tooltip, \a text - is a text of the tooltip.
|
||||
*/
|
||||
RibbonToolTip::RibbonToolTip(const QString& title, const QString& text, const QIcon& icon, QWidget* parent)
|
||||
: QFrame(parent, Qt::ToolTip | Qt::BypassGraphicsProxyWidget)
|
||||
{
|
||||
delete RibbonToolTipPrivate::m_instance;
|
||||
RibbonToolTipPrivate::m_instance = this;
|
||||
|
||||
QTN_INIT_PRIVATE(RibbonToolTip);
|
||||
QTN_D(RibbonToolTip);
|
||||
|
||||
if (d.m_label)
|
||||
{
|
||||
d.m_label->setForegroundRole(QPalette::ToolTipText);
|
||||
d.m_label->setBackgroundRole(QPalette::ToolTipBase);
|
||||
d.m_label->setPalette(QToolTip::palette());
|
||||
d.m_label->setFont(QToolTip::font());
|
||||
d.m_label->ensurePolished();
|
||||
d.m_label->setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this));
|
||||
d.m_label->setFrameStyle(QFrame::NoFrame);
|
||||
}
|
||||
|
||||
setForegroundRole(QPalette::ToolTipText);
|
||||
setBackgroundRole(QPalette::ToolTipBase);
|
||||
setPalette(QToolTip::palette());
|
||||
setFont(QToolTip::font());
|
||||
ensurePolished();
|
||||
setMargin(1 + style()->pixelMetric(QStyle::PM_ToolTipLabelFrameWidth, 0, this));
|
||||
setFrameStyle(QFrame::NoFrame);
|
||||
qApp->installEventFilter(this);
|
||||
setWindowOpacity(style()->styleHint(QStyle::SH_ToolTipLabel_Opacity, 0, this) / 255.0);
|
||||
setMouseTracking(true);
|
||||
d.m_fadingOut = false;
|
||||
setIcon(isIconVisible() ? icon : QIcon());
|
||||
reuseTip(title, text);
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Destructor of the RibbonToolTip object.
|
||||
*/
|
||||
RibbonToolTip::~RibbonToolTip()
|
||||
{
|
||||
RibbonToolTipPrivate::m_instance = Q_NULL;
|
||||
QTN_FINI_PRIVATE();
|
||||
}
|
||||
|
||||
RibbonToolTip* RibbonToolTip::instance()
|
||||
{
|
||||
return RibbonToolTipPrivate::m_instance;
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Shows tooltip in \a pos position. Parameter \a title - is a title of the tooltip, \a text - is a text of the tooltip, \a icon - the icon of the tooltip. Parameter \a widget - reference to the widget for calculating the position of tooltip.
|
||||
*/
|
||||
void RibbonToolTip::showToolTip(const QPoint &pos, const QString& title, const QString& text, const QIcon& icon, QWidget* w)
|
||||
{
|
||||
QRect rect;
|
||||
// a tip does already exist
|
||||
if (RibbonToolTipPrivate::m_instance && RibbonToolTipPrivate::m_instance->isVisible())
|
||||
{
|
||||
// empty text means hide current tip
|
||||
if (text.isEmpty())
|
||||
{
|
||||
RibbonToolTipPrivate::m_instance->hideTip();
|
||||
return;
|
||||
}
|
||||
else if (!RibbonToolTipPrivate::m_instance->fadingOut())
|
||||
{
|
||||
// If the tip has changed, reuse the one
|
||||
// that is showing (removes flickering)
|
||||
QPoint localPos = pos;
|
||||
if (w)
|
||||
localPos = w->mapFromGlobal(pos);
|
||||
if (RibbonToolTipPrivate::m_instance->tipChanged(localPos, text, title, w))
|
||||
{
|
||||
RibbonToolTipPrivate::m_instance->setIcon(isIconVisible() ? icon : QIcon());
|
||||
RibbonToolTipPrivate::m_instance->reuseTip(title, text);
|
||||
RibbonToolTipPrivate::m_instance->setTipRect(w, rect);
|
||||
RibbonToolTipPrivate::m_instance->placeTip(pos, w);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
// no tip can be reused, create new tip:
|
||||
if (!text.isEmpty())
|
||||
{
|
||||
#ifndef Q_WS_WIN
|
||||
new RibbonToolTip(title, text, icon, w); // sets TipLabel::m_pInstanceto itself
|
||||
#else
|
||||
// On windows, we can't use the widget as parent otherwise the window will be
|
||||
// raised when the tooltip will be shown
|
||||
QScreen* screenAtPos = QGuiApplication::screenAt(RibbonToolTip::getTipScreen(pos, w));
|
||||
new RibbonToolTip(title, text, icon, screenAtPos);
|
||||
#endif
|
||||
RibbonToolTipPrivate::m_instance->setTipRect(w, rect);
|
||||
RibbonToolTipPrivate::m_instance->placeTip(pos, w);
|
||||
RibbonToolTipPrivate::m_instance->setObjectName("qtntooltip_label");
|
||||
|
||||
|
||||
#if !defined(QT_NO_EFFECTS) && !defined(Q_WS_MAC)
|
||||
if (QApplication::isEffectEnabled(Qt::UI_FadeTooltip))
|
||||
qFadeEffect(RibbonToolTipPrivate::m_instance);
|
||||
else if (QApplication::isEffectEnabled(Qt::UI_AnimateTooltip))
|
||||
qScrollEffect(RibbonToolTipPrivate::m_instance);
|
||||
else
|
||||
RibbonToolTipPrivate::m_instance->show();
|
||||
#else
|
||||
RibbonToolTipPrivate::m_instance->show();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Hides the tooltip window.
|
||||
*/
|
||||
void RibbonToolTip::hideToolTip()
|
||||
{
|
||||
showToolTip(QPoint(), QString(), QString(), QIcon());
|
||||
}
|
||||
|
||||
/*!
|
||||
\brief Returns visibility of the tooltip at the moment.
|
||||
*/
|
||||
bool RibbonToolTip::isToolTipVisible()
|
||||
{
|
||||
return (RibbonToolTipPrivate::m_instance != 0 && RibbonToolTipPrivate::m_instance->isVisible());
|
||||
}
|
||||
/*
|
||||
QString RibbonToolTip::textToolTip()
|
||||
{
|
||||
if (RibbonToolTipPrivate::m_instance)
|
||||
return RibbonToolTipPrivate::m_instance->text();
|
||||
return QString();
|
||||
}
|
||||
*/
|
||||
/*!
|
||||
Sets the wrap \a mode for the tolltip's text.
|
||||
*/
|
||||
void RibbonToolTip::setWrapMode(WrapMode mode)
|
||||
{
|
||||
RibbonToolTipPrivate::m_wrapMode = mode;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the wrap mode for the tooltip's text.
|
||||
*/
|
||||
RibbonToolTip::WrapMode RibbonToolTip::wordWrap()
|
||||
{
|
||||
return RibbonToolTipPrivate::m_wrapMode;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the visibility of the tooltip's icon to \a visible. Method is static.
|
||||
*/
|
||||
void RibbonToolTip::setIconVisible(bool visible)
|
||||
{
|
||||
RibbonToolTipPrivate::m_showIcon = visible;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the visibility of the tooltip's icon. Method is static.
|
||||
*/
|
||||
bool RibbonToolTip::isIconVisible()
|
||||
{
|
||||
return RibbonToolTipPrivate::m_showIcon;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the margin \a mode for the tolltip's text in pixels.
|
||||
*/
|
||||
int RibbonToolTip::margin() const
|
||||
{
|
||||
QTN_D(const RibbonToolTip);
|
||||
return d.m_margin;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the margin \a mode for the tolltip's text in in pixels.
|
||||
*/
|
||||
void RibbonToolTip::setMargin(int margin)
|
||||
{
|
||||
QTN_D(RibbonToolTip);
|
||||
if (d.m_margin == margin)
|
||||
return;
|
||||
d.m_margin = margin;
|
||||
d.updateTool();
|
||||
}
|
||||
|
||||
void RibbonToolTip::setTitle(const QString& text)
|
||||
{
|
||||
QTN_D(RibbonToolTip);
|
||||
if (d.m_textTitle == text)
|
||||
return;
|
||||
d.m_textTitle = text;
|
||||
d.updateTool();
|
||||
}
|
||||
|
||||
const QString& RibbonToolTip::title() const
|
||||
{
|
||||
QTN_D(const RibbonToolTip);
|
||||
return d.m_textTitle;
|
||||
}
|
||||
|
||||
void RibbonToolTip::setText(const QString& text)
|
||||
{
|
||||
QTN_D(RibbonToolTip);
|
||||
if (d.m_text == text)
|
||||
return;
|
||||
d.m_text = text;
|
||||
d.updateTool();
|
||||
}
|
||||
|
||||
const QString& RibbonToolTip::text() const
|
||||
{
|
||||
QTN_D(const RibbonToolTip);
|
||||
return d.m_text;
|
||||
}
|
||||
|
||||
void RibbonToolTip::setIcon(const QIcon& icon)
|
||||
{
|
||||
QTN_D(RibbonToolTip);
|
||||
d.m_icon = icon;
|
||||
d.updateTool();
|
||||
}
|
||||
|
||||
const QIcon& RibbonToolTip::icon() const
|
||||
{
|
||||
QTN_D(const RibbonToolTip);
|
||||
return d.m_icon;
|
||||
}
|
||||
|
||||
void RibbonToolTip::restartExpireTimer()
|
||||
{
|
||||
QTN_D(RibbonToolTip);
|
||||
int time = 10000 + 40 * qMax(0, text().length()-100);
|
||||
d.m_expireTimer.start(time, this);
|
||||
d.m_hideTimer.stop();
|
||||
}
|
||||
|
||||
void RibbonToolTip::reuseTip(const QString& textTitle, const QString& text)
|
||||
{
|
||||
setText(text);
|
||||
setTitle(textTitle);
|
||||
QFontMetrics fm(font());
|
||||
QSize extra(1, 0);
|
||||
// Make it look good with the default RibbonToolTip font on Mac, which has a small descent.
|
||||
if (fm.descent() == 2 && fm.ascent() >= 11)
|
||||
++extra.rheight();
|
||||
|
||||
resize(sizeHint() + extra);
|
||||
restartExpireTimer();
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
QSize RibbonToolTip::sizeHint() const
|
||||
{
|
||||
QTN_D(const RibbonToolTip);
|
||||
|
||||
QFontMetrics fm = fontMetrics();
|
||||
|
||||
QRect rcMargin(margin(), margin(), margin(), margin());
|
||||
QSize szMargin(3 + rcMargin.left() + rcMargin.right() + 3, 3 + rcMargin.top() + rcMargin.bottom() + 3);
|
||||
|
||||
int flags = Qt::TextExpandTabs | Qt::TextHideMnemonic;
|
||||
|
||||
bool drawTitle = !d.m_textTitle.isEmpty();
|
||||
bool drawImage = !d.m_icon.isNull();
|
||||
bool drawImageTop = true;
|
||||
QSize szImage(0, 0);
|
||||
QSize szTitle(0, 0);
|
||||
|
||||
if (drawTitle)
|
||||
{
|
||||
QFont titleFont(font());
|
||||
titleFont.setBold(true);
|
||||
QFontMetrics titleFM(titleFont);
|
||||
|
||||
int w = titleFM.averageCharWidth() * 80;
|
||||
QRect rcTitle = titleFM.boundingRect(0, 0, w, 2000, flags | Qt::TextSingleLine, d.m_textTitle);
|
||||
szTitle = QSize(rcTitle.width(), rcTitle.height() + 20);
|
||||
}
|
||||
|
||||
if (drawImage)
|
||||
{
|
||||
QSize szIcon(0, 0);
|
||||
if (!d.m_icon.availableSizes().isEmpty())
|
||||
szIcon = d.m_icon.availableSizes().first();
|
||||
|
||||
drawImageTop = (szIcon.height() <= 16);
|
||||
|
||||
if (drawImageTop)
|
||||
{
|
||||
if (!drawTitle)
|
||||
szImage.setWidth(szIcon.height() + 3);
|
||||
else
|
||||
szTitle.setWidth(szTitle.width() + szIcon.width() + 1);
|
||||
}
|
||||
else
|
||||
szImage.setWidth(szIcon.width() + 5);
|
||||
szImage.setHeight(szIcon.height());
|
||||
}
|
||||
|
||||
QSize szText;
|
||||
if (!d.m_label)
|
||||
{
|
||||
int nMaxTipWidth = d.m_maxTipWidth;
|
||||
QRect rcText(QPoint(0, 0), QSize(nMaxTipWidth - szMargin.width(), 0));
|
||||
rcText = fm.boundingRect(rcText.left(), rcText.top(), rcText.width(), rcText.height(), flags | Qt::TextWordWrap, d.m_text);
|
||||
szText = rcText.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
szText = d.m_label->sizeHint();
|
||||
}
|
||||
|
||||
QSize sz(0, 0);
|
||||
sz.setHeight(qMax(szImage.height(), szText.height()));
|
||||
sz.setWidth(szImage.width() + szText.width());
|
||||
|
||||
if (drawTitle)
|
||||
{
|
||||
sz.setWidth(qMax(sz.width(), szTitle.width()));
|
||||
sz.setHeight(sz.height() + szTitle.height());
|
||||
}
|
||||
|
||||
sz += szMargin;
|
||||
return sz;
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void RibbonToolTip::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QTN_D(RibbonToolTip);
|
||||
|
||||
QStylePainter p(this);
|
||||
drawFrame(&p);
|
||||
|
||||
QStyleOptionFrame opt;
|
||||
opt.initFrom(this);
|
||||
p.drawPrimitive(QStyle::PE_PanelTipLabel, opt);
|
||||
|
||||
QRect rc = contentsRect();
|
||||
rc.adjust(margin(), margin(), -margin(), -margin());
|
||||
rc.adjust(3, 3, -3, -3);
|
||||
|
||||
QRect rcTitle(rc.left() + 2, rc.top() + 2, rc.right() - 2, rc.bottom());
|
||||
|
||||
int flags = Qt::TextExpandTabs | Qt::TextHideMnemonic;
|
||||
|
||||
bool drawTitle = !d.m_textTitle.isEmpty();
|
||||
bool drawImage = !d.m_icon.isNull();
|
||||
bool drawImageTop = true;
|
||||
QSize szImage(0, 0);
|
||||
|
||||
if (drawImage)
|
||||
{
|
||||
if (!d.m_icon.availableSizes().isEmpty())
|
||||
szImage = d.m_icon.availableSizes().first();
|
||||
|
||||
drawImageTop = (szImage.height() <= 16);
|
||||
|
||||
if (drawImageTop)
|
||||
{
|
||||
QPoint ptIcon = rc.topLeft();
|
||||
QPixmap pm = d.m_icon.pixmap(szImage, QIcon::Normal, QIcon::On);
|
||||
p.drawPixmap(ptIcon, pm);
|
||||
|
||||
if (drawTitle)
|
||||
rcTitle.setLeft(rcTitle.left()+szImage.width() + 1);
|
||||
else
|
||||
rc.setLeft(rc.left()+szImage.width() + 3);
|
||||
}
|
||||
}
|
||||
if (drawTitle)
|
||||
{
|
||||
QFont oldFont = p.font();
|
||||
QFont fnt = oldFont;
|
||||
fnt.setBold(true);
|
||||
p.setFont(fnt);
|
||||
style()->drawItemText(&p, rcTitle, flags | Qt::TextSingleLine, opt.palette, isEnabled(), d.m_textTitle, QPalette::ToolTipText);
|
||||
p.setFont(oldFont);
|
||||
|
||||
rc.setTop(rc.top() + p.boundingRect(rcTitle, flags | Qt::TextSingleLine, d.m_textTitle).height());
|
||||
rc.adjust(0, 12, 0, 0);
|
||||
}
|
||||
|
||||
if (drawImage && !drawImageTop)
|
||||
{
|
||||
QPoint ptIcon = rc.topLeft();
|
||||
QPixmap pm = d.m_icon.pixmap(szImage, QIcon::Normal, QIcon::On);
|
||||
p.drawPixmap(ptIcon, pm);
|
||||
rc.setLeft(rc.left() + szImage.width() + 4);
|
||||
}
|
||||
|
||||
if (d.m_label)
|
||||
d.m_label->move(rc.topLeft());
|
||||
else
|
||||
style()->drawItemText(&p, rc, flags | Qt::TextWordWrap, opt.palette, isEnabled(), d.m_text, QPalette::ToolTipText);
|
||||
p.end();
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void RibbonToolTip::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
QStyleHintReturnMask frameMask;
|
||||
QStyleOption option;
|
||||
option.initFrom(this);
|
||||
if (style()->styleHint(QStyle::SH_ToolTip_Mask, &option, this, &frameMask))
|
||||
setMask(frameMask.region);
|
||||
|
||||
QFrame::resizeEvent(event);
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void RibbonToolTip::mouseMoveEvent(QMouseEvent* event)
|
||||
{
|
||||
QTN_D(RibbonToolTip);
|
||||
if (d.m_rect.isNull())
|
||||
return;
|
||||
QPoint pos = event->globalPos();
|
||||
if (d.m_widget)
|
||||
pos = d.m_widget->mapFromGlobal(pos);
|
||||
if (!d.m_rect.contains(pos))
|
||||
hideTip();
|
||||
QFrame::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void RibbonToolTip::hideTip()
|
||||
{
|
||||
QTN_D(RibbonToolTip);
|
||||
if (!d.m_hideTimer.isActive())
|
||||
d.m_hideTimer.start(300, this);
|
||||
}
|
||||
|
||||
void RibbonToolTip::closeToolTip()
|
||||
{
|
||||
close(); // to trigger QEvent::Close which stops the animation
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
void RibbonToolTip::setTipRect(QWidget* w, const QRect& r)
|
||||
{
|
||||
QTN_D(RibbonToolTip);
|
||||
if (!d.m_rect.isNull() && !w)
|
||||
qWarning("RibbonToolTip::setTipRect: Cannot pass null widget if rect is set");
|
||||
else
|
||||
{
|
||||
d.m_widget = w;
|
||||
d.m_rect = r;
|
||||
}
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
void RibbonToolTip::timerEvent(QTimerEvent* event)
|
||||
{
|
||||
QTN_D(RibbonToolTip);
|
||||
if (event->timerId() == d.m_hideTimer.timerId() || event->timerId() == d.m_expireTimer.timerId())
|
||||
{
|
||||
d.m_hideTimer.stop();
|
||||
d.m_expireTimer.stop();
|
||||
closeToolTip();
|
||||
}
|
||||
}
|
||||
|
||||
/*! \reimp */
|
||||
bool RibbonToolTip::eventFilter(QObject *o, QEvent* event)
|
||||
{
|
||||
QTN_D(RibbonToolTip);
|
||||
switch (event->type())
|
||||
{
|
||||
case QEvent::Leave:
|
||||
hideTip();
|
||||
break;
|
||||
case QEvent::WindowActivate:
|
||||
case QEvent::WindowDeactivate:
|
||||
case QEvent::MouseButtonPress:
|
||||
case QEvent::MouseButtonRelease:
|
||||
case QEvent::MouseButtonDblClick:
|
||||
case QEvent::FocusIn:
|
||||
case QEvent::FocusOut:
|
||||
case QEvent::Wheel:
|
||||
closeToolTip();
|
||||
break;
|
||||
case QEvent::MouseMove:
|
||||
if (o == d.m_widget && !d.m_rect.isNull() && !d.m_rect.contains(static_cast<QMouseEvent*>(event)->pos()))
|
||||
hideTip();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int RibbonToolTip::getTipScreen(const QPoint& pos, QWidget* w)
|
||||
{
|
||||
if (QGuiApplication::screens().size() > 1) {
|
||||
QScreen* screenAtPos = QGuiApplication::screenAt(pos);
|
||||
return QGuiApplication::screens().indexOf(screenAtPos);
|
||||
} else {
|
||||
QScreen* screenAtWidget = QGuiApplication::screenAt(w->geometry().center());
|
||||
return QGuiApplication::screens().indexOf(screenAtWidget);
|
||||
}
|
||||
}
|
||||
|
||||
void RibbonToolTip::placeTip(const QPoint& pos, QWidget* w)
|
||||
{
|
||||
int screenNumber = getTipScreen(pos, w);
|
||||
QList<QScreen*> screens = QGuiApplication::screens();
|
||||
QRect screen;
|
||||
|
||||
if (screenNumber >= 0 && screenNumber < screens.size()) {
|
||||
screen = screens[screenNumber]->geometry();
|
||||
} else {
|
||||
// Fallback to primary screen if the screen number is invalid
|
||||
QScreen* primaryScreen = QGuiApplication::primaryScreen();
|
||||
if (primaryScreen) {
|
||||
screen = primaryScreen->geometry();
|
||||
}
|
||||
}
|
||||
|
||||
QPoint p = pos;
|
||||
if (p.x() + this->width() > screen.x() + screen.width())
|
||||
p.rx() -= 4 + this->width();
|
||||
if (p.y() + this->height() > screen.y() + screen.height())
|
||||
p.ry() -= 24 + this->height();
|
||||
if (p.y() < screen.y())
|
||||
p.setY(screen.y());
|
||||
if (p.x() + this->width() > screen.x() + screen.width())
|
||||
p.setX(screen.x() + screen.width() - this->width());
|
||||
if (p.x() < screen.x())
|
||||
p.setX(screen.x());
|
||||
if (p.y() + this->height() > screen.y() + screen.height())
|
||||
p.setY(screen.y() + screen.height() - this->height());
|
||||
|
||||
this->move(p);
|
||||
}
|
||||
|
||||
bool RibbonToolTip::tipChanged(const QPoint& pos, const QString& text, const QString& textTitle, QObject* o)
|
||||
{
|
||||
QTN_D(RibbonToolTip);
|
||||
if (RibbonToolTipPrivate::m_instance->text() != text)
|
||||
return true;
|
||||
|
||||
if (RibbonToolTipPrivate::m_instance->title() != textTitle)
|
||||
return true;
|
||||
|
||||
if (o != d.m_widget)
|
||||
return true;
|
||||
|
||||
if (!d.m_rect.isNull())
|
||||
return !d.m_rect.contains(pos);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
bool RibbonToolTip::fadingOut() const
|
||||
{
|
||||
QTN_D(const RibbonToolTip);
|
||||
return d.m_fadingOut;
|
||||
}
|
||||
|
||||
|
||||
/* RibbonKeyTipPrivate */
|
||||
RibbonKeyTipPrivate::RibbonKeyTipPrivate()
|
||||
{
|
||||
owner_ = Q_NULL;
|
||||
action_ = Q_NULL;
|
||||
bars_ = Q_NULL;
|
||||
enabled_ = false;
|
||||
align_ = 0;
|
||||
visible_ = true;
|
||||
explicit_ = false;
|
||||
}
|
||||
|
||||
/*!
|
||||
\class Qtitan::RibbonKeyTip
|
||||
\internal
|
||||
*/
|
||||
RibbonKeyTip::RibbonKeyTip(QWidget* bars, QWidget* owner, const QString& caption,
|
||||
const QPoint& pt, uint align, bool enabled, QAction* action)
|
||||
: QFrame(bars, Qt::ToolTip | Qt::BypassGraphicsProxyWidget)
|
||||
{
|
||||
QTN_INIT_PRIVATE(RibbonKeyTip);
|
||||
QTN_D(RibbonKeyTip);
|
||||
d.action_ = action;
|
||||
d.owner_ = owner;
|
||||
d.strCaption_ = caption;
|
||||
d.bars_ = bars;
|
||||
d.pt_ = pt;
|
||||
d.enabled_ = enabled;
|
||||
d.align_ = align;
|
||||
|
||||
setEnabled(enabled);
|
||||
|
||||
setForegroundRole(QPalette::ToolTipText);
|
||||
setBackgroundRole(QPalette::ToolTipBase);
|
||||
QPalette pal = QToolTip::palette();
|
||||
pal.setColor(QPalette::Light, pal.color(QPalette::ToolTipText));
|
||||
|
||||
setPalette(pal);
|
||||
setFont(QToolTip::font());
|
||||
ensurePolished();
|
||||
|
||||
if (!enabled)
|
||||
setWindowOpacity(0.5);
|
||||
}
|
||||
|
||||
RibbonKeyTip::~RibbonKeyTip()
|
||||
{
|
||||
QTN_FINI_PRIVATE();
|
||||
}
|
||||
|
||||
QPoint RibbonKeyTip::posTip() const
|
||||
{
|
||||
QTN_D(const RibbonKeyTip);
|
||||
return d.pt_;
|
||||
}
|
||||
|
||||
void RibbonKeyTip::setVisibleTip(bool visible)
|
||||
{
|
||||
QTN_D(RibbonKeyTip);
|
||||
d.visible_ = visible;
|
||||
}
|
||||
|
||||
bool RibbonKeyTip::isVisibleTip() const
|
||||
{
|
||||
QTN_D(const RibbonKeyTip);
|
||||
return d.visible_;
|
||||
}
|
||||
|
||||
bool RibbonKeyTip::isEnabledTip() const
|
||||
{
|
||||
QTN_D(const RibbonKeyTip);
|
||||
return d.enabled_;
|
||||
}
|
||||
|
||||
QWidget* RibbonKeyTip::getBars() const
|
||||
{
|
||||
QTN_D(const RibbonKeyTip);
|
||||
return d.bars_;
|
||||
}
|
||||
|
||||
uint RibbonKeyTip::getAlign() const
|
||||
{
|
||||
QTN_D(const RibbonKeyTip);
|
||||
return d.align_;
|
||||
}
|
||||
|
||||
void RibbonKeyTip::setExplicit(bool exp)
|
||||
{
|
||||
QTN_D(RibbonKeyTip);
|
||||
d.explicit_ = exp;
|
||||
}
|
||||
|
||||
bool RibbonKeyTip::isExplicit() const
|
||||
{
|
||||
QTN_D(const RibbonKeyTip);
|
||||
return d.explicit_;
|
||||
}
|
||||
|
||||
QString RibbonKeyTip::getStringTip() const
|
||||
{
|
||||
QTN_D(const RibbonKeyTip);
|
||||
return d.strTip_;
|
||||
}
|
||||
|
||||
void RibbonKeyTip::setStringTip(const QString& str)
|
||||
{
|
||||
QTN_D(RibbonKeyTip);
|
||||
d.strTip_ = str;
|
||||
}
|
||||
|
||||
QString RibbonKeyTip::getCaption() const
|
||||
{
|
||||
QTN_D(const RibbonKeyTip);
|
||||
return d.strCaption_;
|
||||
}
|
||||
|
||||
void RibbonKeyTip::setCaption(const QString& str)
|
||||
{
|
||||
QTN_D(RibbonKeyTip);
|
||||
d.strCaption_ = str;
|
||||
}
|
||||
|
||||
QString RibbonKeyTip::getPrefix() const
|
||||
{
|
||||
QTN_D(const RibbonKeyTip);
|
||||
return d.strPrefix_;
|
||||
}
|
||||
|
||||
void RibbonKeyTip::setPrefix(const QString& pref)
|
||||
{
|
||||
QTN_D(RibbonKeyTip);
|
||||
d.strPrefix_ = pref;
|
||||
}
|
||||
|
||||
QWidget* RibbonKeyTip::getOwner() const
|
||||
{
|
||||
QTN_D(const RibbonKeyTip);
|
||||
return d.owner_;
|
||||
}
|
||||
|
||||
QAction* RibbonKeyTip::getAction() const
|
||||
{
|
||||
QTN_D(const RibbonKeyTip);
|
||||
return d.action_;
|
||||
}
|
||||
|
||||
void RibbonKeyTip::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QTN_D(RibbonKeyTip);
|
||||
|
||||
QPainter p(this);
|
||||
QStyleOption opt;
|
||||
opt.initFrom(this);
|
||||
|
||||
if (d.enabled_)
|
||||
opt.state |= QStyle::State_Enabled;
|
||||
else
|
||||
opt.state &= ~QStyle::State_Enabled;
|
||||
|
||||
style()->drawPrimitive((QStyle::PrimitiveElement)RibbonStyle::PE_RibbonKeyTip, &opt, &p, this);
|
||||
style()->drawItemText(&p, opt.rect, Qt::AlignVCenter | Qt::AlignCenter | Qt::TextSingleLine | Qt::TextWordWrap,
|
||||
opt.palette, d.enabled_, d.strTip_, QPalette::ToolTipText);
|
||||
}
|
||||
|
||||
void RibbonKeyTip::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
|
||||
QBitmap maskBitmap(width(), height());
|
||||
maskBitmap.clear();
|
||||
|
||||
QPainter p(&maskBitmap);
|
||||
p.setBrush(Qt::black);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
|
||||
p.drawRoundedRect(0, 0, width(), height(), 2, 2, Qt::AbsoluteSize);
|
||||
#else
|
||||
p.drawRoundedRect(0, 0, width()-1, height()-1, 2, 2, Qt::AbsoluteSize);
|
||||
#endif
|
||||
p.end();
|
||||
setMask(maskBitmap);
|
||||
}
|
||||
|
||||
168
third-party/QtitanRibbon/src/ribbon/QtnRibbonToolTip.h
vendored
Normal file
168
third-party/QtitanRibbon/src/ribbon/QtnRibbonToolTip.h
vendored
Normal file
@@ -0,0 +1,168 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONTOOLTIP_H
|
||||
#define QTN_RIBBONTOOLTIP_H
|
||||
|
||||
#include <QLabel>
|
||||
#include <QTimer>
|
||||
#include <QIcon>
|
||||
#include <QEvent>
|
||||
#include "QtitanDef.h"
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
class RibbonToolTipPrivate;
|
||||
class QTITAN_EXPORT RibbonToolTip : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(QString title READ title WRITE setTitle)
|
||||
Q_PROPERTY(QString text READ text WRITE setText)
|
||||
Q_PROPERTY(QIcon icon READ icon WRITE setIcon)
|
||||
Q_PROPERTY(int margin READ margin WRITE setMargin)
|
||||
public:
|
||||
RibbonToolTip(const QString& title, const QString& text, const QIcon& icon = QIcon(), QWidget* parent = Q_NULL);
|
||||
virtual ~RibbonToolTip();
|
||||
static RibbonToolTip* instance();
|
||||
public:
|
||||
static void showToolTip(const QPoint& pos, const QString& title, const QString& text, const QIcon& icon = QIcon(), QWidget* parent = Q_NULL);
|
||||
static void hideToolTip();
|
||||
static bool isToolTipVisible();
|
||||
//static QString textToolTip();
|
||||
|
||||
enum WrapMode
|
||||
{
|
||||
NoWrap = 0,
|
||||
NativeWrap = NoWrap,
|
||||
AutoWrap,
|
||||
};
|
||||
|
||||
static void setWrapMode(WrapMode mode);
|
||||
static WrapMode wordWrap();
|
||||
|
||||
static void setIconVisible(bool visible);
|
||||
static bool isIconVisible();
|
||||
|
||||
public:
|
||||
int margin() const;
|
||||
void setMargin(int);
|
||||
|
||||
const QString& title() const;
|
||||
const QString& text() const;
|
||||
|
||||
void setIcon(const QIcon &icon);
|
||||
const QIcon& icon() const;
|
||||
|
||||
public:
|
||||
void reuseTip(const QString& textTitle, const QString& text);
|
||||
void hideTip();
|
||||
void closeToolTip();
|
||||
void setTipRect(QWidget* w, const QRect& r);
|
||||
void restartExpireTimer();
|
||||
bool tipChanged(const QPoint& pos, const QString& text, const QString& textTitle, QObject* o);
|
||||
void placeTip(const QPoint& pos, QWidget* w);
|
||||
|
||||
static int getTipScreen(const QPoint& pos, QWidget* w);
|
||||
|
||||
public Q_SLOTS:
|
||||
void setTitle(const QString&);
|
||||
void setText(const QString&);
|
||||
|
||||
public:
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
virtual bool eventFilter(QObject*, QEvent* event);
|
||||
virtual void timerEvent(QTimerEvent* event);
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void mouseMoveEvent(QMouseEvent* event);
|
||||
virtual void resizeEvent(QResizeEvent* event);
|
||||
|
||||
public:
|
||||
bool fadingOut() const;
|
||||
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonToolTip)
|
||||
Q_DISABLE_COPY(RibbonToolTip)
|
||||
};
|
||||
|
||||
class RibbonKeyTipPrivate;
|
||||
/* KeyTip */
|
||||
class RibbonKeyTip : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum AlignTip
|
||||
{
|
||||
AlignTipTop = 0x00000000,
|
||||
AlignTipLeft = 0x00000000,
|
||||
AlignTipCenter = 0x00000001,
|
||||
AlignTipRight = 0x00000002,
|
||||
AlignTipVCenter = 0x00000004,
|
||||
AlignTipBottom = 0x00000008,
|
||||
};
|
||||
|
||||
public:
|
||||
RibbonKeyTip(QWidget* bars, QWidget* owner, const QString& caption,
|
||||
const QPoint& pt, uint align, bool enabled, QAction* action = Q_NULL);
|
||||
virtual ~RibbonKeyTip();
|
||||
|
||||
public:
|
||||
QPoint posTip() const;
|
||||
void setVisibleTip(bool visible);
|
||||
bool isVisibleTip() const;
|
||||
bool isEnabledTip() const;
|
||||
|
||||
QWidget* getBars() const;
|
||||
uint getAlign() const;
|
||||
|
||||
void setExplicit(bool exp);
|
||||
bool isExplicit() const;
|
||||
|
||||
QString getStringTip() const;
|
||||
void setStringTip(const QString& str);
|
||||
|
||||
QString getCaption() const;
|
||||
void setCaption(const QString& str);
|
||||
|
||||
QString getPrefix() const;
|
||||
void setPrefix(const QString& pref);
|
||||
|
||||
QWidget* getOwner() const;
|
||||
QAction* getAction() const;
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void resizeEvent(QResizeEvent* event);
|
||||
|
||||
private:
|
||||
QTN_DECLARE_PRIVATE(RibbonKeyTip)
|
||||
Q_DISABLE_COPY(RibbonKeyTip)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONTOOLTIP_H
|
||||
3
third-party/QtitanRibbon/src/ribbon/QtnRibbonTranslations.qrc
vendored
Normal file
3
third-party/QtitanRibbon/src/ribbon/QtnRibbonTranslations.qrc
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
<RCC>
|
||||
<qresource prefix="/"/>
|
||||
</RCC>
|
||||
70
third-party/QtitanRibbon/src/ribbon/QtnRibbonWorkspace.cpp
vendored
Normal file
70
third-party/QtitanRibbon/src/ribbon/QtnRibbonWorkspace.cpp
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <qevent.h>
|
||||
#include <QPainter>
|
||||
#include <QStyleOption>
|
||||
|
||||
#include "QtnRibbonWorkspace.h"
|
||||
#include "QtnCommonStyle.h"
|
||||
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
#include "QtitanMSVSDebug.h"
|
||||
#endif
|
||||
|
||||
QTITAN_USE_NAMESPACE
|
||||
|
||||
|
||||
/*!
|
||||
\class Qtitan::RibbonWorkspace
|
||||
\internal
|
||||
*/
|
||||
RibbonWorkspace::RibbonWorkspace(QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setAttribute(Qt::WA_MouseTracking);
|
||||
setAutoFillBackground(true);
|
||||
}
|
||||
|
||||
RibbonWorkspace::~RibbonWorkspace()
|
||||
{
|
||||
}
|
||||
|
||||
void RibbonWorkspace::paintEvent(QPaintEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
QPainter p(this);
|
||||
QStyleOption opt;
|
||||
opt.initFrom(this);
|
||||
if (event->rect().intersects(opt.rect))
|
||||
style()->drawPrimitive((QStyle::PrimitiveElement)CommonStyle::PE_Workspace, &opt, &p, this);
|
||||
}
|
||||
|
||||
void RibbonWorkspace::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
setFocus();
|
||||
}
|
||||
54
third-party/QtitanRibbon/src/ribbon/QtnRibbonWorkspace.h
vendored
Normal file
54
third-party/QtitanRibbon/src/ribbon/QtnRibbonWorkspace.h
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Qtitan Library by Developer Machines (Microsoft-Ribbon implementation for Qt.C++)
|
||||
**
|
||||
** Copyright (c) 2009-2015 Developer Machines (http://www.devmachines.com)
|
||||
** ALL RIGHTS RESERVED
|
||||
**
|
||||
** The entire contents of this file is protected by copyright law and
|
||||
** international treaties. Unauthorized reproduction, reverse-engineering
|
||||
** and distribution of all or any portion of the code contained in this
|
||||
** file is strictly prohibited and may result in severe civil and
|
||||
** criminal penalties and will be prosecuted to the maximum extent
|
||||
** possible under the law.
|
||||
**
|
||||
** RESTRICTIONS
|
||||
**
|
||||
** THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED
|
||||
** FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE
|
||||
** COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE
|
||||
** AVAILABLE TO OTHER INDIVIDUALS WITHOUT WRITTEN CONSENT
|
||||
** AND PERMISSION FROM DEVELOPER MACHINES
|
||||
**
|
||||
** CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON
|
||||
** ADDITIONAL RESTRICTIONS.
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef QTN_RIBBONWORKSPACE_H
|
||||
#define QTN_RIBBONWORKSPACE_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "QtitanDef.h"
|
||||
|
||||
|
||||
QTITAN_BEGIN_NAMESPACE
|
||||
|
||||
/* RibbonWorkspace */
|
||||
class QTITAN_EXPORT RibbonWorkspace : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RibbonWorkspace(QWidget* parent = Q_NULL);
|
||||
virtual ~RibbonWorkspace();
|
||||
|
||||
protected:
|
||||
virtual void paintEvent(QPaintEvent* event);
|
||||
virtual void mousePressEvent(QMouseEvent* event);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(RibbonWorkspace)
|
||||
};
|
||||
|
||||
QTITAN_END_NAMESPACE
|
||||
|
||||
#endif // QTN_RIBBONWORKSPACE_H
|
||||
143
third-party/QtitanRibbon/src/ribbon/ribbon.pri
vendored
Normal file
143
third-party/QtitanRibbon/src/ribbon/ribbon.pri
vendored
Normal file
@@ -0,0 +1,143 @@
|
||||
|
||||
QTN_COMPONENT_VERSION = 4.8.0
|
||||
DEFINES += QTN_VERSION_RIBBON=$$QTN_COMPONENT_VERSION
|
||||
|
||||
INCLUDEPATH += $$quote($$PWD/../../include)
|
||||
INCLUDEPATH += $$quote($$PWD/../styles)
|
||||
INCLUDEPATH += $$quote($$PWD/../base)
|
||||
|
||||
ALL_SOURCES = \
|
||||
$$PWD/QtnRibbonSliderPane.cpp \
|
||||
$$PWD/QtnRibbonStatusBar.cpp \
|
||||
$$PWD/QtnRibbonTabBar.cpp \
|
||||
$$PWD/QtnRibbonSystemPopupBar.cpp \
|
||||
$$PWD/QtnRibbonPage.cpp \
|
||||
$$PWD/QtnRibbonGroup.cpp \
|
||||
$$PWD/QtnRibbonBar.cpp \
|
||||
$$PWD/QtnRibbonPrivate.cpp \
|
||||
$$PWD/QtnRibbonMainWindow.cpp \
|
||||
$$PWD/QtnRibbonButtonPrivate.cpp \
|
||||
$$PWD/QtnRibbonControls.cpp \
|
||||
$$PWD/QtnRibbonButtonControls.cpp \
|
||||
$$PWD/QtnRibbonInputControls.cpp \
|
||||
$$PWD/QtnRibbonGalleryControls.cpp \
|
||||
$$PWD/QtnRibbonToolTip.cpp \
|
||||
$$PWD/QtnRibbonQuickAccessBar.cpp \
|
||||
$$PWD/QtnOfficePopupColorButton.cpp \
|
||||
$$PWD/QtnRibbonGallery.cpp \
|
||||
$$PWD/QtnOfficePopupMenu.cpp \
|
||||
$$PWD/QtnRibbonBackstageView.cpp \
|
||||
$$PWD/QtnOfficePopupWindow.cpp \
|
||||
$$PWD/QtnRibbonWorkspace.cpp \
|
||||
$$PWD/QtnRibbonCustomizeDialog.cpp \
|
||||
$$PWD/QtnRibbonCustomizePage.cpp \
|
||||
$$PWD/QtnRibbonCustomizeManager.cpp \
|
||||
$$PWD/QtnRibbonDef.cpp
|
||||
|
||||
INCLUDE_HEADERS = \
|
||||
$$PWD/../../include/QtitanRibbon.h \
|
||||
$$PWD/../../include/QtitanDef.h \
|
||||
$$PWD/../../include/QtnRibbonDef.h \
|
||||
$$PWD/../../include/QtnRibbonBackstageView.h \
|
||||
$$PWD/../../include/QtnRibbonBar.h \
|
||||
$$PWD/../../include/QtnRibbonGallery.h \
|
||||
$$PWD/../../include/QtnRibbonGroup.h \
|
||||
$$PWD/../../include/QtnRibbonMainWindow.h \
|
||||
$$PWD/../../include/QtnRibbonPage.h \
|
||||
$$PWD/../../include/QtnRibbonQuickAccessBar.h \
|
||||
$$PWD/../../include/QtnRibbonSliderPane.h \
|
||||
$$PWD/../../include/QtnRibbonStatusBar.h \
|
||||
$$PWD/../../include/QtnRibbonSliderPane.h \
|
||||
$$PWD/../../include/QtnRibbonSystemPopupBar.h \
|
||||
$$PWD/../../include/QtnRibbonToolTip.h \
|
||||
$$PWD/../../include/QtnRibbonInputControls.h \
|
||||
$$PWD/../../include/QtnRibbonButtonControls.h \
|
||||
$$PWD/../../include/QtnRibbonGalleryControls.h \
|
||||
$$PWD/../../include/QtnRibbonCustomizeManager.h \
|
||||
$$PWD/../../include/QtnRibbonCustomizeDialog.h \
|
||||
$$PWD/../../include/QtnRibbonCustomizePage.h \
|
||||
$$PWD/../../include/QtnRibbonWorkspace.h
|
||||
|
||||
PRIVATE_HEADERS = \
|
||||
$$PWD/QtnRibbonBarPrivate.h \
|
||||
$$PWD/QtnRibbonPagePrivate.h \
|
||||
$$PWD/QtnRibbonGroupPrivate.h \
|
||||
$$PWD/QtnRibbonPrivate.h \
|
||||
$$PWD/QtnRibbonGalleryPrivate.h \
|
||||
$$PWD/QtnRibbonBackstageViewPrivate.h \
|
||||
$$PWD/QtnOfficeFrameHelper.h
|
||||
|
||||
PUBLIC_HEADERS = \
|
||||
$$PWD/QtnRibbonDef.h \
|
||||
$$PWD/QtnRibbonSliderPane.h \
|
||||
$$PWD/QtnRibbonStatusBar.h \
|
||||
$$PWD/QtnRibbonTabBar.h \
|
||||
$$PWD/QtnRibbonSystemPopupBar.h \
|
||||
$$PWD/QtnRibbonPage.h \
|
||||
$$PWD/QtnRibbonGroup.h \
|
||||
$$PWD/QtnRibbonBar.h \
|
||||
$$PWD/QtnRibbonMainWindow.h \
|
||||
$$PWD/QtnRibbonButtonPrivate.h \
|
||||
$$PWD/QtnRibbonControls.h \
|
||||
$$PWD/QtnRibbonControlsPrivate.h \
|
||||
$$PWD/QtnRibbonButtonControls.h \
|
||||
$$PWD/QtnRibbonInputControls.h \
|
||||
$$PWD/QtnRibbonGalleryControls.h \
|
||||
$$PWD/QtnRibbonToolTip.h \
|
||||
$$PWD/QtnRibbonQuickAccessBar.h \
|
||||
$$PWD/QtnOfficePopupColorButton.h \
|
||||
$$PWD/QtnRibbonGallery.h \
|
||||
$$PWD/QtnOfficePopupMenu.h \
|
||||
$$PWD/QtnRibbonBackstageView.h \
|
||||
$$PWD/QtnOfficePopupWindow.h \
|
||||
$$PWD/QtnRibbonWorkspace.h \
|
||||
$$PWD/QtnRibbonCustomizeDialog.h \
|
||||
$$PWD/QtnRibbonCustomizeDialogPrivate.h \
|
||||
$$PWD/QtnRibbonCustomizePage.h \
|
||||
$$PWD/QtnRibbonCustomizeManager.h \
|
||||
$$PWD/QtnRibbonCustomizeManagerPrivate.h \
|
||||
|
||||
WINDOWS_SOURCES = $$PWD/QtnOfficeFrameHelper_win.cpp
|
||||
LINUX_SOURCES =
|
||||
MACOSX_SOURCES =
|
||||
|
||||
|
||||
WINDOWS_HEADERS = $$PWD/QtnOfficeFrameHelper_win.h
|
||||
LINUX_HEADERS =
|
||||
MACOSX_HEADERS =
|
||||
|
||||
|
||||
HEADERS += \
|
||||
$$PUBLIC_HEADERS \
|
||||
$$PRIVATE_HEADERS
|
||||
|
||||
win32:HEADERS += $$WINDOWS_HEADERS
|
||||
linux*:HEADERS += $$LINUX_HEADERS
|
||||
macx:HEADERS += $$MACOSX_HEADERS
|
||||
|
||||
SOURCES += \
|
||||
$$ALL_SOURCES
|
||||
|
||||
win32:SOURCES += $$WINDOWS_SOURCES
|
||||
linux*:SOURCES += $$LINUX_SOURCES
|
||||
macx:OBJECTIVE_SOURCES += $$MACOSX_SOURCES
|
||||
|
||||
FORMS += \
|
||||
$$PWD/QtnRibbonRenameDialog.ui \
|
||||
$$PWD/QtnRibbonQuickAccessBarCustomizePage.ui \
|
||||
$$PWD/QtnRibbonBarCustomizePage.ui
|
||||
|
||||
RESOURCES += \
|
||||
$$PWD/QtnRibbonResources.qrc \
|
||||
$$PWD/QtnRibbonTranslations.qrc
|
||||
|
||||
win32 {
|
||||
DEFINES += _WINDOWS
|
||||
LIBS += -luser32 -lgdi32 -lshell32 -lcomctl32
|
||||
}
|
||||
|
||||
macx {
|
||||
LIBS += -framework AppKit
|
||||
}
|
||||
|
||||
QT += xml
|
||||
21
third-party/QtitanRibbon/src/ribbondsgn/QtitanRibbon_Backstage_Page.ui
vendored
Normal file
21
third-party/QtitanRibbon/src/ribbondsgn/QtitanRibbon_Backstage_Page.ui
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<ui version="4.0" >
|
||||
<author></author>
|
||||
<comment></comment>
|
||||
<exportmacro></exportmacro>
|
||||
<class>BackstagePage</class>
|
||||
<widget class="Qtitan::RibbonBackstagePage" name="RibbonBackstagePage" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>640</width>
|
||||
<height>480</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>RibbonBackstagePage</string>
|
||||
</property>
|
||||
</widget>
|
||||
<pixmapfunction></pixmapfunction>
|
||||
<connections/>
|
||||
</ui>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user