Automated update from Qt3

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

@ -0,0 +1,48 @@
Qt 3.5 is a new feature release. It is not backwards compatible with any
prior TQt3 version due to changes in the QStyle API.
****************************************************************************
* General *
****************************************************************************
General Improvements
--------------------
- Technical
* Modify TQStyle API to work without requiring direct access to TQt-specific objects
See "TQStyle API Change" section below
TQStyle API Change
---------------------
The following style function definitions have changed:
drawPrimitive
drawControl
drawControlMask
subRect
drawComplexControl
drawComplexControlMask
querySubControlMetrics
querySubControl
pixelMetric
sizeFromContents
styleHint
stylePixmap
visualRect
drawKStylePrimitive
polish
unPolish
The following new functions have been added:
applicationPolish
applicationUnPolish
installObjectEventHandler
removeObjectEventHandler
objectEventHandler
widgetActionRequest
Additionally, SH_UnderlineAccelerator has been extended with a new style hint, SH_HideUnderlineAcceleratorWhenAltUp
Porting an existing style to the new API is relatively straightforward; simply update the function definitions in the existing style with the new definition prototypes and cast the passed pointer to TQWidget or TQObject where appropriate.

@ -177,6 +177,7 @@ class TQStyleControlElementDockWidgetData {
class TQStyleControlElementGenericWidgetData { class TQStyleControlElementGenericWidgetData {
public: public:
TQStringList widgetObjectTypes; TQStringList widgetObjectTypes;
bool allDataPopulated;
TQt::WFlags wflags; TQt::WFlags wflags;
TQPixmap bgPixmap; TQPixmap bgPixmap;
TQBrush bgBrush; TQBrush bgBrush;
@ -196,6 +197,7 @@ class TQStyleControlElementGenericWidgetData {
class TQStyleControlElementData { class TQStyleControlElementData {
public: public:
TQStringList widgetObjectTypes; TQStringList widgetObjectTypes;
bool allDataPopulated;
TQt::WFlags wflags; TQt::WFlags wflags;
TQPixmap bgPixmap; TQPixmap bgPixmap;
TQBrush bgBrush; TQBrush bgBrush;
@ -239,6 +241,24 @@ class TQStyleControlElementData {
TQStyleControlElementListViewData listViewData; TQStyleControlElementListViewData listViewData;
TQStyleControlElementTabBarData tabBarData; TQStyleControlElementTabBarData tabBarData;
TQ_UINT32 comboBoxLineEditFlags; TQ_UINT32 comboBoxLineEditFlags;
TQ_UINT32 frameStyle;
TQRect sliderRect;
};
class TQStyleWidgetActionRequestData {
public:
TQStyleWidgetActionRequestData();
TQStyleWidgetActionRequestData(int metric1, int metric2=0);
TQStyleWidgetActionRequestData(TQPalette palette);
TQStyleWidgetActionRequestData(TQFont font);
TQStyleWidgetActionRequestData(TQRect rect);
~TQStyleWidgetActionRequestData();
public:
int metric1;
int metric2;
TQPalette palette;
TQFont font;
TQRect rect;
}; };
class Q_EXPORT TQStyle: public TQObject class Q_EXPORT TQStyle: public TQObject
@ -249,28 +269,6 @@ public:
TQStyle(); TQStyle();
virtual ~TQStyle(); virtual ~TQStyle();
// New TQStyle API - most of these should probably be pure virtual
virtual void polish( TQWidget * );
virtual void unPolish( TQWidget * );
virtual void polish( TQApplication * );
virtual void unPolish( TQApplication * );
virtual void polish( TQPalette & );
virtual void polishPopupMenu( TQPopupMenu* ) = 0;
virtual TQRect itemRect( TQPainter *p, const TQRect &r,
int flags, bool enabled,
const TQPixmap *pixmap,
const TQString &text, int len = -1 ) const;
virtual void drawItem( TQPainter *p, const TQRect &r,
int flags, const TQColorGroup &g, bool enabled,
const TQPixmap *pixmap, const TQString &text,
int len = -1, const TQColor *penColor = 0 ) const;
enum ControlElementFlags { enum ControlElementFlags {
CEF_None = 0x00000000, CEF_None = 0x00000000,
CEF_IsDefault = 0x00000001, CEF_IsDefault = 0x00000001,
@ -293,9 +291,68 @@ public:
CEF_IsCheckable = 0x00020000, CEF_IsCheckable = 0x00020000,
CEF_HasFocusProxy = 0x00040000, CEF_HasFocusProxy = 0x00040000,
CEF_IsEditable = 0x00080000, CEF_IsEditable = 0x00080000,
CEF_IsFlat = 0x00100000 CEF_IsFlat = 0x00100000,
CEF_IsActiveWindow = 0x00200000,
CEF_IsTopLevel = 0x00400000,
CEF_IsVisible = 0x00800000,
}; };
// New TQStyle API - most of these should probably be pure virtual
// Old API
// DEPRECATED
#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
__attribute__ ((deprecated))
#endif
virtual void polish( TQWidget * );
// New API
virtual void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
// Old API
// DEPRECATED
#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
__attribute__ ((deprecated))
#endif
virtual void unPolish( TQWidget * );
// New API
virtual void unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
// Old API
// DEPRECATED
#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
__attribute__ ((deprecated))
#endif
virtual void polish( TQApplication * );
// New API
virtual void applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
// Old API
// DEPRECATED
#ifdef MARK_OLD_VIRTUAL_STYLE_API_CALLS_DEPRECATED
__attribute__ ((deprecated))
#endif
virtual void unPolish( TQApplication * );
// New API
virtual void applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
virtual void polish( TQPalette & );
virtual void polishPopupMenu( TQPopupMenu* ) = 0;
virtual TQRect itemRect( TQPainter *p, const TQRect &r,
int flags, bool enabled,
const TQPixmap *pixmap,
const TQString &text, int len = -1 ) const;
virtual void drawItem( TQPainter *p, const TQRect &r,
int flags, const TQColorGroup &g, bool enabled,
const TQPixmap *pixmap, const TQString &text,
int len = -1, const TQColor *penColor = 0 ) const;
enum PrimitiveElement { enum PrimitiveElement {
PE_ButtonCommand, PE_ButtonCommand,
PE_ButtonDefault, PE_ButtonDefault,
@ -967,6 +1024,9 @@ public:
// when the mouse is over the button // when the mouse is over the button
SH_ToolButton_Uses3D, SH_ToolButton_Uses3D,
// bool - hide underlined accelerators uless Alt key is currently down
SH_HideUnderlineAcceleratorWhenAltUp,
// do not add any values below/greater than this // do not add any values below/greater than this
SH_CustomBase = 0xf0000000 SH_CustomBase = 0xf0000000
}; };
@ -1038,7 +1098,35 @@ public:
static TQRect visualRect( const TQRect &logical, const TQRect &bounding ); static TQRect visualRect( const TQRect &logical, const TQRect &bounding );
// Object event handling API
typedef TQMap<void*, TQStyle*> ObjectEventSourceToHandlerMap;
typedef TQMap<void*, TQStyleControlElementData> ObjectEventSourceDataToHandlerMap;
typedef TQMap<void*, ControlElementFlags> ObjectEventSourceFlagsToHandlerMap;
typedef bool (*EventHandlerInstallationHook)(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler);
typedef bool (*EventHandlerRemovalHook)(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler);
void installObjectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler );
void removeObjectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler );
void setEventHandlerInstallationHook( EventHandlerInstallationHook );
void setEventHandlerRemovalHook( EventHandlerRemovalHook hook );
virtual bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
enum WidgetActionRequest {
WAR_Repaint,
WAR_RepaintRect,
WAR_EnableMouseTracking,
WAR_DisableMouseTracking,
WAR_FrameSetStyle,
WAR_FrameSetLineWidth,
WAR_SetLayoutMargin,
WAR_SetPalette,
WAR_SetBackgroundMode,
WAR_SetFont,
WAR_RepaintAllAccelerators
};
typedef bool (*WidgetActionRequestHook)(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, TQStyleWidgetActionRequestData requestData);
void setWidgetActionRequestHook( WidgetActionRequestHook );
virtual bool widgetActionRequest( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, TQStyleWidgetActionRequestData requestData = TQStyleWidgetActionRequestData() );
// Old 2.x TQStyle API // Old 2.x TQStyle API
@ -1061,6 +1149,12 @@ public:
} }
#endif #endif
public:
virtual bool eventFilter( TQObject *, TQEvent * );
bool acceleratorsShown() const;
protected:
void acceleratorKeypressEventMonitor( TQObject *, TQEvent * );
private: private:
TQStylePrivate * d; TQStylePrivate * d;
@ -1069,10 +1163,22 @@ private:
TQStyle( const TQStyle & ); TQStyle( const TQStyle & );
TQStyle& operator=( const TQStyle & ); TQStyle& operator=( const TQStyle & );
#endif #endif
EventHandlerInstallationHook m_eventHandlerInstallationHook;
EventHandlerRemovalHook m_eventHandlerRemovalHook;
WidgetActionRequestHook m_widgetActionRequestHook;
ObjectEventSourceToHandlerMap m_objectEventSourceToHandlerMap;
ObjectEventSourceDataToHandlerMap m_objectEventSourceDataToHandlerMap;
ObjectEventSourceFlagsToHandlerMap m_objectEventSourceFlagsToHandlerMap;
bool conditionalAcceleratorsEnabled;
}; };
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|(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; } // 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; }
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, bool populateReliantFields=true);
Q_EXPORT TQStringList getObjectTypeListForObject(const TQObject* object);
#endif // QT_NO_STYLE #endif // QT_NO_STYLE
#endif // TQSTYLE_H #endif // TQSTYLE_H

