diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-08-08 17:42:40 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-08-08 17:42:40 -0500 |
commit | b6053b1b40b51e3d9b1b679a8a1751e5472e06e2 (patch) | |
tree | a327afc6092b7c368e80e6b79dccbfd80a1567b3 /src/kernel | |
parent | 43db215f601fd50f1fd8b502fae30c75c1bdee4a (diff) | |
download | tqt3-b6053b1b40b51e3d9b1b679a8a1751e5472e06e2.tar.gz tqt3-b6053b1b40b51e3d9b1b679a8a1751e5472e06e2.zip |
Automated update from Qt3
Diffstat (limited to 'src/kernel')
-rw-r--r-- | src/kernel/ntqstyle.h | 72 | ||||
-rw-r--r-- | src/kernel/qapplication_x11.cpp | 6 | ||||
-rw-r--r-- | src/kernel/qeventloop_unix.cpp | 6 | ||||
-rw-r--r-- | src/kernel/qprocess_unix.cpp | 8 | ||||
-rw-r--r-- | src/kernel/qstyle.cpp | 192 |
5 files changed, 249 insertions, 35 deletions
diff --git a/src/kernel/ntqstyle.h b/src/kernel/ntqstyle.h index c77ab6e47..20c1b6fd4 100644 --- a/src/kernel/ntqstyle.h +++ b/src/kernel/ntqstyle.h @@ -63,26 +63,26 @@ class TQStyleOption { public: enum StyleOptionDefault { Default }; - TQStyleOption(StyleOptionDefault=Default) : def(TRUE), tb(NULL) {} + TQStyleOption(StyleOptionDefault=Default) : def(TRUE), tb(NULL), cli(NULL) {} // Note: we don't use default arguments since that is unnecessary // initialization. TQStyleOption(int in1) : - def(FALSE), tb(NULL), i1(in1) {} + def(FALSE), tb(NULL), i1(in1), cli(NULL) {} TQStyleOption(int in1, int in2) : - def(FALSE), tb(NULL), i1(in1), i2(in2) {} + def(FALSE), tb(NULL), i1(in1), i2(in2), cli(NULL) {} TQStyleOption(int in1, int in2, int in3, int in4) : - def(FALSE), tb(NULL), i1(in1), i2(in2), i3(in3), i4(in4) {} - TQStyleOption(TQMenuItem* m) : def(FALSE), mi(m), tb(NULL) {} - TQStyleOption(TQMenuItem* m, int in1) : def(FALSE), mi(m), tb(NULL), i1(in1) {} - TQStyleOption(TQMenuItem* m, int in1, int in2) : def(FALSE), mi(m), tb(NULL), i1(in1), i2(in2) {} - TQStyleOption(const TQColor& c) : def(FALSE), tb(NULL), cl(&c) {} - TQStyleOption(TQTab* t) : def(FALSE), tb(t) {} - TQStyleOption(TQListViewItem* i) : def(FALSE), tb(NULL), li(i) {} + def(FALSE), tb(NULL), i1(in1), i2(in2), i3(in3), i4(in4), cli(NULL) {} + TQStyleOption(TQMenuItem* m) : def(FALSE), mi(m), tb(NULL), cli(NULL) {} + TQStyleOption(TQMenuItem* m, int in1) : def(FALSE), mi(m), tb(NULL), i1(in1), cli(NULL) {} + TQStyleOption(TQMenuItem* m, int in1, int in2) : def(FALSE), mi(m), tb(NULL), i1(in1), i2(in2), cli(NULL) {} + TQStyleOption(const TQColor& c) : def(FALSE), tb(NULL), cl(&c), cli(NULL) {} + TQStyleOption(TQTab* t) : def(FALSE), tb(t), cli(NULL) {} + TQStyleOption(TQListViewItem* i) : def(FALSE), tb(NULL), li(i), cli(NULL) {} TQStyleOption(TQCheckListItem* i) : def(FALSE), tb(NULL), cli(i) {} - TQStyleOption(TQt::ArrowType a) : def(FALSE), tb(NULL), i1((int)a) {} - TQStyleOption(const TQRect& r) : def(FALSE), tb(NULL), i1(r.x()), i2(r.y()), i3(r.width()),i4(r.height()){} - TQStyleOption(TQWidget *w) : def(FALSE), tb(NULL), p1((void*)w) {} + TQStyleOption(TQt::ArrowType a) : def(FALSE), tb(NULL), i1((int)a), cli(NULL) {} + TQStyleOption(const TQRect& r) : def(FALSE), tb(NULL), i1(r.x()), i2(r.y()), i3(r.width()), i4(r.height()), cli(NULL) {} + TQStyleOption(TQWidget *w) : def(FALSE), tb(NULL), cli(NULL), p1((void*)w) {} bool isDefault() const { return def; } @@ -134,6 +134,14 @@ class TQStyleControlElementPopupMenuData { // }; +class TQStyleControlElementCheckListItemData { + public: + bool dataValid; + bool enabled; + bool hasParent; + int height; +}; + class TQStyleControlElementTabBarData { public: int tabCount; @@ -176,6 +184,7 @@ class TQStyleControlElementGenericWidgetData { TQStringList widgetObjectTypes; bool allDataPopulated; TQt::WFlags wflags; + TQt::WindowState windowState; TQPixmap bgPixmap; TQBrush bgBrush; TQColor bgColor; @@ -196,6 +205,7 @@ class TQStyleControlElementData { TQStringList widgetObjectTypes; bool allDataPopulated; TQt::WFlags wflags; + TQt::WindowState windowState; TQPixmap bgPixmap; TQBrush bgBrush; TQColor bgColor; @@ -237,12 +247,13 @@ class TQStyleControlElementData { TQStyleControlElementGenericWidgetData viewportData; TQStyleControlElementListViewData listViewData; TQStyleControlElementTabBarData tabBarData; + TQStyleControlElementCheckListItemData checkListItemData; TQ_UINT32 comboBoxLineEditFlags; TQ_UINT32 frameStyle; TQRect sliderRect; }; -class TQStyleWidgetActionRequestData { +class Q_EXPORT TQStyleWidgetActionRequestData { public: TQStyleWidgetActionRequestData(); TQStyleWidgetActionRequestData(int metric1, int metric2=0); @@ -326,7 +337,12 @@ public: virtual void polish( TQPalette & ); - virtual void polishPopupMenu( TQPopupMenu* ) = 0; + // Old API + // DEPRECATED + virtual void polishPopupMenu( TQPopupMenu* ); + + // New API + virtual void polishPopupMenu( TQStyleControlElementData ceData, ControlElementFlags elementFlags, void * ) = 0; virtual TQRect itemRect( TQPainter *p, const TQRect &r, int flags, bool enabled, @@ -445,7 +461,7 @@ public: const TQRect &r, const TQColorGroup &cg, SFlags flags = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const = 0; + const TQStyleOption& = TQStyleOption::Default ) const; // New API virtual void drawPrimitive( PrimitiveElement pe, @@ -500,7 +516,7 @@ public: const TQRect &r, const TQColorGroup &cg, SFlags how = Style_Default, - const TQStyleOption& = TQStyleOption::Default ) const = 0; + const TQStyleOption& = TQStyleOption::Default ) const; // New API virtual void drawControl( ControlElement element, @@ -519,7 +535,7 @@ public: TQPainter *p, const TQWidget *widget, const TQRect &r, - const TQStyleOption& = TQStyleOption::Default ) const = 0; + const TQStyleOption& = TQStyleOption::Default ) const; // New API virtual void drawControlMask( ControlElement element, @@ -572,7 +588,7 @@ public: // Old API // DEPRECATED - virtual TQRect subRect( SubRect r, const TQWidget *widget ) const = 0; + virtual TQRect subRect( SubRect r, const TQWidget *widget ) const; // New API virtual TQRect subRect( SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget ) const = 0; @@ -653,7 +669,7 @@ public: SCFlags sub = (uint)SC_All, #endif SCFlags subActive = SC_None, - const TQStyleOption& = TQStyleOption::Default ) const = 0; + const TQStyleOption& = TQStyleOption::Default ) const; virtual void drawComplexControl( ComplexControl control, TQPainter *p, @@ -677,7 +693,7 @@ public: TQPainter *p, const TQWidget *widget, const TQRect &r, - const TQStyleOption& = TQStyleOption::Default ) const = 0; + const TQStyleOption& = TQStyleOption::Default ) const; // New API virtual void drawComplexControlMask( ComplexControl control, @@ -693,7 +709,7 @@ public: virtual TQRect querySubControlMetrics( ComplexControl control, const TQWidget *widget, SubControl sc, - const TQStyleOption& = TQStyleOption::Default ) const = 0; + const TQStyleOption& = TQStyleOption::Default ) const; // New API virtual TQRect querySubControlMetrics( ComplexControl control, @@ -708,7 +724,7 @@ public: virtual SubControl querySubControl( ComplexControl control, const TQWidget *widget, const TQPoint &pos, - const TQStyleOption& = TQStyleOption::Default ) const = 0; + const TQStyleOption& = TQStyleOption::Default ) const; // New API virtual SubControl querySubControl( ComplexControl control, @@ -790,7 +806,7 @@ public: // Old API // DEPRECATED virtual int pixelMetric( PixelMetric metric, - const TQWidget *widget = 0 ) const = 0; + const TQWidget *widget = 0 ) const; // New API virtual int pixelMetric( PixelMetric metric, @@ -828,7 +844,7 @@ public: virtual TQSize sizeFromContents( ContentsType contents, const TQWidget *widget, const TQSize &contentsSize, - const TQStyleOption& = TQStyleOption::Default ) const = 0; + const TQStyleOption& = TQStyleOption::Default ) const; virtual TQSize sizeFromContents( ContentsType contents, TQStyleControlElementData ceData, @@ -992,7 +1008,7 @@ public: const TQWidget *widget = 0, const TQStyleOption& = TQStyleOption::Default, TQStyleHintReturn* returnData = 0 - ) const = 0; + ) const; // New API virtual int styleHint( StyleHint stylehint, @@ -1025,7 +1041,7 @@ public: // DEPRECATED virtual TQPixmap stylePixmap( StylePixmap stylepixmap, const TQWidget *widget = 0, - const TQStyleOption& = TQStyleOption::Default ) const = 0; + const TQStyleOption& = TQStyleOption::Default ) const; virtual TQPixmap stylePixmap( StylePixmap stylepixmap, TQStyleControlElementData ceData, @@ -1061,6 +1077,8 @@ public: WAR_RepaintRect, WAR_EnableMouseTracking, WAR_DisableMouseTracking, + WAR_SetCheckable, + WAR_UnSetCheckable, WAR_FrameSetStyle, WAR_FrameSetLineWidth, WAR_SetLayoutMargin, diff --git a/src/kernel/qapplication_x11.cpp b/src/kernel/qapplication_x11.cpp index 03e7a7794..aba4fcd50 100644 --- a/src/kernel/qapplication_x11.cpp +++ b/src/kernel/qapplication_x11.cpp @@ -4445,7 +4445,9 @@ bool TQETWidget::translateXinputEvent( const XEvent *ev ) TQPair<int, int> tId; XEvent xinputMotionEvent; XEvent mouseMotionEvent; +#if defined (Q_OS_IRIX) XDevice *dev; +#endif const XDeviceMotionEvent *motion = 0; XDeviceButtonEvent *button = 0; TQEvent::Type t; @@ -4501,18 +4503,14 @@ bool TQETWidget::translateXinputEvent( const XEvent *ev ) #else if ( ev->type == xinput_motion ) { if ( motion->deviceid == devStylus->device_id ) { - dev = devStylus; deviceType = TQTabletEvent::Stylus; } else if ( motion->deviceid == devEraser->device_id ) { - dev = devEraser; deviceType = TQTabletEvent::Eraser; } } else { if ( button->deviceid == devStylus->device_id ) { - dev = devStylus; deviceType = TQTabletEvent::Stylus; } else if ( button->deviceid == devEraser->device_id ) { - dev = devEraser; deviceType = TQTabletEvent::Eraser; } } diff --git a/src/kernel/qeventloop_unix.cpp b/src/kernel/qeventloop_unix.cpp index 1441b78c5..aa13ef8b6 100644 --- a/src/kernel/qeventloop_unix.cpp +++ b/src/kernel/qeventloop_unix.cpp @@ -505,7 +505,11 @@ void TQEventLoop::wakeUp() size_t nbytes = 0; char c = 0; if ( ::ioctl( d->thread_pipe[0], FIONREAD, (char*)&nbytes ) >= 0 && nbytes == 0 ) { - ::write( d->thread_pipe[1], &c, 1 ); + if (::write( d->thread_pipe[1], &c, 1 ) < 0) { +#if defined(QT_CHECK_RANGE) + tqWarning( "TQEventLoop: Internal error (failed thread pipe write)" ); +#endif + } } } diff --git a/src/kernel/qprocess_unix.cpp b/src/kernel/qprocess_unix.cpp index ff68a8860..01eb202df 100644 --- a/src/kernel/qprocess_unix.cpp +++ b/src/kernel/qprocess_unix.cpp @@ -813,7 +813,9 @@ bool TQProcess::start( TQStringList *env ) ::dup2( STDOUT_FILENO, STDERR_FILENO ); } #ifndef QT_NO_DIR - ::chdir( workingDir.absPath().latin1() ); + if (::chdir( workingDir.absPath().latin1() ) < 0) { + tqWarning( "Could not chdir" ); + } #endif if ( fd[0] ) ::close( fd[0] ); @@ -890,7 +892,9 @@ bool TQProcess::start( TQStringList *env ) } if ( fd[1] ) { char buf = 0; - ::write( fd[1], &buf, 1 ); + if (::write( fd[1], &buf, 1 ) < 0) { + tqWarning( "Could not write to file descriptor" ); + } ::close( fd[1] ); } ::_exit( -1 ); diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp index 26fbf0cb8..7799e59ed 100644 --- a/src/kernel/qstyle.cpp +++ b/src/kernel/qstyle.cpp @@ -46,6 +46,8 @@ #include "ntqpixmapcache.h" #include "ntqframe.h" #include "ntqlayout.h" +#include "ntqlistview.h" +#include "ntqpopupmenu.h" #include "ntqobjectlist.h" #include "ntqwidgetlist.h" @@ -592,7 +594,18 @@ void TQStyle::polish( TQPalette&) (\l{TQPopupMenu::setMouseTracking()}) and whether the menu is checkable by default (\l{TQPopupMenu::setCheckable()}). */ -void TQStyle::polishPopupMenu( TQPopupMenu *) +void TQStyle::polishPopupMenu( TQPopupMenu *pm ) { + TQStyleControlElementData ceData = populateControlElementDataFromWidget(pm, TQStyleOption()); + unPolish(ceData, getControlElementFlagsForObject(pm, ceData.widgetObjectTypes, TQStyleOption()), pm); +} + +/*! + Polishes the popup menu according to the GUI style. This usually + means setting the mouse tracking + (\l{TQPopupMenu::setMouseTracking()}) and whether the menu is + checkable by default (\l{TQPopupMenu::setCheckable()}). +*/ +void TQStyle::polishPopupMenu( TQStyleControlElementData, ControlElementFlags, void * ) { } @@ -2204,6 +2217,18 @@ bool TQStyle::widgetActionRequest( TQStyleControlElementData ceData, ControlElem else if (request == WAR_DisableMouseTracking) { widget->setMouseTracking(FALSE); } + else if (request == WAR_SetCheckable) { + TQPopupMenu *pm = dynamic_cast<TQPopupMenu*>(widget); + if (pm) { + pm->setCheckable(TRUE); + } + } + else if (request == WAR_UnSetCheckable) { + TQPopupMenu *pm = dynamic_cast<TQPopupMenu*>(widget); + if (pm) { + pm->setCheckable(FALSE); + } + } else if (request == WAR_FrameSetStyle) { TQFrame* frame = dynamic_cast<TQFrame*>(widget); if (frame) { @@ -2265,6 +2290,10 @@ bool TQStyle::widgetActionRequest( TQStyleControlElementData ceData, ControlElem } 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) { @@ -2324,6 +2353,167 @@ TQStyleWidgetActionRequestData::~TQStyleWidgetActionRequestData() { // } +// ============================================================================================ +// Interface methods +// ============================================================================================ + +void TQStyle::drawPrimitive( PrimitiveElement pe, + TQPainter *p, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt ) const +{ + const TQWidget* widget = 0; + + // Determine if the request needs widget information and set widget appropriately + // FIXME + if ((pe == PE_CheckListController) || (pe == PE_CheckListExclusiveIndicator) || (pe == PE_CheckListIndicator)) { + TQCheckListItem *item = opt.checkListItem(); + if (item) { + TQListView *lv = item->listView(); + widget = dynamic_cast<TQWidget*>(lv); + } + } + + TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption()); + drawPrimitive(pe, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), r, cg, flags, opt); +} + +void TQStyle::drawControl( ControlElement element, + TQPainter *p, + const TQWidget *widget, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + const TQStyleOption& opt ) const +{ +#if defined(QT_CHECK_STATE) + if (!widget) { + tqWarning("TQStyle::drawControl: widget parameter cannot be zero!"); + return; + } +#endif + + TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt); + drawControl(element, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, opt), r, cg, flags, opt, widget); +} + +void TQStyle::drawControlMask( ControlElement control, + TQPainter *p, + const TQWidget *widget, + const TQRect &r, + const TQStyleOption& opt ) const +{ + TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt); + drawControlMask(control, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, opt), r, opt, widget); +} + +TQRect TQStyle::subRect(SubRect r, const TQWidget *widget) const +{ +#if defined(QT_CHECK_STATE) + if (! widget) { + tqWarning("TQStyle::subRect: widget parameter cannot be zero!"); + return TQRect(); + } +#endif + + TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption()); + return subRect(r, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), widget); +} + +void TQStyle::drawComplexControl( ComplexControl control, + TQPainter *p, + const TQWidget *widget, + const TQRect &r, + const TQColorGroup &cg, + SFlags flags, + SCFlags controls, + SCFlags active, + const TQStyleOption& opt ) const +{ +#if defined(QT_CHECK_STATE) + if (! widget) { + tqWarning("TQStyle::drawComplexControl: widget parameter cannot be zero!"); + return; + } +#endif + + TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption()); + drawComplexControl(control, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), r, cg, flags, controls, active, opt, widget); +} + +void TQStyle::drawComplexControlMask( ComplexControl control, + TQPainter *p, + const TQWidget *widget, + const TQRect &r, + const TQStyleOption& opt ) const +{ + TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption()); + drawComplexControlMask(control, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), r, opt, widget); +} + +TQRect TQStyle::querySubControlMetrics( ComplexControl control, + const TQWidget *widget, + SubControl sc, + const TQStyleOption &opt ) const +{ +#if defined(QT_CHECK_STATE) + if (! widget) { + tqWarning("TQStyle::querySubControlMetrics: widget parameter cannot be zero!"); + return TQRect(); + } +#endif + + TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption(), false); + return querySubControlMetrics(control, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), sc, opt, widget); +} + +TQStyle::SubControl TQStyle::querySubControl(ComplexControl control, + const TQWidget *widget, + const TQPoint &pos, + const TQStyleOption& opt ) const +{ + TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, opt); + return querySubControl(control, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, opt), pos, opt, widget); +} + +int TQStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const +{ + TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption()); + return pixelMetric(m, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), widget); +} + +TQSize TQStyle::sizeFromContents(ContentsType contents, + const TQWidget *widget, + const TQSize &contentsSize, + const TQStyleOption& opt ) const +{ + TQSize sz(contentsSize); + +#if defined(QT_CHECK_STATE) + if (! widget) { + tqWarning("TQStyle::sizeFromContents: widget parameter cannot be zero!"); + return sz; + } +#endif + + TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption()); + return sizeFromContents(contents, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), contentsSize, opt, widget); +} + +int TQStyle::styleHint(StyleHint sh, const TQWidget * w, const TQStyleOption &so, TQStyleHintReturn *shr) const +{ + TQStyleControlElementData ceData = populateControlElementDataFromWidget(w, TQStyleOption(), false); + return styleHint(sh, ceData, getControlElementFlagsForObject(w, ceData.widgetObjectTypes, TQStyleOption(), false), so, shr, w); +} + +TQPixmap TQStyle::stylePixmap(StylePixmap sp, const TQWidget *w, const TQStyleOption &so) const +{ + TQStyleControlElementData ceData = populateControlElementDataFromWidget(w, TQStyleOption()); + return stylePixmap(sp, ceData, getControlElementFlagsForObject(w, ceData.widgetObjectTypes, TQStyleOption()), so, w); +} + /*! \fn int TQStyle::defaultFrameWidth() const \obsolete |