Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / fpicker / source / office / autocmpledit.hxx
blobfc1108e383c27647597ccdb8a9f8c28a73ee85b9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_SVTOOLS_AUTOCMPLEDIT_HXX
11 #define INCLUDED_SVTOOLS_AUTOCMPLEDIT_HXX
13 #include <vcl/idle.hxx>
14 #include <vcl/weld.hxx>
15 #include <vector>
17 class AutocompleteEdit
19 private:
20 std::unique_ptr<weld::Entry> m_xEntry;
22 std::vector< OUString > m_aEntries;
23 std::vector< OUString > m_aMatching;
24 Idle m_aChangedIdle;
25 Link<weld::Entry&, void> m_aChangeHdl;
27 DECL_LINK(ChangedHdl, weld::Entry&, void);
28 DECL_LINK(TryAutoComplete, Timer*, void);
30 bool Match( const OUString& rText );
32 public:
33 AutocompleteEdit(std::unique_ptr<weld::Entry> xEntry);
35 void show() { m_xEntry->show(); }
36 void set_sensitive(bool bSensitive) { m_xEntry->set_sensitive(bSensitive); }
37 OUString get_text() const { return m_xEntry->get_text(); }
38 void set_text(const OUString& rText) { m_xEntry->set_text(rText); }
39 void grab_focus() { m_xEntry->grab_focus(); }
40 void select_region(int nStartPos, int nEndPos) { m_xEntry->select_region(nStartPos, nEndPos); }
42 void connect_changed(const Link<weld::Entry&, void>& rLink) { m_aChangeHdl = rLink; }
43 void connect_focus_in(const Link<weld::Widget&, void>& rLink) { m_xEntry->connect_focus_in(rLink); }
45 void AddEntry( const OUString& rEntry );
46 void ClearEntries();
49 #endif
51 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */