mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-04 18:25:27 +02:00
UI: Make InfoView focusable, make it possible to make TextView focusable.
This commit is contained in:
1 parent
bf4a5f0352
commit
98083c8985
2 files changed
+16
-2
No files matched your search
@@ -414,7 +414,13 @@ void Choice::Draw(UIContext &dc) {
|
||||
|
||||
void InfoItem::Draw(UIContext &dc) {
|
||||
Item::Draw(dc);
|
||||
if (HasFocus()) {
|
||||
UI::Style style = dc.theme->itemFocusedStyle;
|
||||
style.background.color &= 0x7fffffff;
|
||||
dc.FillRect(style.background, bounds_);
|
||||
}
|
||||
int paddingX = 12;
|
||||
|
||||
dc.SetFontStyle(dc.theme->uiFont);
|
||||
dc.DrawText(text_.c_str(), bounds_.x + paddingX, bounds_.centerY(), 0xFFFFFFFF, ALIGN_VCENTER);
|
||||
dc.DrawText(rightText_.c_str(), bounds_.x2() - paddingX, bounds_.centerY(), 0xFFFFFFFF, ALIGN_VCENTER | ALIGN_RIGHT);
|
||||
|
||||
@@ -593,6 +593,9 @@ public:
|
||||
|
||||
void Draw(UIContext &dc) override;
|
||||
|
||||
// These are focusable so that long lists of them can be keybaord scrolled.
|
||||
bool CanBeFocused() const override { return true; }
|
||||
|
||||
private:
|
||||
std::string text_;
|
||||
std::string rightText_;
|
||||
@@ -656,10 +659,10 @@ private:
|
||||
class TextView : public InertView {
|
||||
public:
|
||||
TextView(const std::string &text, LayoutParams *layoutParams = 0)
|
||||
: InertView(layoutParams), text_(text), textAlign_(0), textColor_(0xFFFFFFFF), small_(false), shadow_(false) {}
|
||||
: InertView(layoutParams), text_(text), textAlign_(0), textColor_(0xFFFFFFFF), small_(false), shadow_(false), focusable_(false) {}
|
||||
|
||||
TextView(const std::string &text, int textAlign, bool small, LayoutParams *layoutParams = 0)
|
||||
: InertView(layoutParams), text_(text), textAlign_(textAlign), textColor_(0xFFFFFFFF), small_(small), shadow_(false) {}
|
||||
: InertView(layoutParams), text_(text), textAlign_(textAlign), textColor_(0xFFFFFFFF), small_(small), shadow_(false), focusable_(false) {}
|
||||
|
||||
void GetContentDimensions(const UIContext &dc, float &w, float &h) const override;
|
||||
void Draw(UIContext &dc) override;
|
||||
@@ -668,12 +671,17 @@ public:
|
||||
void SetSmall(bool small) { small_ = small; }
|
||||
void SetTextColor(uint32_t color) { textColor_ = color; }
|
||||
void SetShadow(bool shadow) { shadow_ = shadow; }
|
||||
void SetFocusable(bool focusable) { focusable_ = focusable; }
|
||||
|
||||
bool CanBeFocused() const override { return focusable_; }
|
||||
|
||||
private:
|
||||
std::string text_;
|
||||
int textAlign_;
|
||||
uint32_t textColor_;
|
||||
bool small_;
|
||||
bool shadow_;
|
||||
bool focusable_;
|
||||
};
|
||||
|
||||
class TextEdit : public View {
|
||||
|
||||
Reference in new issue
Block a user