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#pragma once
21
22#if !defined(VCL_DLLIMPLEMENTATION) && !defined(TOOLKIT_DLLIMPLEMENTATION) && !defined(VCL_INTERNALS)
23#error "don't use this in new code"
24#endif
25
26#include <vcl/dllapi.h>
27#include <vcl/toolkit/edit.hxx>
28#include <vcl/timer.hxx>
29
31{
32public:
33 explicit SpinField( vcl::Window* pParent, WinBits nWinStyle, WindowType nType = WindowType::SPINFIELD );
34 virtual ~SpinField() override;
35 virtual void dispose() override;
36
37 virtual bool ShowDropDown( bool bShow );
38
39 virtual void Up();
40 virtual void Down();
41 virtual void First();
42 virtual void Last();
43
44 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
45 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
46 virtual void MouseMove( const MouseEvent& rMEvt ) override;
47 virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override;
48 virtual void Draw( OutputDevice* pDev, const Point& rPos,SystemTextColorFlags nFlags ) override;
49 virtual void Resize() override;
50 virtual void StateChanged( StateChangedType nType ) override;
51 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
52 virtual bool PreNotify( NotifyEvent& rNEvt ) override;
53
54 void SetUpHdl( const Link<SpinField&,void>& rLink ) { maUpHdlLink = rLink; }
55 void SetDownHdl( const Link<SpinField&,void>& rLink ) { maDownHdlLink = rLink; }
56
57 virtual Size CalcMinimumSize() const override;
58 virtual Size CalcMinimumSizeForText(const OUString &rString) const override;
59 virtual Size GetOptimalSize() const override;
60 virtual Size CalcSize(sal_Int32 nChars) const override;
61
62 virtual FactoryFunction GetUITestFactory() const override;
63
64 SAL_DLLPRIVATE void SetUpperEnabled(bool bEnabled);
65 SAL_DLLPRIVATE void SetLowerEnabled(bool bEnabled);
66 SAL_DLLPRIVATE bool IsUpperEnabled() const { return mbUpperEnabled; }
67 SAL_DLLPRIVATE bool IsLowerEnabled() const { return mbLowerEnabled; }
68
69protected:
70 using Window::ImplInit;
71 SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
72
73 virtual bool EventNotify( NotifyEvent& rNEvt ) override;
74
75 void EndDropDown();
76
77 virtual void FillLayoutData() const override;
78 tools::Rectangle * ImplFindPartRect( const Point& rPt );
79
80private:
81 DECL_DLLPRIVATE_LINK( ImplTimeout, Timer*, void );
82 SAL_DLLPRIVATE void ImplInitSpinFieldData();
83 SAL_DLLPRIVATE void ImplCalcButtonAreas( const OutputDevice* pDev, const Size& rOutSz, tools::Rectangle& rDDArea, tools::Rectangle& rSpinUpArea, tools::Rectangle& rSpinDownArea );
84
87 tools::Rectangle maDropDownRect; // not yet attached ...
88
93 bool mbRepeat:1,
102};
103
104/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SystemTextColorFlags
An auto-timer is a multi-shot timer re-emitting itself at interval until destroyed or stopped.
Definition: timer.hxx:67
virtual bool EventNotify(NotifyEvent &rNEvt) override
Definition: ctrl.cxx:225
Definition: edit.hxx:56
virtual void Paint(vcl::RenderContext &rRenderContext, const tools::Rectangle &rRect) override
Definition: edit.cxx:1714
SAL_DLLPRIVATE void ImplInit(vcl::Window *pParent, WinBits nStyle)
Definition: edit.cxx:306
virtual void dispose() override
This is intended to be used to clear any locally held references to other Window-subclass objects.
Definition: edit.cxx:225
virtual Size CalcSize(sal_Int32 nChars) const
Definition: edit.cxx:2673
virtual Size GetOptimalSize() const override
Definition: edit.cxx:2668
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: edit.cxx:1906
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: edit.cxx:2241
virtual Size CalcMinimumSize() const
Definition: edit.cxx:2663
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: edit.cxx:1310
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
Definition: edit.cxx:1351
virtual Size CalcMinimumSizeForText(const OUString &rString) const
Definition: edit.cxx:2613
virtual void FillLayoutData() const override
Definition: edit.cxx:1708
virtual FactoryFunction GetUITestFactory() const override
Definition: edit.cxx:2918
virtual void Draw(OutputDevice *pDev, const Point &rPos, SystemTextColorFlags nFlags) override
Definition: edit.cxx:1733
virtual void Resize() override
Definition: edit.cxx:1720
virtual void StateChanged(StateChangedType nType) override
Definition: edit.cxx:2160
Some things multiple-inherit from VclAbstractDialog and OutputDevice, so we need to use virtual inher...
Definition: outdev.hxx:170
bool mbLowerIn
Definition: spinfld.hxx:98
Link< SpinField &, void > maUpHdlLink
Definition: spinfld.hxx:91
Link< SpinField &, void > maDownHdlLink
Definition: spinfld.hxx:92
void SetDownHdl(const Link< SpinField &, void > &rLink)
Definition: spinfld.hxx:55
bool mbRepeat
Definition: spinfld.hxx:93
bool mbSpin
Definition: spinfld.hxx:94
bool mbUpperIn
Definition: spinfld.hxx:97
bool mbLowerEnabled
Definition: spinfld.hxx:101
VclPtr< Edit > mpEdit
Definition: spinfld.hxx:89
SAL_DLLPRIVATE bool IsLowerEnabled() const
Definition: spinfld.hxx:67
bool mbInitialDown
Definition: spinfld.hxx:96
SAL_DLLPRIVATE bool IsUpperEnabled() const
Definition: spinfld.hxx:66
DECL_DLLPRIVATE_LINK(ImplTimeout, Timer *, void)
tools::Rectangle maUpperRect
Definition: spinfld.hxx:85
void SetUpHdl(const Link< SpinField &, void > &rLink)
Definition: spinfld.hxx:54
tools::Rectangle maLowerRect
Definition: spinfld.hxx:86
tools::Rectangle maDropDownRect
Definition: spinfld.hxx:87
bool mbInitialUp
Definition: spinfld.hxx:95
bool mbInDropDown
Definition: spinfld.hxx:99
AutoTimer maRepeatTimer
Definition: spinfld.hxx:90
bool mbUpperEnabled
Definition: spinfld.hxx:100
Definition: timer.hxx:27
virtual void MouseMove(const MouseEvent &rMEvt)
Definition: mouse.cxx:414
#define VCL_DLLPUBLIC
Definition: dllapi.h:29
std::function< std::unique_ptr< UIObject >(vcl::Window *)> FactoryFunction
QPRO_FUNC_TYPE nType
StateChangedType
Definition: window.hxx:291
sal_Int64 WinBits
Definition: wintypes.hxx:109
WindowType
Definition: wintypes.hxx:27