@ -44,6 +44,10 @@
#include "ntqpainter.h" #include "ntqpainter.h"
#include "ntqbitmap.h" #include "ntqbitmap.h"
#include "ntqpixmapcache.h" #include "ntqpixmapcache.h"
#include "ntqframe.h"
#include "ntqlayout.h"
#include "ntqobjectlist.h"
#include "ntqwidgetlist.h"
#include <limits.h> #include <limits.h>
@ -394,6 +398,10 @@ public:
*/ */
TQStyle::TQStyle() TQStyle::TQStyle()
{ {
m_eventHandlerInstallationHook = NULL;
m_eventHandlerRemovalHook = NULL;
m_widgetActionRequestHook = NULL;
conditionalAcceleratorsEnabled = false;
d = new TQStylePrivate; d = new TQStylePrivate;
} }
@ -414,8 +422,6 @@ TQStyle::~TQStyle()
style. Current supported values are TQt::WindowsStyle and TQt::MotifStyle. style. Current supported values are TQt::WindowsStyle and TQt::MotifStyle.
*/ */
/*! /*!
Initializes the appearance of a widget. Initializes the appearance of a widget.
@ -439,8 +445,9 @@ TQStyle::~TQStyle()
\sa unPolish() \sa unPolish()
*/ */
void TQStyle::polish( TQWidget*) void TQStyle::polish( TQWidget *widget ) {
{ TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption());
polish(ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), widget);
} }
/*! /*!
@ -453,10 +460,62 @@ void TQStyle::polish( TQWidget*)
\sa polish() \sa polish()
*/ */
void TQStyle::unPolish( TQWidget*) void TQStyle::unPolish( TQWidget *widget ) {
{ TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption());
unPolish(ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), widget);
}
/*!
Initializes the appearance of a widget.
This function is called for every widget at some point after it
has been fully created but just \e before it is shown the very
first time.
Reasonable actions in this function might be to install a widget
event handler for the style. An example of highly unreasonable
use would be setting the geometry! With TQt 3.0's style engine
you will rarely need to write your own polish(); instead reimplement
drawItem(), drawPrimitive(), etc.
The \a objectTypes object may provide enough information to
allow class-specific customizations. But be careful not to
hard-code things too much because new TQStyle subclasses are
expected to work reasonably with all current and \e future
widgets.
You may specify either a TQWidget pointer or a custom pointer.
If a custom pointer is specified, you must be careful to intercept any event
handler installation/removal calls via setEventHandlerInstallationHook and
setEventHandlerRemovalHook.
\sa unPolish()
*/
void TQStyle::polish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr ) {
if (ceData.widgetObjectTypes.contains("TQWidget")) {
// Enable dynamic hide/show of accelerator shortcuts
TQWidget* widget = reinterpret_cast<TQWidget*>(ptr);
widget->installEventFilter(this);
}
} }
/*!
Undoes the initialization of a widget's appearance.
This function is the counterpart to polish. It is called for every
polished widget when the style is dynamically changed. The former
style has to unpolish its settings before the new style can polish
them again.
\sa polish()
*/
void TQStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags, void *ptr ) {
if (ceData.widgetObjectTypes.contains("TQWidget")) {
// Disable dynamic hide/show of accelerator shortcuts
TQWidget* widget = reinterpret_cast<TQWidget*>(ptr);
widget->installEventFilter(this);
}
}
/*! /*!
\overload \overload
@ -464,8 +523,10 @@ void TQStyle::unPolish( TQWidget*)
\sa unPolish() \sa unPolish()
*/ */
void TQStyle::polish( TQApplication*) void TQStyle::polish( TQApplication *app ) {
{ TQStyleControlElementData ceData;
ceData.widgetObjectTypes = getObjectTypeListForObject(app);
applicationPolish(ceData, getControlElementFlagsForObject(app, ceData.widgetObjectTypes, TQStyleOption()), app);
} }
/*! /*!
@ -475,8 +536,41 @@ void TQStyle::polish( TQApplication*)
\sa polish() \sa polish()
*/ */
void TQStyle::unPolish( TQApplication*) void TQStyle::unPolish( TQApplication *app ) {
{ TQStyleControlElementData ceData;
ceData.widgetObjectTypes = getObjectTypeListForObject(app);
applicationUnPolish(ceData, getControlElementFlagsForObject(app, ceData.widgetObjectTypes, TQStyleOption()), app);
}
/*!
\overload
Late initialization of the TQApplication object or other global application object.
You may specify either a TQApplication pointer or a custom pointer.
If a custom pointer is specified, you must be careful to intercept any event
handler installation/removal calls via setEventHandlerInstallationHook and
setEventHandlerRemovalHook.
\sa unPolish()
*/
void TQStyle::applicationPolish( TQStyleControlElementData, ControlElementFlags, void * ) {
//
}
/*!
\overload
Undoes the application polish.
You may specify either a TQApplication pointer or a custom pointer.
If a custom pointer is specified, you must be careful to intercept any event
handler installation/removal calls via setEventHandlerInstallationHook and
setEventHandlerRemovalHook.
\sa polish()
*/
void TQStyle::applicationUnPolish( TQStyleControlElementData, ControlElementFlags, void * ) {
//
} }
/*! /*!
@ -1957,6 +2051,283 @@ TQRect TQStyle::visualRect( const TQRect &logical, const TQRect &boundingRect )
return r; return r;
} }
/*!
\fn void TQStyle::installObjectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler );
Intercepts events generated by \a source and sends them to \a handler via
the bool TQStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ) virtual method.
\sa void TQStyle::removeObjectEventHandler( TQObject* source, TQStyle* handler )
\sa bool TQStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e )
*/
void TQStyle::installObjectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler ) {
bool cbret = false;
if (m_eventHandlerInstallationHook) {
cbret = (*m_eventHandlerInstallationHook)(ceData, elementFlags, source, handler);
}
if (!cbret) {
if (ceData.widgetObjectTypes.contains("TQObject")) {
TQObject* o = reinterpret_cast<TQObject*>(source);
o->installEventFilter(this);
m_objectEventSourceToHandlerMap[source] = handler;
m_objectEventSourceDataToHandlerMap[source] = ceData;
m_objectEventSourceFlagsToHandlerMap[source] = elementFlags;
}
}
}
/*!
\fn void TQStyle::removeObjectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler );
Stops intercepting events generated by \a source.
\sa void TQStyle::installObjectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler )
*/
void TQStyle::removeObjectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler ) {
bool cbret = false;
if (m_eventHandlerRemovalHook) {
cbret = (*m_eventHandlerRemovalHook)(ceData, elementFlags, source, handler);
}
if (!cbret) {
if (ceData.widgetObjectTypes.contains("TQObject")) {
TQObject* o = reinterpret_cast<TQObject*>(source);
m_objectEventSourceToHandlerMap.remove(source);
m_objectEventSourceDataToHandlerMap.remove(source);
m_objectEventSourceFlagsToHandlerMap.remove(source);
o->removeEventFilter(this);
}
}
}
/*!
\fn void TQStyle::setEventHandlerInstallationHook( EventHandlerInstallationHook hook );
Sets a callback function \a hook which will be called whenever a new intercept request
is made via the TQStyle::installObjectEventHandler method. The callback function must
use this definition: bool callbackFunction( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler ).
\sa void TQStyle::installObjectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler )
*/
void TQStyle::setEventHandlerInstallationHook( EventHandlerInstallationHook hook ) {
m_eventHandlerInstallationHook = hook;
}
/*!
\fn void TQStyle::setEventHandlerRemovalHook( EventHandlerRemovalHook hook );
Sets a callback function \a hook which will be called whenever a new intercept deactivation request
is made via the TQStyle::removeObjectEventHandler method. The callback function must
use this definition: bool callbackFunction( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler ).
\sa void TQStyle::removeObjectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler )
*/
void TQStyle::setEventHandlerRemovalHook( EventHandlerRemovalHook hook ) {
m_eventHandlerRemovalHook = hook;
}
/*!
\fn bool TQStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
Override this virtual function to intercept events requested by a previous call to
TQStyle::installObjectEventHandler.
\sa void TQStyle::installObjectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler )
\sa void TQStyle::removeObjectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler )
*/
bool TQStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ) {
Q_UNUSED(ceData);
Q_UNUSED(elementFlags);
Q_UNUSED(source);
Q_UNUSED(e);
return false;
}
/*!
\fn bool TQStyle::eventFilter(TQObject *o, TQEvent *e);
\internal
*/
bool TQStyle::eventFilter(TQObject *o, TQEvent *e) {
acceleratorKeypressEventMonitor(o, e);
if (m_objectEventSourceToHandlerMap.contains(o)) {
TQStyle* handler = m_objectEventSourceToHandlerMap[o];
TQStyleControlElementData ceData = m_objectEventSourceDataToHandlerMap[o];
ControlElementFlags elementFlags = m_objectEventSourceFlagsToHandlerMap[o];
bool ret = handler->objectEventHandler(ceData, elementFlags, o, e);
if (ret) {
return ret;
}
else {
return TQObject::eventFilter(o, e);
}
}
else {
return TQObject::eventFilter(o, e);
}
}
/*!
\fn void TQStyle::setWidgetActionRequestHook( WidgetActionRequestHook hook );
Sets a callback function \a hook which will be called whenever a new widget action request
is made via the TQStyle::installObjectEventHandler method. The callback function must
use this definition: bool callbackFunction( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler ).
\sa void TQStyle::installObjectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQStyle* handler )
*/
void TQStyle::setWidgetActionRequestHook( WidgetActionRequestHook hook ) {
m_widgetActionRequestHook = hook;
}
/*!
\fn bool widgetActionRequestHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request );
Handles widget action requests. Return FALSE to continue processing in base classes, TRUE to eat the request and halt processing.
*/
bool TQStyle::widgetActionRequest( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, TQStyleWidgetActionRequestData requestData ) {
bool cbret = false;
if (m_widgetActionRequestHook) {
cbret = (*m_widgetActionRequestHook)(ceData, elementFlags, source, request, requestData);
}
if (!cbret) {
if (ceData.widgetObjectTypes.contains("TQWidget")) {
TQWidget* widget = reinterpret_cast<TQWidget*>(source);
if (request == WAR_Repaint) {
widget->repaint(FALSE);
}
else if (request == WAR_RepaintRect) {
widget->repaint(requestData.rect, FALSE);
}
else if (request == WAR_EnableMouseTracking) {
widget->setMouseTracking(TRUE);
}
else if (request == WAR_DisableMouseTracking) {
widget->setMouseTracking(FALSE);
}
else if (request == WAR_FrameSetStyle) {
TQFrame* frame = dynamic_cast<TQFrame*>(widget);
if (frame) {
frame->setFrameStyle(requestData.metric1);
}
}
else if (request == WAR_FrameSetLineWidth) {
TQFrame* frame = dynamic_cast<TQFrame*>(widget);
if (frame) {
frame->setLineWidth(requestData.metric1);
}
}
else if (request == WAR_SetLayoutMargin) {
TQLayout* layout = widget->layout();
if (layout) {
layout->setMargin(requestData.metric1);
}
}
else if (request == WAR_SetPalette) {
widget->setPalette(requestData.palette);
}
else if (request == WAR_SetBackgroundMode) {
widget->setBackgroundMode((TQt::BackgroundMode)requestData.metric1);
}
else if (request == WAR_SetFont) {
widget->setFont(requestData.font);
}
else if (request == WAR_RepaintAllAccelerators) {
TQWidgetList *list = TQApplication::topLevelWidgets();
TQWidgetListIt it( *list );
TQWidget * widget;
while ((widget=it.current()) != 0) {
++it;
TQObjectList *l = widget->queryList("TQWidget");
TQObjectListIt it2( *l );
TQWidget *w;
while ( (w = (TQWidget*)it2.current()) != 0 ) {
++it2;
if (w->isTopLevel() || !w->isVisible() || w->style().styleHint(SH_UnderlineAccelerator, TQStyleControlElementData(), CEF_None, w)) {
l->removeRef(w);
}
}
// Repaint all relevant widgets
it2.toFirst();
while ( (w = (TQWidget*)it2.current()) != 0 ) {
++it2;
w->repaint(FALSE);
}
delete l;
}
delete list;
}
return true;
}
}
return true;
}
void TQStyle::acceleratorKeypressEventMonitor( TQObject *o, TQEvent *e ) {
// RAJA FIXME
// Also, SH_HideUnderlineAcceleratorWhenAltUp should probably be set to 1 in the TQWindowsStyle::styleHint overridden method
// Additionally, the common styleHint code in TDE (that controls popupmenu settings and such via configuration files) needs to be modified to add a config option for this new style hint
if (styleHint(SH_HideUnderlineAcceleratorWhenAltUp, TQStyleControlElementData(), CEF_None, TQStyleOption::Default, NULL, NULL) != 0) {
TQWidget *widget = dynamic_cast<TQWidget*>(o);
if (widget) {
switch(e->type()) {
case TQEvent::KeyPress:
if (((TQKeyEvent*)e)->key() == Key_Alt) {
conditionalAcceleratorsEnabled = true;
widgetActionRequest(TQStyleControlElementData(), CEF_None, o, WAR_RepaintAllAccelerators);
}
break;
case TQEvent::KeyRelease:
if (((TQKeyEvent*)e)->key() == Key_Alt) {
conditionalAcceleratorsEnabled = false;
widgetActionRequest(TQStyleControlElementData(), CEF_None, o, WAR_RepaintAllAccelerators);
}
break;
default:
break;
}
}
}
else {
conditionalAcceleratorsEnabled = false;
}
}
bool TQStyle::acceleratorsShown() const {
if (styleHint(SH_HideUnderlineAcceleratorWhenAltUp, TQStyleControlElementData(), CEF_None, TQStyleOption::Default, NULL, NULL) != 0) {
return conditionalAcceleratorsEnabled;
}
else {
return true;
}
}
TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData() {
//
}
TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(int param1, int param2) {
metric1 = param1;
metric2 = param2;
}
TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQPalette param) {
palette = param;
}
TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQFont param) {
font = param;
}
TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQRect param) {
rect = param;
}
TQStyleWidgetActionRequestData::~TQStyleWidgetActionRequestData() {
//
}
/*! /*!
\fn int TQStyle::defaultFrameWidth() const \fn int TQStyle::defaultFrameWidth() const
\obsolete \obsolete

@ -38,6 +38,11 @@
** **
**********************************************************************/ **********************************************************************/
// RAJA FIXME
// QMotifPlusStyle
// QSGIStyle
// QWindowsStyle
#ifndef TQCOMMONSTYLE_H #ifndef TQCOMMONSTYLE_H
#define TQCOMMONSTYLE_H #define TQCOMMONSTYLE_H
@ -241,7 +246,6 @@ public:
const TQStyleOption& = TQStyleOption::Default, const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const; const TQWidget *widget = 0 ) const;
private: private:
// Disabled copy constructor and operator= // Disabled copy constructor and operator=
#if defined(TQ_DISABLE_COPY) #if defined(TQ_DISABLE_COPY)
@ -250,9 +254,6 @@ 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
#endif // TQCOMMONSTYLE_H #endif // TQCOMMONSTYLE_H

@ -63,11 +63,11 @@ public:
virtual ~TQMotifPlusStyle(); virtual ~TQMotifPlusStyle();
void polish(TQPalette &pal); void polish(TQPalette &pal);
void polish(TQWidget *widget); void polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void unPolish(TQWidget*widget); void unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void polish(TQApplication *app); void applicationPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void unPolish(TQApplication *app); void applicationUnPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void drawPrimitive( PrimitiveElement pe, void drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
@ -118,8 +118,7 @@ public:
int styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default, int styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption & = TQStyleOption::Default,
TQStyleHintReturn* = 0, const TQWidget * = 0) const; TQStyleHintReturn* = 0, const TQWidget * = 0) const;
protected: bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
bool eventFilter(TQObject *, TQEvent *);
private: private:

@ -67,8 +67,8 @@ public:
bool useHighlightColors() const; bool useHighlightColors() const;
void polish( TQPalette& ); void polish( TQPalette& );
void polish( TQWidget* ); void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void polish( TQApplication* ); void applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void polishPopupMenu( TQPopupMenu* ); void polishPopupMenu( TQPopupMenu* );

@ -67,10 +67,10 @@ public:
#if !defined(Q_NO_USING_KEYWORD) #if !defined(Q_NO_USING_KEYWORD)
using TQMotifStyle::polish; using TQMotifStyle::polish;
#endif #endif
void polish( TQWidget* ); void polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void unPolish( TQWidget* ); void unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void polish( TQApplication* ); void applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void unPolish( TQApplication* ); void applicationUnPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * );
void drawPrimitive( PrimitiveElement pe, void drawPrimitive( PrimitiveElement pe,
TQPainter *p, TQPainter *p,
@ -124,8 +124,7 @@ public:
const TQStyleOption& = TQStyleOption::Default, const TQStyleOption& = TQStyleOption::Default,
const TQWidget *widget = 0 ) const; const TQWidget *widget = 0 ) const;
protected: bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
bool eventFilter( TQObject*, TQEvent*);
private: private:
TQSGIStylePrivate *d; TQSGIStylePrivate *d;

