summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2005-03-18 16:51:14 +0000
committerKurt Zenker <kz@openoffice.org>2005-03-18 16:51:14 +0000
commitb1ef2ddd1e1fb23643b4280fcdd2364d83f13ca7 (patch)
tree0907eddddc345c1077ed72bd676004dcad5532ba
parent8cd9dc98b53d550baa92340eb6494852b3486970 (diff)
INTEGRATION: CWS vcl36 (1.35.2); FILE MERGED
2005/02/16 14:23:01 pl 1.35.2.4: #i41741# fix windows case 2005/02/15 07:23:31 dv 1.35.2.3: #i42422# Better alignment of MoreButton text 2005/02/14 08:10:41 dv 1.35.2.2: #i42422# MoreButton now with symbols 2005/02/02 20:45:54 pl 1.35.2.1: #i41741# draw radiobuttons and checkboxes in correct size
-rw-r--r--vcl/source/control/button.cxx68
1 files changed, 62 insertions, 6 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 74b1123776d2..9b33dd8da258 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: button.cxx,v $
*
- * $Revision: 1.36 $
+ * $Revision: 1.37 $
*
- * last change: $Author: vg $ $Date: 2005-02-25 13:10:56 $
+ * last change: $Author: kz $ $Date: 2005-03-18 17:51:14 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -2516,7 +2516,7 @@ void RadioButton::ImplDrawRadioButton( bool bLayout )
Size aImageSize;
if ( !maImage )
- aImageSize = GetRadioImage( GetSettings(), 0 ).GetSizePixel();
+ aImageSize = ImplGetRadioImageSize();
else
aImageSize = maImage.GetSizePixel();
aImageSize.Width() = CalcZoom( aImageSize.Width() );
@@ -3080,6 +3080,34 @@ void RadioButton::Check( BOOL bCheck )
// -----------------------------------------------------------------------
+Size RadioButton::ImplGetRadioImageSize() const
+{
+ Size aSize;
+ // why are IsNativeControlSupported and GetNativeControlRegion not const ?
+ RadioButton* pThis = const_cast<RadioButton*>(this);
+ bool bDefaultSize = true;
+ if( pThis->IsNativeControlSupported( CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL ) )
+ {
+ ImplControlValue aControlValue;
+ Region aCtrlRegion( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
+ ControlState nState = CTRL_STATE_DEFAULT|CTRL_STATE_ENABLED;
+ Region aBoundingRgn, aContentRgn;
+
+ // get native size of a radio button
+ if( pThis->GetNativeControlRegion( CTRL_RADIOBUTTON, PART_ENTIRE_CONTROL, aCtrlRegion,
+ nState, aControlValue, rtl::OUString(),
+ aBoundingRgn, aContentRgn ) )
+ {
+ Rectangle aCont(aContentRgn.GetBoundRect());
+ aSize = aCont.GetSize();
+ bDefaultSize = false;
+ }
+ }
+ if( bDefaultSize )
+ aSize = GetRadioImage( GetSettings(), 0 ).GetSizePixel();
+ return aSize;
+}
+
Image RadioButton::GetRadioImage( const AllSettings& rSettings, USHORT nFlags )
{
ImplSVData* pSVData = ImplGetSVData();
@@ -3156,7 +3184,7 @@ Size RadioButton::CalcMinimumSize( long nMaxWidth ) const
{
Size aSize;
if ( !maImage )
- aSize = GetRadioImage( GetSettings(), 0 ).GetSizePixel();
+ aSize = ImplGetRadioImageSize();
else
aSize = maImage.GetSizePixel();
@@ -3398,7 +3426,7 @@ void CheckBox::ImplDraw( OutputDevice* pDev, ULONG nDrawFlags,
void CheckBox::ImplDrawCheckBox( bool bLayout )
{
- Size aImageSize = GetCheckImage( GetSettings(), 0 ).GetSizePixel();
+ Size aImageSize = ImplGetCheckImageSize();
aImageSize.Width() = CalcZoom( aImageSize.Width() );
aImageSize.Height() = CalcZoom( aImageSize.Height() );
@@ -3870,6 +3898,34 @@ void CheckBox::EnableTriState( BOOL bTriState )
// -----------------------------------------------------------------------
+Size CheckBox::ImplGetCheckImageSize() const
+{
+ Size aSize;
+ // why are IsNativeControlSupported and GetNativeControlRegion not const ?
+ CheckBox* pThis = const_cast<CheckBox*>(this);
+ bool bDefaultSize = true;
+ if( pThis->IsNativeControlSupported( CTRL_CHECKBOX, PART_ENTIRE_CONTROL ) )
+ {
+ ImplControlValue aControlValue;
+ Region aCtrlRegion( Rectangle( Point( 0, 0 ), GetSizePixel() ) );
+ ControlState nState = CTRL_STATE_DEFAULT|CTRL_STATE_ENABLED;
+ Region aBoundingRgn, aContentRgn;
+
+ // get native size of a check box
+ if( pThis->GetNativeControlRegion( CTRL_CHECKBOX, PART_ENTIRE_CONTROL, aCtrlRegion,
+ nState, aControlValue, rtl::OUString(),
+ aBoundingRgn, aContentRgn ) )
+ {
+ Rectangle aCont(aContentRgn.GetBoundRect());
+ aSize = aCont.GetSize();
+ bDefaultSize = false;
+ }
+ }
+ if( bDefaultSize )
+ aSize = GetCheckImage( GetSettings(), 0 ).GetSizePixel();
+ return aSize;
+}
+
Image CheckBox::GetCheckImage( const AllSettings& rSettings, USHORT nFlags )
{
ImplSVData* pSVData = ImplGetSVData();
@@ -3950,7 +4006,7 @@ Image CheckBox::GetCheckImage( const AllSettings& rSettings, USHORT nFlags )
Size CheckBox::CalcMinimumSize( long nMaxWidth ) const
{
- Size aSize = GetCheckImage( GetSettings(), 0 ).GetSizePixel();
+ Size aSize = ImplGetCheckImageSize();
nMaxWidth -= aSize.Width();
XubString aText = GetText();