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/.
12 #include <vcl/idle.hxx>
13 #include <vcl/weld.hxx>
16 class AutocompleteEdit
19 std::unique_ptr
<weld::Entry
> m_xEntry
;
21 std::vector
<OUString
> m_aEntries
;
22 std::vector
<OUString
> m_aMatching
;
24 Link
<weld::Entry
&, void> m_aChangeHdl
;
25 sal_uInt16 m_nLastCharCode
;
27 DECL_LINK(KeyInputHdl
, const KeyEvent
&, bool);
28 DECL_LINK(ChangedHdl
, weld::Entry
&, void);
29 DECL_LINK(TryAutoComplete
, Timer
*, void);
31 bool Match(std::u16string_view rText
);
34 AutocompleteEdit(std::unique_ptr
<weld::Entry
> xEntry
);
36 void show() { m_xEntry
->show(); }
37 void set_sensitive(bool bSensitive
) { m_xEntry
->set_sensitive(bSensitive
); }
38 OUString
get_text() const { return m_xEntry
->get_text(); }
39 void set_text(const OUString
& rText
) { m_xEntry
->set_text(rText
); }
40 void grab_focus() { m_xEntry
->grab_focus(); }
41 void select_region(int nStartPos
, int nEndPos
) { m_xEntry
->select_region(nStartPos
, nEndPos
); }
43 void connect_changed(const Link
<weld::Entry
&, void>& rLink
) { m_aChangeHdl
= rLink
; }
44 void connect_focus_in(const Link
<weld::Widget
&, void>& rLink
)
46 m_xEntry
->connect_focus_in(rLink
);
49 void AddEntry(const OUString
& rEntry
);
53 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */