summaryrefslogtreecommitdiffstats
path: root/style/eventfilter.cpp
diff options
context:
space:
mode:
authorSlávek Banko <slavek.banko@axis.cz>2016-03-25 20:37:57 +0100
committerSlávek Banko <slavek.banko@axis.cz>2016-03-26 01:06:13 +0100
commit42573cc6b43972357d166b0eabf665b1de64f0ac (patch)
tree9c84befb71dcad1076657618f616d82ab440b1ec /style/eventfilter.cpp
parent931f305a785fdaf3b310aeed1c2033d3e42ec82a (diff)
downloadtde-style-baghira-42573cc6b43972357d166b0eabf665b1de64f0ac.tar.gz
tde-style-baghira-42573cc6b43972357d166b0eabf665b1de64f0ac.zip
Update to new style API
Rename KStyle to TDEStyle Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
Diffstat (limited to 'style/eventfilter.cpp')
-rw-r--r--style/eventfilter.cpp32
1 files changed, 19 insertions, 13 deletions
diff --git a/style/eventfilter.cpp b/style/eventfilter.cpp
index 4f860b5..4d1eb4b 100644
--- a/style/eventfilter.cpp
+++ b/style/eventfilter.cpp
@@ -1,5 +1,5 @@
#include <tqcursor.h>
-#include <kpixmapeffect.h>
+#include <kpixmapeffect.h>
#include <X11/keysym.h>
#include <X11/extensions/XTest.h>
#include <fixx11h.h>
@@ -179,14 +179,16 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev )
TQButton * btn = ( TQButton * ) obj;
bool isStatusChild = btn->parent() && ( btn->parent() ->inherits( "TQStatusBar" ) || btn->parent() ->inherits( "KonqFrameStatusBar" ) );
bool isRadio = obj->inherits( "TQRadioButton" );
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(btn, TQStyleOption());
+ ControlElementFlags elementFlags = getControlElementFlagsForObject(btn, TQStyleOption());
btn->erase();
TQPainter p;
p.begin( btn );
TQFontMetrics fm = btn->fontMetrics();
TQSize lsz = fm.size( ShowPrefix, btn->text() );
TQSize sz = isRadio ?
- TQSize( pixelMetric( PM_ExclusiveIndicatorWidth ), pixelMetric( PM_ExclusiveIndicatorHeight ) ) :
- TQSize( pixelMetric( PM_IndicatorWidth ), pixelMetric( PM_IndicatorHeight ) );
+ TQSize( pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags ), pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags ) ) :
+ TQSize( pixelMetric( PM_IndicatorWidth, ceData, elementFlags ), pixelMetric( PM_IndicatorHeight, ceData, elementFlags ) );
int x = 0;
int y = isStatusChild ? 0 : ( btn->height() - lsz.height() + fm.height() - sz.height() ) / 2;
SFlags flags = Style_Default;
@@ -203,9 +205,9 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev )
else if ( btn->state() == TQButton::Off )
flags |= Style_Off;
if ( isRadio )
- drawControl( CE_RadioButton, &p, btn, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags );
+ drawControl( CE_RadioButton, &p, ceData, elementFlags, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags, TQStyleOption::Default, btn );
else
- drawControl( CE_CheckBox, &p, btn, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags );
+ drawControl( CE_CheckBox, &p, ceData, elementFlags, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags, TQStyleOption::Default, btn );
x = sz.width() + 6;
y = 0;
if ( btn->hasFocus() )
@@ -340,12 +342,14 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev )
{
bool isStatusChild = btn->parent() && ( btn->parent() ->inherits( "TQStatusBar" ) || btn->parent() ->inherits( "KonqFrameStatusBar" ) );
bool isRadio = obj->inherits( "TQRadioButton" );
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(btn, TQStyleOption());
+ ControlElementFlags elementFlags = getControlElementFlagsForObject(btn, TQStyleOption());
highlightWidget = btn;
TQFontMetrics fm = btn->fontMetrics();
TQSize lsz = fm.size( ShowPrefix, btn->text() );
TQSize sz = isRadio ?
- TQSize( pixelMetric( PM_ExclusiveIndicatorWidth ), pixelMetric( PM_ExclusiveIndicatorHeight ) ) :
- TQSize( pixelMetric( PM_IndicatorWidth ), pixelMetric( PM_IndicatorHeight ) );
+ TQSize( pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags ), pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags ) ) :
+ TQSize( pixelMetric( PM_IndicatorWidth, ceData, elementFlags ), pixelMetric( PM_IndicatorHeight, ceData, elementFlags ) );
int x = 0;
int y = isStatusChild ? 0 : ( btn->height() - lsz.height() + fm.height() - sz.height() ) / 2;
TQPainter p;
@@ -364,9 +368,9 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev )
else if ( btn->state() == TQButton::Off )
flags |= Style_Off;
if ( isRadio )
- drawControl( CE_RadioButton, &p, btn, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags );
+ drawControl( CE_RadioButton, &p, ceData, elementFlags, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags, TQStyleOption::Default, btn );
else
- drawControl( CE_CheckBox, &p, btn, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags );
+ drawControl( CE_CheckBox, &p, ceData, elementFlags, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags, TQStyleOption::Default, btn );
p.end();
}
return false;
@@ -485,12 +489,14 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev )
{
bool isRadio = obj->inherits( "TQRadioButton" );
bool isStatusChild = btn->parent() && ( btn->parent() ->inherits( "TQStatusBar" ) || btn->parent() ->inherits( "KonqFrameStatusBar" ) );
+ const TQStyleControlElementData &ceData = populateControlElementDataFromWidget(btn, TQStyleOption());
+ ControlElementFlags elementFlags = getControlElementFlagsForObject(btn, TQStyleOption());
highlightWidget = NULL;
TQFontMetrics fm = btn->fontMetrics();
TQSize lsz = fm.size( ShowPrefix, btn->text() );
TQSize sz = isRadio ?
- TQSize( pixelMetric( PM_ExclusiveIndicatorWidth ), pixelMetric( PM_ExclusiveIndicatorHeight ) ) :
- TQSize( pixelMetric( PM_IndicatorWidth ), pixelMetric( PM_IndicatorHeight ) );
+ TQSize( pixelMetric( PM_ExclusiveIndicatorWidth, ceData, elementFlags ), pixelMetric( PM_ExclusiveIndicatorHeight, ceData, elementFlags ) ) :
+ TQSize( pixelMetric( PM_IndicatorWidth, ceData, elementFlags ), pixelMetric( PM_IndicatorHeight, ceData, elementFlags ) );
int x = 0;
int y = isStatusChild ? 0 : ( btn->height() - lsz.height() + fm.height() - sz.height() ) / 2;
TQPainter p;
@@ -509,9 +515,9 @@ bool LiquidStyle::eventFilter( TQObject *obj, TQEvent *ev )
else if ( btn->state() == TQButton::Off )
flags |= Style_Off;
if ( isRadio )
- drawControl( CE_RadioButton, &p, btn, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags );
+ drawControl( CE_RadioButton, &p, ceData, elementFlags, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags, TQStyleOption::Default, btn );
else
- drawControl( CE_CheckBox, &p, btn, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags );
+ drawControl( CE_CheckBox, &p, ceData, elementFlags, TQRect( x, y, sz.width(), sz.height() ), btn->colorGroup(), flags, TQStyleOption::Default, btn );
p.end();
}
return false;