Automated update from Qt3

pull/1/head
Timothy Pearson 12 years ago
parent fe7969ef88
commit c73edd8f63

@ -42,11 +42,19 @@
#ifndef QT_H #ifndef QT_H
#include "ntqobject.h" #include "ntqobject.h"
#include "ntqpixmap.h"
#include "ntqcolor.h"
#include "ntqiconset.h"
#include "ntqtabbar.h"
#include "ntqtoolbutton.h"
#endif // QT_H #endif // QT_H
#ifndef QT_NO_STYLE #ifndef QT_NO_STYLE
/* DEV ONLY */
/* #define MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED 1 */
class TQPopupMenu; class TQPopupMenu;
class TQStylePrivate; class TQStylePrivate;
class TQMenuItem; class TQMenuItem;
@ -58,26 +66,26 @@ class TQStyleOption {
public: public:
enum StyleOptionDefault { Default }; 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 // Note: we don't use default arguments since that is unnecessary
// initialization. // initialization.
TQStyleOption(int in1) : TQStyleOption(int in1) :
def(FALSE), i1(in1) {} def(FALSE), tb(NULL), i1(in1) {}
TQStyleOption(int in1, int in2) : 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) : TQStyleOption(int in1, int in2, int in3, int in4) :
def(FALSE), i1(in1), i2(in2), i3(in3), i4(in4) {} def(FALSE), tb(NULL), i1(in1), i2(in2), i3(in3), i4(in4) {}
TQStyleOption(TQMenuItem* m) : def(FALSE), mi(m) {} TQStyleOption(TQMenuItem* m) : def(FALSE), mi(m), tb(NULL) {}
TQStyleOption(TQMenuItem* m, int in1) : def(FALSE), mi(m), i1(in1) {} TQStyleOption(TQMenuItem* m, int in1) : def(FALSE), mi(m), tb(NULL), i1(in1) {}
TQStyleOption(TQMenuItem* m, int in1, int in2) : def(FALSE), mi(m), i1(in1), i2(in2) {} TQStyleOption(TQMenuItem* m, int in1, int in2) : def(FALSE), mi(m), tb(NULL), i1(in1), i2(in2) {}
TQStyleOption(const TQColor& c) : def(FALSE), cl(&c) {} TQStyleOption(const TQColor& c) : def(FALSE), tb(NULL), cl(&c) {}
TQStyleOption(TQTab* t) : def(FALSE), tb(t) {} TQStyleOption(TQTab* t) : def(FALSE), tb(t) {}
TQStyleOption(TQListViewItem* i) : def(FALSE), li(i) {} TQStyleOption(TQListViewItem* i) : def(FALSE), tb(NULL), li(i) {}
TQStyleOption(TQCheckListItem* i) : def(FALSE), cli(i) {} TQStyleOption(TQCheckListItem* i) : def(FALSE), tb(NULL), cli(i) {}
TQStyleOption(TQt::ArrowType a) : def(FALSE), i1((int)a) {} TQStyleOption(TQt::ArrowType a) : def(FALSE), tb(NULL), i1((int)a) {}
TQStyleOption(const TQRect& r) : def(FALSE), i1(r.x()), i2(r.y()), i3(r.width()),i4(r.height()){} 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), p1((void*)w) {} TQStyleOption(TQWidget *w) : def(FALSE), tb(NULL), p1((void*)w) {}
bool isDefault() const { return def; } bool isDefault() const { return def; }
@ -121,6 +129,118 @@ private:
class TQStyleHintReturn; // not defined yet 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 class Q_EXPORT TQStyle: public TQObject
{ {
TQ_OBJECT TQ_OBJECT
@ -151,6 +271,30 @@ public:
const TQPixmap *pixmap, const TQString &text, const TQPixmap *pixmap, const TQString &text,
int len = -1, const TQColor *penColor = 0 ) const; 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 { enum PrimitiveElement {
PE_ButtonCommand, PE_ButtonCommand,
@ -252,8 +396,23 @@ public:
}; };
typedef uint SFlags; 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,
const TQColorGroup &cg,
SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const = 0;
// New API
virtual void drawPrimitive( PrimitiveElement pe, virtual void drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -294,6 +453,11 @@ public:
CE_CustomBase = 0xf0000000 CE_CustomBase = 0xf0000000
}; };
// Old API
// DEPRECATED
#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
__attribute__ ((deprecated))
#endif
virtual void drawControl( ControlElement element, virtual void drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQWidget *widget,
@ -301,12 +465,38 @@ public:
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how = Style_Default, SFlags how = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const = 0; 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, virtual void drawControlMask( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQWidget *widget,
const TQRect &r, const TQRect &r,
const TQStyleOption& = TQStyleOption::Default ) const = 0; 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 { enum SubRect {
SR_PushButtonContents, SR_PushButtonContents,
SR_PushButtonFocusRect, SR_PushButtonFocusRect,
@ -347,8 +537,16 @@ public:
SR_CustomBase = 0xf0000000 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; 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{ enum ComplexControl{
CC_SpinWidget, CC_SpinWidget,
@ -411,6 +609,11 @@ public:
typedef uint SCFlags; typedef uint SCFlags;
// Old API
// DEPRECATED
#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
__attribute__ ((deprecated))
#endif
virtual void drawComplexControl( ComplexControl control, virtual void drawComplexControl( ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQWidget *widget,
@ -424,21 +627,79 @@ public:
#endif #endif
SCFlags subActive = SC_None, SCFlags subActive = SC_None,
const TQStyleOption& = TQStyleOption::Default ) const = 0; 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, virtual void drawComplexControlMask( ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQWidget *widget,
const TQRect &r, const TQRect &r,
const TQStyleOption& = TQStyleOption::Default ) const = 0; 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, virtual TQRect querySubControlMetrics( ComplexControl control,
const TQWidget *widget, const TQWidget *widget,
SubControl sc, SubControl sc,
const TQStyleOption& = TQStyleOption::Default ) const = 0; 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, virtual SubControl querySubControl( ComplexControl control,
const TQWidget *widget, const TQWidget *widget,
const TQPoint &pos, const TQPoint &pos,
const TQStyleOption& = TQStyleOption::Default ) const = 0; 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 { enum PixelMetric {
PM_ButtonMargin, PM_ButtonMargin,
@ -508,7 +769,18 @@ public:
PM_CustomBase = 0xf0000000 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, virtual int pixelMetric( PixelMetric metric,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQWidget *widget = 0 ) const = 0; const TQWidget *widget = 0 ) const = 0;
@ -536,11 +808,23 @@ public:
CT_CustomBase = 0xf0000000 CT_CustomBase = 0xf0000000
}; };
// Old API
// DEPRECATED
#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
__attribute__ ((deprecated))
#endif
virtual TQSize sizeFromContents( ContentsType contents, virtual TQSize sizeFromContents( ContentsType contents,
const TQWidget *widget, const TQWidget *widget,
const TQSize &contentsSize, const TQSize &contentsSize,
const TQStyleOption& = TQStyleOption::Default ) const = 0; 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 { enum StyleHint {
// ... // ...
// the general hints // the general hints
@ -687,12 +971,26 @@ public:
SH_CustomBase = 0xf0000000 SH_CustomBase = 0xf0000000
}; };
// Old API
// DEPRECATED
#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
__attribute__ ((deprecated))
#endif
virtual int styleHint( StyleHint stylehint, virtual int styleHint( StyleHint stylehint,
const TQWidget *widget = 0, const TQWidget *widget = 0,
const TQStyleOption& = TQStyleOption::Default, const TQStyleOption& = TQStyleOption::Default,
TQStyleHintReturn* returnData = 0 TQStyleHintReturn* returnData = 0
) const = 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 { enum StylePixmap {
SP_TitleBarMinButton, SP_TitleBarMinButton,
@ -711,13 +1009,32 @@ public:
SP_CustomBase = 0xf0000000 SP_CustomBase = 0xf0000000
}; };
// Old API
// DEPRECATED
#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
__attribute__ ((deprecated))
#endif
virtual TQPixmap stylePixmap( StylePixmap stylepixmap, virtual TQPixmap stylePixmap( StylePixmap stylepixmap,
const TQWidget *widget = 0, const TQWidget *widget = 0,
const TQStyleOption& = TQStyleOption::Default ) const = 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 ); 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 ); static TQRect visualRect( const TQRect &logical, const TQRect &bounding );
@ -728,19 +1045,19 @@ public:
#ifndef QT_NO_COMPAT #ifndef QT_NO_COMPAT
int defaultFrameWidth() const int defaultFrameWidth() const
{ {
return pixelMetric( PM_DefaultFrameWidth ); return pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None );
} }
void tabbarMetrics( const TQWidget* t, void tabbarMetrics( const TQWidget* t,
int& hf, int& vf, int& ov ) const int& hf, int& vf, int& ov ) const
{ {
hf = pixelMetric( PM_TabBarTabHSpace, t ); hf = pixelMetric( PM_TabBarTabHSpace, TQStyleControlElementData(), CEF_None, t );
vf = pixelMetric( PM_TabBarTabVSpace, t ); vf = pixelMetric( PM_TabBarTabVSpace, TQStyleControlElementData(), CEF_None, t );
ov = pixelMetric( PM_TabBarBaseOverlap, t ); ov = pixelMetric( PM_TabBarBaseOverlap, TQStyleControlElementData(), CEF_None, t );
} }
TQSize scrollBarExtent() const TQSize scrollBarExtent() const
{ {
return TQSize(pixelMetric(PM_ScrollBarExtent), return TQSize(pixelMetric(PM_ScrollBarExtent, TQStyleControlElementData(), CEF_None),
pixelMetric(PM_ScrollBarExtent)); pixelMetric(PM_ScrollBarExtent, TQStyleControlElementData(), CEF_None));
} }
#endif #endif
@ -754,5 +1071,8 @@ private:
#endif #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 // QT_NO_STYLE
#endif // TQSTYLE_H #endif // TQSTYLE_H

@ -456,6 +456,9 @@ public:
WState testWState( WState s ) const; WState testWState( WState s ) const;
WFlags testWFlags( WFlags f ) const; WFlags testWFlags( WFlags f ) const;
NFlags testNFlags( NFlags f ) const; NFlags testNFlags( NFlags f ) const;
uint getWState() const;
WFlags getWFlags() const;
NFlags getNFlags() const;
static TQWidget * find( WId ); static TQWidget * find( WId );
static TQWidgetMapper *wmapper(); static TQWidgetMapper *wmapper();
@ -573,13 +576,10 @@ protected:
bool destroyOldWindow = TRUE ); bool destroyOldWindow = TRUE );
virtual void destroy( bool destroyWindow = TRUE, virtual void destroy( bool destroyWindow = TRUE,
bool destroySubWindows = TRUE ); bool destroySubWindows = TRUE );
uint getWState() const;
virtual void setWState( uint ); virtual void setWState( uint );
void clearWState( uint n ); void clearWState( uint n );
WFlags getWFlags() const;
virtual void setWFlags( WFlags ); virtual void setWFlags( WFlags );
void clearWFlags( WFlags n ); void clearWFlags( WFlags n );
NFlags getNFlags() const;
virtual void setNFlags( NFlags ); virtual void setNFlags( NFlags );
void clearNFlags( NFlags n ); void clearNFlags( NFlags n );

@ -802,11 +802,14 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
*/ */
/*! /*!
\fn void TQStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, const TQRect &r, const TQColorGroup &cg, SFlags flags, const TQStyleOption& opt) const \fn void TQStyle::drawPrimitive( PrimitiveElement pe, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags flags, const TQStyleOption& opt) const
Draws the style PrimitiveElement \a pe using the painter \a p in Draws the style PrimitiveElement \a pe using the painter \a p in
the area \a r. Colors are used from the color group \a cg. the area \a r. Colors are used from the color group \a cg.
\a ceData and \a elementFlags provide additional information about
the widget for which the PrimitiveElement is being drawn.
The rect \a r should be in screen coordinates. The rect \a r should be in screen coordinates.
The \a flags argument is used to control how the PrimitiveElement The \a flags argument is used to control how the PrimitiveElement
@ -932,20 +935,25 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
*/ */
/*! /*!
\fn void TQStyle::drawControl( ControlElement element, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQColorGroup &cg, SFlags how, const TQStyleOption& opt) const \fn void TQStyle::drawControl( ControlElement element, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags how, const TQStyleOption& opt, const TQWidget *widget) const
Draws the ControlElement \a element using the painter \a p in the Draws the ControlElement \a element using the painter \a p in the
area \a r. Colors are used from the color group \a cg. area \a r. Colors are used from the color group \a cg.
The rect \a r should be in screen coordinates. The rect \a r should be in screen coordinates.
\a ceData and \a elementFlags provide additional information about
the widget for which the PrimitiveElement is being drawn.
The \a how argument is used to control how the ControlElement is The \a how argument is used to control how the ControlElement is
drawn. Multiple flags can be OR'ed together. See the table below drawn. Multiple flags can be OR'ed together. See the table below
for an explanation of which flags are used with the various for an explanation of which flags are used with the various
ControlElements. ControlElements.
The \a widget argument is a pointer to a TQWidget or one of its The \a widget argument is a pointer to a TQWidget or one of its
subclasses. The widget can be cast to the appropriate type based subclasses. Note that usage of the widget argument is deprecated
in favor of specifying widget parameters via \a ceData and \a elementFlags.
The widget can be cast to the appropriate type based
on the value of \a element. The \a opt argument can be used to on the value of \a element. The \a opt argument can be used to
pass extra information required when drawing the ControlElement. pass extra information required when drawing the ControlElement.
Note that \a opt may be the default value even for ControlElements Note that \a opt may be the default value even for ControlElements
@ -1086,14 +1094,19 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
*/ */
/*! /*!
\fn void TQStyle::drawControlMask( ControlElement element, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQStyleOption& opt) const \fn void TQStyle::drawControlMask( ControlElement element, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, const TQStyleOption& opt, const TQWidget *widget) const
Draw a bitmask for the ControlElement \a element using the painter Draw a bitmask for the ControlElement \a element using the painter
\a p in the area \a r. See drawControl() for an explanation of the \a p in the area \a r. See drawControl() for an explanation of the
use of the \a widget and \a opt arguments. use of the \a widget and \a opt arguments.
\a ceData and \a elementFlags provide additional information about
the widget for which the PrimitiveElement is being drawn.
The rect \a r should be in screen coordinates. The rect \a r should be in screen coordinates.
\a widget is deprecated and should not be used.
\sa drawControl(), ControlElement \sa drawControl(), ControlElement
*/ */
@ -1154,15 +1167,19 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
*/ */
/*! /*!
\fn TQRect TQStyle::subRect( SubRect subrect, const TQWidget *widget ) const; \fn TQRect TQStyle::subRect( SubRect subrect, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const;
Returns the sub-area \a subrect for the \a widget in logical Returns the sub-area \a subrect for the \a widget in logical
coordinates. coordinates.
\a ceData and \a elementFlags provide additional information about
the widget for which the PrimitiveElement is being drawn.
The \a widget argument is a pointer to a TQWidget or one of its The \a widget argument is a pointer to a TQWidget or one of its
subclasses. The widget can be cast to the appropriate type based subclasses. Note that usage of \a widget is deprecated in favor
on the value of \a subrect. See the table below for the of \a ceData and \a elementFlags. The widget can be cast to the
appropriate \a widget casts: appropriate type based on the value of \a subrect. See the table
below for the appropriate \a widget casts:
\table \table
\header \i SubRect \i Widget Cast \header \i SubRect \i Widget Cast
@ -1282,7 +1299,7 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
*/ */
/*! /*!
\fn void TQStyle::drawComplexControl( ComplexControl control, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQColorGroup &cg, SFlags how, SCFlags sub, SCFlags subActive, const TQStyleOption& opt ) const \fn void TQStyle::drawComplexControl( ComplexControl control, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r, const TQColorGroup &cg, SFlags how, SCFlags sub, SCFlags subActive, const TQStyleOption& opt, const TQWidget *widget ) const
Draws the ComplexControl \a control using the painter \a p in the Draws the ComplexControl \a control using the painter \a p in the
area \a r. Colors are used from the color group \a cg. The \a sub area \a r. Colors are used from the color group \a cg. The \a sub
@ -1295,6 +1312,9 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
coordinates into screen coordinates when using drawPrimitive() and coordinates into screen coordinates when using drawPrimitive() and
drawControl(). drawControl().
\a ceData and \a elementFlags provide additional information about
the widget for which the PrimitiveElement is being drawn.
The \a how argument is used to control how the ComplexControl is The \a how argument is used to control how the ComplexControl is
drawn. Multiple flags can OR'ed together. See the table below for drawn. Multiple flags can OR'ed together. See the table below for
an explanation of which flags are used with the various an explanation of which flags are used with the various
@ -1302,11 +1322,13 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
The \a widget argument is a pointer to a TQWidget or one of its The \a widget argument is a pointer to a TQWidget or one of its
subclasses. The widget can be cast to the appropriate type based subclasses. The widget can be cast to the appropriate type based
on the value of \a control. The \a opt argument can be used to on the value of \a control. Note that usage of \a widget is
pass extra information required when drawing the ComplexControl. deprecated in favor of \a ceData and \a elementFlags. The \a opt
Note that \a opt may be the default value even for ComplexControls argument can be used to pass extra information required when
that can make use of the extra options. See the table below for drawing the ComplexControl. Note that \a opt may be the default
the appropriate \a widget and \a opt usage: value even for ComplexControls that can make use of the extra
options. See the table below for the appropriate \a widget and
\a opt usage:
\table \table
\header \i ComplexControl<br>\& Widget Cast \header \i ComplexControl<br>\& Widget Cast
@ -1375,26 +1397,34 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
*/ */
/*! /*!
\fn void TQStyle::drawComplexControlMask( ComplexControl control, TQPainter *p, const TQWidget *widget, const TQRect &r, const TQStyleOption& opt) const \fn void TQStyle::drawComplexControlMask( ComplexControl control, TQPainter *p, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQRect &r, const TQStyleOption& opt, const TQWidget *widget) const
Draw a bitmask for the ComplexControl \a control using the painter Draw a bitmask for the ComplexControl \a control using the painter
\a p in the area \a r. See drawComplexControl() for an explanation \a p in the area \a r. See drawComplexControl() for an explanation
of the use of the \a widget and \a opt arguments. of the use of the \a widget and \a opt arguments.
\a ceData and \a elementFlags provide additional information about
the widget for which the PrimitiveElement is being drawn.
The rect \a r should be in logical coordinates. Reimplementations The rect \a r should be in logical coordinates. Reimplementations
of this function should use visualRect() to change the logical of this function should use visualRect() to change the logical
corrdinates into screen coordinates when using drawPrimitive() and corrdinates into screen coordinates when using drawPrimitive() and
drawControl(). drawControl().
Note that usage of \a widget is deprecated in favor of \a ceData and \a elementFlags.
\sa drawComplexControl() ComplexControl \sa drawComplexControl() ComplexControl
*/ */
/*! /*!
\fn TQRect TQStyle::querySubControlMetrics( ComplexControl control, const TQWidget *widget, SubControl subcontrol, const TQStyleOption& opt = TQStyleOption::Default ) const; \fn TQRect TQStyle::querySubControlMetrics( ComplexControl control, TQStyleControlElementData ceData, ControlElementFlags elementFlags, SubControl subcontrol, const TQStyleOption& opt = TQStyleOption::Default, const TQWidget *widget = 0 ) const;
Returns the rect for the SubControl \a subcontrol for \a widget in Returns the rect for the SubControl \a subcontrol for \a widget in
logical coordinates. logical coordinates.
\a ceData and \a elementFlags provide additional information about
the widget for which the PrimitiveElement is being drawn.
The \a widget argument is a pointer to a TQWidget or one of its The \a widget argument is a pointer to a TQWidget or one of its
subclasses. The widget can be cast to the appropriate type based subclasses. The widget can be cast to the appropriate type based
on the value of \a control. The \a opt argument can be used to on the value of \a control. The \a opt argument can be used to
@ -1403,11 +1433,13 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
that can make use of the extra options. See drawComplexControl() that can make use of the extra options. See drawComplexControl()
for an explanation of the \a widget and \a opt arguments. for an explanation of the \a widget and \a opt arguments.
Note that usage of \a widget is deprecated in favor of \a ceData and \a elementFlags.
\sa drawComplexControl(), ComplexControl, SubControl \sa drawComplexControl(), ComplexControl, SubControl
*/ */
/*! /*!
\fn SubControl TQStyle::querySubControl( ComplexControl control, const TQWidget *widget, const TQPoint &pos, const TQStyleOption& opt = TQStyleOption::Default ) const; \fn SubControl TQStyle::querySubControl( ComplexControl control, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQPoint &pos, const TQStyleOption& opt = TQStyleOption::Default, const TQWidget *widget = 0 ) const;
Returns the SubControl for \a widget at the point \a pos. The \a Returns the SubControl for \a widget at the point \a pos. The \a
widget argument is a pointer to a TQWidget or one of its widget argument is a pointer to a TQWidget or one of its
@ -1418,11 +1450,16 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
that can make use of the extra options. See drawComplexControl() that can make use of the extra options. See drawComplexControl()
for an explanation of the \a widget and \a opt arguments. for an explanation of the \a widget and \a opt arguments.
\a ceData and \a elementFlags provide additional information about
the widget for which the PrimitiveElement is being drawn.
Note that \a pos is passed in screen coordinates. When using Note that \a pos is passed in screen coordinates. When using
querySubControlMetrics() to check for hits and misses, use querySubControlMetrics() to check for hits and misses, use
visualRect() to change the logical coordinates into screen visualRect() to change the logical coordinates into screen
coordinates. coordinates.
Note that usage of \a widget is deprecated in favor of \a ceData and \a elementFlags.
\sa drawComplexControl(), ComplexControl, SubControl, querySubControlMetrics() \sa drawComplexControl(), ComplexControl, SubControl, querySubControlMetrics()
*/ */
@ -1528,14 +1565,20 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
*/ */
/*! /*!
\fn int TQStyle::pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const; \fn int TQStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const;
Returns the pixel metric for \a metric.
Returns the pixel metric for \a metric. The \a widget argument is \a ceData and \a elementFlags provide additional information about
a pointer to a TQWidget or one of its subclasses. The widget can be the widget for which the PrimitiveElement is being drawn.
cast to the appropriate type based on the value of \a metric. Note
that \a widget may be zero even for PixelMetrics that can make use The \a widget argument is a pointer to a TQWidget or one of its
of \a widget. See the table below for the appropriate \a widget subclasses. The widget can be cast to the appropriate type based
casts: on the value of \a metric. Note that \a widget may be zero even
for PixelMetrics that can make use of \a widget. Note also that
usage of \a widget is deprecated in favor of \a ceData and
\a elementFlags. See the table below for the appropriate
\a widget casts:
\table \table
\header \i PixelMetric \i Widget Cast \header \i PixelMetric \i Widget Cast
@ -1584,18 +1627,22 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
*/ */
/*! /*!
\fn TQSize TQStyle::sizeFromContents( ContentsType contents, const TQWidget *widget, const TQSize &contentsSize, const TQStyleOption& opt = TQStyleOption::Default ) const; \fn TQSize TQStyle::sizeFromContents( ContentsType contents, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQSize &contentsSize, const TQStyleOption& opt = TQStyleOption::Default, const TQWidget *widget = 0 ) const;
Returns the size of \a widget based on the contents size \a Returns the size of \a widget based on the contents size \a
contentsSize. contentsSize.
\a ceData and \a elementFlags provide additional information about
the widget for which the PrimitiveElement is being drawn.
The \a widget argument is a pointer to a TQWidget or one of its The \a widget argument is a pointer to a TQWidget or one of its
subclasses. The widget can be cast to the appropriate type based subclasses. The widget can be cast to the appropriate type based
on the value of \a contents. The \a opt argument can be used to on the value of \a contents. The \a opt argument can be used to
pass extra information required when calculating the size. Note pass extra information required when calculating the size. Note
that \a opt may be the default value even for ContentsTypes that that \a opt may be the default value even for ContentsTypes that
can make use of the extra options. See the table below for the can make use of the extra options. Note that usage of \a widget
appropriate \a widget and \a opt usage: is deprecated in favor of \a ceData and \a elementFlags. See the
table below for the appropriate \a widget and \a opt usage:
\table \table
\header \i ContentsType \i Widget Cast \i Options \i Notes \header \i ContentsType \i Widget Cast \i Options \i Notes
@ -1770,12 +1817,18 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
*/ */
/*! /*!
\fn int TQStyle::styleHint( StyleHint stylehint, const TQWidget *widget = 0, const TQStyleOption &opt = TQStyleOption::Default, TQStyleHintReturn *returnData = 0 ) const; \fn int TQStyle::styleHint( StyleHint stylehint, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &opt = TQStyleOption::Default, TQStyleHintReturn *returnData = 0, const TQWidget *widget = 0 ) const;
Returns the style hint \a stylehint for \a widget. Currently, \a Returns the style hint \a stylehint for \a widget. Currently, \a
widget, \a opt, and \a returnData are unused; they're included to widget, \a opt, and \a returnData are unused; they're included to
allow for future enhancements. allow for future enhancements.
\a ceData and \a elementFlags provide additional information about
the widget for which the PrimitiveElement is being drawn.
Note that usage of \a widget is deprecated in favor of \a ceData
and \a elementFlags.
For an explanation of the return value see \l StyleHint. For an explanation of the return value see \l StyleHint.
*/ */
@ -1811,10 +1864,13 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
*/ */
/*! /*!
\fn TQPixmap TQStyle::stylePixmap( StylePixmap stylepixmap, const TQWidget *widget = 0, const TQStyleOption& opt = TQStyleOption::Default ) const; \fn TQPixmap TQStyle::stylePixmap( StylePixmap stylepixmap, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption& opt = TQStyleOption::Default, const TQWidget *widget = 0 ) const;
Returns a pixmap for \a stylepixmap. Returns a pixmap for \a stylepixmap.
\a ceData and \a elementFlags provide additional information about
the widget for which the PrimitiveElement is being drawn.
The \a opt argument can be used to pass extra information required The \a opt argument can be used to pass extra information required
when drawing the ControlElement. Note that \a opt may be the when drawing the ControlElement. Note that \a opt may be the
default value even for StylePixmaps that can make use of the extra default value even for StylePixmaps that can make use of the extra
@ -1822,8 +1878,9 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
The \a widget argument is a pointer to a TQWidget or one of its The \a widget argument is a pointer to a TQWidget or one of its
subclasses. The widget can be cast to the appropriate type based subclasses. The widget can be cast to the appropriate type based
on the value of \a stylepixmap. See the table below for the on the value of \a stylepixmap. Note that usage of \a widget is
appropriate \a widget casts: deprecated in favor of \a ceData and \a elementFlags.See the table
below for the appropriate \a widget casts:
\table \table
\header \i StylePixmap \i Widget Cast \header \i StylePixmap \i Widget Cast
@ -1847,11 +1904,33 @@ void TQStyle::drawItem( TQPainter *p, const TQRect &r,
function is provided to aid style implementors in supporting function is provided to aid style implementors in supporting
right-to-left mode. right-to-left mode.
Note that this function is deprecated in favor of visualRect( const TQRect &logical, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags );
\sa TQApplication::reverseLayout() \sa TQApplication::reverseLayout()
*/ */
TQRect TQStyle::visualRect( const TQRect &logical, const TQWidget *w ) TQRect TQStyle::visualRect( const TQRect &logical, const TQWidget *w )
{ {
TQRect boundingRect = w->rect(); TQStyleControlElementData ceData;
ceData.rect = w->rect();
return visualRect(logical, ceData, CEF_None);
}
/*!
\fn TQRect TQStyle::visualRect( const TQRect &logical, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags );
Returns the rect \a logical in screen coordinates. The bounding
rect for the widget described by \a ceData and \a elementFlags
is used to perform the translation. This function is provided to
aid style implementors in supporting
right-to-left mode.
\sa TQApplication::reverseLayout()
*/
TQRect TQStyle::visualRect( const TQRect &logical, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags )
{
Q_UNUSED(elementFlags)
TQRect boundingRect = ceData.rect;
TQRect r = logical; TQRect r = logical;
if ( TQApplication::reverseLayout() ) if ( TQApplication::reverseLayout() )
r.moveBy( 2*(boundingRect.right() - logical.right()) + r.moveBy( 2*(boundingRect.right() - logical.right()) +

@ -62,18 +62,22 @@ public:
TQCDEStyle( bool useHighlightCols = FALSE ); TQCDEStyle( bool useHighlightCols = FALSE );
virtual ~TQCDEStyle(); virtual ~TQCDEStyle();
int pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const; int pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const;
void drawControl( ControlElement element, void drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how = Style_Default, SFlags how = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawPrimitive( PrimitiveElement pe, void drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,

@ -55,14 +55,28 @@ public:
TQCommonStyle(); TQCommonStyle();
~TQCommonStyle(); ~TQCommonStyle();
// Old API
// DEPRECATED
__attribute__ ((deprecated)) void drawPrimitive( PrimitiveElement pe,
TQPainter *p,
const TQRect &r,
const TQColorGroup &cg,
SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const;
// New API
void drawPrimitive( PrimitiveElement pe, void drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default ) const;
void drawControl( ControlElement element, // Old API
// DEPRECATED
__attribute__ ((deprecated)) void drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQWidget *widget,
const TQRect &r, const TQRect &r,
@ -70,15 +84,44 @@ public:
SFlags how = Style_Default, SFlags how = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default ) const;
void drawControlMask( ControlElement element, // New API
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 ) const;
// Old API
// DEPRECATED
__attribute__ ((deprecated)) void drawControlMask( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQWidget *widget,
const TQRect &r, const TQRect &r,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default ) const;
TQRect subRect( SubRect r, const TQWidget *widget ) const; // New API
void drawControlMask( ControlElement element,
TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r,
const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawComplexControl( ComplexControl control, // Old API
// DEPRECATED
__attribute__ ((deprecated)) TQRect subRect( SubRect r, const TQWidget *widget ) const;
// New API
TQRect subRect( SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const;
// Old API
// DEPRECATED
__attribute__ ((deprecated)) void drawComplexControl( ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQWidget *widget,
const TQRect &r, const TQRect &r,
@ -92,35 +135,112 @@ public:
SCFlags subActive = SC_None, SCFlags subActive = SC_None,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default ) const;
void drawComplexControlMask( ComplexControl control, // New API
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;
// Old API
// DEPRECATED
__attribute__ ((deprecated)) void drawComplexControlMask( ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, const TQWidget *widget,
const TQRect &r, const TQRect &r,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default ) const;
TQRect querySubControlMetrics( ComplexControl control, // New API
void drawComplexControlMask( ComplexControl control,
TQPainter *p,
const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r,
const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
// Old API
// DEPRECATED
__attribute__ ((deprecated)) TQRect querySubControlMetrics( ComplexControl control,
const TQWidget *widget, const TQWidget *widget,
SubControl sc, SubControl sc,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default ) const;
SubControl querySubControl( ComplexControl control, // New API
TQRect querySubControlMetrics( ComplexControl control,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sc,
const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
// Old API
// DEPRECATED
__attribute__ ((deprecated)) SubControl querySubControl( ComplexControl control,
const TQWidget *widget, const TQWidget *widget,
const TQPoint &pos, const TQPoint &pos,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default ) const;
int pixelMetric( PixelMetric m, const TQWidget *widget = 0 ) const; // New API
SubControl querySubControl( ComplexControl control,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQPoint &pos,
const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQSize sizeFromContents( ContentsType s, // Old API
// DEPRECATED
__attribute__ ((deprecated)) int pixelMetric( PixelMetric m, const TQWidget *widget = 0 ) const;
// New API
int pixelMetric( PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const;
// Old API
// DEPRECATED
__attribute__ ((deprecated)) TQSize sizeFromContents( ContentsType s,
const TQWidget *widget, const TQWidget *widget,
const TQSize &contentsSize, const TQSize &contentsSize,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default ) const;
int styleHint(StyleHint sh, const TQWidget *, const TQStyleOption &, TQStyleHintReturn *) const; // New API
TQSize sizeFromContents( ContentsType s,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsSize,
const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQPixmap stylePixmap( StylePixmap sp, // Old API
// DEPRECATED
__attribute__ ((deprecated)) int styleHint(StyleHint sh, const TQWidget *, const TQStyleOption &, TQStyleHintReturn *) const;
// New API
int styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &, TQStyleHintReturn *, const TQWidget * w) const;
// Old API
// DEPRECATED
__attribute__ ((deprecated)) TQPixmap stylePixmap( StylePixmap sp,
const TQWidget *widget = 0, const TQWidget *widget = 0,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default ) const;
// New API
TQPixmap stylePixmap( StylePixmap sp,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
private: private:
// Disabled copy constructor and operator= // Disabled copy constructor and operator=
@ -130,7 +250,8 @@ private:
#endif #endif
}; };
Q_EXPORT TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* widget, const TQStyleOption& opt, bool populateReliantFields=true);
Q_EXPORT TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* object, TQStringList objectTypeList, const TQStyleOption& opt);
#endif // QT_NO_STYLE #endif // QT_NO_STYLE

@ -58,10 +58,10 @@ class Q_EXPORT_STYLE_COMPACT TQCompactStyle : public TQWindowsStyle
public: public:
TQCompactStyle(); TQCompactStyle();
int pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ); int pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 );
void drawControl( ControlElement element, TQPainter *p, const TQWidget *w, const TQRect &r, 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 TQColorGroup &cg, SFlags how = Style_Default, const TQStyleOption& = TQStyleOption::Default, const TQWidget *w = 0 );
private: // Disabled copy constructor and operator= private: // Disabled copy constructor and operator=
#if defined(TQ_DISABLE_COPY) #if defined(TQ_DISABLE_COPY)

@ -71,6 +71,8 @@ public:
void drawPrimitive( PrimitiveElement pe, void drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -78,17 +80,20 @@ public:
void drawControl( ControlElement element, void drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how = Style_Default, SFlags how = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQRect subRect(SubRect r, const TQWidget *widget) const; TQRect subRect(SubRect r, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const;
void drawComplexControl(ComplexControl control, void drawComplexControl(ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how = Style_Default, SFlags how = Style_Default,
@ -98,17 +103,20 @@ public:
SCFlags controls = (uint)SC_All, SCFlags controls = (uint)SC_All,
#endif #endif
SCFlags active = SC_None, SCFlags active = SC_None,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQRect querySubControlMetrics(ComplexControl control, TQRect querySubControlMetrics(ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl subcontrol, SubControl subcontrol,
const TQStyleOption& = TQStyleOption::Default) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0) const;
int pixelMetric(PixelMetric metric, const TQWidget *widget = 0) const; int pixelMetric(PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0) const;
int styleHint(StyleHint sh, const TQWidget *, const TQStyleOption & = TQStyleOption::Default, int styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default,
TQStyleHintReturn* = 0) const; TQStyleHintReturn* = 0, const TQWidget * = 0) const;
protected: protected:
bool eventFilter(TQObject *, TQEvent *); bool eventFilter(TQObject *, TQEvent *);

@ -75,6 +75,8 @@ public:
// new style API // new style API
void drawPrimitive( PrimitiveElement pe, void drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -82,15 +84,18 @@ public:
void drawControl( ControlElement element, void drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how = Style_Default, SFlags how = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawComplexControl( ComplexControl control, void drawComplexControl( ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect& r, const TQRect& r,
const TQColorGroup& cg, const TQColorGroup& cg,
SFlags how = Style_Default, SFlags how = Style_Default,
@ -100,26 +105,31 @@ public:
SCFlags sub = (uint)SC_All, SCFlags sub = (uint)SC_All,
#endif #endif
SCFlags subActive = SC_None, SCFlags subActive = SC_None,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
TQRect querySubControlMetrics( ComplexControl control, TQRect querySubControlMetrics( ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sc, SubControl sc,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
int pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const; int pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const;
TQSize sizeFromContents( ContentsType contents, TQSize sizeFromContents( ContentsType contents,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsSize, const TQSize &contentsSize,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQRect subRect( SubRect r, const TQWidget *widget ) const; TQRect subRect( SubRect r, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const;
TQPixmap stylePixmap(StylePixmap, const TQWidget * = 0, const TQStyleOption& = TQStyleOption::Default) const; TQPixmap stylePixmap(StylePixmap, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption& = TQStyleOption::Default, const TQWidget * = 0) const;
int styleHint(StyleHint sh, const TQWidget *, const TQStyleOption & = TQStyleOption::Default, int styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default,
TQStyleHintReturn* = 0) const; TQStyleHintReturn* = 0, const TQWidget * = 0) const;
private: private:
bool highlightCols; bool highlightCols;

@ -65,6 +65,8 @@ public:
// new Style Stuff // new Style Stuff
void drawPrimitive( PrimitiveElement pe, void drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -72,15 +74,18 @@ public:
void drawControl( ControlElement element, void drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how = Style_Default, SFlags how = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawComplexControl( ComplexControl control, void drawComplexControl( ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how = Style_Default, SFlags how = Style_Default,
@ -90,16 +95,19 @@ public:
SCFlags sub = (uint)SC_All, SCFlags sub = (uint)SC_All,
#endif #endif
SCFlags subActive = SC_None, SCFlags subActive = SC_None,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQRect querySubControlMetrics( ComplexControl control, TQRect querySubControlMetrics( ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sc, SubControl sc,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
int pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const; int pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const;
TQRect subRect( SubRect r, const TQWidget *widget ) const; TQRect subRect( SubRect r, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const;
protected: protected:
TQColor mixedColor(const TQColor &, const TQColor &) const; TQColor mixedColor(const TQColor &, const TQColor &) const;

@ -74,6 +74,8 @@ public:
void drawPrimitive( PrimitiveElement pe, void drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -81,15 +83,18 @@ public:
void drawControl( ControlElement element, void drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how = Style_Default, SFlags how = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawComplexControl( ComplexControl control, void drawComplexControl( ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect& r, const TQRect& r,
const TQColorGroup& cg, const TQColorGroup& cg,
SFlags how = Style_Default, SFlags how = Style_Default,
@ -99,20 +104,25 @@ public:
SCFlags sub = (uint)SC_All, SCFlags sub = (uint)SC_All,
#endif #endif
SCFlags subActive = SC_None, SCFlags subActive = SC_None,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
int pixelMetric( PixelMetric metric, const TQWidget *widget = 0 ) const; int pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget = 0 ) const;
TQSize sizeFromContents( ContentsType contents, TQSize sizeFromContents( ContentsType contents,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsSize, const TQSize &contentsSize,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQRect subRect( SubRect r, const TQWidget *widget ) const; TQRect subRect( SubRect r, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const;
TQRect querySubControlMetrics( ComplexControl control, TQRect querySubControlMetrics( ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sc, SubControl sc,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
protected: protected:
bool eventFilter( TQObject*, TQEvent*); bool eventFilter( TQObject*, TQEvent*);

@ -74,6 +74,8 @@ public:
// new stuff // new stuff
void drawPrimitive( PrimitiveElement pe, void drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -81,15 +83,18 @@ public:
void drawControl( ControlElement element, void drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
void drawComplexControl( ComplexControl control, void drawComplexControl( ComplexControl control,
TQPainter* p, TQPainter* p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect& r, const TQRect& r,
const TQColorGroup& cg, const TQColorGroup& cg,
SFlags flags = Style_Default, SFlags flags = Style_Default,
@ -99,24 +104,31 @@ public:
SCFlags sub = (uint)SC_All, SCFlags sub = (uint)SC_All,
#endif #endif
SCFlags subActive = SC_None, SCFlags subActive = SC_None,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget* widget = 0 ) const;
int pixelMetric( PixelMetric metric, int pixelMetric( PixelMetric metric,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQWidget *widget = 0 ) const; const TQWidget *widget = 0 ) const;
TQSize sizeFromContents( ContentsType contents, TQSize sizeFromContents( ContentsType contents,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsSize, const TQSize &contentsSize,
const TQStyleOption& = TQStyleOption::Default ) const; const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
int styleHint(StyleHint sh, const TQWidget *, const TQStyleOption & = TQStyleOption::Default, int styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default,
TQStyleHintReturn* = 0) const; TQStyleHintReturn* = 0, const TQWidget* = 0) const;
TQPixmap stylePixmap( StylePixmap stylepixmap, TQPixmap stylePixmap( StylePixmap stylepixmap,
const TQWidget *widget = 0, TQStyleControlElementData ceData,
const TQStyleOption& = TQStyleOption::Default ) const; ControlElementFlags elementFlags,
const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const;
TQRect subRect( SubRect r, const TQWidget *widget ) const; TQRect subRect( SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const;
private: private:

@ -87,7 +87,7 @@ TQCDEStyle::~TQCDEStyle()
/*!\reimp /*!\reimp
*/ */
int TQCDEStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) const int TQCDEStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const
{ {
int ret; int ret;
@ -102,7 +102,7 @@ int TQCDEStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) const
ret = 13; ret = 13;
break; break;
default: default:
ret = TQMotifStyle::pixelMetric( metric, widget ); ret = TQMotifStyle::pixelMetric( metric, ceData, elementFlags, widget );
break; break;
} }
return ret; return ret;
@ -112,11 +112,13 @@ int TQCDEStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) const
*/ */
void TQCDEStyle::drawControl( ControlElement element, void TQCDEStyle::drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how, SFlags how,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch( element ) { switch( element ) {
@ -127,11 +129,11 @@ void TQCDEStyle::drawControl( ControlElement element,
&cg.brush( TQColorGroup::Button ) ); &cg.brush( TQColorGroup::Button ) );
else // other item else // other item
p->fillRect( r, cg.brush( TQColorGroup::Button ) ); p->fillRect( r, cg.brush( TQColorGroup::Button ) );
TQCommonStyle::drawControl( element, p, widget, r, cg, how, opt ); TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, how, opt, widget );
break; break;
} }
default: default:
TQMotifStyle::drawControl( element, p, widget, r, cg, how, opt ); TQMotifStyle::drawControl( element, p, ceData, elementFlags, r, cg, how, opt, widget );
break; break;
} }
@ -142,6 +144,8 @@ void TQCDEStyle::drawControl( ControlElement element,
*/ */
void TQCDEStyle::drawPrimitive( PrimitiveElement pe, void TQCDEStyle::drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -154,7 +158,7 @@ void TQCDEStyle::drawPrimitive( PrimitiveElement pe,
bool on = flags & Style_On; bool on = flags & Style_On;
bool showUp = !( down ^ on ); bool showUp = !( down ^ on );
TQBrush fill = showUp || flags & Style_NoChange ? cg.brush( TQColorGroup::Button ) : cg.brush( TQColorGroup::Mid ); TQBrush fill = showUp || flags & Style_NoChange ? cg.brush( TQColorGroup::Button ) : cg.brush( TQColorGroup::Mid );
qDrawShadePanel( p, r, cg, !showUp, pixelMetric( PM_DefaultFrameWidth ), &cg.brush( TQColorGroup::Button ) ); qDrawShadePanel( p, r, cg, !showUp, pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ), &cg.brush( TQColorGroup::Button ) );
if ( !( flags & Style_Off ) ) { if ( !( flags & Style_Off ) ) {
TQPointArray a( 7 * 2 ); TQPointArray a( 7 * 2 );
@ -360,7 +364,7 @@ void TQCDEStyle::drawPrimitive( PrimitiveElement pe,
} }
break; break;
default: default:
TQMotifStyle::drawPrimitive( pe, p, r, cg, flags, opt ); TQMotifStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
} }
} }

File diff suppressed because it is too large Load Diff

@ -55,7 +55,7 @@ TQCompactStyle::TQCompactStyle()
} }
/*! \reimp */ /*! \reimp */
int TQCompactStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) int TQCompactStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget )
{ {
int ret; int ret;
switch ( metric ) { switch ( metric ) {
@ -68,7 +68,7 @@ int TQCompactStyle::pixelMetric( PixelMetric metric, const TQWidget *widget )
ret = -1; ret = -1;
break; break;
default: default:
ret = TQWindowsStyle::pixelMetric( metric, widget ); ret = TQWindowsStyle::pixelMetric( metric, ceData, elementFlags, widget );
break; break;
} }
return ret; return ret;
@ -143,16 +143,15 @@ void drawPopupMenuItem( TQPainter* p, bool checkable,
} }
/*! \reimp */ /*! \reimp */
void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, const TQWidget *widget, const TQRect &r, void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQRect &r,
const TQColorGroup &g, SFlags flags, const TQStyleOption& opt ) const TQColorGroup &g, SFlags flags, const TQStyleOption& opt, const TQWidget *widget )
{ {
switch ( element ) { switch ( element ) {
case CE_PopupMenuItem: case CE_PopupMenuItem:
{ {
if (! widget || opt.isDefault()) if (! (elementFlags & CEF_HasWidget) || opt.isDefault())
break; break;
const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget;
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
if ( !mi ) if ( !mi )
break; break;
@ -160,7 +159,7 @@ void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, const TQ
int tab = opt.tabWidth(); int tab = opt.tabWidth();
int maxpmw = opt.maxIconWidth(); int maxpmw = opt.maxIconWidth();
bool dis = !(flags & Style_Enabled); bool dis = !(flags & Style_Enabled);
bool checkable = popupmenu->isCheckable(); bool checkable = (elementFlags & CEF_IsCheckable);
bool act = flags & Style_Active; bool act = flags & Style_Active;
int x, y, w, h; int x, y, w, h;
r.rect( &x, &y, &w, &h ); r.rect( &x, &y, &w, &h );
@ -313,7 +312,7 @@ void TQCompactStyle::drawControl( ControlElement element, TQPainter *p, const TQ
break; break;
default: default:
TQWindowsStyle::drawControl( element, p, widget, r, g, flags, opt ); TQWindowsStyle::drawControl( element, p, ceData, elementFlags, r, g, flags, opt, widget );
break; break;
} }
} }

@ -227,7 +227,7 @@ void TQMotifPlusStyle::unPolish(TQApplication *)
/*! \reimp */ /*! \reimp */
int TQMotifPlusStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) const int TQMotifPlusStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
int ret; int ret;
@ -259,7 +259,7 @@ int TQMotifPlusStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) co
break; break;
default: default:
ret = TQMotifStyle::pixelMetric(metric, widget); ret = TQMotifStyle::pixelMetric(metric, ceData, elementFlags, widget);
break; break;
} }
@ -270,6 +270,8 @@ int TQMotifPlusStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) co
/*! \reimp */ /*! \reimp */
void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe, void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -303,11 +305,11 @@ void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe,
break; break;
case PE_SpinWidgetUp: case PE_SpinWidgetUp:
drawPrimitive(PE_ArrowUp, p, r, cg, flags, opt); drawPrimitive(PE_ArrowUp, p, ceData, elementFlags, r, cg, flags, opt);
break; break;
case PE_SpinWidgetDown: case PE_SpinWidgetDown:
drawPrimitive(PE_ArrowDown, p, r, cg, flags, opt); drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, r, cg, flags, opt);
break; break;
case PE_Indicator: case PE_Indicator:
@ -632,7 +634,7 @@ void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe,
} }
default: default:
TQMotifStyle::drawPrimitive(pe, p, r, cg, flags, opt); TQMotifStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
break; break;
} }
} }
@ -642,11 +644,13 @@ void TQMotifPlusStyle::drawPrimitive( PrimitiveElement pe,
*/ */
void TQMotifPlusStyle::drawControl( ControlElement element, void TQMotifPlusStyle::drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget) const
{ {
if (widget == singleton->hoverWidget) if (widget == singleton->hoverWidget)
flags |= Style_MouseOver; flags |= Style_MouseOver;
@ -655,12 +659,11 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
case CE_PushButton: case CE_PushButton:
{ {
#ifndef QT_NO_PUSHBUTTON #ifndef QT_NO_PUSHBUTTON
const TQPushButton *button = (const TQPushButton *) widget;
TQRect br = r; TQRect br = r;
int dbi = pixelMetric(PM_ButtonDefaultIndicator, widget); int dbi = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget);
if (button->isDefault() || button->autoDefault()) { if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) {
if (button->isDefault()) if (elementFlags & CEF_IsDefault)
drawMotifPlusShade(p, br, cg, TRUE, FALSE, drawMotifPlusShade(p, br, cg, TRUE, FALSE,
&cg.brush(TQColorGroup::Background)); &cg.brush(TQColorGroup::Background));
@ -673,9 +676,9 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
if (flags & Style_HasFocus) if (flags & Style_HasFocus)
br.addCoords(1, 1, -1, -1); br.addCoords(1, 1, -1, -1);
p->save(); p->save();
p->setBrushOrigin( -button->backgroundOffset().x(), p->setBrushOrigin( -ceData.bgOffset.x(),
-button->backgroundOffset().y() ); -ceData.bgOffset.y() );
drawPrimitive(PE_ButtonCommand, p, br, cg, flags); drawPrimitive(PE_ButtonCommand, p, ceData, elementFlags, br, cg, flags);
p->restore(); p->restore();
#endif #endif
break; break;
@ -684,23 +687,21 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
case CE_CheckBoxLabel: case CE_CheckBoxLabel:
{ {
#ifndef QT_NO_CHECKBOX #ifndef QT_NO_CHECKBOX
const TQCheckBox *checkbox = (const TQCheckBox *) widget;
if (flags & Style_MouseOver) { if (flags & Style_MouseOver) {
TQRegion r(checkbox->rect()); TQRegion r(ceData.rect);
r -= visualRect(subRect(SR_CheckBoxIndicator, widget), widget); r -= visualRect(subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget), ceData, elementFlags);
p->setClipRegion(r); p->setClipRegion(r);
p->fillRect(checkbox->rect(), cg.brush(TQColorGroup::Midlight)); p->fillRect(ceData.rect, cg.brush(TQColorGroup::Midlight));
p->setClipping(FALSE); p->setClipping(FALSE);
} }
int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft;
drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg,
flags & Style_Enabled, checkbox->pixmap(), checkbox->text()); flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text);
if (checkbox->hasFocus()) { if (elementFlags & CEF_HasFocus) {
TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, widget), widget); TQRect fr = visualRect(subRect(SR_CheckBoxFocusRect, ceData, elementFlags, widget), ceData, elementFlags);
drawPrimitive(PE_FocusRect, p, fr, cg, flags); drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags);
} }
#endif #endif
break; break;
@ -709,23 +710,21 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
case CE_RadioButtonLabel: case CE_RadioButtonLabel:
{ {
#ifndef QT_NO_RADIOBUTTON #ifndef QT_NO_RADIOBUTTON
const TQRadioButton *radiobutton = (const TQRadioButton *) widget;
if (flags & Style_MouseOver) { if (flags & Style_MouseOver) {
TQRegion r(radiobutton->rect()); TQRegion r(ceData.rect);
r -= visualRect(subRect(SR_RadioButtonIndicator, widget), widget); r -= visualRect(subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget), ceData, elementFlags);
p->setClipRegion(r); p->setClipRegion(r);
p->fillRect(radiobutton->rect(), cg.brush(TQColorGroup::Midlight)); p->fillRect(ceData.rect, cg.brush(TQColorGroup::Midlight));
p->setClipping(FALSE); p->setClipping(FALSE);
} }
int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft;
drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg,
flags & Style_Enabled, radiobutton->pixmap(), radiobutton->text()); flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text);
if (radiobutton->hasFocus()) { if (elementFlags & CEF_HasFocus) {
TQRect fr = visualRect(subRect(SR_RadioButtonFocusRect, widget), widget); TQRect fr = visualRect(subRect(SR_RadioButtonFocusRect, ceData, elementFlags, widget), ceData, elementFlags);
drawPrimitive(PE_FocusRect, p, fr, cg, flags); drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags);
} }
#endif #endif
break; break;
@ -757,7 +756,6 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
if (! widget || opt.isDefault()) if (! widget || opt.isDefault())
break; break;
TQPopupMenu *popupmenu = (TQPopupMenu *) widget;
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
if ( !mi ) if ( !mi )
break; break;
@ -765,7 +763,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
int tab = opt.tabWidth(); int tab = opt.tabWidth();
int maxpmw = opt.maxIconWidth(); int maxpmw = opt.maxIconWidth();
bool dis = ! (flags & Style_Enabled); bool dis = ! (flags & Style_Enabled);
bool checkable = popupmenu->isCheckable(); bool checkable = (elementFlags & CEF_IsCheckable);
bool act = flags & Style_Active; bool act = flags & Style_Active;
int x, y, w, h; int x, y, w, h;
@ -834,7 +832,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
if (act) if (act)
cflags |= Style_On; cflags |= Style_On;
drawPrimitive(PE_CheckMark, p, vrect, cg, cflags); drawPrimitive(PE_CheckMark, p, ceData, elementFlags, vrect, cg, cflags);
} }
} }
@ -883,6 +881,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
TQStyle::PrimitiveElement arrow = (TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight); TQStyle::PrimitiveElement arrow = (TQApplication::reverseLayout() ? PE_ArrowLeft : PE_ArrowRight);
vrect = visualRect( TQRect(x + w - hh - 6, y + (hh / 2), hh, hh), r ); vrect = visualRect( TQRect(x + w - hh - 6, y + (hh / 2), hh, hh), r );
drawPrimitive(arrow, p, drawPrimitive(arrow, p,
ceData, elementFlags,
vrect, cg, vrect, cg,
((act && !dis) ? ((act && !dis) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
@ -895,16 +894,15 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
case CE_TabBarTab: case CE_TabBarTab:
{ {
#ifndef QT_NO_TABBAR #ifndef QT_NO_TABBAR
const TQTabBar *tabbar = (const TQTabBar *) widget;
bool selected = flags & Style_Selected; bool selected = flags & Style_Selected;
TQColorGroup g = tabbar->colorGroup(); TQColorGroup g = ceData.colorGroup;
TQPen oldpen = p->pen(); TQPen oldpen = p->pen();
TQRect fr(r); TQRect fr(r);
if (! selected) { if (! selected) {
if (tabbar->shape() == TQTabBar::RoundedAbove || if (ceData.tabBarData.shape == TQTabBar::RoundedAbove ||
tabbar->shape() == TQTabBar::TriangularAbove) { ceData.tabBarData.shape == TQTabBar::TriangularAbove) {
fr.setTop(fr.top() + 2); fr.setTop(fr.top() + 2);
} else { } else {
fr.setBottom(fr.bottom() - 2); fr.setBottom(fr.bottom() - 2);
@ -917,7 +915,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
(selected) ? cg.brush(TQColorGroup::Button) (selected) ? cg.brush(TQColorGroup::Button)
: cg.brush(TQColorGroup::Mid)); : cg.brush(TQColorGroup::Mid));
if (tabbar->shape() == TQTabBar::RoundedAbove) { if (ceData.tabBarData.shape == TQTabBar::RoundedAbove) {
// "rounded" tabs on top // "rounded" tabs on top
fr.setBottom(fr.bottom() - 1); fr.setBottom(fr.bottom() - 1);
@ -941,7 +939,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
p->setPen(black); p->setPen(black);
p->drawLine(fr.right(), fr.top() + 1, p->drawLine(fr.right(), fr.top() + 1,
fr.right(), fr.bottom() - 1); fr.right(), fr.bottom() - 1);
} else if (tabbar->shape() == TQTabBar::RoundedBelow) { } else if (ceData.tabBarData.shape == TQTabBar::RoundedBelow) {
// "rounded" tabs on bottom // "rounded" tabs on bottom
fr.setTop(fr.top() + 1); fr.setTop(fr.top() + 1);
@ -987,7 +985,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
} }
} else } else
// triangular drawing code // triangular drawing code
TQMotifStyle::drawControl(element, p, widget, r, cg, flags, opt); TQMotifStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
p->setPen(oldpen); p->setPen(oldpen);
#endif #endif
@ -995,7 +993,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
} }
default: default:
TQMotifStyle::drawControl(element, p, widget, r, cg, flags, opt); TQMotifStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
break; break;
} }
} }
@ -1003,7 +1001,7 @@ void TQMotifPlusStyle::drawControl( ControlElement element,
/*! \reimp /*! \reimp
*/ */
TQRect TQMotifPlusStyle::subRect(SubRect r, const TQWidget *widget) const TQRect TQMotifPlusStyle::subRect(SubRect r, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
TQRect rect; TQRect rect;
@ -1011,11 +1009,10 @@ TQRect TQMotifPlusStyle::subRect(SubRect r, const TQWidget *widget) const
case SR_PushButtonFocusRect: case SR_PushButtonFocusRect:
{ {
#ifndef QT_NO_PUSHBUTTON #ifndef QT_NO_PUSHBUTTON
const TQPushButton *button = (const TQPushButton *) widget; int dfi = pixelMetric(PM_ButtonDefaultIndicator, ceData, elementFlags, widget);
int dfi = pixelMetric(PM_ButtonDefaultIndicator, widget);
rect = button->rect(); rect = ceData.rect;
if (button->isDefault() || button->autoDefault()) if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault))
rect.addCoords(dfi, dfi, -dfi, -dfi); rect.addCoords(dfi, dfi, -dfi, -dfi);
#endif #endif
break; break;
@ -1023,38 +1020,36 @@ TQRect TQMotifPlusStyle::subRect(SubRect r, const TQWidget *widget) const
case SR_CheckBoxIndicator: case SR_CheckBoxIndicator:
{ {
int h = pixelMetric( PM_IndicatorHeight ); int h = pixelMetric( PM_IndicatorHeight, ceData, elementFlags );
rect.setRect(( widget->rect().height() - h ) / 2, rect.setRect(( ceData.rect.height() - h ) / 2,
( widget->rect().height() - h ) / 2, ( ceData.rect.height() - h ) / 2,
pixelMetric( PM_IndicatorWidth ), h ); pixelMetric( PM_IndicatorWidth, ceData, elementFlags ), h );
break; break;
} }
case SR_RadioButtonIndicator: case SR_RadioButtonIndicator:
{ {
int h = pixelMetric( PM_ExclusiveIndicatorHeight ); int h = pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags );
rect.setRect( ( widget->rect().height() - h ) / 2, rect.setRect( ( ceData.rect.height() - h ) / 2,
( widget->rect().height() - h ) / 2, ( ceData.rect.height() - h ) / 2,
pixelMetric( PM_ExclusiveIndicatorWidth ), h ); pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags ), h );
break; break;
} }
case SR_CheckBoxFocusRect: case SR_CheckBoxFocusRect:
case SR_RadioButtonFocusRect: case SR_RadioButtonFocusRect:
rect = widget->rect(); rect = ceData.rect;
break; break;
case SR_ComboBoxFocusRect: case SR_ComboBoxFocusRect:
{ {
#ifndef QT_NO_COMBOBOX #ifndef QT_NO_COMBOBOX
const TQComboBox *combobox = (const TQComboBox *) widget; if (elementFlags & CEF_IsEditable) {
rect = querySubControlMetrics(CC_ComboBox, ceData, elementFlags,
if (combobox->editable()) { SC_ComboBoxEditField, TQStyleOption::Default, widget);
rect = querySubControlMetrics(CC_ComboBox, widget,
SC_ComboBoxEditField);
rect.addCoords(-3, -3, 3, 3); rect.addCoords(-3, -3, 3, 3);
} else } else
rect = combobox->rect(); rect = ceData.rect;
#endif #endif
break; break;
} }
@ -1062,21 +1057,20 @@ TQRect TQMotifPlusStyle::subRect(SubRect r, const TQWidget *widget) const
case SR_SliderFocusRect: case SR_SliderFocusRect:
{ {
#ifndef QT_NO_SLIDER #ifndef QT_NO_SLIDER
const TQSlider *slider = (const TQSlider *) widget; int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget );
int tickOffset = pixelMetric( PM_SliderTickmarkOffset, widget ); int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
int thickness = pixelMetric( PM_SliderControlThickness, widget );
int x, y, wi, he; int x, y, wi, he;
if ( slider->orientation() == Horizontal ) { if ( ceData.orientation == Horizontal ) {
x = 0; x = 0;
y = tickOffset; y = tickOffset;
wi = slider->width(); wi = ceData.rect.width();
he = thickness; he = thickness;
} else { } else {
x = tickOffset; x = tickOffset;
y = 0; y = 0;
wi = thickness; wi = thickness;
he = slider->height(); he = ceData.rect.height();
} }
rect.setRect(x, y, wi, he); rect.setRect(x, y, wi, he);
@ -1085,7 +1079,7 @@ TQRect TQMotifPlusStyle::subRect(SubRect r, const TQWidget *widget) const
} }
default: default:
rect = TQMotifStyle::subRect(r, widget); rect = TQMotifStyle::subRect(r, ceData, elementFlags, widget);
break; break;
} }
@ -1096,13 +1090,15 @@ TQRect TQMotifPlusStyle::subRect(SubRect r, const TQWidget *widget) const
/*! \reimp */ /*! \reimp */
void TQMotifPlusStyle::drawComplexControl(ComplexControl control, void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
SCFlags controls, SCFlags controls,
SCFlags active, SCFlags active,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
if (widget == singleton->hoverWidget) if (widget == singleton->hoverWidget)
flags |= Style_MouseOver; flags |= Style_MouseOver;
@ -1111,17 +1107,16 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
case CC_ScrollBar: case CC_ScrollBar:
{ {
#ifndef QT_NO_SCROLLBAR #ifndef QT_NO_SCROLLBAR
const TQScrollBar *scrollbar = (const TQScrollBar *) widget;
TQRect addline, subline, addpage, subpage, slider, first, last; TQRect addline, subline, addpage, subpage, slider, first, last;
bool maxedOut = (scrollbar->minValue() == scrollbar->maxValue()); bool maxedOut = (ceData.minSteps == ceData.maxSteps);
subline = querySubControlMetrics(control, widget, SC_ScrollBarSubLine, opt); subline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget);
addline = querySubControlMetrics(control, widget, SC_ScrollBarAddLine, opt); addline = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget);
subpage = querySubControlMetrics(control, widget, SC_ScrollBarSubPage, opt); subpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget);
addpage = querySubControlMetrics(control, widget, SC_ScrollBarAddPage, opt); addpage = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget);
slider = querySubControlMetrics(control, widget, SC_ScrollBarSlider, opt); slider = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarSlider, opt, widget);
first = querySubControlMetrics(control, widget, SC_ScrollBarFirst, opt); first = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarFirst, opt, widget);
last = querySubControlMetrics(control, widget, SC_ScrollBarLast, opt); last = querySubControlMetrics(control, ceData, elementFlags, SC_ScrollBarLast, opt, widget);
bool skipUpdate = FALSE; bool skipUpdate = FALSE;
if (singleton->hovering) { if (singleton->hovering) {
@ -1157,67 +1152,67 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
&cg.brush(TQColorGroup::Mid)); &cg.brush(TQColorGroup::Mid));
if ((controls & SC_ScrollBarSubLine) && subline.isValid()) if ((controls & SC_ScrollBarSubLine) && subline.isValid())
drawPrimitive(PE_ScrollBarSubLine, p, subline, cg, drawPrimitive(PE_ScrollBarSubLine, p, ceData, elementFlags, subline, cg,
((active == SC_ScrollBarSubLine || ((active == SC_ScrollBarSubLine ||
singleton->scrollbarElement == SC_ScrollBarSubLine) ? singleton->scrollbarElement == SC_ScrollBarSubLine) ?
Style_MouseOver: Style_Default) | Style_MouseOver: Style_Default) |
((maxedOut) ? Style_Default : Style_Enabled) | ((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarSubLine) ? ((active == SC_ScrollBarSubLine) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == TQt::Horizontal) ? ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default)); Style_Horizontal : Style_Default));
if ((controls & SC_ScrollBarAddLine) && addline.isValid()) if ((controls & SC_ScrollBarAddLine) && addline.isValid())
drawPrimitive(PE_ScrollBarAddLine, p, addline, cg, drawPrimitive(PE_ScrollBarAddLine, p, ceData, elementFlags, addline, cg,
((active == SC_ScrollBarAddLine || ((active == SC_ScrollBarAddLine ||
singleton->scrollbarElement == SC_ScrollBarAddLine) ? singleton->scrollbarElement == SC_ScrollBarAddLine) ?
Style_MouseOver: Style_Default) | Style_MouseOver: Style_Default) |
((maxedOut) ? Style_Default : Style_Enabled) | ((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarAddLine) ? ((active == SC_ScrollBarAddLine) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == TQt::Horizontal) ? ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default)); Style_Horizontal : Style_Default));
if ((controls & SC_ScrollBarSubPage) && subpage.isValid()) if ((controls & SC_ScrollBarSubPage) && subpage.isValid())
drawPrimitive(PE_ScrollBarSubPage, p, subpage, cg, drawPrimitive(PE_ScrollBarSubPage, p, ceData, elementFlags, subpage, cg,
((maxedOut) ? Style_Default : Style_Enabled) | ((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarSubPage) ? ((active == SC_ScrollBarSubPage) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == TQt::Horizontal) ? ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default)); Style_Horizontal : Style_Default));
if ((controls & SC_ScrollBarAddPage) && addpage.isValid()) if ((controls & SC_ScrollBarAddPage) && addpage.isValid())
drawPrimitive(PE_ScrollBarAddPage, p, addpage, cg, drawPrimitive(PE_ScrollBarAddPage, p, ceData, elementFlags, addpage, cg,
((maxedOut) ? Style_Default : Style_Enabled) | ((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarAddPage) ? ((active == SC_ScrollBarAddPage) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == TQt::Horizontal) ? ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default)); Style_Horizontal : Style_Default));
if ((controls & SC_ScrollBarFirst) && first.isValid()) if ((controls & SC_ScrollBarFirst) && first.isValid())
drawPrimitive(PE_ScrollBarFirst, p, first, cg, drawPrimitive(PE_ScrollBarFirst, p, ceData, elementFlags, first, cg,
((maxedOut) ? Style_Default : Style_Enabled) | ((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarFirst) ? ((active == SC_ScrollBarFirst) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == TQt::Horizontal) ? ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default)); Style_Horizontal : Style_Default));
if ((controls & SC_ScrollBarLast) && last.isValid()) if ((controls & SC_ScrollBarLast) && last.isValid())
drawPrimitive(PE_ScrollBarLast, p, last, cg, drawPrimitive(PE_ScrollBarLast, p, ceData, elementFlags, last, cg,
((maxedOut) ? Style_Default : Style_Enabled) | ((maxedOut) ? Style_Default : Style_Enabled) |
((active == SC_ScrollBarLast) ? ((active == SC_ScrollBarLast) ?
Style_Down : Style_Default) | Style_Down : Style_Default) |
((scrollbar->orientation() == TQt::Horizontal) ? ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default)); Style_Horizontal : Style_Default));
if ((controls & SC_ScrollBarSlider) && slider.isValid()) { if ((controls & SC_ScrollBarSlider) && slider.isValid()) {
drawPrimitive(PE_ScrollBarSlider, p, slider, cg, drawPrimitive(PE_ScrollBarSlider, p, ceData, elementFlags, slider, cg,
((active == SC_ScrollBarSlider || ((active == SC_ScrollBarSlider ||
singleton->scrollbarElement == SC_ScrollBarSlider) ? singleton->scrollbarElement == SC_ScrollBarSlider) ?
Style_MouseOver: Style_Default) | Style_MouseOver: Style_Default) |
((maxedOut) ? Style_Default : Style_Enabled) | ((maxedOut) ? Style_Default : Style_Enabled) |
((scrollbar->orientation() == TQt::Horizontal) ? ((ceData.orientation == TQt::Horizontal) ?
Style_Horizontal : Style_Default)); Style_Horizontal : Style_Default));
// ### perhaps this should not be able to accept focus if maxedOut? // ### perhaps this should not be able to accept focus if maxedOut?
if (scrollbar->hasFocus()) { if (elementFlags & CEF_HasFocus) {
TQRect fr(slider.x() + 2, slider.y() + 2, TQRect fr(slider.x() + 2, slider.y() + 2,
slider.width() - 5, slider.height() - 5); slider.width() - 5, slider.height() - 5);
drawPrimitive(PE_FocusRect, p, fr, cg, Style_Default); drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, Style_Default);
} }
} }
#endif #endif
@ -1227,27 +1222,25 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
case CC_ComboBox: case CC_ComboBox:
{ {
#ifndef QT_NO_COMBOBOX #ifndef QT_NO_COMBOBOX
const TQComboBox *combobox = (const TQComboBox *) widget;
TQRect editfield, arrow; TQRect editfield, arrow;
editfield = editfield =
visualRect(querySubControlMetrics(CC_ComboBox, visualRect(querySubControlMetrics(CC_ComboBox,
combobox, ceData, elementFlags,
SC_ComboBoxEditField, SC_ComboBoxEditField,
opt), widget); opt, widget), ceData, elementFlags);
arrow = arrow =
visualRect(querySubControlMetrics(CC_ComboBox, visualRect(querySubControlMetrics(CC_ComboBox,
combobox, ceData, elementFlags,
SC_ComboBoxArrow, SC_ComboBoxArrow,
opt), widget); opt, widget), ceData, elementFlags);
if (combobox->editable()) { if (elementFlags & CEF_IsEditable) {
if (controls & SC_ComboBoxEditField && editfield.isValid()) { if (controls & SC_ComboBoxEditField && editfield.isValid()) {
editfield.addCoords(-3, -3, 3, 3); editfield.addCoords(-3, -3, 3, 3);
if (combobox->hasFocus()) if (elementFlags & CEF_HasFocus)
editfield.addCoords(1, 1, -1, -1); editfield.addCoords(1, 1, -1, -1);
drawMotifPlusShade(p, editfield, cg, TRUE, FALSE, drawMotifPlusShade(p, editfield, cg, TRUE, FALSE,
(widget->isEnabled() ? ((elementFlags & CEF_IsEnabled) ?
&cg.brush(TQColorGroup::Base) : &cg.brush(TQColorGroup::Base) :
&cg.brush(TQColorGroup::Background))); &cg.brush(TQColorGroup::Background)));
} }
@ -1261,12 +1254,12 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
if (active == SC_ComboBoxArrow) if (active == SC_ComboBoxArrow)
flags |= Style_Sunken; flags |= Style_Sunken;
drawPrimitive(PE_ArrowDown, p, arrow, cg, flags); drawPrimitive(PE_ArrowDown, p, ceData, elementFlags, arrow, cg, flags);
} }
} else { } else {
if (controls & SC_ComboBoxEditField && editfield.isValid()) { if (controls & SC_ComboBoxEditField && editfield.isValid()) {
editfield.addCoords(-3, -3, 3, 3); editfield.addCoords(-3, -3, 3, 3);
if (combobox->hasFocus()) if (elementFlags & CEF_HasFocus)
editfield.addCoords(1, 1, -1, -1); editfield.addCoords(1, 1, -1, -1);
drawMotifPlusShade(p, editfield, cg, FALSE, drawMotifPlusShade(p, editfield, cg, FALSE,
(flags & Style_MouseOver)); (flags & Style_MouseOver));
@ -1276,10 +1269,10 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
drawMotifPlusShade(p, arrow, cg, FALSE, (flags & Style_MouseOver)); drawMotifPlusShade(p, arrow, cg, FALSE, (flags & Style_MouseOver));
} }
if (combobox->hasFocus() || if ((elementFlags & CEF_HasFocus) ||
(combobox->editable() && combobox->lineEdit()->hasFocus())) { ((elementFlags & CEF_IsEditable) && (ceData.comboBoxLineEditFlags & CEF_HasFocus))) {
TQRect fr = visualRect(subRect(SR_ComboBoxFocusRect, widget), widget); TQRect fr = visualRect(subRect(SR_ComboBoxFocusRect, ceData, elementFlags, widget), ceData, elementFlags);
drawPrimitive(PE_FocusRect, p, fr, cg, flags); drawPrimitive(PE_FocusRect, p, ceData, elementFlags, fr, cg, flags);
} }
#endif #endif
break; break;
@ -1288,7 +1281,6 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
case CC_SpinWidget: case CC_SpinWidget:
{ {
#ifndef QT_NO_SPINWIDGET #ifndef QT_NO_SPINWIDGET
const TQSpinWidget * sw = (const TQSpinWidget *) widget;
SFlags flags = Style_Default; SFlags flags = Style_Default;
if (controls & SC_SpinWidgetFrame) if (controls & SC_SpinWidgetFrame)
@ -1300,14 +1292,14 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
flags |= Style_Down; flags |= Style_Down;
PrimitiveElement pe; PrimitiveElement pe;
if ( sw->buttonSymbols() == TQSpinWidget::PlusMinus ) if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus )
pe = PE_SpinWidgetPlus; pe = PE_SpinWidgetPlus;
else else
pe = PE_SpinWidgetUp; pe = PE_SpinWidgetUp;
TQRect re = sw->upRect(); TQRect re = ceData.spinWidgetData.upRect;
TQColorGroup ucg = sw->isUpEnabled() ? cg : sw->palette().disabled(); TQColorGroup ucg = ceData.spinWidgetData.upEnabled ? cg : ceData.palette.disabled();
drawPrimitive(pe, p, re, ucg, flags); drawPrimitive(pe, p, ceData, elementFlags, re, ucg, flags);
} }
if (controls & SC_SpinWidgetDown) { if (controls & SC_SpinWidgetDown) {
@ -1316,14 +1308,14 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
flags |= Style_Down; flags |= Style_Down;
PrimitiveElement pe; PrimitiveElement pe;
if ( sw->buttonSymbols() == TQSpinWidget::PlusMinus ) if ( ceData.spinWidgetData.buttonSymbols == TQSpinWidget::PlusMinus )
pe = PE_SpinWidgetMinus; pe = PE_SpinWidgetMinus;
else else
pe = PE_SpinWidgetDown; pe = PE_SpinWidgetDown;
TQRect re = sw->downRect(); TQRect re = ceData.spinWidgetData.downRect;
TQColorGroup dcg = sw->isDownEnabled() ? cg : sw->palette().disabled(); TQColorGroup dcg = ceData.spinWidgetData.downEnabled ? cg : ceData.palette.disabled();
drawPrimitive(pe, p, re, dcg, flags); drawPrimitive(pe, p, ceData, elementFlags, re, dcg, flags);
} }
#endif #endif
break; break;
@ -1332,21 +1324,20 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
case CC_Slider: case CC_Slider:
{ {
#ifndef QT_NO_SLIDER #ifndef QT_NO_SLIDER
const TQSlider *slider = (const TQSlider *) widget;
bool mouseover = (flags & Style_MouseOver); bool mouseover = (flags & Style_MouseOver);
TQRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove,
opt), opt, widget),
handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle, handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle,
opt); opt, widget);
if ((controls & SC_SliderGroove) && groove.isValid()) { if ((controls & SC_SliderGroove) && groove.isValid()) {
drawMotifPlusShade(p, groove, cg, TRUE, FALSE, drawMotifPlusShade(p, groove, cg, TRUE, FALSE,
&cg.brush(TQColorGroup::Mid)); &cg.brush(TQColorGroup::Mid));
if ( flags & Style_HasFocus ) { if ( flags & Style_HasFocus ) {
TQRect fr = subRect( SR_SliderFocusRect, widget ); TQRect fr = subRect( SR_SliderFocusRect, ceData, elementFlags, widget );
drawPrimitive( PE_FocusRect, p, fr, cg, flags ); drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg, flags );
} }
} }
@ -1356,9 +1347,9 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
flags |= Style_MouseOver; flags |= Style_MouseOver;
else else
flags &= ~Style_MouseOver; flags &= ~Style_MouseOver;
drawPrimitive(PE_ButtonBevel, p, handle, cg, flags | Style_Raised); drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, handle, cg, flags | Style_Raised);
if ( slider->orientation() == Horizontal ) { if ( ceData.orientation == Horizontal ) {
TQCOORD mid = handle.x() + handle.width() / 2; TQCOORD mid = handle.x() + handle.width() / 2;
qDrawShadeLine( p, mid, handle.y() + 1, mid , qDrawShadeLine( p, mid, handle.y() + 1, mid ,
handle.y() + handle.height() - 3, handle.y() + handle.height() - 3,
@ -1372,15 +1363,15 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
} }
if (controls & SC_SliderTickmarks) if (controls & SC_SliderTickmarks)
TQMotifStyle::drawComplexControl(control, p, widget, r, cg, flags, TQMotifStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
SC_SliderTickmarks, active, opt); SC_SliderTickmarks, active, opt, widget);
#endif #endif
break; break;
} }
default: default:
TQMotifStyle::drawComplexControl(control, p, widget, r, cg, flags, TQMotifStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags,
controls, active, opt); controls, active, opt, widget);
} }
} }
@ -1388,22 +1379,24 @@ void TQMotifPlusStyle::drawComplexControl(ComplexControl control,
/*! \reimp /*! \reimp
*/ */
TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control, TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl subcontrol, SubControl subcontrol,
const TQStyleOption& opt) const const TQStyleOption& opt,
const TQWidget *widget) const
{ {
switch (control) { switch (control) {
case CC_SpinWidget: { case CC_SpinWidget: {
int fw = pixelMetric( PM_SpinBoxFrameWidth, 0 ); int fw = pixelMetric( PM_SpinBoxFrameWidth, ceData, elementFlags, 0 );
TQSize bs; TQSize bs;
bs.setHeight( (widget->height() + 1)/2 ); bs.setHeight( (ceData.rect.height() + 1)/2 );
if ( bs.height() < 10 ) if ( bs.height() < 10 )
bs.setHeight( 10 ); bs.setHeight( 10 );
bs.setWidth( bs.height() ); // 1.6 -approximate golden mean bs.setWidth( bs.height() ); // 1.6 -approximate golden mean
bs = bs.expandedTo( TQApplication::globalStrut() ); bs = bs.expandedTo( TQApplication::globalStrut() );
int y = 0; int y = 0;
int x, lx, rx, h; int x, lx, rx, h;
x = widget->width() - y - bs.width(); x = ceData.rect.width() - y - bs.width();
lx = fw; lx = fw;
rx = x - fw * 2; rx = x - fw * 2;
h = bs.height() * 2; h = bs.height() * 2;
@ -1418,7 +1411,7 @@ TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control,
case SC_SpinWidgetEditField: case SC_SpinWidgetEditField:
return TQRect(lx, fw, rx, h - 2*fw); return TQRect(lx, fw, rx, h - 2*fw);
case SC_SpinWidgetFrame: case SC_SpinWidgetFrame:
return TQRect( 0, 0, widget->width() - bs.width(), h); return TQRect( 0, 0, ceData.rect.width() - bs.width(), h);
default: default:
break; break;
} }
@ -1426,34 +1419,33 @@ TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control,
#ifndef QT_NO_COMBOBOX #ifndef QT_NO_COMBOBOX
case CC_ComboBox: { case CC_ComboBox: {
const TQComboBox *combobox = (const TQComboBox *) widget; if (elementFlags & CEF_IsEditable) {
if (combobox->editable()) { int space = (ceData.rect.height() - 13) / 2;
int space = (combobox->height() - 13) / 2;
switch (subcontrol) { switch (subcontrol) {
case SC_ComboBoxFrame: case SC_ComboBoxFrame:
return TQRect(); return TQRect();
case SC_ComboBoxEditField: { case SC_ComboBoxEditField: {
TQRect rect = widget->rect(); TQRect rect = ceData.rect;
rect.setWidth(rect.width() - 13 - space * 2); rect.setWidth(rect.width() - 13 - space * 2);
rect.addCoords(3, 3, -3, -3); rect.addCoords(3, 3, -3, -3);
return rect; } return rect; }
case SC_ComboBoxArrow: case SC_ComboBoxArrow:
return TQRect(combobox->width() - 13 - space * 2, 0, return TQRect(ceData.rect.width() - 13 - space * 2, 0,
13 + space * 2, combobox->height()); 13 + space * 2, ceData.rect.height());
default: break; // shouldn't get here default: break; // shouldn't get here
} }
} else { } else {
int space = (combobox->height() - 7) / 2; int space = (ceData.rect.height() - 7) / 2;
switch (subcontrol) { switch (subcontrol) {
case SC_ComboBoxFrame: case SC_ComboBoxFrame:
return TQRect(); return TQRect();
case SC_ComboBoxEditField: { case SC_ComboBoxEditField: {
TQRect rect = widget->rect(); TQRect rect = ceData.rect;
rect.addCoords(3, 3, -3, -3); rect.addCoords(3, 3, -3, -3);
return rect; } return rect; }
case SC_ComboBoxArrow: // 12 wide, 7 tall case SC_ComboBoxArrow: // 12 wide, 7 tall
return TQRect(combobox->width() - 12 - space, space, 12, 7); return TQRect(ceData.rect.width() - 12 - space, space, 12, 7);
default: break; // shouldn't get here default: break; // shouldn't get here
} }
} }
@ -1464,14 +1456,13 @@ TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control,
case CC_Slider: { case CC_Slider: {
if (subcontrol == SC_SliderHandle) { if (subcontrol == SC_SliderHandle) {
const TQSlider *slider = (const TQSlider *) widget; int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget );
int tickOffset = pixelMetric( PM_SliderTickmarkOffset, widget ); int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
int thickness = pixelMetric( PM_SliderControlThickness, widget ); int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget ) + 2;
int len = pixelMetric( PM_SliderLength, widget ) + 2; int sliderPos = ceData.startStep;
int sliderPos = slider->sliderStart();
int motifBorder = 2; int motifBorder = 2;
if ( slider->orientation() == Horizontal ) if ( ceData.orientation == Horizontal )
return TQRect( sliderPos + motifBorder, tickOffset + motifBorder, len, return TQRect( sliderPos + motifBorder, tickOffset + motifBorder, len,
thickness - 2*motifBorder ); thickness - 2*motifBorder );
return TQRect( tickOffset + motifBorder, sliderPos + motifBorder, return TQRect( tickOffset + motifBorder, sliderPos + motifBorder,
@ -1481,7 +1472,7 @@ TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control,
#endif #endif
default: break; default: break;
} }
return TQMotifStyle::querySubControlMetrics(control, widget, subcontrol, opt); return TQMotifStyle::querySubControlMetrics(control, ceData, elementFlags, subcontrol, opt, widget);
} }
@ -1564,9 +1555,11 @@ bool TQMotifPlusStyle::eventFilter(TQObject *object, TQEvent *event)
/*! \reimp */ /*! \reimp */
int TQMotifPlusStyle::styleHint(StyleHint hint, int TQMotifPlusStyle::styleHint(StyleHint hint,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQStyleOption &opt, const TQStyleOption &opt,
TQStyleHintReturn *returnData) const TQStyleHintReturn *returnData,
const TQWidget *widget) const
{ {
int ret; int ret;
switch (hint) { switch (hint) {
@ -1574,7 +1567,7 @@ int TQMotifPlusStyle::styleHint(StyleHint hint,
ret = 1; ret = 1;
break; break;
default: default:
ret = TQMotifStyle::styleHint(hint, widget, opt, returnData); ret = TQMotifStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget);
break; break;
} }
return ret; return ret;

@ -204,6 +204,8 @@ static void rot(TQPointArray& a, int n)
*/ */
void TQMotifStyle::drawPrimitive( PrimitiveElement pe, void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -251,7 +253,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
case PE_ButtonTool: case PE_ButtonTool:
case PE_HeaderSection: case PE_HeaderSection:
qDrawShadePanel( p, r, cg, bool(flags & (Style_Down | Style_On )), qDrawShadePanel( p, r, cg, bool(flags & (Style_Down | Style_On )),
pixelMetric(PM_DefaultFrameWidth), pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags),
&cg.brush(TQColorGroup::Button) ); &cg.brush(TQColorGroup::Button) );
break; break;
@ -268,7 +270,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
r.x(), r.y() + r.height() - 1); r.x(), r.y() + r.height() - 1);
} else } else
qDrawShadePanel( p, r, cg, !showUp, qDrawShadePanel( p, r, cg, !showUp,
pixelMetric(PM_DefaultFrameWidth), &fill ); pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags), &fill );
#endif #endif
break; break;
} }
@ -509,7 +511,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
case PE_SpinWidgetMinus: case PE_SpinWidgetMinus:
{ {
p->save(); p->save();
int fw = pixelMetric( PM_DefaultFrameWidth ); int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags );
TQRect br; TQRect br;
br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2, br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2,
r.height() - fw*2 ); r.height() - fw*2 );
@ -547,7 +549,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
case PE_SpinWidgetDown: case PE_SpinWidgetDown:
{ {
p->save(); p->save();
int fw = pixelMetric( PM_DefaultFrameWidth ); int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags );
TQRect br; TQRect br;
br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2, br.setRect( r.x() + fw, r.y() + fw, r.width() - fw*2,
r.height() - fw*2 ); r.height() - fw*2 );
@ -576,8 +578,8 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
int bsx = 0; int bsx = 0;
int bsy = 0; int bsy = 0;
if ( flags & Style_Sunken ) { if ( flags & Style_Sunken ) {
bsx = pixelMetric(PM_ButtonShiftHorizontal); bsx = pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags);
bsy = pixelMetric(PM_ButtonShiftVertical); bsy = pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags);
} }
p->translate( sx + bsx, sy + bsy ); p->translate( sx + bsx, sy + bsy );
p->setPen( cg.buttonText() ); p->setPen( cg.buttonText() );
@ -665,7 +667,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
case PE_DockWindowResizeHandle: case PE_DockWindowResizeHandle:
{ {
const int motifOffset = 10; const int motifOffset = 10;
int sw = pixelMetric( PM_SplitterWidth ); int sw = pixelMetric( PM_SplitterWidth, ceData, elementFlags );
if ( flags & Style_Horizontal ) { if ( flags & Style_Horizontal ) {
TQCOORD yPos = r.y() + r.height() / 2; TQCOORD yPos = r.y() + r.height() / 2;
TQCOORD kPos = r.width() - motifOffset - sw; TQCOORD kPos = r.width() - motifOffset - sw;
@ -694,7 +696,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
const int markH = 6; const int markH = 6;
int posX = r.x() + ( r.width() - markW ) / 2 - 1; int posX = r.x() + ( r.width() - markW ) / 2 - 1;
int posY = r.y() + ( r.height() - markH ) / 2; int posY = r.y() + ( r.height() - markH ) / 2;
int dfw = pixelMetric(PM_DefaultFrameWidth); int dfw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags);
if (dfw < 2) { if (dfw < 2) {
// Could do with some optimizing/caching... // Could do with some optimizing/caching...
@ -736,12 +738,12 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
case PE_ScrollBarSubLine: case PE_ScrollBarSubLine:
drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp), drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp),
p, r, cg, Style_Enabled | flags); p, ceData, elementFlags, r, cg, Style_Enabled | flags);
break; break;
case PE_ScrollBarAddLine: case PE_ScrollBarAddLine:
drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown), drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown),
p, r, cg, Style_Enabled | flags); p, ceData, elementFlags, r, cg, Style_Enabled | flags);
break; break;
case PE_ScrollBarSubPage: case PE_ScrollBarSubPage:
@ -750,7 +752,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
break; break;
case PE_ScrollBarSlider: case PE_ScrollBarSlider:
drawPrimitive(PE_ButtonBevel, p, r, cg, drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg,
(flags | Style_Raised) & ~Style_Down); (flags | Style_Raised) & ~Style_Down);
break; break;
@ -760,7 +762,7 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
break; break;
default: default:
TQCommonStyle::drawPrimitive( pe, p, r, cg, flags, opt ); TQCommonStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
break; break;
} }
} }
@ -770,40 +772,40 @@ void TQMotifStyle::drawPrimitive( PrimitiveElement pe,
*/ */
void TQMotifStyle::drawControl( ControlElement element, void TQMotifStyle::drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch( element ) { switch( element ) {
case CE_PushButton: case CE_PushButton:
{ {
#ifndef QT_NO_PUSHBUTTON #ifndef QT_NO_PUSHBUTTON
int diw, x1, y1, x2, y2; int diw, x1, y1, x2, y2;
const TQPushButton *btn;
TQColorGroup newCg = cg; TQColorGroup newCg = cg;
btn = ( const TQPushButton * )widget;
p->setPen( cg.foreground() ); p->setPen( cg.foreground() );
p->setBrush( TQBrush( cg.button(), NoBrush ) ); p->setBrush( TQBrush( cg.button(), NoBrush ) );
diw = pixelMetric( PM_ButtonDefaultIndicator ); diw = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags );
r.coords( &x1, &y1, &x2, &y2 ); r.coords( &x1, &y1, &x2, &y2 );
if ( btn->isDefault() || btn->autoDefault() ) { if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) {
x1 += diw; x1 += diw;
y1 += diw; y1 += diw;
x2 -= diw; x2 -= diw;
y2 -= diw; y2 -= diw;
} }
TQBrush fill; TQBrush fill;
if ( btn->isDown() ) if ( elementFlags & CEF_IsDown )
fill = newCg.brush( TQColorGroup::Mid ); fill = newCg.brush( TQColorGroup::Mid );
else if ( btn->isOn() ) else if ( elementFlags & CEF_IsOn )
fill = TQBrush( newCg.mid(), Dense4Pattern ); fill = TQBrush( newCg.mid(), Dense4Pattern );
else else
fill = newCg.brush( TQColorGroup::Button ); fill = newCg.brush( TQColorGroup::Button );
newCg.setBrush( TQColorGroup::Button, fill ); newCg.setBrush( TQColorGroup::Button, fill );
if ( btn->isDefault() ) { if ( elementFlags & CEF_IsDefault ) {
if ( diw == 0 ) { if ( diw == 0 ) {
TQPointArray a; TQPointArray a;
a.setPoints( 9, a.setPoints( 9,
@ -819,17 +821,17 @@ void TQMotifStyle::drawControl( ControlElement element,
qDrawShadePanel( p, r, newCg, TRUE ); qDrawShadePanel( p, r, newCg, TRUE );
} }
} }
if ( !btn->isFlat() || btn->isOn() || btn->isDown() ) { if ( !( elementFlags & CEF_IsFlat ) || ( elementFlags & CEF_IsOn ) || ( elementFlags & CEF_IsDown ) ) {
TQRect tmp( x1, y1, x2 - x1 + 1, y2 - y1 + 1 ); TQRect tmp( x1, y1, x2 - x1 + 1, y2 - y1 + 1 );
SFlags flags = Style_Default; SFlags flags = Style_Default;
if ( btn->isOn()) if ( elementFlags & CEF_IsOn )
flags |= Style_On; flags |= Style_On;
if (btn->isDown()) if ( elementFlags & CEF_IsDown )
flags |= Style_Down; flags |= Style_Down;
p->save(); p->save();
p->setBrushOrigin( -widget->backgroundOffset().x(), p->setBrushOrigin( -ceData.bgOffset.x(),
-widget->backgroundOffset().y() ); -ceData.bgOffset.y() );
drawPrimitive( PE_ButtonCommand, p, drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags,
tmp, newCg, tmp, newCg,
flags ); flags );
p->restore(); p->restore();
@ -843,47 +845,46 @@ void TQMotifStyle::drawControl( ControlElement element,
case CE_TabBarTab: case CE_TabBarTab:
{ {
#ifndef QT_NO_TABBAR #ifndef QT_NO_TABBAR
if ( !widget || !widget->parentWidget() || !opt.tab() ) if ( (elementFlags & CEF_UseGenericParameters) || !(elementFlags & CEF_HasParentWidget) || !opt.tab() )
break; break;
const TQTabBar * tb = (const TQTabBar *) widget;
const TQTab * t = opt.tab(); const TQTab * t = opt.tab();
int dfw = pixelMetric( PM_DefaultFrameWidth, tb ); int dfw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget );
bool selected = flags & Style_Selected; bool selected = flags & Style_Selected;
int o = dfw > 1 ? 1 : 0; int o = dfw > 1 ? 1 : 0;
bool lastTab = FALSE; bool lastTab = FALSE;
TQRect r2( r ); TQRect r2( r );
if ( tb->shape() == TQTabBar::RoundedAbove ) { if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ) {
if ( styleHint( SH_TabBar_Alignment, tb ) == AlignRight && if ( styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, widget ) == AlignRight &&
tb->indexOf( t->identifier() ) == tb->count()-1 ) ceData.tabBarData.identIndexMap[t->identifier()] == ceData.tabBarData.tabCount-1 )
lastTab = TRUE; lastTab = TRUE;
if ( o ) { if ( o ) {
p->setPen( tb->colorGroup().light() ); p->setPen( ceData.colorGroup.light() );
p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() );
p->setPen( tb->colorGroup().light() ); p->setPen( ceData.colorGroup.light() );
p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 ); p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 );
if ( r2.left() == 0 ) if ( r2.left() == 0 )
p->drawPoint( tb->rect().bottomLeft() ); p->drawPoint( ceData.rect.bottomLeft() );
} }
else { else {
p->setPen( tb->colorGroup().light() ); p->setPen( ceData.colorGroup.light() );
p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() );
} }
if ( selected ) { if ( selected ) {
p->fillRect( TQRect( r2.left()+1, r2.bottom()-o, r2.width()-3, 2), p->fillRect( TQRect( r2.left()+1, r2.bottom()-o, r2.width()-3, 2),
tb->palette().active().brush( TQColorGroup::Background )); ceData.palette.active().brush( TQColorGroup::Background ));
p->setPen( tb->colorGroup().background() ); p->setPen( ceData.colorGroup.background() );
// p->drawLine( r2.left()+1, r2.bottom(), r2.right()-2, r2.bottom() ); // p->drawLine( r2.left()+1, r2.bottom(), r2.right()-2, r2.bottom() );
// if (o) // if (o)
// p->drawLine( r2.left()+1, r2.bottom()-1, r2.right()-2, r2.bottom()-1 ); // p->drawLine( r2.left()+1, r2.bottom()-1, r2.right()-2, r2.bottom()-1 );
p->drawLine( r2.left()+1, r2.bottom(), r2.left()+1, r2.top()+2 ); p->drawLine( r2.left()+1, r2.bottom(), r2.left()+1, r2.top()+2 );
p->setPen( tb->colorGroup().light() ); p->setPen( ceData.colorGroup.light() );
} else { } else {
p->setPen( tb->colorGroup().light() ); p->setPen( ceData.colorGroup.light() );
r2.setRect( r2.left() + 2, r2.top() + 2, r2.setRect( r2.left() + 2, r2.top() + 2,
r2.width() - 4, r2.height() - 2 ); r2.width() - 4, r2.height() - 2 );
} }
@ -900,7 +901,7 @@ void TQMotifStyle::drawControl( ControlElement element,
r2.right() - 2, r2.top()+1 ); r2.right() - 2, r2.top()+1 );
} }
p->setPen( tb->colorGroup().dark() ); p->setPen( ceData.colorGroup.dark() );
p->drawLine( r2.right() - 1, r2.top() + 2, p->drawLine( r2.right() - 1, r2.top() + 2,
r2.right() - 1, r2.bottom() - 1 + (selected ? o : -o)); r2.right() - 1, r2.bottom() - 1 + (selected ? o : -o));
if ( o ) { if ( o ) {
@ -910,19 +911,19 @@ void TQMotifStyle::drawControl( ControlElement element,
(selected ? (lastTab ? 0:1):1+o)); (selected ? (lastTab ? 0:1):1+o));
p->drawPoint( r2.right() - 1, r2.top() + 1 ); p->drawPoint( r2.right() - 1, r2.top() + 1 );
} }
} else if ( tb->shape() == TQTabBar::RoundedBelow ) { } else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ) {
if ( styleHint( SH_TabBar_Alignment, tb ) == AlignLeft && if ( styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, widget ) == AlignLeft &&
tb->indexOf( t->identifier() ) == tb->count()-1 ) ceData.tabBarData.identIndexMap[t->identifier()] == ceData.tabBarData.tabCount-1 )
lastTab = TRUE; lastTab = TRUE;
if ( selected ) { if ( selected ) {
p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1), p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1),
tb->palette().active().brush( TQColorGroup::Background )); ceData.palette.active().brush( TQColorGroup::Background ));
p->setPen( tb->colorGroup().background() ); p->setPen( ceData.colorGroup.background() );
// p->drawLine( r2.left()+1, r2.top(), r2.right()-2, r2.top() ); // p->drawLine( r2.left()+1, r2.top(), r2.right()-2, r2.top() );
p->drawLine( r2.left()+1, r2.top(), r2.left()+1, r2.bottom()-2 ); p->drawLine( r2.left()+1, r2.top(), r2.left()+1, r2.bottom()-2 );
p->setPen( tb->colorGroup().dark() ); p->setPen( ceData.colorGroup.dark() );
} else { } else {
p->setPen( tb->colorGroup().dark() ); p->setPen( ceData.colorGroup.dark() );
p->drawLine( r2.left(), r2.top(), r2.right(), r2.top() ); p->drawLine( r2.left(), r2.top(), r2.right(), r2.top() );
p->drawLine( r2.left() + 1, r2.top() + 1, p->drawLine( r2.left() + 1, r2.top() + 1,
r2.right() - (lastTab ? 0 : 2), r2.right() - (lastTab ? 0 : 2),
@ -946,14 +947,14 @@ void TQMotifStyle::drawControl( ControlElement element,
r2.left() + 2, r2.bottom() ); r2.left() + 2, r2.bottom() );
} }
p->setPen( tb->colorGroup().light() ); p->setPen( ceData.colorGroup.light() );
p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2), p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2),
r2.left(), r2.bottom() - 2 ); r2.left(), r2.bottom() - 2 );
p->drawLine( r2.left() + 1, r2.top() + (selected ? 0 : 2), p->drawLine( r2.left() + 1, r2.top() + (selected ? 0 : 2),
r2.left() + 1, r2.bottom() - 3 ); r2.left() + 1, r2.bottom() - 3 );
} else { } else {
TQCommonStyle::drawControl( element, p, widget, r, cg, flags, opt ); TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget );
} }
#endif #endif
break; break;
@ -966,32 +967,31 @@ void TQMotifStyle::drawControl( ControlElement element,
case CE_ProgressBarLabel: case CE_ProgressBarLabel:
{ {
#ifndef QT_NO_PROGRESSBAR #ifndef QT_NO_PROGRESSBAR
const TQProgressBar * pb = (const TQProgressBar *) widget; const int unit_width = pixelMetric( PM_ProgressBarChunkWidth, ceData, elementFlags, widget );
const int unit_width = pixelMetric( PM_ProgressBarChunkWidth, pb );
int u = r.width() / unit_width; int u = r.width() / unit_width;
int p_v = pb->progress(); int p_v = ceData.currentStep;
int t_s = pb->totalSteps(); int t_s = ceData.totalSteps;
if ( u > 0 && pb->progress() >= INT_MAX / u && t_s >= u ) { if ( u > 0 && ceData.currentStep >= INT_MAX / u && t_s >= u ) {
// scale down to something usable. // scale down to something usable.
p_v /= u; p_v /= u;
t_s /= u; t_s /= u;
} }
if ( pb->percentageVisible() && pb->totalSteps() ) { if ( ceData.percentageVisible && ceData.totalSteps ) {
int nu = ( u * p_v + t_s/2 ) / t_s; int nu = ( u * p_v + t_s/2 ) / t_s;
int x = unit_width * nu; int x = unit_width * nu;
if (pb->indicatorFollowsStyle() || pb->centerIndicator()) { if ((elementFlags & CEF_IndicatorFollowsStyle) || (elementFlags & CEF_CenterIndicator)) {
p->setPen( cg.highlightedText() ); p->setPen( cg.highlightedText() );
p->setClipRect( r.x(), r.y(), x, r.height() ); p->setClipRect( r.x(), r.y(), x, r.height() );
p->drawText( r, AlignCenter | SingleLine, pb->progressString() ); p->drawText( r, AlignCenter | SingleLine, ceData.progressText );
if ( pb->progress() != pb->totalSteps() ) { if ( ceData.currentStep != ceData.totalSteps ) {
p->setClipRect( r.x() + x, r.y(), r.width() - x, r.height() ); p->setClipRect( r.x() + x, r.y(), r.width() - x, r.height() );
p->setPen( cg.highlight() ); p->setPen( cg.highlight() );
p->drawText( r, AlignCenter | SingleLine, pb->progressString() ); p->drawText( r, AlignCenter | SingleLine, ceData.progressText );
} }
} else { } else {
p->setPen( cg.text() ); p->setPen( cg.text() );
p->drawText( r, AlignCenter | SingleLine, pb->progressString() ); p->drawText( r, AlignCenter | SingleLine, ceData.progressText );
} }
} }
#endif #endif
@ -1001,10 +1001,9 @@ void TQMotifStyle::drawControl( ControlElement element,
#ifndef QT_NO_POPUPMENU #ifndef QT_NO_POPUPMENU
case CE_PopupMenuItem: case CE_PopupMenuItem:
{ {
if (! widget || opt.isDefault()) if ((elementFlags & CEF_UseGenericParameters) || opt.isDefault())
break; break;
const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget;
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
if ( !mi ) if ( !mi )
break; break;
@ -1012,7 +1011,7 @@ void TQMotifStyle::drawControl( ControlElement element,
int tab = opt.tabWidth(); int tab = opt.tabWidth();
int maxpmw = opt.maxIconWidth(); int maxpmw = opt.maxIconWidth();
bool dis = ! (flags & Style_Enabled); bool dis = ! (flags & Style_Enabled);
bool checkable = popupmenu->isCheckable(); bool checkable = (elementFlags & CEF_IsCheckable);
bool act = flags & Style_Active; bool act = flags & Style_Active;
int x, y, w, h; int x, y, w, h;
@ -1034,7 +1033,7 @@ void TQMotifStyle::drawControl( ControlElement element,
int pw = motifItemFrame; int pw = motifItemFrame;
if ( act && !dis ) { // active item frame if ( act && !dis ) { // active item frame
if (pixelMetric( PM_DefaultFrameWidth ) > 1) if (pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) > 1)
qDrawShadePanel( p, x, y, w, h, cg, FALSE, pw, qDrawShadePanel( p, x, y, w, h, cg, FALSE, pw,
&cg.brush( TQColorGroup::Button ) ); &cg.brush( TQColorGroup::Button ) );
else else
@ -1086,7 +1085,7 @@ void TQMotifStyle::drawControl( ControlElement element,
if (act) if (act)
cflags |= Style_On; cflags |= Style_On;
drawPrimitive(PE_CheckMark, p, drawPrimitive(PE_CheckMark, p, ceData, elementFlags,
TQRect(xvis, y+motifItemFrame, mw, mh), TQRect(xvis, y+motifItemFrame, mw, mh),
cg, cflags); cg, cflags);
} }
@ -1140,11 +1139,11 @@ void TQMotifStyle::drawControl( ControlElement element,
TQRect vr = visualRect( TQRect(x+w - motifArrowHMargin - motifItemFrame - dim, TQRect vr = visualRect( TQRect(x+w - motifArrowHMargin - motifItemFrame - dim,
y+h/2-dim/2, dim, dim), r ); y+h/2-dim/2, dim, dim), r );
if ( act ) if ( act )
drawPrimitive(arrow, p, vr, cg, drawPrimitive(arrow, p, ceData, elementFlags, vr, cg,
(Style_Down | (Style_Down |
(dis ? Style_Default : Style_Enabled)) ); (dis ? Style_Default : Style_Enabled)) );
else else
drawPrimitive(arrow, p, vr, cg, drawPrimitive(arrow, p, ceData, elementFlags, vr, cg,
(dis ? Style_Default : Style_Enabled)); (dis ? Style_Default : Style_Enabled));
} }
@ -1159,12 +1158,12 @@ void TQMotifStyle::drawControl( ControlElement element,
&cg.brush(TQColorGroup::Button) ); &cg.brush(TQColorGroup::Button) );
else // other item else // other item
p->fillRect( r, cg.brush(TQColorGroup::Button) ); p->fillRect( r, cg.brush(TQColorGroup::Button) );
TQCommonStyle::drawControl( element, p, widget, r, cg, flags, opt ); TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget );
break; break;
} }
default: default:
TQCommonStyle::drawControl( element, p, widget, r, cg, flags, opt ); TQCommonStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget );
break; break;
} }
} }
@ -1220,20 +1219,22 @@ static void get_combo_parameters( const TQRect &r,
*/ */
void TQMotifStyle::drawComplexControl( ComplexControl control, void TQMotifStyle::drawComplexControl( ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
SCFlags sub, SCFlags sub,
SCFlags subActive, SCFlags subActive,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch ( control ) { switch ( control ) {
case CC_SpinWidget: { case CC_SpinWidget: {
SCFlags drawSub = SC_None; SCFlags drawSub = SC_None;
if ( sub & SC_SpinWidgetFrame ) if ( sub & SC_SpinWidgetFrame )
qDrawShadePanel( p, r, cg, TRUE, qDrawShadePanel( p, r, cg, TRUE,
pixelMetric( PM_DefaultFrameWidth) ); pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) );
if ( sub & SC_SpinWidgetUp || sub & SC_SpinWidgetDown ) { if ( sub & SC_SpinWidgetUp || sub & SC_SpinWidgetDown ) {
if ( sub & SC_SpinWidgetUp ) if ( sub & SC_SpinWidgetUp )
@ -1241,20 +1242,18 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
if ( sub & SC_SpinWidgetDown ) if ( sub & SC_SpinWidgetDown )
drawSub |= SC_SpinWidgetDown; drawSub |= SC_SpinWidgetDown;
TQCommonStyle::drawComplexControl( control, p, widget, r, cg, flags, TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags,
drawSub, subActive, opt ); drawSub, subActive, opt, widget );
} }
break; } break; }
case CC_Slider: case CC_Slider:
{ {
#ifndef QT_NO_SLIDER #ifndef QT_NO_SLIDER
const TQSlider * slider = (const TQSlider *) widget; TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove,
opt, widget),
TQRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle,
opt), opt, widget);
handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle,
opt);
if ((sub & SC_SliderGroove) && groove.isValid()) { if ((sub & SC_SliderGroove) && groove.isValid()) {
qDrawShadePanel( p, groove, cg, TRUE, 2, qDrawShadePanel( p, groove, cg, TRUE, 2,
@ -1262,15 +1261,15 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
if ( flags & Style_HasFocus ) { if ( flags & Style_HasFocus ) {
TQRect fr = subRect( SR_SliderFocusRect, widget ); TQRect fr = subRect( SR_SliderFocusRect, ceData, elementFlags, widget );
drawPrimitive( PE_FocusRect, p, fr, cg ); drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg );
} }
} }
if (( sub & SC_SliderHandle ) && handle.isValid()) { if (( sub & SC_SliderHandle ) && handle.isValid()) {
drawPrimitive( PE_ButtonBevel, p, handle, cg ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, handle, cg );
if ( slider->orientation() == Horizontal ) { if ( ceData.orientation == Horizontal ) {
TQCOORD mid = handle.x() + handle.width() / 2; TQCOORD mid = handle.x() + handle.width() / 2;
qDrawShadeLine( p, mid, handle.y(), mid, qDrawShadeLine( p, mid, handle.y(), mid,
handle.y() + handle.height() - 2, handle.y() + handle.height() - 2,
@ -1284,9 +1283,9 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
} }
if ( sub & SC_SliderTickmarks ) if ( sub & SC_SliderTickmarks )
TQCommonStyle::drawComplexControl( control, p, widget, r, cg, flags, TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags,
SC_SliderTickmarks, subActive, SC_SliderTickmarks, subActive,
opt ); opt, widget );
#endif #endif
break; break;
} }
@ -1296,12 +1295,12 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
if ( sub & SC_ComboBoxArrow ) { if ( sub & SC_ComboBoxArrow ) {
const TQComboBox * cb = (const TQComboBox *) widget; const TQComboBox * cb = (const TQComboBox *) widget;
int awh, ax, ay, sh, sy, dh, ew; int awh, ax, ay, sh, sy, dh, ew;
int fw = pixelMetric( PM_DefaultFrameWidth, cb); int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, cb);
drawPrimitive( PE_ButtonCommand, p, r, cg, flags ); drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags );
TQRect ar = TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, cb, SC_ComboBoxArrow, TQRect ar = TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow,
opt ), cb ); opt, cb ), ceData, elementFlags );
drawPrimitive( PE_ArrowDown, p, ar, cg, flags | Style_Enabled ); drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, ar, cg, flags | Style_Enabled );
TQRect tr = r; TQRect tr = r;
tr.addCoords( fw, fw, -fw, -fw ); tr.addCoords( fw, fw, -fw, -fw );
@ -1316,16 +1315,16 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
p->drawLine( ar.x()+awh-1, sy+1, ar.x()+awh-1, sy+sh-1 ); p->drawLine( ar.x()+awh-1, sy+1, ar.x()+awh-1, sy+sh-1 );
if ( cb->hasFocus() ) { if ( cb->hasFocus() ) {
TQRect re = TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, cb ), cb ); TQRect re = TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, cb ), ceData, elementFlags );
drawPrimitive( PE_FocusRect, p, re, cg ); drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg );
} }
} }
if ( sub & SC_ComboBoxEditField ) { if ( sub & SC_ComboBoxEditField ) {
TQComboBox * cb = (TQComboBox *) widget; TQComboBox * cb = (TQComboBox *) widget;
if ( cb->editable() ) { if ( cb->editable() ) {
TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, cb, TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags,
SC_ComboBoxEditField ), cb ); SC_ComboBoxEditField, cb ), ceData, elementFlags );
er.addCoords( -1, -1, 1, 1); er.addCoords( -1, -1, 1, 1);
qDrawShadePanel( p, er, cg, TRUE, 1, qDrawShadePanel( p, er, cg, TRUE, 1,
&cg.brush( TQColorGroup::Button )); &cg.brush( TQColorGroup::Button ));
@ -1340,11 +1339,11 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
if (sub == (SC_ScrollBarAddLine | SC_ScrollBarSubLine | SC_ScrollBarAddPage | if (sub == (SC_ScrollBarAddLine | SC_ScrollBarSubLine | SC_ScrollBarAddPage |
SC_ScrollBarSubPage | SC_ScrollBarFirst | SC_ScrollBarLast | SC_ScrollBarSubPage | SC_ScrollBarFirst | SC_ScrollBarLast |
SC_ScrollBarSlider)) SC_ScrollBarSlider))
qDrawShadePanel(p, widget->rect(), cg, TRUE, qDrawShadePanel(p, ceData.rect, cg, TRUE,
pixelMetric(PM_DefaultFrameWidth, widget), pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget),
&cg.brush(TQColorGroup::Mid)); &cg.brush(TQColorGroup::Mid));
TQCommonStyle::drawComplexControl(control, p, widget, r, cg, flags, sub, TQCommonStyle::drawComplexControl(control, p, ceData, elementFlags, r, cg, flags, sub,
subActive, opt); subActive, opt, widget);
break; break;
} }
@ -1352,7 +1351,7 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
case CC_ListView: case CC_ListView:
{ {
if ( sub & SC_ListView ) { if ( sub & SC_ListView ) {
TQCommonStyle::drawComplexControl( control, p, widget, r, cg, flags, sub, subActive, opt ); TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, sub, subActive, opt, widget );
} }
if ( sub & ( SC_ListViewBranch | SC_ListViewExpand ) ) { if ( sub & ( SC_ListViewBranch | SC_ListViewExpand ) ) {
if (opt.isDefault()) if (opt.isDefault())
@ -1455,14 +1454,14 @@ void TQMotifStyle::drawComplexControl( ComplexControl control,
#endif // QT_NO_LISTVIEW #endif // QT_NO_LISTVIEW
default: default:
TQCommonStyle::drawComplexControl( control, p, widget, r, cg, flags, TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags,
sub, subActive, opt ); sub, subActive, opt, widget );
} }
} }
/*! \reimp */ /*! \reimp */
int TQMotifStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) const int TQMotifStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const
{ {
int ret; int ret;
@ -1519,9 +1518,9 @@ int TQMotifStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) cons
#ifndef QT_NO_SLIDER #ifndef QT_NO_SLIDER
const TQSlider * sl = (const TQSlider *) widget; const TQSlider * sl = (const TQSlider *) widget;
if ( sl->orientation() == Horizontal ) if ( sl->orientation() == Horizontal )
ret = sl->width() - pixelMetric( PM_SliderLength, sl ) - 6; ret = sl->width() - pixelMetric( PM_SliderLength, ceData, elementFlags, sl ) - 6;
else else
ret = sl->height() - pixelMetric( PM_SliderLength, sl ) - 6; ret = sl->height() - pixelMetric( PM_SliderLength, ceData, elementFlags, sl ) - 6;
#endif #endif
break; break;
} }
@ -1540,7 +1539,7 @@ int TQMotifStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) cons
break; break;
default: default:
ret = TQCommonStyle::pixelMetric( metric, widget ); ret = TQCommonStyle::pixelMetric( metric, ceData, elementFlags, widget );
break; break;
} }
return ret; return ret;
@ -1550,24 +1549,26 @@ int TQMotifStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) cons
/*!\reimp /*!\reimp
*/ */
TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control, TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sc, SubControl sc,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch ( control ) { switch ( control ) {
case CC_SpinWidget: { case CC_SpinWidget: {
if ( !widget ) if ( elementFlags & CEF_UseGenericParameters )
return TQRect(); return TQRect();
int fw = pixelMetric( PM_SpinBoxFrameWidth, 0 ); int fw = pixelMetric( PM_SpinBoxFrameWidth, ceData, elementFlags, 0 );
TQSize bs; TQSize bs;
bs.setHeight( widget->height()/2 ); bs.setHeight( ceData.rect.height()/2 );
if ( bs.height() < 8 ) if ( bs.height() < 8 )
bs.setHeight( 8 ); bs.setHeight( 8 );
bs.setWidth( TQMIN( bs.height() * 8 / 5, widget->width() / 4 ) ); // 1.6 -approximate golden mean bs.setWidth( TQMIN( bs.height() * 8 / 5, ceData.rect.width() / 4 ) ); // 1.6 -approximate golden mean
bs = bs.expandedTo( TQApplication::globalStrut() ); bs = bs.expandedTo( TQApplication::globalStrut() );
int y = 0; int y = 0;
int x, lx, rx; int x, lx, rx;
x = widget->width() - y - bs.width(); x = ceData.rect.width() - y - bs.width();
lx = fw; lx = fw;
rx = x - fw * 2; rx = x - fw * 2;
switch ( sc ) { switch ( sc ) {
@ -1576,12 +1577,12 @@ TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
case SC_SpinWidgetDown: case SC_SpinWidgetDown:
return TQRect(x, y + bs.height(), bs.width(), bs.height()); return TQRect(x, y + bs.height(), bs.width(), bs.height());
case SC_SpinWidgetButtonField: case SC_SpinWidgetButtonField:
return TQRect(x, y, bs.width(), widget->height() - 2*fw); return TQRect(x, y, bs.width(), ceData.rect.height() - 2*fw);
case SC_SpinWidgetEditField: case SC_SpinWidgetEditField:
return TQRect(lx, fw, rx, widget->height() - 2*fw); return TQRect(lx, fw, rx, ceData.rect.height() - 2*fw);
case SC_SpinWidgetFrame: case SC_SpinWidgetFrame:
return TQRect( 0, 0, return TQRect( 0, 0,
widget->width() - bs.width(), widget->height() ); ceData.rect.width() - bs.width(), ceData.rect.height() );
default: default:
break; break;
} }
@ -1590,14 +1591,13 @@ TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
#ifndef QT_NO_SLIDER #ifndef QT_NO_SLIDER
case CC_Slider: { case CC_Slider: {
if (sc == SC_SliderHandle) { if (sc == SC_SliderHandle) {
const TQSlider * sl = (const TQSlider *) widget; int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget );
int tickOffset = pixelMetric( PM_SliderTickmarkOffset, sl ); int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
int thickness = pixelMetric( PM_SliderControlThickness, sl ); int sliderPos = ceData.startStep;
int sliderPos = sl->sliderStart(); int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget );
int len = pixelMetric( PM_SliderLength, sl );
int motifBorder = 3; int motifBorder = 3;
if ( sl->orientation() == Horizontal ) if ( ceData.orientation == Horizontal )
return TQRect( sliderPos + motifBorder, tickOffset + motifBorder, len, return TQRect( sliderPos + motifBorder, tickOffset + motifBorder, len,
thickness - 2*motifBorder ); thickness - 2*motifBorder );
return TQRect( tickOffset + motifBorder, sliderPos + motifBorder, return TQRect( tickOffset + motifBorder, sliderPos + motifBorder,
@ -1608,25 +1608,24 @@ TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
#ifndef QT_NO_SCROLLBAR #ifndef QT_NO_SCROLLBAR
case CC_ScrollBar: { case CC_ScrollBar: {
if (! widget) if (elementFlags & CEF_UseGenericParameters)
return TQRect(); return TQRect();
const TQScrollBar *scrollbar = (const TQScrollBar *) widget; int sliderstart = ceData.startStep;
int sliderstart = scrollbar->sliderStart(); int sbextent = pixelMetric(PM_ScrollBarExtent, ceData, elementFlags, widget);
int sbextent = pixelMetric(PM_ScrollBarExtent, widget); int fw = pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags, widget);
int fw = pixelMetric(PM_DefaultFrameWidth, widget);
int buttonw = sbextent - (fw * 2); int buttonw = sbextent - (fw * 2);
int buttonh = sbextent - (fw * 2); int buttonh = sbextent - (fw * 2);
int maxlen = ((scrollbar->orientation() == TQt::Horizontal) ? int maxlen = ((ceData.orientation == TQt::Horizontal) ?
scrollbar->width() : scrollbar->height()) - ceData.rect.width() : ceData.rect.height()) -
(buttonw * 2) - (fw * 2); (buttonw * 2) - (fw * 2);
int sliderlen; int sliderlen;
// calculate slider length // calculate slider length
if (scrollbar->maxValue() != scrollbar->minValue()) { if (ceData.maxSteps != ceData.minSteps) {
uint range = scrollbar->maxValue() - scrollbar->minValue(); uint range = ceData.maxSteps - ceData.minSteps;
sliderlen = (scrollbar->pageStep() * maxlen) / sliderlen = (ceData.pageStep * maxlen) /
(range + scrollbar->pageStep()); (range + ceData.pageStep);
if ( sliderlen < 9 || range > INT_MAX/2 ) if ( sliderlen < 9 || range > INT_MAX/2 )
sliderlen = 9; sliderlen = 9;
@ -1638,47 +1637,47 @@ TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
switch (sc) { switch (sc) {
case SC_ScrollBarSubLine: case SC_ScrollBarSubLine:
// top/left button // top/left button
if (scrollbar->orientation() == TQt::Horizontal) { if (ceData.orientation == TQt::Horizontal) {
if ( scrollbar->width()/2 < sbextent ) if ( ceData.rect.width()/2 < sbextent )
buttonw = scrollbar->width()/2 - (fw*2); buttonw = ceData.rect.width()/2 - (fw*2);
return TQRect(fw, fw, buttonw, buttonh); return TQRect(fw, fw, buttonw, buttonh);
} else { } else {
if ( scrollbar->height()/2 < sbextent ) if ( ceData.rect.height()/2 < sbextent )
buttonh = scrollbar->height()/2 - (fw*2); buttonh = ceData.rect.height()/2 - (fw*2);
return TQRect(fw, fw, buttonw, buttonh); return TQRect(fw, fw, buttonw, buttonh);
} }
case SC_ScrollBarAddLine: case SC_ScrollBarAddLine:
// bottom/right button // bottom/right button
if (scrollbar->orientation() == TQt::Horizontal) { if (ceData.orientation == TQt::Horizontal) {
if ( scrollbar->width()/2 < sbextent ) if ( ceData.rect.width()/2 < sbextent )
buttonw = scrollbar->width()/2 - (fw*2); buttonw = ceData.rect.width()/2 - (fw*2);
return TQRect(scrollbar->width() - buttonw - fw, fw, return TQRect(ceData.rect.width() - buttonw - fw, fw,
buttonw, buttonh); buttonw, buttonh);
} else { } else {
if ( scrollbar->height()/2 < sbextent ) if ( ceData.rect.height()/2 < sbextent )
buttonh = scrollbar->height()/2 - (fw*2); buttonh = ceData.rect.height()/2 - (fw*2);
return TQRect(fw, scrollbar->height() - buttonh - fw, return TQRect(fw, ceData.rect.height() - buttonh - fw,
buttonw, buttonh); buttonw, buttonh);
} }
case SC_ScrollBarSubPage: case SC_ScrollBarSubPage:
if (scrollbar->orientation() == TQt::Horizontal) if (ceData.orientation == TQt::Horizontal)
return TQRect(buttonw + fw, fw, sliderstart - buttonw - fw, buttonw); return TQRect(buttonw + fw, fw, sliderstart - buttonw - fw, buttonw);
return TQRect(fw, buttonw + fw, buttonw, sliderstart - buttonw - fw); return TQRect(fw, buttonw + fw, buttonw, sliderstart - buttonw - fw);
case SC_ScrollBarAddPage: case SC_ScrollBarAddPage:
if (scrollbar->orientation() == TQt::Horizontal) if (ceData.orientation == TQt::Horizontal)
return TQRect(sliderstart + sliderlen, fw, return TQRect(sliderstart + sliderlen, fw,
maxlen - sliderstart - sliderlen + buttonw + fw, buttonw); maxlen - sliderstart - sliderlen + buttonw + fw, buttonw);
return TQRect(fw, sliderstart + sliderlen, buttonw, return TQRect(fw, sliderstart + sliderlen, buttonw,
maxlen - sliderstart - sliderlen + buttonw + fw); maxlen - sliderstart - sliderlen + buttonw + fw);
case SC_ScrollBarGroove: case SC_ScrollBarGroove:
if (scrollbar->orientation() == TQt::Horizontal) if (ceData.orientation == TQt::Horizontal)
return TQRect(buttonw + fw, fw, maxlen, buttonw); return TQRect(buttonw + fw, fw, maxlen, buttonw);
return TQRect(fw, buttonw + fw, buttonw, maxlen); return TQRect(fw, buttonw + fw, buttonw, maxlen);
case SC_ScrollBarSlider: case SC_ScrollBarSlider:
if (scrollbar->orientation() == TQt::Horizontal) if (ceData.orientation == TQt::Horizontal)
return TQRect(sliderstart, fw, sliderlen, buttonw); return TQRect(sliderstart, fw, sliderlen, buttonw);
return TQRect(fw, sliderstart, buttonw, sliderlen); return TQRect(fw, sliderstart, buttonw, sliderlen);
@ -1693,18 +1692,16 @@ TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
switch ( sc ) { switch ( sc ) {
case SC_ComboBoxArrow: { case SC_ComboBoxArrow: {
const TQComboBox * cb = (const TQComboBox *) widget;
int ew, awh, sh, dh, ax, ay, sy; int ew, awh, sh, dh, ax, ay, sy;
int fw = pixelMetric( PM_DefaultFrameWidth, cb ); int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget );
TQRect cr = cb->rect(); TQRect cr = ceData.rect;
cr.addCoords( fw, fw, -fw, -fw ); cr.addCoords( fw, fw, -fw, -fw );
get_combo_parameters( cr, ew, awh, ax, ay, sh, dh, sy ); get_combo_parameters( cr, ew, awh, ax, ay, sh, dh, sy );
return TQRect( ax, ay, awh, awh ); } return TQRect( ax, ay, awh, awh ); }
case SC_ComboBoxEditField: { case SC_ComboBoxEditField: {
const TQComboBox * cb = (const TQComboBox *) widget; int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget );
int fw = pixelMetric( PM_DefaultFrameWidth, cb ); TQRect rect = ceData.rect;
TQRect rect = cb->rect();
rect.addCoords( fw, fw, -fw, -fw ); rect.addCoords( fw, fw, -fw, -fw );
int ew = get_combo_extra_width( rect.height(), rect.width() ); int ew = get_combo_extra_width( rect.height(), rect.width() );
rect.addCoords( 1, 1, -1-ew, -1 ); rect.addCoords( 1, 1, -1-ew, -1 );
@ -1717,15 +1714,17 @@ TQRect TQMotifStyle::querySubControlMetrics( ComplexControl control,
#endif #endif
default: break; default: break;
} }
return TQCommonStyle::querySubControlMetrics( control, widget, sc, opt ); return TQCommonStyle::querySubControlMetrics( control, ceData, elementFlags, sc, opt, widget );
} }
/*!\reimp /*!\reimp
*/ */
TQSize TQMotifStyle::sizeFromContents( ContentsType contents, TQSize TQMotifStyle::sizeFromContents( ContentsType contents,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsSize, const TQSize &contentsSize,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
TQSize sz(contentsSize); TQSize sz(contentsSize);
@ -1733,10 +1732,9 @@ TQSize TQMotifStyle::sizeFromContents( ContentsType contents,
case CT_PushButton: case CT_PushButton:
{ {
#ifndef QT_NO_PUSHBUTTON #ifndef QT_NO_PUSHBUTTON
const TQPushButton *button = (const TQPushButton *) widget; sz = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, contentsSize, opt, widget);
sz = TQCommonStyle::sizeFromContents(contents, widget, contentsSize, opt); if (((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault)) &&
if ((button->isDefault() || button->autoDefault()) && sz.width() < 80 && ceData.fgPixmap.isNull())
sz.width() < 80 && ! button->pixmap())
sz.setWidth(80); sz.setWidth(80);
#endif #endif
break; break;
@ -1745,11 +1743,10 @@ TQSize TQMotifStyle::sizeFromContents( ContentsType contents,
case CT_PopupMenuItem: case CT_PopupMenuItem:
{ {
#ifndef QT_NO_POPUPMENU #ifndef QT_NO_POPUPMENU
if (! widget || opt.isDefault()) if ((elementFlags & CEF_UseGenericParameters) || opt.isDefault())
break; break;
const TQPopupMenu *popup = (TQPopupMenu *) widget; bool checkable = (elementFlags & CEF_IsCheckable);
bool checkable = popup->isCheckable();
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
int maxpmw = opt.maxIconWidth(); int maxpmw = opt.maxIconWidth();
int w = sz.width(), h = sz.height(); int w = sz.width(), h = sz.height();
@ -1794,7 +1791,7 @@ TQSize TQMotifStyle::sizeFromContents( ContentsType contents,
} }
default: default:
sz = TQCommonStyle::sizeFromContents( contents, widget, contentsSize, opt ); sz = TQCommonStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, opt, widget );
break; break;
} }
@ -1803,21 +1800,21 @@ TQSize TQMotifStyle::sizeFromContents( ContentsType contents,
/*!\reimp /*!\reimp
*/ */
TQRect TQMotifStyle::subRect( SubRect r, const TQWidget *widget ) const TQRect TQMotifStyle::subRect( SubRect r, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const
{ {
TQRect rect; TQRect rect;
TQRect wrect = widget->rect(); TQRect wrect = ceData.rect;
switch ( r ) { switch ( r ) {
case SR_SliderFocusRect: case SR_SliderFocusRect:
rect = TQCommonStyle::subRect( r, widget ); rect = TQCommonStyle::subRect( r, ceData, elementFlags, widget );
rect.addCoords( 2, 2, -2, -2 ); rect.addCoords( 2, 2, -2, -2 );
break; break;
case SR_ComboBoxFocusRect: case SR_ComboBoxFocusRect:
{ {
int awh, ax, ay, sh, sy, dh, ew; int awh, ax, ay, sh, sy, dh, ew;
int fw = pixelMetric( PM_DefaultFrameWidth, widget ); int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget );
TQRect tr = wrect; TQRect tr = wrect;
tr.addCoords( fw, fw, -fw, -fw ); tr.addCoords( fw, fw, -fw, -fw );
@ -1829,17 +1826,16 @@ TQRect TQMotifStyle::subRect( SubRect r, const TQWidget *widget ) const
case SR_DockWindowHandleRect: case SR_DockWindowHandleRect:
{ {
#ifndef QT_NO_MAINWINDOW #ifndef QT_NO_MAINWINDOW
if ( !widget || !widget->parent() ) if ( (elementFlags & CEF_UseGenericParameters) || !(elementFlags & CEF_HasParentWidget) )
break; break;
const TQDockWindow * dw = (const TQDockWindow *) widget->parent(); if ( !ceData.dwData.hasDockArea || !ceData.dwData.closeEnabled )
if ( !dw->area() || !dw->isCloseEnabled() ) rect.setRect( 0, 0, ceData.rect.width(), ceData.rect.height() );
rect.setRect( 0, 0, widget->width(), widget->height() );
else { else {
if ( dw->area()->orientation() == Horizontal ) if ( ceData.dwData.areaOrientation == Horizontal )
rect.setRect(2, 15, widget->width()-2, widget->height() - 15); rect.setRect(2, 15, ceData.rect.width()-2, ceData.rect.height() - 15);
else else
rect.setRect(0, 2, widget->width() - 15, widget->height() - 2); rect.setRect(0, 2, ceData.rect.width() - 15, ceData.rect.height() - 2);
} }
#endif #endif
break; break;
@ -1849,15 +1845,14 @@ TQRect TQMotifStyle::subRect( SubRect r, const TQWidget *widget ) const
case SR_ProgressBarContents: case SR_ProgressBarContents:
{ {
#ifndef QT_NO_PROGRESSBAR #ifndef QT_NO_PROGRESSBAR
TQFontMetrics fm( ( widget ? widget->fontMetrics() : TQFontMetrics fm( ( (!(elementFlags & CEF_UseGenericParameters)) ? TQFontMetrics(ceData.font) :
TQApplication::fontMetrics() ) ); TQApplication::fontMetrics() ) );
const TQProgressBar *progressbar = (const TQProgressBar *) widget;
int textw = 0; int textw = 0;
if (progressbar->percentageVisible()) if (ceData.percentageVisible)
textw = fm.width("100%") + 6; textw = fm.width("100%") + 6;
if (progressbar->indicatorFollowsStyle() || if ((elementFlags & CEF_IndicatorFollowsStyle) ||
progressbar->centerIndicator()) (elementFlags & CEF_CenterIndicator))
rect = wrect; rect = wrect;
else else
rect.setCoords(wrect.left(), wrect.top(), rect.setCoords(wrect.left(), wrect.top(),
@ -1869,15 +1864,14 @@ TQRect TQMotifStyle::subRect( SubRect r, const TQWidget *widget ) const
case SR_ProgressBarLabel: case SR_ProgressBarLabel:
{ {
#ifndef QT_NO_PROGRESSBAR #ifndef QT_NO_PROGRESSBAR
TQFontMetrics fm( ( widget ? widget->fontMetrics() : TQFontMetrics fm( ( (!(elementFlags & CEF_UseGenericParameters)) ? TQFontMetrics(ceData.font) :
TQApplication::fontMetrics() ) ); TQApplication::fontMetrics() ) );
const TQProgressBar *progressbar = (const TQProgressBar *) widget;
int textw = 0; int textw = 0;
if (progressbar->percentageVisible()) if (ceData.percentageVisible)
textw = fm.width("100%") + 6; textw = fm.width("100%") + 6;
if (progressbar->indicatorFollowsStyle() || if ((elementFlags & CEF_IndicatorFollowsStyle) ||
progressbar->centerIndicator()) (elementFlags & CEF_CenterIndicator))
rect = wrect; rect = wrect;
else else
rect.setCoords(wrect.right() - textw, wrect.top(), rect.setCoords(wrect.right() - textw, wrect.top(),
@ -1889,7 +1883,7 @@ TQRect TQMotifStyle::subRect( SubRect r, const TQWidget *widget ) const
case SR_CheckBoxContents: case SR_CheckBoxContents:
{ {
#ifndef QT_NO_CHECKBOX #ifndef QT_NO_CHECKBOX
TQRect ir = subRect(SR_CheckBoxIndicator, widget); TQRect ir = subRect(SR_CheckBoxIndicator, ceData, elementFlags, widget);
rect.setRect(ir.right() + 10, wrect.y(), rect.setRect(ir.right() + 10, wrect.y(),
wrect.width() - ir.width() - 10, wrect.height()); wrect.width() - ir.width() - 10, wrect.height());
#endif #endif
@ -1898,14 +1892,14 @@ TQRect TQMotifStyle::subRect( SubRect r, const TQWidget *widget ) const
case SR_RadioButtonContents: case SR_RadioButtonContents:
{ {
TQRect ir = subRect(SR_RadioButtonIndicator, widget); TQRect ir = subRect(SR_RadioButtonIndicator, ceData, elementFlags, widget);
rect.setRect(ir.right() + 10, wrect.y(), rect.setRect(ir.right() + 10, wrect.y(),
wrect.width() - ir.width() - 10, wrect.height()); wrect.width() - ir.width() - 10, wrect.height());
break; break;
} }
default: default:
rect = TQCommonStyle::subRect( r, widget ); rect = TQCommonStyle::subRect( r, ceData, elementFlags, widget );
} }
return rect; return rect;
@ -2228,8 +2222,10 @@ static const char *const question_xpm[] = {
\reimp \reimp
*/ */
TQPixmap TQMotifStyle::stylePixmap(StylePixmap sp, TQPixmap TQMotifStyle::stylePixmap(StylePixmap sp,
const TQWidget *widget, TQStyleControlElementData ceData,
const TQStyleOption& opt) const ControlElementFlags elementFlags,
const TQStyleOption& opt,
const TQWidget *widget) const
{ {
#ifndef QT_NO_IMAGEIO_XPM #ifndef QT_NO_IMAGEIO_XPM
switch (sp) { switch (sp) {
@ -2306,15 +2302,17 @@ TQPixmap TQMotifStyle::stylePixmap(StylePixmap sp,
} }
#endif #endif
return TQCommonStyle::stylePixmap(sp, widget, opt); return TQCommonStyle::stylePixmap(sp, ceData, elementFlags, opt, widget);
} }
/*! \reimp */ /*! \reimp */
int TQMotifStyle::styleHint(StyleHint hint, int TQMotifStyle::styleHint(StyleHint hint,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQStyleOption &opt, const TQStyleOption &opt,
TQStyleHintReturn *returnData) const TQStyleHintReturn *returnData,
const TQWidget *widget) const
{ {
int ret; int ret;
@ -2348,7 +2346,7 @@ int TQMotifStyle::styleHint(StyleHint hint,
break; break;
default: default:
ret = TQCommonStyle::styleHint(hint, widget, opt, returnData); ret = TQCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget);
break; break;
} }

@ -86,6 +86,8 @@ TQPlatinumStyle::~TQPlatinumStyle()
*/ */
void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe, void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -98,7 +100,7 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe,
// sunken... // sunken...
if ( flags & Style_Sunken ) if ( flags & Style_Sunken )
flags ^= Style_Sunken; flags ^= Style_Sunken;
drawPrimitive( PE_ButtonBevel, p, r, cg, flags, opt ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags, opt );
break; break;
} }
case PE_ButtonTool: case PE_ButtonTool:
@ -115,7 +117,7 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe,
fill = myCG.brush( TQColorGroup::Button ); fill = myCG.brush( TQColorGroup::Button );
myCG.setBrush( TQColorGroup::Mid, fill ); myCG.setBrush( TQColorGroup::Mid, fill );
drawPrimitive( PE_ButtonBevel, p, r, myCG, flags, opt ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, myCG, flags, opt );
break; break;
} }
case PE_ButtonBevel: case PE_ButtonBevel:
@ -450,7 +452,7 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe,
} }
case PE_Indicator: case PE_Indicator:
{ {
drawPrimitive( PE_ButtonBevel, p, TQRect(r.x(), r.y(), drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect(r.x(), r.y(),
r.width() - 2, r.height()), r.width() - 2, r.height()),
cg, flags ); cg, flags );
p->fillRect( r.x() + r.width() - 2, r.y(), 2, r.height(), p->fillRect( r.x() + r.width() - 2, r.y(), 2, r.height(),
@ -606,14 +608,14 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe,
} }
case PE_ScrollBarAddLine: case PE_ScrollBarAddLine:
{ {
drawPrimitive( PE_ButtonBevel, p, r, cg, drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg,
(flags & Style_Enabled) | ((flags & Style_Down) (flags & Style_Enabled) | ((flags & Style_Down)
? Style_Sunken ? Style_Sunken
: Style_Raised) ); : Style_Raised) );
p->setPen( cg.shadow() ); p->setPen( cg.shadow() );
p->drawRect( r ); p->drawRect( r );
drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowRight drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowRight
: PE_ArrowDown), p, TQRect(r.x() + 2, : PE_ArrowDown), p, ceData, elementFlags, TQRect(r.x() + 2,
r.y() + 2, r.y() + 2,
r.width() - 4, r.width() - 4,
r.height() - 4), r.height() - 4),
@ -622,14 +624,14 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe,
} }
case PE_ScrollBarSubLine: case PE_ScrollBarSubLine:
{ {
drawPrimitive( PE_ButtonBevel, p, r, cg, drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg,
(flags & Style_Enabled) | ((flags & Style_Down) (flags & Style_Enabled) | ((flags & Style_Down)
? Style_Sunken ? Style_Sunken
: Style_Raised) ); : Style_Raised) );
p->setPen( cg.shadow() ); p->setPen( cg.shadow() );
p->drawRect( r ); p->drawRect( r );
drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowLeft drawPrimitive( ((flags & Style_Horizontal) ? PE_ArrowLeft
: PE_ArrowUp ), p, TQRect(r.x() + 2, : PE_ArrowUp ), p, ceData, elementFlags, TQRect(r.x() + 2,
r.y() + 2, r.y() + 2,
r.width() - 4, r.width() - 4,
r.height() - 4), r.height() - 4),
@ -715,14 +717,14 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe,
{ {
TQPoint bo = p->brushOrigin(); TQPoint bo = p->brushOrigin();
p->setBrushOrigin( r.topLeft() ); p->setBrushOrigin( r.topLeft() );
drawPrimitive( PE_ButtonBevel, p, r, cg, Style_Raised ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, r, cg, Style_Raised );
p->setBrushOrigin( bo ); p->setBrushOrigin( bo );
drawRiffles( p, r.x(), r.y(), r.width(), r.height(), cg, drawRiffles( p, r.x(), r.y(), r.width(), r.height(), cg,
flags & Style_Horizontal ); flags & Style_Horizontal );
p->setPen( cg.shadow() ); p->setPen( cg.shadow() );
p->drawRect( r ); p->drawRect( r );
if ( flags & Style_HasFocus ) { if ( flags & Style_HasFocus ) {
drawPrimitive( PE_FocusRect, p, TQRect(r.x() + 2, r.y() + 2, drawPrimitive( PE_FocusRect, p, ceData, elementFlags, TQRect(r.x() + 2, r.y() + 2,
r.width() - 5, r.width() - 5,
r.height() - 5 ), r.height() - 5 ),
cg, flags ); cg, flags );
@ -730,7 +732,7 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe,
break; break;
} }
default: default:
TQWindowsStyle::drawPrimitive( pe, p, r, cg, flags, opt ); TQWindowsStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
break; break;
} }
@ -740,36 +742,36 @@ void TQPlatinumStyle::drawPrimitive( PrimitiveElement pe,
*/ */
void TQPlatinumStyle::drawControl( ControlElement element, void TQPlatinumStyle::drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how, SFlags how,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch( element ) { switch( element ) {
case CE_PushButton: case CE_PushButton:
{ {
#ifndef QT_NO_PUSHBUTTON #ifndef QT_NO_PUSHBUTTON
TQColorGroup myCg( cg ); TQColorGroup myCg( cg );
const TQPushButton *btn;
int x1, y1, x2, y2; int x1, y1, x2, y2;
bool useBevelButton; bool useBevelButton;
SFlags flags; SFlags flags;
flags = Style_Default; flags = Style_Default;
btn = (const TQPushButton*)widget; p->setBrushOrigin( -ceData.bgOffset.x(),
p->setBrushOrigin( -widget->backgroundOffset().x(), -ceData.bgOffset.y() );
-widget->backgroundOffset().y() );
// take care of the flags based on what we know... // take care of the flags based on what we know...
if ( btn->isDown() ) if ( elementFlags & CEF_IsDown )
flags |= Style_Down; flags |= Style_Down;
if ( btn->isOn() ) if ( elementFlags & CEF_IsOn )
flags |= Style_On; flags |= Style_On;
if ( btn->isEnabled() ) if ( elementFlags & CEF_IsEnabled )
flags |= Style_Enabled; flags |= Style_Enabled;
if ( btn->isDefault() ) if ( elementFlags & CEF_IsDefault )
flags |= Style_Default; flags |= Style_Default;
if (! btn->isFlat() && !(flags & Style_Down)) if (! ( elementFlags & CEF_IsFlat ) && !(flags & Style_Down))
flags |= Style_Raised; flags |= Style_Raised;
r.coords( &x1, &y1, &x2, &y2 ); r.coords( &x1, &y1, &x2, &y2 );
@ -778,28 +780,28 @@ void TQPlatinumStyle::drawControl( ControlElement element,
p->setBrush( TQBrush(cg.button(), NoBrush) ); p->setBrush( TQBrush(cg.button(), NoBrush) );
TQBrush fill; TQBrush fill;
if ( btn->isDown() ) { if ( elementFlags & CEF_IsDown ) {
fill = cg.brush( TQColorGroup::Dark ); fill = cg.brush( TQColorGroup::Dark );
// this could be done differently, but this // this could be done differently, but this
// makes a down Bezel drawn correctly... // makes a down Bezel drawn correctly...
myCg.setBrush( TQColorGroup::Mid, fill ); myCg.setBrush( TQColorGroup::Mid, fill );
} else if ( btn->isOn() ) { } else if ( elementFlags & CEF_IsOn ) {
fill = TQBrush( cg.mid(), Dense4Pattern ); fill = TQBrush( cg.mid(), Dense4Pattern );
myCg.setBrush( TQColorGroup::Mid, fill ); myCg.setBrush( TQColorGroup::Mid, fill );
} }
// to quote the old TQPlatinumStlye drawPushButton... // to quote the old TQPlatinumStlye drawPushButton...
// small or square image buttons as well as toggle buttons are // small or square image buttons as well as toggle buttons are
// bevel buttons (what a heuristic....) // bevel buttons (what a heuristic....)
if ( btn->isToggleButton() if ( ( elementFlags & CEF_BiState )
|| ( btn->pixmap() && || ( (!ceData.fgPixmap.isNull()) &&
(btn->width() * btn->height() < 1600 || (ceData.rect.width() * ceData.rect.height() < 1600 ||
TQABS( btn->width() - btn->height()) < 10 )) ) TQABS( ceData.rect.width() - ceData.rect.height()) < 10 )) )
useBevelButton = TRUE; useBevelButton = TRUE;
else else
useBevelButton = FALSE; useBevelButton = FALSE;
int diw = pixelMetric( PM_ButtonDefaultIndicator, widget ); int diw = pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, widget );
if ( btn->isDefault() ) { if ( elementFlags & CEF_IsDefault ) {
x1 += 1; x1 += 1;
y1 += 1; y1 += 1;
x2 -= 1; x2 -= 1;
@ -814,37 +816,37 @@ void TQPlatinumStyle::drawControl( ControlElement element,
cg2.setColor( TQColorGroup::Button, cg.mid() ); cg2.setColor( TQColorGroup::Button, cg.mid() );
if ( useBevelButton ) { if ( useBevelButton ) {
drawPrimitive( PE_ButtonBevel, p, TQRect( x1, y1, drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( x1, y1,
x2 - x1 + 1, x2 - x1 + 1,
y2 - y1 + 1 ), y2 - y1 + 1 ),
myCg, myFlags, opt ); myCg, myFlags, opt );
} else { } else {
drawPrimitive( PE_ButtonCommand, p, TQRect( x1, y1, drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, TQRect( x1, y1,
x2 - x1 + 1, x2 - x1 + 1,
y2 - y1 + 1 ), y2 - y1 + 1 ),
cg2, myFlags, opt ); cg2, myFlags, opt );
} }
} }
if ( btn->isDefault() || btn->autoDefault() ) { if ( ( elementFlags & CEF_IsDefault ) || ( elementFlags & CEF_AutoDefault ) ) {
x1 += diw; x1 += diw;
y1 += diw; y1 += diw;
x2 -= diw; x2 -= diw;
y2 -= diw; y2 -= diw;
} }
if ( !btn->isFlat() || btn->isOn() || btn->isDown() ) { if ( (!( elementFlags & CEF_IsFlat )) || ( elementFlags & CEF_IsOn ) || ( elementFlags & CEF_IsDown ) ) {
if ( useBevelButton ) { if ( useBevelButton ) {
// fix for toggle buttons... // fix for toggle buttons...
if ( flags & (Style_Down | Style_On) ) if ( flags & (Style_Down | Style_On) )
flags |= Style_Sunken; flags |= Style_Sunken;
drawPrimitive( PE_ButtonBevel, p, TQRect( x1, y1, drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( x1, y1,
x2 - x1 + 1, x2 - x1 + 1,
y2 - y1 + 1 ), y2 - y1 + 1 ),
myCg, flags, opt ); myCg, flags, opt );
} else { } else {
drawPrimitive( PE_ButtonCommand, p, TQRect( x1, y1, drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, TQRect( x1, y1,
x2 - x1 + 1, x2 - x1 + 1,
y2 - y1 + 1 ), y2 - y1 + 1 ),
myCg, flags, opt ); myCg, flags, opt );
@ -860,16 +862,14 @@ void TQPlatinumStyle::drawControl( ControlElement element,
case CE_PushButtonLabel: case CE_PushButtonLabel:
{ {
#ifndef QT_NO_PUSHBUTTON #ifndef QT_NO_PUSHBUTTON
const TQPushButton *btn;
bool on; bool on;
int x, y, w, h; int x, y, w, h;
SFlags flags; SFlags flags;
flags = Style_Default; flags = Style_Default;
btn = (const TQPushButton*)widget; on = (( elementFlags & CEF_IsDown ) || ( elementFlags & CEF_IsOn ));
on = btn->isDown() || btn->isOn();
r.rect( &x, &y, &w, &h ); r.rect( &x, &y, &w, &h );
if ( btn->isMenuButton() ) { if ( elementFlags & CEF_IsMenuWidget ) {
int dx = pixelMetric( PM_MenuButtonIndicator, widget ); int dx = pixelMetric( PM_MenuButtonIndicator, ceData, elementFlags, widget );
TQColorGroup g = cg; TQColorGroup g = cg;
int xx = x + w - dx - 4; int xx = x + w - dx - 4;
@ -884,23 +884,23 @@ void TQPlatinumStyle::drawControl( ControlElement element,
p->setPen( g.light() ); p->setPen( g.light() );
p->drawLine( xx + 2, yy + 2, xx + 2, yy + hh - 2 ); p->drawLine( xx + 2, yy + 2, xx + 2, yy + hh - 2 );
} }
if ( btn->isEnabled() ) if ( elementFlags & CEF_IsEnabled )
flags |= Style_Enabled; flags |= Style_Enabled;
drawPrimitive( PE_ArrowDown, p, TQRect(x + w - dx - 1, y + 2, drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, TQRect(x + w - dx - 1, y + 2,
dx, h - 4), dx, h - 4),
g, flags, opt ); g, flags, opt );
w -= dx; w -= dx;
} }
#ifndef QT_NO_ICONSET #ifndef QT_NO_ICONSET
if ( btn->iconSet() && !btn->iconSet()->isNull() ) { if ( !ceData.iconSet.isNull() ) {
TQIconSet::Mode mode = btn->isEnabled() TQIconSet::Mode mode = ( elementFlags & CEF_IsEnabled )
? TQIconSet::Normal : TQIconSet::Disabled; ? TQIconSet::Normal : TQIconSet::Disabled;
if ( mode == TQIconSet::Normal && btn->hasFocus() ) if ( mode == TQIconSet::Normal && ( elementFlags & CEF_HasFocus ) )
mode = TQIconSet::Active; mode = TQIconSet::Active;
TQIconSet::State state = TQIconSet::Off; TQIconSet::State state = TQIconSet::Off;
if ( btn->isToggleButton() && btn->isOn() ) if ( ( elementFlags & CEF_BiState ) && ( elementFlags & CEF_IsOn ) )
state = TQIconSet::On; state = TQIconSet::On;
TQPixmap pixmap = btn->iconSet()->pixmap( TQIconSet::Small, TQPixmap pixmap = ceData.iconSet.pixmap( TQIconSet::Small,
mode, state ); mode, state );
int pixw = pixmap.width(); int pixw = pixmap.width();
int pixh = pixmap.height(); int pixh = pixmap.height();
@ -911,19 +911,19 @@ void TQPlatinumStyle::drawControl( ControlElement element,
#endif #endif
drawItem( p, TQRect( x, y, w, h ), drawItem( p, TQRect( x, y, w, h ),
AlignCenter | ShowPrefix, AlignCenter | ShowPrefix,
btn->colorGroup(), btn->isEnabled(), ceData.colorGroup, ( elementFlags & CEF_IsEnabled ),
btn->pixmap(), btn->text(), -1, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text, -1,
on ? &btn->colorGroup().brightText() on ? &ceData.colorGroup.brightText()
: &btn->colorGroup().buttonText() ); : &ceData.colorGroup.buttonText() );
if ( btn->hasFocus() ) if ( elementFlags & CEF_HasFocus )
drawPrimitive( PE_FocusRect, p, drawPrimitive( PE_FocusRect, p, ceData, elementFlags,
subRect(SR_PushButtonFocusRect, widget), subRect(SR_PushButtonFocusRect, ceData, elementFlags, widget),
cg, flags ); cg, flags );
break; break;
#endif #endif
} }
default: default:
TQWindowsStyle::drawControl( element, p, widget, r, cg, how, opt ); TQWindowsStyle::drawControl( element, p, ceData, elementFlags, r, cg, how, opt, widget );
break; break;
} }
} }
@ -932,13 +932,15 @@ void TQPlatinumStyle::drawControl( ControlElement element,
*/ */
void TQPlatinumStyle::drawComplexControl( ComplexControl control, void TQPlatinumStyle::drawComplexControl( ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags how, SFlags how,
SCFlags sub, SCFlags sub,
SCFlags subActive, SCFlags subActive,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch ( control ) { switch ( control ) {
case CC_ComboBox: case CC_ComboBox:
@ -1010,8 +1012,8 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control,
p->drawPoint( x + w - 3, y + h - 3 ); p->drawPoint( x + w - 3, y + h - 3 );
if ( sub & SC_ComboBoxArrow ) { if ( sub & SC_ComboBoxArrow ) {
TQRect rTmp = querySubControlMetrics( CC_ComboBox, widget, TQRect rTmp = querySubControlMetrics( CC_ComboBox, ceData, elementFlags,
SC_ComboBoxArrow, opt ); SC_ComboBoxArrow, opt, widget );
int xx = rTmp.x(), int xx = rTmp.x(),
yy = rTmp.y(), yy = rTmp.y(),
ww = rTmp.width(), ww = rTmp.width(),
@ -1078,21 +1080,19 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control,
} }
#ifndef QT_NO_COMBOBOX #ifndef QT_NO_COMBOBOX
if ( sub & SC_ComboBoxEditField ) { if ( sub & SC_ComboBoxEditField ) {
const TQComboBox *cmb;
cmb = (const TQComboBox*)widget;
// sadly this is pretty much the windows code, except // sadly this is pretty much the windows code, except
// for the first fillRect call... // for the first fillRect call...
TQRect re = TQRect re =
TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, TQStyle::visualRect( querySubControlMetrics( CC_ComboBox,
widget, ceData, elementFlags,
SC_ComboBoxEditField ), SC_ComboBoxEditField, TQStyleOption::Default, widget ),
widget ); ceData, elementFlags );
if ( cmb->hasFocus() && !cmb->editable() ) if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) )
p->fillRect( re.x() + 1, re.y() + 1, p->fillRect( re.x() + 1, re.y() + 1,
re.width() - 2, re.height() - 2, re.width() - 2, re.height() - 2,
cg.brush( TQColorGroup::Highlight ) ); cg.brush( TQColorGroup::Highlight ) );
if ( cmb->hasFocus() ) { if ( elementFlags & CEF_HasFocus ) {
p->setPen( cg.highlightedText() ); p->setPen( cg.highlightedText() );
p->setBackgroundColor( cg.highlight() ); p->setBackgroundColor( cg.highlight() );
} else { } else {
@ -1100,16 +1100,16 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control,
p->setBackgroundColor( cg.background() ); p->setBackgroundColor( cg.background() );
} }
if ( cmb->hasFocus() && !cmb->editable() ) { if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) ) {
TQRect re = TQRect re =
TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags,
cmb ), widget ),
widget ); ceData, elementFlags );
drawPrimitive( PE_FocusRect, p, re, cg, drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg,
Style_FocusAtBorder, Style_FocusAtBorder,
TQStyleOption(cg.highlight())); TQStyleOption(cg.highlight()));
} }
if ( cmb->editable() ) { if ( elementFlags & CEF_IsEditable ) {
// need this for the moment... // need this for the moment...
// was the code in comboButton rect // was the code in comboButton rect
TQRect ir( x + 3, y + 3, TQRect ir( x + 3, y + 3,
@ -1128,15 +1128,14 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control,
case CC_Slider: case CC_Slider:
{ {
#ifndef QT_NO_SLIDER #ifndef QT_NO_SLIDER
const TQSlider *slider = (const TQSlider *) widget; int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
int thickness = pixelMetric( PM_SliderControlThickness, widget ); int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget );
int len = pixelMetric( PM_SliderLength, widget ); int ticks = ceData.tickMarkSetting;
int ticks = slider->tickmarks();
TQRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove,
opt), opt, widget),
handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle, handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle,
opt); opt, widget);
if ((sub & SC_SliderGroove) && groove.isValid()) { if ((sub & SC_SliderGroove) && groove.isValid()) {
p->fillRect( groove, cg.brush(TQColorGroup::Background) ); p->fillRect( groove, cg.brush(TQColorGroup::Background) );
@ -1149,16 +1148,16 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control,
if ( ticks & TQSlider::Below ) if ( ticks & TQSlider::Below )
mid -= len / 8; mid -= len / 8;
if ( slider->orientation() == Horizontal ) { if ( ceData.orientation == Horizontal ) {
x = 0; x = 0;
y = groove.y() + mid - 3; y = groove.y() + mid - 3;
w = slider->width(); w = ceData.rect.width();
h = 7; h = 7;
} else { } else {
x = groove.x() + mid - 3; x = groove.x() + mid - 3;
y = 0; y = 0;
w = 7; w = 7;
h = slider->height(); h = ceData.rect.height();
} }
p->fillRect( x, y, w, h, cg.brush( TQColorGroup::Dark )); p->fillRect( x, y, w, h, cg.brush( TQColorGroup::Dark ));
@ -1209,7 +1208,7 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control,
// ### end slider groove // ### end slider groove
if ( how & Style_HasFocus ) if ( how & Style_HasFocus )
drawPrimitive( PE_FocusRect, p, groove, cg ); drawPrimitive( PE_FocusRect, p, ceData, elementFlags, groove, cg );
} }
if ((sub & SC_SliderHandle) && handle.isValid()) { if ((sub & SC_SliderHandle) && handle.isValid()) {
@ -1224,7 +1223,7 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control,
int mx = handle.width() / 2; int mx = handle.width() / 2;
int my = handle.height() / 2; int my = handle.height() / 2;
if ( slider->orientation() == Vertical ) { if ( ceData.orientation == Vertical ) {
// Background // Background
TQBrush oldBrush = p->brush(); TQBrush oldBrush = p->brush();
p->setBrush( cg.brush( TQColorGroup::Button ) ); p->setBrush( cg.brush( TQColorGroup::Button ) );
@ -1303,15 +1302,15 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control,
} }
if ( sub & SC_SliderTickmarks ) if ( sub & SC_SliderTickmarks )
TQCommonStyle::drawComplexControl( control, p, widget, r, TQCommonStyle::drawComplexControl( control, p, ceData, elementFlags, r,
cg, how, SC_SliderTickmarks, cg, how, SC_SliderTickmarks,
subActive, opt ); subActive, opt, widget );
#endif #endif
break; break;
} }
default: default:
TQWindowsStyle::drawComplexControl( control, p, widget, r, cg, TQWindowsStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg,
how, sub, subActive, opt ); how, sub, subActive, opt, widget );
break; break;
} }
} }
@ -1321,18 +1320,18 @@ void TQPlatinumStyle::drawComplexControl( ComplexControl control,
/*!\reimp /*!\reimp
*/ */
TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control, TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sc, SubControl sc,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch( control ) { switch( control ) {
#ifndef QT_NO_COMBOBOX #ifndef QT_NO_COMBOBOX
case CC_ComboBox: case CC_ComboBox:
const TQComboBox *cb;
cb = (const TQComboBox *)widget;
switch( sc ) { switch( sc ) {
case SC_ComboBoxArrow: { case SC_ComboBoxArrow: {
TQRect ir = cb->rect(); TQRect ir = ceData.rect;
int xx; int xx;
if( TQApplication::reverseLayout() ) if( TQApplication::reverseLayout() )
xx = ir.x(); xx = ir.x();
@ -1346,22 +1345,20 @@ TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control,
#endif #endif
#ifndef QT_NO_SCROLLBAR #ifndef QT_NO_SCROLLBAR
case CC_ScrollBar: { case CC_ScrollBar: {
const TQScrollBar *sb; int sliderStart = ceData.startStep;
sb = (const TQScrollBar *)widget; int sbextent = pixelMetric( PM_ScrollBarExtent, ceData, elementFlags, widget );
int sliderStart = sb->sliderStart(); int maxlen = ((ceData.orientation == TQt::Horizontal) ?
int sbextent = pixelMetric( PM_ScrollBarExtent, widget ); ceData.rect.width() : ceData.rect.height()) - ( sbextent * 2 );
int maxlen = ((sb->orientation() == TQt::Horizontal) ?
sb->width() : sb->height()) - ( sbextent * 2 );
int sliderlen; int sliderlen;
// calculate length // calculate length
if ( sb->maxValue() != sb->minValue() ) { if ( ceData.maxSteps != ceData.minSteps ) {
uint range = sb->maxValue() - sb->minValue(); uint range = ceData.maxSteps - ceData.minSteps;
sliderlen = ( sb->pageStep() * maxlen ) / sliderlen = ( ceData.pageStep * maxlen ) /
( range + sb->pageStep() ); ( range + ceData.pageStep );
int slidermin = pixelMetric( PM_ScrollBarSliderMin, widget ); int slidermin = pixelMetric( PM_ScrollBarSliderMin, ceData, elementFlags, widget );
if ( sliderlen < slidermin || range > INT_MAX / 2 ) if ( sliderlen < slidermin || range > INT_MAX / 2 )
sliderlen = slidermin; sliderlen = slidermin;
if ( sliderlen > maxlen ) if ( sliderlen > maxlen )
@ -1372,33 +1369,33 @@ TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control,
switch ( sc ) { switch ( sc ) {
case SC_ScrollBarSubLine: case SC_ScrollBarSubLine:
if ( sb->orientation() == TQt::Horizontal ) { if ( ceData.orientation == TQt::Horizontal ) {
int buttonw = TQMIN( sb->width() / 2, sbextent ); int buttonw = TQMIN( ceData.rect.width() / 2, sbextent );
return TQRect( sb->width() - 2 * buttonw, 0, buttonw, sbextent ); return TQRect( ceData.rect.width() - 2 * buttonw, 0, buttonw, sbextent );
} else { } else {
int buttonh = TQMIN( sb->height() / 2, sbextent ); int buttonh = TQMIN( ceData.rect.height() / 2, sbextent );
return TQRect( 0, sb->height() - 2 * buttonh, sbextent, buttonh ); return TQRect( 0, ceData.rect.height() - 2 * buttonh, sbextent, buttonh );
} }
case SC_ScrollBarAddLine: case SC_ScrollBarAddLine:
if ( sb->orientation() == TQt::Horizontal ) { if ( ceData.orientation == TQt::Horizontal ) {
int buttonw = TQMIN( sb->width() / 2, sbextent ); int buttonw = TQMIN( ceData.rect.width() / 2, sbextent );
return TQRect( sb->width() - buttonw, 0, sbextent, buttonw ); return TQRect( ceData.rect.width() - buttonw, 0, sbextent, buttonw );
} else { } else {
int buttonh = TQMIN( sb->height() / 2, sbextent ); int buttonh = TQMIN( ceData.rect.height() / 2, sbextent );
return TQRect(0, sb->height() - buttonh, sbextent, buttonh ); return TQRect(0, ceData.rect.height() - buttonh, sbextent, buttonh );
} }
case SC_ScrollBarSubPage: case SC_ScrollBarSubPage:
if ( sb->orientation() == TQt::Horizontal ) if ( ceData.orientation == TQt::Horizontal )
return TQRect( 1, 0, sliderStart, sbextent ); return TQRect( 1, 0, sliderStart, sbextent );
return TQRect( 0, 1, sbextent, sliderStart ); return TQRect( 0, 1, sbextent, sliderStart );
case SC_ScrollBarAddPage: case SC_ScrollBarAddPage:
if ( sb->orientation() == TQt::Horizontal ) if ( ceData.orientation == TQt::Horizontal )
return TQRect( sliderStart + sliderlen, 0, maxlen - sliderStart - sliderlen, sbextent ); return TQRect( sliderStart + sliderlen, 0, maxlen - sliderStart - sliderlen, sbextent );
return TQRect( 0, sliderStart + sliderlen, sbextent, maxlen - sliderStart - sliderlen ); return TQRect( 0, sliderStart + sliderlen, sbextent, maxlen - sliderStart - sliderlen );
case SC_ScrollBarGroove: case SC_ScrollBarGroove:
if ( sb->orientation() == TQt::Horizontal ) if ( ceData.orientation == TQt::Horizontal )
return TQRect( 1, 0, sb->width() - sbextent * 2, sb->height() ); return TQRect( 1, 0, ceData.rect.width() - sbextent * 2, ceData.rect.height() );
return TQRect( 0, 1, sb->width(), sb->height() - sbextent * 2 ); return TQRect( 0, 1, ceData.rect.width(), ceData.rect.height() - sbextent * 2 );
default: default:
break; break;
} }
@ -1406,13 +1403,11 @@ TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control,
#endif #endif
#ifndef QT_NO_SLIDER #ifndef QT_NO_SLIDER
case CC_Slider: { case CC_Slider: {
int tickOffset = pixelMetric( PM_SliderTickmarkOffset, ceData, elementFlags, widget);
const TQSlider *slider = (const TQSlider *) widget; int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget);
int tickOffset = pixelMetric( PM_SliderTickmarkOffset, widget);
int thickness = pixelMetric( PM_SliderControlThickness, widget);
int mid = thickness / 2; int mid = thickness / 2;
int ticks = slider->tickmarks(); int ticks = ceData.tickMarkSetting;
int len = pixelMetric( PM_SliderLength, widget ); int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget );
switch ( sc ) { switch ( sc ) {
case SC_SliderGroove: case SC_SliderGroove:
@ -1420,9 +1415,9 @@ TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control,
mid += len / 8; mid += len / 8;
if ( ticks & TQSlider::Below ) if ( ticks & TQSlider::Below )
mid -= len / 8; mid -= len / 8;
if ( slider->orientation() == TQSlider::Horizontal ) if ( ceData.orientation == TQSlider::Horizontal )
return TQRect( 0, tickOffset, slider->width(), thickness ); return TQRect( 0, tickOffset, ceData.rect.width(), thickness );
return TQRect( tickOffset, 0, thickness, slider->height() ); return TQRect( tickOffset, 0, thickness, ceData.rect.height() );
default: default:
break; break;
} }
@ -1431,13 +1426,13 @@ TQRect TQPlatinumStyle::querySubControlMetrics( ComplexControl control,
default: default:
break; break;
} }
return TQWindowsStyle::querySubControlMetrics( control, widget, sc, opt ); return TQWindowsStyle::querySubControlMetrics( control, ceData, elementFlags, sc, opt, widget );
} }
/*!\reimp /*!\reimp
*/ */
int TQPlatinumStyle::pixelMetric( PixelMetric metric, int TQPlatinumStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags,
const TQWidget *widget ) const const TQWidget *widget ) const
{ {
int ret; int ret;
@ -1466,7 +1461,7 @@ int TQPlatinumStyle::pixelMetric( PixelMetric metric,
ret = -1; ret = -1;
break; break;
default: default:
ret = TQWindowsStyle::pixelMetric( metric, widget ); ret = TQWindowsStyle::pixelMetric( metric, ceData, elementFlags, widget );
break; break;
} }
return ret; return ret;
@ -1474,19 +1469,19 @@ int TQPlatinumStyle::pixelMetric( PixelMetric metric,
/*!\reimp /*!\reimp
*/ */
TQRect TQPlatinumStyle::subRect( SubRect r, const TQWidget *widget ) const TQRect TQPlatinumStyle::subRect( SubRect r, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const
{ {
TQRect rect; TQRect rect;
switch ( r ) { switch ( r ) {
case SR_ComboBoxFocusRect: case SR_ComboBoxFocusRect:
{ {
TQRect tmpR = widget->rect(); TQRect tmpR = ceData.rect;
rect = TQRect( tmpR.x() + 4, tmpR.y() + 4, tmpR.width() - 8 - 16, rect = TQRect( tmpR.x() + 4, tmpR.y() + 4, tmpR.width() - 8 - 16,
tmpR.height() - 8 ); tmpR.height() - 8 );
break; break;
} }
default: default:
rect = TQWindowsStyle::subRect( r, widget ); rect = TQWindowsStyle::subRect( r, ceData, elementFlags, widget );
break; break;
} }
return rect; return rect;

@ -254,7 +254,7 @@ TQSGIStyle::polish( TQWidget* w )
#endif #endif
#ifndef QT_NO_POPUPMENU #ifndef QT_NO_POPUPMENU
} else if ( ::tqt_cast<TQPopupMenu*>(w) ) { } else if ( ::tqt_cast<TQPopupMenu*>(w) ) {
((TQFrame*) w)->setLineWidth( pixelMetric( PM_DefaultFrameWidth ) + 1 ); ((TQFrame*) w)->setLineWidth( pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None ) + 1 );
TQFont f = TQApplication::font(); TQFont f = TQApplication::font();
f.setBold( TRUE ); f.setBold( TRUE );
f.setItalic( TRUE ); f.setItalic( TRUE );
@ -273,7 +273,7 @@ TQSGIStyle::unPolish( TQWidget* w )
w->removeEventFilter( this ); w->removeEventFilter( this );
#ifndef QT_NO_POPUPMENU #ifndef QT_NO_POPUPMENU
} else if ( ::tqt_cast<TQPopupMenu*>(w) ) { } else if ( ::tqt_cast<TQPopupMenu*>(w) ) {
((TQFrame*)w)->setLineWidth( pixelMetric( PM_DefaultFrameWidth ) ); ((TQFrame*)w)->setLineWidth( pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None ) );
w->setFont( TQApplication::font() ); w->setFont( TQApplication::font() );
#endif #endif
#if !defined(QT_NO_MENUBAR) || !defined(QT_NO_COMBOBOX) #if !defined(QT_NO_MENUBAR) || !defined(QT_NO_COMBOBOX)
@ -375,7 +375,7 @@ static const int sgiTabSpacing = 12; // space between text and tab
static const int sgiCheckMarkSpace = 20; static const int sgiCheckMarkSpace = 20;
/*! \reimp */ /*! \reimp */
int TQSGIStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) const int TQSGIStyle::pixelMetric( PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const
{ {
switch ( metric ) { switch ( metric ) {
case PM_DefaultFrameWidth: case PM_DefaultFrameWidth:
@ -401,7 +401,7 @@ int TQSGIStyle::pixelMetric( PixelMetric metric, const TQWidget *widget ) const
default: default:
break; break;
} }
return TQMotifStyle::pixelMetric( metric, widget ); return TQMotifStyle::pixelMetric( metric, ceData, elementFlags, widget );
} }
static void drawPanel( TQPainter *p, int x, int y, int w, int h, static void drawPanel( TQPainter *p, int x, int y, int w, int h,
@ -552,6 +552,8 @@ static void get_combo_parameters( const TQRect &r,
/*! \reimp */ /*! \reimp */
void TQSGIStyle::drawPrimitive( PrimitiveElement pe, void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -562,7 +564,7 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
const int w = r.width(); const int w = r.width();
const int h = r.height(); const int h = r.height();
const bool sunken = flags & ( Style_Sunken | Style_Down | Style_On ); const bool sunken = flags & ( Style_Sunken | Style_Down | Style_On );
const int defaultFrameWidth = pixelMetric( PM_DefaultFrameWidth ); const int defaultFrameWidth = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags );
bool hot = ( flags & Style_MouseOver ) && ( flags & Style_Enabled ); bool hot = ( flags & Style_MouseOver ) && ( flags & Style_Enabled );
switch ( pe ) { switch ( pe ) {
@ -588,7 +590,7 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
case PE_ButtonBevel: case PE_ButtonBevel:
case PE_ButtonTool: case PE_ButtonTool:
{ {
drawPrimitive( PE_ButtonCommand, p, TQRect( x+1, y+1, w-2, h-2 ), cg, flags, opt ); drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, TQRect( x+1, y+1, w-2, h-2 ), cg, flags, opt );
TQPen oldPen = p->pen(); TQPen oldPen = p->pen();
TQPointArray a; TQPointArray a;
@ -642,11 +644,11 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
TQRect er = r; TQRect er = r;
er.addCoords( 1, 1, -1, -1 ); er.addCoords( 1, 1, -1, -1 );
int iflags = flags & ~Style_On; int iflags = flags & ~Style_On;
drawPrimitive( PE_ButtonBevel, p, er, cg, iflags, opt ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, er, cg, iflags, opt );
if ( !(flags & TQStyle::Style_Off) ) { if ( !(flags & TQStyle::Style_Off) ) {
er = r; er = r;
er.addCoords( 1, 2, 1, 1 ); er.addCoords( 1, 2, 1, 1 );
drawPrimitive( PE_CheckMark, p, er, cg, flags, opt ); drawPrimitive( PE_CheckMark, p, ceData, elementFlags, er, cg, flags, opt );
} }
} }
break; break;
@ -795,17 +797,17 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
case PE_ScrollBarSubLine: case PE_ScrollBarSubLine:
if ( !r.contains( d->mousePos ) && !(flags & Style_Active) ) if ( !r.contains( d->mousePos ) && !(flags & Style_Active) )
flags &= ~Style_MouseOver; flags &= ~Style_MouseOver;
drawPrimitive( PE_ButtonCommand, p, r, cg, flags, opt ); drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags, opt );
drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp), drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp),
p, r, cg, Style_Enabled | flags); p, ceData, elementFlags, r, cg, Style_Enabled | flags);
break; break;
case PE_ScrollBarAddLine: case PE_ScrollBarAddLine:
if ( !r.contains( d->mousePos ) ) if ( !r.contains( d->mousePos ) )
flags &= ~Style_MouseOver; flags &= ~Style_MouseOver;
drawPrimitive( PE_ButtonCommand, p, r, cg, flags, opt ); drawPrimitive( PE_ButtonCommand, p, ceData, elementFlags, r, cg, flags, opt );
drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown), drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown),
p, r, cg, Style_Enabled | flags); p, ceData, elementFlags, r, cg, Style_Enabled | flags);
break; break;
case PE_ScrollBarSubPage: case PE_ScrollBarSubPage:
@ -825,7 +827,7 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
TQPixmap pm( r.width(), r.height() ); TQPixmap pm( r.width(), r.height() );
TQPainter bp( &pm ); TQPainter bp( &pm );
drawPrimitive(PE_ButtonBevel, &bp, TQRect(0,0,r.width(),r.height()), cg, flags | Style_Enabled | Style_Raised); drawPrimitive(PE_ButtonBevel, &bp, ceData, elementFlags, TQRect(0,0,r.width(),r.height()), cg, flags | Style_Enabled | Style_Raised);
if ( flags & Style_Horizontal ) { if ( flags & Style_Horizontal ) {
const int sliderM = r.width() / 2; const int sliderM = r.width() / 2;
if ( r.width() > 20 ) { if ( r.width() > 20 ) {
@ -853,7 +855,7 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
case PE_Splitter: case PE_Splitter:
{ {
const int motifOffset = 10; const int motifOffset = 10;
int sw = pixelMetric( PM_SplitterWidth ); int sw = pixelMetric( PM_SplitterWidth, ceData, elementFlags );
if ( flags & Style_Horizontal ) { if ( flags & Style_Horizontal ) {
int xPos = x + w/2; int xPos = x + w/2;
int kPos = motifOffset; int kPos = motifOffset;
@ -862,7 +864,7 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
qDrawShadeLine( p, xPos, kPos + kSize - 1 , qDrawShadeLine( p, xPos, kPos + kSize - 1 ,
xPos, h, cg ); xPos, h, cg );
drawPrimitive( PE_ButtonBevel, p, TQRect(xPos-sw/2+1, kPos, kSize, kSize+1), cg, flags, opt ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect(xPos-sw/2+1, kPos, kSize, kSize+1), cg, flags, opt );
qDrawShadeLine( p, xPos+2, 0, xPos, kPos, cg ); qDrawShadeLine( p, xPos+2, 0, xPos, kPos, cg );
} else { } else {
int yPos = y + h/2; int yPos = y + h/2;
@ -870,14 +872,14 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
int kSize = sw - 2; int kSize = sw - 2;
qDrawShadeLine( p, 0, yPos, kPos, yPos, cg ); qDrawShadeLine( p, 0, yPos, kPos, yPos, cg );
drawPrimitive( PE_ButtonBevel, p, TQRect( kPos, yPos-sw/2+1, kSize+1, kSize ), cg, flags, opt ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( kPos, yPos-sw/2+1, kSize+1, kSize ), cg, flags, opt );
qDrawShadeLine( p, kPos + kSize+1, yPos, w, yPos, cg ); qDrawShadeLine( p, kPos + kSize+1, yPos, w, yPos, cg );
} }
} }
break; break;
default: default:
TQMotifStyle::drawPrimitive( pe, p, r, cg, flags, opt ); TQMotifStyle::drawPrimitive( pe, p, ceData, elementFlags, r, cg, flags, opt );
break; break;
} }
} }
@ -885,11 +887,13 @@ void TQSGIStyle::drawPrimitive( PrimitiveElement pe,
/*! \reimp */ /*! \reimp */
void TQSGIStyle::drawControl( ControlElement element, void TQSGIStyle::drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
if ( widget == d->hotWidget ) if ( widget == d->hotWidget )
flags |= Style_MouseOver; flags |= Style_MouseOver;
@ -898,17 +902,16 @@ void TQSGIStyle::drawControl( ControlElement element,
case CE_PushButton: case CE_PushButton:
{ {
#ifndef QT_NO_PUSHBUTTON #ifndef QT_NO_PUSHBUTTON
const TQPushButton *btn = (TQPushButton*)widget;
int x1, y1, x2, y2; int x1, y1, x2, y2;
r.coords( &x1, &y1, &x2, &y2 ); r.coords( &x1, &y1, &x2, &y2 );
p->setPen( cg.foreground() ); p->setPen( cg.foreground() );
p->setBrush( TQBrush( cg.button(),TQt::NoBrush ) ); p->setBrush( TQBrush( cg.button(),TQt::NoBrush ) );
p->setBrushOrigin( -widget->backgroundOffset().x(), p->setBrushOrigin( -ceData.bgOffset.x(),
-widget->backgroundOffset().y() ); -ceData.bgOffset.y() );
int diw = pixelMetric( TQStyle::PM_ButtonDefaultIndicator ); int diw = pixelMetric( TQStyle::PM_ButtonDefaultIndicator, ceData, elementFlags );
if ( btn->isDefault() || btn->autoDefault() ) { if ( ( elementFlags & CEF_IsDefault ) || ( elementFlags & CEF_AutoDefault ) ) {
x1 += diw; x1 += diw;
y1 += diw; y1 += diw;
x2 -= diw; x2 -= diw;
@ -916,7 +919,7 @@ void TQSGIStyle::drawControl( ControlElement element,
} }
TQPointArray a; TQPointArray a;
if ( btn->isDefault() ) { if ( elementFlags & CEF_IsDefault ) {
if ( diw == 0 ) { if ( diw == 0 ) {
a.setPoints( 9, a.setPoints( 9,
x1, y1, x2, y1, x2, y2, x1, y2, x1, y1+1, x1, y1, x2, y1, x2, y2, x1, y2, x1, y1+1,
@ -928,13 +931,13 @@ void TQSGIStyle::drawControl( ControlElement element,
x2 -= 2; x2 -= 2;
y2 -= 2; y2 -= 2;
} else { } else {
qDrawShadePanel( p, btn->rect(), cg, TRUE ); qDrawShadePanel( p, ceData.rect, cg, TRUE );
} }
} }
TQBrush fill = cg.brush( TQColorGroup::Button ); TQBrush fill = cg.brush( TQColorGroup::Button );
if ( !btn->isFlat() || btn->isOn() || btn->isDown() ) if ( (!( elementFlags & CEF_IsFlat )) || ( elementFlags & CEF_IsOn ) || ( elementFlags & CEF_IsDown ) )
drawPrimitive( PE_ButtonBevel, p, TQRect( x1, y1, x2-x1+1, y2-y1+1 ), cg, flags, opt ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, TQRect( x1, y1, x2-x1+1, y2-y1+1 ), cg, flags, opt );
if ( p->brush().style() != TQt::NoBrush ) if ( p->brush().style() != TQt::NoBrush )
p->setBrush( TQt::NoBrush ); p->setBrush( TQt::NoBrush );
@ -945,16 +948,15 @@ void TQSGIStyle::drawControl( ControlElement element,
case CE_PopupMenuItem: case CE_PopupMenuItem:
{ {
#ifndef QT_NO_POPUPMENU #ifndef QT_NO_POPUPMENU
if (! widget || opt.isDefault()) if ( ( elementFlags & CEF_UseGenericParameters ) || opt.isDefault())
break; break;
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
if ( !mi ) if ( !mi )
break; break;
const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget;
int tab = opt.tabWidth(); int tab = opt.tabWidth();
int maxpmw = opt.maxIconWidth(); int maxpmw = opt.maxIconWidth();
bool dis = ! (flags & Style_Enabled); bool dis = ! (flags & Style_Enabled);
bool checkable = popupmenu->isCheckable(); bool checkable = ( elementFlags & CEF_IsCheckable );
bool act = flags & Style_Active; bool act = flags & Style_Active;
int x, y, w, h; int x, y, w, h;
@ -973,7 +975,7 @@ void TQSGIStyle::drawControl( ControlElement element,
int pw = sgiItemFrame; int pw = sgiItemFrame;
if ( act && !dis ) { if ( act && !dis ) {
if ( pixelMetric( PM_DefaultFrameWidth ) > 1 ) if ( pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags ) > 1 )
drawPanel( p, x, y, w, h, cg, FALSE, pw, drawPanel( p, x, y, w, h, cg, FALSE, pw,
&cg.brush( TQColorGroup::Light ) ); &cg.brush( TQColorGroup::Light ) );
else else
@ -1024,12 +1026,12 @@ void TQSGIStyle::drawControl( ControlElement element,
if ( mi->isChecked() ) { if ( mi->isChecked() ) {
TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3, TQRect er( x+sgiItemFrame+1, y+sgiItemFrame+3,
pixelMetric(PM_IndicatorWidth), pixelMetric(PM_IndicatorWidth, ceData, elementFlags),
pixelMetric(PM_IndicatorHeight) ); pixelMetric(PM_IndicatorHeight, ceData, elementFlags) );
er.addCoords( 1, 1, -1, -1 ); er.addCoords( 1, 1, -1, -1 );
drawPrimitive( PE_ButtonBevel, p, er, cg, cflags, opt ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, er, cg, cflags, opt );
er.addCoords( 0, 1, 1, 1 ); er.addCoords( 0, 1, 1, 1 );
drawPrimitive( PE_CheckMark, p, er, cg, cflags | Style_On, opt ); drawPrimitive( PE_CheckMark, p, ceData, elementFlags, er, cg, cflags | Style_On, opt );
} }
} }
} }
@ -1082,7 +1084,7 @@ void TQSGIStyle::drawControl( ControlElement element,
} }
if ( mi->popup() ) { if ( mi->popup() ) {
int dim = (h-2*sgiItemFrame) / 2; int dim = (h-2*sgiItemFrame) / 2;
drawPrimitive( PE_ArrowRight, p, TQRect( x+w-sgiArrowHMargin-sgiItemFrame-dim, y+h/2-dim/2, dim, dim ), cg, flags ); drawPrimitive( PE_ArrowRight, p, ceData, elementFlags, TQRect( x+w-sgiArrowHMargin-sgiItemFrame-dim, y+h/2-dim/2, dim, dim ), cg, flags );
} }
#endif #endif
} }
@ -1128,11 +1130,11 @@ void TQSGIStyle::drawControl( ControlElement element,
break; break;
case CE_CheckBox: case CE_CheckBox:
TQMotifStyle::drawControl( element, p, widget, r, cg, flags, opt ); TQMotifStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget );
break; break;
default: default:
TQMotifStyle::drawControl( element, p, widget, r, cg, flags, opt ); TQMotifStyle::drawControl( element, p, ceData, elementFlags, r, cg, flags, opt, widget );
break; break;
} }
} }
@ -1140,13 +1142,15 @@ void TQSGIStyle::drawControl( ControlElement element,
/*! \reimp */ /*! \reimp */
void TQSGIStyle::drawComplexControl( ComplexControl control, void TQSGIStyle::drawComplexControl( ComplexControl control,
TQPainter *p, TQPainter *p,
const TQWidget* widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect& r, const TQRect& r,
const TQColorGroup& cg, const TQColorGroup& cg,
SFlags flags, SFlags flags,
SCFlags sub, SCFlags sub,
SCFlags subActive, SCFlags subActive,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget* widget ) const
{ {
if ( widget == d->hotWidget ) if ( widget == d->hotWidget )
flags |= Style_MouseOver; flags |= Style_MouseOver;
@ -1155,33 +1159,31 @@ void TQSGIStyle::drawComplexControl( ComplexControl control,
case CC_Slider: case CC_Slider:
{ {
#ifndef QT_NO_SLIDER #ifndef QT_NO_SLIDER
const TQSlider * slider = (const TQSlider *) widget; TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove,
opt, widget),
TQRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle,
opt), opt, widget);
handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle,
opt);
if ((sub & SC_SliderGroove) && groove.isValid()) { if ((sub & SC_SliderGroove) && groove.isValid()) {
TQRegion region( groove ); TQRegion region( groove );
if ( ( sub & SC_SliderHandle ) && handle.isValid() ) if ( ( sub & SC_SliderHandle ) && handle.isValid() )
region = region.subtract( handle ); region = region.subtract( handle );
if ( d->lastSliderRect.slider == slider && d->lastSliderRect.rect.isValid() ) if ( d->lastSliderRect.slider == widget && d->lastSliderRect.rect.isValid() )
region = region.subtract( d->lastSliderRect.rect ); region = region.subtract( d->lastSliderRect.rect );
p->setClipRegion( region ); p->setClipRegion( region );
TQRect grooveTop = groove; TQRect grooveTop = groove;
grooveTop.addCoords( 1, 1, -1, -1 ); grooveTop.addCoords( 1, 1, -1, -1 );
drawPrimitive( PE_ButtonBevel, p, grooveTop, cg, flags & ~Style_MouseOver, opt ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, grooveTop, cg, flags & ~Style_MouseOver, opt );
if ( flags & Style_HasFocus ) { if ( flags & Style_HasFocus ) {
TQRect fr = subRect( SR_SliderFocusRect, widget ); TQRect fr = subRect( SR_SliderFocusRect, ceData, elementFlags, widget );
drawPrimitive( PE_FocusRect, p, fr, cg, flags & ~Style_MouseOver ); drawPrimitive( PE_FocusRect, p, ceData, elementFlags, fr, cg, flags & ~Style_MouseOver );
} }
if ( d->lastSliderRect.slider == slider && d->lastSliderRect.rect.isValid() ) { if ( d->lastSliderRect.slider == widget && d->lastSliderRect.rect.isValid() ) {
if ( ( sub & SC_SliderHandle ) && handle.isValid() ) { if ( ( sub & SC_SliderHandle ) && handle.isValid() ) {
region = widget->rect(); region = ceData.rect;
region = region.subtract( handle ); region = region.subtract( handle );
p->setClipRegion( region ); p->setClipRegion( region );
} else { } else {
@ -1195,9 +1197,9 @@ void TQSGIStyle::drawComplexControl( ComplexControl control,
if (( sub & SC_SliderHandle ) && handle.isValid()) { if (( sub & SC_SliderHandle ) && handle.isValid()) {
if ( flags & Style_MouseOver && !handle.contains( d->mousePos ) && subActive != SC_SliderHandle ) if ( flags & Style_MouseOver && !handle.contains( d->mousePos ) && subActive != SC_SliderHandle )
flags &= ~Style_MouseOver; flags &= ~Style_MouseOver;
drawPrimitive( PE_ButtonBevel, p, handle, cg, flags ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, handle, cg, flags );
if ( slider->orientation() == Horizontal ) { if ( ceData.orientation == Horizontal ) {
TQCOORD mid = handle.x() + handle.width() / 2; TQCOORD mid = handle.x() + handle.width() / 2;
qDrawShadeLine( p, mid, handle.y(), mid, qDrawShadeLine( p, mid, handle.y(), mid,
handle.y() + handle.height() - 2, handle.y() + handle.height() - 2,
@ -1211,50 +1213,48 @@ void TQSGIStyle::drawComplexControl( ComplexControl control,
} }
if ( sub & SC_SliderTickmarks ) if ( sub & SC_SliderTickmarks )
TQMotifStyle::drawComplexControl( control, p, widget, r, cg, flags, TQMotifStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags,
SC_SliderTickmarks, subActive, SC_SliderTickmarks, subActive,
opt ); opt, widget );
#endif #endif
break; break;
} }
case CC_ComboBox: case CC_ComboBox:
{ {
#ifndef QT_NO_COMBOBOX #ifndef QT_NO_COMBOBOX
const TQComboBox * cb = (TQComboBox *) widget;
if (sub & SC_ComboBoxFrame) { if (sub & SC_ComboBoxFrame) {
TQRect fr = TQRect fr =
TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, cb, TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags,
SC_ComboBoxFrame ), cb ); SC_ComboBoxFrame, TQStyleOption::Default, widget ), ceData, elementFlags );
drawPrimitive( PE_ButtonBevel, p, fr, cg, flags ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, fr, cg, flags );
} }
if ( sub & SC_ComboBoxArrow ) { if ( sub & SC_ComboBoxArrow ) {
p->save(); p->save();
TQRect er = TQRect er =
TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, cb, SC_ComboBoxArrow ), cb ); TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags, SC_ComboBoxArrow, TQStyleOption::Default, widget ), ceData, elementFlags );
er.addCoords( 0, 3, 0, 0 ); er.addCoords( 0, 3, 0, 0 );
drawPrimitive( PE_ArrowDown, p, er, cg, flags | Style_Enabled, opt ); drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, er, cg, flags | Style_Enabled, opt );
int awh, ax, ay, sh, sy, dh, ew; int awh, ax, ay, sh, sy, dh, ew;
get_combo_parameters( widget->rect(), ew, awh, ax, ay, sh, dh, sy ); get_combo_parameters( ceData.rect, ew, awh, ax, ay, sh, dh, sy );
TQBrush arrow = cg.brush( TQColorGroup::Dark ); TQBrush arrow = cg.brush( TQColorGroup::Dark );
p->fillRect( ax, sy-1, awh, sh, arrow ); p->fillRect( ax, sy-1, awh, sh, arrow );
p->restore(); p->restore();
if ( cb->hasFocus() ) { if ( elementFlags & CEF_HasFocus ) {
TQRect re = TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, cb ), cb ); TQRect re = TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ), ceData, elementFlags );
drawPrimitive( PE_FocusRect, p, re, cg ); drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg );
} }
} }
if ( sub & SC_ComboBoxEditField ) { if ( sub & SC_ComboBoxEditField ) {
if ( cb->editable() ) { if ( elementFlags & CEF_IsEditable ) {
TQRect er = TQRect er =
TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, cb, TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags,
SC_ComboBoxEditField ), cb ); SC_ComboBoxEditField, TQStyleOption::Default, widget ), ceData, elementFlags );
er.addCoords( -1, -1, 1, 1); er.addCoords( -1, -1, 1, 1);
qDrawShadePanel( p, TQRect( er.x()-1, er.y()-1, qDrawShadePanel( p, TQRect( er.x()-1, er.y()-1,
er.width()+2, er.height()+2 ), er.width()+2, er.height()+2 ),
@ -1269,27 +1269,26 @@ void TQSGIStyle::drawComplexControl( ComplexControl control,
case CC_ScrollBar: case CC_ScrollBar:
{ {
#ifndef QT_NO_SCROLLBAR #ifndef QT_NO_SCROLLBAR
TQScrollBar *scrollbar = (TQScrollBar*)widget; bool maxedOut = (ceData.minSteps == ceData.maxSteps);
bool maxedOut = (scrollbar->minValue() == scrollbar->maxValue());
if ( maxedOut ) if ( maxedOut )
flags &= ~Style_Enabled; flags &= ~Style_Enabled;
TQRect handle = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, widget, SC_ScrollBarSlider, opt ), widget ); TQRect handle = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarSlider, opt, widget ), ceData, elementFlags );
if ( sub & SC_ScrollBarGroove ) { if ( sub & SC_ScrollBarGroove ) {
} }
if ( sub & SC_ScrollBarAddLine ) { if ( sub & SC_ScrollBarAddLine ) {
TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, widget, SC_ScrollBarAddLine, opt ), widget ); TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarAddLine, opt, widget ), ceData, elementFlags );
drawPrimitive( PE_ScrollBarAddLine, p, er, cg, flags, opt ); drawPrimitive( PE_ScrollBarAddLine, p, ceData, elementFlags, er, cg, flags, opt );
} }
if ( sub & SC_ScrollBarSubLine ) { if ( sub & SC_ScrollBarSubLine ) {
TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, widget, SC_ScrollBarSubLine, opt ), widget ); TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarSubLine, opt, widget ), ceData, elementFlags );
drawPrimitive( PE_ScrollBarSubLine, p, er, cg, flags, opt ); drawPrimitive( PE_ScrollBarSubLine, p, ceData, elementFlags, er, cg, flags, opt );
} }
if ( sub & SC_ScrollBarAddPage ) { if ( sub & SC_ScrollBarAddPage ) {
TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, widget, SC_ScrollBarAddPage, opt ), widget ); TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarAddPage, opt, widget ), ceData, elementFlags );
TQRegion region( er ); TQRegion region( er );
if ( d->lastScrollbarRect.scrollbar == scrollbar && if ( d->lastScrollbarRect.scrollbar == widget &&
d->lastScrollbarRect.rect.isValid() && d->lastScrollbarRect.rect.isValid() &&
er.intersects( d->lastScrollbarRect.rect ) ) { er.intersects( d->lastScrollbarRect.rect ) ) {
region = region.subtract( d->lastScrollbarRect.rect ); region = region.subtract( d->lastScrollbarRect.rect );
@ -1300,9 +1299,9 @@ void TQSGIStyle::drawComplexControl( ComplexControl control,
p->setClipRegion( region ); p->setClipRegion( region );
} }
drawPrimitive( PE_ScrollBarAddPage, p, er, cg, flags & ~Style_MouseOver, opt ); drawPrimitive( PE_ScrollBarAddPage, p, ceData, elementFlags, er, cg, flags & ~Style_MouseOver, opt );
if ( d->lastScrollbarRect.scrollbar == scrollbar && if ( d->lastScrollbarRect.scrollbar == widget &&
d->lastScrollbarRect.rect.isValid() && d->lastScrollbarRect.rect.isValid() &&
er.intersects( d->lastScrollbarRect.rect ) ) { er.intersects( d->lastScrollbarRect.rect ) ) {
if ( sub & SC_ScrollBarSlider && handle.isValid() ) { if ( sub & SC_ScrollBarSlider && handle.isValid() ) {
@ -1317,9 +1316,9 @@ void TQSGIStyle::drawComplexControl( ComplexControl control,
p->setClipping( FALSE ); p->setClipping( FALSE );
} }
if ( sub & SC_ScrollBarSubPage ) { if ( sub & SC_ScrollBarSubPage ) {
TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, widget, SC_ScrollBarSubPage, opt ), widget ); TQRect er = TQStyle::visualRect( querySubControlMetrics( CC_ScrollBar, ceData, elementFlags, SC_ScrollBarSubPage, opt, widget ), ceData, elementFlags );
TQRegion region( er ); TQRegion region( er );
if ( d->lastScrollbarRect.scrollbar == scrollbar && if ( d->lastScrollbarRect.scrollbar == widget &&
d->lastScrollbarRect.rect.isValid() && d->lastScrollbarRect.rect.isValid() &&
er.intersects( d->lastScrollbarRect.rect ) ) { er.intersects( d->lastScrollbarRect.rect ) ) {
region = region.subtract( d->lastScrollbarRect.rect ); region = region.subtract( d->lastScrollbarRect.rect );
@ -1329,8 +1328,8 @@ void TQSGIStyle::drawComplexControl( ComplexControl control,
region = region.subtract( handle ); region = region.subtract( handle );
p->setClipRegion( region ); p->setClipRegion( region );
} }
drawPrimitive( PE_ScrollBarSubPage, p, er, cg, flags & ~Style_MouseOver, opt ); drawPrimitive( PE_ScrollBarSubPage, p, ceData, elementFlags, er, cg, flags & ~Style_MouseOver, opt );
if ( d->lastScrollbarRect.scrollbar == scrollbar && if ( d->lastScrollbarRect.scrollbar == widget &&
d->lastScrollbarRect.rect.isValid() && d->lastScrollbarRect.rect.isValid() &&
er.intersects( d->lastScrollbarRect.rect ) ) { er.intersects( d->lastScrollbarRect.rect ) ) {
if ( sub & SC_ScrollBarSlider && handle.isValid() ) { if ( sub & SC_ScrollBarSlider && handle.isValid() ) {
@ -1349,14 +1348,14 @@ void TQSGIStyle::drawComplexControl( ComplexControl control,
if ( subActive == SC_ScrollBarSlider ) if ( subActive == SC_ScrollBarSlider )
flags |= Style_Active; flags |= Style_Active;
drawPrimitive( PE_ScrollBarSlider, p, handle, cg, flags, opt ); drawPrimitive( PE_ScrollBarSlider, p, ceData, elementFlags, handle, cg, flags, opt );
} }
#endif #endif
} }
break; break;
default: default:
TQMotifStyle::drawComplexControl( control, p, widget, r, cg, flags, sub, subActive, opt ); // TQMotifStyle::drawComplexControl( control, p, ceData, elementFlags, r, cg, flags, sub, subActive, opt, widget );
break; break;
} }
} }
@ -1364,9 +1363,11 @@ void TQSGIStyle::drawComplexControl( ComplexControl control,
/*!\reimp /*!\reimp
*/ */
TQSize TQSGIStyle::sizeFromContents( ContentsType contents, TQSize TQSGIStyle::sizeFromContents( ContentsType contents,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsSize, const TQSize &contentsSize,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
TQSize sz(contentsSize); TQSize sz(contentsSize);
@ -1374,15 +1375,14 @@ TQSize TQSGIStyle::sizeFromContents( ContentsType contents,
case CT_PopupMenuItem: case CT_PopupMenuItem:
{ {
#ifndef QT_NO_POPUPMENU #ifndef QT_NO_POPUPMENU
if (! widget || opt.isDefault()) if ((elementFlags & CEF_UseGenericParameters) || opt.isDefault())
break; break;
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
sz = TQMotifStyle::sizeFromContents( contents, widget, contentsSize, sz = TQMotifStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize,
opt ); opt, widget );
// SGI checkmark items needs a bit more room // SGI checkmark items needs a bit more room
const TQPopupMenu *popup = (TQPopupMenu *) widget; if ( elementFlags & CEF_IsCheckable )
if ( popup && popup->isCheckable() )
sz.setWidth( sz.width() + 8 ); sz.setWidth( sz.width() + 8 );
// submenu indicator needs a bit more room // submenu indicator needs a bit more room
if (mi->popup()) if (mi->popup())
@ -1395,7 +1395,7 @@ TQSize TQSGIStyle::sizeFromContents( ContentsType contents,
break; break;
default: default:
sz = TQMotifStyle::sizeFromContents( contents, widget, contentsSize, opt ); sz = TQMotifStyle::sizeFromContents( contents, ceData, elementFlags, contentsSize, opt, widget );
break; break;
} }
@ -1403,7 +1403,7 @@ TQSize TQSGIStyle::sizeFromContents( ContentsType contents,
} }
/*! \reimp */ /*! \reimp */
TQRect TQSGIStyle::subRect( SubRect r, const TQWidget *widget ) const TQRect TQSGIStyle::subRect( SubRect r, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget ) const
{ {
TQRect rect; TQRect rect;
@ -1411,8 +1411,8 @@ TQRect TQSGIStyle::subRect( SubRect r, const TQWidget *widget ) const
case SR_ComboBoxFocusRect: case SR_ComboBoxFocusRect:
{ {
int awh, ax, ay, sh, sy, dh, ew; int awh, ax, ay, sh, sy, dh, ew;
int fw = pixelMetric( PM_DefaultFrameWidth, widget ); int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget );
TQRect tr = widget->rect(); TQRect tr = ceData.rect;
tr.addCoords( fw, fw, -fw, -fw ); tr.addCoords( fw, fw, -fw, -fw );
get_combo_parameters( tr, ew, awh, ax, ay, sh, dh, sy ); get_combo_parameters( tr, ew, awh, ax, ay, sh, dh, sy );
@ -1420,7 +1420,7 @@ TQRect TQSGIStyle::subRect( SubRect r, const TQWidget *widget ) const
} }
break; break;
default: default:
return TQMotifStyle::subRect( r, widget ); return TQMotifStyle::subRect( r, ceData, elementFlags, widget );
} }
return rect; return rect;
@ -1428,27 +1428,29 @@ TQRect TQSGIStyle::subRect( SubRect r, const TQWidget *widget ) const
/*! \reimp */ /*! \reimp */
TQRect TQSGIStyle::querySubControlMetrics( ComplexControl control, TQRect TQSGIStyle::querySubControlMetrics( ComplexControl control,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sub, SubControl sub,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch ( control ) { switch ( control ) {
case CC_ComboBox: case CC_ComboBox:
switch ( sub ) { switch ( sub ) {
case SC_ComboBoxFrame: case SC_ComboBoxFrame:
return widget->rect(); return ceData.rect;
case SC_ComboBoxArrow: { case SC_ComboBoxArrow: {
int ew, awh, sh, dh, ax, ay, sy; int ew, awh, sh, dh, ax, ay, sy;
int fw = pixelMetric( PM_DefaultFrameWidth, widget ); int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget );
TQRect cr = widget->rect(); TQRect cr = ceData.rect;
cr.addCoords( fw, fw, -fw, -fw ); cr.addCoords( fw, fw, -fw, -fw );
get_combo_parameters( cr, ew, awh, ax, ay, sh, dh, sy ); get_combo_parameters( cr, ew, awh, ax, ay, sh, dh, sy );
return TQRect( ax, ay, awh, awh ); } return TQRect( ax, ay, awh, awh ); }
case SC_ComboBoxEditField: { case SC_ComboBoxEditField: {
int fw = pixelMetric( PM_DefaultFrameWidth, widget ); int fw = pixelMetric( PM_DefaultFrameWidth, ceData, elementFlags, widget );
TQRect rect = widget->rect(); TQRect rect = ceData.rect;
rect.addCoords( fw, fw, -fw, -fw ); rect.addCoords( fw, fw, -fw, -fw );
int ew = get_combo_extra_width( rect.height() ); int ew = get_combo_extra_width( rect.height() );
rect.addCoords( 1, 1, -1-ew, -1 ); rect.addCoords( 1, 1, -1-ew, -1 );
@ -1459,10 +1461,10 @@ TQRect TQSGIStyle::querySubControlMetrics( ComplexControl control,
} }
break; break;
case CC_ScrollBar: case CC_ScrollBar:
return TQCommonStyle::querySubControlMetrics( control, widget, sub, opt ); return TQCommonStyle::querySubControlMetrics( control, ceData, elementFlags, sub, opt, widget );
default: break; default: break;
} }
return TQMotifStyle::querySubControlMetrics( control, widget, sub, opt ); return TQMotifStyle::querySubControlMetrics( control, ceData, elementFlags, sub, opt, widget );
} }
#endif // QT_NO_STYLE_SGI #endif // QT_NO_STYLE_SGI

@ -66,10 +66,6 @@
#include "ntqobjectlist.h" #include "ntqobjectlist.h"
#include "ntqmenubar.h" #include "ntqmenubar.h"
#if defined(Q_WS_WIN)
#include "qt_windows.h"
#endif
#include <limits.h> #include <limits.h>
@ -143,7 +139,7 @@ bool TQWindowsStyle::Private::eventFilter(TQObject *o, TQEvent *e)
while ( (w = (TQWidget*)it.current()) != 0 ) { while ( (w = (TQWidget*)it.current()) != 0 ) {
++it; ++it;
if (w->isTopLevel() || !w->isVisible() || if (w->isTopLevel() || !w->isVisible() ||
w->style().styleHint(SH_UnderlineAccelerator, w)) w->style().styleHint(SH_UnderlineAccelerator, TQStyleControlElementData(), CEF_None, w))
l->removeRef(w); l->removeRef(w);
} }
// Update states before repainting // Update states before repainting
@ -237,7 +233,7 @@ TQWindowsStyle::~TQWindowsStyle()
void TQWindowsStyle::polish(TQApplication *app) void TQWindowsStyle::polish(TQApplication *app)
{ {
// We only need the overhead when shortcuts are sometimes hidden // We only need the overhead when shortcuts are sometimes hidden
if (!styleHint(SH_UnderlineAccelerator, 0)) { if (!styleHint(SH_UnderlineAccelerator, TQStyleControlElementData(), CEF_None, 0)) {
d = new Private(this); d = new Private(this);
app->installEventFilter(d); app->installEventFilter(d);
} }
@ -271,6 +267,8 @@ void TQWindowsStyle::polish( TQPalette &pal )
/*! \reimp */ /*! \reimp */
void TQWindowsStyle::drawPrimitive( PrimitiveElement pe, void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
@ -315,31 +313,6 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
p->fillRect(r, fill); p->fillRect(r, fill);
break; break;
} }
#if defined(Q_WS_WIN)
case PE_HeaderArrow:
p->save();
if ( flags & Style_Up ) { // invert logic to follow Windows style guide
TQPointArray pa( 3 );
p->setPen( cg.light() );
p->drawLine( r.x() + r.width(), r.y(), r.x() + r.width() / 2, r.height() );
p->setPen( cg.dark() );
pa.setPoint( 0, r.x() + r.width() / 2, r.height() );
pa.setPoint( 1, r.x(), r.y() );
pa.setPoint( 2, r.x() + r.width(), r.y() );
p->drawPolyline( pa );
} else {
TQPointArray pa( 3 );
p->setPen( cg.light() );
pa.setPoint( 0, r.x(), r.height() );
pa.setPoint( 1, r.x() + r.width(), r.height() );
pa.setPoint( 2, r.x() + r.width() / 2, r.y() );
p->drawPolyline( pa );
p->setPen( cg.dark() );
p->drawLine( r.x(), r.height(), r.x() + r.width() / 2, r.y() );
}
p->restore();
break;
#endif
case PE_ButtonDefault: case PE_ButtonDefault:
p->setPen(cg.shadow()); p->setPen(cg.shadow());
@ -507,7 +480,7 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
case PE_Panel: case PE_Panel:
case PE_PanelPopup: case PE_PanelPopup:
{ {
int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth) int lw = opt.isDefault() ? pixelMetric(PM_DefaultFrameWidth, ceData, elementFlags)
: opt.lineWidth(); : opt.lineWidth();
if (lw == 2) { if (lw == 2) {
@ -518,7 +491,7 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
} }
qDrawWinPanel(p, r, popupCG, flags & Style_Sunken); qDrawWinPanel(p, r, popupCG, flags & Style_Sunken);
} else { } else {
TQCommonStyle::drawPrimitive(pe, p, r, cg, flags, opt); TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
} }
break; break;
} }
@ -572,13 +545,13 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
p->setBrush( cg.brush( TQColorGroup::Button ) ); p->setBrush( cg.brush( TQColorGroup::Button ) );
p->drawRect( r ); p->drawRect( r );
} else } else
drawPrimitive(PE_ButtonBevel, p, r, cg, flags | Style_Raised); drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags | Style_Raised);
} else } else
drawPrimitive(PE_ButtonBevel, p, r, cg, (flags & Style_Enabled) | drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) |
((flags & Style_Down) ? Style_Down : Style_Raised)); ((flags & Style_Down) ? Style_Down : Style_Raised));
drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp), drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowLeft : PE_ArrowUp),
p, r, cg, flags); p, ceData, elementFlags, r, cg, flags);
break; break;
case PE_ScrollBarAddLine: case PE_ScrollBarAddLine:
@ -588,13 +561,13 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
p->setBrush( cg.brush( TQColorGroup::Button ) ); p->setBrush( cg.brush( TQColorGroup::Button ) );
p->drawRect( r ); p->drawRect( r );
} else } else
drawPrimitive(PE_ButtonBevel, p, r, cg, flags | Style_Raised); drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, flags | Style_Raised);
} else } else
drawPrimitive(PE_ButtonBevel, p, r, cg, (flags & Style_Enabled) | drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, (flags & Style_Enabled) |
((flags & Style_Down) ? Style_Down : Style_Raised)); ((flags & Style_Down) ? Style_Down : Style_Raised));
drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown), drawPrimitive(((flags & Style_Horizontal) ? PE_ArrowRight : PE_ArrowDown),
p, r, cg, flags); p, ceData, elementFlags, r, cg, flags);
break; break;
case PE_ScrollBarAddPage: case PE_ScrollBarAddPage:
@ -632,7 +605,7 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
p->setBackgroundMode(OpaqueMode); p->setBackgroundMode(OpaqueMode);
p->drawRect(r); p->drawRect(r);
} else } else
drawPrimitive(PE_ButtonBevel, p, r, cg, Style_Enabled | Style_Raised); drawPrimitive(PE_ButtonBevel, p, ceData, elementFlags, r, cg, Style_Enabled | Style_Raised);
break; break;
case PE_WindowFrame: case PE_WindowFrame:
@ -674,8 +647,8 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
p->save(); p->save();
if ( flags & Style_Down ) if ( flags & Style_Down )
p->translate( pixelMetric( PM_ButtonShiftHorizontal ), p->translate( pixelMetric( PM_ButtonShiftHorizontal, ceData, elementFlags ),
pixelMetric( PM_ButtonShiftVertical ) ); pixelMetric( PM_ButtonShiftVertical, ceData, elementFlags ) );
if ( flags & Style_Enabled ) { if ( flags & Style_Enabled ) {
a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 ); a.translate( r.x() + r.width() / 2, r.y() + r.height() / 2 );
@ -694,7 +667,7 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
} }
p->restore(); p->restore();
} else } else
TQCommonStyle::drawPrimitive(pe, p, r, cg, flags, opt); TQCommonStyle::drawPrimitive(pe, p, ceData, elementFlags, r, cg, flags, opt);
} }
} }
@ -704,33 +677,34 @@ void TQWindowsStyle::drawPrimitive( PrimitiveElement pe,
*/ */
void TQWindowsStyle::drawControl( ControlElement element, void TQWindowsStyle::drawControl( ControlElement element,
TQPainter *p, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch (element) { switch (element) {
#ifndef QT_NO_TABBAR #ifndef QT_NO_TABBAR
case CE_TabBarTab: case CE_TabBarTab:
{ {
if ( !widget || !widget->parentWidget() || !opt.tab() ) if ( ( elementFlags & CEF_UseGenericParameters ) || (!( elementFlags & CEF_HasParentWidget )) || !opt.tab() )
break; break;
const TQTabBar * tb = (const TQTabBar *) widget;
const TQTab * t = opt.tab(); const TQTab * t = opt.tab();
bool selected = flags & Style_Selected; bool selected = flags & Style_Selected;
bool lastTab = (tb->indexOf( t->identifier() ) == tb->count()-1) ? bool lastTab = (ceData.tabBarData.identIndexMap[t->identifier()] == ceData.tabBarData.tabCount-1) ?
TRUE : FALSE; TRUE : FALSE;
TQRect r2( r ); TQRect r2( r );
if ( tb->shape() == TQTabBar::RoundedAbove ) { if ( ceData.tabBarData.shape == TQTabBar::RoundedAbove ) {
p->setPen( cg.midlight() ); p->setPen( cg.midlight() );
p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() ); p->drawLine( r2.left(), r2.bottom(), r2.right(), r2.bottom() );
p->setPen( cg.light() ); p->setPen( cg.light() );
p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 ); p->drawLine( r2.left(), r2.bottom()-1, r2.right(), r2.bottom()-1 );
if ( r2.left() == 0 ) if ( r2.left() == 0 )
p->drawPoint( tb->rect().bottomLeft() ); p->drawPoint( ceData.rect.bottomLeft() );
if ( selected ) { if ( selected ) {
p->fillRect( TQRect( r2.left()+1, r2.bottom()-1, r2.width()-3, 2), p->fillRect( TQRect( r2.left()+1, r2.bottom()-1, r2.width()-3, 2),
@ -774,9 +748,9 @@ void TQWindowsStyle::drawControl( ControlElement element,
x2++; x2++;
p->drawLine( x2, r2.top() + 2, x2, r2.bottom() - p->drawLine( x2, r2.top() + 2, x2, r2.bottom() -
(selected ? (lastTab ? 0:1) :2)); (selected ? (lastTab ? 0:1) :2));
} else if ( tb->shape() == TQTabBar::RoundedBelow ) { } else if ( ceData.tabBarData.shape == TQTabBar::RoundedBelow ) {
bool rightAligned = styleHint( SH_TabBar_Alignment, tb ) == AlignRight; bool rightAligned = styleHint( SH_TabBar_Alignment, ceData, elementFlags, TQStyleOption::Default, 0, widget ) == AlignRight;
bool firstTab = tb->indexOf( t->identifier() ) == 0; bool firstTab = ceData.tabBarData.identIndexMap[t->identifier()] == 0;
if ( selected ) { if ( selected ) {
p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1), p->fillRect( TQRect( r2.left()+1, r2.top(), r2.width()-3, 1),
cg.brush( TQColorGroup::Background )); cg.brush( TQColorGroup::Background ));
@ -823,7 +797,7 @@ void TQWindowsStyle::drawControl( ControlElement element,
p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2), p->drawLine( r2.left(), r2.top() + (selected ? 0 : 2),
r2.left(), r2.bottom() - 2 ); r2.left(), r2.bottom() - 2 );
} else { } else {
TQCommonStyle::drawControl(element, p, widget, r, cg, flags, opt); TQCommonStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
break; break;
} }
@ -838,10 +812,9 @@ void TQWindowsStyle::drawControl( ControlElement element,
#ifndef QT_NO_POPUPMENU #ifndef QT_NO_POPUPMENU
case CE_PopupMenuItem: case CE_PopupMenuItem:
{ {
if (! widget || opt.isDefault()) if (( elementFlags & CEF_UseGenericParameters ) || opt.isDefault())
break; break;
const TQPopupMenu *popupmenu = (const TQPopupMenu *) widget;
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
if ( !mi ) if ( !mi )
break; break;
@ -849,7 +822,7 @@ void TQWindowsStyle::drawControl( ControlElement element,
int tab = opt.tabWidth(); int tab = opt.tabWidth();
int maxpmw = opt.maxIconWidth(); int maxpmw = opt.maxIconWidth();
bool dis = !(flags&Style_Enabled); bool dis = !(flags&Style_Enabled);
bool checkable = popupmenu->isCheckable(); bool checkable = ( elementFlags & CEF_IsCheckable );
bool act = flags & Style_Active; bool act = flags & Style_Active;
int x, y, w, h; int x, y, w, h;
@ -937,7 +910,7 @@ void TQWindowsStyle::drawControl( ControlElement element,
if (act) if (act)
cflags |= Style_On; cflags |= Style_On;
drawPrimitive(PE_CheckMark, p, drawPrimitive(PE_CheckMark, p, ceData, elementFlags,
visualRect( TQRect(xp, y + windowsItemFrame, visualRect( TQRect(xp, y + windowsItemFrame,
checkcol - 2*windowsItemFrame, checkcol - 2*windowsItemFrame,
h - 2*windowsItemFrame), r ), cg, cflags); h - 2*windowsItemFrame), r ), cg, cflags);
@ -973,7 +946,7 @@ void TQWindowsStyle::drawControl( ControlElement element,
if ( !s.isNull() ) { // draw text if ( !s.isNull() ) { // draw text
int t = s.find( '\t' ); int t = s.find( '\t' );
int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine; int text_flags = AlignVCenter|ShowPrefix | DontClip | SingleLine;
if (!styleHint(SH_UnderlineAccelerator, widget)) if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget))
text_flags |= NoAccel; text_flags |= NoAccel;
text_flags |= (TQApplication::reverseLayout() ? AlignRight : AlignLeft ); text_flags |= (TQApplication::reverseLayout() ? AlignRight : AlignLeft );
if ( t >= 0 ) { // draw tab text if ( t >= 0 ) { // draw tab text
@ -1014,10 +987,10 @@ void TQWindowsStyle::drawControl( ControlElement element,
if ( act ) { if ( act ) {
TQColorGroup g2 = cg; TQColorGroup g2 = cg;
g2.setColor( TQColorGroup::ButtonText, g2.highlightedText() ); g2.setColor( TQColorGroup::ButtonText, g2.highlightedText() );
drawPrimitive(arrow, p, vrect, drawPrimitive(arrow, p, ceData, elementFlags, vrect,
g2, dis ? Style_Default : Style_Enabled); g2, dis ? Style_Default : Style_Enabled);
} else { } else {
drawPrimitive(arrow, p, vrect, drawPrimitive(arrow, p, ceData, elementFlags, vrect,
cg, dis ? Style_Default : Style_Enabled ); cg, dis ? Style_Default : Style_Enabled );
} }
} }
@ -1042,17 +1015,17 @@ void TQWindowsStyle::drawControl( ControlElement element,
qDrawShadeRect( p, r.x(), r.y(), r.width(), r.height(), qDrawShadeRect( p, r.x(), r.y(), r.width(), r.height(),
cg, active && down, 1, 0, &b ); cg, active && down, 1, 0, &b );
if ( active && down ) { if ( active && down ) {
pr.moveBy( pixelMetric(PM_ButtonShiftHorizontal, widget), pr.moveBy( pixelMetric(PM_ButtonShiftHorizontal, ceData, elementFlags, widget),
pixelMetric(PM_ButtonShiftVertical, widget) ); pixelMetric(PM_ButtonShiftVertical, ceData, elementFlags, widget) );
p->setBrushOrigin(p->brushOrigin() - TQPoint(1,1)); p->setBrushOrigin(p->brushOrigin() - TQPoint(1,1));
} }
} }
TQCommonStyle::drawControl(element, p, widget, pr, cg, flags, opt); TQCommonStyle::drawControl(element, p, ceData, elementFlags, pr, cg, flags, opt, widget);
break; break;
} }
default: default:
TQCommonStyle::drawControl(element, p, widget, r, cg, flags, opt); TQCommonStyle::drawControl(element, p, ceData, elementFlags, r, cg, flags, opt, widget);
} }
} }
@ -1060,7 +1033,7 @@ void TQWindowsStyle::drawControl( ControlElement element,
/*! /*!
\reimp \reimp
*/ */
int TQWindowsStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) const int TQWindowsStyle::pixelMetric(PixelMetric metric, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
int ret; int ret;
@ -1085,10 +1058,9 @@ int TQWindowsStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) cons
// equally between the tickmark regions. // equally between the tickmark regions.
case PM_SliderControlThickness: case PM_SliderControlThickness:
{ {
const TQSlider * sl = (const TQSlider *) widget; int space = (ceData.orientation == Horizontal) ? ceData.rect.height()
int space = (sl->orientation() == Horizontal) ? sl->height() : ceData.rect.width();
: sl->width(); int ticks = ceData.tickMarkSetting;
int ticks = sl->tickmarks();
int n = 0; int n = 0;
if ( ticks & TQSlider::Above ) n++; if ( ticks & TQSlider::Above ) n++;
if ( ticks & TQSlider::Below ) n++; if ( ticks & TQSlider::Below ) n++;
@ -1099,7 +1071,7 @@ int TQWindowsStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) cons
int thick = 6; // Magic constant to get 5 + 16 + 5 int thick = 6; // Magic constant to get 5 + 16 + 5
if ( ticks != TQSlider::Both && ticks != TQSlider::NoMarks ) if ( ticks != TQSlider::Both && ticks != TQSlider::NoMarks )
thick += pixelMetric( PM_SliderLength, sl ) / 4; thick += pixelMetric( PM_SliderLength, ceData, elementFlags, widget ) / 4;
space -= thick; space -= thick;
//### the two sides may be unequal in size //### the two sides may be unequal in size
@ -1114,46 +1086,12 @@ int TQWindowsStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) cons
ret = 0; ret = 0;
break; break;
#if defined(Q_WS_WIN)
case PM_TitleBarHeight:
if ( widget && ( widget->testWFlags( WStyle_Tool ) || ::tqt_cast<TQDockWindow*>(widget) ) ) {
// MS always use one less than they say
#if defined(Q_OS_TEMP)
ret = GetSystemMetrics( SM_CYCAPTION ) - 1;
#else
ret = GetSystemMetrics( SM_CYSMCAPTION ) - 1;
#endif
} else {
ret = GetSystemMetrics( SM_CYCAPTION ) - 1;
}
break;
case PM_ScrollBarExtent:
{
#ifndef Q_OS_TEMP
NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof(NONCLIENTMETRICS);
if ( SystemParametersInfo( SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0 ) )
ret = TQMAX( ncm.iScrollHeight, ncm.iScrollWidth );
else
#endif
ret = TQCommonStyle::pixelMetric( metric, widget );
}
break;
#endif
case PM_SplitterWidth: case PM_SplitterWidth:
ret = TQMAX( 6, TQApplication::globalStrut().width() ); ret = TQMAX( 6, TQApplication::globalStrut().width() );
break; break;
#if defined(Q_WS_WIN)
case PM_MDIFrameWidth:
ret = GetSystemMetrics(SM_CYFRAME);
break;
#endif
default: default:
ret = TQCommonStyle::pixelMetric(metric, widget); ret = TQCommonStyle::pixelMetric(metric, ceData, elementFlags, widget);
break; break;
} }
@ -1165,9 +1103,11 @@ int TQWindowsStyle::pixelMetric(PixelMetric metric, const TQWidget *widget) cons
\reimp \reimp
*/ */
TQSize TQWindowsStyle::sizeFromContents( ContentsType contents, TQSize TQWindowsStyle::sizeFromContents( ContentsType contents,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsSize, const TQSize &contentsSize,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
TQSize sz(contentsSize); TQSize sz(contentsSize);
@ -1175,15 +1115,14 @@ TQSize TQWindowsStyle::sizeFromContents( ContentsType contents,
case CT_PushButton: case CT_PushButton:
{ {
#ifndef QT_NO_PUSHBUTTON #ifndef QT_NO_PUSHBUTTON
const TQPushButton *button = (const TQPushButton *) widget; sz = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, contentsSize, opt, widget);
sz = TQCommonStyle::sizeFromContents(contents, widget, contentsSize, opt);
int w = sz.width(), h = sz.height(); int w = sz.width(), h = sz.height();
int defwidth = 0; int defwidth = 0;
if (button->isDefault() || button->autoDefault()) if ((elementFlags & CEF_IsDefault) || (elementFlags & CEF_AutoDefault))
defwidth = 2*pixelMetric( PM_ButtonDefaultIndicator, widget ); defwidth = 2*pixelMetric( PM_ButtonDefaultIndicator, ceData, elementFlags, widget );
if (w < 80+defwidth && !button->pixmap()) if (w < 80+defwidth && ceData.fgPixmap.isNull())
w = 80+defwidth; w = 80+defwidth;
if (h < 23+defwidth) if (h < 23+defwidth)
h = 23+defwidth; h = 23+defwidth;
@ -1196,11 +1135,10 @@ TQSize TQWindowsStyle::sizeFromContents( ContentsType contents,
case CT_PopupMenuItem: case CT_PopupMenuItem:
{ {
#ifndef QT_NO_POPUPMENU #ifndef QT_NO_POPUPMENU
if (! widget || opt.isDefault()) if (( elementFlags & CEF_UseGenericParameters ) || opt.isDefault())
break; break;
const TQPopupMenu *popup = (const TQPopupMenu *) widget; bool checkable = ( elementFlags & CEF_IsCheckable );
bool checkable = popup->isCheckable();
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
int maxpmw = opt.maxIconWidth(); int maxpmw = opt.maxIconWidth();
int w = sz.width(), h = sz.height(); int w = sz.width(), h = sz.height();
@ -1218,7 +1156,7 @@ TQSize TQWindowsStyle::sizeFromContents( ContentsType contents,
if (mi->pixmap()) if (mi->pixmap())
h = TQMAX(h, mi->pixmap()->height() + 2*windowsItemFrame); h = TQMAX(h, mi->pixmap()->height() + 2*windowsItemFrame);
else if (! mi->text().isNull()) else if (! mi->text().isNull())
h = TQMAX(h, popup->fontMetrics().height() + 2*windowsItemVMargin + h = TQMAX(h, TQFontMetrics(ceData.font).height() + 2*windowsItemVMargin +
2*windowsItemFrame); 2*windowsItemFrame);
if (mi->iconSet() != 0) if (mi->iconSet() != 0)
@ -1256,7 +1194,7 @@ TQSize TQWindowsStyle::sizeFromContents( ContentsType contents,
} }
default: default:
sz = TQCommonStyle::sizeFromContents(contents, widget, sz, opt); sz = TQCommonStyle::sizeFromContents(contents, ceData, elementFlags, sz, opt, widget);
break; break;
} }
@ -1556,8 +1494,10 @@ static const char *const question_xpm[] = {
\reimp \reimp
*/ */
TQPixmap TQWindowsStyle::stylePixmap(StylePixmap stylepixmap, TQPixmap TQWindowsStyle::stylePixmap(StylePixmap stylepixmap,
const TQWidget *widget, TQStyleControlElementData ceData,
const TQStyleOption& opt) const ControlElementFlags elementFlags,
const TQStyleOption& opt,
const TQWidget *widget) const
{ {
#ifndef QT_NO_IMAGEIO_XPM #ifndef QT_NO_IMAGEIO_XPM
switch (stylepixmap) { switch (stylepixmap) {
@ -1587,26 +1527,28 @@ TQPixmap TQWindowsStyle::stylePixmap(StylePixmap stylepixmap,
break; break;
} }
#endif //QT_NO_IMAGEIO_XPM #endif //QT_NO_IMAGEIO_XPM
return TQCommonStyle::stylePixmap(stylepixmap, widget, opt); return TQCommonStyle::stylePixmap(stylepixmap, ceData, elementFlags, opt, widget);
} }
/*!\reimp /*!\reimp
*/ */
void TQWindowsStyle::drawComplexControl( ComplexControl ctrl, TQPainter *p, void TQWindowsStyle::drawComplexControl( ComplexControl ctrl, TQPainter *p,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r, const TQRect &r,
const TQColorGroup &cg, const TQColorGroup &cg,
SFlags flags, SFlags flags,
SCFlags sub, SCFlags sub,
SCFlags subActive, SCFlags subActive,
const TQStyleOption& opt ) const const TQStyleOption& opt,
const TQWidget *widget ) const
{ {
switch (ctrl) { switch (ctrl) {
#ifndef QT_NO_LISTVIEW #ifndef QT_NO_LISTVIEW
case CC_ListView: case CC_ListView:
{ {
if ( sub & SC_ListView ) { if ( sub & SC_ListView ) {
TQCommonStyle::drawComplexControl( ctrl, p, widget, r, cg, flags, sub, subActive, opt ); TQCommonStyle::drawComplexControl( ctrl, p, ceData, elementFlags, r, cg, flags, sub, subActive, opt, widget );
} }
if ( sub & ( SC_ListViewBranch | SC_ListViewExpand ) ) { if ( sub & ( SC_ListViewBranch | SC_ListViewExpand ) ) {
if (opt.isDefault()) if (opt.isDefault())
@ -1769,13 +1711,13 @@ void TQWindowsStyle::drawComplexControl( ComplexControl ctrl, TQPainter *p,
if ( sub & SC_ComboBoxArrow ) { if ( sub & SC_ComboBoxArrow ) {
SFlags flags = Style_Default; SFlags flags = Style_Default;
qDrawWinPanel( p, r, cg, TRUE, widget->isEnabled() ? qDrawWinPanel( p, r, cg, TRUE, ( elementFlags & CEF_IsEnabled ) ?
&cg.brush( TQColorGroup::Base ): &cg.brush( TQColorGroup::Base ):
&cg.brush( TQColorGroup::Background ) ); &cg.brush( TQColorGroup::Background ) );
TQRect ar = TQRect ar =
TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget, TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags,
SC_ComboBoxArrow ), widget ); SC_ComboBoxArrow, TQStyleOption::Default, widget ), ceData, elementFlags );
if ( subActive == SC_ComboBoxArrow ) { if ( subActive == SC_ComboBoxArrow ) {
p->setPen( cg.dark() ); p->setPen( cg.dark() );
p->setBrush( cg.brush( TQColorGroup::Button ) ); p->setBrush( cg.brush( TQColorGroup::Button ) );
@ -1785,25 +1727,24 @@ void TQWindowsStyle::drawComplexControl( ComplexControl ctrl, TQPainter *p,
&cg.brush( TQColorGroup::Button ) ); &cg.brush( TQColorGroup::Button ) );
ar.addCoords( 2, 2, -2, -2 ); ar.addCoords( 2, 2, -2, -2 );
if ( widget->isEnabled() ) if ( elementFlags & CEF_IsEnabled )
flags |= Style_Enabled; flags |= Style_Enabled;
if ( subActive == SC_ComboBoxArrow ) { if ( subActive == SC_ComboBoxArrow ) {
flags |= Style_Sunken; flags |= Style_Sunken;
} }
drawPrimitive( PE_ArrowDown, p, ar, cg, flags ); drawPrimitive( PE_ArrowDown, p, ceData, elementFlags, ar, cg, flags );
} }
if ( sub & SC_ComboBoxEditField ) { if ( sub & SC_ComboBoxEditField ) {
const TQComboBox * cb = (const TQComboBox *) widget;
TQRect re = TQRect re =
TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, widget, TQStyle::visualRect( querySubControlMetrics( CC_ComboBox, ceData, elementFlags,
SC_ComboBoxEditField ), widget ); SC_ComboBoxEditField, TQStyleOption::Default, widget ), ceData, elementFlags );
if ( cb->hasFocus() && !cb->editable() ) if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) )
p->fillRect( re.x(), re.y(), re.width(), re.height(), p->fillRect( re.x(), re.y(), re.width(), re.height(),
cg.brush( TQColorGroup::Highlight ) ); cg.brush( TQColorGroup::Highlight ) );
if ( cb->hasFocus() ) { if ( elementFlags & CEF_HasFocus ) {
p->setPen( cg.highlightedText() ); p->setPen( cg.highlightedText() );
p->setBackgroundColor( cg.highlight() ); p->setBackgroundColor( cg.highlight() );
@ -1812,10 +1753,10 @@ void TQWindowsStyle::drawComplexControl( ComplexControl ctrl, TQPainter *p,
p->setBackgroundColor( cg.background() ); p->setBackgroundColor( cg.background() );
} }
if ( cb->hasFocus() && !cb->editable() ) { if ( ( elementFlags & CEF_HasFocus ) && (!( elementFlags & CEF_IsEditable )) ) {
TQRect re = TQRect re =
TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, cb ), widget ); TQStyle::visualRect( subRect( SR_ComboBoxFocusRect, ceData, elementFlags, widget ), ceData, elementFlags );
drawPrimitive( PE_FocusRect, p, re, cg, Style_FocusAtBorder, TQStyleOption(cg.highlight())); drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg, Style_FocusAtBorder, TQStyleOption(cg.highlight()));
} }
} }
@ -1825,15 +1766,14 @@ void TQWindowsStyle::drawComplexControl( ComplexControl ctrl, TQPainter *p,
#ifndef QT_NO_SLIDER #ifndef QT_NO_SLIDER
case CC_Slider: case CC_Slider:
{ {
const TQSlider *sl = (const TQSlider *) widget; int thickness = pixelMetric( PM_SliderControlThickness, ceData, elementFlags, widget );
int thickness = pixelMetric( PM_SliderControlThickness, widget ); int len = pixelMetric( PM_SliderLength, ceData, elementFlags, widget );
int len = pixelMetric( PM_SliderLength, widget ); int ticks = ceData.tickMarkSetting;
int ticks = sl->tickmarks();
TQRect groove = querySubControlMetrics(CC_Slider, widget, SC_SliderGroove, TQRect groove = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderGroove,
opt), opt, widget),
handle = querySubControlMetrics(CC_Slider, widget, SC_SliderHandle, handle = querySubControlMetrics(CC_Slider, ceData, elementFlags, SC_SliderHandle,
opt); opt, widget);
if ((sub & SC_SliderGroove) && groove.isValid()) { if ((sub & SC_SliderGroove) && groove.isValid()) {
int mid = thickness / 2; int mid = thickness / 2;
@ -1844,7 +1784,7 @@ void TQWindowsStyle::drawComplexControl( ComplexControl ctrl, TQPainter *p,
mid -= len / 8; mid -= len / 8;
p->setPen( cg.shadow() ); p->setPen( cg.shadow() );
if ( sl->orientation() == Horizontal ) { if ( ceData.orientation == Horizontal ) {
qDrawWinPanel( p, groove.x(), groove.y() + mid - 2, qDrawWinPanel( p, groove.x(), groove.y() + mid - 2,
groove.width(), 4, cg, TRUE ); groove.width(), 4, cg, TRUE );
p->drawLine( groove.x() + 1, groove.y() + mid - 1, p->drawLine( groove.x() + 1, groove.y() + mid - 1,
@ -1859,9 +1799,9 @@ void TQWindowsStyle::drawComplexControl( ComplexControl ctrl, TQPainter *p,
} }
if (sub & SC_SliderTickmarks) if (sub & SC_SliderTickmarks)
TQCommonStyle::drawComplexControl(ctrl, p, widget, r, cg, flags, TQCommonStyle::drawComplexControl(ctrl, p, ceData, elementFlags, r, cg, flags,
SC_SliderTickmarks, subActive, SC_SliderTickmarks, subActive,
opt ); opt, widget );
if ( sub & SC_SliderHandle ) { if ( sub & SC_SliderHandle ) {
// 4444440 // 4444440
@ -1887,15 +1827,15 @@ void TQWindowsStyle::drawComplexControl( ComplexControl ctrl, TQPainter *p,
int y1 = y; int y1 = y;
int y2 = y+he-1; int y2 = y+he-1;
Orientation orient = sl->orientation(); Orientation orient = ceData.orientation;
bool tickAbove = sl->tickmarks() == TQSlider::Above; bool tickAbove = ceData.tickMarkSetting == TQSlider::Above;
bool tickBelow = sl->tickmarks() == TQSlider::Below; bool tickBelow = ceData.tickMarkSetting == TQSlider::Below;
p->fillRect( x, y, wi, he, cg.brush( TQColorGroup::Background ) ); p->fillRect( x, y, wi, he, cg.brush( TQColorGroup::Background ) );
if ( flags & Style_HasFocus ) { if ( flags & Style_HasFocus ) {
TQRect re = subRect( SR_SliderFocusRect, sl ); TQRect re = subRect( SR_SliderFocusRect, ceData, elementFlags, widget );
drawPrimitive( PE_FocusRect, p, re, cg ); drawPrimitive( PE_FocusRect, p, ceData, elementFlags, re, cg );
} }
if ( (tickAbove && tickBelow) || (!tickAbove && !tickBelow) ) { if ( (tickAbove && tickBelow) || (!tickAbove && !tickBelow) ) {
@ -2032,8 +1972,8 @@ void TQWindowsStyle::drawComplexControl( ComplexControl ctrl, TQPainter *p,
#endif // QT_NO_SLIDER #endif // QT_NO_SLIDER
default: default:
TQCommonStyle::drawComplexControl( ctrl, p, widget, r, cg, flags, sub, TQCommonStyle::drawComplexControl( ctrl, p, ceData, elementFlags, r, cg, flags, sub,
subActive, opt ); subActive, opt, widget );
break; break;
} }
} }
@ -2041,9 +1981,11 @@ void TQWindowsStyle::drawComplexControl( ComplexControl ctrl, TQPainter *p,
/*! \reimp */ /*! \reimp */
int TQWindowsStyle::styleHint( StyleHint hint, int TQWindowsStyle::styleHint( StyleHint hint,
const TQWidget *widget, TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQStyleOption &opt, const TQStyleOption &opt,
TQStyleHintReturn *returnData ) const TQStyleHintReturn *returnData,
const TQWidget *widget ) const
{ {
int ret; int ret;
@ -2063,11 +2005,6 @@ int TQWindowsStyle::styleHint( StyleHint hint,
break; break;
case SH_ItemView_ChangeHighlightOnFocus: case SH_ItemView_ChangeHighlightOnFocus:
#if defined(Q_WS_WIN)
if ( qWinVersion() != WV_95 && qWinVersion() != WV_NT )
ret = 1;
else
#endif
ret = 0; ret = 0;
break; break;
@ -2075,59 +2012,8 @@ int TQWindowsStyle::styleHint( StyleHint hint,
ret = 0; ret = 0;
break; break;
#if defined(Q_WS_WIN)
case SH_UnderlineAccelerator:
ret = 1;
if ( qWinVersion() != WV_95 && qWinVersion() != WV_98 && qWinVersion() != WV_NT ) {
BOOL cues;
SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &cues, 0);
ret = cues ? 1 : 0;
// Do nothing if we always paint underlines
if (!ret && widget && d) {
TQMenuBar *menuBar = ::tqt_cast<TQMenuBar*>(widget);
TQPopupMenu *popupMenu = 0;
if (!menuBar)
popupMenu = ::tqt_cast<TQPopupMenu*>(widget);
// If we paint a menubar draw underlines if it has focus, or if alt is down,
// or if a popup menu belonging to the menubar is active and paints underlines
if (menuBar) {
if (menuBar->hasFocus()) {
ret = 1;
} else if (d->altDown()) {
ret = 1;
} else if (tqApp->focusWidget() && tqApp->focusWidget()->isPopup()) {
popupMenu = ::tqt_cast<TQPopupMenu*>(tqApp->focusWidget());
TQMenuData *pm = popupMenu ? (TQMenuData*)popupMenu->tqt_cast("TQMenuData") : 0;
if (pm && ((FriendlyMenuData*)pm)->parentMenu == menuBar) {
if (d->hasSeenAlt(menuBar))
ret = 1;
}
}
// If we paint a popup menu draw underlines if the respective menubar does
} else if (popupMenu) {
TQMenuData *pm = (TQMenuData*)popupMenu->tqt_cast("TQMenuData");
while (pm) {
if (((FriendlyMenuData*)pm)->isMenuBar) {
menuBar = (TQMenuBar*)pm;
if (d->hasSeenAlt(menuBar))
ret = 1;
break;
}
pm = ((FriendlyMenuData*)pm)->parentMenu;
}
// Otherwise draw underlines if the toplevel widget has seen an alt-press
} else if (d->hasSeenAlt(widget)) {
ret = 1;
}
}
}
break;
#endif
default: default:
ret = TQCommonStyle::styleHint(hint, widget, opt, returnData); ret = TQCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget);
break; break;
} }
@ -2135,7 +2021,7 @@ int TQWindowsStyle::styleHint( StyleHint hint,
} }
/*! \reimp */ /*! \reimp */
TQRect TQWindowsStyle::subRect(SubRect r, const TQWidget *widget) const TQRect TQWindowsStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
{ {
TQRect rect; TQRect rect;
@ -2143,15 +2029,15 @@ TQRect TQWindowsStyle::subRect(SubRect r, const TQWidget *widget) const
#ifndef QT_NO_SLIDER #ifndef QT_NO_SLIDER
case SR_SliderFocusRect: case SR_SliderFocusRect:
{ {
rect = widget->rect(); rect = ceData.rect;
break; break;
} }
#endif // QT_NO_SLIDER #endif // QT_NO_SLIDER
case SR_ToolBoxTabContents: case SR_ToolBoxTabContents:
rect = widget->rect(); rect = ceData.rect;
break; break;
default: default:
rect = TQCommonStyle::subRect( r, widget ); rect = TQCommonStyle::subRect( r, ceData, elementFlags, widget );
break; break;
} }

@ -150,6 +150,12 @@ TQDialogButtons::isButtonVisible(Button button) const
return ((int)(d->visible & button)) == button; return ((int)(d->visible & button)) == button;
} }
TQ_UINT32
TQDialogButtons::visibleButtons() const
{
return d->visible;
}
void void
TQDialogButtons::addWidget(TQWidget *w) TQDialogButtons::addWidget(TQWidget *w)
{ {

@ -72,6 +72,7 @@ public:
inline void hideButton(Button b) { setButtonVisible(b, FALSE); } inline void hideButton(Button b) { setButtonVisible(b, FALSE); }
virtual void setButtonVisible(Button, bool visible); virtual void setButtonVisible(Button, bool visible);
bool isButtonVisible(Button) const; bool isButtonVisible(Button) const;
TQ_UINT32 visibleButtons() const;
void addWidget(TQWidget *); void addWidget(TQWidget *);

@ -335,7 +335,7 @@ private:
*/ */
TQTabBar::TQTabBar( TQWidget * parent, const char *name ) TQTabBar::TQTabBar( TQWidget * parent, const char *name )
: TQWidget( parent, name, WNoAutoErase | WNoMousePropagation ) : TQWidget( parent, name, WNoAutoErase | WNoMousePropagation ), l(NULL)
{ {
d = new TQTabPrivate; d = new TQTabPrivate;
d->pressed = 0; d->pressed = 0;
@ -839,7 +839,10 @@ void TQTabBar::show()
int TQTabBar::currentTab() const int TQTabBar::currentTab() const
{ {
const TQTab * t = l->getLast(); const TQTab * t = 0;
if (l) {
t = l->getLast();
}
return t ? t->id : -1; return t ? t->id : -1;
} }
@ -965,10 +968,12 @@ void TQTabBar::keyPressEvent( TQKeyEvent * e )
TQTab * TQTabBar::tab( int id ) const TQTab * TQTabBar::tab( int id ) const
{ {
if (l) {
TQTab * t; TQTab * t;
for( t = l->first(); t; t = l->next() ) for( t = l->first(); t; t = l->next() )
if ( t && t->id == id ) if ( t && t->id == id )
return t; return t;
}
return 0; return 0;
} }
@ -982,7 +987,8 @@ TQTab * TQTabBar::tab( int id ) const
TQTab * TQTabBar::tabAt( int index ) const TQTab * TQTabBar::tabAt( int index ) const
{ {
TQTab * t; TQTab * t;
t = lstatic->at( index ); TQPtrList<TQTab> internalList = *lstatic;
t = internalList.at( index );
return t; return t;
} }
@ -996,8 +1002,9 @@ TQTab * TQTabBar::tabAt( int index ) const
int TQTabBar::indexOf( int id ) const int TQTabBar::indexOf( int id ) const
{ {
TQTab * t; TQTab * t;
TQPtrList<TQTab> internalList = *lstatic;
int idx = 0; int idx = 0;
for( t = lstatic->first(); t; t = lstatic->next() ) { for( t = internalList.first(); t; t = internalList.next() ) {
if ( t && t->id == id ) if ( t && t->id == id )
return idx; return idx;
idx++; idx++;
@ -1014,8 +1021,11 @@ int TQTabBar::indexOf( int id ) const
*/ */
int TQTabBar::count() const int TQTabBar::count() const
{ {
if (l) {
return l->count(); return l->count();
} }
return 0;
}
/*! /*!

Loading…
Cancel
Save