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

Caolán McNamara caolanm at redhat.com
Thu May 14 08:45:24 PDT 2015


 vcl/inc/ilstbox.hxx                           |    2 ++
 vcl/source/control/ilstbox.cxx                |   16 ++++++++++++++++
 vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx |    4 ++--
 3 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit f6a04cb509a2c12932c6be789fdc0cdb9d447aad
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu May 14 16:44:10 2015 +0100

    gtk3: shiny native focus rectangles for listboxes
    
    Change-Id: Id0ace0ae5e90877497834166c5e488a0f5caf0be

diff --git a/vcl/inc/ilstbox.hxx b/vcl/inc/ilstbox.hxx
index 180b9f1..155e03f 100644
--- a/vcl/inc/ilstbox.hxx
+++ b/vcl/inc/ilstbox.hxx
@@ -600,6 +600,8 @@ public:
 
     bool GetEdgeBlending() const { return mbEdgeBlending; }
     void SetEdgeBlending(bool bNew) { mbEdgeBlending = bNew; }
+
+    virtual void    ShowFocus(const Rectangle& rRect) SAL_OVERRIDE;
 };
 
 class ImplBtn : public PushButton
diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx
index d624398..cb6f861 100644
--- a/vcl/source/control/ilstbox.cxx
+++ b/vcl/source/control/ilstbox.cxx
@@ -2889,6 +2889,22 @@ void ImplWin::LoseFocus()
     Control::LoseFocus();
 }
 
+void ImplWin::ShowFocus(const Rectangle& rRect)
+{
+    bool bNativeOK;
+    if ((bNativeOK = IsNativeControlSupported(CTRL_LISTBOX, PART_FOCUS)))
+    {
+        ImplControlValue aControlValue;
+
+        vcl::Window *pWin = GetParent();
+        Rectangle aParentRect(Point(0, 0), pWin->GetSizePixel());
+        bNativeOK = pWin->DrawNativeControl(CTRL_LISTBOX, PART_FOCUS, aParentRect,
+                                            ControlState::FOCUSED, aControlValue, OUString());
+    }
+    if (!bNativeOK)
+        Control::ShowFocus(rRect);
+}
+
 ImplBtn::ImplBtn( vcl::Window* pParent, WinBits nWinStyle ) :
     PushButton(  pParent, nWinStyle ),
     mbDown  ( false )
diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
index bf0e331..d05f86b 100644
--- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
+++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx
@@ -828,7 +828,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
         break;
     case CTRL_LISTBOX:
         context = mpListboxStyle;
-        renderType = RENDER_COMBOBOX;
+        renderType = nPart == PART_FOCUS ? RENDER_FOCUS : RENDER_COMBOBOX;
         break;
     case CTRL_MENU_POPUP:
 
@@ -1682,7 +1682,7 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
             break;
 
         case CTRL_LISTBOX:
-            if (nPart==PART_ENTIRE_CONTROL || nPart==PART_WINDOW || nPart==HAS_BACKGROUND_TEXTURE)
+            if (nPart==PART_ENTIRE_CONTROL || nPart==PART_WINDOW || nPart==HAS_BACKGROUND_TEXTURE || nPart == PART_FOCUS)
                 return true;
             break;
 


More information about the Libreoffice-commits mailing list