mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-17 04:39:34 +00:00
UI: Allow showing popup string values as password stars
This commit is contained in:
parent
2708f0b93e
commit
0a1bf5532d
@ -1,5 +1,6 @@
|
||||
#include <algorithm>
|
||||
#include <sstream>
|
||||
#include <cstring>
|
||||
|
||||
#include "Common/UI/PopupScreens.h"
|
||||
#include "Common/UI/ViewGroup.h"
|
||||
@ -582,7 +583,12 @@ void AbstractChoiceWithValueDisplay::Draw(UIContext &dc) {
|
||||
int paddingX = 12;
|
||||
dc.SetFontStyle(dc.theme->uiFont);
|
||||
|
||||
const std::string valueText = ValueText();
|
||||
std::string valueText = ValueText();
|
||||
|
||||
if (password_) {
|
||||
// Replace all characters with stars.
|
||||
memset(&valueText[0], '*', valueText.size());
|
||||
}
|
||||
|
||||
// If there is a label, assume we want at least 20% of the size for it, at a minimum.
|
||||
|
||||
|
@ -191,10 +191,16 @@ public:
|
||||
void Draw(UIContext &dc) override;
|
||||
void GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const override;
|
||||
|
||||
void SetPasswordDisplay() {
|
||||
password_ = true;
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual std::string ValueText() const = 0;
|
||||
|
||||
float CalculateValueScale(const UIContext &dc, const std::string &valueText, float availWidth) const;
|
||||
|
||||
bool password_ = false;
|
||||
};
|
||||
|
||||
// Reads and writes value to determine the current selection.
|
||||
|
Loading…
x
Reference in New Issue
Block a user