1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_SPINFLD_HXX
21 #define INCLUDED_VCL_SPINFLD_HXX
23 #include <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/edit.hxx>
26 #include <vcl/timer.hxx>
29 class VCL_DLLPUBLIC SpinField
: public Edit
32 explicit SpinField( vcl::Window
* pParent
, WinBits nWinStyle
);
33 virtual ~SpinField() override
;
34 virtual void dispose() override
;
36 virtual bool ShowDropDown( bool bShow
);
43 virtual void MouseButtonDown( const MouseEvent
& rMEvt
) override
;
44 virtual void MouseButtonUp( const MouseEvent
& rMEvt
) override
;
45 virtual void MouseMove( const MouseEvent
& rMEvt
) override
;
46 virtual void Paint( vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
47 virtual void Draw( OutputDevice
* pDev
, const Point
& rPos
, const Size
& rSize
, DrawFlags nFlags
) override
;
48 virtual void Resize() override
;
49 virtual void StateChanged( StateChangedType nType
) override
;
50 virtual void DataChanged( const DataChangedEvent
& rDCEvt
) override
;
51 virtual bool PreNotify( NotifyEvent
& rNEvt
) override
;
53 void SetUpHdl( const Link
<SpinField
&,void>& rLink
) { maUpHdlLink
= rLink
; }
54 void SetDownHdl( const Link
<SpinField
&,void>& rLink
) { maDownHdlLink
= rLink
; }
55 const Link
<SpinField
&,void>& GetDownHdl() const { return maDownHdlLink
; }
56 void SetFirstHdl( const Link
<SpinField
&,void>& rLink
) { maFirstHdlLink
= rLink
; }
57 void SetLastHdl( const Link
<SpinField
&,void>& rLink
) { maLastHdlLink
= rLink
; }
59 virtual Size
CalcMinimumSize() const override
;
60 virtual Size
CalcMinimumSizeForText(const OUString
&rString
) const override
;
61 virtual Size
GetOptimalSize() const override
;
62 virtual Size
CalcSize(sal_Int32 nChars
) const override
;
64 virtual FactoryFunction
GetUITestFactory() const override
;
67 tools::Rectangle maUpperRect
;
68 tools::Rectangle maLowerRect
;
69 tools::Rectangle maDropDownRect
; // not yet attached ...
71 using Window::ImplInit
;
72 SAL_DLLPRIVATE
void ImplInit( vcl::Window
* pParent
, WinBits nStyle
);
74 virtual bool EventNotify( NotifyEvent
& rNEvt
) override
;
78 virtual void FillLayoutData() const override
;
79 tools::Rectangle
* ImplFindPartRect( const Point
& rPt
);
82 DECL_DLLPRIVATE_LINK( ImplTimeout
, Timer
*, void );
83 SAL_DLLPRIVATE
void ImplInitSpinFieldData();
84 SAL_DLLPRIVATE
void ImplCalcButtonAreas( OutputDevice
* pDev
, const Size
& rOutSz
, tools::Rectangle
& rDDArea
, tools::Rectangle
& rSpinUpArea
, tools::Rectangle
& rSpinDownArea
);
87 AutoTimer maRepeatTimer
;
88 Link
<SpinField
&,void> maUpHdlLink
;
89 Link
<SpinField
&,void> maDownHdlLink
;
90 Link
<SpinField
&,void> maFirstHdlLink
;
91 Link
<SpinField
&,void> maLastHdlLink
;
102 #endif // INCLUDED_VCL_SPINFLD_HXX
104 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */