Skip to content

Commit

Permalink
Add getter and example
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaudic committed Nov 15, 2024
1 parent f7529a3 commit 65745cb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/widgets_example.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ namespace WidgetsExample

textField = std::make_unique<gcn::TextField>("Text field");

passwordField = std::make_unique<gcn::PasswordField>("password");

textBox = std::make_unique<gcn::TextBox>("Lorem ipsum dolor sit amet consectetur\n"
"adipiscing elit Integer vitae ultrices\n"
"eros Curabitur malesuada dolor imperdieat\n"
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -228,6 +231,7 @@ namespace WidgetsExample
std::unique_ptr<gcn::ImageTextButton> imageTextButton; // An image text button
std::unique_ptr<gcn::InputBox> inputBox; // An input box
std::unique_ptr<gcn::TextField> textField; // One-line text field
std::unique_ptr<gcn::PasswordField> passwordField; // One-line password field
std::unique_ptr<gcn::TextBox> textBox; // Multi-line text box
std::unique_ptr<gcn::ScrollArea> textBoxScrollArea; // Scroll area for the text box
std::unique_ptr<gcn::ListBox> listBox; // A list box
Expand Down
7 changes: 7 additions & 0 deletions include/guisan/widgets/passwordfield.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '*';
};
Expand Down
5 changes: 5 additions & 0 deletions src/widgets/passwordfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,10 @@ namespace gcn
{
masking = mask;
}

const char PasswordField::getMaskingChar() const
{
return masking;
}

}

0 comments on commit 65745cb

Please sign in to comment.