mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-22 07:10:40 +01:00
[escher] In text field, change background color when editing
Change-Id: I054ce60bb8c7e96076a8f8cafe773d6506d2766a
This commit is contained in:
@@ -39,10 +39,7 @@ View * EditableTextCell::subviewAtIndex(int index) {
|
||||
}
|
||||
|
||||
void EditableTextCell::layoutSubviews() {
|
||||
KDCoordinate width = bounds().width();
|
||||
KDCoordinate height = bounds().height();
|
||||
KDCoordinate textHeight = m_textField.minimalSizeForOptimalDisplay().height();
|
||||
m_textField.setFrame(KDRect(k_separatorThickness, (height - textHeight)/2, width - k_separatorThickness, textHeight));
|
||||
m_textField.setFrame(bounds());
|
||||
}
|
||||
|
||||
void EditableTextCell::didBecomeFirstResponder() {
|
||||
|
||||
@@ -21,11 +21,15 @@ TextField::ContentView::ContentView(char * textBuffer, char * draftTextBuffer, s
|
||||
}
|
||||
|
||||
void TextField::ContentView::drawRect(KDContext * ctx, KDRect rect) const {
|
||||
ctx->fillRect(rect, m_backgroundColor);
|
||||
KDColor bckCol = m_backgroundColor;
|
||||
if (m_isEditing) {
|
||||
bckCol = KDColorWhite;
|
||||
}
|
||||
ctx->fillRect(rect, bckCol);
|
||||
KDSize textSize = KDText::stringSize(text(), m_fontSize);
|
||||
KDPoint origin(m_horizontalAlignment*(m_frame.width() - textSize.width()-m_cursorView.minimalSizeForOptimalDisplay().width()),
|
||||
m_verticalAlignment*(m_frame.height() - textSize.height()));
|
||||
ctx->drawString(text(), origin, m_fontSize, m_textColor, m_backgroundColor);
|
||||
ctx->drawString(text(), origin, m_fontSize, m_textColor, bckCol);
|
||||
}
|
||||
|
||||
void TextField::ContentView::reload() {
|
||||
|
||||
Reference in New Issue
Block a user