summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorAkshay Deep <akshaydeepiitr@gmail.com>2016-06-19 14:38:54 +0530
committerAkshay Deep <akshaydeepiitr@gmail.com>2016-06-23 07:09:13 +0000
commit596065ff05165f5b59cfcfdcee09166931455e19 (patch)
tree9bcdab619182f085aa00611caa493e244794c6bf /vcl
parent2c1056d679187a702bad3a2ba5dcb6b068e1aa5e (diff)
GSoC tdf#87697 START CENTER: Indicate selected thumbnailview
Added new "Active" state to PushButton class Active state used in MenuToggleButton class. Active => Pressed + Flyover When hovered in Active state, Active => Flyover only Change-Id: Iece1550b6d742a7ab3c9f4c7516ec855e1a1b6ef Reviewed-on: https://gerrit.libreoffice.org/26470 Reviewed-by: Akshay Deep <akshaydeepiitr@gmail.com> Tested-by: Akshay Deep <akshaydeepiitr@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/button.cxx20
-rw-r--r--vcl/source/control/menubtn.cxx18
2 files changed, 33 insertions, 5 deletions
diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx
index 0e4dc5b16a9c..3c53cbbd7e32 100644
--- a/vcl/source/control/button.cxx
+++ b/vcl/source/control/button.cxx
@@ -642,6 +642,7 @@ void PushButton::ImplInitPushButtonData()
meState = TRISTATE_FALSE;
meSaveValue = TRISTATE_FALSE;
mnDDStyle = PushButtonDropdownStyle::NONE;
+ mbIsActive = false;
mbPressed = false;
mbInUserDraw = false;
}
@@ -951,7 +952,7 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
bool bNativeOK = false;
// adjust style if button should be rendered 'pressed'
- if (mbPressed)
+ if (mbPressed || mbIsActive)
nButtonStyle |= DrawButtonFlags::Pressed;
// TODO: move this to Window class or make it a member !!!
@@ -1004,7 +1005,7 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
ImplControlValue aControlValue;
ControlState nState = ControlState::NONE;
- if (mbPressed)
+ if (mbPressed || mbIsActive)
nState |= ControlState::PRESSED;
if (ImplGetButtonState() & DrawButtonFlags::Pressed)
nState |= ControlState::PRESSED;
@@ -1018,6 +1019,12 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
if (IsMouseOver() && aInRect.IsInside(GetPointerPosPixel()))
nState |= ControlState::ROLLOVER;
+ if ( IsMouseOver() && aInRect.IsInside(GetPointerPosPixel()) && mbIsActive)
+ {
+ nState |= ControlState::ROLLOVER;
+ nButtonStyle &= ~DrawButtonFlags::Pressed;
+ }
+
bNativeOK = rRenderContext.DrawNativeControl(aCtrlType, ControlPart::ButtonDown, aInRect, nState,
aControlValue, OUString());
}
@@ -1027,7 +1034,7 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
if (bNativeOK)
return;
- bool bRollOver = IsMouseOver() && aInRect.IsInside(GetPointerPosPixel());
+ bool bRollOver = (IsMouseOver() && aInRect.IsInside(GetPointerPosPixel()));
bool bDrawMenuSep = true;
if (GetStyle() & WB_FLATBUTTON)
{
@@ -1040,7 +1047,7 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
Rectangle aCtrlRegion(aInRect);
ControlState nState = ControlState::NONE;
- if (mbPressed || IsChecked())
+ if (mbPressed || IsChecked() || mbIsActive)
nState |= ControlState::PRESSED;
if (ImplGetButtonState() & DrawButtonFlags::Pressed)
nState |= ControlState::PRESSED;
@@ -1051,9 +1058,12 @@ void PushButton::ImplDrawPushButton(vcl::RenderContext& rRenderContext)
if (Window::IsEnabled())
nState |= ControlState::ENABLED;
- if (bRollOver)
+ if (bRollOver || mbIsActive)
nState |= ControlState::ROLLOVER;
+ if (mbIsActive && bRollOver)
+ nState &= ~ControlState::PRESSED;
+
if (GetStyle() & WB_BEVELBUTTON)
aControlValue.mbBevelButton = true;
diff --git a/vcl/source/control/menubtn.cxx b/vcl/source/control/menubtn.cxx
index 702d7201dbe5..918e10b000ab 100644
--- a/vcl/source/control/menubtn.cxx
+++ b/vcl/source/control/menubtn.cxx
@@ -168,4 +168,22 @@ void MenuButton::SetPopupMenu( PopupMenu* pNewMenu )
mpMenu = pNewMenu;
}
+//class MenuToggleButton ----------------------------------------------------
+
+MenuToggleButton::MenuToggleButton( vcl::Window* pParent, WinBits nWinBits )
+ : MenuButton( pParent, nWinBits )
+{
+}
+
+MenuToggleButton::~MenuToggleButton()
+{
+ disposeOnce();
+}
+
+void MenuToggleButton::SetActive( bool bSel )
+{
+ mbIsActive = bSel;
+}
+
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */