diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-06-18 21:30:10 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-06-20 12:41:53 +0200 |
commit | 1f8d45c276760a173c3e30c78b8b740414a5b05f (patch) | |
tree | 4e22f39b8515a1839c9dc64146725ca02ec9b6f9 /vcl | |
parent | 6e5e83025c948b699bb65839ef810a45a98ba014 (diff) |
weld SvxColorTabPage
Change-Id: I5dc6f949edcb34aa110dfa9415e2ac886d0dfa4c
Reviewed-on: https://gerrit.libreoffice.org/56111
Tested-by: Jenkins
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.cxx | 26 | ||||
-rw-r--r-- | vcl/source/window/layout.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 154 |
3 files changed, 136 insertions, 48 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 20f957af82d3..c40e5fd27c46 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -805,6 +805,32 @@ public: rVertScrollBar.SetRangeMax(upper); } + virtual void set_vpolicy(VclPolicyType eVPolicy) override + { + WinBits nWinBits = m_xScrolledWindow->GetStyle() & ~(WB_AUTOVSCROLL|WB_VSCROLL); + if (eVPolicy == VclPolicyType::ALWAYS) + nWinBits |= WB_VSCROLL; + else if (eVPolicy == VclPolicyType::AUTOMATIC) + nWinBits |= WB_AUTOVSCROLL; + m_xScrolledWindow->SetStyle(nWinBits); + m_xScrolledWindow->queue_resize(); + } + + virtual VclPolicyType get_vpolicy() const override + { + WinBits nWinBits = m_xScrolledWindow->GetStyle(); + if (nWinBits & WB_AUTOVSCROLL) + return VclPolicyType::AUTOMATIC; + else if (nWinBits & WB_VSCROLL) + return VclPolicyType::ALWAYS; + return VclPolicyType::NEVER; + } + + virtual int get_vscroll_width() const override + { + return m_xScrolledWindow->getVertScrollBar().GetSizePixel().Width(); + } + virtual void set_user_managed_scrolling() override { m_bUserManagedScrolling = true; diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index e29619092ba5..26cb8d0bb8d8 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -1926,6 +1926,8 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation) { m_pVScroll->Show(nAvailHeight < aChildReq.Height()); } + else if (m_pVScroll->IsVisible() != bool(GetStyle() & WB_VSCROLL)) + m_pVScroll->Show((GetStyle() & WB_VSCROLL) != 0); if (m_pVScroll->IsVisible()) nAvailWidth -= getLayoutRequisition(*m_pVScroll).Width(); @@ -1942,6 +1944,8 @@ void VclScrolledWindow::setAllocation(const Size &rAllocation) if (GetStyle() & WB_AUTOVSCROLL) m_pVScroll->Show(nAvailHeight < aChildReq.Height()); } + else if (m_pHScroll->IsVisible() != bool(GetStyle() & WB_HSCROLL)) + m_pHScroll->Show((GetStyle() & WB_HSCROLL) != 0); Size aInnerSize(rAllocation); aInnerSize.AdjustWidth(-2); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 47ef69b4077a..05035bb756ad 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -2339,6 +2339,91 @@ GType crippled_viewport_get_type() return type; } +VclPolicyType GtkToVcl(GtkPolicyType eType) +{ + VclPolicyType eRet(VclPolicyType::NEVER); + switch (eType) + { + case GTK_POLICY_ALWAYS: + eRet = VclPolicyType::ALWAYS; + break; + case GTK_POLICY_AUTOMATIC: + eRet = VclPolicyType::AUTOMATIC; + break; + case GTK_POLICY_EXTERNAL: + case GTK_POLICY_NEVER: + eRet = VclPolicyType::NEVER; + break; + } + return eRet; +} + +GtkPolicyType VclToGtk(VclPolicyType eType) +{ + GtkPolicyType eRet(GTK_POLICY_ALWAYS); + switch (eType) + { + case VclPolicyType::ALWAYS: + eRet = GTK_POLICY_ALWAYS; + break; + case VclPolicyType::AUTOMATIC: + eRet = GTK_POLICY_AUTOMATIC; + break; + case VclPolicyType::NEVER: + eRet = GTK_POLICY_NEVER; + break; + } + return eRet; +} + +GtkMessageType VclToGtk(VclMessageType eType) +{ + GtkMessageType eRet(GTK_MESSAGE_INFO); + switch (eType) + { + case VclMessageType::Info: + eRet = GTK_MESSAGE_INFO; + break; + case VclMessageType::Warning: + eRet = GTK_MESSAGE_WARNING; + break; + case VclMessageType::Question: + eRet = GTK_MESSAGE_QUESTION; + break; + case VclMessageType::Error: + eRet = GTK_MESSAGE_ERROR; + break; + } + return eRet; +} + +GtkButtonsType VclToGtk(VclButtonsType eType) +{ + GtkButtonsType eRet(GTK_BUTTONS_NONE); + switch (eType) + { + case VclButtonsType::NONE: + eRet = GTK_BUTTONS_NONE; + break; + case VclButtonsType::Ok: + eRet = GTK_BUTTONS_OK; + break; + case VclButtonsType::Close: + eRet = GTK_BUTTONS_CLOSE; + break; + case VclButtonsType::Cancel: + eRet = GTK_BUTTONS_CANCEL; + break; + case VclButtonsType::YesNo: + eRet = GTK_BUTTONS_YES_NO; + break; + case VclButtonsType::OkCancel: + eRet = GTK_BUTTONS_OK_CANCEL; + break; + } + return eRet; +} + class GtkInstanceScrolledWindow : public GtkInstanceContainer, public virtual weld::ScrolledWindow { private: @@ -2419,6 +2504,27 @@ public: enable_notify_events(); } + virtual void set_vpolicy(VclPolicyType eVPolicy) override + { + GtkPolicyType eGtkHPolicy; + gtk_scrolled_window_get_policy(m_pScrolledWindow, &eGtkHPolicy, nullptr); + gtk_scrolled_window_set_policy(m_pScrolledWindow, eGtkHPolicy, VclToGtk(eVPolicy)); + } + + virtual VclPolicyType get_vpolicy() const override + { + GtkPolicyType eGtkVPolicy; + gtk_scrolled_window_get_policy(m_pScrolledWindow, nullptr, &eGtkVPolicy); + return GtkToVcl(eGtkVPolicy); + } + + virtual int get_vscroll_width() const override + { + if (gtk_scrolled_window_get_overlay_scrolling(m_pScrolledWindow)) + return 0; + return gtk_widget_get_allocated_width(GTK_WIDGET(m_pScrolledWindow)); + } + virtual void disable_notify_events() override { g_signal_handler_block(m_pVAdjustment, m_nVAdjustChangedSignalId); @@ -4962,54 +5068,6 @@ weld::Builder* GtkInstance::CreateBuilder(weld::Widget* pParent, const OUString& return new GtkInstanceBuilder(pBuilderParent, rUIRoot, rUIFile); } -GtkMessageType VclToGtk(VclMessageType eType) -{ - GtkMessageType eRet(GTK_MESSAGE_INFO); - switch (eType) - { - case VclMessageType::Info: - eRet = GTK_MESSAGE_INFO; - break; - case VclMessageType::Warning: - eRet = GTK_MESSAGE_WARNING; - break; - case VclMessageType::Question: - eRet = GTK_MESSAGE_QUESTION; - break; - case VclMessageType::Error: - eRet = GTK_MESSAGE_ERROR; - break; - } - return eRet; -} - -GtkButtonsType VclToGtk(VclButtonsType eType) -{ - GtkButtonsType eRet(GTK_BUTTONS_NONE); - switch (eType) - { - case VclButtonsType::NONE: - eRet = GTK_BUTTONS_NONE; - break; - case VclButtonsType::Ok: - eRet = GTK_BUTTONS_OK; - break; - case VclButtonsType::Close: - eRet = GTK_BUTTONS_CLOSE; - break; - case VclButtonsType::Cancel: - eRet = GTK_BUTTONS_CANCEL; - break; - case VclButtonsType::YesNo: - eRet = GTK_BUTTONS_YES_NO; - break; - case VclButtonsType::OkCancel: - eRet = GTK_BUTTONS_OK_CANCEL; - break; - } - return eRet; -} - weld::MessageDialog* GtkInstance::CreateMessageDialog(weld::Widget* pParent, VclMessageType eMessageType, VclButtonsType eButtonsType, const OUString &rPrimaryMessage) { GtkInstanceWidget* pParentInstance = dynamic_cast<GtkInstanceWidget*>(pParent); |