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/qstyle.cpp | |
parent | 43db215f601fd50f1fd8b502fae30c75c1bdee4a (diff) | |
download | tqt3-b6053b1b40b51e3d9b1b679a8a1751e5472e06e2.tar.gz tqt3-b6053b1b40b51e3d9b1b679a8a1751e5472e06e2.zip |
Automated update from Qt3
Diffstat (limited to 'src/kernel/qstyle.cpp')
-rw-r--r-- | src/kernel/qstyle.cpp | 192 |
1 files changed, 191 insertions, 1 deletions
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 |