summaryrefslogtreecommitdiffstats
path: root/src/styles/qcommonstyle.cpp
diff options
context:
space:
mode:
authorDarrell Anderson <[email protected]>2012-08-09 13:00:30 -0500
committerDarrell Anderson <[email protected]>2012-08-09 13:00:30 -0500
commit34ddcfd05b2b4772eeb70493726e0f8c8b40a3af (patch)
tree8b1d100ee7f3ff0a997338b2e0424392121c09fa /src/styles/qcommonstyle.cpp
parent785106b36c47923c338b6d3d61584eea448863ca (diff)
parentb6053b1b40b51e3d9b1b679a8a1751e5472e06e2 (diff)
downloadtqt3-34ddcfd05b2b4772eeb70493726e0f8c8b40a3af.tar.gz
tqt3-34ddcfd05b2b4772eeb70493726e0f8c8b40a3af.zip
Merge branch 'master' of http://scm.trinitydesktop.org/scm/git/tqt3
Diffstat (limited to 'src/styles/qcommonstyle.cpp')
-rw-r--r--src/styles/qcommonstyle.cpp208
1 files changed, 26 insertions, 182 deletions
diff --git a/src/styles/qcommonstyle.cpp b/src/styles/qcommonstyle.cpp
index 20c6c9993..7162c4c0d 100644
--- a/src/styles/qcommonstyle.cpp
+++ b/src/styles/qcommonstyle.cpp
@@ -184,7 +184,6 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
if (button) {
if (button->isDown()) cef = cef | TQStyle::CEF_IsDown;
if (button->isOn()) cef = cef | TQStyle::CEF_IsOn;
- if (button->isEnabled()) cef = cef | TQStyle::CEF_IsEnabled;
if (button->isToggleButton()) cef = cef | TQStyle::CEF_BiState;
}
}
@@ -223,6 +222,7 @@ TQStyle::ControlElementFlags getControlElementFlagsForObject(const TQObject* obj
// Generic flags
const TQWidget* widget = dynamic_cast<const TQWidget*>(object);
if (widget) {
+ if (widget->isEnabled()) cef = cef | TQStyle::CEF_IsEnabled;
if (widget->parentWidget()) cef = cef | TQStyle::CEF_HasParentWidget;
if (widget->focusProxy()) cef = cef | TQStyle::CEF_HasFocusProxy;
if (widget->hasFocus()) cef = cef | TQStyle::CEF_HasFocus;
@@ -254,6 +254,9 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.bgBrush = widget->backgroundBrush();
}
ceData.wflags = widget->getWFlags();
+ if (populateReliantFields) {
+ ceData.windowState = (TQt::WindowState)(widget->windowState());
+ }
ceData.bgColor = widget->eraseColor();
ceData.bgOffset = widget->backgroundOffset();
ceData.backgroundMode = widget->backgroundMode();
@@ -419,10 +422,10 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
const TQTitleBar *tb = dynamic_cast<const TQTitleBar*>(widget);
if (tb) {
ceData.titleBarData.hasWindow = !!(tb->window());
- if (ceData.titleBarData.hasWindow) {
- ceData.titleBarData.windowState = tb->window()->windowState();
- }
if (populateReliantFields) {
+ if (ceData.titleBarData.hasWindow) {
+ ceData.titleBarData.windowState = (TQt::WindowState)(tb->window()->windowState());
+ }
ceData.titleBarData.usesActiveColor = tb->usesActiveColor();
}
ceData.titleBarData.visibleText = tb->visibleText();
@@ -455,6 +458,9 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.viewportData.bgBrush = viewport->backgroundBrush();
}
ceData.viewportData.wflags = viewport->getWFlags();
+ if (populateReliantFields) {
+ ceData.viewportData.windowState = (TQt::WindowState)(widget->windowState());
+ }
ceData.viewportData.bgColor = viewport->eraseColor();
ceData.viewportData.bgOffset = viewport->backgroundOffset();
ceData.viewportData.backgroundMode = viewport->backgroundMode();
@@ -502,6 +508,9 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.parentWidgetData.bgBrush = parentWidget->backgroundBrush();
}
ceData.parentWidgetData.wflags = parentWidget->getWFlags();
+ if (populateReliantFields) {
+ ceData.parentWidgetData.windowState = (TQt::WindowState)(widget->windowState());
+ }
ceData.parentWidgetData.bgColor = parentWidget->eraseColor();
ceData.parentWidgetData.bgOffset = parentWidget->backgroundOffset();
ceData.parentWidgetData.backgroundMode = parentWidget->backgroundMode();
@@ -531,33 +540,20 @@ TQStyleControlElementData populateControlElementDataFromWidget(const TQWidget* w
ceData.dwData.closeEnabled = dw->isCloseEnabled();
}
}
- }
- return ceData;
-}
-
-/*! \reimp */
-void TQCommonStyle::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);
+ ceData.checkListItemData.dataValid = true;
+ ceData.checkListItemData.enabled = item->isEnabled();
+ ceData.checkListItemData.hasParent = ( item->parent() && (item->parent()->rtti() == 1) && (((TQCheckListItem*) item->parent())->type() == TQCheckListItem::Controller) );
+ ceData.checkListItemData.height = item->height();
+ }
+ else {
+ ceData.checkListItemData.dataValid = false;
}
}
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption());
- drawPrimitive(pe, p, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), r, cg, flags, opt);
+ return ceData;
}
/*! \reimp */
@@ -578,8 +574,7 @@ void TQCommonStyle::drawPrimitive( PrimitiveElement pe,
p->drawPixmap(r, TQPixmap((const char **)check_list_controller_xpm));
break; }
case PE_CheckListExclusiveIndicator: {
- TQCheckListItem *item = opt.checkListItem();
- if(!item)
+ if(!ceData.checkListItemData.dataValid)
return;
int x = r.x(), y = r.y();
#define TQCOORDARRLEN(x) sizeof(x)/(sizeof(TQCOORD)*2)
@@ -630,8 +625,7 @@ void TQCommonStyle::drawPrimitive( PrimitiveElement pe,
}
break; }
case PE_CheckListIndicator: {
- TQCheckListItem *item = opt.checkListItem();
- if(!item)
+ if(!ceData.checkListItemData.dataValid)
return;
int x = r.x(), y = r.y(), w = r.width(), h = r.width(), marg = ceData.listViewData.itemMargin;
@@ -640,14 +634,10 @@ void TQCommonStyle::drawPrimitive( PrimitiveElement pe,
else
p->setPen( TQPen( ceData.palette.color( TQPalette::Disabled, TQColorGroup::Text ),
2 ) );
- bool parentControl = FALSE;
- if ( item->parent() && item->parent()->rtti() == 1 &&
- ((TQCheckListItem*) item->parent())->type() == TQCheckListItem::Controller )
- parentControl = TRUE;
- if ( flags & Style_Selected && !ceData.listViewData.rootDecorated && !parentControl ) {
- p->fillRect( 0, 0, x + marg + w + 4, item->height(),
+ if ( flags & Style_Selected && !ceData.listViewData.rootDecorated && !ceData.checkListItemData.hasParent ) {
+ p->fillRect( 0, 0, x + marg + w + 4, ceData.checkListItemData.height,
cg.brush( TQColorGroup::Highlight ) );
- if ( item->isEnabled() )
+ if ( ceData.checkListItemData.enabled )
p->setPen( TQPen( cg.highlightedText(), 2 ) );
}
@@ -1047,26 +1037,6 @@ void qt_style_erase_region(TQPainter* p, const TQRegion& region, TQStyleControlE
/*! \reimp */
void TQCommonStyle::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("TQCommonStyle::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);
-}
-
-/*! \reimp */
-void TQCommonStyle::drawControl( ControlElement element,
- TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r,
@@ -1544,16 +1514,6 @@ void TQCommonStyle::drawControl( ControlElement element,
activePainter = 0;
}
-void TQCommonStyle::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);
-}
-
/*! \reimp */
void TQCommonStyle::drawControlMask( ControlElement control,
TQPainter *p,
@@ -1593,20 +1553,6 @@ void TQCommonStyle::drawControlMask( ControlElement control,
}
/*! \reimp */
-TQRect TQCommonStyle::subRect(SubRect r, const TQWidget *widget) const
-{
-#if defined(QT_CHECK_STATE)
- if (! widget) {
- tqWarning("TQCommonStyle::subRect: widget parameter cannot be zero!");
- return TQRect();
- }
-#endif
-
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption());
- return subRect(r, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), widget);
-}
-
-/*! \reimp */
TQRect TQCommonStyle::subRect(SubRect r, const TQStyleControlElementData ceData, const ControlElementFlags elementFlags, const TQWidget *widget) const
{
TQRect rect, wrect(ceData.rect);
@@ -1936,28 +1882,6 @@ static int qPositionFromValue( TQStyleControlElementData ceData, int logical_val
/*! \reimp */
void TQCommonStyle::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("TQCommonStyle::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);
-}
-
-/*! \reimp */
-void TQCommonStyle::drawComplexControl( ComplexControl control,
- TQPainter *p,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQRect &r,
@@ -2360,17 +2284,6 @@ void TQCommonStyle::drawComplexControl( ComplexControl control,
/*! \reimp */
void TQCommonStyle::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);
-}
-
-/*! \reimp */
-void TQCommonStyle::drawComplexControlMask( ComplexControl control,
- TQPainter *p,
const TQStyleControlElementData ceData,
const ControlElementFlags elementFlags,
const TQRect &r,
@@ -2388,23 +2301,6 @@ void TQCommonStyle::drawComplexControlMask( ComplexControl control,
/*! \reimp */
TQRect TQCommonStyle::querySubControlMetrics( ComplexControl control,
- const TQWidget *widget,
- SubControl sc,
- const TQStyleOption &opt ) const
-{
-#if defined(QT_CHECK_STATE)
- if (! widget) {
- tqWarning("TQCommonStyle::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);
-}
-
-/*! \reimp */
-TQRect TQCommonStyle::querySubControlMetrics( ComplexControl control,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
SubControl sc,
@@ -2637,17 +2533,6 @@ TQRect TQCommonStyle::querySubControlMetrics( ComplexControl control,
return TQRect();
}
-
-/*! \reimp */
-TQStyle::SubControl TQCommonStyle::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);
-}
-
/*! \reimp */
TQStyle::SubControl TQCommonStyle::querySubControl(ComplexControl control,
TQStyleControlElementData ceData,
@@ -2724,14 +2609,6 @@ TQStyle::SubControl TQCommonStyle::querySubControl(ComplexControl control,
return ret;
}
-
-/*! \reimp */
-int TQCommonStyle::pixelMetric(PixelMetric m, const TQWidget *widget) const
-{
- TQStyleControlElementData ceData = populateControlElementDataFromWidget(widget, TQStyleOption());
- return pixelMetric(m, ceData, getControlElementFlagsForObject(widget, ceData.widgetObjectTypes, TQStyleOption()), widget);
-}
-
/*! \reimp */
int TQCommonStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQWidget *widget) const
{
@@ -2954,25 +2831,6 @@ int TQCommonStyle::pixelMetric(PixelMetric m, TQStyleControlElementData ceData,
/*! \reimp */
TQSize TQCommonStyle::sizeFromContents(ContentsType contents,
- const TQWidget *widget,
- const TQSize &contentsSize,
- const TQStyleOption& opt ) const
-{
- TQSize sz(contentsSize);
-
-#if defined(QT_CHECK_STATE)
- if (! widget) {
- tqWarning("TQCommonStyle::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);
-}
-
-/*! \reimp */
-TQSize TQCommonStyle::sizeFromContents(ContentsType contents,
TQStyleControlElementData ceData,
ControlElementFlags elementFlags,
const TQSize &contentsSize,
@@ -3143,13 +3001,6 @@ TQSize TQCommonStyle::sizeFromContents(ContentsType contents,
}
/*! \reimp */
-int TQCommonStyle::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);
-}
-
-/*! \reimp */
int TQCommonStyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, ControlElementFlags elementFlags, const TQStyleOption &, TQStyleHintReturn *, const TQWidget * w) const
{
Q_UNUSED(w);
@@ -3233,13 +3084,6 @@ int TQCommonStyle::styleHint(StyleHint sh, TQStyleControlElementData ceData, Con
}
/*! \reimp */
-TQPixmap TQCommonStyle::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);
-}
-
-/*! \reimp */
TQPixmap TQCommonStyle::stylePixmap(StylePixmap, TQStyleControlElementData, ControlElementFlags, const TQStyleOption&, const TQWidget *) const
{
return TQPixmap();