summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-02 09:23:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-05-02 22:37:17 +0200
commitc7f9599f685a8e297be32fe6db5de04068b22d05 (patch)
treef371e617f8cabe325f04c1ac8b30052357da280e /vcl
parentdfb9138b8b5a239b46f189a717999bcaff19aa79 (diff)
weld SvxTextAnimationPage
Change-Id: I5aadf86648483be254157d3ca148eb16258980e1 Reviewed-on: https://gerrit.libreoffice.org/53723 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/salvtables.cxx74
-rw-r--r--vcl/source/window/builder.cxx6
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx15
3 files changed, 80 insertions, 15 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index aecefcffbd88..3ec78eb95013 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -345,16 +345,14 @@ public:
virtual void connect_focus_in(const Link<Widget&, void>& rLink) override
{
- assert(!m_aFocusInHdl.IsSet());
- m_xWidget->AddEventListener(LINK( this, SalInstanceWidget, FocusInListener));
- m_aFocusInHdl = rLink;
+ m_xWidget->AddEventListener(LINK(this, SalInstanceWidget, FocusInListener));
+ weld::Widget::connect_focus_in(rLink);
}
virtual void connect_focus_out(const Link<Widget&, void>& rLink) override
{
- assert(!m_aFocusOutHdl.IsSet());
- m_xWidget->AddEventListener(LINK( this, SalInstanceWidget, FocusOutListener));
- m_aFocusOutHdl = rLink;
+ m_xWidget->AddEventListener(LINK(this, SalInstanceWidget, FocusOutListener));
+ weld::Widget::connect_focus_out(rLink);
}
virtual void grab_add() override
@@ -372,9 +370,9 @@ public:
virtual ~SalInstanceWidget() override
{
if (m_aFocusInHdl.IsSet())
- m_xWidget->RemoveEventListener(LINK( this, SalInstanceWidget, FocusInListener));
+ m_xWidget->RemoveEventListener(LINK(this, SalInstanceWidget, FocusInListener));
if (m_aFocusOutHdl.IsSet())
- m_xWidget->RemoveEventListener(LINK( this, SalInstanceWidget, FocusOutListener));
+ m_xWidget->RemoveEventListener(LINK(this, SalInstanceWidget, FocusOutListener));
if (m_bTakeOwnership)
m_xWidget.disposeAndClear();
}
@@ -978,6 +976,60 @@ IMPL_LINK_NOARG(SalInstanceRadioButton, ToggleHdl, ::RadioButton&, void)
signal_toggled();
}
+class SalInstanceToggleButton : public SalInstanceButton, public virtual weld::ToggleButton
+{
+private:
+ VclPtr<PushButton> m_xToggleButton;
+
+ DECL_LINK(ToggleListener, VclWindowEvent&, void);
+
+public:
+ SalInstanceToggleButton(PushButton* pButton, bool bTakeOwnership)
+ : SalInstanceButton(pButton, bTakeOwnership)
+ , m_xToggleButton(pButton)
+ {
+ }
+
+ virtual void connect_toggled(const Link<ToggleButton&, void>& rLink) override
+ {
+ assert(!m_aToggleHdl.IsSet());
+ m_xToggleButton->AddEventListener(LINK(this, SalInstanceToggleButton, ToggleListener));
+ weld::ToggleButton::connect_toggled(rLink);
+ }
+
+ virtual void set_active(bool active) override
+ {
+ m_xToggleButton->Check(active);
+ }
+
+ virtual bool get_active() const override
+ {
+ return m_xToggleButton->IsChecked();
+ }
+
+ virtual void set_inconsistent(bool inconsistent) override
+ {
+ m_xToggleButton->SetState(inconsistent ? TRISTATE_INDET : TRISTATE_FALSE);
+ }
+
+ virtual bool get_inconsistent() const override
+ {
+ return m_xToggleButton->GetState() == TRISTATE_INDET;
+ }
+
+ virtual ~SalInstanceToggleButton() override
+ {
+ if (m_aToggleHdl.IsSet())
+ m_xToggleButton->RemoveEventListener(LINK(this, SalInstanceToggleButton, ToggleListener));
+ }
+};
+
+IMPL_LINK(SalInstanceToggleButton, ToggleListener, VclWindowEvent&, rEvent, void)
+{
+ if (rEvent.GetId() == VclEventId::PushbuttonToggle)
+ signal_toggled();
+}
+
class SalInstanceCheckButton : public SalInstanceButton, public virtual weld::CheckButton
{
private:
@@ -1990,6 +2042,12 @@ public:
return pButton ? new SalInstanceMenuButton(pButton, bTakeOwnership) : nullptr;
}
+ virtual weld::ToggleButton* weld_toggle_button(const OString &id, bool bTakeOwnership) override
+ {
+ PushButton* pToggleButton = m_xBuilder->get<PushButton>(id);
+ return pToggleButton ? new SalInstanceToggleButton(pToggleButton, bTakeOwnership) : nullptr;
+ }
+
virtual weld::RadioButton* weld_radio_button(const OString &id, bool bTakeOwnership) override
{
RadioButton* pRadioButton = m_xBuilder->get<RadioButton>(id);
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 0cd56a7cd58c..65e31948aa0b 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1402,7 +1402,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
}
else if (name == "GtkAlignment")
xWindow = VclPtr<VclAlignment>::Create(pParent);
- else if (name == "GtkButton")
+ else if (name == "GtkButton" || (!m_bLegacy && name == "GtkToggleButton"))
{
VclPtr<Button> xButton;
OUString sMenu = BuilderUtils::extractCustomProperty(rMap);
@@ -1429,7 +1429,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
setupFromActionName(xButton, rMap, m_xFrame);
xWindow = xButton;
}
- else if (name == "GtkToggleButton")
+ else if (name == "GtkToggleButton" && m_bLegacy)
{
VclPtr<Button> xButton;
OUString sMenu = BuilderUtils::extractCustomProperty(rMap);
@@ -1465,7 +1465,7 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
//maybe always import as TriStateBox and enable/disable tristate
bool bIsTriState = extractInconsistent(rMap);
VclPtr<CheckBox> xCheckBox;
- if (bIsTriState)
+ if (bIsTriState && m_bLegacy)
xCheckBox = VclPtr<TriStateBox>::Create(pParent, nBits);
else
xCheckBox = VclPtr<CheckBox>::Create(pParent, nBits);
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index bb8b1d862e07..250f5e845a99 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1402,16 +1402,14 @@ public:
virtual void connect_focus_in(const Link<Widget&, void>& rLink) override
{
- assert(!m_aFocusInHdl.IsSet());
m_nFocusInSignalId = g_signal_connect(m_pWidget, "focus-in-event", G_CALLBACK(signalFocusIn), this);
- m_aFocusInHdl = rLink;
+ weld::Widget::connect_focus_in(rLink);
}
virtual void connect_focus_out(const Link<Widget&, void>& rLink) override
{
- assert(!m_aFocusOutHdl.IsSet());
m_nFocusOutSignalId = g_signal_connect(m_pWidget, "focus-out-event", G_CALLBACK(signalFocusOut), this);
- m_aFocusOutHdl = rLink;
+ weld::Widget::connect_focus_out(rLink);
}
virtual void grab_add() override
@@ -4455,6 +4453,15 @@ public:
return new GtkInstanceMenuButton(pButton, bTakeOwnership);
}
+ virtual weld::ToggleButton* weld_toggle_button(const OString &id, bool bTakeOwnership) override
+ {
+ GtkToggleButton* pToggleButton = GTK_TOGGLE_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));
+ if (!pToggleButton)
+ return nullptr;
+ auto_add_parentless_widgets_to_container(GTK_WIDGET(pToggleButton));
+ return new GtkInstanceToggleButton(pToggleButton, bTakeOwnership);
+ }
+
virtual weld::RadioButton* weld_radio_button(const OString &id, bool bTakeOwnership) override
{
GtkRadioButton* pRadioButton = GTK_RADIO_BUTTON(gtk_builder_get_object(m_pBuilder, id.getStr()));