Make some GWIN constants into #defines

ugfx_release_2.6
inmarket 2014-05-01 16:44:11 +10:00
parent 8f6c04e120
commit 558ee7282d
2 changed files with 13 additions and 8 deletions

View File

@ -25,6 +25,8 @@
#define RND_CNR_SIZE 5 // Rounded corner size for rounded buttons
#define ARROWHEAD_DIVIDER 4 // A quarter of the height for the arrow head
#define ARROWBODY_DIVIDER 4 // A quarter of the width for the arrow body
#define TOP_FADE 50 // (TOP_FADE/255)% fade to white for top of button
#define BOTTOM_FADE 25 // (BOTTOM_FADE/255)% fade to black for bottom of button
// Our pressed state
#define GBUTTON_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0)
@ -189,8 +191,8 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
pcol = getDrawColors(gw);
/* Fill the box blended from variants of the fill color */
tcol = gdispBlendColor(White, pcol->fill, 50);
bcol = gdispBlendColor(Black, pcol->fill, 25);
tcol = gdispBlendColor(White, pcol->fill, TOP_FADE);
bcol = gdispBlendColor(Black, pcol->fill, BOTTOM_FADE);
dalpha = FIXED(255)/gw->g.height;
for(alpha = 0, i = 0; i < gw->g.height; i++, alpha += dalpha)
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+i, gw->g.x+gw->g.width-2, gw->g.y+i, gdispBlendColor(bcol, tcol, NONFIXED(alpha)));

View File

@ -21,7 +21,10 @@
#include "src/gwin/class_gwin.h"
#define GRADIO_TAB_CNR 3
#define GRADIO_TAB_CNR 3 // Diagonal corner on active tab
#define GRADIO_TOP_FADE 50 // (GRADIO_TOP_FADE/255)% fade to white for top of tab/button
#define GRADIO_BOTTOM_FADE 25 // (GRADIO_BOTTOM_FADE/255)% fade to black for bottom of tab/button
#define GRADIO_OUTLINE_FADE 128 // (GRADIO_OUTLINE_FADE/255)% fade to background for active tab edge
// Our pressed state
#define GRADIO_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0)
@ -238,8 +241,8 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) {
pcol = getDrawColors(gw);
/* Fill the box blended from variants of the fill color */
tcol = gdispBlendColor(White, pcol->fill, 50);
bcol = gdispBlendColor(Black, pcol->fill, 25);
tcol = gdispBlendColor(White, pcol->fill, GRADIO_TOP_FADE);
bcol = gdispBlendColor(Black, pcol->fill, GRADIO_BOTTOM_FADE);
dalpha = FIXED(255)/gw->g.height;
for(alpha = 0, i = 0; i < gw->g.height; i++, alpha += dalpha)
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+i, gw->g.x+gw->g.width-2, gw->g.y+i, gdispBlendColor(bcol, tcol, NONFIXED(alpha)));
@ -260,15 +263,15 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) {
pcol = getDrawColors(gw);
if ((gw->g.flags & GRADIO_FLG_PRESSED)) {
tcol = gdispBlendColor(pcol->edge, gw->pstyle->background, 128);
tcol = gdispBlendColor(pcol->edge, gw->pstyle->background, GRADIO_OUTLINE_FADE);
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font, pcol->text, gw->g.bgcolor, justifyCenter);
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y, gw->g.x+gw->g.width-(GRADIO_TAB_CNR+1), gw->g.y, tcol);
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-(GRADIO_TAB_CNR+1), gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+GRADIO_TAB_CNR, tcol);
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y+GRADIO_TAB_CNR, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, tcol);
} else {
/* Fill the box blended from variants of the fill color */
tcol = gdispBlendColor(White, pcol->fill, 50);
bcol = gdispBlendColor(Black, pcol->fill, 25);
tcol = gdispBlendColor(White, pcol->fill, GRADIO_TOP_FADE);
bcol = gdispBlendColor(Black, pcol->fill, GRADIO_BOTTOM_FADE);
dalpha = FIXED(255)/gw->g.height;
for(alpha = 0, i = 0; i < gw->g.height; i++, alpha += dalpha)
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+i, gw->g.x+gw->g.width-2, gw->g.y+i, gdispBlendColor(bcol, tcol, NONFIXED(alpha)));