summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-05-14 14:15:29 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-05-14 16:13:21 +0100
commit994b9700f824869ade12b16b8a2ebe333642e9ec (patch)
treedca25ba2dcc128390ab93ac499ffc5b2605a6707 /vcl
parent6cbdd2a141d906d941831496e0e697823fac3753 (diff)
gtk3: provide a scheme where NWF can render the focus rects itself
Change-Id: Ide68e35964670f7acf7a9098b2e04451a17e335a
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/button.cxx14
-rw-r--r--vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx21
2 files changed, 33 insertions, 2 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index d545f2d4645f..f6dec45595bc 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -1657,6 +1657,20 @@ bool PushButton::set_property(const OString &rKey, const OString &rValue)
return true;
}
+void PushButton::ShowFocus(const Rectangle& rRect)
+{
+ bool bNativeOK;
+ if ((bNativeOK = IsNativeControlSupported(CTRL_PUSHBUTTON, PART_FOCUS)))
+ {
+ ImplControlValue aControlValue;
+ Rectangle aInRect(Point(), GetOutputSizePixel());
+ bNativeOK = GetOutDev()->DrawNativeControl(CTRL_PUSHBUTTON, PART_FOCUS, aInRect,
+ ControlState::FOCUSED, aControlValue, OUString());
+ }
+ if (!bNativeOK)
+ Button::ShowFocus(rRect);
+}
+
void OKButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
{
PushButton::ImplInit( pParent, nStyle );
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 37b00b1177a9..bf0e33127ee4 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -82,6 +82,7 @@ enum {
RENDER_SPINBUTTON = 9,
RENDER_COMBOBOX = 10,
RENDER_EXTENSION = 11,
+ RENDER_FOCUS = 12,
};
static void NWCalcArrowRect( const Rectangle& rButton, Rectangle& rArrow )
@@ -801,7 +802,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
{
GtkStateFlags flags;
GtkShadowType shadow;
- gint renderType = RENDER_BACKGROUND_AND_FRAME;
+ gint renderType = nPart == PART_FOCUS ? RENDER_FOCUS : RENDER_BACKGROUND_AND_FRAME;
GtkStyleContext *context = NULL;
const gchar *styleClass = NULL;
@@ -1034,6 +1035,21 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
case RENDER_COMBOBOX:
PaintCombobox(flags, cr, rControlRegion, nType, nPart, rValue);
break;
+ case RENDER_FOCUS:
+ {
+ GtkBorder border;
+
+ gtk_style_context_get_border(context, flags, &border);
+
+ nX += border.left;
+ nY += border.top;
+ nWidth -= border.left + border.right;
+ nHeight -= border.top + border.bottom;
+
+ gtk_render_focus(context, cr, nX, nY, nWidth, nHeight);
+
+ break;
+ }
default:
break;
}
@@ -1626,7 +1642,7 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
// case CTRL_PROGRESS:
// case CTRL_LISTNODE:
// case CTRL_LISTNET:
- if(nPart==PART_ENTIRE_CONTROL)
+ if (nPart==PART_ENTIRE_CONTROL || nPart == PART_FOCUS)
return true;
break;
@@ -1760,6 +1776,7 @@ void GtkData::initNWF()
pSVData->maNWFData.mbCheckBoxNeedsErase = true;
pSVData->maNWFData.mbCanDrawWidgetAnySize = true;
pSVData->maNWFData.mbDDListBoxNoTextArea = true;
+ pSVData->maNWFData.mbNoFocusRects = true;
}
void GtkData::deInitNWF()