[Libreoffice-commits] core.git: vcl/inc vcl/jsdialog

Szymon KÅ‚os (via logerrit) logerrit at kemper.freedesktop.org
Thu Jan 14 09:22:08 UTC 2021


 vcl/inc/jsdialog/jsdialogbuilder.hxx |   18 ++++++++++++
 vcl/jsdialog/jsdialogbuilder.cxx     |   50 +++++++++++++++++++++++++++++++++++
 2 files changed, 68 insertions(+)

New commits:
commit 95bddeaa8176ca4c79274632fce24181dcd8bc0a
Author:     Szymon Kłos <szymon.klos at collabora.com>
AuthorDate: Wed Dec 16 23:00:11 2020 +0300
Commit:     Szymon Kłos <szymon.klos at collabora.com>
CommitDate: Thu Jan 14 10:21:29 2021 +0100

    jsdialogs: implemented IconView
    
    Change-Id: I05f5009efc879aaf3fc6055ff8dfa7c26aa33d1b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108983
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Szymon Kłos <szymon.klos at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/109244
    Tested-by: Jenkins

diff --git a/vcl/inc/jsdialog/jsdialogbuilder.hxx b/vcl/inc/jsdialog/jsdialogbuilder.hxx
index 8740ce5db983..ca59aab24924 100644
--- a/vcl/inc/jsdialog/jsdialogbuilder.hxx
+++ b/vcl/inc/jsdialog/jsdialogbuilder.hxx
@@ -28,6 +28,7 @@ class ToolBox;
 class ComboBox;
 class VclMultiLineEdit;
 class SvTabListBox;
+class IconView;
 
 typedef std::map<OString, weld::Widget*> WidgetMap;
 
@@ -174,6 +175,7 @@ public:
     virtual std::unique_ptr<weld::TextView> weld_text_view(const OString& id) override;
     virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString& id) override;
     virtual std::unique_ptr<weld::Expander> weld_expander(const OString& id) override;
+    virtual std::unique_ptr<weld::IconView> weld_icon_view(const OString& id) override;
 
     static weld::MessageDialog* CreateMessageDialog(weld::Widget* pParent,
                                                     VclMessageType eMessageType,
@@ -444,4 +446,20 @@ public:
     virtual void set_expanded(bool bExpand) override;
 };
 
+class JSIconView : public JSWidget<SalInstanceIconView, ::IconView>
+{
+public:
+    JSIconView(JSDialogSender* pSender, ::IconView* pIconView, SalInstanceBuilder* pBuilder,
+               bool bTakeOwnership);
+
+    virtual void insert(int pos, const OUString* pStr, const OUString* pId,
+                        const OUString* pIconName, weld::TreeIter* pRet) override;
+
+    virtual void insert(int pos, const OUString* pStr, const OUString* pId,
+                        const VirtualDevice* pIcon, weld::TreeIter* pRet) override;
+    virtual void clear() override;
+    virtual void select(int pos) override;
+    virtual void unselect(int pos) override;
+};
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
diff --git a/vcl/jsdialog/jsdialogbuilder.cxx b/vcl/jsdialog/jsdialogbuilder.cxx
index 921552a7d32c..81ba11f92fb9 100644
--- a/vcl/jsdialog/jsdialogbuilder.cxx
+++ b/vcl/jsdialog/jsdialogbuilder.cxx
@@ -667,6 +667,18 @@ std::unique_ptr<weld::Expander> JSInstanceBuilder::weld_expander(const OString&
     return pWeldWidget;
 }
 
+std::unique_ptr<weld::IconView> JSInstanceBuilder::weld_icon_view(const OString& id)
+{
+    ::IconView* pIconView = m_xBuilder->get<::IconView>(id);
+    auto pWeldWidget
+        = pIconView ? std::make_unique<JSIconView>(this, pIconView, this, false) : nullptr;
+
+    if (pWeldWidget)
+        RememberWidget(id, pWeldWidget.get());
+
+    return pWeldWidget;
+}
+
 weld::MessageDialog* JSInstanceBuilder::CreateMessageDialog(weld::Widget* pParent,
                                                             VclMessageType eMessageType,
                                                             VclButtonsType eButtonType,
@@ -1056,4 +1068,42 @@ void JSExpander::set_expanded(bool bExpand)
     notifyDialogState();
 }
 
+JSIconView::JSIconView(JSDialogSender* pSender, ::IconView* pIconView, SalInstanceBuilder* pBuilder,
+                       bool bTakeOwnership)
+    : JSWidget<SalInstanceIconView, ::IconView>(pSender, pIconView, pBuilder, bTakeOwnership)
+{
+}
+
+void JSIconView::insert(int pos, const OUString* pStr, const OUString* pId,
+                        const OUString* pIconName, weld::TreeIter* pRet)
+{
+    SalInstanceIconView::insert(pos, pStr, pId, pIconName, pRet);
+    notifyDialogState();
+}
+
+void JSIconView::insert(int pos, const OUString* pStr, const OUString* pId,
+                        const VirtualDevice* pIcon, weld::TreeIter* pRet)
+{
+    SalInstanceIconView::insert(pos, pStr, pId, pIcon, pRet);
+    notifyDialogState();
+}
+
+void JSIconView::clear()
+{
+    SalInstanceIconView::clear();
+    notifyDialogState();
+}
+
+void JSIconView::select(int pos)
+{
+    SalInstanceIconView::select(pos);
+    notifyDialogState();
+}
+
+void JSIconView::unselect(int pos)
+{
+    SalInstanceIconView::unselect(pos);
+    notifyDialogState();
+}
+
 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */


More information about the Libreoffice-commits mailing list