diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-05-14 20:32:41 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-05-14 20:34:56 +0100 |
commit | 73cc6d76b598c2028fda65d578ce57affd96cb6f (patch) | |
tree | 045f49a057bc09edd1ffa94a4fee78c6a299e66d /vcl | |
parent | 415454cfbc6add8534e1dcff1ff16cc8dcc9296c (diff) |
gtk3: shiny native focus rectangles for radiobuttons
Change-Id: I8f709cd0683c1a244d6b8c269c75b7f841824926
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/control/button.cxx | 21 | ||||
-rw-r--r-- | vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 2 |
2 files changed, 22 insertions, 1 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 75b2fe360723..82af4fa81ec2 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 9db5f72b9014..ea60f09ccf80 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; |