diff options
Diffstat (limited to 'src/kernel/qstyle.cpp')
-rw-r--r-- | src/kernel/qstyle.cpp | 66 |
1 files changed, 56 insertions, 10 deletions
diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp index 7799e59ed..2195382e7 100644 --- a/src/kernel/qstyle.cpp +++ b/src/kernel/qstyle.cpp @@ -403,6 +403,7 @@ TQStyle::TQStyle() m_eventHandlerInstallationHook = NULL; m_eventHandlerRemovalHook = NULL; m_widgetActionRequestHook = NULL; + m_applicationActionRequestHook = NULL; conditionalAcceleratorsEnabled = false; d = new TQStylePrivate; } @@ -526,8 +527,7 @@ void TQStyle::unPolish( TQStyleControlElementData ceData, ControlElementFlags, v \sa unPolish() */ void TQStyle::polish( TQApplication *app ) { - TQStyleControlElementData ceData; - ceData.widgetObjectTypes = getObjectTypeListForObject(app); + TQStyleControlElementData ceData = populateControlElementDataFromApplication(app, TQStyleOption()); applicationPolish(ceData, getControlElementFlagsForObject(app, ceData.widgetObjectTypes, TQStyleOption()), app); } @@ -539,8 +539,7 @@ void TQStyle::polish( TQApplication *app ) { \sa polish() */ void TQStyle::unPolish( TQApplication *app ) { - TQStyleControlElementData ceData; - ceData.widgetObjectTypes = getObjectTypeListForObject(app); + TQStyleControlElementData ceData = populateControlElementDataFromApplication(app, TQStyleOption()); applicationUnPolish(ceData, getControlElementFlagsForObject(app, ceData.widgetObjectTypes, TQStyleOption()), app); } @@ -2217,6 +2216,12 @@ bool TQStyle::widgetActionRequest( TQStyleControlElementData ceData, ControlElem else if (request == WAR_DisableMouseTracking) { widget->setMouseTracking(FALSE); } + else if (request == WAR_SetAutoMask) { + widget->setAutoMask(TRUE); + } + else if (request == WAR_UnSetAutoMask) { + widget->setAutoMask(FALSE); + } else if (request == WAR_SetCheckable) { TQPopupMenu *pm = dynamic_cast<TQPopupMenu*>(widget); if (pm) { @@ -2253,6 +2258,9 @@ bool TQStyle::widgetActionRequest( TQStyleControlElementData ceData, ControlElem else if (request == WAR_SetBackgroundMode) { widget->setBackgroundMode((TQt::BackgroundMode)requestData.metric1); } + else if (request == WAR_SetBackgroundOrigin) { + widget->setBackgroundOrigin((TQWidget::BackgroundOrigin)requestData.metric1); + } else if (request == WAR_SetFont) { widget->setFont(requestData.font); } @@ -2289,11 +2297,45 @@ bool TQStyle::widgetActionRequest( TQStyleControlElementData ceData, ControlElem 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 +/*! + \fn void TQStyle::setApplicationActionRequestHook( ApplicationActionRequestHook hook ); + + Sets a callback function \a hook which will be called whenever a new application 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::setApplicationActionRequestHook( ApplicationActionRequestHook hook ) { + m_applicationActionRequestHook = hook; +} + +/*! + \fn bool applicationActionRequestHandler( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request ); + Handles application action requests. Return FALSE to continue processing in base classes, TRUE to eat the request and halt processing. +*/ +bool TQStyle::applicationActionRequest( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request, TQStyleApplicationActionRequestData requestData ) { + bool cbret = false; + if (m_applicationActionRequestHook) { + cbret = (*m_applicationActionRequestHook)(ceData, elementFlags, source, request, requestData); + } + if (!cbret) { + if (ceData.widgetObjectTypes.contains("TQApplication")) { + TQApplication* application = reinterpret_cast<TQApplication*>(source); + if (request == AAR_SetPalette) { + application->setPalette(requestData.palette, requestData.bool1, requestData.cstr); + } + else if (request == AAR_SetFont) { + application->setFont(requestData.font, requestData.bool1, requestData.cstr); + } + return true; + } + } + return true; +} + +void TQStyle::acceleratorKeypressEventMonitor( TQObject *o, TQEvent *e ) { if (styleHint(SH_HideUnderlineAcceleratorWhenAltUp, TQStyleControlElementData(), CEF_None, TQStyleOption::Default, NULL, NULL) != 0) { TQWidget *widget = dynamic_cast<TQWidget*>(o); if (widget) { @@ -2337,12 +2379,16 @@ TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(int param1, int p metric2 = param2; } -TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQPalette param) { +TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQPalette param, bool informWidgets, const char* className) { palette = param; + bool1 = informWidgets; + cstr = className; } -TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQFont param) { +TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQFont param, bool informWidgets, const char* className) { font = param; + bool1 = informWidgets; + cstr = className; } TQStyleWidgetActionRequestData::TQStyleWidgetActionRequestData(TQRect param) { |