diff --git a/RunCPM_VGA32_v5_1/uistyle.h b/RunCPM_VGA32_v5_1/uistyle.h new file mode 100644 index 0000000..e4e05b5 --- /dev/null +++ b/RunCPM_VGA32_v5_1/uistyle.h @@ -0,0 +1,63 @@ + /* + Created by Fabrizio Di Vittorio (fdivitto2013@gmail.com) - www.fabgl.com + Copyright (c) 2019-2020 Fabrizio Di Vittorio. + All rights reserved. + + This file is part of FabGL Library. + + FabGL is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + FabGL is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with FabGL. If not, see . + */ + + +#pragma once + + +enum { STYLE_NONE, STYLE_FRAME, STYLE_LABEL, STYLE_LABELHELP, STYLE_BUTTON, STYLE_COMBOBOX, STYLE_CHECKBOX }; + + +#define BACKGROUND_COLOR RGB888(64, 64, 64) + + +struct DialogStyle : uiStyle { + void setStyle(uiObject * object, uint32_t styleClassID) { + switch (styleClassID) { + case STYLE_FRAME: + ((uiFrame*)object)->windowStyle().activeBorderColor = RGB888(128, 128, 255); + ((uiFrame*)object)->frameStyle().activeTitleBackgroundColor = RGB888(128, 128, 255); + ((uiFrame*)object)->frameStyle().backgroundColor = BACKGROUND_COLOR; + break; + case STYLE_LABEL: + ((uiLabel*)object)->labelStyle().textFont = &fabgl::FONT_std_12; + ((uiLabel*)object)->labelStyle().backgroundColor = BACKGROUND_COLOR; + ((uiLabel*)object)->labelStyle().textColor = RGB888(255, 255, 255); + break; + case STYLE_LABELHELP: + ((uiLabel*)object)->labelStyle().textFont = &fabgl::FONT_std_14; + ((uiLabel*)object)->labelStyle().backgroundColor = BACKGROUND_COLOR; + ((uiLabel*)object)->labelStyle().textColor = RGB888(255, 255, 0); + break; + case STYLE_BUTTON: + ((uiButton*)object)->windowStyle().borderColor = RGB888(0, 0, 0); + ((uiButton*)object)->buttonStyle().backgroundColor = RGB888(128, 128, 64); + break; + case STYLE_COMBOBOX: + ((uiFrame*)object)->windowStyle().borderColor = RGB888(255, 255, 255); + ((uiFrame*)object)->windowStyle().borderSize = 1; + break; + case STYLE_CHECKBOX: + ((uiFrame*)object)->windowStyle().borderColor = RGB888(255, 255, 255); + break; + } + } +} dialogStyle;