@ -61,11 +61,11 @@ public:
TQWindowsStyle(); TQWindowsStyle();
~TQWindowsStyle(); ~TQWindowsStyle();
void polish(TQApplication*); void applicationPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void unPolish(TQApplication*); void applicationUnPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void polish(TQWidget*); void polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void unPolish(TQWidget*); void unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *);
void polish( TQPalette & ); void polish( TQPalette & );
@ -130,6 +130,7 @@ public:
TQRect subRect( SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const; TQRect subRect( SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const;
bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
private: private:
class Private; class Private;

@ -156,7 +156,7 @@ TQStringList getObjectTypeListForObject(const TQObject* object) {
return objectTypes; return objectTypes;
} }
TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* object, TQStringList objectTypeList, const TQStyleOption& opt) { TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* object, TQStringList objectTypeList, const TQStyleOption& opt, bool populateReliantFields) {
TQStyle::ControlElementFlags cef = (TQStyle::ControlElementFlags)0; TQStyle::ControlElementFlags cef = (TQStyle::ControlElementFlags)0;
if (object) { if (object) {
@ -226,6 +226,11 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
if (widget->parentWidget()) cef = cef | TQStyle::CEF_HasParentWidget; if (widget->parentWidget()) cef = cef | TQStyle::CEF_HasParentWidget;
if (widget->focusProxy()) cef = cef | TQStyle::CEF_HasFocusProxy; if (widget->focusProxy()) cef = cef | TQStyle::CEF_HasFocusProxy;
if (widget->hasFocus()) cef = cef | TQStyle::CEF_HasFocus; if (widget->hasFocus()) cef = cef | TQStyle::CEF_HasFocus;
if (populateReliantFields) {
if (widget->isActiveWindow()) cef = cef | TQStyle::CEF_IsActiveWindow;
if (widget->isTopLevel()) cef = cef | TQStyle::CEF_IsTopLevel;
if (widget->isVisible()) cef = cef | TQStyle::CEF_IsVisible;
}
} }
} }
else { else {
@ -240,6 +245,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
if (widget) { if (widget) {
ceData.widgetObjectTypes = getObjectTypeListForObject(widget); ceData.widgetObjectTypes = getObjectTypeListForObject(widget);
ceData.allDataPopulated = populateReliantFields;
const TQPixmap* erasePixmap = widget->backgroundPixmap(); const TQPixmap* erasePixmap = widget->backgroundPixmap();
if (erasePixmap) { if (erasePixmap) {
ceData.bgPixmap = *erasePixmap; ceData.bgPixmap = *erasePixmap;
@ -373,8 +379,11 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.maxSteps = sb->maxValue(); ceData.maxSteps = sb->maxValue();
ceData.currentStep = sb->value(); ceData.currentStep = sb->value();
ceData.startStep = sb->sliderStart(); ceData.startStep = sb->sliderStart();
ceData.lineStep = sb->lineStep();
ceData.pageStep = sb->pageStep(); ceData.pageStep = sb->pageStep();
if (populateReliantFields) {
ceData.sliderRect = sb->sliderRect();
}
} }
} }
if (ceData.widgetObjectTypes.contains("TQSlider")) { if (ceData.widgetObjectTypes.contains("TQSlider")) {
@ -387,6 +396,9 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.startStep = sl->sliderStart(); ceData.startStep = sl->sliderStart();
ceData.lineStep = sl->lineStep(); ceData.lineStep = sl->lineStep();
ceData.pageStep = sl->pageStep(); ceData.pageStep = sl->pageStep();
if (populateReliantFields) {
ceData.sliderRect = sl->sliderRect();
}
} }
} }
if (ceData.widgetObjectTypes.contains("TQDialogButtons")) { if (ceData.widgetObjectTypes.contains("TQDialogButtons")) {
@ -434,6 +446,7 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
TQWidget* viewport = lv->viewport(); TQWidget* viewport = lv->viewport();
if (viewport) { if (viewport) {
ceData.viewportData.widgetObjectTypes = getObjectTypeListForObject(viewport); ceData.viewportData.widgetObjectTypes = getObjectTypeListForObject(viewport);
ceData.viewportData.allDataPopulated = populateReliantFields;
const TQPixmap* erasePixmap = viewport->backgroundPixmap(); const TQPixmap* erasePixmap = viewport->backgroundPixmap();
if (erasePixmap) { if (erasePixmap) {
ceData.viewportData.bgPixmap = *erasePixmap; ceData.viewportData.bgPixmap = *erasePixmap;
@ -470,10 +483,17 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
} }
} }
} }
if (ceData.widgetObjectTypes.contains("TQFrame")) {
const TQFrame *frame = dynamic_cast<const TQFrame*>(widget);
if (frame) {
ceData.frameStyle = frame->frameStyle();
}
}
const TQWidget* parentWidget = widget->parentWidget(); const TQWidget* parentWidget = widget->parentWidget();
if (parentWidget) { if (parentWidget) {
ceData.parentWidgetData.widgetObjectTypes = getObjectTypeListForObject(parentWidget); ceData.parentWidgetData.widgetObjectTypes = getObjectTypeListForObject(parentWidget);
ceData.parentWidgetData.allDataPopulated = populateReliantFields;
const TQPixmap* erasePixmap = parentWidget->backgroundPixmap(); const TQPixmap* erasePixmap = parentWidget->backgroundPixmap();
if (erasePixmap) { if (erasePixmap) {
ceData.parentWidgetData.bgPixmap = *erasePixmap; ceData.parentWidgetData.bgPixmap = *erasePixmap;
@ -1111,7 +1131,7 @@ void TQCommonStyle::drawControl( ControlElement element,
} }
int tf=AlignVCenter | ShowPrefix; int tf=AlignVCenter | ShowPrefix;
if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown())))
tf |= NoAccel; tf |= NoAccel;
#ifndef QT_NO_ICONSET #ifndef QT_NO_ICONSET
@ -1164,7 +1184,7 @@ void TQCommonStyle::drawControl( ControlElement element,
{ {
#ifndef QT_NO_CHECKBOX #ifndef QT_NO_CHECKBOX
int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft;
if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown())))
alignment |= NoAccel; alignment |= NoAccel;
drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg,
@ -1186,7 +1206,7 @@ void TQCommonStyle::drawControl( ControlElement element,
{ {
#ifndef QT_NO_RADIOBUTTON #ifndef QT_NO_RADIOBUTTON
int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft; int alignment = TQApplication::reverseLayout() ? AlignRight : AlignLeft;
if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown())))
alignment |= NoAccel; alignment |= NoAccel;
drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg, drawItem(p, r, alignment | AlignVCenter | ShowPrefix, cg,
flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text); flags & Style_Enabled, (ceData.fgPixmap.isNull())?NULL:&ceData.fgPixmap, ceData.text);
@ -1253,7 +1273,7 @@ void TQCommonStyle::drawControl( ControlElement element,
pixelMetric( TQStyle::PM_DefaultFrameWidth, ceData, elementFlags, widget ) ); pixelMetric( TQStyle::PM_DefaultFrameWidth, ceData, elementFlags, widget ) );
int alignment = AlignCenter | ShowPrefix; int alignment = AlignCenter | ShowPrefix;
if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown())))
alignment |= NoAccel; alignment |= NoAccel;
drawItem( p, tr, alignment, cg, drawItem( p, tr, alignment, cg,
flags & Style_Enabled, 0, t->text() ); flags & Style_Enabled, 0, t->text() );
@ -1386,7 +1406,7 @@ void TQCommonStyle::drawControl( ControlElement element,
TQMenuItem *mi = opt.menuItem(); TQMenuItem *mi = opt.menuItem();
int alignment = AlignCenter|ShowPrefix|DontClip|SingleLine; int alignment = AlignCenter|ShowPrefix|DontClip|SingleLine;
if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown())))
alignment |= NoAccel; alignment |= NoAccel;
drawItem( p, r, alignment, cg, drawItem( p, r, alignment, cg,
flags & Style_Enabled, mi->pixmap(), mi->text(), -1, flags & Style_Enabled, mi->pixmap(), mi->text(), -1,
@ -1428,7 +1448,7 @@ void TQCommonStyle::drawControl( ControlElement element,
! ceData.text.isNull() && ! ceData.text.isNull() &&
! (elementFlags & CEF_UsesTextLabel)) { ! (elementFlags & CEF_UsesTextLabel)) {
int alignment = AlignCenter | ShowPrefix; int alignment = AlignCenter | ShowPrefix;
if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown())))
alignment |= NoAccel; alignment |= NoAccel;
rect.moveBy(shiftX, shiftY); rect.moveBy(shiftX, shiftY);
@ -1455,7 +1475,7 @@ void TQCommonStyle::drawControl( ControlElement element,
p->setFont( ceData.font ); p->setFont( ceData.font );
TQRect pr = rect, tr = rect; TQRect pr = rect, tr = rect;
int alignment = ShowPrefix; int alignment = ShowPrefix;
if (!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown())))
alignment |= NoAccel; alignment |= NoAccel;
if ( ceData.toolButtonTextPosition == TQToolButton::Under ) { if ( ceData.toolButtonTextPosition == TQToolButton::Under ) {
@ -2379,7 +2399,7 @@ TQRect TQCommonStyle::querySubControlMetrics( ComplexControl control,
} }
#endif #endif
TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption()); TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption(), false);
return querySubControlMetrics(control, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), sc, opt, widget); return querySubControlMetrics(control, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), sc, opt, widget);
} }
@ -3126,7 +3146,7 @@ TQSize TQCommonStyle::sizeFromContents(ContentsType contents,
int TQCommonStyle::styleHint(StyleHint sh, const TQWidget * w, const TQStyleOption &so, TQStyleHintReturn *shr) const int TQCommonStyle::styleHint(StyleHint sh, const TQWidget * w, const TQStyleOption &so, TQStyleHintReturn *shr) const
{ {
TQStyleControlElementData ceData = populateControlElementDataFromWidget(w, TQStyleOption(), false); TQStyleControlElementData ceData = populateControlElementDataFromWidget(w, TQStyleOption(), false);
return styleHint(sh, ceData, getControlElementFlagsForObject(w, ceData.widgetObjectTypes, TQStyleOption()), so, shr, w); return styleHint(sh, ceData, getControlElementFlagsForObject(w, ceData.widgetObjectTypes, TQStyleOption(), false), so, shr, w);
} }
/*! \reimp */ /*! \reimp */
@ -3200,6 +3220,10 @@ int TQCommonStyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, Con
ret = 1; ret = 1;
break; break;
case SH_HideUnderlineAcceleratorWhenAltUp:
ret = 0;
break;
default: default:
ret = 0; ret = 0;
break; break;
@ -3221,5 +3245,4 @@ TQPixmap TQCommonStyle::stylePixmap(StylePixmap, TQStyleControlElementData, Cont
return TQPixmap(); return TQPixmap();
} }
#endif // QT_NO_STYLE #endif // QT_NO_STYLE

