summaryrefslogtreecommitdiffstats
path: root/src/kernel/ntqstyle.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/ntqstyle.h')
-rw-r--r--src/kernel/ntqstyle.h358
1 files changed, 339 insertions, 19 deletions
diff --git a/src/kernel/ntqstyle.h b/src/kernel/ntqstyle.h
index 0cacb8b20..25ffd5778 100644
--- a/src/kernel/ntqstyle.h
+++ b/src/kernel/ntqstyle.h
@@ -42,11 +42,19 @@
#ifndef QT_H
#include "ntqobject.h"
+#include "ntqpixmap.h"
+#include "ntqcolor.h"
+#include "ntqiconset.h"
+#include "ntqtabbar.h"
+#include "ntqtoolbutton.h"
#endif // QT_H
#ifndef QT_NO_STYLE
+/* DEV ONLY */
+/* #define MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED 1 */
+
class TQPopupMenu;
class TQStylePrivate;
class TQMenuItem;
@@ -58,26 +66,26 @@ class TQStyleOption {
public:
enum StyleOptionDefault { Default };
- TQStyleOption(StyleOptionDefault=Default) : def(TRUE) {}
+ TQStyleOption(StyleOptionDefault=Default) : def(TRUE), tb(NULL) {}
// Note: we don't use default arguments since that is unnecessary
// initialization.
TQStyleOption(int in1) :
- def(FALSE), i1(in1) {}
+ def(FALSE), tb(NULL), i1(in1) {}
TQStyleOption(int in1, int in2) :
- def(FALSE), i1(in1), i2(in2) {}
+ def(FALSE), tb(NULL), i1(in1), i2(in2) {}
TQStyleOption(int in1, int in2, int in3, int in4) :
- def(FALSE), i1(in1), i2(in2), i3(in3), i4(in4) {}
- TQStyleOption(TQMenuItem* m) : def(FALSE), mi(m) {}
- TQStyleOption(TQMenuItem* m, int in1) : def(FALSE), mi(m), i1(in1) {}
- TQStyleOption(TQMenuItem* m, int in1, int in2) : def(FALSE), mi(m), i1(in1), i2(in2) {}
- TQStyleOption(const TQColor& c) : def(FALSE), cl(&c) {}
+ def(FALSE), tb(NULL), i1(in1), i2(in2), i3(in3), i4(in4) {}
+ TQStyleOption(TQMenuItem* m) : def(FALSE), mi(m), tb(NULL) {}
+ TQStyleOption(TQMenuItem* m, int in1) : def(FALSE), mi(m), tb(NULL), i1(in1) {}
+ TQStyleOption(TQMenuItem* m, int in1, int in2) : def(FALSE), mi(m), tb(NULL), i1(in1), i2(in2) {}
+ TQStyleOption(const TQColor& c) : def(FALSE), tb(NULL), cl(&c) {}
TQStyleOption(TQTab* t) : def(FALSE), tb(t) {}
- TQStyleOption(TQListViewItem* i) : def(FALSE), li(i) {}
- TQStyleOption(TQCheckListItem* i) : def(FALSE), cli(i) {}
- TQStyleOption(TQt::ArrowType a) : def(FALSE), i1((int)a) {}
- TQStyleOption(const TQRect& r) : def(FALSE), i1(r.x()), i2(r.y()), i3(r.width()),i4(r.height()){}
- TQStyleOption(TQWidget *w) : def(FALSE), p1((void*)w) {}
+ TQStyleOption(TQListViewItem* i) : def(FALSE), tb(NULL), li(i) {}
+ TQStyleOption(TQCheckListItem* i) : def(FALSE), tb(NULL), cli(i) {}
+ TQStyleOption(TQt::ArrowType a) : def(FALSE), tb(NULL), i1((int)a) {}
+ TQStyleOption(const TQRect& r) : def(FALSE), tb(NULL), i1(r.x()), i2(r.y()), i3(r.width()),i4(r.height()){}
+ TQStyleOption(TQWidget *w) : def(FALSE), tb(NULL), p1((void*)w) {}
bool isDefault() const { return def; }
@@ -121,6 +129,118 @@ private:
class TQStyleHintReturn; // not defined yet
+typedef TQMap<TQ_UINT32, TQSize> DialogButtonSizeMap;
+typedef TQMap<TQ_INT32, TQ_INT32> TabIdentifierIndexMap;
+
+class TQStyleControlElementPopupMenuData {
+ public:
+ //
+};
+
+class TQStyleControlElementTabBarData {
+ public:
+ int tabCount;
+ TQTabBar::Shape shape;
+ TabIdentifierIndexMap identIndexMap;
+};
+
+class TQStyleControlElementListViewData {
+ public:
+ bool rootDecorated;
+ int itemMargin;
+};
+
+class TQStyleControlElementSpinWidgetData {
+ public:
+ TQ_UINT32 buttonSymbols;
+ TQRect upRect;
+ TQRect downRect;
+ bool upEnabled;
+ bool downEnabled;
+};
+
+class TQStyleControlElementTitleBarData {
+ public:
+ bool hasWindow;
+ bool usesActiveColor;
+ int windowState;
+ TQString visibleText;
+};
+
+class TQStyleControlElementDockWidgetData {
+ public:
+ bool hasDockArea;
+ bool closeEnabled;
+ TQt::Orientation areaOrientation;
+};
+
+class TQStyleControlElementGenericWidgetData {
+ public:
+ TQStringList widgetObjectTypes;
+ TQt::WFlags wflags;
+ TQPixmap bgPixmap;
+ TQBrush bgBrush;
+ TQColor bgColor;
+ TQPoint bgOffset;
+ TQt::BackgroundMode backgroundMode;
+ TQColor fgColor;
+ TQColorGroup colorGroup;
+ TQRect geometry;
+ TQRect rect;
+ TQPoint pos;
+ TQPixmap icon;
+ TQPalette palette;
+ TQFont font;
+};
+
+class TQStyleControlElementData {
+ public:
+ TQStringList widgetObjectTypes;
+ TQt::WFlags wflags;
+ TQPixmap bgPixmap;
+ TQBrush bgBrush;
+ TQColor bgColor;
+ TQPoint bgOffset;
+ TQt::BackgroundMode backgroundMode;
+ TQPixmap fgPixmap;
+ TQColor fgColor;
+ TQColorGroup colorGroup;
+ TQRect geometry;
+ TQRect rect;
+ TQPoint pos;
+ TQPixmap icon;
+ TQIconSet iconSet;
+ TQString text;
+ TQt::Orientation orientation;
+ TQColor activeItemPaletteBgColor;
+ TQPalette palette;
+ int totalSteps;
+ int currentStep;
+ TQ_UINT32 tickMarkSetting;
+ int tickInterval;
+ int minSteps;
+ int maxSteps;
+ int startStep;
+ int pageStep;
+ int lineStep;
+ int dlgVisibleButtons;
+ DialogButtonSizeMap dlgVisibleSizeHints;
+ TQString progressText;
+ TQString textLabel;
+ TQFont font;
+ int percentageVisible;
+ TQStyleControlElementDockWidgetData dwData;
+ TQToolButton::TextPosition toolButtonTextPosition;
+ int popupDelay;
+ TQStyleControlElementTitleBarData titleBarData;
+ TQStyleControlElementSpinWidgetData spinWidgetData;
+ TQStyleControlElementGenericWidgetData parentWidgetData;
+ TQStyleControlElementGenericWidgetData viewportData;
+ TQStyleControlElementListViewData listViewData;
+ TQStyleControlElementTabBarData tabBarData;
+ TQ_UINT32 comboBoxLineEditFlags;
+};
+
class Q_EXPORT TQStyle: public TQObject
{
TQ_OBJECT
@@ -151,6 +271,30 @@ public:
const TQPixmap *pixmap, const TQString &text,
int len = -1, const TQColor *penColor = 0 ) const;
+ enum ControlElementFlags {
+ CEF_None = 0x00000000,
+ CEF_IsDefault = 0x00000001,
+ CEF_AutoDefault = 0x00000002,
+ CEF_IsActive = 0x00000004,
+ CEF_IsDown = 0x00000008,
+ CEF_IsOn = 0x00000010,
+ CEF_IsEnabled = 0x00000020,
+ CEF_BiState = 0x00000040,
+ CEF_HasFocus = 0x00000080,
+ CEF_IsMenuWidget = 0x00000100,
+ CEF_IsContainerEmpty = 0x00000200,
+ CEF_CenterIndicator = 0x00000400,
+ CEF_IndicatorFollowsStyle = 0x00000800,
+ CEF_UsesTextLabel = 0x00001000,
+ CEF_UsesBigPixmap = 0x00002000,
+ CEF_UseGenericParameters = 0x00004000,
+ CEF_HasParentWidget = 0x00008000,
+ CEF_HasPopupMenu = 0x00010000,
+ CEF_IsCheckable = 0x00020000,
+ CEF_HasFocusProxy = 0x00040000,
+ CEF_IsEditable = 0x00080000,
+ CEF_IsFlat = 0x00100000
+ };
enum PrimitiveElement {
PE_ButtonCommand,
@@ -252,6 +396,11 @@ public:
};
typedef uint SFlags;
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
virtual void drawPrimitive( PrimitiveElement pe,
TQPainter *p,
const TQRect &r,
@@ -259,6 +408,16 @@ public:
SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const = 0;
+ // New API
+ virtual void drawPrimitive( PrimitiveElement pe,
+ TQPainter *p,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags flags = Style_Default,
+ const TQStyleOption& = TQStyleOption::Default ) const = 0;
+
enum ControlElement {
CE_PushButton,
@@ -294,6 +453,11 @@ public:
CE_CustomBase = 0xf0000000
};
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
virtual void drawControl( ControlElement element,
TQPainter *p,
const TQWidget *widget,
@@ -301,12 +465,38 @@ public:
const TQColorGroup &cg,
SFlags how = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const = 0;
+
+ // New API
+ virtual void drawControl( ControlElement element,
+ TQPainter *p,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags how = Style_Default,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 /* compat, will likely go away */ ) const = 0;
+
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
virtual void drawControlMask( ControlElement element,
TQPainter *p,
const TQWidget *widget,
const TQRect &r,
const TQStyleOption& = TQStyleOption::Default ) const = 0;
+ // New API
+ virtual void drawControlMask( ControlElement element,
+ TQPainter *p,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 /* compat, will likely go away */ ) const = 0;
+
enum SubRect {
SR_PushButtonContents,
SR_PushButtonFocusRect,
@@ -347,8 +537,16 @@ public:
SR_CustomBase = 0xf0000000
};
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
virtual TQRect subRect( SubRect r, const TQWidget *widget ) const = 0;
+ // New API
+ virtual TQRect subRect( SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const = 0;
+
enum ComplexControl{
CC_SpinWidget,
@@ -411,6 +609,11 @@ public:
typedef uint SCFlags;
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
virtual void drawComplexControl( ComplexControl control,
TQPainter *p,
const TQWidget *widget,
@@ -424,21 +627,79 @@ public:
#endif
SCFlags subActive = SC_None,
const TQStyleOption& = TQStyleOption::Default ) const = 0;
+
+ virtual void drawComplexControl( ComplexControl control,
+ TQPainter *p,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQColorGroup &cg,
+ SFlags how = Style_Default,
+#ifdef Q_QDOC
+ SCFlags sub = SC_All,
+#else
+ SCFlags sub = (uint)SC_All,
+#endif
+ SCFlags subActive = SC_None,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const = 0;
+
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
virtual void drawComplexControlMask( ComplexControl control,
TQPainter *p,
const TQWidget *widget,
const TQRect &r,
const TQStyleOption& = TQStyleOption::Default ) const = 0;
+ // New API
+ virtual void drawComplexControlMask( ComplexControl control,
+ TQPainter *p,
+ const TQStyleControlElementData ceData,
+ const ControlElementFlags elementFlags,
+ const TQRect &r,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const = 0;
+
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
virtual TQRect querySubControlMetrics( ComplexControl control,
const TQWidget *widget,
SubControl sc,
const TQStyleOption& = TQStyleOption::Default ) const = 0;
+
+ // New API
+ virtual TQRect querySubControlMetrics( ComplexControl control,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
+ SubControl sc,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const = 0;
+
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
virtual SubControl querySubControl( ComplexControl control,
const TQWidget *widget,
const TQPoint &pos,
const TQStyleOption& = TQStyleOption::Default ) const = 0;
+ // New API
+ virtual SubControl querySubControl( ComplexControl control,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
+ const TQPoint &pos,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const = 0;
+
enum PixelMetric {
PM_ButtonMargin,
@@ -508,9 +769,20 @@ public:
PM_CustomBase = 0xf0000000
};
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
virtual int pixelMetric( PixelMetric metric,
const TQWidget *widget = 0 ) const = 0;
+ // New API
+ virtual int pixelMetric( PixelMetric metric,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
+ const TQWidget *widget = 0 ) const = 0;
+
enum ContentsType {
CT_PushButton,
@@ -536,11 +808,23 @@ public:
CT_CustomBase = 0xf0000000
};
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
virtual TQSize sizeFromContents( ContentsType contents,
const TQWidget *widget,
const TQSize &contentsSize,
const TQStyleOption& = TQStyleOption::Default ) const = 0;
+ virtual TQSize sizeFromContents( ContentsType contents,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
+ const TQSize &contentsSize,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const = 0;
+
enum StyleHint {
// ...
// the general hints
@@ -687,12 +971,26 @@ public:
SH_CustomBase = 0xf0000000
};
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
virtual int styleHint( StyleHint stylehint,
const TQWidget *widget = 0,
const TQStyleOption& = TQStyleOption::Default,
TQStyleHintReturn* returnData = 0
) const = 0;
+ // New API
+ virtual int styleHint( StyleHint stylehint,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
+ const TQStyleOption& = TQStyleOption::Default,
+ TQStyleHintReturn* returnData = 0,
+ const TQWidget *widget = 0
+ ) const = 0;
+
enum StylePixmap {
SP_TitleBarMinButton,
@@ -711,13 +1009,32 @@ public:
SP_CustomBase = 0xf0000000
};
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
virtual TQPixmap stylePixmap( StylePixmap stylepixmap,
const TQWidget *widget = 0,
const TQStyleOption& = TQStyleOption::Default ) const = 0;
+ virtual TQPixmap stylePixmap( StylePixmap stylepixmap,
+ TQStyleControlElementData ceData,
+ ControlElementFlags elementFlags,
+ const TQStyleOption& = TQStyleOption::Default,
+ const TQWidget *widget = 0 ) const = 0;
+
+ // Old API
+ // DEPRECATED
+#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
+ __attribute__ ((deprecated))
+#endif
static TQRect visualRect( const TQRect &logical, const TQWidget *w );
+ // New API
+ static TQRect visualRect( const TQRect &logical, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags );
+
static TQRect visualRect( const TQRect &logical, const TQRect &bounding );
@@ -728,19 +1045,19 @@ public:
#ifndef QT_NO_COMPAT
int defaultFrameWidth() const
{
- return pixelMetric( PM_DefaultFrameWidth );
+ return pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None );
}
void tabbarMetrics( const TQWidget* t,
int& hf, int& vf, int& ov ) const
{
- hf = pixelMetric( PM_TabBarTabHSpace, t );
- vf = pixelMetric( PM_TabBarTabVSpace, t );
- ov = pixelMetric( PM_TabBarBaseOverlap, t );
+ hf = pixelMetric( PM_TabBarTabHSpace, TQStyleControlElementData(), CEF_None, t );
+ vf = pixelMetric( PM_TabBarTabVSpace, TQStyleControlElementData(), CEF_None, t );
+ ov = pixelMetric( PM_TabBarBaseOverlap, TQStyleControlElementData(), CEF_None, t );
}
TQSize scrollBarExtent() const
{
- return TQSize(pixelMetric(PM_ScrollBarExtent),
- pixelMetric(PM_ScrollBarExtent));
+ return TQSize(pixelMetric(PM_ScrollBarExtent, TQStyleControlElementData(), CEF_None),
+ pixelMetric(PM_ScrollBarExtent, TQStyleControlElementData(), CEF_None));
}
#endif
@@ -754,5 +1071,8 @@ private:
#endif
};
+inline TQStyle::ControlElementFlags operator|(const TQStyle::ControlElementFlags a, const TQStyle::ControlElementFlags b) { return static_cast<TQStyle::ControlElementFlags>(static_cast<int>(a) | static_cast<int>(b)); }
+// inline TQStyle::ControlElementFlags operator|=(TQStyle::ControlElementFlags &a, const TQStyle::ControlElementFlags b) { a = static_cast<TQStyle::ControlElementFlags>(static_cast<int>(a) | static_cast<int>(b)); return a; }
+
#endif // QT_NO_STYLE
#endif // TQSTYLE_H