summaryrefslogtreecommitdiff
path: root/vcl/unx/kde4/KDESalGraphics.cxx
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2011-04-08 15:15:49 +0200
committerLuboš Luňák <l.lunak@suse.cz>2011-04-08 21:56:41 +0200
commit6ce101d8c446f6639cee21a229ccde6eb42d812e (patch)
tree8f3b470aa17857a4a6f6434a490677b588946b14 /vcl/unx/kde4/KDESalGraphics.cxx
parent09b546cf9c1d0d9f78066e70a0348c7678cdcb14 (diff)
move hitTestNativeControl() to be next to getNativeControlRegion()
Diffstat (limited to 'vcl/unx/kde4/KDESalGraphics.cxx')
-rw-r--r--vcl/unx/kde4/KDESalGraphics.cxx91
1 files changed, 46 insertions, 45 deletions
diff --git a/vcl/unx/kde4/KDESalGraphics.cxx b/vcl/unx/kde4/KDESalGraphics.cxx
index 95a913e6d5dd..9a7771dc3956 100644
--- a/vcl/unx/kde4/KDESalGraphics.cxx
+++ b/vcl/unx/kde4/KDESalGraphics.cxx
@@ -156,51 +156,6 @@ sal_Bool KDESalGraphics::IsNativeControlSupported( ControlType type, ControlPart
return false;
}
-/** Test whether the position is in the native widget.
- If the return value is TRUE, bIsInside contains information whether
- aPos was or was not inside the native widget specified by the
- nType/nPart combination.
-*/
-sal_Bool KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart,
- const Rectangle& rControlRegion, const Point& rPos,
- sal_Bool& rIsInside )
-{
- if ( nType == CTRL_SCROLLBAR )
- {
- if( nPart != PART_BUTTON_UP && nPart != PART_BUTTON_DOWN
- && nPart != PART_BUTTON_LEFT && nPart != PART_BUTTON_RIGHT )
- { // we adjust only for buttons (because some scrollbars have 3 buttons)
- return FALSE;
- }
- rIsInside = FALSE;
- bool bHorizontal = ( nPart == PART_BUTTON_LEFT || nPart == PART_BUTTON_RIGHT );
- QRect rect = region2QRect( rControlRegion );
- QPoint pos( rPos.X(), rPos.Y());
- // Adjust coordinates to make the widget appear to be at (0,0), i.e. make
- // widget and screen coordinates the same. QStyle functions should use screen
- // coordinates but at least QPlastiqueStyle::subControlRect() is buggy
- // and sometimes uses widget coordinates.
- pos -= rect.topLeft();
- rect.moveTo( 0, 0 );
- QStyleOptionSlider options;
- options.orientation = bHorizontal ? Qt::Horizontal : Qt::Vertical;
- options.rect = rect;
- // some random sensible values, since we call this code only for scrollbar buttons,
- // the slider position does not exactly matter
- options.maximum = 10;
- options.minimum = 0;
- options.sliderPosition = options.sliderValue = 4;
- options.pageStep = 2;
- QStyle::SubControl control = kapp->style()->hitTestComplexControl( QStyle::CC_ScrollBar, &options, pos );
- if( nPart == PART_BUTTON_UP || nPart == PART_BUTTON_LEFT )
- rIsInside = ( control == QStyle::SC_ScrollBarSubLine );
- else // DOWN, RIGHT
- rIsInside = ( control == QStyle::SC_ScrollBarAddLine );
- return TRUE;
- }
- return FALSE;
-}
-
/// helper drawing methods
namespace
{
@@ -924,4 +879,50 @@ sal_Bool KDESalGraphics::getNativeControlRegion( ControlType type, ControlPart p
return retVal;
}
+/** Test whether the position is in the native widget.
+ If the return value is TRUE, bIsInside contains information whether
+ aPos was or was not inside the native widget specified by the
+ nType/nPart combination.
+*/
+sal_Bool KDESalGraphics::hitTestNativeControl( ControlType nType, ControlPart nPart,
+ const Rectangle& rControlRegion, const Point& rPos,
+ sal_Bool& rIsInside )
+{
+ if ( nType == CTRL_SCROLLBAR )
+ {
+ if( nPart != PART_BUTTON_UP && nPart != PART_BUTTON_DOWN
+ && nPart != PART_BUTTON_LEFT && nPart != PART_BUTTON_RIGHT )
+ { // we adjust only for buttons (because some scrollbars have 3 buttons)
+ return FALSE;
+ }
+ rIsInside = FALSE;
+ bool bHorizontal = ( nPart == PART_BUTTON_LEFT || nPart == PART_BUTTON_RIGHT );
+ QRect rect = region2QRect( rControlRegion );
+ QPoint pos( rPos.X(), rPos.Y());
+ // Adjust coordinates to make the widget appear to be at (0,0), i.e. make
+ // widget and screen coordinates the same. QStyle functions should use screen
+ // coordinates but at least QPlastiqueStyle::subControlRect() is buggy
+ // and sometimes uses widget coordinates.
+ pos -= rect.topLeft();
+ rect.moveTo( 0, 0 );
+ QStyleOptionSlider options;
+ options.orientation = bHorizontal ? Qt::Horizontal : Qt::Vertical;
+ options.rect = rect;
+ // some random sensible values, since we call this code only for scrollbar buttons,
+ // the slider position does not exactly matter
+ options.maximum = 10;
+ options.minimum = 0;
+ options.sliderPosition = options.sliderValue = 4;
+ options.pageStep = 2;
+ QStyle::SubControl control = kapp->style()->hitTestComplexControl( QStyle::CC_ScrollBar, &options, pos );
+ if( nPart == PART_BUTTON_UP || nPart == PART_BUTTON_LEFT )
+ rIsInside = ( control == QStyle::SC_ScrollBarSubLine );
+ else // DOWN, RIGHT
+ rIsInside = ( control == QStyle::SC_ScrollBarAddLine );
+ return TRUE;
+ }
+ return FALSE;
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */