summaryrefslogtreecommitdiff
path: root/vcl/source/control/lstbox.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/control/lstbox.cxx')
-rw-r--r--vcl/source/control/lstbox.cxx77
1 files changed, 58 insertions, 19 deletions
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 66722b70eef8..a5e9ff1cc7d0 100644
--- a/vcl/source/control/lstbox.cxx
+++ b/vcl/source/control/lstbox.cxx
@@ -31,21 +31,21 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_vcl.hxx"
-#ifndef _SV_RC_H
-#include <tools/rc.h>
-#endif
-#include <vcl/svdata.hxx>
-#include <vcl/decoview.hxx>
-#include <vcl/event.hxx>
-#include <vcl/scrbar.hxx>
-#include <vcl/button.hxx>
-#include <vcl/edit.hxx>
-#include <vcl/subedit.hxx>
-#include <vcl/ilstbox.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/combobox.hxx>
-#include <vcl/controllayout.hxx>
-#include <tools/debug.hxx>
+#include "tools/rc.h"
+
+#include "vcl/svdata.hxx"
+#include "vcl/decoview.hxx"
+#include "vcl/event.hxx"
+#include "vcl/scrbar.hxx"
+#include "vcl/button.hxx"
+#include "vcl/edit.hxx"
+#include "vcl/subedit.hxx"
+#include "vcl/ilstbox.hxx"
+#include "vcl/lstbox.hxx"
+#include "vcl/combobox.hxx"
+#include "vcl/controllayout.hxx"
+
+#include "tools/debug.hxx"
@@ -127,9 +127,7 @@ void ListBox::ImplInit( Window* pParent, WinBits nStyle )
GetBorder( nLeft, nTop, nRight, nBottom );
mnDDHeight = (USHORT)(GetTextHeight() + nTop + nBottom + 4);
- // FIXME: this is currently only on mac/aqua
- if( ImplGetSVData()->maNWFData.mbNoFocusRects &&
- IsNativeWidgetEnabled() &&
+ if( IsNativeWidgetEnabled() &&
IsNativeControlSupported( CTRL_LISTBOX, PART_ENTIRE_CONTROL ) )
{
ImplControlValue aControlValue;
@@ -650,6 +648,7 @@ void ListBox::Resize()
long nTop = 0;
long nBottom = aOutSz.Height();
+ // note: in case of no border, pBorder will actually be this
Window *pBorder = GetWindow( WINDOW_BORDER );
ImplControlValue aControlValue;
Point aPoint;
@@ -678,6 +677,17 @@ void ListBox::Resize()
// use the themes drop down size
Rectangle aContentRect = aContent.GetBoundRect();
+ if( ! (GetStyle() & WB_BORDER) && ImplGetSVData()->maNWFData.mbNoFocusRects )
+ {
+ // no border but focus ring behavior -> we have a problem; the
+ // native rect relies on the border to draw the focus
+ // let's do the best we can and center vertically, so it doesn't look
+ // completely wrong.
+ Size aSz( GetOutputSizePixel() );
+ long nDiff = aContentRect.Top() - (aSz.Height() - aContentRect.GetHeight())/2;
+ aContentRect.Top() -= nDiff;
+ aContentRect.Bottom() -= nDiff;
+ }
mpImplWin->SetPosSizePixel( aContentRect.TopLeft(), aContentRect.GetSize() );
}
else
@@ -959,10 +969,19 @@ long ListBox::PreNotify( NotifyEvent& rNEvt )
(rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL) &&
(rNEvt.GetWindow() == mpImplWin) )
{
- if( ! GetSettings().GetMouseSettings().GetNoWheelActionWithoutFocus() || HasChildPathFocus() )
+ USHORT nWheelBehavior( GetSettings().GetMouseSettings().GetWheelBehavior() );
+ if ( ( nWheelBehavior == MOUSE_WHEEL_ALWAYS )
+ || ( ( nWheelBehavior == MOUSE_WHEEL_FOCUS_ONLY )
+ && HasChildPathFocus()
+ )
+ )
+ {
nDone = mpImplLB->HandleWheelAsCursorTravel( *rNEvt.GetCommandEvent() );
+ }
else
+ {
nDone = 0; // don't eat this event, let the default handling happen (i.e. scroll the context)
+ }
}
}
@@ -1264,6 +1283,26 @@ Size ListBox::CalcMinimumSize() const
else
{
aSz.Height() = mpImplLB->CalcSize( 1 ).Height();
+ if( aSz.Height() < mnDDHeight )
+ {
+ aSz.Height() = mnDDHeight;
+ // FIXME: this is currently only on mac/aqua
+ if( ImplGetSVData()->maNWFData.mbNoFocusRects &&
+ IsNativeWidgetEnabled() &&
+ const_cast<ListBox*>(this)->IsNativeControlSupported( CTRL_LISTBOX, PART_ENTIRE_CONTROL ) )
+ {
+ ImplControlValue aControlValue;
+ Region aCtrlRegion( Rectangle( (const Point&)Point(), Size( 20, mnDDHeight ) ) );
+ Region aBoundingRgn( aCtrlRegion );
+ Region aContentRgn( aCtrlRegion );
+ // adjust the size of the edit field
+ if( const_cast<ListBox*>(this)->GetNativeControlRegion( CTRL_LISTBOX, PART_ENTIRE_CONTROL,
+ aCtrlRegion, 0, aControlValue, rtl::OUString(), aBoundingRgn, aContentRgn) )
+ {
+ aSz.Height() = aContentRgn.GetBoundRect().GetHeight();
+ }
+ }
+ }
aSz.Width() = mpImplLB->GetMaxEntryWidth();
aSz.Width() += GetSettings().GetStyleSettings().GetScrollBarSize();
}