diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-03-06 12:25:35 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-03-07 21:18:42 +0100 |
commit | 82925b574209d3971c05b9bd98a317683dd583a5 (patch) | |
tree | 7fedf333686a3c25942debf82328978e97d7a437 /vcl | |
parent | 64117f700ba3bd8c4b42488f582fa5e5c53487e6 (diff) |
weld SfxNewFileDialog
Change-Id: I28b1aff90407bce7d04f10eed6a227c0970f9c0a
Reviewed-on: https://gerrit.libreoffice.org/50878
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.cxx | 58 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 59 |
2 files changed, 112 insertions, 5 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 02626e61b2d2..b01cff2f25b9 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -399,6 +399,14 @@ public: return false; } + virtual void set_busy_cursor(bool bBusy) override + { + if (bBusy) + m_xWindow->EnterWait(); + else + m_xWindow->LeaveWait(); + } + virtual ~SalInstanceWindow() override { clear_child_help(m_xWindow); @@ -861,12 +869,12 @@ public: virtual void select(int pos) override { + assert(m_xTreeView->IsUpdateMode() && "don't select when frozen"); if (pos == -1) - { m_xTreeView->SetNoSelection(); - return; - } - m_xTreeView->SelectEntryPos(pos); + else + m_xTreeView->SelectEntryPos(pos); + m_xTreeView->Select(); } virtual OUString get_selected() override @@ -1063,6 +1071,42 @@ public: } }; +class SalInstanceExpander : public SalInstanceContainer, public virtual weld::Expander +{ +private: + VclPtr<VclExpander> m_xExpander; + + DECL_LINK(ExpandedHdl, VclExpander&, void); + +public: + SalInstanceExpander(VclExpander* pExpander, bool bTakeOwnership) + : SalInstanceContainer(pExpander, bTakeOwnership) + , m_xExpander(pExpander) + { + m_xExpander->SetExpandedHdl(LINK(this, SalInstanceExpander, ExpandedHdl)); + } + + virtual bool get_expanded() const override + { + return m_xExpander->get_expanded(); + } + + virtual void set_expanded(bool bExpand) override + { + m_xExpander->set_expanded(bExpand); + } + + virtual ~SalInstanceExpander() override + { + m_xExpander->SetExpandedHdl(Link<VclExpander&, void>()); + } +}; + +IMPL_LINK_NOARG(SalInstanceExpander, ExpandedHdl, VclExpander&, void) +{ + signal_expanded(); +} + class SalInstanceDrawingArea : public SalInstanceWidget, public virtual weld::DrawingArea { private: @@ -1365,6 +1409,12 @@ public: return pTextView ? new SalInstanceTextView(pTextView, bTakeOwnership) : nullptr; } + virtual weld::Expander* weld_expander(const OString &id, bool bTakeOwnership) override + { + VclExpander* pExpander = m_xBuilder->get<VclExpander>(id); + return pExpander ? new SalInstanceExpander(pExpander, bTakeOwnership) : nullptr; + } + virtual weld::DrawingArea* weld_drawing_area(const OString &id, bool bTakeOwnership) override { VclDrawingArea* pDrawingArea = m_xBuilder->get<VclDrawingArea>(id); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index b3071c9a4ee4..ef8060662269 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -1404,6 +1404,17 @@ public: const gchar* pStr = gtk_window_get_title(m_pWindow); return OUString(pStr, pStr ? strlen(pStr) : 0, RTL_TEXTENCODING_UTF8); } + + virtual void set_busy_cursor(bool bBusy) override + { + gtk_widget_realize(m_pWidget); + GdkDisplay *pDisplay = gtk_widget_get_display(m_pWidget); + GdkCursor *pCursor = bBusy ? gdk_cursor_new_from_name(pDisplay, "progress") : nullptr; + gdk_window_set_cursor(gtk_widget_get_window(m_pWidget), pCursor); + gdk_display_flush(pDisplay); + if (pCursor) + g_object_unref(pCursor); + } }; namespace @@ -2027,6 +2038,7 @@ public: virtual void select(int pos) override { + assert(gtk_tree_view_get_model(m_pTreeView) && "don't select when frozen"); if (pos != -1) { GtkTreePath* path = gtk_tree_path_new_from_indices(pos, -1); @@ -2406,7 +2418,7 @@ public: GtkInstanceComboBoxText(GtkComboBoxText* pComboBoxText, bool bTakeOwnership) : GtkInstanceContainer(GTK_CONTAINER(pComboBoxText), bTakeOwnership) , m_pComboBoxText(pComboBoxText) - , m_nSignalId(g_signal_connect(pComboBoxText, "changed", G_CALLBACK(signalChanged), this)) + , m_nSignalId(g_signal_connect(m_pComboBoxText, "changed", G_CALLBACK(signalChanged), this)) { } @@ -2527,6 +2539,42 @@ public: } }; +class GtkInstanceExpander : public GtkInstanceContainer, public virtual weld::Expander +{ +private: + GtkExpander* m_pExpander; + gulong m_nSignalId; + + static void signalExpanded(GtkExpander*, GParamSpec *, gpointer widget) + { + GtkInstanceExpander* pThis = static_cast<GtkInstanceExpander*>(widget); + pThis->signal_expanded(); + } + +public: + GtkInstanceExpander(GtkExpander* pExpander, bool bTakeOwnership) + : GtkInstanceContainer(GTK_CONTAINER(pExpander), bTakeOwnership) + , m_pExpander(pExpander) + , m_nSignalId(g_signal_connect(m_pExpander, "notify::expanded", G_CALLBACK(signalExpanded), this)) + { + } + + virtual bool get_expanded() const override + { + return gtk_expander_get_expanded(m_pExpander); + } + + virtual void set_expanded(bool bExpand) override + { + gtk_expander_set_expanded(m_pExpander, bExpand); + } + + virtual ~GtkInstanceExpander() override + { + g_signal_handler_disconnect(m_pExpander, m_nSignalId); + } +}; + namespace { gboolean signalTooltipQuery(GtkWidget* pWidget, gint /*x*/, gint /*y*/, @@ -2810,6 +2858,15 @@ public: return new GtkInstanceTextView(pTextView, bTakeOwnership); } + virtual weld::Expander* weld_expander(const OString &id, bool bTakeOwnership) override + { + GtkExpander* pExpander = GTK_EXPANDER(gtk_builder_get_object(m_pBuilder, id.getStr())); + if (!pExpander) + return nullptr; + auto_add_parentless_widgets_to_container(GTK_WIDGET(pExpander)); + return new GtkInstanceExpander(pExpander, bTakeOwnership); + } + virtual weld::DrawingArea* weld_drawing_area(const OString &id, bool bTakeOwnership) override { GtkDrawingArea* pDrawingArea = GTK_DRAWING_AREA(gtk_builder_get_object(m_pBuilder, id.getStr())); |