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 | |
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>
-rw-r--r-- | accessibility/source/standard/vclxaccessiblebutton.cxx | 2 | ||||
-rw-r--r-- | accessibility/source/standard/vclxaccessiblecheckbox.cxx | 2 | ||||
-rw-r--r-- | accessibility/source/standard/vclxaccessibleradiobutton.cxx | 2 | ||||
-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 | ||||
-rw-r--r-- | sfx2/inc/sidebar/ControlFactory.hxx | 3 | ||||
-rw-r--r-- | sfx2/inc/sidebar/MenuButton.hxx | 4 | ||||
-rw-r--r-- | sfx2/source/sidebar/ControlFactory.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/sidebar/MenuButton.cxx | 4 | ||||
-rw-r--r-- | toolkit/inc/controls/filectrl.hxx | 2 | ||||
-rw-r--r-- | toolkit/source/awt/vclxwindows.cxx | 2 | ||||
-rw-r--r-- | vcl/inc/jsdialog/jsdialogbuilder.hxx | 2 | ||||
-rw-r--r-- | vcl/jsdialog/jsdialogbuilder.cxx | 1 | ||||
-rw-r--r-- | vcl/workben/vcldemo.cxx | 2 |
15 files changed, 113 insertions, 116 deletions
diff --git a/accessibility/source/standard/vclxaccessiblebutton.cxx b/accessibility/source/standard/vclxaccessiblebutton.cxx index f0ade105ce27..4c912530f8bf 100644 --- a/accessibility/source/standard/vclxaccessiblebutton.cxx +++ b/accessibility/source/standard/vclxaccessiblebutton.cxx @@ -29,7 +29,7 @@ #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <strings.hxx> -#include <vcl/button.hxx> +#include <vcl/toolkit/button.hxx> #include <vcl/event.hxx> #include <vcl/vclevent.hxx> diff --git a/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/accessibility/source/standard/vclxaccessiblecheckbox.cxx index a1074af9836d..a15ae4013ceb 100644 --- a/accessibility/source/standard/vclxaccessiblecheckbox.cxx +++ b/accessibility/source/standard/vclxaccessiblecheckbox.cxx @@ -30,7 +30,7 @@ #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> -#include <vcl/button.hxx> +#include <vcl/toolkit/button.hxx> #include <vcl/event.hxx> #include <vcl/vclevent.hxx> diff --git a/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/accessibility/source/standard/vclxaccessibleradiobutton.cxx index 4b408cb35b57..aae9c76731f7 100644 --- a/accessibility/source/standard/vclxaccessibleradiobutton.cxx +++ b/accessibility/source/standard/vclxaccessibleradiobutton.cxx @@ -30,7 +30,7 @@ #include <com/sun/star/accessibility/AccessibleEventId.hpp> #include <com/sun/star/lang/IndexOutOfBoundsException.hpp> #include <vcl/window.hxx> -#include <vcl/button.hxx> +#include <vcl/toolkit/button.hxx> #include <vcl/event.hxx> #include <vcl/vclevent.hxx> #include <strings.hxx> 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: */ diff --git a/sfx2/inc/sidebar/ControlFactory.hxx b/sfx2/inc/sidebar/ControlFactory.hxx index 15ae45ef4c81..22fd2fdeb119 100644 --- a/sfx2/inc/sidebar/ControlFactory.hxx +++ b/sfx2/inc/sidebar/ControlFactory.hxx @@ -22,7 +22,6 @@ #include <sfx2/dllapi.h> #include <vcl/vclptr.hxx> -class CheckBox; class RadioButton; namespace vcl { class Window; } @@ -38,7 +37,7 @@ class ControlFactory public: /** Create the menu button for the task bar. */ - static VclPtr<CheckBox> CreateMenuButton (vcl::Window* pParentWindow); + static VclPtr<RadioButton> CreateMenuButton (vcl::Window* pParentWindow); static VclPtr<RadioButton> CreateTabItem (vcl::Window* pParentWindow); }; diff --git a/sfx2/inc/sidebar/MenuButton.hxx b/sfx2/inc/sidebar/MenuButton.hxx index a244a3439738..eab32a463b64 100644 --- a/sfx2/inc/sidebar/MenuButton.hxx +++ b/sfx2/inc/sidebar/MenuButton.hxx @@ -23,7 +23,7 @@ namespace sfx2::sidebar { class MenuButton final - : public CheckBox + : public RadioButton { public: MenuButton (vcl::Window* pParentWindow); @@ -34,7 +34,7 @@ public: virtual void MouseButtonUp (const MouseEvent& rMouseEvent) override; protected: - using CheckBox::FillLayoutData; + using RadioButton::FillLayoutData; private: bool mbIsLeftButtonDown; diff --git a/sfx2/source/sidebar/ControlFactory.cxx b/sfx2/source/sidebar/ControlFactory.cxx index d2d3d27dde32..e310e2b9012a 100644 --- a/sfx2/source/sidebar/ControlFactory.cxx +++ b/sfx2/source/sidebar/ControlFactory.cxx @@ -23,7 +23,7 @@ namespace sfx2::sidebar { -VclPtr<CheckBox> ControlFactory::CreateMenuButton (vcl::Window* pParentWindow) +VclPtr<RadioButton> ControlFactory::CreateMenuButton (vcl::Window* pParentWindow) { return VclPtr<MenuButton>::Create(pParentWindow); } diff --git a/sfx2/source/sidebar/MenuButton.cxx b/sfx2/source/sidebar/MenuButton.cxx index 36be7fcfc2e3..364f0b89d6af 100644 --- a/sfx2/source/sidebar/MenuButton.cxx +++ b/sfx2/source/sidebar/MenuButton.cxx @@ -29,7 +29,7 @@ using namespace css::uno; namespace sfx2::sidebar { MenuButton::MenuButton (vcl::Window* pParentWindow) - : CheckBox(pParentWindow), + : RadioButton(pParentWindow), mbIsLeftButtonDown(false) { #ifdef DEBUG @@ -63,7 +63,7 @@ void MenuButton::MouseMove (const MouseEvent& rEvent) { if (rEvent.IsEnterWindow() || rEvent.IsLeaveWindow()) Invalidate(); - CheckBox::MouseMove(rEvent); + RadioButton::MouseMove(rEvent); } void MenuButton::MouseButtonDown (const MouseEvent& rMouseEvent) diff --git a/toolkit/inc/controls/filectrl.hxx b/toolkit/inc/controls/filectrl.hxx index 1ffcb67e3441..9c98a10c2335 100644 --- a/toolkit/inc/controls/filectrl.hxx +++ b/toolkit/inc/controls/filectrl.hxx @@ -20,7 +20,7 @@ #pragma once #include <vcl/window.hxx> -#include <vcl/button.hxx> +#include <vcl/toolkit/button.hxx> class Edit; diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index e630919b206e..f3a41f03f7dd 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -42,7 +42,7 @@ #include <controls/filectrl.hxx> #include <svl/zforlist.hxx> -#include <vcl/button.hxx> +#include <vcl/toolkit/button.hxx> #include <vcl/toolkit/fmtfield.hxx> #include <vcl/graph.hxx> #include <vcl/toolkit/lstbox.hxx> diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx index 950898ead48c..1b572df582b7 100644 --- a/vcl/inc/jsdialog/jsdialogbuilder.hxx +++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx @@ -16,7 +16,7 @@ #include <vcl/virdev.hxx> #include <vcl/builder.hxx> #include <salvtables.hxx> -#include <vcl/button.hxx> +#include <vcl/toolkit/button.hxx> #include <vcl/toolkit/fmtfield.hxx> class ToolBox; diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx index 8f12489ed44c..cf37b9593880 100644 --- a/vcl/jsdialog/jsdialogbuilder.cxx +++ b/vcl/jsdialog/jsdialogbuilder.cxx @@ -11,6 +11,7 @@ #include <sal/log.hxx> #include <comphelper/lok.hxx> #include <vcl/tabpage.hxx> +#include <vcl/toolkit/button.hxx> #include <vcl/toolkit/dialog.hxx> #include <LibreOfficeKit/LibreOfficeKitEnums.h> #include <vcl/toolkit/combobox.hxx> diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 93abd642bef0..f86f23ccfcc0 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -43,7 +43,7 @@ #include <vcl/wrkwin.hxx> #include <vcl/virdev.hxx> #include <vcl/graphicfilter.hxx> -#include <vcl/button.hxx> +#include <vcl/toolkit/button.hxx> #include <vcl/toolkit/combobox.hxx> #include <vcl/toolbox.hxx> #include <vcl/pngwrite.hxx> |