summaryrefslogtreecommitdiffstats
path: root/src/kernel/qstyle.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/qstyle.h')
-rw-r--r--src/kernel/qstyle.h152
1 files changed, 129 insertions, 23 deletions
diff --git a/src/kernel/qstyle.h b/src/kernel/qstyle.h
index 9a10b7f..6978deb 100644
--- a/src/kernel/qstyle.h
+++ b/src/kernel/qstyle.h
@@ -177,6 +177,7 @@ class QStyleControlElementDockWidgetData {
class QStyleControlElementGenericWidgetData {
public:
QStringList widgetObjectTypes;
+ bool allDataPopulated;
Qt::WFlags wflags;
QPixmap bgPixmap;
QBrush bgBrush;
@@ -196,6 +197,7 @@ class QStyleControlElementGenericWidgetData {
class QStyleControlElementData {
public:
QStringList widgetObjectTypes;
+ bool allDataPopulated;
Qt::WFlags wflags;
QPixmap bgPixmap;
QBrush bgBrush;
@@ -239,6 +241,24 @@ class QStyleControlElementData {
QStyleControlElementListViewData listViewData;
QStyleControlElementTabBarData tabBarData;
Q_UINT32 comboBoxLineEditFlags;
+ Q_UINT32 frameStyle;
+ QRect sliderRect;
+};
+
+class QStyleWidgetActionRequestData {
+ public:
+ QStyleWidgetActionRequestData();
+ QStyleWidgetActionRequestData(int metric1, int metric2=0);
+ QStyleWidgetActionRequestData(QPalette palette);
+ QStyleWidgetActionRequestData(QFont font);
+ QStyleWidgetActionRequestData(QRect rect);
+ ~QStyleWidgetActionRequestData();
+ public:
+ int metric1;
+ int metric2;
+ QPalette palette;
+ QFont font;
+ QRect rect;
};
class Q_EXPORT QStyle: public QObject
@@ -249,28 +269,6 @@ public:
QStyle();
virtual ~QStyle();
- // New QStyle API - most of these should probably be pure virtual
-
- virtual void polish( QWidget * );
- virtual void unPolish( QWidget * );
-
- virtual void polish( QApplication * );
- virtual void unPolish( QApplication * );
-
- virtual void polish( QPalette & );
-
- virtual void polishPopupMenu( QPopupMenu* ) = 0;
-
- virtual QRect itemRect( QPainter *p, const QRect &r,
- int flags, bool enabled,
- const QPixmap *pixmap,
- const QString &text, int len = -1 ) const;
-
- virtual void drawItem( QPainter *p, const QRect &r,
- int flags, const QColorGroup &g, bool enabled,
- const QPixmap *pixmap, const QString &text,
- int len = -1, const QColor *penColor = 0 ) const;
-
enum ControlElementFlags {
CEF_None = 0x00000000,
CEF_IsDefault = 0x00000001,
@@ -293,9 +291,68 @@ public:
CEF_IsCheckable = 0x00020000,
CEF_HasFocusProxy = 0x00040000,
CEF_IsEditable = 0x00080000,
- CEF_IsFlat = 0x00100000
+ CEF_IsFlat = 0x00100000,
+ CEF_IsActiveWindow = 0x00200000,
+ CEF_IsTopLevel = 0x00400000,
+ CEF_IsVisible = 0x00800000,
};
+ // New QStyle API - most of these should probably be pure virtual
+
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
+ virtual void polish( QWidget * );
+
+ // New API
+ virtual void polish( QStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
+
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
+ virtual void unPolish( QWidget * );
+
+ // New API
+ virtual void unPolish( QStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
+
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
+ virtual void polish( QApplication * );
+
+ // New API
+ virtual void applicationPolish( QStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
+
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
+ virtual void unPolish( QApplication * );
+
+ // New API
+ virtual void applicationUnPolish( QStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
+
+ virtual void polish( QPalette & );
+
+ virtual void polishPopupMenu( QPopupMenu* ) = 0;
+
+ virtual QRect itemRect( QPainter *p, const QRect &r,
+ int flags, bool enabled,
+ const QPixmap *pixmap,
+ const QString &text, int len = -1 ) const;
+
+ virtual void drawItem( QPainter *p, const QRect &r,
+ int flags, const QColorGroup &g, bool enabled,
+ const QPixmap *pixmap, const QString &text,
+ int len = -1, const QColor *penColor = 0 ) const;
+
enum PrimitiveElement {
PE_ButtonCommand,
PE_ButtonDefault,
@@ -967,6 +1024,9 @@ public:
// when the mouse is over the button
SH_ToolButton_Uses3D,
+ // bool - hide underlined accelerators uless Alt key is currently down
+ SH_HideUnderlineAcceleratorWhenAltUp,
+
// do not add any values below/greater than this
SH_CustomBase = 0xf0000000
};
@@ -1038,7 +1098,35 @@ public:
static QRect visualRect( const QRect &logical, const QRect &bounding );
+ // Object event handling API
+ typedef QMap<void*, QStyle*> ObjectEventSourceToHandlerMap;
+ typedef QMap<void*, QStyleControlElementData> ObjectEventSourceDataToHandlerMap;
+ typedef QMap<void*, ControlElementFlags> ObjectEventSourceFlagsToHandlerMap;
+ typedef bool (*EventHandlerInstallationHook)(QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler);
+ typedef bool (*EventHandlerRemovalHook)(QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler);
+ void installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler );
+ void removeObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler );
+ void setEventHandlerInstallationHook( EventHandlerInstallationHook );
+ void setEventHandlerRemovalHook( EventHandlerRemovalHook hook );
+ virtual bool objectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QEvent *e );
+
+ enum WidgetActionRequest {
+ WAR_Repaint,
+ WAR_RepaintRect,
+ WAR_EnableMouseTracking,
+ WAR_DisableMouseTracking,
+ WAR_FrameSetStyle,
+ WAR_FrameSetLineWidth,
+ WAR_SetLayoutMargin,
+ WAR_SetPalette,
+ WAR_SetBackgroundMode,
+ WAR_SetFont,
+ WAR_RepaintAllAccelerators
+ };
+ typedef bool (*WidgetActionRequestHook)(QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, QStyleWidgetActionRequestData requestData);
+ void setWidgetActionRequestHook( WidgetActionRequestHook );
+ virtual bool widgetActionRequest( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, QStyleWidgetActionRequestData requestData = QStyleWidgetActionRequestData() );
// Old 2.x QStyle API
@@ -1061,6 +1149,12 @@ public:
}
#endif
+public:
+ virtual bool eventFilter( QObject *, QEvent * );
+ bool acceleratorsShown() const;
+
+protected:
+ void acceleratorKeypressEventMonitor( QObject *, QEvent * );
private:
QStylePrivate * d;
@@ -1069,10 +1163,22 @@ private:
QStyle( const QStyle & );
QStyle& operator=( const QStyle & );
#endif
+
+ EventHandlerInstallationHook m_eventHandlerInstallationHook;
+ EventHandlerRemovalHook m_eventHandlerRemovalHook;
+ WidgetActionRequestHook m_widgetActionRequestHook;
+ ObjectEventSourceToHandlerMap m_objectEventSourceToHandlerMap;
+ ObjectEventSourceDataToHandlerMap m_objectEventSourceDataToHandlerMap;
+ ObjectEventSourceFlagsToHandlerMap m_objectEventSourceFlagsToHandlerMap;
+ bool conditionalAcceleratorsEnabled;
};
inline QStyle::ControlElementFlags operator|(const QStyle::ControlElementFlags a, const QStyle::ControlElementFlags b) { return static_cast<QStyle::ControlElementFlags>(static_cast<int>(a) | static_cast<int>(b)); }
// inline QStyle::ControlElementFlags operator|=(QStyle::ControlElementFlags &a, const QStyle::ControlElementFlags b) { a = static_cast<QStyle::ControlElementFlags>(static_cast<int>(a) | static_cast<int>(b)); return a; }
+Q_EXPORT QStyleControlElementData populateControlElementDataFromWidget(const QWidget* widget, const QStyleOption& opt, bool populateReliantFields=true);
+Q_EXPORT QStyle::ControlElementFlags getControlElementFlagsForObject(const QObject* object, QStringList objectTypeList, const QStyleOption& opt, bool populateReliantFields=true);
+Q_EXPORT QStringList getObjectTypeListForObject(const QObject* object);
+
#endif // QT_NO_STYLE
#endif // QSTYLE_H