diff options
author | Caolán McNamara <caolanm@redhat.com> | 2020-07-12 17:22:54 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2020-07-12 20:28:56 +0200 |
commit | bcea211b66910ee6cf6a51e4baa950b3f897e310 (patch) | |
tree | b642d3acecade37f7ea5530e36d5d248e6b31c5e /include | |
parent | fcadbd72c14b9337cb11e4afb5143bff44a83646 (diff) |
move CheckBox to toolkit-only headers
Change-Id: Id1b2dd11bd0ebd9c88cf7e86d990a1990d760b2e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98605
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/sfx2/sidebar/TabBar.hxx | 2 | ||||
-rw-r--r-- | include/vcl/button.hxx | 101 | ||||
-rw-r--r-- | include/vcl/toolkit/button.hxx | 98 |
3 files changed, 99 insertions, 102 deletions
diff --git a/include/sfx2/sidebar/TabBar.hxx b/include/sfx2/sidebar/TabBar.hxx index 70ff1ec29ebb..055167890ee4 100644 --- a/include/sfx2/sidebar/TabBar.hxx +++ b/include/sfx2/sidebar/TabBar.hxx @@ -91,7 +91,7 @@ public: private: css::uno::Reference<css::frame::XFrame> mxFrame; - VclPtr<CheckBox> mpMenuButton; + VclPtr<RadioButton> mpMenuButton; class Item { public: diff --git a/include/vcl/button.hxx b/include/vcl/button.hxx index 3f998d5d6402..0819ff1b5aab 100644 --- a/include/vcl/button.hxx +++ b/include/vcl/button.hxx @@ -335,107 +335,6 @@ public: virtual FactoryFunction GetUITestFactory() const override; }; -class VCL_DLLPUBLIC CheckBox : public Button -{ -private: - tools::Rectangle maStateRect; - tools::Rectangle maMouseRect; - TriState meState; - TriState meSaveValue; - bool mbTriState; - Link<CheckBox&,void> maToggleHdl; - // when mbLegacyNoTextAlign is set then the old behaviour where - // the WB_LEFT, WB_RIGHT & WB_CENTER affect the image placement - // occurs, otherwise the image ( checkbox box ) is placed - // to the left or right ( depending on RTL or LTR settings ) - bool mbLegacyNoTextAlign; - SAL_DLLPRIVATE void ImplInitCheckBoxData(); - SAL_DLLPRIVATE static WinBits ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nStyle ); - SAL_DLLPRIVATE void ImplInitSettings( bool bBackground ); - SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, - const Point& rPos, const Size& rSize, - const Size& rImageSize, tools::Rectangle& rStateRect, - tools::Rectangle& rMouseRect ); - SAL_DLLPRIVATE void ImplDrawCheckBox(vcl::RenderContext& rRenderContext ); - SAL_DLLPRIVATE long ImplGetImageToTextDistance() const; - SAL_DLLPRIVATE Size ImplGetCheckImageSize() const; - - CheckBox(const CheckBox &) = delete; - CheckBox& operator= (const CheckBox &) = delete; - -protected: - using Control::ImplInitSettings; - using Window::ImplInit; - SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); - virtual void FillLayoutData() const override; - virtual const vcl::Font& GetCanonicalFont( const StyleSettings& _rStyle ) const override; - virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const override; - void ImplAdjustNWFSizes() override; - - virtual void ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext); - SAL_DLLPRIVATE const tools::Rectangle& GetStateRect() const { return maStateRect; } - SAL_DLLPRIVATE const tools::Rectangle& GetMouseRect() const { return maMouseRect; } - -public: - SAL_DLLPRIVATE void ImplCheck(); -public: - explicit CheckBox( vcl::Window* pParent, WinBits nStyle = 0 ); - - virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; - virtual void Tracking( const TrackingEvent& rTEvt ) override; - virtual void KeyInput( const KeyEvent& rKEvt ) override; - virtual void KeyUp( const KeyEvent& rKEvt ) override; - virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; - virtual void Draw( OutputDevice* pDev, const Point& rPos, DrawFlags nFlags ) override; - virtual void Resize() override; - virtual void GetFocus() override; - virtual void LoseFocus() override; - virtual void StateChanged( StateChangedType nType ) override; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; - virtual bool PreNotify( NotifyEvent& rNEvt ) override; - - void Toggle(); - - void SetState( TriState eState ); - TriState GetState() const { return meState; } - - void Check( bool bCheck = true ); - bool IsChecked() const; - - void EnableTriState( bool bTriState = true ); - bool IsTriStateEnabled() const { return mbTriState; } - - void SaveValue() { meSaveValue = GetState(); } - TriState GetSavedValue() const { return meSaveValue; } - bool IsValueChangedFromSaved() const { return meSaveValue != GetState(); } - - static Image GetCheckImage( const AllSettings& rSettings, DrawButtonFlags nFlags ); - - Size CalcMinimumSize( long nMaxWidth = 0 ) const; - virtual Size GetOptimalSize() const override; - - void SetToggleHdl( const Link<CheckBox&,void>& rLink ) { maToggleHdl = rLink; } - void SetLegacyNoTextAlign( bool bVal ) { mbLegacyNoTextAlign = bVal; } - - virtual bool set_property(const OString &rKey, const OUString &rValue) override; - virtual void ShowFocus(const tools::Rectangle& rRect) override; - - /// Button hes additional stuff that we need to dump too. - void DumpAsPropertyTree(tools::JsonWriter&) override; - - virtual FactoryFunction GetUITestFactory() const override; -}; - -inline void CheckBox::Check( bool bCheck ) -{ - SetState( bCheck ? TRISTATE_TRUE : TRISTATE_FALSE ); -} - -inline bool CheckBox::IsChecked() const -{ - return (GetState() == TRISTATE_TRUE); -} - class VCL_DLLPUBLIC ImageButton final : public PushButton { protected: diff --git a/include/vcl/toolkit/button.hxx b/include/vcl/toolkit/button.hxx index fd9692cae2ac..bcc7ac1c40cb 100644 --- a/include/vcl/toolkit/button.hxx +++ b/include/vcl/toolkit/button.hxx @@ -80,4 +80,102 @@ public: virtual void Click() override; }; +class VCL_DLLPUBLIC CheckBox : public Button +{ +private: + tools::Rectangle maStateRect; + tools::Rectangle maMouseRect; + TriState meState; + TriState meSaveValue; + bool mbTriState; + Link<CheckBox&,void> maToggleHdl; + // when mbLegacyNoTextAlign is set then the old behaviour where + // the WB_LEFT, WB_RIGHT & WB_CENTER affect the image placement + // occurs, otherwise the image ( checkbox box ) is placed + // to the left or right ( depending on RTL or LTR settings ) + bool mbLegacyNoTextAlign; + SAL_DLLPRIVATE void ImplInitCheckBoxData(); + SAL_DLLPRIVATE static WinBits ImplInitStyle( const vcl::Window* pPrevWindow, WinBits nStyle ); + SAL_DLLPRIVATE void ImplInitSettings( bool bBackground ); + SAL_DLLPRIVATE void ImplDraw( OutputDevice* pDev, DrawFlags nDrawFlags, + const Point& rPos, const Size& rSize, + const Size& rImageSize, tools::Rectangle& rStateRect, + tools::Rectangle& rMouseRect ); + SAL_DLLPRIVATE void ImplDrawCheckBox(vcl::RenderContext& rRenderContext ); + SAL_DLLPRIVATE long ImplGetImageToTextDistance() const; + SAL_DLLPRIVATE Size ImplGetCheckImageSize() const; + + CheckBox(const CheckBox &) = delete; + CheckBox& operator= (const CheckBox &) = delete; + +protected: + using Control::ImplInitSettings; + using Window::ImplInit; + SAL_DLLPRIVATE void ImplInit( vcl::Window* pParent, WinBits nStyle ); + virtual void FillLayoutData() const override; + virtual const vcl::Font& GetCanonicalFont( const StyleSettings& _rStyle ) const override; + virtual const Color& GetCanonicalTextColor( const StyleSettings& _rStyle ) const override; + void ImplAdjustNWFSizes() override; + + virtual void ImplDrawCheckBoxState(vcl::RenderContext& rRenderContext); + SAL_DLLPRIVATE const tools::Rectangle& GetStateRect() const { return maStateRect; } + SAL_DLLPRIVATE const tools::Rectangle& GetMouseRect() const { return maMouseRect; } + +public: + SAL_DLLPRIVATE void ImplCheck(); +public: + explicit CheckBox( vcl::Window* pParent, WinBits nStyle = 0 ); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ) override; + virtual void Tracking( const TrackingEvent& rTEvt ) override; + virtual void KeyInput( const KeyEvent& rKEvt ) override; + virtual void KeyUp( const KeyEvent& rKEvt ) override; + virtual void Paint( vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect ) override; + virtual void Draw( OutputDevice* pDev, const Point& rPos, DrawFlags nFlags ) override; + virtual void Resize() override; + virtual void GetFocus() override; + virtual void LoseFocus() override; + virtual void StateChanged( StateChangedType nType ) override; + virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; + virtual bool PreNotify( NotifyEvent& rNEvt ) override; + + void Toggle(); + + void SetState( TriState eState ); + TriState GetState() const { return meState; } + + void Check( bool bCheck = true ) + { + SetState( bCheck ? TRISTATE_TRUE : TRISTATE_FALSE ); + } + + bool IsChecked() const + { + return (GetState() == TRISTATE_TRUE); + } + + void EnableTriState( bool bTriState = true ); + bool IsTriStateEnabled() const { return mbTriState; } + + void SaveValue() { meSaveValue = GetState(); } + TriState GetSavedValue() const { return meSaveValue; } + bool IsValueChangedFromSaved() const { return meSaveValue != GetState(); } + + static Image GetCheckImage( const AllSettings& rSettings, DrawButtonFlags nFlags ); + + Size CalcMinimumSize( long nMaxWidth = 0 ) const; + virtual Size GetOptimalSize() const override; + + void SetToggleHdl( const Link<CheckBox&,void>& rLink ) { maToggleHdl = rLink; } + void SetLegacyNoTextAlign( bool bVal ) { mbLegacyNoTextAlign = bVal; } + + virtual bool set_property(const OString &rKey, const OUString &rValue) override; + virtual void ShowFocus(const tools::Rectangle& rRect) override; + + /// Button hes additional stuff that we need to dump too. + void DumpAsPropertyTree(tools::JsonWriter&) override; + + virtual FactoryFunction GetUITestFactory() const override; +}; + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |