LibreOffice Module vcl (master)  1
spinfld.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_VCL_SPINFLD_HXX
21 #define INCLUDED_VCL_SPINFLD_HXX
22 
23 #include <vcl/dllapi.h>
24 #include <vcl/edit.hxx>
25 #include <vcl/timer.hxx>
26 
27 
29 {
30 public:
31  explicit SpinField( vcl::Window* pParent, WinBits nWinStyle );
32  virtual ~SpinField() override;
33  virtual void dispose() override;
34 
35  virtual bool ShowDropDown( bool bShow );
36 
37  virtual void Up();
38  virtual void Down();
39  virtual void First();
40  virtual void Last();
41 
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;
51 
52  void SetUpHdl( const Link<SpinField&,void>& rLink ) { maUpHdlLink = rLink; }
53  void SetDownHdl( const Link<SpinField&,void>& rLink ) { maDownHdlLink = rLink; }
54 
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;
59 
60  virtual FactoryFunction GetUITestFactory() const override;
61 
62 protected:
65  tools::Rectangle maDropDownRect; // not yet attached ...
66 
67  using Window::ImplInit;
68  SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
69 
70  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
71 
72  void EndDropDown();
73 
74  virtual void FillLayoutData() const override;
75  tools::Rectangle * ImplFindPartRect( const Point& rPt );
76 
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 );
81 
86  bool mbRepeat:1,
87  mbSpin:1,
88  mbInitialUp:1,
89  mbInitialDown:1,
90  mbUpperIn:1,
91  mbLowerIn:1,
92  mbInDropDown:1;
93 };
94 
95 #endif // INCLUDED_VCL_SPINFLD_HXX
96 
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: edit.cxx:1709
virtual Size CalcMinimumSize() const
Definition: edit.cxx:2669
DECL_DLLPRIVATE_LINK(ImplHandlePaintHdl, Timer *, void)
virtual FactoryFunction GetUITestFactory() const override
Definition: edit.cxx:2927
virtual Size CalcMinimumSizeForText(const OUString &rString) const
Definition: edit.cxx:2619
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
std::function< std::unique_ptr< UIObject >vcl::Window *)> FactoryFunction
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects...
Definition: edit.cxx:213
StateChangedType
Definition: window.hxx:311
sal_Int64 WinBits
virtual void FillLayoutData() const override
Definition: edit.cxx:1703
AutoTimer maRepeatTimer
Definition: spinfld.hxx:83
tools::Rectangle maDropDownRect
Definition: spinfld.hxx:65
tools::Rectangle maLowerRect
Definition: spinfld.hxx:64
Link< SpinField &, void > maDownHdlLink
Definition: spinfld.hxx:85
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: edit.cxx:1345
Definition: edit.hxx:57
An auto-timer is a multi-shot timer re-emitting itself at interval until destroyed or stopped...
Definition: timer.hxx:72
virtual bool PreNotify(NotifyEvent &rNEvt)
Definition: event.cxx:51
virtual Size GetOptimalSize() const override
Definition: edit.cxx:2682
DrawFlags
Definition: window.hxx:354
virtual void StateChanged(StateChangedType nType) override
Definition: edit.cxx:2145
QPRO_FUNC_TYPE const nType
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:304
virtual void Resize() override
Definition: edit.cxx:1715
virtual Size CalcSize(sal_Int32 nChars) const
Definition: edit.cxx:2687
Link< SpinField &, void > maUpHdlLink
Definition: spinfld.hxx:84
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: edit.cxx:2226
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: edit.cxx:1304
void SetUpHdl(const Link< SpinField &, void > &rLink)
Definition: spinfld.hxx:52
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:407
void SetDownHdl(const Link< SpinField &, void > &rLink)
Definition: spinfld.hxx:53
Definition: timer.hxx:26
virtual void Draw(OutputDevice *pDev, const Point &rPos, const Size &rSize, DrawFlags nFlags) override
Definition: edit.cxx:1728
VclPtr< Edit > mpEdit
Definition: spinfld.hxx:82
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: edit.cxx:297
tools::Rectangle maUpperRect
Definition: spinfld.hxx:63
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: ctrl.cxx:225