diff --git a/examples/widgets_example.hpp b/examples/widgets_example.hpp index 79728f7..f83cc40 100644 --- a/examples/widgets_example.hpp +++ b/examples/widgets_example.hpp @@ -79,6 +79,8 @@ namespace WidgetsExample textField = std::make_unique("Text field"); + passwordField = std::make_unique("password"); + textBox = std::make_unique("Lorem ipsum dolor sit amet consectetur\n" "adipiscing elit Integer vitae ultrices\n" "eros Curabitur malesuada dolor imperdieat\n" @@ -150,6 +152,7 @@ namespace WidgetsExample top->add(imageButton.get(), 10, 290); top->add(imageTextButton.get(), 10, 380); top->add(textField.get(), 375, 10); + top->add(passwordField.get(), 425, 10); top->add(textBoxScrollArea.get(), 290, 50); top->add(inputBox.get(), 270, 180); top->add(listBox.get(), 290, 200); @@ -228,6 +231,7 @@ namespace WidgetsExample std::unique_ptr imageTextButton; // An image text button std::unique_ptr inputBox; // An input box std::unique_ptr textField; // One-line text field + std::unique_ptr passwordField; // One-line password field std::unique_ptr textBox; // Multi-line text box std::unique_ptr textBoxScrollArea; // Scroll area for the text box std::unique_ptr listBox; // A list box diff --git a/include/guisan/widgets/passwordfield.hpp b/include/guisan/widgets/passwordfield.hpp index 0ebfb7a..09bdc7d 100644 --- a/include/guisan/widgets/passwordfield.hpp +++ b/include/guisan/widgets/passwordfield.hpp @@ -96,6 +96,13 @@ namespace gcn */ void setMaskingChar(const char mask); + /** + * Get the masking character + * + * @return the masking character + */ + const char getMaskingChar() const; + private: char masking = '*'; }; diff --git a/src/widgets/passwordfield.cpp b/src/widgets/passwordfield.cpp index b34b567..a9897e7 100644 --- a/src/widgets/passwordfield.cpp +++ b/src/widgets/passwordfield.cpp @@ -90,5 +90,10 @@ namespace gcn { masking = mask; } + + const char PasswordField::getMaskingChar() const + { + return masking; + } }