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>
This commit is contained in:
parent
fcadbd72c1
commit
bcea211b66
15 changed files with 113 additions and 116 deletions
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
|
||||
private:
|
||||
css::uno::Reference<css::frame::XFrame> mxFrame;
|
||||
VclPtr<CheckBox> mpMenuButton;
|
||||
VclPtr<RadioButton> mpMenuButton;
|
||||
class Item
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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: */
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <vcl/window.hxx>
|
||||
#include <vcl/button.hxx>
|
||||
#include <vcl/toolkit/button.hxx>
|
||||
|
||||
class Edit;
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue