diff options
author | Caolán McNamara <caolanm@redhat.com> | 2019-10-21 14:20:12 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2019-10-29 13:58:47 +0100 |
commit | 09e3d45cdc5c739e5246388a83ccfc6d76bf66e9 (patch) | |
tree | 5ae533f38a626016951b02e7d2406c368b298723 /include | |
parent | 93a641d291adf86491cc68ac64f4f614c937183a (diff) |
weld fpicker cluster
Change-Id: I6566263809ff0032388a0b56571f0cf7428058d7
Reviewed-on: https://gerrit.libreoffice.org/81334
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/svtools/imagemgr.hxx | 1 | ||||
-rw-r--r-- | include/svtools/inettbc.hxx | 10 | ||||
-rw-r--r-- | include/svtools/strings.hrc | 11 | ||||
-rw-r--r-- | include/vcl/treelistbox.hxx | 1 | ||||
-rw-r--r-- | include/vcl/weld.hxx | 95 |
5 files changed, 96 insertions, 22 deletions
diff --git a/include/svtools/imagemgr.hxx b/include/svtools/imagemgr.hxx index 697ab8aeb41c..0eb8b5e96f00 100644 --- a/include/svtools/imagemgr.hxx +++ b/include/svtools/imagemgr.hxx @@ -124,6 +124,7 @@ public: SVT_DLLPUBLIC static OUString GetFileImageId( const INetURLObject& rURL ); SVT_DLLPUBLIC static Image GetFileImage( const INetURLObject& rURL ); SVT_DLLPUBLIC static Image GetImageNoDefault(const INetURLObject& rURL, bool bBig = false, Size const & rPreferredSize = Size()); + SVT_DLLPUBLIC static OUString GetFolderImageId( const svtools::VolumeInfo& rInfo ); SVT_DLLPUBLIC static Image GetFolderImage( const svtools::VolumeInfo& rInfo ); SVT_DLLPUBLIC static OUString GetDescription( const INetURLObject& rObject ); diff --git a/include/svtools/inettbc.hxx b/include/svtools/inettbc.hxx index ff2a674618b8..c6c3b03137dd 100644 --- a/include/svtools/inettbc.hxx +++ b/include/svtools/inettbc.hxx @@ -98,9 +98,12 @@ class SVT_DLLPUBLIC URLBox rtl::Reference< MatchContext_Impl > pCtx; std::unique_ptr<SvtURLBox_Impl> pImpl; INetProtocol eSmartProtocol; + bool bOnlyDirectories : 1; bool bHistoryDisabled : 1; + bool bNoSelection : 1; Link<weld::ComboBox&, void> aChangeHdl; + Link<weld::Widget&, void> aFocusInHdl; Link<weld::Widget&, void> aFocusOutHdl; std::unique_ptr<weld::ComboBox> m_xWidget; @@ -122,16 +125,21 @@ public: void connect_entry_activate(const Link<weld::ComboBox&, bool>& rLink) { m_xWidget->connect_entry_activate(rLink); } void connect_changed(const Link<weld::ComboBox&, void>& rLink) { aChangeHdl = rLink; } void trigger_changed() { aChangeHdl.Call(*m_xWidget); } + void connect_focus_in(const Link<weld::Widget&, void>& rLink) { aFocusInHdl = rLink; } void connect_focus_out(const Link<weld::Widget&, void>& rLink) { aFocusOutHdl = rLink; } void append_text(const OUString& rStr) { m_xWidget->append_text(rStr); } int find_text(const OUString& rStr) const { return m_xWidget->find_text(rStr); } OUString get_active_text() const { return m_xWidget->get_active_text(); } void grab_focus() { m_xWidget->grab_focus(); } void set_sensitive(bool bSensitive) { m_xWidget->set_sensitive(bSensitive); } - void EnableAutocomplete() { m_xWidget->set_entry_completion(true); } + void set_help_id(const OString& rHelpId) { m_xWidget->set_help_id(rHelpId); } + void select_entry_region(int nStartPos, int nEndPos) { m_xWidget->select_entry_region(nStartPos, nEndPos); } + void EnableAutocomplete(bool bEnable = true) { m_xWidget->set_entry_completion(bEnable); } void SetBaseURL( const OUString& rURL ); const OUString& GetBaseURL() const { return aBaseURL; } + void SetOnlyDirectories( bool bDir ); + void SetNoURLSelection( bool bSet ); void SetSmartProtocol( INetProtocol eProt ); INetProtocol GetSmartProtocol() const { return eSmartProtocol; } OUString GetURL(); diff --git a/include/svtools/strings.hrc b/include/svtools/strings.hrc index a7ddf804c2e3..5b99e51605e3 100644 --- a/include/svtools/strings.hrc +++ b/include/svtools/strings.hrc @@ -103,22 +103,11 @@ #define STR_FURTHER_OBJECT NC_("STR_FURTHER_OBJECT", "Further objects") #define STR_UNKNOWN_SOURCE NC_("STR_UNKNOWN_SOURCE", "Unknown source") -#define STR_SVT_FILEVIEW_COLUMN_TITLE NC_("STR_SVT_FILEVIEW_COLUMN_TITLE", "Name") -#define STR_SVT_FILEVIEW_COLUMN_SIZE NC_("STR_SVT_FILEVIEW_COLUMN_SIZE", "Size") -#define STR_SVT_FILEVIEW_COLUMN_DATE NC_("STR_SVT_FILEVIEW_COLUMN_DATE", "Date modified") -#define STR_SVT_FILEVIEW_COLUMN_TYPE NC_("STR_SVT_FILEVIEW_COLUMN_TYPE", "Type") #define STR_SVT_BYTES NC_("STR_SVT_BYTES", "Bytes") #define STR_SVT_KB NC_("STR_SVT_KB", "KB") #define STR_SVT_MB NC_("STR_SVT_MB", "MB") #define STR_SVT_GB NC_("STR_SVT_GB", "GB") -// descriptions of accessible objects -#define STR_SVT_ACC_DESC_TABLISTBOX NC_("STR_SVT_ACC_DESC_TABLISTBOX", "Row: %1, Column: %2") -#define STR_SVT_ACC_DESC_FILEVIEW NC_("STR_SVT_ACC_DESC_FILEVIEW", ", Type: %1, URL: %2") -#define STR_SVT_ACC_DESC_FOLDER NC_("STR_SVT_ACC_DESC_FOLDER", "Folder") -#define STR_SVT_ACC_DESC_FILE NC_("STR_SVT_ACC_DESC_FILE", "File") -#define STR_SVT_ACC_EMPTY_FIELD NC_("STR_SVT_ACC_EMPTY_FIELD", "Empty Field") - /* * resources for CollatorResource / CollatorResourceData resp. */ diff --git a/include/vcl/treelistbox.hxx b/include/vcl/treelistbox.hxx index f370d284e59f..847fda6b71d4 100644 --- a/include/vcl/treelistbox.hxx +++ b/include/vcl/treelistbox.hxx @@ -188,6 +188,7 @@ class VCL_DLLPUBLIC SvTreeListBox friend class SvImpLBox; friend class IconViewImpl; friend class TreeControlPeer; + friend class SalInstanceIconView; friend class SalInstanceTreeView; friend class SalInstanceEntryTreeView; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 300cdf04641f..21550aae2b8c 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -27,6 +27,7 @@ #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> +#include <assert.h> #include <memory> #include <vector> @@ -599,8 +600,8 @@ public: { insert(-1, rStr, &rId, nullptr, &rImage); } - virtual void insert_separator(int pos) = 0; - void append_separator() { insert_separator(-1); } + virtual void insert_separator(int pos, const OUString& rId) = 0; + void append_separator(const OUString& rId) { insert_separator(-1, rId); } virtual int get_count() const = 0; virtual void make_sorted() = 0; @@ -911,16 +912,15 @@ public: void connect_expanding(const Link<const TreeIter&, bool>& rLink) { m_aExpandingHdl = rLink; } - // return true to allow editing, false to disallow - virtual void connect_editing_started(const Link<const TreeIter&, bool>& rLink) - { - m_aEditingStartedHdl = rLink; - } - + // rStartLink returns true to allow editing, false to disallow + // rEndLink returns true to accept the edit, false to reject virtual void - connect_editing_done(const Link<const std::pair<const TreeIter&, OUString>&, bool>& rLink) + connect_editing(const Link<const TreeIter&, bool>& rStartLink, + const Link<const std::pair<const TreeIter&, OUString>&, bool>& rEndLink) { - m_aEditingDoneHdl = rLink; + assert(rStartLink.IsSet() == rEndLink.IsSet() && "should be both on or both off"); + m_aEditingStartedHdl = rStartLink; + m_aEditingDoneHdl = rEndLink; } virtual void start_editing(const weld::TreeIter& rEntry) = 0; @@ -993,6 +993,77 @@ public: using Widget::set_sensitive; }; +class VCL_DLLPUBLIC IconView : virtual public Container +{ +private: + OUString m_sSavedValue; + +protected: + Link<IconView&, void> m_aSelectionChangeHdl; + Link<IconView&, bool> m_aItemActivatedHdl; + + void signal_selection_changed() { m_aSelectionChangeHdl.Call(*this); } + bool signal_item_activated() { return m_aItemActivatedHdl.Call(*this); } + +public: + virtual void insert(int pos, const OUString* pStr, const OUString* pId, + const OUString* pIconName, TreeIter* pRet) + = 0; + + void append(const OUString& rId, const OUString& rStr, const OUString& rImage) + { + insert(-1, &rStr, &rId, &rImage, nullptr); + } + + void connect_selection_changed(const Link<IconView&, void>& rLink) + { + m_aSelectionChangeHdl = rLink; + } + + /* A row is "activated" when the user double clicks a treeview row. It may + also be emitted when a row is selected and Space or Enter is pressed. + + a return of "true" means the activation has been handled, a "false" propagates + the activation to the default handler which expands/collapses the row, if possible. + */ + void connect_item_activated(const Link<IconView&, bool>& rLink) { m_aItemActivatedHdl = rLink; } + + virtual OUString get_selected_id() const = 0; + + virtual void clear() = 0; + + virtual int count_selected_items() const = 0; + + virtual OUString get_selected_text() const = 0; + + //by index + virtual void select(int pos) = 0; + virtual void unselect(int pos) = 0; + + //via iter + virtual std::unique_ptr<TreeIter> make_iterator(const TreeIter* pOrig = nullptr) const = 0; + virtual bool get_selected(TreeIter* pIter) const = 0; + virtual bool get_cursor(TreeIter* pIter) const = 0; + virtual void set_cursor(const TreeIter& rIter) = 0; + virtual bool get_iter_first(TreeIter& rIter) const = 0; + virtual OUString get_id(const TreeIter& rIter) const = 0; + virtual void scroll_to_item(const TreeIter& rIter) = 0; + + // call func on each selected element until func returns true or we run out of elements + virtual void selected_foreach(const std::function<bool(TreeIter&)>& func) = 0; + + //all of them + void select_all() { unselect(-1); } + void unselect_all() { select(-1); } + + // return the number of toplevel nodes + virtual int n_children() const = 0; + + void save_value() { m_sSavedValue = get_selected_text(); } + OUString const& get_saved_value() const { return m_sSavedValue; } + bool get_value_changed_from_saved() const { return m_sSavedValue != get_selected_text(); } +}; + class VCL_DLLPUBLIC Button : virtual public Container { protected: @@ -1334,6 +1405,7 @@ class VCL_DLLPUBLIC Image : virtual public Widget public: virtual void set_from_icon_name(const OUString& rIconName) = 0; virtual void set_image(VirtualDevice* pDevice) = 0; + virtual void set_image(const css::uno::Reference<css::graphic::XGraphic>& rImage) = 0; }; class VCL_DLLPUBLIC Calendar : virtual public Widget @@ -1846,6 +1918,7 @@ public: virtual bool get_item_sensitive(const OString& rIdent) const = 0; virtual void set_item_active(const OString& rIdent, bool bActive) = 0; virtual bool get_item_active(const OString& rIdent) const = 0; + virtual void set_item_menu(const OString& rIdent, weld::Menu* pMenu) = 0; virtual void set_item_popover(const OString& rIdent, weld::Widget* pPopover) = 0; virtual void insert_separator(int pos, const OUString& rId) = 0; @@ -1927,6 +2000,8 @@ public: = 0; virtual std::unique_ptr<TreeView> weld_tree_view(const OString& id, bool bTakeOwnership = false) = 0; + virtual std::unique_ptr<IconView> weld_icon_view(const OString& id, bool bTakeOwnership = false) + = 0; virtual std::unique_ptr<Label> weld_label(const OString& id, bool bTakeOwnership = false) = 0; virtual std::unique_ptr<TextView> weld_text_view(const OString& id, bool bTakeOwnership = false) = 0; |