summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-08-01 21:28:17 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-08-02 09:44:54 +0200
commit6aaf6c4c5ad096ed11fc524ebe0540ba0a41c053 (patch)
tree3c8a3e0f5534d977744ebca52b54932f578bb875
parent40b18263e71921a5bb4f219b2098022a5bbbad19 (diff)
DrawButtonFlags::NoText never set
Change-Id: I23531adc0798ec4a97538a8002ba0866535677a3 Reviewed-on: https://gerrit.libreoffice.org/76829 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/vcl/decoview.hxx5
-rw-r--r--vcl/source/control/button.cxx44
2 files changed, 21 insertions, 28 deletions
diff --git a/include/vcl/decoview.hxx b/include/vcl/decoview.hxx
index 51eb1b75afa0..5bcdcc1a208a 100644
--- a/include/vcl/decoview.hxx
+++ b/include/vcl/decoview.hxx
@@ -87,12 +87,11 @@ enum class DrawButtonFlags
Disabled = 0x0040,
Highlight = 0x0100,
Flat = 0x0200,
- NoLeftLightBorder = 0x1000,
- NoText = 0x2000
+ NoLeftLightBorder = 0x1000
};
namespace o3tl
{
- template<> struct typed_flags<DrawButtonFlags> : is_typed_flags<DrawButtonFlags, 0x337f> {};
+ template<> struct typed_flags<DrawButtonFlags> : is_typed_flags<DrawButtonFlags, 0x137f> {};
}
class VCL_DLLPUBLIC DecorationView
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index a46ab29fc08a..7240f7ce1b87 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -219,7 +219,7 @@ void Button::ImplDrawAlignedImage(OutputDevice* pDev, Point& rPos,
{
OUString aText(GetText());
bool bDrawImage = HasImage();
- bool bDrawText = !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText);
+ bool bDrawText = !aText.isEmpty();
bool bHasSymbol = pSymbolRect != nullptr;
// No text and no image => nothing to do => return
@@ -839,23 +839,19 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice* pDev, DrawFlags nDrawFl
{
long nSeparatorX = 0;
tools::Rectangle aSymbolRect = aInRect;
- if (!(ImplGetButtonState() & DrawButtonFlags::NoText))
- {
- // calculate symbol size
- long nSymbolSize = pDev->GetTextHeight() / 2 + 1;
- nSeparatorX = aInRect.Right() - 2*nSymbolSize;
- aSize.AdjustWidth( -(2*nSymbolSize) );
+ // calculate symbol size
+ long nSymbolSize = pDev->GetTextHeight() / 2 + 1;
- // center symbol rectangle in the separated area
- aSymbolRect.AdjustRight( -(nSymbolSize/2) );
- aSymbolRect.SetLeft( aSymbolRect.Right() - nSymbolSize );
+ nSeparatorX = aInRect.Right() - 2*nSymbolSize;
+ aSize.AdjustWidth( -(2*nSymbolSize) );
- ImplDrawAlignedImage( pDev, aPos, aSize, nImageSep,
- nTextStyle, nullptr, true );
- }
- else
- ImplCalcSymbolRect( aSymbolRect );
+ // center symbol rectangle in the separated area
+ aSymbolRect.AdjustRight( -(nSymbolSize/2) );
+ aSymbolRect.SetLeft( aSymbolRect.Right() - nSymbolSize );
+
+ ImplDrawAlignedImage( pDev, aPos, aSize, nImageSep,
+ nTextStyle, nullptr, true );
long nDistance = (aSymbolRect.GetHeight() > 10) ? 2 : 1;
DecorationView aDecoView( pDev );
@@ -1626,7 +1622,7 @@ Size PushButton::CalcMinimumSize() const
long nSymbolSize = GetTextHeight() / 2 + 1;
aSize.AdjustWidth(2*nSymbolSize );
}
- if ( !PushButton::GetText().isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) )
+ if (!PushButton::GetText().isEmpty())
{
Size textSize = GetTextRect( tools::Rectangle( Point(), Size( 0x7fffffff, 0x7fffffff ) ),
PushButton::GetText(), ImplGetTextStyle( DrawFlags::NONE ) ).GetSize();
@@ -2015,8 +2011,7 @@ void RadioButton::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
// no image radio button
if ( !maImage )
{
- if ( ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) ) ||
- HasImage() )
+ if (!aText.isEmpty() || HasImage())
{
DrawTextFlags nTextStyle = Button::ImplGetTextStyle( nWinStyle, nDrawFlags );
@@ -2085,7 +2080,7 @@ void RadioButton::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
long nTextWidth = pDev->GetCtrlTextWidth( aText );
// calculate position and sizes
- if ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) )
+ if (!aText.isEmpty())
{
Size aTmpSize( (aImageSize.Width()+8), (aImageSize.Height()+8) );
if ( bTopImage )
@@ -2855,7 +2850,7 @@ Size RadioButton::CalcMinimumSize() const
}
OUString aText = GetText();
- if ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) )
+ if (!aText.isEmpty())
{
bool bTopImage = (GetStyle() & WB_TOP) != 0;
@@ -3032,8 +3027,7 @@ void CheckBox::ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags,
pDev->Push( PushFlags::CLIPREGION | PushFlags::LINECOLOR );
pDev->IntersectClipRegion( tools::Rectangle( rPos, rSize ) );
- if ( ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) ) ||
- ( HasImage() ) )
+ if (!aText.isEmpty() || HasImage())
{
DrawTextFlags nTextStyle = Button::ImplGetTextStyle( nWinStyle, nDrawFlags );
@@ -3359,7 +3353,7 @@ void CheckBox::Resize()
void CheckBox::GetFocus()
{
- if ( GetText().isEmpty() || (ImplGetButtonState() & DrawButtonFlags::NoText) )
+ if (GetText().isEmpty())
{
// increase button size to have space for focus rect
// checkboxes without text will draw focusrect around the check
@@ -3391,7 +3385,7 @@ void CheckBox::LoseFocus()
HideFocus();
Button::LoseFocus();
- if ( GetText().isEmpty() || (ImplGetButtonState() & DrawButtonFlags::NoText) )
+ if (GetText().isEmpty())
{
// decrease button size again (see GetFocus())
// checkboxes without text will draw focusrect around the check
@@ -3672,7 +3666,7 @@ Size CheckBox::CalcMinimumSize( long nMaxWidth ) const
nMaxWidth -= aSize.Width();
OUString aText = GetText();
- if ( !aText.isEmpty() && ! (ImplGetButtonState() & DrawButtonFlags::NoText) )
+ if (!aText.isEmpty())
{
// subtract what will be added later
nMaxWidth-=2;