10d63794cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 30d63794cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 40d63794cSAndrew Rist * or more contributor license agreements. See the NOTICE file 50d63794cSAndrew Rist * distributed with this work for additional information 60d63794cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 70d63794cSAndrew Rist * to you under the Apache License, Version 2.0 (the 80d63794cSAndrew Rist * "License"); you may not use this file except in compliance 90d63794cSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 110d63794cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 130d63794cSAndrew Rist * Unless required by applicable law or agreed to in writing, 140d63794cSAndrew Rist * software distributed under the License is distributed on an 150d63794cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 160d63794cSAndrew Rist * KIND, either express or implied. See the License for the 170d63794cSAndrew Rist * specific language governing permissions and limitations 180d63794cSAndrew Rist * under the License. 19cdf0e10cSrcweir * 200d63794cSAndrew Rist *************************************************************/ 210d63794cSAndrew Rist 220d63794cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _SV_SPINFLD_HXX 25cdf0e10cSrcweir #define _SV_SPINFLD_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <vcl/sv.h> 28cdf0e10cSrcweir #include <vcl/dllapi.h> 29cdf0e10cSrcweir #include <vcl/edit.hxx> 30cdf0e10cSrcweir #include <vcl/timer.hxx> 31cdf0e10cSrcweir 32cdf0e10cSrcweir // ------------- 33cdf0e10cSrcweir // - SpinField - 34cdf0e10cSrcweir // ------------- 35cdf0e10cSrcweir 36cdf0e10cSrcweir class VCL_DLLPUBLIC SpinField : public Edit 37cdf0e10cSrcweir { 38cdf0e10cSrcweir protected: 39cdf0e10cSrcweir Edit* mpEdit; 40cdf0e10cSrcweir AutoTimer maRepeatTimer; 41cdf0e10cSrcweir Rectangle maUpperRect; 42cdf0e10cSrcweir Rectangle maLowerRect; 43cdf0e10cSrcweir Rectangle maDropDownRect; // noch nicht angebunden... 44cdf0e10cSrcweir Link maUpHdlLink; 45cdf0e10cSrcweir Link maDownHdlLink; 46cdf0e10cSrcweir Link maFirstHdlLink; 47cdf0e10cSrcweir Link maLastHdlLink; 48cdf0e10cSrcweir sal_Bool mbRepeat:1, 49cdf0e10cSrcweir mbSpin:1, 50cdf0e10cSrcweir mbInitialUp:1, 51cdf0e10cSrcweir mbInitialDown:1, 52cdf0e10cSrcweir mbNoSelect:1, 53cdf0e10cSrcweir mbUpperIn:1, 54cdf0e10cSrcweir mbLowerIn:1, 55cdf0e10cSrcweir mbInDropDown:1; 56cdf0e10cSrcweir 57cdf0e10cSrcweir using Window::ImplInit; 58cdf0e10cSrcweir SAL_DLLPRIVATE void ImplInit( Window* pParent, WinBits nStyle ); 59cdf0e10cSrcweir 60cdf0e10cSrcweir private: 61cdf0e10cSrcweir DECL_DLLPRIVATE_LINK( ImplTimeout, Timer* ); 62cdf0e10cSrcweir SAL_DLLPRIVATE void ImplInitSpinFieldData(); 63cdf0e10cSrcweir SAL_DLLPRIVATE void ImplCalcButtonAreas( OutputDevice* pDev, const Size& rOutSz, Rectangle& rDDArea, Rectangle& rSpinUpArea, Rectangle& rSpinDownArea ); 64cdf0e10cSrcweir 65cdf0e10cSrcweir protected: 66*e1beba7dSHerbert Dürr explicit SpinField( WindowType nTyp ); 67cdf0e10cSrcweir 68cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 69cdf0e10cSrcweir virtual void Command( const CommandEvent& rCEvt ); 70cdf0e10cSrcweir 71cdf0e10cSrcweir void EndDropDown(); 72cdf0e10cSrcweir 73cdf0e10cSrcweir virtual void FillLayoutData() const; 74cdf0e10cSrcweir Rectangle * ImplFindPartRect( const Point& rPt ); 75cdf0e10cSrcweir public: 76*e1beba7dSHerbert Dürr explicit SpinField( Window* pParent, WinBits nWinStyle = 0 ); 77*e1beba7dSHerbert Dürr explicit SpinField( Window* pParent, const ResId& ); 78*e1beba7dSHerbert Dürr virtual ~SpinField(); 79cdf0e10cSrcweir 80cdf0e10cSrcweir virtual sal_Bool ShowDropDown( sal_Bool bShow ); 81cdf0e10cSrcweir 82cdf0e10cSrcweir virtual void Up(); 83cdf0e10cSrcweir virtual void Down(); 84cdf0e10cSrcweir virtual void First(); 85cdf0e10cSrcweir virtual void Last(); 86cdf0e10cSrcweir 87cdf0e10cSrcweir virtual void MouseButtonDown( const MouseEvent& rMEvt ); 88cdf0e10cSrcweir virtual void MouseButtonUp( const MouseEvent& rMEvt ); 89cdf0e10cSrcweir virtual void MouseMove( const MouseEvent& rMEvt ); 90cdf0e10cSrcweir virtual void Paint( const Rectangle& rRect ); 91cdf0e10cSrcweir virtual void Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ); 92cdf0e10cSrcweir virtual void Resize(); 93cdf0e10cSrcweir virtual void StateChanged( StateChangedType nType ); 94cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 95cdf0e10cSrcweir virtual long PreNotify( NotifyEvent& rNEvt ); 96cdf0e10cSrcweir SetUpHdl(const Link & rLink)97cdf0e10cSrcweir void SetUpHdl( const Link& rLink ) { maUpHdlLink = rLink; } GetUpHdl() const98cdf0e10cSrcweir const Link& GetUpHdl() const { return maUpHdlLink; } SetDownHdl(const Link & rLink)99cdf0e10cSrcweir void SetDownHdl( const Link& rLink ) { maDownHdlLink = rLink; } GetDownHdl() const100cdf0e10cSrcweir const Link& GetDownHdl() const { return maDownHdlLink; } SetFirstHdl(const Link & rLink)101cdf0e10cSrcweir void SetFirstHdl( const Link& rLink ) { maFirstHdlLink = rLink; } GetFirstHdl() const102cdf0e10cSrcweir const Link& GetFirstHdl() const { return maFirstHdlLink; } SetLastHdl(const Link & rLink)103cdf0e10cSrcweir void SetLastHdl( const Link& rLink ) { maLastHdlLink = rLink; } GetLastHdl() const104cdf0e10cSrcweir const Link& GetLastHdl() const { return maLastHdlLink; } 105cdf0e10cSrcweir 106cdf0e10cSrcweir virtual Size CalcMinimumSize() const; 107cdf0e10cSrcweir virtual Size GetOptimalSize(WindowSizeType eType) const; 108cdf0e10cSrcweir virtual Size CalcSize( sal_uInt16 nChars ) const; 109cdf0e10cSrcweir }; 110cdf0e10cSrcweir 111cdf0e10cSrcweir #endif // _SV_SPINFLD_HXX 112