diff options
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/ntqstyle.h | 152 | ||||
-rw-r--r-- | src/kernel/qstyle.cpp | 391 |
2 files changed, 510 insertions, 33 deletions
diff --git a/src/kernel/ntqstyle.h b/src/kernel/ntqstyle.h index 25ffd5778..e2338fc49 100644 --- a/src/kernel/ntqstyle.h +++ b/src/kernel/ntqstyle.h @@ -177,6 +177,7 @@ class TQStyleControlElementDockWidgetData { class TQStyleControlElementGenericWidgetData { public: TQStringList widgetObjectTypes; + bool allDataPopulated; TQt::WFlags wflags; TQPixmap bgPixmap; TQBrush bgBrush; @@ -196,6 +197,7 @@ class TQStyleControlElementGenericWidgetData { class TQStyleControlElementData { public: TQStringList widgetObjectTypes; + bool allDataPopulated; TQt::WFlags wflags; TQPixmap bgPixmap; TQBrush bgBrush; @@ -239,6 +241,24 @@ class TQStyleControlElementData { TQStyleControlElementListViewData listViewData; TQStyleControlElementTabBarData tabBarData; 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 @@ -249,28 +269,6 @@ public: 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 { CEF_None = 0x00000000, CEF_IsDefault = 0x00000001, @@ -293,9 +291,68 @@ public: CEF_IsCheckable = 0x00020000, CEF_HasFocusProxy = 0x00040000, CEF_IsEditable = 0x00080000, - CEF_IsFlat = 0x00100000 + CEF_IsFlat = 0x00100000, + CEF_IsActiveWindow = 0x00200000, + CEF_IsTopLevel = 0x00400000, + CEF_IsVisible = 0x00800000, }; + // New 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 { PE_ButtonCommand, PE_ButtonDefault, @@ -967,6 +1024,9 @@ public: // when the mouse is over the button SH_ToolButton_Uses3D, + // bool - hide underlined accelerators uless Alt key is currently down + SH_HideUnderlineAcceleratorWhenAltUp, + // do not add any values below/greater than this SH_CustomBase = 0xf0000000 }; @@ -1038,7 +1098,35 @@ public: static 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 @@ -1061,6 +1149,12 @@ public: } #endif +public: + virtual bool eventFilter( TQObject *, TQEvent * ); + bool acceleratorsShown() const; + +protected: + void acceleratorKeypressEventMonitor( TQObject *, TQEvent * ); private: TQStylePrivate * d; @@ -1069,10 +1163,22 @@ private: TQStyle( const TQStyle & ); TQStyle& operator=( const TQStyle & ); #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|=(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 // TQSTYLE_H diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp index 3a3a2775c..d100d5f1e 100644 --- a/src/kernel/qstyle.cpp +++ b/src/kernel/qstyle.cpp @@ -44,6 +44,10 @@ #include "ntqpainter.h" #include "ntqbitmap.h" #include "ntqpixmapcache.h" +#include "ntqframe.h" +#include "ntqlayout.h" +#include "ntqobjectlist.h" +#include "ntqwidgetlist.h" #include <limits.h> @@ -394,6 +398,10 @@ public: */ TQStyle::TQStyle() { + m_eventHandlerInstallationHook = NULL; + m_eventHandlerRemovalHook = NULL; + m_widgetActionRequestHook = NULL; + conditionalAcceleratorsEnabled = false; d = new TQStylePrivate; } @@ -414,8 +422,6 @@ TQStyle::~TQStyle() style. Current supported values are TQt::WindowsStyle and TQt::MotifStyle. */ - - /*! Initializes the appearance of a widget. @@ -439,8 +445,9 @@ TQStyle::~TQStyle() \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() */ -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 @@ -464,8 +523,10 @@ void TQStyle::unPolish( TQWidget*) \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() */ -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 * ) { + // } /*! @@ -1958,6 +2052,283 @@ TQRect TQStyle::visualRect( const TQRect &logical, const TQRect &boundingRect ) } /*! + \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 \obsolete */ |