Enhance FormField paint to allow instantiator to set a background color handler. Used in FlightModes() to set background color. Enhance GridLayout to allow whitespace at top. changed modal to use hard coded BLACK instead of theme color as per JimB40

This commit is contained in:
kkoenig1@optonline.com
2021-09-29 10:56:55 +10:00
committed by Peter Feerick
parent 461b8971a2
commit d862cd6a8c
+16 -13
View File
@@ -86,21 +86,24 @@ void FormField::setFocus(uint8_t flag, Window * from)
void FormField::paint(BitmapBuffer * dc)
{
if (editMode) {
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, COLOR_THEME_EDIT);
}
else {
if (!(windowFlags & FORM_NO_BORDER)) {
if (hasFocus()) {
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, COLOR_THEME_FOCUS);
} else if (!(windowFlags & FORM_BORDER_FOCUS_ONLY)) {
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, COLOR_THEME_PRIMARY2);
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, COLOR_THEME_SECONDARY2);
}
uint32_t bgColor = 0;
if (backgroundHandler) {
bgColor = backgroundHandler(this);
} else {
if (editMode) {
bgColor = COLOR_THEME_EDIT;
} else if (hasFocus()) {
bgColor = COLOR_THEME_FOCUS;
} else {
bgColor = COLOR_THEME_PRIMARY2;
}
}
if (editMode || ! (windowFlags & FORM_NO_BORDER)) {
dc->drawSolidFilledRect(0, 0, rect.w, rect.h, bgColor);
if (!editMode)
dc->drawSolidRect(0, 0, rect.w, rect.h, 1, COLOR_THEME_SECONDARY2);
}
}
void FormGroup::removeField(FormField * field)