Kaydet (Commit) 5ccf6718 authored tarafından Tomaž Vajngerl's avatar Tomaž Vajngerl

cleanup code

Change-Id: I0fdcb3d179d87ae202199d2eb904e701bad45ab1
üst 9c869aec
This diff is collapsed.
...@@ -35,12 +35,12 @@ void SpinButton::ImplInit( vcl::Window* pParent, WinBits nStyle ) ...@@ -35,12 +35,12 @@ void SpinButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
mnValue = 0; mnValue = 0;
mnValueStep = 1; mnValueStep = 1;
maRepeatTimer.SetTimeout( GetSettings().GetMouseSettings().GetButtonStartRepeat() ); maRepeatTimer.SetTimeout(GetSettings().GetMouseSettings().GetButtonStartRepeat());
maRepeatTimer.SetTimeoutHdl( LINK( this, SpinButton, ImplTimeout ) ); maRepeatTimer.SetTimeoutHdl(LINK(this, SpinButton, ImplTimeout));
mbRepeat = 0 != ( nStyle & WB_REPEAT ); mbRepeat = 0 != (nStyle & WB_REPEAT);
if ( nStyle & WB_HSCROLL ) if (nStyle & WB_HSCROLL)
mbHorz = true; mbHorz = true;
else else
mbHorz = false; mbHorz = false;
...@@ -49,22 +49,22 @@ void SpinButton::ImplInit( vcl::Window* pParent, WinBits nStyle ) ...@@ -49,22 +49,22 @@ void SpinButton::ImplInit( vcl::Window* pParent, WinBits nStyle )
} }
SpinButton::SpinButton( vcl::Window* pParent, WinBits nStyle ) SpinButton::SpinButton( vcl::Window* pParent, WinBits nStyle )
:Control( WINDOW_SPINBUTTON ) : Control(WINDOW_SPINBUTTON)
,mbUpperIsFocused( false ) , mbUpperIsFocused(false)
{ {
ImplInit( pParent, nStyle ); ImplInit(pParent, nStyle);
} }
IMPL_LINK_TYPED( SpinButton, ImplTimeout, Timer*, pTimer, void ) IMPL_LINK_TYPED(SpinButton, ImplTimeout, Timer*, pTimer, void)
{ {
if ( pTimer->GetTimeout() == GetSettings().GetMouseSettings().GetButtonStartRepeat() ) if (pTimer->GetTimeout() == GetSettings().GetMouseSettings().GetButtonStartRepeat())
{ {
pTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonRepeat() ); pTimer->SetTimeout( GetSettings().GetMouseSettings().GetButtonRepeat() );
pTimer->Start(); pTimer->Start();
} }
else else
{ {
if ( mbInitialUp ) if (mbInitialUp)
Up(); Up();
else else
Down(); Down();
...@@ -73,57 +73,57 @@ IMPL_LINK_TYPED( SpinButton, ImplTimeout, Timer*, pTimer, void ) ...@@ -73,57 +73,57 @@ IMPL_LINK_TYPED( SpinButton, ImplTimeout, Timer*, pTimer, void )
void SpinButton::Up() void SpinButton::Up()
{ {
if ( ImplIsUpperEnabled() ) if (ImplIsUpperEnabled())
{ {
mnValue += mnValueStep; mnValue += mnValueStep;
StateChanged( StateChangedType::Data ); StateChanged(StateChangedType::Data);
ImplMoveFocus( true ); ImplMoveFocus(true);
} }
ImplCallEventListenersAndHandler( VCLEVENT_SPINBUTTON_UP, maUpHdlLink, this ); ImplCallEventListenersAndHandler(VCLEVENT_SPINBUTTON_UP, maUpHdlLink, this);
} }
void SpinButton::Down() void SpinButton::Down()
{ {
if ( ImplIsLowerEnabled() ) if (ImplIsLowerEnabled())
{ {
mnValue -= mnValueStep; mnValue -= mnValueStep;
StateChanged( StateChangedType::Data ); StateChanged(StateChangedType::Data);
ImplMoveFocus( false ); ImplMoveFocus(false);
} }
ImplCallEventListenersAndHandler( VCLEVENT_SPINBUTTON_DOWN, maDownHdlLink, this ); ImplCallEventListenersAndHandler(VCLEVENT_SPINBUTTON_DOWN, maDownHdlLink, this);
} }
void SpinButton::Resize() void SpinButton::Resize()
{ {
Control::Resize(); Control::Resize();
Size aSize( GetOutputSizePixel() ); Size aSize(GetOutputSizePixel());
Point aTmpPoint; Point aTmpPoint;
Rectangle aRect( aTmpPoint, aSize ); Rectangle aRect(aTmpPoint, aSize);
if ( mbHorz ) if (mbHorz)
{ {
maLowerRect = Rectangle( 0, 0, aSize.Width()/2, aSize.Height()-1 ); maLowerRect = Rectangle(0, 0, aSize.Width() / 2, aSize.Height() - 1);
maUpperRect = Rectangle( maLowerRect.TopRight(), aRect.BottomRight() ); maUpperRect = Rectangle(maLowerRect.TopRight(), aRect.BottomRight());
} }
else else
{ {
maUpperRect = Rectangle( 0, 0, aSize.Width()-1, aSize.Height()/2 ); maUpperRect = Rectangle(0, 0, aSize.Width() - 1, aSize.Height() / 2);
maLowerRect = Rectangle( maUpperRect.BottomLeft(), aRect.BottomRight() ); maLowerRect = Rectangle(maUpperRect.BottomLeft(), aRect.BottomRight());
} }
ImplCalcFocusRect( ImplIsUpperEnabled() || !ImplIsLowerEnabled() ); ImplCalcFocusRect(ImplIsUpperEnabled() || !ImplIsLowerEnabled());
Invalidate(); Invalidate();
} }
void SpinButton::Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) void SpinButton::Draw(OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags)
{ {
Point aPos = pDev->LogicToPixel( rPos ); Point aPos = pDev->LogicToPixel(rPos);
Size aSize = pDev->LogicToPixel( rSize ); Size aSize = pDev->LogicToPixel(rSize);
pDev->Push(); pDev->Push();
pDev->SetMapMode(); pDev->SetMapMode();
...@@ -440,30 +440,30 @@ bool SpinButton::PreNotify( NotifyEvent& rNEvt ) ...@@ -440,30 +440,30 @@ bool SpinButton::PreNotify( NotifyEvent& rNEvt )
{ {
const MouseEvent* pMouseEvt = NULL; const MouseEvent* pMouseEvt = NULL;
if( (rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != NULL ) if ((rNEvt.GetType() == MouseNotifyEvent::MOUSEMOVE) && (pMouseEvt = rNEvt.GetMouseEvent()) != NULL)
{ {
if( !pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged() ) if (!pMouseEvt->GetButtons() && !pMouseEvt->IsSynthetic() && !pMouseEvt->IsModifierChanged())
{ {
// trigger redraw if mouse over state has changed // trigger redraw if mouse over state has changed
if( IsNativeControlSupported(CTRL_SPINBOX, PART_ENTIRE_CONTROL) || if (IsNativeControlSupported(CTRL_SPINBOX, PART_ENTIRE_CONTROL) ||
IsNativeControlSupported(CTRL_SPINBOX, PART_ALL_BUTTONS) ) IsNativeControlSupported(CTRL_SPINBOX, PART_ALL_BUTTONS) )
{ {
Rectangle* pRect = ImplFindPartRect( GetPointerPosPixel() ); Rectangle* pRect = ImplFindPartRect( GetPointerPosPixel() );
Rectangle* pLastRect = ImplFindPartRect( GetLastPointerPosPixel() ); Rectangle* pLastRect = ImplFindPartRect( GetLastPointerPosPixel() );
if( pRect != pLastRect || (pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow()) ) if (pRect != pLastRect || (pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow()))
{ {
vcl::Region aRgn( GetActiveClipRegion() ); vcl::Region aRgn(GetActiveClipRegion());
if( pLastRect ) if (pLastRect)
{ {
SetClipRegion(vcl::Region(*pLastRect)); SetClipRegion(vcl::Region(*pLastRect));
Invalidate(*pLastRect); Invalidate(*pLastRect);
SetClipRegion( aRgn ); SetClipRegion( aRgn );
} }
if( pRect ) if (pRect)
{ {
SetClipRegion(vcl::Region(*pRect)); SetClipRegion(vcl::Region(*pRect));
Invalidate(*pRect); Invalidate(*pRect);
SetClipRegion( aRgn ); SetClipRegion(aRgn);
} }
} }
} }
......
This diff is collapsed.
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