LCOV - code coverage report
Current view: top level - libreoffice/solver/unxlngi6.pro/inc/vcl - spin.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 9 0.0 %
Date: 2012-12-27 Functions: 0 7 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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 _SV_SPIN_HXX
      21             : #define _SV_SPIN_HXX
      22             : 
      23             : #include <tools/solar.h>
      24             : #include <vcl/dllapi.h>
      25             : #include <vcl/ctrl.hxx>
      26             : #include <vcl/timer.hxx>
      27             : 
      28             : // --------------
      29             : // - SpinButton -
      30             : // --------------
      31             : 
      32             : class VCL_DLLPUBLIC SpinButton : public Control
      33             : {
      34             : private:
      35             :     AutoTimer       maRepeatTimer;
      36             :     Rectangle       maUpperRect;
      37             :     Rectangle       maLowerRect;
      38             :     Rectangle       maFocusRect;
      39             :     sal_Bool            mbRepeat         : 1;
      40             :     sal_Bool            mbUpperIn        : 1;
      41             :     sal_Bool            mbLowerIn        : 1;
      42             :     sal_Bool            mbInitialUp      : 1;
      43             :     sal_Bool            mbInitialDown    : 1;
      44             :     sal_Bool            mbHorz           : 1;
      45             :     sal_Bool            mbUpperIsFocused : 1;
      46             :     Link            maUpHdlLink;
      47             :     Link            maDownHdlLink;
      48             :     long            mnMinRange;
      49             :     long            mnMaxRange;
      50             :     long            mnValue;
      51             :     long            mnValueStep;
      52             : 
      53             :     SAL_DLLPRIVATE Rectangle* ImplFindPartRect( const Point& rPt );
      54             :     using Window::ImplInit;
      55             :     SAL_DLLPRIVATE void       ImplInit( Window* pParent, WinBits nStyle );
      56             :     DECL_DLLPRIVATE_LINK(     ImplTimeout, Timer* );
      57             : 
      58             : public:
      59             :                     SpinButton( Window* pParent, WinBits nStyle = 0 );
      60             :                     ~SpinButton();
      61             : 
      62             :     virtual void    Up();
      63             :     virtual void    Down();
      64             : 
      65             :     virtual void    Resize();
      66             :     virtual void    Paint( const Rectangle& rRect );
      67             :     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags );
      68             :     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
      69             :     virtual void    MouseButtonUp( const MouseEvent& rMEvt );
      70             :     virtual void    MouseMove( const MouseEvent& rMEvt );
      71             :     virtual void    KeyInput( const KeyEvent& rKEvt );
      72             :     virtual void    StateChanged( StateChangedType nStateChange );
      73             :     virtual void    GetFocus();
      74             :     virtual void    LoseFocus();
      75             : 
      76             :     void            SetRangeMin( long nNewRange );
      77           0 :     long            GetRangeMin() const { return mnMinRange; }
      78             :     void            SetRangeMax( long nNewRange );
      79           0 :     long            GetRangeMax() const { return mnMaxRange; }
      80             :     void            SetRange( const Range& rRange );
      81             :     Range           GetRange() const { return Range( GetRangeMin(), GetRangeMax() ); }
      82             :     void            SetValue( long nValue );
      83           0 :     long            GetValue() const { return mnValue; }
      84           0 :     void            SetValueStep( long nNewStep ) { mnValueStep = nNewStep; }
      85           0 :     long            GetValueStep() const { return mnValueStep; }
      86             :     virtual long    PreNotify( NotifyEvent& rNEvt );
      87             : 
      88             :     void            SetUpHdl( const Link& rLink ) { maUpHdlLink = rLink; }
      89             :     const Link&     GetUpHdl() const   { return maUpHdlLink;   }
      90             :     void            SetDownHdl( const Link& rLink ) { maDownHdlLink = rLink; }
      91             :     const Link&     GetDownHdl() const { return maDownHdlLink; }
      92             : 
      93             : private:
      94             :     // moves the focus to the upper or lower rect. Return sal_True if the focus rect actually changed.
      95             :     SAL_DLLPRIVATE sal_Bool        ImplMoveFocus( sal_Bool _bUpper );
      96             :     SAL_DLLPRIVATE void        ImplCalcFocusRect( sal_Bool _bUpper );
      97             : 
      98           0 :     SAL_DLLPRIVATE inline sal_Bool ImplIsUpperEnabled( ) const
      99             :     {
     100           0 :         return mnValue + mnValueStep <= mnMaxRange;
     101             :     }
     102           0 :     SAL_DLLPRIVATE inline sal_Bool ImplIsLowerEnabled( ) const
     103             :     {
     104           0 :         return mnValue >= mnMinRange + mnValueStep;
     105             :     }
     106             : };
     107             : 
     108             : #endif  // _SV_SPIN_HXX
     109             : 
     110             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10