Kaydet (Commit) 994b9700 authored tarafından Caolán McNamara's avatar Caolán McNamara

gtk3: provide a scheme where NWF can render the focus rects itself

Change-Id: Ide68e35964670f7acf7a9098b2e04451a17e335a
üst 6cbdd2a1
...@@ -203,6 +203,7 @@ public: ...@@ -203,6 +203,7 @@ public:
void SetToggleHdl( const Link<>& rLink ) { maToggleHdl = rLink; } void SetToggleHdl( const Link<>& rLink ) { maToggleHdl = rLink; }
const Link<>& GetToggleHdl() const { return maToggleHdl; } const Link<>& GetToggleHdl() const { return maToggleHdl; }
virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE; virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
virtual void ShowFocus(const Rectangle& rRect) SAL_OVERRIDE;
}; };
inline void PushButton::Check( bool bCheck ) inline void PushButton::Check( bool bCheck )
......
...@@ -225,6 +225,9 @@ typedef sal_uInt32 ControlPart; ...@@ -225,6 +225,9 @@ typedef sal_uInt32 ControlPart;
//to draw natively the border of frames //to draw natively the border of frames
#define PART_BORDER 7000 #define PART_BORDER 7000
//to draw natively the focus rects
#define PART_FOCUS 8000
/* Control State: /* Control State:
* *
* Specify how a particular part of the control * Specify how a particular part of the control
......
...@@ -1100,7 +1100,7 @@ public: ...@@ -1100,7 +1100,7 @@ public:
/// Add all children to @rAllChildren recursively. /// Add all children to @rAllChildren recursively.
SAL_DLLPRIVATE void CollectChildren(::std::vector<vcl::Window *>& rAllChildren ); SAL_DLLPRIVATE void CollectChildren(::std::vector<vcl::Window *>& rAllChildren );
void ShowFocus( const Rectangle& rRect ); virtual void ShowFocus(const Rectangle& rRect);
void HideFocus(); void HideFocus();
void Invert( const Rectangle& rRect, sal_uInt16 nFlags = 0 ); void Invert( const Rectangle& rRect, sal_uInt16 nFlags = 0 );
......
...@@ -1657,6 +1657,20 @@ bool PushButton::set_property(const OString &rKey, const OString &rValue) ...@@ -1657,6 +1657,20 @@ bool PushButton::set_property(const OString &rKey, const OString &rValue)
return true; 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 ) void OKButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
{ {
PushButton::ImplInit( pParent, nStyle ); PushButton::ImplInit( pParent, nStyle );
......
...@@ -82,6 +82,7 @@ enum { ...@@ -82,6 +82,7 @@ enum {
RENDER_SPINBUTTON = 9, RENDER_SPINBUTTON = 9,
RENDER_COMBOBOX = 10, RENDER_COMBOBOX = 10,
RENDER_EXTENSION = 11, RENDER_EXTENSION = 11,
RENDER_FOCUS = 12,
}; };
static void NWCalcArrowRect( const Rectangle& rButton, Rectangle& rArrow ) static void NWCalcArrowRect( const Rectangle& rButton, Rectangle& rArrow )
...@@ -801,7 +802,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co ...@@ -801,7 +802,7 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
{ {
GtkStateFlags flags; GtkStateFlags flags;
GtkShadowType shadow; GtkShadowType shadow;
gint renderType = RENDER_BACKGROUND_AND_FRAME; gint renderType = nPart == PART_FOCUS ? RENDER_FOCUS : RENDER_BACKGROUND_AND_FRAME;
GtkStyleContext *context = NULL; GtkStyleContext *context = NULL;
const gchar *styleClass = NULL; const gchar *styleClass = NULL;
...@@ -1034,6 +1035,21 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co ...@@ -1034,6 +1035,21 @@ bool GtkSalGraphics::drawNativeControl( ControlType nType, ControlPart nPart, co
case RENDER_COMBOBOX: case RENDER_COMBOBOX:
PaintCombobox(flags, cr, rControlRegion, nType, nPart, rValue); PaintCombobox(flags, cr, rControlRegion, nType, nPart, rValue);
break; 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: default:
break; break;
} }
...@@ -1626,7 +1642,7 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP ...@@ -1626,7 +1642,7 @@ bool GtkSalGraphics::IsNativeControlSupported( ControlType nType, ControlPart nP
// case CTRL_PROGRESS: // case CTRL_PROGRESS:
// case CTRL_LISTNODE: // case CTRL_LISTNODE:
// case CTRL_LISTNET: // case CTRL_LISTNET:
if(nPart==PART_ENTIRE_CONTROL) if (nPart==PART_ENTIRE_CONTROL || nPart == PART_FOCUS)
return true; return true;
break; break;
...@@ -1760,6 +1776,7 @@ void GtkData::initNWF() ...@@ -1760,6 +1776,7 @@ void GtkData::initNWF()
pSVData->maNWFData.mbCheckBoxNeedsErase = true; pSVData->maNWFData.mbCheckBoxNeedsErase = true;
pSVData->maNWFData.mbCanDrawWidgetAnySize = true; pSVData->maNWFData.mbCanDrawWidgetAnySize = true;
pSVData->maNWFData.mbDDListBoxNoTextArea = true; pSVData->maNWFData.mbDDListBoxNoTextArea = true;
pSVData->maNWFData.mbNoFocusRects = true;
} }
void GtkData::deInitNWF() void GtkData::deInitNWF()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment