Merge branch 'master' into freertos
commit
7e79191024
|
@ -28,7 +28,7 @@ static const SPIConfig spicfg = {
|
||||||
0,
|
0,
|
||||||
GPIOC,
|
GPIOC,
|
||||||
GPIOC_MP3_CS,
|
GPIOC_MP3_CS,
|
||||||
0,
|
SPI_CR1_BR_0,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Initialise the board
|
// Initialise the board
|
||||||
|
@ -60,10 +60,10 @@ static inline void board_startcmdwrite(void) {
|
||||||
|
|
||||||
// End a command write
|
// End a command write
|
||||||
static inline void board_endcmdwrite(void) {
|
static inline void board_endcmdwrite(void) {
|
||||||
|
SET_CS;
|
||||||
#if SPI_USE_MUTUAL_EXCLUSION
|
#if SPI_USE_MUTUAL_EXCLUSION
|
||||||
spiReleaseBus(SPI_PORT);
|
spiReleaseBus(SPI_PORT);
|
||||||
#endif
|
#endif
|
||||||
SET_CS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start a command read
|
// Start a command read
|
||||||
|
|
|
@ -30,93 +30,19 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
#define GFX_USE_GDISP TRUE
|
#define GFX_USE_GDISP TRUE
|
||||||
|
|
||||||
#define GDISP_NEED_AUTOFLUSH FALSE
|
|
||||||
#define GDISP_NEED_TIMERFLUSH FALSE
|
|
||||||
#define GDISP_NEED_VALIDATION TRUE
|
#define GDISP_NEED_VALIDATION TRUE
|
||||||
#define GDISP_NEED_CLIP TRUE
|
#define GDISP_NEED_CLIP TRUE
|
||||||
#define GDISP_NEED_CIRCLE TRUE
|
#define GDISP_NEED_CIRCLE TRUE
|
||||||
#define GDISP_NEED_ELLIPSE FALSE
|
|
||||||
#define GDISP_NEED_ARC FALSE
|
|
||||||
#define GDISP_NEED_CONVEX_POLYGON TRUE
|
#define GDISP_NEED_CONVEX_POLYGON TRUE
|
||||||
#define GDISP_NEED_SCROLL FALSE
|
//#define GDISP_NEED_SCROLL TRUE
|
||||||
#define GDISP_NEED_PIXELREAD FALSE
|
|
||||||
#define GDISP_NEED_CONTROL TRUE
|
#define GDISP_NEED_CONTROL TRUE
|
||||||
#define GDISP_NEED_QUERY FALSE
|
|
||||||
#define GDISP_NEED_MULTITHREAD FALSE
|
|
||||||
#define GDISP_NEED_STREAMING FALSE
|
|
||||||
#define GDISP_NEED_TEXT TRUE
|
#define GDISP_NEED_TEXT TRUE
|
||||||
#define GDISP_NEED_ANTIALIAS TRUE
|
|
||||||
#define GDISP_NEED_UTF8 TRUE
|
|
||||||
#define GDISP_NEED_TEXT_KERNING TRUE
|
|
||||||
#define GDISP_INCLUDE_FONT_UI1 FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_UI2 TRUE
|
#define GDISP_INCLUDE_FONT_UI2 TRUE
|
||||||
#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_DEJAVUSANS12 FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_DEJAVUSANS16 FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_DEJAVUSANS24 FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_DEJAVUSANS32 FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12 FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_FIXED_10X20 FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_FIXED_7X14 FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_FIXED_5X8 FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_DEJAVUSANS12_AA FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_DEJAVUSANS16_AA FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_DEJAVUSANS24_AA FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_DEJAVUSANS32_AA FALSE
|
|
||||||
#define GDISP_INCLUDE_FONT_DEJAVUSANSBOLD12_AA FALSE
|
|
||||||
#define GDISP_INCLUDE_USER_FONTS FALSE
|
|
||||||
|
|
||||||
#define GDISP_NEED_IMAGE TRUE
|
#define GDISP_NEED_IMAGE TRUE
|
||||||
#define GDISP_NEED_IMAGE_NATIVE FALSE
|
|
||||||
#define GDISP_NEED_IMAGE_GIF TRUE
|
#define GDISP_NEED_IMAGE_GIF TRUE
|
||||||
#define GDISP_NEED_IMAGE_BMP TRUE
|
|
||||||
#define GDISP_NEED_IMAGE_BMP_1 FALSE
|
|
||||||
#define GDISP_NEED_IMAGE_BMP_4 FALSE
|
|
||||||
#define GDISP_NEED_IMAGE_BMP_4_RLE FALSE
|
|
||||||
#define GDISP_NEED_IMAGE_BMP_8 FALSE
|
|
||||||
#define GDISP_NEED_IMAGE_BMP_8_RLE FALSE
|
|
||||||
#define GDISP_NEED_IMAGE_BMP_16 FALSE
|
|
||||||
#define GDISP_NEED_IMAGE_BMP_24 TRUE
|
|
||||||
#define GDISP_NEED_IMAGE_BMP_32 FALSE
|
|
||||||
#define GDISP_NEED_IMAGE_JPG FALSE
|
|
||||||
#define GDISP_NEED_IMAGE_PNG FALSE
|
|
||||||
#define GDISP_NEED_IMAGE_ACCOUNTING FALSE
|
|
||||||
|
|
||||||
#define GDISP_NEED_STARTUP_LOGO FALSE
|
|
||||||
|
|
||||||
#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE
|
#define GDISP_DEFAULT_ORIENTATION GDISP_ROTATE_LANDSCAPE
|
||||||
#define GDISP_LINEBUF_SIZE 128
|
|
||||||
|
|
||||||
#define GDISP_TOTAL_DISPLAYS 1
|
|
||||||
#if GDISP_TOTAL_DISPLAYS > 1
|
|
||||||
#define GDISP_HARDWARE_STREAM_WRITE FALSE
|
|
||||||
#define GDISP_HARDWARE_STREAM_READ FALSE
|
|
||||||
#define GDISP_HARDWARE_STREAM_POS FALSE
|
|
||||||
#define GDISP_HARDWARE_DRAWPIXEL FALSE
|
|
||||||
#define GDISP_HARDWARE_CLEARS FALSE
|
|
||||||
#define GDISP_HARDWARE_FILLS FALSE
|
|
||||||
#define GDISP_HARDWARE_BITFILLS FALSE
|
|
||||||
#define GDISP_HARDWARE_SCROLL FALSE
|
|
||||||
#define GDISP_HARDWARE_PIXELREAD FALSE
|
|
||||||
#define GDISP_HARDWARE_CONTROL FALSE
|
|
||||||
#define GDISP_HARDWARE_QUERY FALSE
|
|
||||||
#define GDISP_HARDWARE_CLIP FALSE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define GDISP_TOTAL_CONTROLLERS 1
|
|
||||||
#if GDISP_TOTAL_CONTROLLERS > 1
|
|
||||||
#define GDISP_CONTROLLER_LIST GDISPVMT_Win32, GDISPVMT_Win32
|
|
||||||
#define GDISP_CONTROLLER_DISPLAYS 1, 1
|
|
||||||
#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define GDISP_USE_GFXNET FALSE
|
|
||||||
#define GDISP_GFXNET_PORT 13001
|
|
||||||
#define GDISP_GFXNET_CUSTOM_LWIP_STARTUP FALSE
|
|
||||||
#define GDISP_DONT_WAIT_FOR_NET_DISPLAY FALSE
|
|
||||||
#define GDISP_GFXNET_UNSAFE_SOCKETS FALSE
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// GWIN //
|
// GWIN //
|
||||||
|
@ -126,56 +52,36 @@
|
||||||
#define GWIN_NEED_WINDOWMANAGER TRUE
|
#define GWIN_NEED_WINDOWMANAGER TRUE
|
||||||
|
|
||||||
#define GWIN_NEED_CONSOLE TRUE
|
#define GWIN_NEED_CONSOLE TRUE
|
||||||
#define GWIN_CONSOLE_USE_HISTORY FALSE
|
|
||||||
#define GWIN_CONSOLE_HISTORY_AVERAGING FALSE
|
|
||||||
#define GWIN_CONSOLE_HISTORY_ATCREATE FALSE
|
|
||||||
#define GWIN_CONSOLE_ESCSEQ FALSE
|
|
||||||
#define GWIN_CONSOLE_USE_BASESTREAM FALSE
|
|
||||||
#define GWIN_CONSOLE_USE_FLOAT FALSE
|
|
||||||
#define GWIN_NEED_GRAPH TRUE
|
#define GWIN_NEED_GRAPH TRUE
|
||||||
|
|
||||||
#define GWIN_NEED_WIDGET TRUE
|
#define GWIN_NEED_WIDGET TRUE
|
||||||
#define GWIN_NEED_LABEL TRUE
|
#define GWIN_NEED_LABEL TRUE
|
||||||
#define GWIN_NEED_BUTTON TRUE
|
#define GWIN_NEED_BUTTON TRUE
|
||||||
#define GWIN_BUTTON_LAZY_RELEASE FALSE
|
// #define GWIN_BUTTON_LAZY_RELEASE TRUE
|
||||||
#define GWIN_NEED_SLIDER TRUE
|
#define GWIN_NEED_SLIDER TRUE
|
||||||
#define GWIN_NEED_CHECKBOX TRUE
|
#define GWIN_NEED_CHECKBOX TRUE
|
||||||
#define GWIN_NEED_IMAGE TRUE
|
#define GWIN_NEED_IMAGE TRUE
|
||||||
#define GWIN_NEED_IMAGE_ANIMATION TRUE
|
|
||||||
#define GWIN_NEED_RADIO TRUE
|
#define GWIN_NEED_RADIO TRUE
|
||||||
#define GWIN_NEED_LIST TRUE
|
#define GWIN_NEED_LIST TRUE
|
||||||
#define GWIN_NEED_LIST_IMAGES TRUE
|
#define GWIN_NEED_LIST_IMAGES TRUE
|
||||||
#define GWIN_NEED_PROGRESSBAR TRUE
|
#define GWIN_NEED_PROGRESSBAR TRUE
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// GEVENT //
|
// GEVENT //
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
#define GFX_USE_GEVENT TRUE
|
#define GFX_USE_GEVENT TRUE
|
||||||
|
|
||||||
#define GEVENT_ASSERT_NO_RESOURCE FALSE
|
|
||||||
#define GEVENT_MAXIMUM_SIZE 32
|
|
||||||
#define GEVENT_MAX_SOURCE_LISTENERS 32
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// GTIMER //
|
// GTIMER //
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
#define GFX_USE_GTIMER TRUE
|
#define GFX_USE_GTIMER TRUE
|
||||||
|
|
||||||
#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY
|
|
||||||
#define GTIMER_THREAD_WORKAREA_SIZE 2048
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// GQUEUE //
|
// GQUEUE //
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
#define GFX_USE_GQUEUE TRUE
|
#define GFX_USE_GQUEUE TRUE
|
||||||
|
|
||||||
#define GQUEUE_NEED_ASYNC TRUE
|
#define GQUEUE_NEED_ASYNC TRUE
|
||||||
#define GQUEUE_NEED_GSYNC FALSE
|
|
||||||
#define GQUEUE_NEED_FSYNC FALSE
|
|
||||||
#define GQUEUE_NEED_BUFFERS FALSE
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// GINPUT //
|
// GINPUT //
|
||||||
|
@ -183,59 +89,15 @@
|
||||||
#define GFX_USE_GINPUT TRUE
|
#define GFX_USE_GINPUT TRUE
|
||||||
|
|
||||||
#define GINPUT_NEED_MOUSE TRUE
|
#define GINPUT_NEED_MOUSE TRUE
|
||||||
#define GINPUT_NEED_KEYBOARD FALSE
|
//#define GINPUT_NEED_TOGGLE TRUE
|
||||||
#define GINPUT_NEED_TOGGLE FALSE
|
//#define GINPUT_NEED_DIAL TRUE
|
||||||
#define GINPUT_NEED_DIAL FALSE
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// GFILE //
|
// GFILE //
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
#define GFX_USE_GFILE TRUE
|
#define GFX_USE_GFILE TRUE
|
||||||
|
|
||||||
#define GFILE_NEED_PRINTG FALSE
|
|
||||||
#define GFILE_NEED_SCANG FALSE
|
|
||||||
#define GFILE_NEED_STRINGS FALSE
|
|
||||||
#define GFILE_NEED_STDIO FALSE
|
|
||||||
#define GFILE_ALLOW_FLOATS FALSE
|
|
||||||
#define GFILE_ALLOW_DEVICESPECIFIC FALSE
|
|
||||||
#define GFILE_MAX_GFILES 3
|
|
||||||
|
|
||||||
#define GFILE_NEED_MEMFS FALSE
|
|
||||||
#define GFILE_NEED_ROMFS TRUE
|
#define GFILE_NEED_ROMFS TRUE
|
||||||
#define GFILE_NEED_RAMFS FALSE
|
//#define GFILE_NEED_NATIVEFS TRUE
|
||||||
#define GFILE_NEED_FATFS FALSE
|
|
||||||
#define GFILE_NEED_NATIVEFS FALSE
|
|
||||||
#define GFILE_NEED_CHBIOSFS FALSE
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// GADC //
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
#define GFX_USE_GADC FALSE
|
|
||||||
|
|
||||||
#define GADC_MAX_LOWSPEED_DEVICES 4
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// GAUDIO //
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
#define GFX_USE_GAUDIO FALSE
|
|
||||||
#define GAUDIO_NEED_PLAY FALSE
|
|
||||||
#define GAUDIO_NEED_RECORD FALSE
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// GMISC //
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
#define GFX_USE_GMISC FALSE
|
|
||||||
|
|
||||||
#define GMISC_NEED_ARRAYOPS FALSE
|
|
||||||
#define GMISC_NEED_FASTTRIG FALSE
|
|
||||||
#define GMISC_NEED_FIXEDTRIG FALSE
|
|
||||||
#define GMISC_NEED_INVSQRT FALSE
|
|
||||||
#define GMISC_INVSQRT_MIXED_ENDIAN FALSE
|
|
||||||
#define GMISC_INVSQRT_REAL_SLOW FALSE
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* _GFXCONF_H */
|
#endif /* _GFXCONF_H */
|
||||||
|
|
|
@ -237,7 +237,7 @@ static void createWidgets(void) {
|
||||||
gdispImageOpenFile(&imgYesNo, "image_yesno.gif");
|
gdispImageOpenFile(&imgYesNo, "image_yesno.gif");
|
||||||
gwinListItemSetImage(ghList3, 1, &imgYesNo);
|
gwinListItemSetImage(ghList3, 1, &imgYesNo);
|
||||||
gwinListItemSetImage(ghList3, 3, &imgYesNo);
|
gwinListItemSetImage(ghList3, 3, &imgYesNo);
|
||||||
wi.g.x = 0+3*(LIST_WIDTH+5); wi.text = "L2";
|
wi.g.x = 0+3*(LIST_WIDTH+5); wi.text = "L4";
|
||||||
ghList4 = gwinListCreate(0, &wi, TRUE);
|
ghList4 = gwinListCreate(0, &wi, TRUE);
|
||||||
gwinListAddItem(ghList4, "Item 0", FALSE);
|
gwinListAddItem(ghList4, "Item 0", FALSE);
|
||||||
gwinListAddItem(ghList4, "Item 1", FALSE);
|
gwinListAddItem(ghList4, "Item 1", FALSE);
|
||||||
|
@ -258,7 +258,7 @@ static void createWidgets(void) {
|
||||||
// Image
|
// Image
|
||||||
wi.g.x = 20; wi.g.y = 2*TAB_HEIGHT+20; wi.g.width = 200; wi.g.height = 100;
|
wi.g.x = 20; wi.g.y = 2*TAB_HEIGHT+20; wi.g.width = 200; wi.g.height = 100;
|
||||||
ghImage1 = gwinImageCreate(0, &wi.g);
|
ghImage1 = gwinImageCreate(0, &wi.g);
|
||||||
gwinImageOpenFile(ghImage1, "romfs_img_ugfx.bmp");
|
gwinImageOpenFile(ghImage1, "romfs_img_ugfx.gif");
|
||||||
|
|
||||||
// Progressbar
|
// Progressbar
|
||||||
wi.g.show = FALSE; wi.customDraw = 0;
|
wi.g.show = FALSE; wi.customDraw = 0;
|
||||||
|
@ -381,16 +381,16 @@ int main(void) {
|
||||||
// Initialize the display
|
// Initialize the display
|
||||||
gfxInit();
|
gfxInit();
|
||||||
|
|
||||||
// Set the widget defaults
|
|
||||||
gwinSetDefaultFont(gdispOpenFont("*"));
|
|
||||||
gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE);
|
|
||||||
gdispClear(White);
|
|
||||||
|
|
||||||
// Connect the mouse
|
// Connect the mouse
|
||||||
#if GINPUT_NEED_MOUSE
|
#if GINPUT_NEED_MOUSE
|
||||||
gwinAttachMouse(0);
|
gwinAttachMouse(0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Set the widget defaults
|
||||||
|
gwinSetDefaultFont(gdispOpenFont("*"));
|
||||||
|
gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE);
|
||||||
|
gdispClear(White);
|
||||||
|
|
||||||
// Create the gwin windows/widgets
|
// Create the gwin windows/widgets
|
||||||
createWidgets();
|
createWidgets();
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Before Width: | Height: | Size: 26 KiB |
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
|
@ -33,6 +33,7 @@ FEATURE: Update GADC audio recording driver to new GAUDIO format
|
||||||
FEATURE: Added vs1053 audio play driver
|
FEATURE: Added vs1053 audio play driver
|
||||||
FEATURE: Added GAUDIO wave-play demo
|
FEATURE: Added GAUDIO wave-play demo
|
||||||
FEATURE: Added many GWIN simple demo's and updated the combined widget demo
|
FEATURE: Added many GWIN simple demo's and updated the combined widget demo
|
||||||
|
FEATURE: Added gwinEnable() and gwinDisable()
|
||||||
|
|
||||||
|
|
||||||
*** changes after 1.9 ***
|
*** changes after 1.9 ***
|
||||||
|
|
|
@ -4,4 +4,4 @@ GFXSRC += $(GFXLIB)/drivers/gaudio/vs1053/gaudio_play_lld.c
|
||||||
# Required include directories
|
# Required include directories
|
||||||
GFXINC += $(GFXLIB)/drivers/gaudio/vs1053
|
GFXINC += $(GFXLIB)/drivers/gaudio/vs1053
|
||||||
|
|
||||||
GFXDEFS += -DGFX_USE_GTIMER=TRUE
|
GFXDEFS += -DGFX_USE_GTIMER=GFX_USE_GAUDIO
|
||||||
|
|
|
@ -188,7 +188,7 @@ static void FeedData(void *param) {
|
||||||
(void) param;
|
(void) param;
|
||||||
|
|
||||||
// While there is data space
|
// While there is data space
|
||||||
while (!board_dreq()) {
|
while (board_dreq()) {
|
||||||
|
|
||||||
// Send up to 32 bytes
|
// Send up to 32 bytes
|
||||||
len = playlen;
|
len = playlen;
|
||||||
|
|
|
@ -150,6 +150,7 @@
|
||||||
#define GWIN_NEED_LIST_IMAGES FALSE
|
#define GWIN_NEED_LIST_IMAGES FALSE
|
||||||
#define GWIN_NEED_PROGRESSBAR FALSE
|
#define GWIN_NEED_PROGRESSBAR FALSE
|
||||||
#define GWIN_NEED_FRAME FALSE
|
#define GWIN_NEED_FRAME FALSE
|
||||||
|
#define GWIN_FLAT_STYLING FALSE
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -174,7 +174,7 @@ void gdispImageClose(gdispImage *img) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t gdispImageIsOpen(gdispImage *img) {
|
bool_t gdispImageIsOpen(gdispImage *img) {
|
||||||
return img->fns != 0;
|
return img->type != GDISP_IMAGE_TYPE_UNKNOWN && img->fns != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gdispImageSetBgColor(gdispImage *img, color_t bgcolor) {
|
void gdispImageSetBgColor(gdispImage *img, color_t bgcolor) {
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#define RND_CNR_SIZE 5 // Rounded corner size for rounded buttons
|
#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 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 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
|
// Our pressed state
|
||||||
#define GBUTTON_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0)
|
#define GBUTTON_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0)
|
||||||
|
@ -109,7 +111,7 @@ static const gwidgetVMT buttonVMT = {
|
||||||
_gwidgetRedraw, // The redraw routine
|
_gwidgetRedraw, // The redraw routine
|
||||||
0, // The after-clear routine
|
0, // The after-clear routine
|
||||||
},
|
},
|
||||||
gwinButtonDraw_3D, // The default drawing routine
|
gwinButtonDraw_Normal, // The default drawing routine
|
||||||
#if GINPUT_NEED_MOUSE
|
#if GINPUT_NEED_MOUSE
|
||||||
{
|
{
|
||||||
MouseDown, // Process mouse down events
|
MouseDown, // Process mouse down events
|
||||||
|
@ -164,17 +166,42 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||||
return &gw->pstyle->enabled;
|
return &gw->pstyle->enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
void gwinButtonDraw_3D(GWidgetObject *gw, void *param) {
|
#if GWIN_FLAT_STYLING
|
||||||
const GColorSet * pcol;
|
void gwinButtonDraw_Normal(GWidgetObject *gw, void *param) {
|
||||||
(void) param;
|
const GColorSet * pcol;
|
||||||
|
(void) param;
|
||||||
|
|
||||||
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
|
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
|
||||||
pcol = getDrawColors(gw);
|
pcol = getDrawColors(gw);
|
||||||
|
|
||||||
|
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
|
||||||
|
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
|
||||||
|
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void gwinButtonDraw_Normal(GWidgetObject *gw, void *param) {
|
||||||
|
const GColorSet * pcol;
|
||||||
|
fixed alpha;
|
||||||
|
fixed dalpha;
|
||||||
|
coord_t i;
|
||||||
|
color_t tcol, bcol;
|
||||||
|
(void) param;
|
||||||
|
|
||||||
|
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
|
||||||
|
pcol = getDrawColors(gw);
|
||||||
|
|
||||||
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
|
/* Fill the box blended from variants of the fill color */
|
||||||
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
|
tcol = gdispBlendColor(White, pcol->fill, TOP_FADE);
|
||||||
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
|
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)));
|
||||||
|
|
||||||
|
gdispGDrawStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, justifyCenter);
|
||||||
|
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
|
||||||
|
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#if GDISP_NEED_ARC
|
#if GDISP_NEED_ARC
|
||||||
void gwinButtonDraw_Rounded(GWidgetObject *gw, void *param) {
|
void gwinButtonDraw_Rounded(GWidgetObject *gw, void *param) {
|
||||||
|
|
|
@ -111,7 +111,7 @@ bool_t gwinButtonIsPressed(GHandle gh);
|
||||||
* @api
|
* @api
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
void gwinButtonDraw_3D(GWidgetObject *gw, void *param); // @< A standard 3D button
|
void gwinButtonDraw_Normal(GWidgetObject *gw, void *param); // @< A standard button
|
||||||
#if GDISP_NEED_ARC || defined(__DOXYGEN__)
|
#if GDISP_NEED_ARC || defined(__DOXYGEN__)
|
||||||
void gwinButtonDraw_Rounded(GWidgetObject *gw, void *param); // @< A rounded rectangle button
|
void gwinButtonDraw_Rounded(GWidgetObject *gw, void *param); // @< A rounded rectangle button
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -140,6 +140,10 @@ GHandle gwinGImageCreate(GDisplay *g, GImageObject *gobj, GWindowInit *pInit) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool_t gwinImageOpenGFile(GHandle gh, GFILE *f) {
|
bool_t gwinImageOpenGFile(GHandle gh, GFILE *f) {
|
||||||
|
// is it a valid handle?
|
||||||
|
if (gh->vmt != (gwinVMT *)&imageVMT)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (gdispImageIsOpen(&widget(gh)->image))
|
if (gdispImageIsOpen(&widget(gh)->image))
|
||||||
gdispImageClose(&widget(gh)->image);
|
gdispImageClose(&widget(gh)->image);
|
||||||
|
|
||||||
|
@ -159,6 +163,10 @@ bool_t gwinImageOpenGFile(GHandle gh, GFILE *f) {
|
||||||
}
|
}
|
||||||
|
|
||||||
gdispImageError gwinImageCache(GHandle gh) {
|
gdispImageError gwinImageCache(GHandle gh) {
|
||||||
|
// is it a valid handle?
|
||||||
|
if (gh->vmt != (gwinVMT *)&imageVMT)
|
||||||
|
return GDISP_IMAGE_ERR_BADFORMAT;
|
||||||
|
|
||||||
return gdispImageCache(&widget(gh)->image);
|
return gdispImageCache(&widget(gh)->image);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -371,6 +371,9 @@ void gwinSetStyle(GHandle gh, const GWidgetStyle *pstyle) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const GWidgetStyle *gwinGetStyle(GHandle gh) {
|
const GWidgetStyle *gwinGetStyle(GHandle gh) {
|
||||||
|
if (!(gh->flags & GWIN_FLG_WIDGET))
|
||||||
|
return 0;
|
||||||
|
|
||||||
return gw->pstyle;
|
return gw->pstyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,44 +45,7 @@ static coord_t getheight(const char *text, font_t font, coord_t maxwidth) {
|
||||||
return gdispGetFontMetric(font, fontHeight);
|
return gdispGetFontMetric(font, fontHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gwinLabelDefaultDraw(GWidgetObject *gw, void *param) {
|
static void gwinLabelDefaultDraw(GWidgetObject *gw, void *param);
|
||||||
coord_t w, h;
|
|
||||||
(void) param;
|
|
||||||
|
|
||||||
w = (gw->g.flags & GLABEL_FLG_WAUTO) ? getwidth(gw->text, gw->g.font, gdispGGetWidth(gw->g.display) - gw->g.x) : gw->g.width;
|
|
||||||
h = (gw->g.flags & GLABEL_FLG_HAUTO) ? getheight(gw->text, gw->g.font, gdispGGetWidth(gw->g.display) - gw->g.x) : gw->g.height;
|
|
||||||
|
|
||||||
if (gw->g.width != w || gw->g.height != h) {
|
|
||||||
gwinResize(&gw->g, w, h);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if GWIN_LABEL_ATTRIBUTE
|
|
||||||
if (gw2obj->attr != 0) {
|
|
||||||
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw2obj->attr, gw->g.font,
|
|
||||||
(gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background,
|
|
||||||
justifyLeft);
|
|
||||||
|
|
||||||
gdispGFillStringBox(gw->g.display, gw->g.x + gw2obj->tab, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font,
|
|
||||||
(gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background,
|
|
||||||
justifyLeft);
|
|
||||||
} else {
|
|
||||||
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font,
|
|
||||||
(gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background,
|
|
||||||
justifyLeft);
|
|
||||||
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font,
|
|
||||||
(gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background,
|
|
||||||
justifyLeft);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// render the border (if any)
|
|
||||||
if (gw->g.flags & GLABEL_FLG_BORDER)
|
|
||||||
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, (gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.edge : gw->pstyle->disabled.edge);
|
|
||||||
}
|
|
||||||
|
|
||||||
static const gwidgetVMT labelVMT = {
|
static const gwidgetVMT labelVMT = {
|
||||||
{
|
{
|
||||||
|
@ -138,9 +101,6 @@ GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit)
|
||||||
if (!(widget = (GLabelObject *)_gwidgetCreate(g, &widget->w, pInit, &labelVMT)))
|
if (!(widget = (GLabelObject *)_gwidgetCreate(g, &widget->w, pInit, &labelVMT)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// no borders by default
|
|
||||||
flags &=~ GLABEL_FLG_BORDER;
|
|
||||||
|
|
||||||
#if GWIN_LABEL_ATTRIBUTE
|
#if GWIN_LABEL_ATTRIBUTE
|
||||||
widget->tab = 0;
|
widget->tab = 0;
|
||||||
widget->attr = 0;
|
widget->attr = 0;
|
||||||
|
@ -176,6 +136,49 @@ void gwinLabelSetBorder(GHandle gh, bool_t border) {
|
||||||
}
|
}
|
||||||
#endif // GWIN_LABEL_ATTRIBUTE
|
#endif // GWIN_LABEL_ATTRIBUTE
|
||||||
|
|
||||||
|
static void gwinLabelDefaultDraw(GWidgetObject *gw, void *param) {
|
||||||
|
coord_t w, h;
|
||||||
|
(void) param;
|
||||||
|
|
||||||
|
// is it a valid handle?
|
||||||
|
if (gw->g.vmt != (gwinVMT *)&labelVMT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
w = (gw->g.flags & GLABEL_FLG_WAUTO) ? getwidth(gw->text, gw->g.font, gdispGGetWidth(gw->g.display) - gw->g.x) : gw->g.width;
|
||||||
|
h = (gw->g.flags & GLABEL_FLG_HAUTO) ? getheight(gw->text, gw->g.font, gdispGGetWidth(gw->g.display) - gw->g.x) : gw->g.height;
|
||||||
|
|
||||||
|
if (gw->g.width != w || gw->g.height != h) {
|
||||||
|
gwinResize(&gw->g, w, h);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if GWIN_LABEL_ATTRIBUTE
|
||||||
|
if (gw2obj->attr != 0) {
|
||||||
|
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw2obj->attr, gw->g.font,
|
||||||
|
(gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background,
|
||||||
|
justifyLeft);
|
||||||
|
|
||||||
|
gdispGFillStringBox(gw->g.display, gw->g.x + gw2obj->tab, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font,
|
||||||
|
(gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background,
|
||||||
|
justifyLeft);
|
||||||
|
} else {
|
||||||
|
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font,
|
||||||
|
(gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background,
|
||||||
|
justifyLeft);
|
||||||
|
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font,
|
||||||
|
(gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background,
|
||||||
|
justifyLeft);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// render the border (if any)
|
||||||
|
if (gw->g.flags & GLABEL_FLG_BORDER)
|
||||||
|
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, (gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.edge : gw->pstyle->disabled.edge);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // GFX_USE_GWIN && GFX_NEED_LABEL
|
#endif // GFX_USE_GWIN && GFX_NEED_LABEL
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
216
src/gwin/list.c
216
src/gwin/list.c
|
@ -76,102 +76,7 @@ static void sendListEvent(GWidgetObject *gw, int item) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void gwinListDefaultDraw(GWidgetObject* gw, void* param) {
|
static void gwinListDefaultDraw(GWidgetObject* gw, void* param);
|
||||||
(void)param;
|
|
||||||
|
|
||||||
#if GDISP_NEED_CONVEX_POLYGON
|
|
||||||
static const point upArrow[] = { {0, ARROW}, {ARROW, ARROW}, {ARROW/2, 0} };
|
|
||||||
static const point downArrow[] = { {0, 0}, {ARROW, 0}, {ARROW/2, ARROW} };
|
|
||||||
#endif
|
|
||||||
|
|
||||||
const gfxQueueASyncItem* qi;
|
|
||||||
int i;
|
|
||||||
coord_t x, y, iheight, iwidth;
|
|
||||||
color_t fill;
|
|
||||||
const GColorSet * ps;
|
|
||||||
#if GWIN_NEED_LIST_IMAGES
|
|
||||||
coord_t sy;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// dont render if render has been disabled
|
|
||||||
if (!(gw->g.flags & GLIST_FLG_ENABLERENDER)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ps = (gw->g.flags & GWIN_FLG_ENABLED) ? &gw->pstyle->enabled : &gw->pstyle->disabled;
|
|
||||||
iheight = gdispGetFontMetric(gw->g.font, fontHeight) + VERTICAL_PADDING;
|
|
||||||
x = 1;
|
|
||||||
|
|
||||||
// the scroll area
|
|
||||||
if (gw->g.flags & GLIST_FLG_SCROLLSMOOTH) {
|
|
||||||
iwidth = gw->g.width - 2 - 4;
|
|
||||||
if (gw2obj->cnt > 0) {
|
|
||||||
int max_scroll_value = gw2obj->cnt * iheight - gw->g.height-2;
|
|
||||||
if (max_scroll_value > 0) {
|
|
||||||
int bar_height = (gw->g.height-2) * (gw->g.height-2) / (gw2obj->cnt * iheight);
|
|
||||||
gdispGFillArea(gw->g.display, gw->g.x + gw->g.width-4, gw->g.y + 1, 2, gw->g.height-1, gw->pstyle->background);
|
|
||||||
gdispGFillArea(gw->g.display, gw->g.x + gw->g.width-4, gw->g.y + gw2obj->top * ((gw->g.height-2)-bar_height) / max_scroll_value, 2, bar_height, ps->edge);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ((gw2obj->cnt > (gw->g.height-2) / iheight) || (gw->g.flags & GLIST_FLG_SCROLLALWAYS)) {
|
|
||||||
iwidth = gw->g.width - (SCROLLWIDTH+3);
|
|
||||||
gdispGFillArea(gw->g.display, gw->g.x+iwidth+2, gw->g.y+1, SCROLLWIDTH, gw->g.height-2, gdispBlendColor(ps->fill, gw->pstyle->background, 128));
|
|
||||||
gdispGDrawLine(gw->g.display, gw->g.x+iwidth+1, gw->g.y+1, gw->g.x+iwidth+1, gw->g.y+gw->g.height-2, ps->edge);
|
|
||||||
#if GDISP_NEED_CONVEX_POLYGON
|
|
||||||
gdispGFillConvexPoly(gw->g.display, gw->g.x+iwidth+((SCROLLWIDTH-ARROW)/2+2), gw->g.y+(ARROW/2+1), upArrow, 3, ps->fill);
|
|
||||||
gdispGFillConvexPoly(gw->g.display, gw->g.x+iwidth+((SCROLLWIDTH-ARROW)/2+2), gw->g.y+gw->g.height-(ARROW+ARROW/2+1), downArrow, 3, ps->fill);
|
|
||||||
#else
|
|
||||||
#warning "GWIN: Lists display better when GDISP_NEED_CONVEX_POLGON is turned on"
|
|
||||||
gdispGFillArea(gw->g.display, gw->g.x+iwidth+((SCROLLWIDTH-ARROW)/2+2), gw->g.y+(ARROW/2+1), ARROW, ARROW, ps->fill);
|
|
||||||
gdispGFillArea(gw->g.display, gw->g.x+iwidth+((SCROLLWIDTH-ARROW)/2+2), gw->g.y+gw->g.height-(ARROW+ARROW/2+1), ARROW, ARROW, ps->fill);
|
|
||||||
#endif
|
|
||||||
} else
|
|
||||||
iwidth = gw->g.width - 2;
|
|
||||||
|
|
||||||
#if GWIN_NEED_LIST_IMAGES
|
|
||||||
if ((gw->g.flags & GLIST_FLG_HASIMAGES)) {
|
|
||||||
x += iheight;
|
|
||||||
iwidth -= iheight;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
// Find the top item
|
|
||||||
for (qi = gfxQueueASyncPeek(&gw2obj->list_head), i = iheight - 1; i < gw2obj->top && qi; qi = gfxQueueASyncNext(qi), i+=iheight);
|
|
||||||
|
|
||||||
// the list frame
|
|
||||||
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, ps->edge);
|
|
||||||
|
|
||||||
// Set the clipping region so we do not override the frame.
|
|
||||||
gdispGSetClip(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2);
|
|
||||||
|
|
||||||
// Draw until we run out of room or items
|
|
||||||
for (y = 1-(gw2obj->top%iheight); y < gw->g.height-2 && qi; qi = gfxQueueASyncNext(qi), y += iheight) {
|
|
||||||
fill = (qi2li->flags & GLIST_FLG_SELECTED) ? ps->fill : gw->pstyle->background;
|
|
||||||
gdispGFillArea(gw->g.display, gw->g.x+1, gw->g.y+y, iwidth, iheight, fill);
|
|
||||||
#if GWIN_NEED_LIST_IMAGES
|
|
||||||
if ((gw->g.flags & GLIST_FLG_HASIMAGES)) {
|
|
||||||
// Clear the image area
|
|
||||||
if (qi2li->pimg && gdispImageIsOpen(qi2li->pimg)) {
|
|
||||||
// Calculate which image
|
|
||||||
sy = (qi2li->flags & GLIST_FLG_SELECTED) ? 0 : (iheight-VERTICAL_PADDING);
|
|
||||||
if (!(gw->g.flags & GWIN_FLG_ENABLED))
|
|
||||||
sy += 2*(iheight-VERTICAL_PADDING);
|
|
||||||
while (sy > qi2li->pimg->height)
|
|
||||||
sy -= iheight-VERTICAL_PADDING;
|
|
||||||
// Draw the image
|
|
||||||
gdispImageSetBgColor(qi2li->pimg, fill);
|
|
||||||
gdispGImageDraw(gw->g.display, qi2li->pimg, gw->g.x+1, gw->g.y+y, iheight-VERTICAL_PADDING, iheight-VERTICAL_PADDING, 0, sy);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
gdispGFillStringBox(gw->g.display, gw->g.x+x+HORIZONTAL_PADDING, gw->g.y+y, iwidth-HORIZONTAL_PADDING, iheight, qi2li->text, gw->g.font, ps->text, fill, justifyLeft);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fill any remaining item space
|
|
||||||
if (y < gw->g.height-1)
|
|
||||||
gdispGFillArea(gw->g.display, gw->g.x+1, gw->g.y+y, iwidth, gw->g.height-1-y, gw->pstyle->background);
|
|
||||||
}
|
|
||||||
|
|
||||||
#if GINPUT_NEED_MOUSE
|
#if GINPUT_NEED_MOUSE
|
||||||
static void MouseSelect(GWidgetObject* gw, coord_t x, coord_t y) {
|
static void MouseSelect(GWidgetObject* gw, coord_t x, coord_t y) {
|
||||||
|
@ -209,24 +114,23 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param) {
|
||||||
|
|
||||||
// a mouse down has occurred over the list area
|
// a mouse down has occurred over the list area
|
||||||
static void MouseDown(GWidgetObject* gw, coord_t x, coord_t y) {
|
static void MouseDown(GWidgetObject* gw, coord_t x, coord_t y) {
|
||||||
int pgsz;
|
coord_t iheight, pgsz;
|
||||||
coord_t iheight;
|
|
||||||
(void) x;
|
|
||||||
|
|
||||||
|
// Save our mouse start position
|
||||||
gw2obj->start_mouse_x = x;
|
gw2obj->start_mouse_x = x;
|
||||||
gw2obj->start_mouse_y = y;
|
gw2obj->start_mouse_y = y;
|
||||||
gw2obj->last_mouse_y = y;
|
gw2obj->last_mouse_y = y;
|
||||||
|
|
||||||
iheight = gdispGetFontMetric(gw->g.font, fontHeight) + VERTICAL_PADDING;
|
|
||||||
pgsz = (gw->g.height-2);
|
|
||||||
if (pgsz < 1) pgsz = 1;
|
|
||||||
|
|
||||||
// For smooth scrolling, scrolling is done in the MouseMove and selection is done on MouseUp
|
// For smooth scrolling, scrolling is done in the MouseMove and selection is done on MouseUp
|
||||||
if (gw->g.flags & GLIST_FLG_SCROLLSMOOTH)
|
if (gw->g.flags & GLIST_FLG_SCROLLSMOOTH)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Some initial stuff
|
||||||
|
iheight = gdispGetFontMetric(gw->g.font, fontHeight) + VERTICAL_PADDING;
|
||||||
|
pgsz = gw->g.height-2;
|
||||||
|
|
||||||
// Handle click over the scroll bar
|
// Handle click over the scroll bar
|
||||||
if (gw2obj->cnt > (pgsz / iheight) && x >= gw->g.width-(SCROLLWIDTH+2)) {
|
if (x >= gw->g.width-(SCROLLWIDTH+2) && (gw2obj->cnt > pgsz/iheight || (gw->g.flags & GLIST_FLG_SCROLLALWAYS))) {
|
||||||
if (y < 2*ARROW) {
|
if (y < 2*ARROW) {
|
||||||
if (gw2obj->top > 0) {
|
if (gw2obj->top > 0) {
|
||||||
gw2obj->top -= iheight;
|
gw2obj->top -= iheight;
|
||||||
|
@ -450,6 +354,10 @@ void gwinListSetScroll(GHandle gh, scroll_t flag) {
|
||||||
int gwinListAddItem(GHandle gh, const char* item_name, bool_t useAlloc) {
|
int gwinListAddItem(GHandle gh, const char* item_name, bool_t useAlloc) {
|
||||||
ListItem *newItem;
|
ListItem *newItem;
|
||||||
|
|
||||||
|
// is it a valid handle?
|
||||||
|
if (gh->vmt != (gwinVMT *)&listVMT)
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (useAlloc) {
|
if (useAlloc) {
|
||||||
size_t len = strlen(item_name)+1;
|
size_t len = strlen(item_name)+1;
|
||||||
if (!(newItem = gfxAlloc(sizeof(ListItem) + len)))
|
if (!(newItem = gfxAlloc(sizeof(ListItem) + len)))
|
||||||
|
@ -687,6 +595,106 @@ const char* gwinListGetSelectedText(GHandle gh) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static void gwinListDefaultDraw(GWidgetObject* gw, void* param) {
|
||||||
|
(void)param;
|
||||||
|
|
||||||
|
#if GDISP_NEED_CONVEX_POLYGON
|
||||||
|
static const point upArrow[] = { {0, ARROW}, {ARROW, ARROW}, {ARROW/2, 0} };
|
||||||
|
static const point downArrow[] = { {0, 0}, {ARROW, 0}, {ARROW/2, ARROW} };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const gfxQueueASyncItem* qi;
|
||||||
|
int i;
|
||||||
|
coord_t x, y, iheight, iwidth;
|
||||||
|
color_t fill;
|
||||||
|
const GColorSet * ps;
|
||||||
|
#if GWIN_NEED_LIST_IMAGES
|
||||||
|
coord_t sy;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// is it a valid handle?
|
||||||
|
if (gw->g.vmt != (gwinVMT *)&listVMT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// don't render if render has been disabled
|
||||||
|
if (!(gw->g.flags & GLIST_FLG_ENABLERENDER))
|
||||||
|
return;
|
||||||
|
|
||||||
|
ps = (gw->g.flags & GWIN_FLG_ENABLED) ? &gw->pstyle->enabled : &gw->pstyle->disabled;
|
||||||
|
iheight = gdispGetFontMetric(gw->g.font, fontHeight) + VERTICAL_PADDING;
|
||||||
|
x = 1;
|
||||||
|
|
||||||
|
// the scroll area
|
||||||
|
if (gw->g.flags & GLIST_FLG_SCROLLSMOOTH) {
|
||||||
|
iwidth = gw->g.width - 2 - 4;
|
||||||
|
if (gw2obj->cnt > 0) {
|
||||||
|
int max_scroll_value = gw2obj->cnt * iheight - gw->g.height-2;
|
||||||
|
if (max_scroll_value > 0) {
|
||||||
|
int bar_height = (gw->g.height-2) * (gw->g.height-2) / (gw2obj->cnt * iheight);
|
||||||
|
gdispGFillArea(gw->g.display, gw->g.x + gw->g.width-4, gw->g.y + 1, 2, gw->g.height-1, gw->pstyle->background);
|
||||||
|
gdispGFillArea(gw->g.display, gw->g.x + gw->g.width-4, gw->g.y + gw2obj->top * ((gw->g.height-2)-bar_height) / max_scroll_value, 2, bar_height, ps->edge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if ((gw2obj->cnt > (gw->g.height-2) / iheight) || (gw->g.flags & GLIST_FLG_SCROLLALWAYS)) {
|
||||||
|
iwidth = gw->g.width - (SCROLLWIDTH+3);
|
||||||
|
gdispGFillArea(gw->g.display, gw->g.x+iwidth+2, gw->g.y+1, SCROLLWIDTH, gw->g.height-2, gdispBlendColor(ps->fill, gw->pstyle->background, 128));
|
||||||
|
gdispGDrawLine(gw->g.display, gw->g.x+iwidth+1, gw->g.y+1, gw->g.x+iwidth+1, gw->g.y+gw->g.height-2, ps->edge);
|
||||||
|
#if GDISP_NEED_CONVEX_POLYGON
|
||||||
|
gdispGFillConvexPoly(gw->g.display, gw->g.x+iwidth+((SCROLLWIDTH-ARROW)/2+2), gw->g.y+(ARROW/2+1), upArrow, 3, ps->fill);
|
||||||
|
gdispGFillConvexPoly(gw->g.display, gw->g.x+iwidth+((SCROLLWIDTH-ARROW)/2+2), gw->g.y+gw->g.height-(ARROW+ARROW/2+1), downArrow, 3, ps->fill);
|
||||||
|
#else
|
||||||
|
#warning "GWIN: Lists display better when GDISP_NEED_CONVEX_POLGON is turned on"
|
||||||
|
gdispGFillArea(gw->g.display, gw->g.x+iwidth+((SCROLLWIDTH-ARROW)/2+2), gw->g.y+(ARROW/2+1), ARROW, ARROW, ps->fill);
|
||||||
|
gdispGFillArea(gw->g.display, gw->g.x+iwidth+((SCROLLWIDTH-ARROW)/2+2), gw->g.y+gw->g.height-(ARROW+ARROW/2+1), ARROW, ARROW, ps->fill);
|
||||||
|
#endif
|
||||||
|
} else
|
||||||
|
iwidth = gw->g.width - 2;
|
||||||
|
|
||||||
|
#if GWIN_NEED_LIST_IMAGES
|
||||||
|
if ((gw->g.flags & GLIST_FLG_HASIMAGES)) {
|
||||||
|
x += iheight;
|
||||||
|
iwidth -= iheight;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Find the top item
|
||||||
|
for (qi = gfxQueueASyncPeek(&gw2obj->list_head), i = iheight - 1; i < gw2obj->top && qi; qi = gfxQueueASyncNext(qi), i+=iheight);
|
||||||
|
|
||||||
|
// the list frame
|
||||||
|
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, ps->edge);
|
||||||
|
|
||||||
|
// Set the clipping region so we do not override the frame.
|
||||||
|
gdispGSetClip(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2);
|
||||||
|
|
||||||
|
// Draw until we run out of room or items
|
||||||
|
for (y = 1-(gw2obj->top%iheight); y < gw->g.height-2 && qi; qi = gfxQueueASyncNext(qi), y += iheight) {
|
||||||
|
fill = (qi2li->flags & GLIST_FLG_SELECTED) ? ps->fill : gw->pstyle->background;
|
||||||
|
gdispGFillArea(gw->g.display, gw->g.x+1, gw->g.y+y, iwidth, iheight, fill);
|
||||||
|
#if GWIN_NEED_LIST_IMAGES
|
||||||
|
if ((gw->g.flags & GLIST_FLG_HASIMAGES)) {
|
||||||
|
// Clear the image area
|
||||||
|
if (qi2li->pimg && gdispImageIsOpen(qi2li->pimg)) {
|
||||||
|
// Calculate which image
|
||||||
|
sy = (qi2li->flags & GLIST_FLG_SELECTED) ? 0 : (iheight-VERTICAL_PADDING);
|
||||||
|
if (!(gw->g.flags & GWIN_FLG_ENABLED))
|
||||||
|
sy += 2*(iheight-VERTICAL_PADDING);
|
||||||
|
while (sy > qi2li->pimg->height)
|
||||||
|
sy -= iheight-VERTICAL_PADDING;
|
||||||
|
// Draw the image
|
||||||
|
gdispImageSetBgColor(qi2li->pimg, fill);
|
||||||
|
gdispGImageDraw(gw->g.display, qi2li->pimg, gw->g.x+1, gw->g.y+y, iheight-VERTICAL_PADDING, iheight-VERTICAL_PADDING, 0, sy);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
gdispGFillStringBox(gw->g.display, gw->g.x+x+HORIZONTAL_PADDING, gw->g.y+y, iwidth-HORIZONTAL_PADDING, iheight, qi2li->text, gw->g.font, ps->text, fill, justifyLeft);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fill any remaining item space
|
||||||
|
if (y < gw->g.height-1)
|
||||||
|
gdispGFillArea(gw->g.display, gw->g.x+1, gw->g.y+y, iwidth, gw->g.height-1-y, gw->pstyle->background);
|
||||||
|
}
|
||||||
|
|
||||||
#endif // GFX_USE_GWIN && GWIN_NEED_LIST
|
#endif // GFX_USE_GWIN && GWIN_NEED_LIST
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ static const gwidgetVMT progressbarVMT = {
|
||||||
{
|
{
|
||||||
"Progressbar", // The classname
|
"Progressbar", // The classname
|
||||||
sizeof(GProgressbarObject), // The object size
|
sizeof(GProgressbarObject), // The object size
|
||||||
_destroy, // The destroy routine
|
_destroy, // The destroy routine
|
||||||
_gwidgetRedraw, // The redraw routine
|
_gwidgetRedraw, // The redraw routine
|
||||||
0, // The after-clear routine
|
0, // The after-clear routine
|
||||||
},
|
},
|
||||||
|
@ -180,7 +180,7 @@ void gwinProgressbarDecrement(GHandle gh) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// used by gwinProgressbarStart();
|
// used by gwinProgressbarStart();
|
||||||
void _progressbarCallback(void *param) {
|
static void _progressbarCallback(void *param) {
|
||||||
#define gsw ((GProgressbarObject *)gh)
|
#define gsw ((GProgressbarObject *)gh)
|
||||||
GHandle gh = (GHandle)param;
|
GHandle gh = (GHandle)param;
|
||||||
|
|
||||||
|
@ -206,11 +206,13 @@ void gwinProgressbarStart(GHandle gh, delaytime_t delay) {
|
||||||
gtimerInit(&(gsw->gt));
|
gtimerInit(&(gsw->gt));
|
||||||
gtimerStart(&(gsw->gt), _progressbarCallback, gh, FALSE, gsw->delay);
|
gtimerStart(&(gsw->gt), _progressbarCallback, gh, FALSE, gsw->delay);
|
||||||
|
|
||||||
// if this is not made, the progressbar will not start when the it's already visible
|
#if 0
|
||||||
if (gsw->w.g.flags & GWIN_FLG_VISIBLE) {
|
// if this is not made, the progressbar will not start when it's already visible
|
||||||
gwinSetVisible(gh, FALSE);
|
if (gsw->w.g.flags & GWIN_FLG_VISIBLE) {
|
||||||
gwinSetVisible(gh, TRUE);
|
gwinSetVisible(gh, FALSE);
|
||||||
}
|
gwinSetVisible(gh, TRUE);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#undef gsw
|
#undef gsw
|
||||||
}
|
}
|
||||||
|
@ -239,13 +241,6 @@ void gwinProgressbarDraw_Std(GWidgetObject *gw, void *param) {
|
||||||
if (gw->g.vmt != (gwinVMT *)&progressbarVMT)
|
if (gw->g.vmt != (gwinVMT *)&progressbarVMT)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// disable the auto-update timer if any
|
|
||||||
#if GFX_USE_GTIMER
|
|
||||||
if (gtimerIsActive(&(gsw->gt)) && !(gw->g.flags & GWIN_FLG_ENABLED)) {
|
|
||||||
gtimerStop(&(gsw->gt));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// get the colors right
|
// get the colors right
|
||||||
if ((gw->g.flags & GWIN_FLG_ENABLED))
|
if ((gw->g.flags & GWIN_FLG_ENABLED))
|
||||||
pcol = &gw->pstyle->pressed;
|
pcol = &gw->pstyle->pressed;
|
||||||
|
|
101
src/gwin/radio.c
101
src/gwin/radio.c
|
@ -21,6 +21,11 @@
|
||||||
|
|
||||||
#include "src/gwin/class_gwin.h"
|
#include "src/gwin/class_gwin.h"
|
||||||
|
|
||||||
|
#define GRADIO_TAB_CNR 8 // 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
|
// Our pressed state
|
||||||
#define GRADIO_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0)
|
#define GRADIO_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0)
|
||||||
|
|
||||||
|
@ -195,34 +200,86 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) {
|
||||||
#undef gcw
|
#undef gcw
|
||||||
}
|
}
|
||||||
|
|
||||||
void gwinRadioDraw_Button(GWidgetObject *gw, void *param) {
|
#if GWIN_FLAT_STYLING
|
||||||
const GColorSet * pcol;
|
void gwinRadioDraw_Button(GWidgetObject *gw, void *param) {
|
||||||
(void) param;
|
const GColorSet * pcol;
|
||||||
|
(void) param;
|
||||||
|
|
||||||
if (gw->g.vmt != (gwinVMT *)&radioVMT) return;
|
if (gw->g.vmt != (gwinVMT *)&radioVMT) return;
|
||||||
pcol = getDrawColors(gw);
|
pcol = getDrawColors(gw);
|
||||||
|
|
||||||
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
|
|
||||||
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
|
|
||||||
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
|
|
||||||
}
|
|
||||||
|
|
||||||
void gwinRadioDraw_Tab(GWidgetObject *gw, void *param) {
|
|
||||||
const GColorSet * pcol;
|
|
||||||
(void) param;
|
|
||||||
|
|
||||||
if (gw->g.vmt != (gwinVMT *)&radioVMT) return;
|
|
||||||
pcol = getDrawColors(gw);
|
|
||||||
|
|
||||||
if ((gw->g.flags & GRADIO_FLG_PRESSED)) {
|
|
||||||
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge);
|
|
||||||
gdispGFillStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
|
|
||||||
} else {
|
|
||||||
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
|
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
|
||||||
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
|
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
|
||||||
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
|
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
|
||||||
}
|
}
|
||||||
}
|
void gwinRadioDraw_Tab(GWidgetObject *gw, void *param) {
|
||||||
|
const GColorSet * pcol;
|
||||||
|
(void) param;
|
||||||
|
|
||||||
|
if (gw->g.vmt != (gwinVMT *)&radioVMT) return;
|
||||||
|
pcol = getDrawColors(gw);
|
||||||
|
|
||||||
|
if ((gw->g.flags & GRADIO_FLG_PRESSED)) {
|
||||||
|
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge);
|
||||||
|
gdispGFillStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
|
||||||
|
} else {
|
||||||
|
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
|
||||||
|
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
|
||||||
|
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void gwinRadioDraw_Button(GWidgetObject *gw, void *param) {
|
||||||
|
const GColorSet * pcol;
|
||||||
|
fixed alpha;
|
||||||
|
fixed dalpha;
|
||||||
|
coord_t i;
|
||||||
|
color_t tcol, bcol;
|
||||||
|
(void) param;
|
||||||
|
|
||||||
|
if (gw->g.vmt != (gwinVMT *)&radioVMT) return;
|
||||||
|
pcol = getDrawColors(gw);
|
||||||
|
|
||||||
|
/* Fill the box blended from variants of the fill color */
|
||||||
|
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)));
|
||||||
|
|
||||||
|
gdispGDrawStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, justifyCenter);
|
||||||
|
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
|
||||||
|
gdispGDrawLine(gw->g.display, gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge);
|
||||||
|
}
|
||||||
|
void gwinRadioDraw_Tab(GWidgetObject *gw, void *param) {
|
||||||
|
const GColorSet * pcol;
|
||||||
|
fixed alpha;
|
||||||
|
fixed dalpha;
|
||||||
|
coord_t i;
|
||||||
|
color_t tcol, bcol;
|
||||||
|
(void) param;
|
||||||
|
|
||||||
|
if (gw->g.vmt != (gwinVMT *)&radioVMT) return;
|
||||||
|
pcol = getDrawColors(gw);
|
||||||
|
|
||||||
|
if ((gw->g.flags & GRADIO_FLG_PRESSED)) {
|
||||||
|
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, 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)));
|
||||||
|
gdispGDrawLine(gw->g.display, gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge);
|
||||||
|
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* GFX_USE_GWIN && GWIN_NEED_BUTTON */
|
#endif /* GFX_USE_GWIN && GWIN_NEED_BUTTON */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
|
@ -336,6 +336,24 @@ extern "C" {
|
||||||
*/
|
*/
|
||||||
void gwinSetEnabled(GHandle gh, bool_t enabled);
|
void gwinSetEnabled(GHandle gh, bool_t enabled);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Enables a widget
|
||||||
|
*
|
||||||
|
* @param[in] gh The window handle
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
#define gwinEnable(gh) gwinSetEnabled(gh, TRUE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Disables a widget
|
||||||
|
*
|
||||||
|
* @param[in] gh The window handle
|
||||||
|
*
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
|
#define gwinDisable(gh) gwinSetEnabled(gh, FALSE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Gets the enabled state of a window
|
* @brief Gets the enabled state of a window
|
||||||
* @return TRUE if enabled
|
* @return TRUE if enabled
|
||||||
|
|
|
@ -98,6 +98,15 @@
|
||||||
* @name GWIN Optional Parameters
|
* @name GWIN Optional Parameters
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* @brief Use flat styling for controls rather than a 3D look
|
||||||
|
* @details Defaults to FALSE
|
||||||
|
* @note This may appear better on color-restricted displays
|
||||||
|
* @note Flat styling is less graphics and cpu intensive (marginally) than the default 3D look.
|
||||||
|
*/
|
||||||
|
#ifndef GWIN_FLAT_STYLING
|
||||||
|
#define GWIN_FLAT_STYLING FALSE
|
||||||
|
#endif
|
||||||
/**
|
/**
|
||||||
* @brief Buttons should not insist the mouse is over the button on mouse release
|
* @brief Buttons should not insist the mouse is over the button on mouse release
|
||||||
* @details Defaults to FALSE
|
* @details Defaults to FALSE
|
||||||
|
|
Loading…
Reference in New Issue