diff options
Diffstat (limited to 'src/kernel/ntqstyle.h')
-rw-r--r-- | src/kernel/ntqstyle.h | 152 |
1 files changed, 129 insertions, 23 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 |