@ -69,7 +69,9 @@ struct TQMotifPlusStylePrivate
scrollbarElement(0), lastElement(0), ref(1) scrollbarElement(0), lastElement(0), ref(1)
{ ; } { ; }
TQGuardedPtr<TQWidget> hoverWidget; void* hoverWidget;
TQStyleControlElementData hoverWidgetData;
TQStyle::ControlElementFlags hoverWidgetFlags;
bool hovering, sliderActive, mousePressed; bool hovering, sliderActive, mousePressed;
int scrollbarElement, lastElement, ref; int scrollbarElement, lastElement, ref;
TQPoint mousePos; TQPoint mousePos;
@ -176,52 +178,58 @@ void TQMotifPlusStyle::polish(TQPalette &)
/*! \reimp */ /*! \reimp */
void TQMotifPlusStyle::polish(TQWidget *widget) void TQMotifPlusStyle::polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{ {
if (ceData.widgetObjectTypes.contains("TQWidget")) {
#ifndef QT_NO_FRAME #ifndef QT_NO_FRAME
if (::tqt_cast<TQFrame*>(widget) && ((TQFrame *) widget)->frameStyle() == TQFrame::Panel) if ((ceData.widgetObjectTypes.contains("TQFrame")) && (ceData.frameStyle == TQFrame::Panel)) {
((TQFrame *) widget)->setFrameStyle(TQFrame::WinPanel); widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetStyle, TQStyleWidgetActionRequestData(TQFrame::WinPanel));
}
#endif #endif
#ifndef QT_NO_MENUBAR #ifndef QT_NO_MENUBAR
if (::tqt_cast<TQMenuBar*>(widget) && ((TQMenuBar *) widget)->frameStyle() != TQFrame::NoFrame) if ((ceData.widgetObjectTypes.contains("TQMenuBar")) && (ceData.frameStyle != TQFrame::NoFrame)) {
((TQMenuBar *) widget)->setFrameStyle(TQFrame::StyledPanel | TQFrame::Raised); widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetStyle, TQStyleWidgetActionRequestData(TQFrame::StyledPanel | TQFrame::Raised));
}
#endif #endif
#ifndef QT_NO_TOOLBAR #ifndef QT_NO_TOOLBAR
if (::tqt_cast<TQToolBar*>(widget)) if (ceData.widgetObjectTypes.contains("TQToolBar")) {
widget->layout()->setMargin(2); widgetActionRequest(ceData, elementFlags, ptr, WAR_SetLayoutMargin, TQStyleWidgetActionRequestData(2));
}
#endif #endif
}
if (useHoveringHighlight) { if (useHoveringHighlight) {
if (::tqt_cast<TQButton*>(widget) || ::tqt_cast<TQComboBox*>(widget)) if ((ceData.widgetObjectTypes.contains("TQButton")) || (ceData.widgetObjectTypes.contains("TQComboBox"))) {
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
}
if (::tqt_cast<TQScrollBar*>(widget) || ::tqt_cast<TQSlider*>(widget)) { if ((ceData.widgetObjectTypes.contains("TQScrollBar")) || (ceData.widgetObjectTypes.contains("TQSlider"))) {
widget->setMouseTracking(TRUE); widgetActionRequest(ceData, elementFlags, ptr, WAR_EnableMouseTracking);
widget->installEventFilter(this); installObjectEventHandler(ceData, elementFlags, ptr, this);
} }
} }
TQMotifStyle::polish(widget); TQMotifStyle::polish(ceData, elementFlags, ptr);
} }
/*! \reimp */ /*! \reimp */
void TQMotifPlusStyle::unPolish(TQWidget *widget) void TQMotifPlusStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{ {
widget->removeEventFilter(this); removeObjectEventHandler(ceData, elementFlags, ptr, this);
TQMotifStyle::unPolish(widget); TQMotifStyle::unPolish(ceData, elementFlags, ptr);
} }
/*! \reimp */ /*! \reimp */
void TQMotifPlusStyle::polish(TQApplication *) void TQMotifPlusStyle::applicationPolish(TQStyleControlElementData, ControlElementFlags, void *)
{ {
} }
/*! \reimp */ /*! \reimp */
void TQMotifPlusStyle::unPolish(TQApplication *) void TQMotifPlusStyle::applicationUnPolish(TQStyleControlElementData, ControlElementFlags, void *)
{ {
} }
@ -1477,14 +1485,14 @@ TQRect TQMotifPlusStyle::querySubControlMetrics(ComplexControl control,
/*! \reimp */ /*! \reimp */
bool TQMotifPlusStyle::eventFilter(TQObject *object, TQEvent *event) bool TQMotifPlusStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *event )
{ {
switch(event->type()) { switch(event->type()) {
case TQEvent::MouseButtonPress: case TQEvent::MouseButtonPress:
{ {
singleton->mousePressed = TRUE; singleton->mousePressed = TRUE;
if (!::tqt_cast<TQSlider*>(object)) if (!ceData.widgetObjectTypes.contains("TQSlider"))
break; break;
singleton->sliderActive = TRUE; singleton->sliderActive = TRUE;
@ -1495,50 +1503,52 @@ bool TQMotifPlusStyle::eventFilter(TQObject *object, TQEvent *event)
{ {
singleton->mousePressed = FALSE; singleton->mousePressed = FALSE;
if (!::tqt_cast<TQSlider*>(object)) if (!ceData.widgetObjectTypes.contains("TQSlider"))
break; break;
singleton->sliderActive = FALSE; singleton->sliderActive = FALSE;
((TQWidget *) object)->repaint(FALSE); widgetActionRequest(ceData, elementFlags, source, WAR_Repaint);
break; break;
} }
case TQEvent::Enter: case TQEvent::Enter:
{ {
if (! object->isWidgetType()) if (!ceData.widgetObjectTypes.contains("TQWidget"))
break; break;
singleton->hoverWidget = (TQWidget *) object; singleton->hoverWidget = source;
if (! singleton->hoverWidget->isEnabled()) { singleton->hoverWidgetData = ceData;
singleton->hoverWidgetFlags = elementFlags;
if (!(singleton->hoverWidgetFlags & CEF_IsEnabled)) {
singleton->hoverWidget = 0; singleton->hoverWidget = 0;
break; break;
} }
singleton->hoverWidget->repaint(FALSE); widgetActionRequest(singleton->hoverWidgetData, singleton->hoverWidgetFlags, singleton->hoverWidget, WAR_Repaint);
break; break;
} }
case TQEvent::Leave: case TQEvent::Leave:
{ {
if (object != singleton->hoverWidget) if (source != singleton->hoverWidget)
break; break;
TQWidget *w = singleton->hoverWidget; void *w = singleton->hoverWidget;
singleton->hoverWidget = 0; singleton->hoverWidget = 0;
w->repaint(FALSE); widgetActionRequest(singleton->hoverWidgetData, singleton->hoverWidgetFlags, w, WAR_Repaint);
break; break;
} }
case TQEvent::MouseMove: case TQEvent::MouseMove:
{ {
if (! object->isWidgetType() || object != singleton->hoverWidget) if ((!ceData.widgetObjectTypes.contains("TQWidget")) || source != singleton->hoverWidget)
break; break;
if (!::tqt_cast<TQScrollBar*>(object) && ! ::tqt_cast<TQSlider*>(object)) if ((!ceData.widgetObjectTypes.contains("TQScrollBar")) && (!ceData.widgetObjectTypes.contains("TQSlider")))
break; break;
singleton->mousePos = ((TQMouseEvent *) event)->pos(); singleton->mousePos = ((TQMouseEvent *) event)->pos();
if (! singleton->mousePressed) { if (! singleton->mousePressed) {
singleton->hovering = TRUE; singleton->hovering = TRUE;
singleton->hoverWidget->repaint(FALSE); widgetActionRequest(singleton->hoverWidgetData, singleton->hoverWidgetFlags, singleton->hoverWidget, WAR_Repaint);
singleton->hovering = FALSE; singleton->hovering = FALSE;
} }
@ -1549,7 +1559,7 @@ bool TQMotifPlusStyle::eventFilter(TQObject *object, TQEvent *event)
break; break;
} }
return TQMotifStyle::eventFilter(object, event); return TQMotifStyle::objectEventHandler(ceData, elementFlags, source, event);
} }

@ -171,9 +171,9 @@ void TQMotifStyle::polish( TQPalette& pal )
\internal \internal
Keep TQStyle::polish() visible. Keep TQStyle::polish() visible.
*/ */
void TQMotifStyle::polish( TQWidget* w ) void TQMotifStyle::polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{ {
TQStyle::polish(w); TQStyle::polish(ceData, elementFlags, ptr);
} }
/*! /*!
@ -181,9 +181,9 @@ void TQMotifStyle::polish( TQWidget* w )
\internal \internal
Keep TQStyle::polish() visible. Keep TQStyle::polish() visible.
*/ */
void TQMotifStyle::polish( TQApplication* a ) void TQMotifStyle::applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{ {
TQStyle::polish(a); TQStyle::applicationPolish(ceData, elementFlags, ptr);
} }
static void rot(TQPointArray& a, int n) static void rot(TQPointArray& a, int n)

@ -65,7 +65,7 @@ struct SliderLastPosition
{ {
SliderLastPosition() : rect(0,-1,0,-1), slider(0) {} SliderLastPosition() : rect(0,-1,0,-1), slider(0) {}
TQRect rect; TQRect rect;
const TQSlider* slider; const void* slider;
}; };
#endif #endif
@ -74,7 +74,7 @@ struct ScrollbarLastPosition
{ {
ScrollbarLastPosition() : rect( 0,-1, 0,-1 ), scrollbar(0) {} ScrollbarLastPosition() : rect( 0,-1, 0,-1 ), scrollbar(0) {}
TQRect rect; TQRect rect;
const TQScrollBar *scrollbar; const void* scrollbar;
}; };
#endif #endif
@ -86,7 +86,7 @@ public:
{ {
} }
const TQWidget *hotWidget; const void* hotWidget;
TQPoint mousePos; TQPoint mousePos;
#ifndef QT_NO_SCROLLBAR #ifndef QT_NO_SCROLLBAR
ScrollbarLastPosition lastScrollbarRect; ScrollbarLastPosition lastScrollbarRect;
@ -136,10 +136,10 @@ TQSGIStyle::~TQSGIStyle()
bold italic font for menu options. bold italic font for menu options.
*/ */
void void
TQSGIStyle::polish( TQApplication* app) TQSGIStyle::applicationPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{ {
isApplicationStyle = 1; isApplicationStyle = 1;
TQMotifStyle::polish( app ); TQMotifStyle::polish( ceData, elementFlags, ptr );
TQPalette pal = TQApplication::palette(); TQPalette pal = TQApplication::palette();
// check this on SGI-Boxes // check this on SGI-Boxes
@ -181,7 +181,7 @@ TQSGIStyle::polish( TQApplication* app)
/*! \reimp /*! \reimp
*/ */
void void
TQSGIStyle::unPolish( TQApplication* /* app */ ) TQSGIStyle::applicationUnPolish( TQStyleControlElementData, ControlElementFlags, void * )
{ {
TQFont f = TQApplication::font(); TQFont f = TQApplication::font();
TQApplication::setFont( f, TRUE ); // get rid of the special fonts for special widget classes TQApplication::setFont( f, TRUE ); // get rid of the special fonts for special widget classes
@ -194,9 +194,9 @@ TQSGIStyle::unPolish( TQApplication* /* app */ )
hovering. hovering.
*/ */
void void
TQSGIStyle::polish( TQWidget* w ) TQSGIStyle::polish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{ {
TQMotifStyle::polish(w); TQMotifStyle::polish(ceData, elementFlags, ptr);
if ( !isApplicationStyle ) { if ( !isApplicationStyle ) {
TQPalette sgiPal = TQApplication::palette(); TQPalette sgiPal = TQApplication::palette();
@ -214,7 +214,7 @@ TQSGIStyle::polish( TQWidget* w )
sgiPal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, sgiPal.disabled().base() ); sgiPal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, sgiPal.disabled().base() );
} }
if ( ::tqt_cast<TQLineEdit*>(w) || ::tqt_cast<TQTextEdit*>(w) ) { if ( (ceData.widgetObjectTypes.contains("TQLineEdit")) || (ceData.widgetObjectTypes.contains("TQTextEdit")) ) {
// different basecolor and highlighting in Q(Multi)LineEdit // different basecolor and highlighting in Q(Multi)LineEdit
sgiPal.setColor( TQColorGroup::Base, TQColor(211,181,181) ); sgiPal.setColor( TQColorGroup::Base, TQColor(211,181,181) );
sgiPal.setColor( TQPalette::Active, TQColorGroup::Highlight, sgiPal.active().midlight() ); sgiPal.setColor( TQPalette::Active, TQColorGroup::Highlight, sgiPal.active().midlight() );
@ -224,89 +224,89 @@ TQSGIStyle::polish( TQWidget* w )
sgiPal.setColor( TQPalette::Disabled, TQColorGroup::Highlight, sgiPal.disabled().midlight() ); sgiPal.setColor( TQPalette::Disabled, TQColorGroup::Highlight, sgiPal.disabled().midlight() );
sgiPal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, sgiPal.disabled().text() ); sgiPal.setColor( TQPalette::Disabled, TQColorGroup::HighlightedText, sgiPal.disabled().text() );
} else if ( ::tqt_cast<TQMenuBar*>(w) || ::tqt_cast<TQToolBar*>(w) ) { } else if ( (ceData.widgetObjectTypes.contains("TQMenuBar")) || (ceData.widgetObjectTypes.contains("TQToolBar")) ) {
sgiPal.setColor( TQColorGroup::Button, sgiPal.active().midlight() ); sgiPal.setColor( TQColorGroup::Button, sgiPal.active().midlight() );
} }
w->setPalette( sgiPal ); widgetActionRequest(ceData, elementFlags, ptr, WAR_SetPalette, TQStyleWidgetActionRequestData(sgiPal));
} }
if ( ::tqt_cast<TQButton*>(w) || ::tqt_cast<TQSlider*>(w) || ::tqt_cast<TQScrollBar*>(w) ) { if ( (ceData.widgetObjectTypes.contains("TQButton")) || (ceData.widgetObjectTypes.contains("TQSlider")) || (ceData.widgetObjectTypes.contains("TQScrollBar")) ) {
w->installEventFilter( this ); installObjectEventHandler(ceData, elementFlags, ptr, this);
w->setMouseTracking( TRUE ); widgetActionRequest(ceData, elementFlags, ptr, WAR_EnableMouseTracking);
#ifndef QT_NO_SCROLLBAR #ifndef QT_NO_SCROLLBAR
if ( ::tqt_cast<TQScrollBar*>(w) ) if ( ceData.widgetObjectTypes.contains("TQScrollBar") ) {
w->setBackgroundMode( TQWidget::NoBackground ); widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::NoBackground));
}
#endif #endif
} else if ( ::tqt_cast<TQComboBox*>(w) ) { } else if ( ceData.widgetObjectTypes.contains("TQComboBox") ) {
TQFont f = TQApplication::font(); TQFont f = TQApplication::font();
f.setBold( TRUE ); f.setBold( TRUE );
f.setItalic( TRUE ); f.setItalic( TRUE );
w->setFont( f ); widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(f));
#ifndef QT_NO_MENUBAR #ifndef QT_NO_MENUBAR
} else if ( ::tqt_cast<TQMenuBar*>(w) ) { } else if ( ceData.widgetObjectTypes.contains("TQMenuBar") ) {
((TQFrame*) w)->setFrameStyle(TQFrame::StyledPanel | TQFrame::Raised); widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetStyle, TQStyleWidgetActionRequestData(TQFrame::StyledPanel | TQFrame::Raised));
w->setBackgroundMode( TQWidget::PaletteBackground ); widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::PaletteBackground));
TQFont f = TQApplication::font(); TQFont f = TQApplication::font();
f.setBold( TRUE ); f.setBold( TRUE );
f.setItalic( TRUE ); f.setItalic( TRUE );
w->setFont( f ); widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(f));
#endif #endif
#ifndef QT_NO_POPUPMENU #ifndef QT_NO_POPUPMENU
} else if ( ::tqt_cast<TQPopupMenu*>(w) ) { } else if ( ceData.widgetObjectTypes.contains("TQPopupMenu") ) {
((TQFrame*) w)->setLineWidth( pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None ) + 1 ); TQStyleWidgetActionRequestData requestData;
widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetLineWidth, TQStyleWidgetActionRequestData(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 );
w->setFont( f ); widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(f));
#endif #endif
} else if ( ::tqt_cast<TQToolBar*>(w) || w->inherits("TQToolBarSeparator") ) { } else if ( (ceData.widgetObjectTypes.contains("TQToolBar")) || (ceData.widgetObjectTypes.contains("TQToolBarSeparator")) ) {
w->setBackgroundMode( TQWidget::PaletteBackground ); widgetActionRequest(ceData, elementFlags, ptr, WAR_SetBackgroundMode, TQStyleWidgetActionRequestData(TQWidget::PaletteBackground));
} }
} }
/*! \reimp */ /*! \reimp */
void void
TQSGIStyle::unPolish( TQWidget* w ) TQSGIStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr )
{ {
if ( ::tqt_cast<TQButton*>(w) || ::tqt_cast<TQSlider*>(w) || ::tqt_cast<TQScrollBar*>(w) ) { if ( (ceData.widgetObjectTypes.contains("TQButton")) || (ceData.widgetObjectTypes.contains("TQSlider")) || (ceData.widgetObjectTypes.contains("TQScrollBar")) ) {
w->removeEventFilter( this ); removeObjectEventHandler(ceData, elementFlags, ptr, this);
#ifndef QT_NO_POPUPMENU #ifndef QT_NO_POPUPMENU
} else if ( ::tqt_cast<TQPopupMenu*>(w) ) { } else if ( ceData.widgetObjectTypes.contains("TQPopupMenu") ) {
((TQFrame*)w)->setLineWidth( pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None ) ); widgetActionRequest(ceData, elementFlags, ptr, WAR_FrameSetLineWidth, TQStyleWidgetActionRequestData(pixelMetric( PM_DefaultFrameWidth, TQStyleControlElementData(), CEF_None )));
w->setFont( TQApplication::font() ); widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(TQApplication::font()));
#endif #endif
#if !defined(QT_NO_MENUBAR) || !defined(QT_NO_COMBOBOX) #if !defined(QT_NO_MENUBAR) || !defined(QT_NO_COMBOBOX)
} else if ( ::tqt_cast<TQMenuBar*>(w) || ::tqt_cast<TQComboBox*>(w) ) { } else if ( (ceData.widgetObjectTypes.contains("TQMenuBar")) || (ceData.widgetObjectTypes.contains("TQComboBox")) ) {
w->setFont( TQApplication::font() ); widgetActionRequest(ceData, elementFlags, ptr, WAR_SetFont, TQStyleWidgetActionRequestData(TQApplication::font()));
#endif #endif
} }
} }
/*! \reimp */ /*! \reimp */
bool TQSGIStyle::eventFilter( TQObject* o, TQEvent* e ) bool TQSGIStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e )
{ {
if ( !o->isWidgetType() || e->type() == TQEvent::Paint ) if ( (!(ceData.widgetObjectTypes.contains("TQWidget"))) || (e->type() == TQEvent::Paint) )
return TQMotifStyle::eventFilter( o, e ); return TQMotifStyle::objectEventHandler( ceData, elementFlags, source, e );
TQWidget *widget = (TQWidget*)o;
switch ( e->type() ) { switch ( e->type() ) {
case TQEvent::MouseButtonPress: case TQEvent::MouseButtonPress:
{ {
#ifndef QT_NO_SCROLLBAR #ifndef QT_NO_SCROLLBAR
if ( ::tqt_cast<TQScrollBar*>(widget) ) { if (ceData.widgetObjectTypes.contains("TQScrollBar")) {
d->lastScrollbarRect.rect = ((TQScrollBar*)widget)->sliderRect(); d->lastScrollbarRect.rect = ceData.sliderRect;
d->lastScrollbarRect.scrollbar = ((TQScrollBar*)widget); d->lastScrollbarRect.scrollbar = source;
widget->repaint( FALSE ); widgetActionRequest(ceData, elementFlags, source, WAR_Repaint);
} else } else
#endif #endif
{ {
#ifndef QT_NO_SLIDER #ifndef QT_NO_SLIDER
if ( ::tqt_cast<TQSlider*>(widget) ) { if (ceData.widgetObjectTypes.contains("TQSlider")) {
d->lastSliderRect.rect = ((TQSlider*)widget)->sliderRect(); d->lastSliderRect.rect = ceData.sliderRect;
d->lastSliderRect.slider = ((TQSlider*)widget); d->lastSliderRect.slider = source;
widget->repaint( FALSE ); widgetActionRequest(ceData, elementFlags, source, WAR_Repaint);
} }
#endif #endif
} }
@ -317,52 +317,52 @@ bool TQSGIStyle::eventFilter( TQObject* o, TQEvent* e )
{ {
if ( 0 ) { if ( 0 ) {
#ifndef QT_NO_SCROLLBAR #ifndef QT_NO_SCROLLBAR
} else if ( ::tqt_cast<TQScrollBar*>(widget) ) { } else if (ceData.widgetObjectTypes.contains("TQScrollBar")) {
TQRect oldRect = d->lastScrollbarRect.rect; TQRect oldRect = d->lastScrollbarRect.rect;
d->lastScrollbarRect.rect = TQRect( 0, -1, 0, -1 ); d->lastScrollbarRect.rect = TQRect( 0, -1, 0, -1 );
widget->repaint( oldRect, FALSE ); widgetActionRequest(ceData, elementFlags, source, WAR_RepaintRect, TQStyleWidgetActionRequestData(oldRect));
#endif #endif
#ifndef QT_NO_SLIDER #ifndef QT_NO_SLIDER
} else if ( ::tqt_cast<TQSlider*>(widget) ) { } else if (ceData.widgetObjectTypes.contains("TQSlider")) {
TQRect oldRect = d->lastSliderRect.rect; TQRect oldRect = d->lastSliderRect.rect;
d->lastSliderRect.rect = TQRect( 0, -1, 0, -1 ); d->lastSliderRect.rect = TQRect( 0, -1, 0, -1 );
widget->repaint( oldRect, FALSE ); widgetActionRequest(ceData, elementFlags, source, WAR_RepaintRect, TQStyleWidgetActionRequestData(oldRect));
#endif #endif
} }
} }
break; break;
case TQEvent::MouseMove: case TQEvent::MouseMove:
if ( !widget->isActiveWindow() ) if ( !(elementFlags & CEF_IsActiveWindow) )
break; break;
if ( ((TQMouseEvent*)e)->button() ) if ( ((TQMouseEvent*)e)->button() )
break; break;
d->hotWidget = widget; d->hotWidget = source;
d->mousePos = ((TQMouseEvent*)e)->pos(); d->mousePos = ((TQMouseEvent*)e)->pos();
widget->repaint( FALSE ); widgetActionRequest(ceData, elementFlags, source, WAR_Repaint);
break; break;
case TQEvent::Enter: case TQEvent::Enter:
if ( !widget->isActiveWindow() ) if ( !(elementFlags & CEF_IsActiveWindow) )
break; break;
d->hotWidget = widget; d->hotWidget = source;
widget->repaint( FALSE ); widgetActionRequest(ceData, elementFlags, source, WAR_Repaint);
break; break;
case TQEvent::Leave: case TQEvent::Leave:
if ( !widget->isActiveWindow() ) if ( !(elementFlags & CEF_IsActiveWindow) )
break; break;
if ( widget == d->hotWidget) { if ( source == d->hotWidget) {
d->hotWidget = 0; d->hotWidget = 0;
widget->repaint( FALSE ); widgetActionRequest(ceData, elementFlags, source, WAR_Repaint);
} }
break; break;
default: default:
break; break;
} }
return TQMotifStyle::eventFilter( o, e ); return TQMotifStyle::objectEventHandler( ceData, elementFlags, source, e );
} }
static const int sgiItemFrame = 2; // menu item frame width static const int sgiItemFrame = 2; // menu item frame width

@ -95,99 +95,42 @@ class TQWindowsStyle::Private : public TQObject
public: public:
Private(TQWindowsStyle *parent); Private(TQWindowsStyle *parent);
bool hasSeenAlt(const TQWidget *widget) const; bool objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e );
bool altDown() const { return alt_down; }
protected:
bool eventFilter(TQObject *o, TQEvent *e);
private: private:
TQPtrList<TQWidget> seenAlt;
bool alt_down;
int menuBarTimer; int menuBarTimer;
}; };
TQWindowsStyle::Private::Private(TQWindowsStyle *parent) TQWindowsStyle::Private::Private(TQWindowsStyle *parent)
: TQObject(parent, "TQWindowsStylePrivate"), alt_down(FALSE), menuBarTimer(0) : TQObject(parent, "TQWindowsStylePrivate"), menuBarTimer(0)
{ {
} }
// Returns true if the toplevel parent of \a widget has seen the Alt-key
bool TQWindowsStyle::Private::hasSeenAlt(const TQWidget *widget) const
{
widget = widget->topLevelWidget();
return seenAlt.contains(widget);
}
// Records Alt- and Focus events // Records Alt- and Focus events
bool TQWindowsStyle::Private::eventFilter(TQObject *o, TQEvent *e) bool TQWindowsStyle::Private::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags, void* source, TQEvent *e )
{ {
if (!o->isWidgetType()) if (!(ceData.widgetObjectTypes.contains("TQWidget"))) {
return TQObject::eventFilter(o, e); return TRUE;
}
TQWidget *widget = ::tqt_cast<TQWidget*>(o); TQWidget *widget = reinterpret_cast<TQWidget*>(source);
switch(e->type()) { switch(e->type()) {
case TQEvent::KeyPress:
if (((TQKeyEvent*)e)->key() == Key_Alt) {
widget = widget->topLevelWidget();
// Alt has been pressed - find all widgets that care
TQObjectList *l = widget->queryList("TQWidget");
TQObjectListIt it( *l );
TQWidget *w;
while ( (w = (TQWidget*)it.current()) != 0 ) {
++it;
if (w->isTopLevel() || !w->isVisible() ||
w->style().styleHint(SH_UnderlineAccelerator, TQStyleControlElementData(), CEF_None, w))
l->removeRef(w);
}
// Update states before repainting
seenAlt.append(widget);
alt_down = TRUE;
// Repaint all relevant widgets
it.toFirst();
while ( (w = (TQWidget*)it.current()) != 0 ) {
++it;
w->repaint(FALSE);
}
delete l;
}
break;
case TQEvent::KeyRelease:
if (((TQKeyEvent*)e)->key() == Key_Alt) {
widget = widget->topLevelWidget();
// Update state
alt_down = FALSE;
// Repaint only menubars
TQObjectList *l = widget->queryList("TQMenuBar");
TQObjectListIt it( *l );
TQMenuBar *menuBar;
while ( (menuBar = (TQMenuBar*)it.current()) != 0) {
++it;
menuBar->repaint(FALSE);
}
}
break;
case TQEvent::FocusIn: case TQEvent::FocusIn:
case TQEvent::FocusOut: case TQEvent::FocusOut:
{ {
// Menubars toggle based on focus // Menubars toggle based on focus
TQMenuBar *menuBar = ::tqt_cast<TQMenuBar*>(o); TQMenuBar *menuBar = ::tqt_cast<TQMenuBar*>(widget);
if (menuBar && !menuBarTimer) // delayed repaint to avoid flicker if (menuBar && !menuBarTimer) // delayed repaint to avoid flicker
menuBarTimer = menuBar->startTimer(0); menuBarTimer = menuBar->startTimer(0);
} }
break; break;
case TQEvent::Close: case TQEvent::Close:
// Reset widget when closing // Reset widget when closing
seenAlt.removeRef(widget);
seenAlt.removeRef(widget->topLevelWidget());
break; break;
case TQEvent::Timer: case TQEvent::Timer:
{ {
TQMenuBar *menuBar = ::tqt_cast<TQMenuBar*>(o); TQMenuBar *menuBar = ::tqt_cast<TQMenuBar*>(widget);
TQTimerEvent *te = (TQTimerEvent*)e; TQTimerEvent *te = (TQTimerEvent*)e;
if (menuBar && te->timerId() == menuBarTimer) { if (menuBar && te->timerId() == menuBarTimer) {
menuBar->killTimer(te->timerId()); menuBar->killTimer(te->timerId());
@ -201,7 +144,7 @@ bool TQWindowsStyle::Private::eventFilter(TQObject *o, TQEvent *e)
break; break;
} }
return TQObject::eventFilter(o, e); return TRUE;
} }
/*! /*!
@ -230,32 +173,40 @@ TQWindowsStyle::~TQWindowsStyle()
} }
/*! \reimp */ /*! \reimp */
void TQWindowsStyle::polish(TQApplication *app) bool TQWindowsStyle::objectEventHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, TQEvent *e ) {
if (d) {
return d->objectEventHandler(ceData, elementFlags, source, e);
}
return TRUE;
}
/*! \reimp */
void TQWindowsStyle::applicationPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{ {
// We only need the overhead when shortcuts are sometimes hidden // We only need the overhead when shortcuts are sometimes hidden
if (!styleHint(SH_UnderlineAccelerator, TQStyleControlElementData(), CEF_None, 0)) { if (styleHint(SH_UnderlineAccelerator, TQStyleControlElementData(), CEF_None, 0) && styleHint(SH_HideUnderlineAcceleratorWhenAltUp, TQStyleControlElementData(), CEF_None, 0)) {
d = new Private(this); d = new Private(this);
app->installEventFilter(d); installObjectEventHandler(ceData, elementFlags, ptr, this);
} }
} }
/*! \reimp */ /*! \reimp */
void TQWindowsStyle::unPolish(TQApplication *) void TQWindowsStyle::applicationUnPolish(TQStyleControlElementData, ControlElementFlags, void *)
{ {
delete d; delete d;
d = 0; d = 0;
} }
/*! \reimp */ /*! \reimp */
void TQWindowsStyle::polish(TQWidget *widget) void TQWindowsStyle::polish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{ {
TQCommonStyle::polish(widget); TQCommonStyle::polish(ceData, elementFlags, ptr);
} }
/*! \reimp */ /*! \reimp */
void TQWindowsStyle::unPolish(TQWidget *widget) void TQWindowsStyle::unPolish(TQStyleControlElementData ceData, ControlElementFlags elementFlags, void *ptr)
{ {
TQCommonStyle::polish(widget); TQCommonStyle::polish(ceData, elementFlags, ptr);
} }
/*! \reimp */ /*! \reimp */
@ -946,8 +897,9 @@ 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, ceData, elementFlags, TQStyleOption::Default, 0, widget)) if ((!styleHint(SH_UnderlineAccelerator, ceData, elementFlags, TQStyleOption::Default, 0, widget)) || ((styleHint(SH_HideUnderlineAcceleratorWhenAltUp, ceData, elementFlags, TQStyleOption::Default, 0, widget)) && (!acceleratorsShown()))) {
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
int xp = x + w - tab - windowsItemHMargin - windowsItemFrame + 1; int xp = x + w - tab - windowsItemHMargin - windowsItemFrame + 1;

@ -43,11 +43,11 @@
#define TQT_REAL_TQT 1 #define TQT_REAL_TQT 1
#define TQT_VERSION_STR "3.4.0" #define TQT_VERSION_STR "3.5.0"
/* /*
TQT_VERSION is (major << 16) + (minor << 8) + patch. TQT_VERSION is (major << 16) + (minor << 8) + patch.
*/ */
#define TQT_VERSION 0x030400 #define TQT_VERSION 0x030500
/* /*
The operating system, must be one of: (Q_OS_x) The operating system, must be one of: (Q_OS_x)

@ -364,8 +364,9 @@ void TQGroupBox::paintEvent( TQPaintEvent *event )
if(va & AlignTop) if(va & AlignTop)
r.moveBy(0, fm.descent()); r.moveBy(0, fm.descent());
TQColor pen( (TQRgb) style().styleHint(TQStyle::SH_GroupBox_TextLabelColor, this ) ); TQColor pen( (TQRgb) style().styleHint(TQStyle::SH_GroupBox_TextLabelColor, this ) );
if (!style().styleHint(TQStyle::SH_UnderlineAccelerator, this)) if ((!style().styleHint(TQStyle::SH_UnderlineAccelerator, this)) || ((style().styleHint(TQStyle::SH_HideUnderlineAcceleratorWhenAltUp, this)) && (!style().acceleratorsShown()))) {
va |= NoAccel; va |= NoAccel;
}
style().drawItem( &paint, r, ShowPrefix | AlignHCenter | va, colorGroup(), style().drawItem( &paint, r, ShowPrefix | AlignHCenter | va, colorGroup(),
isEnabled(), 0, str, -1, ownPalette() ? 0 : &pen ); isEnabled(), 0, str, -1, ownPalette() ? 0 : &pen );
paint.setClipRegion( event->region().subtract( r ) ); // clip everything but title paint.setClipRegion( event->region().subtract( r ) ); // clip everything but title

@ -838,8 +838,9 @@ void TQLabel::drawContents( TQPainter *p )
} }
#endif #endif
int alignment = align; int alignment = align;
if ((align & ShowPrefix) && !style().styleHint(TQStyle::SH_UnderlineAccelerator, this)) if ((align & ShowPrefix) && ((!style().styleHint(TQStyle::SH_UnderlineAccelerator, this)) || ((style().styleHint(TQStyle::SH_HideUnderlineAcceleratorWhenAltUp, this)) && (!style().acceleratorsShown())))) {
alignment |= NoAccel; alignment |= NoAccel;
}
// ordinary text or pixmap label // ordinary text or pixmap label
style().drawItem( p, cr, alignment, colorGroup(), isEnabled(), style().drawItem( p, cr, alignment, colorGroup(), isEnabled(),
pix, ltext ); pix, ltext );

@ -240,8 +240,9 @@ void TQToolBoxButton::drawButton( TQPainter *p )
fill = &cg.color( TQPalette::foregroundRoleFromMode( tb->backgroundMode() ) ); fill = &cg.color( TQPalette::foregroundRoleFromMode( tb->backgroundMode() ) );
int alignment = AlignLeft | AlignVCenter | ShowPrefix; int alignment = AlignLeft | AlignVCenter | ShowPrefix;
if (!style().styleHint(TQStyle::SH_UnderlineAccelerator, this)) if ((!style().styleHint(TQStyle::SH_UnderlineAccelerator, this)) || ((style().styleHint(TQStyle::SH_HideUnderlineAcceleratorWhenAltUp, this)) && (!style().acceleratorsShown()))) {
alignment |= NoAccel; alignment |= NoAccel;
}
style().drawItem( p, tr, alignment, cg, style().drawItem( p, tr, alignment, cg,
isEnabled(), 0, txt, -1, fill ); isEnabled(), 0, txt, -1, fill );

Loading…
Cancel
Save