1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
10 #ifndef INCLUDED_SVTOOLS_AUTOCMPLEDIT_HXX
11 #define INCLUDED_SVTOOLS_AUTOCMPLEDIT_HXX
13 #include <vcl/idle.hxx>
14 #include <vcl/weld.hxx>
17 class AutocompleteEdit
20 std::unique_ptr
<weld::Entry
> m_xEntry
;
22 std::vector
< OUString
> m_aEntries
;
23 std::vector
< OUString
> m_aMatching
;
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
);
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
);
51 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */