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 #include <config_options.h>
27 
28 
30 {
31 public:
32  explicit SpinField( vcl::Window* pParent, WinBits nWinStyle, WindowType nType = WindowType::SPINFIELD );
33  virtual ~SpinField() override;
34  virtual void dispose() override;
35 
36  virtual bool ShowDropDown( bool bShow );
37 
38  virtual void Up();
39  virtual void Down();
40  virtual void First();
41  virtual void Last();
42 
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, 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;
52 
53  void SetUpHdl( const Link<SpinField&,void>& rLink ) { maUpHdlLink = rLink; }
54  void SetDownHdl( const Link<SpinField&,void>& rLink ) { maDownHdlLink = rLink; }
55 
56  virtual Size CalcMinimumSize() const override;
57  virtual Size CalcMinimumSizeForText(const OUString &rString) const override;
58  virtual Size GetOptimalSize() const override;
59  virtual Size CalcSize(sal_Int32 nChars) const override;
60 
61  virtual FactoryFunction GetUITestFactory() const override;
62 
63 protected:
66  tools::Rectangle maDropDownRect; // not yet attached ...
67 
68  using Window::ImplInit;
69  SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
70 
71  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
72 
73  void EndDropDown();
74 
75  virtual void FillLayoutData() const override;
76  tools::Rectangle * ImplFindPartRect( const Point& rPt );
77 
78 private:
79  DECL_DLLPRIVATE_LINK( ImplTimeout, Timer*, void );
80  SAL_DLLPRIVATE void ImplInitSpinFieldData();
81  SAL_DLLPRIVATE void ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, tools::Rectangle& rDDArea, tools::Rectangle& rSpinUpArea, tools::Rectangle& rSpinDownArea );
82 
87  bool mbRepeat:1,
88  mbSpin:1,
89  mbInitialUp:1,
90  mbInitialDown:1,
91  mbUpperIn:1,
92  mbLowerIn:1,
93  mbInDropDown:1;
94 };
95 
96 #endif // INCLUDED_VCL_SPINFLD_HXX
97 
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: edit.cxx:1716
virtual Size CalcMinimumSize() const
Definition: edit.cxx:2667
DECL_DLLPRIVATE_LINK(ImplHandlePaintHdl, Timer *, void)
virtual FactoryFunction GetUITestFactory() const override
Definition: edit.cxx:2923
virtual Size CalcMinimumSizeForText(const OUString &rString) const
Definition: edit.cxx:2617
#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:216
StateChangedType
Definition: window.hxx:310
sal_Int64 WinBits
virtual void FillLayoutData() const override
Definition: edit.cxx:1710
AutoTimer maRepeatTimer
Definition: spinfld.hxx:84
tools::Rectangle maDropDownRect
Definition: spinfld.hxx:66
tools::Rectangle maLowerRect
Definition: spinfld.hxx:65
Link< SpinField &, void > maDownHdlLink
Definition: spinfld.hxx:86
virtual void Draw(OutputDevice *pDev, const Point &rPos, DrawFlags nFlags) override
Definition: edit.cxx:1735
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: edit.cxx:1352
Definition: edit.hxx:56
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:2680
DrawFlags
Definition: window.hxx:353
virtual void StateChanged(StateChangedType nType) override
Definition: edit.cxx:2152
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:302
virtual void Resize() override
Definition: edit.cxx:1722
virtual Size CalcSize(sal_Int32 nChars) const
Definition: edit.cxx:2685
WindowType
Link< SpinField &, void > maUpHdlLink
Definition: spinfld.hxx:85
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: edit.cxx:2233
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: edit.cxx:1311
QPRO_FUNC_TYPE nType
void SetUpHdl(const Link< SpinField &, void > &rLink)
Definition: spinfld.hxx:53
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:408
void SetDownHdl(const Link< SpinField &, void > &rLink)
Definition: spinfld.hxx:54
Definition: timer.hxx:26
VclPtr< Edit > mpEdit
Definition: spinfld.hxx:83
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: edit.cxx:299
tools::Rectangle maUpperRect
Definition: spinfld.hxx:64
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: ctrl.cxx:225