[Libreoffice-commits] core.git: include/vcl vcl/source vcl/unx

Caolán McNamara caolanm at redhat.com
Thu May 14 12:35:18 PDT 2015


 include/vcl/button.hxx                        |    1 +
 vcl/source/control/button.cxx                 |   21 +++++++++++++++++++++
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |    2 +-
 3 files changed, 23 insertions(+), 1 deletion(-)

New commits:
commit 73cc6d76b598c2028fda65d578ce57affd96cb6f
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 14 20:32:41 2015 +0100

    gtk3: shiny native focus rectangles for radiobuttons
    
    Change-Id: I8f709cd0683c1a244d6b8c269c75b7f841824926

diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx
index ef64257..f8bfddf 100644
--- a/include/vcl/button.hxx
+++ b/include/vcl/button.hxx
@@ -402,6 +402,7 @@ public:
      * Group this RadioButton with another
      */
     void group(RadioButton &rOther);
+    virtual void ShowFocus(const Rectangle& rRect) SAL_OVERRIDE;
 };
 
 
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 75b2fe3..82af4fa 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -2916,6 +2916,27 @@ Size RadioButton::GetOptimalSize() const
     return CalcMinimumSize();
 }
 
+void RadioButton::ShowFocus(const Rectangle& rRect)
+{
+    if (IsNativeControlSupported(CTRL_RADIOBUTTON, PART_FOCUS))
+    {
+        ImplControlValue aControlValue;
+        Rectangle aInRect(Point(0, 0), GetSizePixel());
+
+        aInRect.Left() = rRect.Left();  // exclude the radio element itself from the focusrect
+
+        //to-do, figure out a better solution here
+        aInRect.Left()-=2;
+        aInRect.Right()+=2;
+        aInRect.Top()-=2;
+        aInRect.Bottom()+=2;
+
+        DrawNativeControl(CTRL_RADIOBUTTON, PART_FOCUS, aInRect,
+                          ControlState::FOCUSED, aControlValue, OUString());
+    }
+    Button::ShowFocus(rRect);
+}
+
 void CheckBox::ImplInitCheckBoxData()
 {
     meState         = TRISTATE_FALSE;
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index 9db5f72..ea60f09 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -902,7 +902,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
                 ( (rValue.getTristateVal() == BUTTONVALUE_ON) ? CHECKED : GTK_STATE_FLAG_NORMAL));
         context = mpCheckButtonStyle;
         styleClass = GTK_STYLE_CLASS_RADIO;
-        renderType = RENDER_RADIO;
+        renderType = nPart == PART_FOCUS ? RENDER_FOCUS : RENDER_RADIO;
         break;
     case CTRL_PUSHBUTTON:
         context = mpButtonStyle;


More information about the Libreoffice-commits mailing list