LCOV - code coverage report
Current view: top level - include/vcl - button.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 12 45 26.7 %
Date: 2014-11-03 Functions: 12 45 26.7 %
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 INCLUDED_VCL_BUTTON_HXX
      21             : #define INCLUDED_VCL_BUTTON_HXX
      22             : 
      23             : #include <tools/solar.h>
      24             : #include <tools/color.hxx>
      25             : #include <vcl/dllapi.h>
      26             : #include <vcl/image.hxx>
      27             : #include <vcl/ctrl.hxx>
      28             : #include <vcl/bitmap.hxx>
      29             : #include <vcl/salnativewidgets.hxx>
      30             : #include <rsc/rsc-vcl-shared-types.hxx>
      31             : 
      32             : #include <vector>
      33             : 
      34             : class UserDrawEvent;
      35             : class ImplCommonButtonData;
      36             : 
      37             : class VCL_DLLPUBLIC Button : public Control
      38             : {
      39             : private:
      40             :     ImplCommonButtonData *mpButtonData;
      41             :     Link maClickHdl;
      42             : 
      43             :     /// Command URL (like .uno:Save) in case the button should handle it.
      44             :     OUString maCommand;
      45             : 
      46             :     // Copy assignment is forbidden and not implemented.
      47             :     SAL_DLLPRIVATE                  Button (const Button &);
      48             :     SAL_DLLPRIVATE                  Button & operator= (const Button &);
      49             : public:
      50             :     SAL_DLLPRIVATE sal_uInt16       ImplGetButtonState() const;
      51             :     SAL_DLLPRIVATE sal_uInt16&      ImplGetButtonState();
      52             :     SAL_DLLPRIVATE sal_uInt16       ImplGetTextStyle( OUString& rText, WinBits nWinStyle, sal_uLong nDrawFlags );
      53             :     SAL_DLLPRIVATE void             ImplDrawAlignedImage( OutputDevice* pDev, Point& rPos, Size& rSize,
      54             :                                               bool bLayout, sal_uLong nImageSep, sal_uLong nDrawFlags,
      55             :                                               sal_uInt16 nTextStyle, Rectangle *pSymbolRect=NULL, bool bAddImageSep = false );
      56             :     SAL_DLLPRIVATE void             ImplSetFocusRect( const Rectangle &rFocusRect );
      57             :     SAL_DLLPRIVATE const Rectangle& ImplGetFocusRect() const;
      58             :     SAL_DLLPRIVATE void             ImplSetSymbolAlign( SymbolAlign eAlign );
      59             :     /// The x-coordinate of the vertical separator line, use in MenuButton subclass only.
      60             :     SAL_DLLPRIVATE long             ImplGetSeparatorX() const;
      61             :     SAL_DLLPRIVATE void             ImplSetSeparatorX( long nX );
      62             : 
      63             : protected:
      64             :     explicit            Button( WindowType nType );
      65             : 
      66             : public:
      67             :     virtual            ~Button();
      68             : 
      69             :     virtual void        Click();
      70             : 
      71       23358 :     void                SetClickHdl( const Link& rLink ) { maClickHdl = rLink; }
      72           0 :     const Link&         GetClickHdl() const { return maClickHdl; }
      73             : 
      74             :     /// Setup handler for UNO commands so that commands like .uno:Something are handled automagically by this button.
      75             :     void                SetCommandHandler(const OUString& aCommand);
      76             : 
      77             :     static OUString     GetStandardText( StandardButtonType eButton );
      78             : 
      79             :     bool            SetModeImage( const Image& rImage );
      80             :     const Image         GetModeImage( ) const;
      81             :     bool            HasImage() const;
      82             :     void                SetImageAlign( ImageAlign eAlign );
      83             :     ImageAlign          GetImageAlign() const;
      84             : 
      85             :     void                EnableImageDisplay( bool bEnable );
      86             :     void                EnableTextDisplay( bool bEnable );
      87             : 
      88             :     void                SetFocusRect( const Rectangle& rFocusRect );
      89             :     bool                IsSmallSymbol() const;
      90             :     void                SetSmallSymbol(bool bSmall = true);
      91             :     virtual bool        set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
      92             : 
      93             : protected:
      94             : 
      95             :     /// Handler for click, in case we want the button to handle uno commands (.uno:Something).
      96             :     static long         dispatchCommandHandler(void *, void *pCaller);
      97             : };
      98             : 
      99             : 
     100             : // - PushButton-Types -
     101             : 
     102             : 
     103             : #define PUSHBUTTON_DROPDOWN_TOOLBOX         ((sal_uInt16)0x0001)
     104             : #define PUSHBUTTON_DROPDOWN_MENUBUTTON      ((sal_uInt16)0x0002)
     105             : 
     106             : 
     107             : // - PushButton -
     108             : 
     109             : 
     110             : class VCL_DLLPUBLIC PushButton : public Button
     111             : {
     112             : protected:
     113             :     SymbolType      meSymbol;
     114             :     TriState        meState;
     115             :     TriState        meSaveValue;
     116             :     sal_uInt16      mnDDStyle;
     117             :     bool            mbPressed;
     118             :     bool            mbInUserDraw;
     119             :     Link            maToggleHdl;
     120             : 
     121             :     SAL_DLLPRIVATE void            ImplInitPushButtonData();
     122             :     SAL_DLLPRIVATE WinBits         ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nStyle );
     123             :     SAL_DLLPRIVATE void            ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
     124             :     SAL_DLLPRIVATE void            ImplDrawPushButtonContent( OutputDevice* pDev, sal_uLong nDrawFlags,
     125             :                                                const Rectangle& rRect, bool bLayout, bool bMenuBtnSep );
     126             :     SAL_DLLPRIVATE void            ImplDrawPushButton( bool bLayout = false );
     127             :     using Button::ImplGetTextStyle;
     128             :     SAL_DLLPRIVATE sal_uInt16          ImplGetTextStyle( sal_uLong nDrawFlags ) const;
     129       30011 :     SAL_DLLPRIVATE bool            IsSymbol() const { return ( (meSymbol != SymbolType::DONTKNOW) && (meSymbol != SymbolType::IMAGE) ); }
     130          54 :     SAL_DLLPRIVATE bool            IsImage() const { return Button::HasImage(); }
     131             : 
     132             :     // Copy assignment is forbidden and not implemented.
     133             :     SAL_DLLPRIVATE                 PushButton( const PushButton & );
     134             :     SAL_DLLPRIVATE                 PushButton& operator=( const PushButton & );
     135             : 
     136             :     SAL_DLLPRIVATE void            ImplInit( vcl::Window* pParent, WinBits nStyle );
     137             : 
     138             :     using Control::ImplInitSettings;
     139             :     using Window::ImplInit;
     140             : public:
     141             :     SAL_DLLPRIVATE void            ImplSetDefButton( bool bSet );
     142             :     SAL_DLLPRIVATE static void     ImplDrawPushButtonFrame( vcl::Window* pDev, Rectangle& rRect, sal_uInt16 nStyle );
     143             :     SAL_DLLPRIVATE static bool     ImplHitTestPushButton( vcl::Window* pDev, const Point& rPos );
     144             :     SAL_DLLPRIVATE bool            ImplIsDefButton() const;
     145             : 
     146             : protected:
     147             :     explicit        PushButton( WindowType nType );
     148             : 
     149             :     virtual void    FillLayoutData() const SAL_OVERRIDE;
     150             :     virtual const vcl::Font&
     151             :                     GetCanonicalFont( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
     152             :     virtual const Color&
     153             :                     GetCanonicalTextColor( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
     154             : public:
     155             :     explicit        PushButton( vcl::Window* pParent, WinBits nStyle = 0 );
     156             :     explicit        PushButton( vcl::Window* pParent, const ResId& );
     157             :     virtual         ~PushButton();
     158             : 
     159             :     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     160             :     virtual void    Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
     161             :     virtual void    KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
     162             :     virtual void    KeyUp( const KeyEvent& rKEvt ) SAL_OVERRIDE;
     163             :     virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     164             :     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
     165             :     virtual void    Resize() SAL_OVERRIDE;
     166             :     virtual void    GetFocus() SAL_OVERRIDE;
     167             :     virtual void    LoseFocus() SAL_OVERRIDE;
     168             :     virtual void    StateChanged( StateChangedType nType ) SAL_OVERRIDE;
     169             :     virtual void    DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     170             :     virtual bool    PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     171             :     virtual void    UserDraw( const UserDrawEvent& rUDEvt );
     172             : 
     173             :     virtual void    Toggle();
     174             : 
     175             :     void            SetSymbol( SymbolType eSymbol );
     176        9779 :     SymbolType      GetSymbol() const { return meSymbol; }
     177             :     void            SetSymbolAlign( SymbolAlign eAlign );
     178             : 
     179             :     void            SetDropDown( sal_uInt16 nStyle );
     180             :     sal_uInt16          GetDropDown() const { return mnDDStyle; }
     181             : 
     182             :     void            SetState( TriState eState );
     183           0 :     TriState        GetState() const { return meState; }
     184             : 
     185             :     void            Check( bool bCheck = true );
     186             :     bool            IsChecked() const;
     187             : 
     188             :     void            SetPressed( bool bPressed );
     189           0 :     bool            IsPressed() const { return mbPressed; }
     190             : 
     191             :     void            EndSelection();
     192             : 
     193           0 :     void            SaveValue() { meSaveValue = GetState(); }
     194             :     TriState        GetSavedValue() const { return meSaveValue; }
     195           0 :     bool            IsValueChangedFromSaved() const { return meSaveValue != GetState(); }
     196             : 
     197             :     Size            CalcMinimumSize( long nMaxWidth = 0 ) const;
     198             :     virtual Size    GetOptimalSize() const SAL_OVERRIDE;
     199             : 
     200             :     void            SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; }
     201             :     const Link&     GetToggleHdl() const { return maToggleHdl; }
     202             :     virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
     203             : };
     204             : 
     205           0 : inline void PushButton::Check( bool bCheck )
     206             : {
     207           0 :     SetState( (bCheck) ? TRISTATE_TRUE : TRISTATE_FALSE );
     208           0 : }
     209             : 
     210           0 : inline bool PushButton::IsChecked() const
     211             : {
     212           0 :     return (GetState() == TRISTATE_TRUE);
     213             : }
     214             : 
     215           0 : class VCL_DLLPUBLIC OKButton : public PushButton
     216             : {
     217             : protected:
     218             :     using PushButton::ImplInit;
     219             : private:
     220             :     SAL_DLLPRIVATE void            ImplInit( vcl::Window* pParent, WinBits nStyle );
     221             : 
     222             :     // Copy assignment is forbidden and not implemented.
     223             :     SAL_DLLPRIVATE                 OKButton (const OKButton &);
     224             :     SAL_DLLPRIVATE                 OKButton & operator= (const OKButton &);
     225             : 
     226             : public:
     227             :     explicit        OKButton( vcl::Window* pParent, WinBits nStyle = WB_DEFBUTTON );
     228             : 
     229             :     virtual void    Click() SAL_OVERRIDE;
     230             : };
     231             : 
     232             : 
     233           0 : class VCL_DLLPUBLIC CancelButton : public PushButton
     234             : {
     235             : protected:
     236             :     using PushButton::ImplInit;
     237             : private:
     238             :     SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
     239             : 
     240             :     // Copy assignment is forbidden and not implemented.
     241             :     SAL_DLLPRIVATE      CancelButton (const CancelButton &);
     242             :     SAL_DLLPRIVATE      CancelButton & operator= (const CancelButton &);
     243             : 
     244             : public:
     245             :     explicit        CancelButton( vcl::Window* pParent, WinBits nStyle = 0 );
     246             : 
     247             :     virtual void    Click() SAL_OVERRIDE;
     248             : };
     249             : 
     250           0 : class VCL_DLLPUBLIC CloseButton : public CancelButton
     251             : {
     252             : public:
     253             :     explicit CloseButton(vcl::Window* pParent, WinBits nStyle = 0);
     254             : };
     255             : 
     256             : 
     257             : 
     258             : // - HelpButton -
     259             : 
     260             : 
     261           0 : class VCL_DLLPUBLIC HelpButton : public PushButton
     262             : {
     263             : protected:
     264             :     using PushButton::ImplInit;
     265             : private:
     266             :     SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle );
     267             : 
     268             :     // Copy assignment is forbidden and not implemented.
     269             :     SAL_DLLPRIVATE      HelpButton( const HelpButton & );
     270             :     SAL_DLLPRIVATE      HelpButton & operator= ( const HelpButton & );
     271             : 
     272             : public:
     273             :     explicit        HelpButton( vcl::Window* pParent, WinBits nStyle = 0 );
     274             :     explicit        HelpButton( vcl::Window* pParent, const ResId& );
     275             : 
     276             :     virtual void    Click() SAL_OVERRIDE;
     277             : };
     278             : 
     279             : 
     280             : // - RadioButton -
     281             : 
     282             : 
     283             : class VCL_DLLPUBLIC RadioButton : public Button
     284             : {
     285             : private:
     286             :     boost::shared_ptr< std::vector<RadioButton*> > m_xGroup;
     287             :     Rectangle       maStateRect;
     288             :     Rectangle       maMouseRect;
     289             :     Image           maImage;
     290             :     bool        mbChecked;
     291             :     bool        mbSaveValue;
     292             :     bool        mbRadioCheck;
     293             :     bool        mbStateChanged;
     294             :     Link            maToggleHdl;
     295             :     // when mbLegacyNoTextAlign is set then the old behaviour where
     296             :     // the WB_LEFT, WB_RIGHT & WB_CENTER affect the image placement
     297             :     // occurs, otherwise the image ( radiobutton circle ) is placed
     298             :     // to the left or right ( depending on RTL or LTR settings )
     299             :     bool            mbLegacyNoTextAlign;
     300             :     SAL_DLLPRIVATE void     ImplInitRadioButtonData();
     301             :     SAL_DLLPRIVATE WinBits  ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nStyle );
     302             :     SAL_DLLPRIVATE void     ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
     303             :     SAL_DLLPRIVATE void     ImplDrawRadioButtonState();
     304             :     SAL_DLLPRIVATE void     ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
     305             :                               const Point& rPos, const Size& rSize,
     306             :                               const Size& rImageSize, Rectangle& rStateRect,
     307             :                               Rectangle& rMouseRect, bool bLayout = false );
     308             :     SAL_DLLPRIVATE void     ImplDrawRadioButton( bool bLayout = false );
     309             :     SAL_DLLPRIVATE void     ImplInvalidateOrDrawRadioButtonState();
     310             :     SAL_DLLPRIVATE void     ImplUncheckAllOther();
     311             :     SAL_DLLPRIVATE Size     ImplGetRadioImageSize() const;
     312             :     SAL_DLLPRIVATE long     ImplGetImageToTextDistance() const;
     313             : 
     314             :     // Copy assignment is forbidden and not implemented.
     315             :     SAL_DLLPRIVATE          RadioButton(const RadioButton &);
     316             :     SAL_DLLPRIVATE          RadioButton& operator= (const RadioButton &);
     317             : 
     318             : protected:
     319             :     using Control::ImplInitSettings;
     320             :     using Window::ImplInit;
     321             :     SAL_DLLPRIVATE void     ImplInit( vcl::Window* pParent, WinBits nStyle );
     322             :     SAL_DLLPRIVATE void     ImplLoadRes( const ResId& rResId );
     323             : 
     324             : public:
     325             :     SAL_DLLPRIVATE void     ImplCallClick( bool bGrabFocus = false, sal_uInt16 nFocusFlags = 0 );
     326             :     SAL_DLLPRIVATE void     ImplSetMinimumNWFSize();
     327             : 
     328             : protected:
     329             :     virtual void FillLayoutData() const SAL_OVERRIDE;
     330             :     virtual const vcl::Font&
     331             :                     GetCanonicalFont( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
     332             :     virtual const Color&
     333             :                     GetCanonicalTextColor( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
     334             : 
     335           0 :     inline void             SetMouseRect( const Rectangle& _rMouseRect )    { maMouseRect = _rMouseRect; }
     336             :     inline const Rectangle& GetMouseRect( ) const                           { return maMouseRect; }
     337           0 :     inline void             SetStateRect( const Rectangle& _rStateRect )    { maStateRect = _rStateRect; }
     338             :     inline const Rectangle& GetStateRect( ) const                           { return maStateRect; }
     339             : 
     340             :     // draws the radio button (the knob image), in its current state (pressed/checked)
     341             :     // at the usual location, which can be overridden with SetStateRect
     342             :     void            DrawRadioButtonState( );
     343             : 
     344             : public:
     345             :     explicit        RadioButton( vcl::Window* pParent, WinBits nWinStyle = 0 );
     346             :     explicit        RadioButton( vcl::Window* pParent, const ResId& );
     347             :     virtual         ~RadioButton();
     348             : 
     349             :     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     350             :     virtual void    Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
     351             :     virtual void    KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
     352             :     virtual void    KeyUp( const KeyEvent& rKEvt ) SAL_OVERRIDE;
     353             :     virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     354             :     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
     355             :     virtual void    Resize() SAL_OVERRIDE;
     356             :     virtual void    GetFocus() SAL_OVERRIDE;
     357             :     virtual void    LoseFocus() SAL_OVERRIDE;
     358             :     virtual void    StateChanged( StateChangedType nType ) SAL_OVERRIDE;
     359             :     virtual void    DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     360             :     virtual bool    PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     361             : 
     362             :     virtual void    Toggle();
     363             : 
     364           0 :     bool            IsStateChanged() const { return mbStateChanged; }
     365             : 
     366          88 :     void            EnableRadioCheck( bool bRadioCheck = true ) { mbRadioCheck = bRadioCheck; }
     367          82 :     bool            IsRadioCheckEnabled() const { return mbRadioCheck; }
     368             : 
     369             :     bool            SetModeRadioImage( const Image& rImage );
     370           0 :     const Image&    GetModeRadioImage( ) const { return maImage;}
     371             : 
     372             :     void            SetState( bool bCheck );
     373             :     void            Check( bool bCheck = true );
     374       17277 :     bool            IsChecked() const { return mbChecked; }
     375             : 
     376           0 :     void            SaveValue() { mbSaveValue = IsChecked(); }
     377           0 :     bool            GetSavedValue() const { return mbSaveValue; }
     378           0 :     bool            IsValueChangedFromSaved() const { return mbSaveValue != IsChecked(); }
     379             : 
     380             :     static Image    GetRadioImage( const AllSettings& rSettings, sal_uInt16 nFlags );
     381             : 
     382             :     Size            CalcMinimumSize( long nMaxWidth = 0 ) const;
     383             :     virtual Size    GetOptimalSize() const SAL_OVERRIDE;
     384             : 
     385           0 :     void            SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; }
     386             :     const Link&     GetToggleHdl() const { return maToggleHdl; }
     387             : 
     388             :     /** GetRadioButtonGroup returns a list of pointers to <code>RadioButton</code>s in the same group.
     389             : 
     390             :     The pointers in the returned list are valid at the time call returns. However rescheduling
     391             :     or giving up the SolarMutex may mean events get executed that lead to the pointers getting
     392             :     invalid.
     393             : 
     394             :     @param bIncludeThis
     395             :     defines whether <code>this</code> is contained in the returned list
     396             : 
     397             :     @return
     398             :     on return contains the <code>RadioButton</code>s
     399             :     in the same group as this <code>RadioButton</code>.
     400             :     */
     401             :     std::vector<RadioButton*> GetRadioButtonGroup(bool bIncludeThis = true) const;
     402             : 
     403             :     virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
     404             : 
     405             :     /*
     406             :      * Group this RadioButton with another
     407             :      */
     408             :     void group(RadioButton &rOther);
     409             : };
     410             : 
     411             : 
     412             : // - CheckBox -
     413             : 
     414             : 
     415        4825 : class VCL_DLLPUBLIC CheckBox : public Button
     416             : {
     417             : private:
     418             :     Rectangle       maStateRect;
     419             :     Rectangle       maMouseRect;
     420             :     TriState        meState;
     421             :     TriState        meSaveValue;
     422             :     bool            mbTriState;
     423             :     Link            maToggleHdl;
     424             :     // when mbLegacyNoTextAlign is set then the old behaviour where
     425             :     // the WB_LEFT, WB_RIGHT & WB_CENTER affect the image placement
     426             :     // occurs, otherwise the image ( checkbox box ) is placed
     427             :     // to the left or right ( depending on RTL or LTR settings )
     428             :     bool            mbLegacyNoTextAlign;
     429             :     SAL_DLLPRIVATE void         ImplInitCheckBoxData();
     430             :     SAL_DLLPRIVATE WinBits      ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nStyle );
     431             :     SAL_DLLPRIVATE void         ImplInitSettings( bool bFont, bool bForeground, bool bBackground );
     432             :     SAL_DLLPRIVATE void         ImplInvalidateOrDrawCheckBoxState();
     433             :     SAL_DLLPRIVATE void         ImplDraw( OutputDevice* pDev, sal_uLong nDrawFlags,
     434             :                                     const Point& rPos, const Size& rSize,
     435             :                                     const Size& rImageSize, Rectangle& rStateRect,
     436             :                                     Rectangle& rMouseRect, bool bLayout );
     437             :     SAL_DLLPRIVATE void         ImplDrawCheckBox( bool bLayout = false );
     438             :     SAL_DLLPRIVATE long         ImplGetImageToTextDistance() const;
     439             :     SAL_DLLPRIVATE Size         ImplGetCheckImageSize() const;
     440             : 
     441             :     // Copy assignment is forbidden and not implemented.
     442             :     SAL_DLLPRIVATE              CheckBox(const CheckBox &);
     443             :     SAL_DLLPRIVATE              CheckBox& operator= (const CheckBox &);
     444             : 
     445             : protected:
     446             :     using Control::ImplInitSettings;
     447             :     using Window::ImplInit;
     448             :     SAL_DLLPRIVATE void         ImplInit( vcl::Window* pParent, WinBits nStyle );
     449             :     SAL_DLLPRIVATE void         ImplLoadRes( const ResId& rResId );
     450             :     virtual void FillLayoutData() const SAL_OVERRIDE;
     451             :     virtual const vcl::Font&    GetCanonicalFont( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
     452             :     virtual const Color&        GetCanonicalTextColor( const StyleSettings& _rStyle ) const SAL_OVERRIDE;
     453             : 
     454             :     virtual void ImplDrawCheckBoxState();
     455           0 :     SAL_DLLPRIVATE const Rectangle& GetStateRect() const { return maStateRect; }
     456           0 :     SAL_DLLPRIVATE const Rectangle& GetMouseRect() const { return maMouseRect; }
     457             : 
     458             : public:
     459             :     SAL_DLLPRIVATE void         ImplCheck();
     460             :     SAL_DLLPRIVATE void         ImplSetMinimumNWFSize();
     461             : public:
     462             :     explicit        CheckBox( vcl::Window* pParent, WinBits nStyle = 0 );
     463             :     explicit        CheckBox( vcl::Window* pParent, const ResId& );
     464             : 
     465             :     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     466             :     virtual void    Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
     467             :     virtual void    KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
     468             :     virtual void    KeyUp( const KeyEvent& rKEvt ) SAL_OVERRIDE;
     469             :     virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     470             :     virtual void    Draw( OutputDevice* pDev, const Point& rPos, const Size& rSize, sal_uLong nFlags ) SAL_OVERRIDE;
     471             :     virtual void    Resize() SAL_OVERRIDE;
     472             :     virtual void    GetFocus() SAL_OVERRIDE;
     473             :     virtual void    LoseFocus() SAL_OVERRIDE;
     474             :     virtual void    StateChanged( StateChangedType nType ) SAL_OVERRIDE;
     475             :     virtual void    DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     476             :     virtual bool    PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     477             : 
     478             :     virtual void    Toggle();
     479             : 
     480             :     void            SetState( TriState eState );
     481       10324 :     TriState        GetState() const { return meState; }
     482             : 
     483             :     void            Check( bool bCheck = true );
     484             :     bool            IsChecked() const;
     485             : 
     486             :     void            EnableTriState( bool bTriState = true );
     487           0 :     bool            IsTriStateEnabled() const { return mbTriState; }
     488             : 
     489           0 :     void            SaveValue() { meSaveValue = GetState(); }
     490           0 :     TriState        GetSavedValue() const { return meSaveValue; }
     491           0 :     bool            IsValueChangedFromSaved() const { return meSaveValue != GetState(); }
     492             : 
     493             :     static Image    GetCheckImage( const AllSettings& rSettings, sal_uInt16 nFlags );
     494             : 
     495             :     Size            CalcMinimumSize( long nMaxWidth = 0 ) const;
     496             :     virtual Size    GetOptimalSize() const SAL_OVERRIDE;
     497             : 
     498           0 :     void            SetToggleHdl( const Link& rLink ) { maToggleHdl = rLink; }
     499             :     const Link&     GetToggleHdl() const { return maToggleHdl; }
     500             :     bool            IsLegacyNoTextAlign() { return mbLegacyNoTextAlign; }
     501          41 :     void            SetLegacyNoTextAlign( bool bVal ) { mbLegacyNoTextAlign = bVal; }
     502             : 
     503             :     virtual bool set_property(const OString &rKey, const OString &rValue) SAL_OVERRIDE;
     504             : };
     505             : 
     506           0 : inline void CheckBox::Check( bool bCheck )
     507             : {
     508           0 :     SetState( (bCheck) ? TRISTATE_TRUE : TRISTATE_FALSE );
     509           0 : }
     510             : 
     511       10300 : inline bool CheckBox::IsChecked() const
     512             : {
     513       10300 :     return (GetState() == TRISTATE_TRUE);
     514             : }
     515             : 
     516             : 
     517             : // - Control-Layer fuer alten Code -
     518             : 
     519             : 
     520             : class VCL_DLLPUBLIC ImageButton : public PushButton
     521             : {
     522             : protected:
     523             :     using PushButton::ImplInitStyle;
     524             : private:
     525             :     SAL_DLLPRIVATE void     ImplInitStyle();
     526             : 
     527             :     // Copy assignment is forbidden and not implemented.
     528             :     SAL_DLLPRIVATE          ImageButton( const ImageButton & );
     529             :     SAL_DLLPRIVATE          ImageButton & operator= ( const ImageButton & );
     530             : 
     531             : public:
     532             :                     ImageButton( vcl::Window* pParent, WinBits nStyle = 0 );
     533             :                     ImageButton( vcl::Window* pParent, const ResId& rResId );
     534             :                     virtual ~ImageButton();
     535             : };
     536             : 
     537             : class VCL_DLLPUBLIC ImageRadioButton : public RadioButton
     538             : {
     539             :     // Copy assignment is forbidden and not implemented.
     540             :     SAL_DLLPRIVATE  ImageRadioButton( const ImageRadioButton & );
     541             :     SAL_DLLPRIVATE  ImageRadioButton & operator= ( const ImageRadioButton & );
     542             : 
     543             : public:
     544             :     explicit        ImageRadioButton( vcl::Window* pParent, WinBits nStyle = 0 );
     545             :     virtual         ~ImageRadioButton();
     546             : };
     547             : 
     548             : class VCL_DLLPUBLIC TriStateBox : public CheckBox
     549             : {
     550             :     // Copy assignment is forbidden and not implemented.
     551             :     SAL_DLLPRIVATE  TriStateBox( const TriStateBox & );
     552             :     SAL_DLLPRIVATE  TriStateBox & operator= ( const TriStateBox & );
     553             : 
     554             : public:
     555             :     explicit        TriStateBox( vcl::Window* pParent, WinBits nStyle = 0 );
     556             :     virtual         ~TriStateBox();
     557             : };
     558             : 
     559           0 : class VCL_DLLPUBLIC DisclosureButton : public CheckBox
     560             : {
     561             : protected:
     562             :     SAL_DLLPRIVATE virtual void ImplDrawCheckBoxState() SAL_OVERRIDE;
     563             : public:
     564             :     explicit DisclosureButton( vcl::Window* pParent, WinBits nStyle = 0 );
     565             : 
     566             :     virtual void    KeyInput( const KeyEvent& rKEvt ) SAL_OVERRIDE;
     567             : };
     568             : 
     569             : typedef rtl::Reference<DisclosureButton> DisclosureButtonPtr;
     570             : 
     571             : #endif // INCLUDED_VCL_BUTTON_HXX
     572             : 
     573             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10