summaryrefslogtreecommitdiff
path: root/vcl/source/control
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/control')
-rw-r--r--vcl/source/control/button.cxx16
-rw-r--r--vcl/source/control/combobox.cxx11
-rw-r--r--vcl/source/control/edit.cxx4
-rw-r--r--vcl/source/control/imgctrl.cxx33
-rw-r--r--vcl/source/control/lstbox.cxx85
-rw-r--r--vcl/source/control/spinfld.cxx7
6 files changed, 119 insertions, 37 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 3a0c2af0e852..2e2342fc6fc8 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -794,6 +794,15 @@ void Button::DataChanged( const DataChangedEvent& rDCEvt )
}
}
+void Button::SetSmallSymbol (bool small)
+{
+ ImplSetSmallSymbol (small);
+}
+
+bool Button::IsSmallSymbol () const
+{
+ return mpButtonData->mbSmallSymbol;
+}
// =======================================================================
@@ -1964,7 +1973,12 @@ Size PushButton::CalcMinimumSize( long nMaxWidth ) const
Size aSize;
if ( IsSymbol() )
- aSize = Size( 12, 12 );
+ {
+ if ( IsSmallSymbol ())
+ aSize = Size( 16, 12 );
+ else
+ aSize = Size( 26, 24 );
+ }
else if ( IsImage() && ! (ImplGetButtonState() & BUTTON_DRAW_NOIMAGE) )
aSize = GetModeImage().GetSizePixel();
if ( PushButton::GetText().Len() && ! (ImplGetButtonState() & BUTTON_DRAW_NOTEXT) )
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 42abe3fd248a..309acb404750 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -876,10 +876,19 @@ long ComboBox::Notify( NotifyEvent& rNEvt )
(rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL) &&
(rNEvt.GetWindow() == mpSubEdit) )
{
- 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)
+ }
}
return nDone ? nDone : Edit::Notify( rNEvt );
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index 3834e4de8677..5f41a441c6a1 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -2903,8 +2903,8 @@ PopupMenu* Edit::CreatePopupMenu()
pPopup->SetAccelKey( SV_MENU_EDIT_COPY, KeyCode( KEYFUNC_COPY ) );
pPopup->SetAccelKey( SV_MENU_EDIT_PASTE, KeyCode( KEYFUNC_PASTE ) );
pPopup->SetAccelKey( SV_MENU_EDIT_DELETE, KeyCode( KEYFUNC_DELETE ) );
- pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, FALSE, TRUE, FALSE ) );
- pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, TRUE, TRUE, FALSE ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_SELECTALL, KeyCode( KEY_A, FALSE, TRUE, FALSE, FALSE ) );
+ pPopup->SetAccelKey( SV_MENU_EDIT_INSERTSYMBOL, KeyCode( KEY_S, TRUE, TRUE, FALSE, FALSE ) );
return pPopup;
}
diff --git a/vcl/source/control/imgctrl.cxx b/vcl/source/control/imgctrl.cxx
index e6930edeba95..6d4777013a73 100644
--- a/vcl/source/control/imgctrl.cxx
+++ b/vcl/source/control/imgctrl.cxx
@@ -103,13 +103,28 @@ void ImageControl::UserDraw( const UserDrawEvent& rUDEvt )
// nStyle |= IMAGE_DRAW_COLORTRANSFORM;
}
+ if ( !*pBitmap )
+ {
+ String sText( GetText() );
+ if ( !sText.Len() )
+ return;
+
+ WinBits nWinStyle = GetStyle();
+ USHORT nTextStyle = FixedText::ImplGetTextStyle( nWinStyle );
+ if ( !IsEnabled() )
+ nTextStyle |= TEXT_DRAW_DISABLE;
+
+ DrawText( rUDEvt.GetRect(), sText, nTextStyle );
+ return;
+ }
+
const Rectangle& rPaintRect = rUDEvt.GetRect();
const Size& rBitmapSize = maBmp.GetSizePixel();
if( nStyle & IMAGE_DRAW_COLORTRANSFORM )
{
// only images support IMAGE_DRAW_COLORTRANSFORM
- Image aImage( maBmp );
+ Image aImage( *pBitmap );
if ( !!aImage )
{
switch ( mnScaleMode )
@@ -153,29 +168,29 @@ void ImageControl::UserDraw( const UserDrawEvent& rUDEvt )
{
case ImageScaleMode::None:
{
- maBmp.Draw( rUDEvt.GetDevice(), lcl_centerWithin( rPaintRect, rBitmapSize ) );
+ pBitmap->Draw( rUDEvt.GetDevice(), lcl_centerWithin( rPaintRect, rBitmapSize ) );
}
break;
case ImageScaleMode::Isotropic:
{
const Size aPaintSize = lcl_calcPaintSize( rPaintRect, rBitmapSize );
- maBmp.Draw( rUDEvt.GetDevice(),
- lcl_centerWithin( rPaintRect, aPaintSize ),
- aPaintSize );
+ pBitmap->Draw( rUDEvt.GetDevice(),
+ lcl_centerWithin( rPaintRect, aPaintSize ),
+ aPaintSize );
}
break;
case ImageScaleMode::Anisotropic:
{
- maBmp.Draw( rUDEvt.GetDevice(),
- rPaintRect.TopLeft(),
- rPaintRect.GetSize() );
+ pBitmap->Draw( rUDEvt.GetDevice(),
+ rPaintRect.TopLeft(),
+ rPaintRect.GetSize() );
}
break;
default:
- OSL_ENSURE( false, "ImageControl::UserDraw: unhandled scale mode!" );
+ OSL_ENSURE( false, "ImageControl::UserDraw: unhandled scale mode!" );
break;
} // switch ( mnScaleMode )
diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx
index 0accd17489c9..641665aacf6b 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"
@@ -604,18 +604,18 @@ BOOL ListBox::IsDDAutoWidthEnabled() const
void ListBox::SetDropDownLineCount( USHORT nLines )
{
+ mnLineCount = nLines;
if ( mpFloatWin )
- mpFloatWin->SetDropDownLineCount( nLines );
+ mpFloatWin->SetDropDownLineCount( mnLineCount );
}
// -----------------------------------------------------------------------
USHORT ListBox::GetDropDownLineCount() const
{
- USHORT nLines = 0;
if ( mpFloatWin )
- nLines = mpFloatWin->GetDropDownLineCount();
- return nLines;
+ return mpFloatWin->GetDropDownLineCount();
+ return mnLineCount;
}
// -----------------------------------------------------------------------
@@ -650,6 +650,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 +679,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 +971,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)
+ }
}
}
@@ -1260,12 +1281,30 @@ Size ListBox::CalcMinimumSize() const
{
Size aSz;
if ( !IsDropDownBox() )
- {
- aSz = mpImplLB->CalcSize( mpImplLB->GetEntryList()->GetEntryCount() );
- }
+ aSz = mpImplLB->CalcSize (mnLineCount ? mnLineCount : mpImplLB->GetEntryList()->GetEntryCount());
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();
}
diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx
index 3f8779dc2e90..0d656da40ba7 100644
--- a/vcl/source/control/spinfld.cxx
+++ b/vcl/source/control/spinfld.cxx
@@ -599,7 +599,12 @@ long SpinField::Notify( NotifyEvent& rNEvt )
{
if ( ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL ) && !IsReadOnly() )
{
- if( ! GetSettings().GetMouseSettings().GetNoWheelActionWithoutFocus() || HasChildPathFocus() )
+ USHORT nWheelBehavior( GetSettings().GetMouseSettings().GetWheelBehavior() );
+ if ( ( nWheelBehavior == MOUSE_WHEEL_ALWAYS )
+ || ( ( nWheelBehavior == MOUSE_WHEEL_FOCUS_ONLY )
+ && HasChildPathFocus()
+ )
+ )
{
const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )