aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2014-05-30 01:11:25 +0200
committerJoel Bodenmann <joel@unormal.org>2014-05-30 01:11:25 +0200
commitc65cdaed2489234a10f0c676fac12a0b9072fbe1 (patch)
tree4e71484055ea089a1acd93e7618aacdaea337e99 /src
parent52cfaf00ccd35f5a0740a489a1a2af64c800b537 (diff)
downloaduGFX-c65cdaed2489234a10f0c676fac12a0b9072fbe1.tar.gz
uGFX-c65cdaed2489234a10f0c676fac12a0b9072fbe1.tar.bz2
uGFX-c65cdaed2489234a10f0c676fac12a0b9072fbe1.zip
frame widget render improvements
Diffstat (limited to 'src')
-rw-r--r--src/gwin/frame.c54
1 files changed, 48 insertions, 6 deletions
diff --git a/src/gwin/frame.c b/src/gwin/frame.c
index 063d847a..8d6ce73b 100644
--- a/src/gwin/frame.c
+++ b/src/gwin/frame.c
@@ -45,6 +45,45 @@ static void _frameDestroy(GHandle gh) {
_gcontainerDestroy(gh);
}
+static void _closeBtnDraw(struct GWidgetObject *gw, void *param) {
+ // the background
+ if (gwinButtonIsPressed( (GHandle)gw)) {
+ gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gdispBlendColor(Black, HTML2COLOR(0xC55152), 50));
+ } else {
+ gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gw->g.height, HTML2COLOR(0xC55152));
+ }
+
+ // the cross
+ gdispDrawLine(gw->g.x+4, gw->g.y+4, gw->g.x+gw->g.width-5, gw->g.y+gw->g.height-5, White);
+ gdispDrawLine(gw->g.x+gw->g.width-5, gw->g.y+4, gw->g.x+4, gw->g.y+gw->g.height-5, White);
+}
+
+static void _closeBtnMin(struct GWidgetObject *gw, void *param) {
+ // the background
+ if (gwinButtonIsPressed( (GHandle)gw)) {
+ gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gdispBlendColor(Black, Grey, 50));
+ } else {
+ gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gdispBlendColor(White, Grey, 50));
+ }
+
+ // the symbol
+ gdispDrawLine(gw->g.x+5, gw->g.y+gw->g.height-5, gw->g.x+gw->g.width-5, gw->g.y+gw->g.height-5, White);
+}
+
+static void _closeBtnMax(struct GWidgetObject *gw, void *param) {
+ // the background
+ if (gwinButtonIsPressed( (GHandle)gw)) {
+ gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gdispBlendColor(Black, Grey, 50));
+ } else {
+ gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gdispBlendColor(White, Grey, 50));
+ }
+
+ // the symbol
+ gdispDrawBox(gw->g.x+4, gw->g.y+4, gw->g.width-8, gw->g.height-8, White);
+ gdispDrawLine(gw->g.x+4, gw->g.y+5, gw->g.x+gw->g.width-5, gw->g.y+5, White);
+ gdispDrawLine(gw->g.x+4, gw->g.y+6, gw->g.x+gw->g.width-5, gw->g.y+6, White);
+}
+
#if 0 && GINPUT_NEED_MOUSE
static void _mouseDown(GWidgetObject *gw, coord_t x, coord_t y) {
@@ -133,7 +172,8 @@ GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint
wi.g.y = (BORDER_Y - BUTTON_Y) / 2;
wi.g.width = BUTTON_X;
wi.g.height = BUTTON_Y;
- wi.text = "X";
+ wi.text = "Frame Close Button";
+ wi.customDraw = _closeBtnDraw;
fo->btnClose = gwinGButtonCreate(g, 0, &wi);
}
@@ -149,15 +189,17 @@ GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint
wi.g.y = (BORDER_Y - BUTTON_Y) / 2;
wi.g.width = BUTTON_X;
wi.g.height = BUTTON_Y;
- wi.text = "O";
- fo->btnMin = gwinGButtonCreate(g, 0, &wi);
+ wi.text = "Frame Max Button";
+ wi.customDraw = _closeBtnMax;
+ fo->btnMax = gwinGButtonCreate(g, 0, &wi);
wi.g.x = (flags & GWIN_FRAME_CLOSE_BTN) ? fo->gc.g.width - 3*BORDER_X - 3*BUTTON_X : fo->gc.g.width - BORDER_X - BUTTON_X;
wi.g.y = (BORDER_Y - BUTTON_Y) / 2;
wi.g.width = BUTTON_X;
wi.g.height = BUTTON_Y;
- wi.text = "_";
- fo->btnMax = gwinGButtonCreate(g, 0, &wi);
+ wi.text = "Frame Min Button";
+ wi.customDraw = _closeBtnMin;
+ fo->btnMin = gwinGButtonCreate(g, 0, &wi);
}
/* Apply flags. We apply these here so the controls above are outside the child area */
@@ -173,7 +215,7 @@ static void _callbackBtn(void *param, GEvent *pe) {
switch (pe->type) {
case GEVENT_GWIN_BUTTON:
if (((GEventGWinButton *)pe)->button == ((GFrameObject*)(GHandle)param)->btnClose)
- gwinDestroy((GHandle)param);
+ ;//gwinDestroy((GHandle)param);
else if (((GEventGWinButton *)pe)->button == ((GFrameObject*)(GHandle)param)->btnMin) {
;/* ToDo */