aboutsummaryrefslogtreecommitdiffstats
path: root/src/gwin/gwin_textedit.c
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@seriouslyembedded.com>2015-08-14 23:51:28 +0200
committerJoel Bodenmann <joel@seriouslyembedded.com>2015-08-14 23:51:28 +0200
commit668b161f0eead1b9687305281eb59be0e0713bbe (patch)
tree75bcf589f03dc528ed2ff960388d940fcf3a9b0d /src/gwin/gwin_textedit.c
parent755b7a45ab517a303510b728a9c54e48f9216557 (diff)
downloaduGFX-668b161f0eead1b9687305281eb59be0e0713bbe.tar.gz
uGFX-668b161f0eead1b9687305281eb59be0e0713bbe.tar.bz2
uGFX-668b161f0eead1b9687305281eb59be0e0713bbe.zip
Adding color to widget style for focused widgets
Diffstat (limited to 'src/gwin/gwin_textedit.c')
-rw-r--r--src/gwin/gwin_textedit.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/gwin/gwin_textedit.c b/src/gwin/gwin_textedit.c
index eb6340a3..21415b9c 100644
--- a/src/gwin/gwin_textedit.c
+++ b/src/gwin/gwin_textedit.c
@@ -18,9 +18,10 @@
#include <string.h>
// Some settings
-const int TEXT_PADDING_LEFT = 4;
-const int CURSOR_PADDING_LEFT = 0;
-const int CURSOR_EXTRA_HEIGHT = 1;
+const int TEXT_PADDING_LEFT = 4;
+const int FOCUS_BORDER_THICKNESS = 3;
+const int CURSOR_PADDING_LEFT = 0;
+const int CURSOR_EXTRA_HEIGHT = 1;
// Some flags
#define GTEXTEDIT_FLG_BORDER (GWIN_FIRST_CONTROL_FLAG << 0)
@@ -237,6 +238,14 @@ static void gwinTexteditDefaultDraw(GWidgetObject* gw, void* param)
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, (gw->g.flags & GWIN_FLG_SYSENABLED) ? gw->pstyle->enabled.edge : gw->pstyle->disabled.edge);
}
+ // Render highlighted border of focused
+ if (gwinGetFocus() == (GHandle)gw) {
+ int i = 0;
+ for (i = 0; i < FOCUS_BORDER_THICKNESS; i++) {
+ gdispGDrawBox(gw->g.display, gw->g.x+i, gw->g.y+i, gw->g.width-2*i, gw->g.height-2*i, gw->pstyle->focus);
+ }
+ }
+
// Render cursor (if focused)
if (gwinGetFocus() == (GHandle)gw) {
// Calculate cursor stuff