weld: Move weld::TriStateEnabled to own header/source
Move the class definition and implementation out of weld.hxx and weldutils.cxx into its own header and source file, in order to make it easier to keep an overview and to avoid having to recompile ~all UI code when the class is modified. Change-Id: I97768bf75dac492e32e1d387853d123481aa643a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205902 Tested-by: Jenkins Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/MetricSpinButton.hxx>
|
||||
#include <vcl/weld/TriStateEnabled.hxx>
|
||||
#include <TextDirectionListBox.hxx>
|
||||
|
||||
#include <map>
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
#include <vcl/weld/Grid.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/ScrolledWindow.hxx>
|
||||
#include <vcl/weld/TriStateEnabled.hxx>
|
||||
#include <vcl/weld/Window.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <vcl/font/Feature.hxx>
|
||||
|
||||
@@ -45,6 +45,7 @@ enum VerticalAlign {
|
||||
#include <vcl/weld/ComboBox.hxx>
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/MetricSpinButton.hxx>
|
||||
#include <vcl/weld/TriStateEnabled.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
|
||||
class SvxJustifyMethodItem;
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <vcl/weld/MetricSpinButton.hxx>
|
||||
#include <vcl/weld/Notebook.hxx>
|
||||
#include <vcl/weld/TreeView.hxx>
|
||||
#include <vcl/weld/TriStateEnabled.hxx>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
#include <memory>
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <vcl/weld/Label.hxx>
|
||||
#include <vcl/weld/MetricSpinButton.hxx>
|
||||
#include <vcl/weld/SpinButton.hxx>
|
||||
#include <vcl/weld/TriStateEnabled.hxx>
|
||||
|
||||
class SvxLineSpacingItem;
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <vcl/weld/FormattedSpinButton.hxx>
|
||||
#include <vcl/weld/MenuButton.hxx>
|
||||
#include <vcl/weld/TextView.hxx>
|
||||
#include <vcl/weld/TriStateEnabled.hxx>
|
||||
#include <vcl/weld/weldutils.hxx>
|
||||
#include <o3tl/typed_flags_set.hxx>
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <vcl/dllapi.h>
|
||||
#include <vcl/weld/weld.hxx>
|
||||
|
||||
namespace weld
|
||||
{
|
||||
struct VCL_DLLPUBLIC TriStateEnabled
|
||||
{
|
||||
TriState eState;
|
||||
bool bTriStateEnabled;
|
||||
TriStateEnabled()
|
||||
: eState(TRISTATE_INDET)
|
||||
, bTriStateEnabled(true)
|
||||
{
|
||||
}
|
||||
void CheckButtonToggled(CheckButton& rToggle);
|
||||
};
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
@@ -131,18 +131,6 @@ public:
|
||||
virtual void set_label_wrap(bool wrap) = 0;
|
||||
};
|
||||
|
||||
struct VCL_DLLPUBLIC TriStateEnabled
|
||||
{
|
||||
TriState eState;
|
||||
bool bTriStateEnabled;
|
||||
TriStateEnabled()
|
||||
: eState(TRISTATE_INDET)
|
||||
, bTriStateEnabled(true)
|
||||
{
|
||||
}
|
||||
void CheckButtonToggled(CheckButton& rToggle);
|
||||
};
|
||||
|
||||
class VCL_DLLPUBLIC RadioButton : virtual public Toggleable
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <sfx2/tabdlg.hxx>
|
||||
#include <vcl/weld/TriStateEnabled.hxx>
|
||||
|
||||
class ScTabPageProtection : public SfxTabPage
|
||||
{
|
||||
|
||||
@@ -614,6 +614,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
|
||||
vcl/source/weld/TextView \
|
||||
vcl/source/weld/TextWidget \
|
||||
vcl/source/weld/TreeView \
|
||||
vcl/source/weld/TriStateEnabled \
|
||||
vcl/source/weld/WaitObject \
|
||||
vcl/source/weld/Widget \
|
||||
vcl/source/weld/weldutils \
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
|
||||
/*
|
||||
* This file is part of the LibreOffice project.
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <vcl/weld/TriStateEnabled.hxx>
|
||||
|
||||
namespace weld
|
||||
{
|
||||
void TriStateEnabled::CheckButtonToggled(weld::CheckButton& rToggle)
|
||||
{
|
||||
if (bTriStateEnabled)
|
||||
{
|
||||
switch (eState)
|
||||
{
|
||||
case TRISTATE_INDET:
|
||||
rToggle.set_state(TRISTATE_FALSE);
|
||||
break;
|
||||
case TRISTATE_TRUE:
|
||||
rToggle.set_state(TRISTATE_INDET);
|
||||
break;
|
||||
case TRISTATE_FALSE:
|
||||
rToggle.set_state(TRISTATE_TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
eState = rToggle.get_state();
|
||||
}
|
||||
}
|
||||
|
||||
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
|
||||
@@ -41,26 +41,6 @@ BuilderPage::~BuilderPage() {}
|
||||
|
||||
namespace weld
|
||||
{
|
||||
void TriStateEnabled::CheckButtonToggled(weld::CheckButton& rToggle)
|
||||
{
|
||||
if (bTriStateEnabled)
|
||||
{
|
||||
switch (eState)
|
||||
{
|
||||
case TRISTATE_INDET:
|
||||
rToggle.set_state(TRISTATE_FALSE);
|
||||
break;
|
||||
case TRISTATE_TRUE:
|
||||
rToggle.set_state(TRISTATE_INDET);
|
||||
break;
|
||||
case TRISTATE_FALSE:
|
||||
rToggle.set_state(TRISTATE_TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
eState = rToggle.get_state();
|
||||
}
|
||||
|
||||
size_t GetAbsPos(const weld::TreeView& rTreeView, const weld::TreeIter& rIter)
|
||||
{
|
||||
size_t nAbsPos = 0;
|
||||
|
||||
Reference in New Issue
Block a user