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 _SV_SPINFLD_HXX
21 #define _SV_SPINFLD_HXX
23 #include <tools/solar.h>
24 #include <vcl/dllapi.h>
25 #include <vcl/edit.hxx>
26 #include <vcl/timer.hxx>
32 class VCL_DLLPUBLIC SpinField
: public Edit
36 AutoTimer maRepeatTimer
;
37 Rectangle maUpperRect
;
38 Rectangle maLowerRect
;
39 Rectangle maDropDownRect
; // noch nicht angebunden...
53 using Window::ImplInit
;
54 SAL_DLLPRIVATE
void ImplInit( Window
* pParent
, WinBits nStyle
);
57 DECL_DLLPRIVATE_LINK( ImplTimeout
, Timer
* );
58 SAL_DLLPRIVATE
void ImplInitSpinFieldData();
59 SAL_DLLPRIVATE
void ImplCalcButtonAreas( OutputDevice
* pDev
, const Size
& rOutSz
, Rectangle
& rDDArea
, Rectangle
& rSpinUpArea
, Rectangle
& rSpinDownArea
);
62 explicit SpinField( WindowType nTyp
);
64 virtual long Notify( NotifyEvent
& rNEvt
);
65 virtual void Command( const CommandEvent
& rCEvt
);
69 virtual void FillLayoutData() const;
70 Rectangle
* ImplFindPartRect( const Point
& rPt
);
73 explicit SpinField( Window
* pParent
, WinBits nWinStyle
= 0 );
74 explicit SpinField( Window
* pParent
, const ResId
& );
77 virtual sal_Bool
ShowDropDown( sal_Bool bShow
);
84 virtual void MouseButtonDown( const MouseEvent
& rMEvt
);
85 virtual void MouseButtonUp( const MouseEvent
& rMEvt
);
86 virtual void MouseMove( const MouseEvent
& rMEvt
);
87 virtual void Paint( const Rectangle
& rRect
);
88 virtual void Draw( OutputDevice
* pDev
, const Point
& rPos
, const Size
& rSize
, sal_uLong nFlags
);
89 virtual void Resize();
90 virtual void StateChanged( StateChangedType nType
);
91 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
92 virtual long PreNotify( NotifyEvent
& rNEvt
);
94 void SetUpHdl( const Link
& rLink
) { maUpHdlLink
= rLink
; }
95 const Link
& GetUpHdl() const { return maUpHdlLink
; }
96 void SetDownHdl( const Link
& rLink
) { maDownHdlLink
= rLink
; }
97 const Link
& GetDownHdl() const { return maDownHdlLink
; }
98 void SetFirstHdl( const Link
& rLink
) { maFirstHdlLink
= rLink
; }
99 const Link
& GetFirstHdl() const { return maFirstHdlLink
; }
100 void SetLastHdl( const Link
& rLink
) { maLastHdlLink
= rLink
; }
101 const Link
& GetLastHdl() const { return maLastHdlLink
; }
103 virtual Size
CalcMinimumSize() const;
104 virtual Size
CalcMinimumSizeForText(const OUString
&rString
) const;
105 virtual Size
GetOptimalSize() const;
106 virtual Size
CalcSize( sal_uInt16 nChars
) const;
109 #endif // _SV_SPINFLD_HXX
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */