From b56b578398b7d9e9b47d8d880ae9778566a99c34 Mon Sep 17 00:00:00 2001 From: mrwastl Date: Sun, 29 May 2011 17:09:06 +0200 Subject: add fgcol/bgcol class members to base class cDriver, add distinction between default fg/bg colours from driver and fg/bg colours from class; adapt serdisp-driver to these changes --- glcddrivers/driver.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'glcddrivers/driver.h') diff --git a/glcddrivers/driver.h b/glcddrivers/driver.h index c235459..5b75c20 100644 --- a/glcddrivers/driver.h +++ b/glcddrivers/driver.h @@ -42,10 +42,14 @@ public: class cDriver { protected: - int width; - int height; + int width; + int height; + uint32_t bgcol; + uint32_t fgcol; virtual bool GetDriverFeature (const std::string & Feature, int & value) { return false; } + virtual GLCD::cColor GetDefaultBackgroundColor(void) { return GLCD::cColor(GLCD::cColor::Black); } + GLCD::cColor GetDefaultForegroundColor(void) { return GLCD::cColor(GetBackgroundColor()).Invert(); } public: cDriver(); virtual ~cDriver() {} @@ -65,13 +69,11 @@ public: virtual void SetBrightness(unsigned int percent) {} - virtual GLCD::cColor GetBackgroundColor(void) { return GLCD::cColor(GLCD::cColor::White); } virtual bool SetFeature (const std::string & Feature, int value) { return false; } - GLCD::cColor GetForegroundColor(void) { - return GLCD::cColor(GetBackgroundColor()).Invert(); - } + GLCD::cColor GetBackgroundColor(bool driverdefault=false) { return (driverdefault) ? GetDefaultBackgroundColor() : (GLCD::cColor)bgcol; } + GLCD::cColor GetForegroundColor(bool driverdefault=false) { return (driverdefault) ? GetDefaultForegroundColor() : (GLCD::cColor)fgcol; } // not to be overridden, override GetDriverFeature() instead // the following feature names (case insensitive!) are guaranteed to give results: -- cgit v1.2.3