Bump version to 6.4-15
[LibreOffice.git] / include / vcl / spinfld.hxx
blob8fb21f8605fde5c242d2e59f88418e4ff98a5417
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 <vcl/dllapi.h>
24 #include <vcl/edit.hxx>
25 #include <vcl/timer.hxx>
28 class VCL_DLLPUBLIC SpinField : public Edit
30 public:
31 explicit SpinField( vcl::Window* pParent, WinBits nWinStyle, WindowType nType = WindowType::SPINFIELD );
32 virtual ~SpinField() override;
33 virtual void dispose() override;
35 virtual bool ShowDropDown( bool bShow );
37 virtual void Up();
38 virtual void Down();
39 virtual void First();
40 virtual void Last();
42 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
43 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
44 virtual void MouseMove( const MouseEvent& rMEvt ) override;
45 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
46 virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, DrawFlags nFlags ) override;
47 virtual void Resize() override;
48 virtual void StateChanged( StateChangedType nType ) override;
49 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
50 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
52 void SetUpHdl( const Link<SpinField&,void>& rLink ) { maUpHdlLink = rLink; }
53 void SetDownHdl( const Link<SpinField&,void>& rLink ) { maDownHdlLink = rLink; }
55 virtual Size CalcMinimumSize() const override;
56 virtual Size CalcMinimumSizeForText(const OUString &rString) const override;
57 virtual Size GetOptimalSize() const override;
58 virtual Size CalcSize(sal_Int32 nChars) const override;
60 virtual FactoryFunction GetUITestFactory() const override;
62 protected:
63 tools::Rectangle maUpperRect;
64 tools::Rectangle maLowerRect;
65 tools::Rectangle maDropDownRect; // not yet attached ...
67 using Window::ImplInit;
68 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
70 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
72 void EndDropDown();
74 virtual void FillLayoutData() const override;
75 tools::Rectangle * ImplFindPartRect( const Point& rPt );
77 private:
78 DECL_DLLPRIVATE_LINK( ImplTimeout, Timer*, void );
79 SAL_DLLPRIVATE void ImplInitSpinFieldData();
80 SAL_DLLPRIVATE void ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, tools::Rectangle& rDDArea, tools::Rectangle& rSpinUpArea, tools::Rectangle& rSpinDownArea );
82 VclPtr<Edit> mpEdit;
83 AutoTimer maRepeatTimer;
84 Link<SpinField&,void> maUpHdlLink;
85 Link<SpinField&,void> maDownHdlLink;
86 bool mbRepeat:1,
87 mbSpin:1,
88 mbInitialUp:1,
89 mbInitialDown:1,
90 mbUpperIn:1,
91 mbLowerIn:1,
92 mbInDropDown:1;
95 #endif // INCLUDED_VCL_SPINFLD_HXX
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */