ADd Entry::set/getSuffix() property

This commit is contained in:
David Capello 2013-03-29 16:20:32 -03:00
parent c5a0acf7c6
commit c2664b6aac
3 changed files with 17 additions and 3 deletions

View File

@ -975,7 +975,9 @@ void SkinTheme::paintEntry(PaintEvent& ev)
Entry* widget = static_cast<Entry*>(ev.getSource());
bool password = widget->isPassword();
int scroll, caret, state, selbeg, selend;
const char *text = widget->getText();
std::string textString = widget->getText() + widget->getSuffix();
int suffixIndex = widget->getTextSize();
const char* text = textString.c_str();
int c, ch, x, y, w;
int x1, y1, x2, y2;
int caret_x;
@ -1022,7 +1024,10 @@ void SkinTheme::paintEntry(PaintEvent& ev)
}
// Disabled
if (!widget->isEnabled()) {
if (!widget->isEnabled() || (c >= suffixIndex)) {
if (widget->hasFocus())
break;
bg = ColorNone;
fg = getColor(ThemeColor::Disabled);
}

View File

@ -145,6 +145,12 @@ void Entry::deselectText()
invalidate();
}
void Entry::setSuffix(const std::string& suffix)
{
m_suffix = suffix;
invalidate();
}
void Entry::getEntryThemeInfo(int* scroll, int* caret, int* state,
int* selbeg, int* selend)
{
@ -641,4 +647,3 @@ void Entry::backwardWord()
}
} // namespace ui

View File

@ -32,6 +32,9 @@ namespace ui {
void selectText(int from, int to);
void deselectText();
void setSuffix(const std::string& suffix);
const std::string& getSuffix() { return m_suffix; }
// for themes
void getEntryThemeInfo(int* scroll, int* caret, int* state,
int* selbeg, int* selend);
@ -82,6 +85,7 @@ namespace ui {
bool m_readonly : 1;
bool m_password : 1;
bool m_recent_focused : 1;
std::string m_suffix;
};
} // namespace ui