FifeGUI 0.3.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// Standard library includes
9#include <string>
10
11// Project headers (subdirs before local)
12#include <fifechan/widgets/textfield.hpp>
13
14namespace fcn
15{
16 class Text;
17
21 class FIFEGUI_API PasswordField : public TextField
22 {
23 public:
29 explicit PasswordField(std::string const & text = "");
30
31 ~PasswordField() override;
32
33 PasswordField(PasswordField const &) = delete;
34 PasswordField& operator=(PasswordField const &) = delete;
35 PasswordField(PasswordField&&) = delete;
36 PasswordField& operator=(PasswordField&&) = delete;
37
38 // Inherited from TextField
39
40 void keyPressed(KeyEvent& keyEvent) override;
41
42 void setText(std::string const & text) override; // cppcheck-suppress virtualCallInConstructor
43
44 std::string getText() const override;
45
46 private:
50 unsigned int getActualTextCaretPosition() const;
51
57 void setActualTextCaretPosition(unsigned int position);
58
63 Text* mActualText;
64 };
65}; // namespace fcn
66
67#endif // INCLUDE_FIFECHAN_WIDGETS_PASSWORDFIELD_HPP_
Represents a key event.
Definition keyevent.hpp:26
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:32
Used replacement tokens by configure_file():