FifeGUI 0.2.0
A C++ GUI library designed for games.
passwordfield.hpp
1// SPDX-License-Identifier: LGPL-2.1-or-later OR BSD-3-Clause
2// SPDX-FileCopyrightText: 2004 - 2008 Olof Naessén and Per Larsson
3// SPDX-FileCopyrightText: 2013 - 2026 Fifengine contributors
4
5#ifndef INCLUDE_FIFECHAN_WIDGETS_PASSWORDFIELD_HPP_
6#define INCLUDE_FIFECHAN_WIDGETS_PASSWORDFIELD_HPP_
7
8#include <fifechan/widgets/textfield.hpp>
9
10#include <string>
11
12namespace fcn
13{
14 class Text;
15
19 class FIFEGUI_API PasswordField : public TextField
20 {
21 public:
27 explicit PasswordField(std::string const & text = "");
28
29 ~PasswordField() override;
30
31 PasswordField(PasswordField const &) = delete;
32 PasswordField& operator=(PasswordField const &) = delete;
33 PasswordField(PasswordField&&) = delete;
34 PasswordField& operator=(PasswordField&&) = delete;
35
36 // Inherited from TextField
37
38 void keyPressed(KeyEvent& keyEvent) override;
39
40 void setText(std::string const & text) override;
41
42 std::string getText() const override;
43
44 private:
48 unsigned int getActualTextCaretPosition() const;
49
53 void setActualTextCaretPosition(unsigned int position);
54
59 Text* mActualText;
60 };
61}; // namespace fcn
62
63#endif // INCLUDE_FIFECHAN_WIDGETS_PASSWORDFIELD_HPP_
Represents a key event.
Definition keyevent.hpp:22
std::string getText() const override
Gets the text of the text field.
PasswordField(std::string const &text="")
Constructor.
void keyPressed(KeyEvent &keyEvent) override
Called if a key is pressed when the widget has keyboard focus.
void setText(std::string const &text) override
Sets the text of the text field.
Helper class for text manipulation within widgets.
Definition text.hpp:28