summaryrefslogtreecommitdiff
path: root/vcl/source/control/ctrl.cxx
diff options
context:
space:
mode:
authorSimon Long <simon@raspberrypi.org>2015-07-08 18:02:50 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-07-09 15:07:24 +0000
commit74407aef94b6d8dfdd69891c4a6e578587ef3e71 (patch)
treecc8c8f9cde981f90760cb7fdaa02688713989f83 /vcl/source/control/ctrl.cxx
parent40ade8d04380083e383d6a6e50e5c254fcde2b2f (diff)
tdf#92630 Enable auto-accelerator behaviour for gtk
Change-Id: I671177dd1f9e535c28a29bcbd6b74f1c789371ea Reviewed-on: https://gerrit.libreoffice.org/16883 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/control/ctrl.cxx')
-rw-r--r--vcl/source/control/ctrl.cxx29
1 files changed, 26 insertions, 3 deletions
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 21056db4c58f..59d3389bc47a 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -38,6 +38,7 @@ void Control::ImplInitControlData()
mbHasControlFocus = false;
mbFont = false;
mbForeground = false;
+ mbShowAccelerator = false;
mpControlData = new ImplControlData;
}
@@ -379,6 +380,16 @@ void Control::ImplDrawFrame( OutputDevice* pDev, Rectangle& rRect )
pDev->OutputDevice::SetSettings( aOriginalSettings );
}
+void Control::SetShowAccelerator(bool bVal)
+{
+ mbShowAccelerator = bVal;
+};
+
+bool Control::GetShowAccelerator() const
+{
+ return mbShowAccelerator;
+}
+
ControlLayoutData::~ControlLayoutData()
{
if( m_pParent )
@@ -442,15 +453,27 @@ void Control::ImplInitSettings(const bool _bFont, const bool _bForeground)
void Control::DrawControlText( OutputDevice& _rTargetDevice, Rectangle& _io_rRect, const OUString& _rStr,
DrawTextFlags _nStyle, MetricVector* _pVector, OUString* _pDisplayText ) const
{
+ OUString rPStr = _rStr;
+ DrawTextFlags nPStyle = _nStyle;
+
+ bool accel = ImplGetSVData()->maNWFData.mbEnableAccel;
+ bool autoacc = ImplGetSVData()->maNWFData.mbAutoAccel;
+
+ if (!accel || (autoacc && !mbShowAccelerator))
+ {
+ rPStr = GetNonMnemonicString( _rStr );
+ nPStyle &= ~DrawTextFlags::HideMnemonic;
+ }
+
if ( !mpControlData->mpReferenceDevice || ( mpControlData->mpReferenceDevice == &_rTargetDevice ) )
{
- _io_rRect = _rTargetDevice.GetTextRect( _io_rRect, _rStr, _nStyle );
- _rTargetDevice.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText );
+ _io_rRect = _rTargetDevice.GetTextRect( _io_rRect, rPStr, nPStyle );
+ _rTargetDevice.DrawText( _io_rRect, rPStr, nPStyle, _pVector, _pDisplayText );
}
else
{
ControlTextRenderer aRenderer( *this, _rTargetDevice, *mpControlData->mpReferenceDevice );
- _io_rRect = aRenderer.DrawText( _io_rRect, _rStr, _nStyle, _pVector, _pDisplayText );
+ _io_rRect = aRenderer.DrawText( _io_rRect, rPStr, nPStyle, _pVector, _pDisplayText );
}
}