Added ability to compile ugfx as a single file (excluding driver and board files).
Simply compile src/gfx_mk.c
This commit is contained in:
parent
e850c344b8
commit
ccde54722f
30
gfx.mk
30
gfx.mk
@ -4,20 +4,24 @@
|
||||
# http://ugfx.org/license.html
|
||||
|
||||
GFXINC += $(GFXLIB)
|
||||
GFXSRC += $(GFXLIB)/src/gfx.c
|
||||
|
||||
include $(GFXLIB)/src/gos/gos.mk
|
||||
include $(GFXLIB)/src/gdriver/gdriver.mk
|
||||
include $(GFXLIB)/src/gqueue/gqueue.mk
|
||||
include $(GFXLIB)/src/gdisp/gdisp.mk
|
||||
include $(GFXLIB)/src/gevent/gevent.mk
|
||||
include $(GFXLIB)/src/gtimer/gtimer.mk
|
||||
include $(GFXLIB)/src/gwin/gwin.mk
|
||||
include $(GFXLIB)/src/ginput/ginput.mk
|
||||
include $(GFXLIB)/src/gadc/gadc.mk
|
||||
include $(GFXLIB)/src/gaudio/gaudio.mk
|
||||
include $(GFXLIB)/src/gmisc/gmisc.mk
|
||||
include $(GFXLIB)/src/gfile/gfile.mk
|
||||
ifeq ($(GFXSINGLEMAKE),yes)
|
||||
GFXSRC += $(GFXLIB)/src/gfx_mk.c
|
||||
else
|
||||
GFXSRC += $(GFXLIB)/src/gfx.c
|
||||
include $(GFXLIB)/src/gos/gos.mk
|
||||
include $(GFXLIB)/src/gdriver/gdriver.mk
|
||||
include $(GFXLIB)/src/gqueue/gqueue.mk
|
||||
include $(GFXLIB)/src/gdisp/gdisp.mk
|
||||
include $(GFXLIB)/src/gevent/gevent.mk
|
||||
include $(GFXLIB)/src/gtimer/gtimer.mk
|
||||
include $(GFXLIB)/src/gwin/gwin.mk
|
||||
include $(GFXLIB)/src/ginput/ginput.mk
|
||||
include $(GFXLIB)/src/gadc/gadc.mk
|
||||
include $(GFXLIB)/src/gaudio/gaudio.mk
|
||||
include $(GFXLIB)/src/gmisc/gmisc.mk
|
||||
include $(GFXLIB)/src/gfile/gfile.mk
|
||||
endif
|
||||
|
||||
# Include the boards and drivers
|
||||
ifneq ($(GFXBOARD),)
|
||||
|
8
src/gadc/gadc_mk.c
Normal file
8
src/gadc/gadc_mk.c
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "gadc.c"
|
8
src/gaudio/gaudio_mk.c
Normal file
8
src/gaudio/gaudio_mk.c
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "gaudio.c"
|
@ -65,7 +65,7 @@ build fixed_10x20.bdf fixed_10x20 bwfont
|
||||
build fixed_7x14.bdf fixed_7x14 bwfont
|
||||
build fixed_5x8.bdf fixed_5x8 bwfont
|
||||
|
||||
echo '#include "gfx.h"' > fonts.h
|
||||
echo '// This file is generated by build_fonts.sh' > fonts.h
|
||||
for file in *.c; do
|
||||
echo >> fonts.h
|
||||
noext="${file%.*}"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "gfx.h"
|
||||
// This file is generated by build_fonts.sh
|
||||
|
||||
#if defined(GDISP_INCLUDE_FONT_DEJAVUSANS10) && GDISP_INCLUDE_FONT_DEJAVUSANS10
|
||||
#define GDISP_FONT_FOUND
|
||||
|
15
src/gdisp/fonts/mf_bwfont.h
Normal file
15
src/gdisp/fonts/mf_bwfont.h
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
/* This is a stub file to prevent having to include the mcufont
|
||||
* directory in the include path for funny compilers such as arduino
|
||||
* which don't support a user specified include path.
|
||||
*
|
||||
* It is not needed anyway as the files are already included.
|
||||
*
|
||||
* New versions of the font generator do not generate these include lines.
|
||||
*/
|
15
src/gdisp/fonts/mf_rlefont.h
Normal file
15
src/gdisp/fonts/mf_rlefont.h
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
/* This is a stub file to prevent having to include the mcufont
|
||||
* directory in the include path for funny compilers such as arduino
|
||||
* which don't support a user specified include path.
|
||||
*
|
||||
* It is not needed anyway as the files are already included.
|
||||
*
|
||||
* New versions of the font generator do not generate these include lines.
|
||||
*/
|
15
src/gdisp/fonts/mf_scaledfont.h
Normal file
15
src/gdisp/fonts/mf_scaledfont.h
Normal file
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
/* This is a stub file to prevent having to include the mcufont
|
||||
* directory in the include path for funny compilers such as arduino
|
||||
* which don't support a user specified include path.
|
||||
*
|
||||
* It is not needed anyway as the files are already included.
|
||||
*
|
||||
* New versions of the font generator do not generate these include lines.
|
||||
*/
|
@ -501,7 +501,7 @@ static void line_clip(GDisplay *g) {
|
||||
}
|
||||
|
||||
#if GDISP_STARTUP_LOGO_TIMEOUT > 0
|
||||
static bool_t initDone;
|
||||
static bool_t gdispInitDone;
|
||||
static void StartupLogoDisplay(GDisplay *g) {
|
||||
coord_t x, y, w;
|
||||
const coord_t * p;
|
||||
@ -604,7 +604,7 @@ void _gdispInit(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
initDone = TRUE;
|
||||
gdispInitDone = TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -660,7 +660,7 @@ void _gdispPostInitDriver(GDriver *g) {
|
||||
|
||||
// Display the startup logo if this is a static initialised display
|
||||
#if GDISP_STARTUP_LOGO_TIMEOUT > 0
|
||||
if (!initDone)
|
||||
if (!gdispInitDone)
|
||||
StartupLogoDisplay(gd);
|
||||
#endif
|
||||
|
||||
|
@ -15,5 +15,5 @@ GFXSRC += $(GFXLIB)/src/gdisp/gdisp.c \
|
||||
|
||||
MFDIR = $(GFXLIB)/src/gdisp/mcufont
|
||||
include $(GFXLIB)/src/gdisp/mcufont/mcufont.mk
|
||||
GFXINC += $(MFDIR)
|
||||
#GFXINC += $(MFDIR)
|
||||
GFXSRC += $(MFSRC)
|
||||
|
29
src/gdisp/gdisp_mk.c
Normal file
29
src/gdisp/gdisp_mk.c
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
/* The very first thing that has to be compiled here is mf_font.c so that
|
||||
* inclusion of the font header files does not stop the inclusion of the
|
||||
* implementation specific parts of the font files.
|
||||
*/
|
||||
#include "mcufont/mf_font.c"
|
||||
#include "mcufont/mf_rlefont.c"
|
||||
#include "mcufont/mf_bwfont.c"
|
||||
#include "mcufont/mf_scaledfont.c"
|
||||
#include "mcufont/mf_encoding.c"
|
||||
#include "mcufont/mf_justify.c"
|
||||
#include "mcufont/mf_kerning.c"
|
||||
#include "mcufont/mf_wordwrap.c"
|
||||
|
||||
#include "gdisp.c"
|
||||
#include "gdisp_fonts.c"
|
||||
#include "gdisp_pixmap.c"
|
||||
#include "gdisp_image.c"
|
||||
#include "gdisp_image_native.c"
|
||||
#include "gdisp_image_gif.c"
|
||||
#include "gdisp_image_bmp.c"
|
||||
#include "gdisp_image_jpg.c"
|
||||
#include "gdisp_image_png.c"
|
@ -73,12 +73,12 @@ struct mf_bwfont_s
|
||||
/* Internal functions, don't use these directly. */
|
||||
MF_EXTERN uint8_t mf_bwfont_render_character(const struct mf_font_s *font,
|
||||
int16_t x0, int16_t y0,
|
||||
mf_char character,
|
||||
uint16_t character,
|
||||
mf_pixel_callback_t callback,
|
||||
void *state);
|
||||
|
||||
MF_EXTERN uint8_t mf_bwfont_character_width(const struct mf_font_s *font,
|
||||
mf_char character);
|
||||
uint16_t character);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -159,7 +159,7 @@
|
||||
#ifdef __cplusplus
|
||||
#define MF_EXTERN extern "C"
|
||||
#else
|
||||
#define MF_EXTERN extern
|
||||
#define MF_EXTERN
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -19,9 +19,11 @@
|
||||
|
||||
/* Type used to represent characters internally. */
|
||||
#if MF_ENCODING == MF_ENCODING_ASCII
|
||||
typedef char mf_char;
|
||||
typedef char mf_char;
|
||||
#define MFCHAR2UINT16(c) ((uint16_t)(uint8_t)(c))
|
||||
#else
|
||||
typedef uint16_t mf_char;
|
||||
typedef uint16_t mf_char;
|
||||
#define MFCHAR2UINT16(c) (c)
|
||||
#endif
|
||||
|
||||
/* Type used to represent input strings. */
|
||||
|
@ -5,10 +5,18 @@
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "mf_font.h"
|
||||
#include "mf_config.h"
|
||||
|
||||
#ifndef MF_NO_COMPILE
|
||||
|
||||
#define MF_BWFONT_INTERNALS
|
||||
#define MF_RLEFONT_INTERNALS
|
||||
#define MF_SCALEDFONT_INTERNALS
|
||||
#include "mf_font.h"
|
||||
#include "mf_rlefont.h"
|
||||
#include "mf_bwfont.h"
|
||||
#include "mf_scaledfont.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
/* This will be made into a list of included fonts using macro magic. */
|
||||
@ -40,7 +48,7 @@ uint8_t mf_character_width(const struct mf_font_s *font,
|
||||
mf_char character)
|
||||
{
|
||||
uint8_t width;
|
||||
width = font->character_width(font, character);
|
||||
width = font->character_width(font, MFCHAR2UINT16(character));
|
||||
|
||||
if (!width)
|
||||
{
|
||||
|
@ -53,17 +53,17 @@ struct mf_font_s
|
||||
uint8_t flags;
|
||||
|
||||
/* Fallback character to use for missing glyphs. */
|
||||
mf_char fallback_character;
|
||||
uint16_t fallback_character;
|
||||
|
||||
/* Function to get character width. Should return 0 if character is
|
||||
* not found. */
|
||||
uint8_t (*character_width)(const struct mf_font_s *font, mf_char character);
|
||||
uint8_t (*character_width)(const struct mf_font_s *font, uint16_t character);
|
||||
|
||||
/* Function to render a character. Returns the character width or 0 if
|
||||
* character is not found. */
|
||||
uint8_t (*render_character)(const struct mf_font_s *font,
|
||||
int16_t x0, int16_t y0,
|
||||
mf_char character,
|
||||
uint16_t character,
|
||||
mf_pixel_callback_t callback,
|
||||
void *state);
|
||||
};
|
||||
|
@ -297,7 +297,7 @@ void mf_render_justified(const struct mf_font_s *font,
|
||||
|
||||
{
|
||||
int16_t x, tmp;
|
||||
uint16_t c1 = 0, c2;
|
||||
mf_char c1 = 0, c2;
|
||||
|
||||
x = x0 - font->baseline_x;
|
||||
while (count--)
|
||||
|
@ -70,12 +70,12 @@ struct mf_rlefont_s
|
||||
/* Internal functions, don't use these directly. */
|
||||
MF_EXTERN uint8_t mf_rlefont_render_character(const struct mf_font_s *font,
|
||||
int16_t x0, int16_t y0,
|
||||
mf_char character,
|
||||
uint16_t character,
|
||||
mf_pixel_callback_t callback,
|
||||
void *state);
|
||||
|
||||
MF_EXTERN uint8_t mf_rlefont_character_width(const struct mf_font_s *font,
|
||||
mf_char character);
|
||||
uint16_t character);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@ static void scaled_pixel_callback(int16_t x, int16_t y, uint8_t count,
|
||||
}
|
||||
|
||||
uint8_t mf_scaled_character_width(const struct mf_font_s *font,
|
||||
mf_char character)
|
||||
uint16_t character)
|
||||
{
|
||||
struct mf_scaledfont_s *sfont = (struct mf_scaledfont_s*)font;
|
||||
uint8_t basewidth;
|
||||
@ -48,7 +48,7 @@ uint8_t mf_scaled_character_width(const struct mf_font_s *font,
|
||||
|
||||
uint8_t mf_scaled_render_character(const struct mf_font_s *font,
|
||||
int16_t x0, int16_t y0,
|
||||
mf_char character,
|
||||
uint16_t character,
|
||||
mf_pixel_callback_t callback,
|
||||
void *state)
|
||||
{
|
||||
|
@ -31,12 +31,12 @@ MF_EXTERN void mf_scale_font(struct mf_scaledfont_s *newfont,
|
||||
/* Internal functions, don't use these directly. */
|
||||
MF_EXTERN uint8_t mf_scaled_render_character(const struct mf_font_s *font,
|
||||
int16_t x0, int16_t y0,
|
||||
mf_char character,
|
||||
uint16_t character,
|
||||
mf_pixel_callback_t callback,
|
||||
void *state);
|
||||
|
||||
MF_EXTERN uint8_t mf_scaled_character_width(const struct mf_font_s *font,
|
||||
mf_char character);
|
||||
uint16_t character);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
8
src/gdriver/gdriver_mk.c
Normal file
8
src/gdriver/gdriver_mk.c
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "gdriver.c"
|
8
src/gevent/gevent_mk.c
Normal file
8
src/gevent/gevent_mk.c
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "gevent.c"
|
23
src/gfile/gfile_mk.c
Normal file
23
src/gfile/gfile_mk.c
Normal file
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "gfile.c"
|
||||
#include "gfile_fs_native.c"
|
||||
#include "gfile_fs_ram.c"
|
||||
#include "gfile_fs_rom.c"
|
||||
#include "gfile_fs_fatfs.c"
|
||||
#include "gfile_fs_petitfs.c"
|
||||
#include "gfile_fs_mem.c"
|
||||
#include "gfile_fs_chibios.c"
|
||||
#include "gfile_fs_strings.c"
|
||||
#include "gfile_printg.c"
|
||||
#include "gfile_scang.c"
|
||||
#include "gfile_stdio.c"
|
||||
#include "gfile_fatfs_wrapper.c"
|
||||
#include "gfile_fatfs_diskio_chibios.c"
|
||||
#include "gfile_petitfs_wrapper.c"
|
||||
#include "gfile_petitfs_diskio_chibios.c"
|
10
src/gfx.c
10
src/gfx.c
@ -15,7 +15,7 @@
|
||||
|
||||
#include "gfx.h"
|
||||
|
||||
static bool_t initDone = FALSE;
|
||||
static bool_t gfxInitDone = FALSE;
|
||||
|
||||
/* These init functions are defined by each module but not published */
|
||||
extern void _gosInit(void);
|
||||
@ -74,9 +74,9 @@ extern void _gosDeinit(void);
|
||||
void gfxInit(void)
|
||||
{
|
||||
/* Ensure we only initialise once */
|
||||
if (initDone)
|
||||
if (gfxInitDone)
|
||||
return;
|
||||
initDone = TRUE;
|
||||
gfxInitDone = TRUE;
|
||||
|
||||
// These must be initialised in the order of their dependancies
|
||||
|
||||
@ -121,9 +121,9 @@ void gfxInit(void)
|
||||
|
||||
void gfxDeinit(void)
|
||||
{
|
||||
if (!initDone)
|
||||
if (!gfxInitDone)
|
||||
return;
|
||||
initDone = FALSE;
|
||||
gfxInitDone = FALSE;
|
||||
|
||||
// We deinitialise the opposite way as we initialised
|
||||
#if GFX_USE_GWIN
|
||||
|
20
src/gfx_mk.c
Normal file
20
src/gfx_mk.c
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "gfx.c"
|
||||
#include "gos/gos_mk.c"
|
||||
#include "gdriver/gdriver_mk.c"
|
||||
#include "gqueue/gqueue_mk.c"
|
||||
#include "gdisp/gdisp_mk.c"
|
||||
#include "gevent/gevent_mk.c"
|
||||
#include "gtimer/gtimer_mk.c"
|
||||
#include "gwin/gwin_mk.c"
|
||||
#include "ginput/ginput_mk.c"
|
||||
#include "gadc/gadc_mk.c"
|
||||
#include "gaudio/gaudio_mk.c"
|
||||
#include "gmisc/gmisc_mk.c"
|
||||
#include "gfile/gfile_mk.c"
|
13
src/ginput/ginput_mk.c
Normal file
13
src/ginput/ginput_mk.c
Normal file
@ -0,0 +1,13 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "ginput.c"
|
||||
#include "ginput_mouse.c"
|
||||
#include "ginput_keyboard.c"
|
||||
#include "ginput_keyboard_microcode.c"
|
||||
#include "ginput_toggle.c"
|
||||
#include "ginput_dial.c"
|
11
src/gmisc/gmisc_mk.c
Normal file
11
src/gmisc/gmisc_mk.c
Normal file
@ -0,0 +1,11 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "gmisc.c"
|
||||
#include "gmisc_arrayops.c"
|
||||
#include "gmisc_matrix2d.c"
|
||||
#include "gmisc_trig.c"
|
16
src/gos/gos_mk.c
Normal file
16
src/gos/gos_mk.c
Normal file
@ -0,0 +1,16 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "gos_arduino.c"
|
||||
#include "gos_chibios.c"
|
||||
#include "gos_ecos.c"
|
||||
#include "gos_freertos.c"
|
||||
#include "gos_linux.c"
|
||||
#include "gos_osx.c"
|
||||
#include "gos_raw32.c"
|
||||
#include "gos_rawrtos.c"
|
||||
#include "gos_win32.c"
|
8
src/gqueue/gqueue_mk.c
Normal file
8
src/gqueue/gqueue_mk.c
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "gqueue.c"
|
8
src/gtimer/gtimer_mk.c
Normal file
8
src/gtimer/gtimer_mk.c
Normal file
@ -0,0 +1,8 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "gtimer.c"
|
@ -17,25 +17,25 @@
|
||||
#include "gwin_class.h"
|
||||
|
||||
// Parameters for various shapes
|
||||
#define RND_CNR_SIZE 5 // Rounded corner size for rounded buttons
|
||||
#define ARROWHEAD_DIVIDER 0 // What fraction of the length for the arrow head. Use 0 for 45 degree arrow head.
|
||||
#define ARROWBODY_DIVIDER 2 // What fraction 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
|
||||
#define BTN_CNR_SIZE 5 // Rounded corner size for rounded buttons
|
||||
#define BTN_ARROWHEAD_DIV 0 // What fraction of the length for the arrow head. Use 0 for 45 degree arrow head.
|
||||
#define BTN_ARROWBODY_DIV 2 // What fraction of the width for the arrow body
|
||||
#define BTN_TOP_FADE 50 // (BTN_TOP_FADE/255)% fade to white for top of button
|
||||
#define BTN_BOTTOM_FADE 25 // (BTN_BOTTOM_FADE/255)% fade to black for bottom of button
|
||||
|
||||
// Our pressed state
|
||||
#define GBUTTON_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0)
|
||||
|
||||
#if GINPUT_NEED_MOUSE
|
||||
// A mouse down has occurred over the button
|
||||
static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
static void ButtonMouseDown(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
(void) x; (void) y;
|
||||
gw->g.flags |= GBUTTON_FLG_PRESSED;
|
||||
_gwinUpdate((GHandle)gw);
|
||||
}
|
||||
|
||||
// A mouse up has occurred (it may or may not be over the button)
|
||||
static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
static void ButtonMouseUp(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
(void) x; (void) y;
|
||||
gw->g.flags &= ~GBUTTON_FLG_PRESSED;
|
||||
_gwinUpdate((GHandle)gw);
|
||||
@ -52,14 +52,14 @@
|
||||
|
||||
#if GINPUT_NEED_TOGGLE
|
||||
// A toggle off has occurred
|
||||
static void ToggleOff(GWidgetObject *gw, uint16_t role) {
|
||||
static void ButtonToggleOff(GWidgetObject *gw, uint16_t role) {
|
||||
(void) role;
|
||||
gw->g.flags &= ~GBUTTON_FLG_PRESSED;
|
||||
_gwinUpdate((GHandle)gw);
|
||||
}
|
||||
|
||||
// A toggle on has occurred
|
||||
static void ToggleOn(GWidgetObject *gw, uint16_t role) {
|
||||
static void ButtonToggleOn(GWidgetObject *gw, uint16_t role) {
|
||||
(void) role;
|
||||
gw->g.flags |= GBUTTON_FLG_PRESSED;
|
||||
_gwinUpdate((GHandle)gw);
|
||||
@ -67,12 +67,12 @@
|
||||
_gwinSendEvent(&gw->g, GEVENT_GWIN_BUTTON);
|
||||
}
|
||||
|
||||
static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) {
|
||||
static void ButtonToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) {
|
||||
(void) role;
|
||||
((GButtonObject *)gw)->toggle = instance;
|
||||
}
|
||||
|
||||
static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) {
|
||||
static uint16_t ButtonToggleGet(GWidgetObject *gw, uint16_t role) {
|
||||
(void) role;
|
||||
return ((GButtonObject *)gw)->toggle;
|
||||
}
|
||||
@ -90,18 +90,18 @@ static const gwidgetVMT buttonVMT = {
|
||||
gwinButtonDraw_Normal, // The default drawing routine
|
||||
#if GINPUT_NEED_MOUSE
|
||||
{
|
||||
MouseDown, // Process mouse down events
|
||||
MouseUp, // Process mouse up events
|
||||
ButtonMouseDown, // Process mouse down events
|
||||
ButtonMouseUp, // Process mouse up events
|
||||
0, // Process mouse move events (NOT USED)
|
||||
},
|
||||
#endif
|
||||
#if GINPUT_NEED_TOGGLE
|
||||
{
|
||||
1, // 1 toggle role
|
||||
ToggleAssign, // Assign Toggles
|
||||
ToggleGet, // Get Toggles
|
||||
ToggleOff, // Process toggle off events
|
||||
ToggleOn, // Process toggle on events
|
||||
ButtonToggleAssign, // Assign Toggles
|
||||
ButtonToggleGet, // Get Toggles
|
||||
ButtonToggleOff, // Process toggle off events
|
||||
ButtonToggleOn, // Process toggle on events
|
||||
},
|
||||
#endif
|
||||
#if GINPUT_NEED_DIAL
|
||||
@ -136,7 +136,7 @@ bool_t gwinButtonIsPressed(GHandle gh) {
|
||||
* Custom Draw Routines
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
static const GColorSet *getButtonColors(GWidgetObject *gw) {
|
||||
if (!(gw->g.flags & GWIN_FLG_SYSENABLED)) return &gw->pstyle->disabled;
|
||||
if ((gw->g.flags & GBUTTON_FLG_PRESSED)) return &gw->pstyle->pressed;
|
||||
return &gw->pstyle->enabled;
|
||||
@ -148,7 +148,7 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
(void) param;
|
||||
|
||||
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
|
||||
pcol = getDrawColors(gw);
|
||||
pcol = getButtonColors(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);
|
||||
@ -164,11 +164,11 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
(void) param;
|
||||
|
||||
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
|
||||
pcol = getDrawColors(gw);
|
||||
pcol = getButtonColors(gw);
|
||||
|
||||
/* Fill the box blended from variants of the fill color */
|
||||
tcol = gdispBlendColor(White, pcol->fill, TOP_FADE);
|
||||
bcol = gdispBlendColor(Black, pcol->fill, BOTTOM_FADE);
|
||||
tcol = gdispBlendColor(White, pcol->fill, BTN_TOP_FADE);
|
||||
bcol = gdispBlendColor(Black, pcol->fill, BTN_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)));
|
||||
@ -185,13 +185,13 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
(void) param;
|
||||
|
||||
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
|
||||
pcol = getDrawColors(gw);
|
||||
pcol = getButtonColors(gw);
|
||||
|
||||
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
|
||||
if (gw->g.width >= 2*RND_CNR_SIZE+10) {
|
||||
gdispGFillRoundedBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, RND_CNR_SIZE-1, pcol->fill);
|
||||
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+RND_CNR_SIZE, gw->g.width-2, gw->g.height-(2*RND_CNR_SIZE), gw->text, gw->g.font, pcol->text, justifyCenter);
|
||||
gdispGDrawRoundedBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, RND_CNR_SIZE, pcol->edge);
|
||||
if (gw->g.width >= 2*BTN_CNR_SIZE+10) {
|
||||
gdispGFillRoundedBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, BTN_CNR_SIZE-1, pcol->fill);
|
||||
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+BTN_CNR_SIZE, gw->g.width-2, gw->g.height-(2*BTN_CNR_SIZE), gw->text, gw->g.font, pcol->text, justifyCenter);
|
||||
gdispGDrawRoundedBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, BTN_CNR_SIZE, pcol->edge);
|
||||
} else {
|
||||
gdispGFillStringBox(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, pcol->fill, justifyCenter);
|
||||
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge);
|
||||
@ -205,7 +205,7 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
(void) param;
|
||||
|
||||
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
|
||||
pcol = getDrawColors(gw);
|
||||
pcol = getButtonColors(gw);
|
||||
|
||||
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
|
||||
gdispGFillEllipse(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width/2-1, gw->g.height/2-1, pcol->fill);
|
||||
@ -221,13 +221,13 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
point arw[7];
|
||||
|
||||
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
|
||||
pcol = getDrawColors(gw);
|
||||
pcol = getButtonColors(gw);
|
||||
|
||||
// Create the arrow polygon
|
||||
arw[0].x = (gw->g.width-1)/2; // Point center
|
||||
arw[0].y = 0; // Arrow start
|
||||
arw[3].y = gw->g.height-1; // Arrow end
|
||||
#if ARROWHEAD_DIVIDER == 0
|
||||
#if BTN_ARROWHEAD_DIV == 0
|
||||
if (gw->g.height <= arw[0].x) {
|
||||
arw[1].y = arw[3].y; // End of head
|
||||
arw[1].x = arw[0].x+arw[3].y; // Width of head (side 1)
|
||||
@ -237,15 +237,15 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
} else {
|
||||
arw[1].y = arw[0].x;
|
||||
arw[1].x = arw[0].x << 1;
|
||||
arw[2].x = arw[0].x + arw[0].x/ARROWBODY_DIVIDER;
|
||||
arw[4].x = arw[0].x - arw[0].x/ARROWBODY_DIVIDER;
|
||||
arw[2].x = arw[0].x + arw[0].x/BTN_ARROWBODY_DIV;
|
||||
arw[4].x = arw[0].x - arw[0].x/BTN_ARROWBODY_DIV;
|
||||
arw[6].x = 0;
|
||||
}
|
||||
#else
|
||||
arw[1].y = gw->g.height/ARROWHEAD_DIVIDER;
|
||||
arw[1].y = gw->g.height/BTN_ARROWHEAD_DIV;
|
||||
arw[1].x = arw[0].x << 1;
|
||||
arw[2].x = arw[0].x + arw[0].x/ARROWBODY_DIVIDER;
|
||||
arw[4].x = arw[0].x - arw[0].x/ARROWBODY_DIVIDER;
|
||||
arw[2].x = arw[0].x + arw[0].x/BTN_ARROWBODY_DIV;
|
||||
arw[4].x = arw[0].x - arw[0].x/BTN_ARROWBODY_DIV;
|
||||
arw[6].x = 0;
|
||||
#endif
|
||||
|
||||
@ -271,13 +271,13 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
point arw[7];
|
||||
|
||||
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
|
||||
pcol = getDrawColors(gw);
|
||||
pcol = getButtonColors(gw);
|
||||
|
||||
// Create the arrow polygon
|
||||
arw[0].x = (gw->g.width-1)/2; // Point center
|
||||
arw[0].y = gw->g.height-1; // Arrow start
|
||||
arw[3].y = 0; // Arrow end
|
||||
#if ARROWHEAD_DIVIDER == 0
|
||||
#if BTN_ARROWHEAD_DIV == 0
|
||||
if (gw->g.height <= arw[0].x) {
|
||||
arw[1].y = arw[3].y; // End of head
|
||||
arw[1].x = arw[0].x+arw[0].y; // Width of head (side 1)
|
||||
@ -287,15 +287,15 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
} else {
|
||||
arw[1].y = arw[0].y - arw[0].x;
|
||||
arw[1].x = arw[0].x << 1;
|
||||
arw[2].x = arw[0].x + arw[0].x/ARROWBODY_DIVIDER;
|
||||
arw[4].x = arw[0].x - arw[0].x/ARROWBODY_DIVIDER;
|
||||
arw[2].x = arw[0].x + arw[0].x/BTN_ARROWBODY_DIV;
|
||||
arw[4].x = arw[0].x - arw[0].x/BTN_ARROWBODY_DIV;
|
||||
arw[6].x = 0;
|
||||
}
|
||||
#else
|
||||
arw[1].y = arw[0].y - gw->g.height/ARROWHEAD_DIVIDER;
|
||||
arw[1].y = arw[0].y - gw->g.height/BTN_ARROWHEAD_DIV;
|
||||
arw[1].x = arw[0].x << 1;
|
||||
arw[2].x = arw[0].x + arw[0].x/ARROWBODY_DIVIDER;
|
||||
arw[4].x = arw[0].x - arw[0].x/ARROWBODY_DIVIDER;
|
||||
arw[2].x = arw[0].x + arw[0].x/BTN_ARROWBODY_DIV;
|
||||
arw[4].x = arw[0].x - arw[0].x/BTN_ARROWBODY_DIV;
|
||||
arw[6].x = 0;
|
||||
#endif
|
||||
|
||||
@ -321,13 +321,13 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
point arw[7];
|
||||
|
||||
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
|
||||
pcol = getDrawColors(gw);
|
||||
pcol = getButtonColors(gw);
|
||||
|
||||
// Create the arrow polygon
|
||||
arw[0].y = (gw->g.height-1)/2; // Point center
|
||||
arw[0].x = 0; // Arrow start
|
||||
arw[3].x = gw->g.width-1; // Arrow end
|
||||
#if ARROWHEAD_DIVIDER == 0
|
||||
#if BTN_ARROWHEAD_DIV == 0
|
||||
if (gw->g.width <= arw[0].y) {
|
||||
arw[1].x = arw[3].x; // End of head
|
||||
arw[1].y = arw[0].y+arw[3].x; // Width of head (side 1)
|
||||
@ -337,15 +337,15 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
} else {
|
||||
arw[1].x = arw[0].y;
|
||||
arw[1].y = arw[0].y << 1;
|
||||
arw[2].y = arw[0].y + arw[0].y/ARROWBODY_DIVIDER;
|
||||
arw[4].y = arw[0].y - arw[0].y/ARROWBODY_DIVIDER;
|
||||
arw[2].y = arw[0].y + arw[0].y/BTN_ARROWBODY_DIV;
|
||||
arw[4].y = arw[0].y - arw[0].y/BTN_ARROWBODY_DIV;
|
||||
arw[6].y = 0;
|
||||
}
|
||||
#else
|
||||
arw[1].x = gw->g.width/ARROWHEAD_DIVIDER;
|
||||
arw[1].x = gw->g.width/BTN_ARROWHEAD_DIV;
|
||||
arw[1].y = arw[0].y << 1;
|
||||
arw[2].y = arw[0].y + arw[0].y/ARROWBODY_DIVIDER;
|
||||
arw[4].y = arw[0].y - arw[0].y/ARROWBODY_DIVIDER;
|
||||
arw[2].y = arw[0].y + arw[0].y/BTN_ARROWBODY_DIV;
|
||||
arw[4].y = arw[0].y - arw[0].y/BTN_ARROWBODY_DIV;
|
||||
arw[6].y = 0;
|
||||
#endif
|
||||
|
||||
@ -371,13 +371,13 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
point arw[7];
|
||||
|
||||
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
|
||||
pcol = getDrawColors(gw);
|
||||
pcol = getButtonColors(gw);
|
||||
|
||||
// Create the arrow polygon
|
||||
arw[0].y = (gw->g.height-1)/2; // Point center
|
||||
arw[0].x = gw->g.width-1; // Arrow start
|
||||
arw[3].x = 0; // Arrow end
|
||||
#if ARROWHEAD_DIVIDER == 0
|
||||
#if BTN_ARROWHEAD_DIV == 0
|
||||
if (gw->g.width <= arw[0].y) {
|
||||
arw[1].x = arw[3].x; // End of head
|
||||
arw[1].y = arw[0].y+arw[0].x; // Width of head (side 1)
|
||||
@ -387,15 +387,15 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
} else {
|
||||
arw[1].x = arw[0].x - arw[0].y;
|
||||
arw[1].y = arw[0].y << 1;
|
||||
arw[2].y = arw[0].y + arw[0].y/ARROWBODY_DIVIDER;
|
||||
arw[4].y = arw[0].y - arw[0].y/ARROWBODY_DIVIDER;
|
||||
arw[2].y = arw[0].y + arw[0].y/BTN_ARROWBODY_DIV;
|
||||
arw[4].y = arw[0].y - arw[0].y/BTN_ARROWBODY_DIV;
|
||||
arw[6].y = 0;
|
||||
}
|
||||
#else
|
||||
arw[1].x = arw[0].x - gw->g.width/ARROWHEAD_DIVIDER;
|
||||
arw[1].x = arw[0].x - gw->g.width/BTN_ARROWHEAD_DIV;
|
||||
arw[1].y = arw[0].y << 1;
|
||||
arw[2].y = arw[0].y + arw[0].y/ARROWBODY_DIVIDER;
|
||||
arw[4].y = arw[0].y - arw[0].y/ARROWBODY_DIVIDER;
|
||||
arw[2].y = arw[0].y + arw[0].y/BTN_ARROWBODY_DIV;
|
||||
arw[4].y = arw[0].y - arw[0].y/BTN_ARROWBODY_DIV;
|
||||
arw[6].y = 0;
|
||||
#endif
|
||||
|
||||
@ -422,7 +422,7 @@ static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
coord_t sy;
|
||||
|
||||
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
|
||||
pcol = getDrawColors(gw);
|
||||
pcol = getButtonColors(gw);
|
||||
|
||||
if (!(gw->g.flags & GWIN_FLG_SYSENABLED)) {
|
||||
sy = 2 * gw->g.height;
|
||||
|
@ -17,8 +17,8 @@
|
||||
#include "gwin_class.h"
|
||||
|
||||
// Parameters for button custom draw
|
||||
#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
|
||||
#define CHK_TOP_FADE 50 // (CHK_TOP_FADE/255)% fade to white for top of button
|
||||
#define CHK_BOTTOM_FADE 25 // (CHK_BOTTOM_FADE/255)% fade to black for bottom of button
|
||||
|
||||
// Our checked state
|
||||
#define GCHECKBOX_FLG_CHECKED (GWIN_FIRST_CONTROL_FLAG<<0)
|
||||
@ -47,7 +47,7 @@ static void SendCheckboxEvent(GWidgetObject *gw) {
|
||||
}
|
||||
|
||||
#if GINPUT_NEED_MOUSE
|
||||
static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
static void CheckboxMouseDown(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
(void) x; (void) y;
|
||||
gw->g.flags ^= GCHECKBOX_FLG_CHECKED;
|
||||
_gwinUpdate((GHandle)gw);
|
||||
@ -56,19 +56,19 @@ static void SendCheckboxEvent(GWidgetObject *gw) {
|
||||
#endif
|
||||
|
||||
#if GINPUT_NEED_TOGGLE
|
||||
static void ToggleOn(GWidgetObject *gw, uint16_t role) {
|
||||
static void CheckboxToggleOn(GWidgetObject *gw, uint16_t role) {
|
||||
(void) role;
|
||||
gw->g.flags ^= GCHECKBOX_FLG_CHECKED;
|
||||
_gwinUpdate((GHandle)gw);
|
||||
SendCheckboxEvent(gw);
|
||||
}
|
||||
|
||||
static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) {
|
||||
static void CheckboxToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) {
|
||||
(void) role;
|
||||
((GCheckboxObject *)gw)->toggle = instance;
|
||||
}
|
||||
|
||||
static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) {
|
||||
static uint16_t CheckboxToggleGet(GWidgetObject *gw, uint16_t role) {
|
||||
(void) role;
|
||||
return ((GCheckboxObject *)gw)->toggle;
|
||||
}
|
||||
@ -86,7 +86,7 @@ static const gwidgetVMT checkboxVMT = {
|
||||
gwinCheckboxDraw_CheckOnLeft, // The default drawing routine
|
||||
#if GINPUT_NEED_MOUSE
|
||||
{
|
||||
MouseDown, // Process mouse down events
|
||||
CheckboxMouseDown, // Process mouse down events
|
||||
0, // Process mouse up events (NOT USED)
|
||||
0, // Process mouse move events (NOT USED)
|
||||
},
|
||||
@ -94,10 +94,10 @@ static const gwidgetVMT checkboxVMT = {
|
||||
#if GINPUT_NEED_TOGGLE
|
||||
{
|
||||
1, // 1 toggle role
|
||||
ToggleAssign, // Assign Toggles
|
||||
ToggleGet, // Get Toggles
|
||||
CheckboxToggleAssign, // Assign Toggles
|
||||
CheckboxToggleGet, // Get Toggles
|
||||
0, // Process toggle off events (NOT USED)
|
||||
ToggleOn, // Process toggle on events
|
||||
CheckboxToggleOn, // Process toggle on events
|
||||
},
|
||||
#endif
|
||||
#if GINPUT_NEED_DIAL
|
||||
@ -147,7 +147,7 @@ bool_t gwinCheckboxIsChecked(GHandle gh) {
|
||||
* Custom Draw Routines
|
||||
*----------------------------------------------------------*/
|
||||
|
||||
static const GColorSet *getDrawColors(GWidgetObject *gw) {
|
||||
static const GColorSet *getCheckboxColors(GWidgetObject *gw) {
|
||||
if (!(gw->g.flags & GWIN_FLG_SYSENABLED)) return &gw->pstyle->disabled;
|
||||
if ((gw->g.flags & GCHECKBOX_FLG_CHECKED)) return &gw->pstyle->pressed;
|
||||
return &gw->pstyle->enabled;
|
||||
@ -160,7 +160,7 @@ void gwinCheckboxDraw_CheckOnLeft(GWidgetObject *gw, void *param) {
|
||||
(void) param;
|
||||
|
||||
if (gw->g.vmt != (gwinVMT *)&checkboxVMT) return;
|
||||
pcol = getDrawColors(gw);
|
||||
pcol = getCheckboxColors(gw);
|
||||
|
||||
// Get the dimension of the check box (sans text)
|
||||
ld = gw->g.width < gw->g.height ? gw->g.width : gw->g.height;
|
||||
@ -186,7 +186,7 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) {
|
||||
(void) param;
|
||||
|
||||
if (gw->g.vmt != (gwinVMT *)&checkboxVMT) return;
|
||||
pcol = getDrawColors(gw);
|
||||
pcol = getCheckboxColors(gw);
|
||||
|
||||
// Get the dimension of the check box (sans text)
|
||||
ld = gw->g.width < gw->g.height ? gw->g.width : gw->g.height;
|
||||
@ -214,7 +214,7 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) {
|
||||
(void) param;
|
||||
|
||||
if (gw->g.vmt != (gwinVMT *)&checkboxVMT) return;
|
||||
pcol = getDrawColors(gw);
|
||||
pcol = getCheckboxColors(gw);
|
||||
|
||||
#if GWIN_NEED_FLASHING
|
||||
// Flash the on and off state.
|
||||
@ -235,7 +235,7 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) {
|
||||
(void) param;
|
||||
|
||||
if (gw->g.vmt != (gwinVMT *)&checkboxVMT) return;
|
||||
pcol = getDrawColors(gw);
|
||||
pcol = getCheckboxColors(gw);
|
||||
|
||||
#if GWIN_NEED_FLASHING
|
||||
// Flash the on and off state.
|
||||
@ -243,8 +243,8 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) {
|
||||
#endif
|
||||
|
||||
/* Fill the box blended from variants of the fill color */
|
||||
tcol = gdispBlendColor(White, pcol->fill, TOP_FADE);
|
||||
bcol = gdispBlendColor(Black, pcol->fill, BOTTOM_FADE);
|
||||
tcol = gdispBlendColor(White, pcol->fill, CHK_TOP_FADE);
|
||||
bcol = gdispBlendColor(Black, pcol->fill, CHK_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)));
|
||||
|
@ -611,7 +611,7 @@ void gwinPutCharArray(GHandle gh, const char *str, size_t n) {
|
||||
#define MAX_FILLER 11
|
||||
#define FLOAT_PRECISION 100000
|
||||
|
||||
static char *ltoa_wd(char *p, long num, unsigned radix, long divisor) {
|
||||
static char *consltoa_wd(char *p, long num, unsigned radix, long divisor) {
|
||||
int i;
|
||||
char *q;
|
||||
|
||||
@ -641,10 +641,10 @@ static char *ltoa_wd(char *p, long num, unsigned radix, long divisor) {
|
||||
unsigned long precision = FLOAT_PRECISION;
|
||||
|
||||
l = num;
|
||||
p = ltoa_wd(p, l, 10, 0);
|
||||
p = consltoa_wd(p, l, 10, 0);
|
||||
*p++ = '.';
|
||||
l = (num - l) * precision;
|
||||
return ltoa_wd(p, l, 10, precision / 10);
|
||||
return consltoa_wd(p, l, 10, precision / 10);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -746,7 +746,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) {
|
||||
*p++ = '-';
|
||||
l = -l;
|
||||
}
|
||||
p = ltoa_wd(p, l, 10, 0);
|
||||
p = consltoa_wd(p, l, 10, 0);
|
||||
break;
|
||||
#if GWIN_CONSOLE_USE_FLOAT
|
||||
case 'f':
|
||||
@ -774,7 +774,7 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) {
|
||||
l = va_arg(ap, long);
|
||||
else
|
||||
l = va_arg(ap, int);
|
||||
p = ltoa_wd(p, l, c, 0);
|
||||
p = consltoa_wd(p, l, c, 0);
|
||||
break;
|
||||
default:
|
||||
*p++ = c;
|
||||
|
@ -92,7 +92,7 @@ coord_t gwinGetInnerHeight(GHandle gh) {
|
||||
|
||||
#define BORDER_WIDTH 2
|
||||
|
||||
static coord_t BorderSize(GHandle gh) { return (gh->flags & GWIN_CONTAINER_BORDER) ? BORDER_WIDTH : 0; }
|
||||
static coord_t ContainerBorderSize(GHandle gh) { return (gh->flags & GWIN_CONTAINER_BORDER) ? BORDER_WIDTH : 0; }
|
||||
|
||||
// The container VMT table
|
||||
static const gcontainerVMT containerVMT = {
|
||||
@ -121,10 +121,10 @@ static const gcontainerVMT containerVMT = {
|
||||
},
|
||||
#endif
|
||||
},
|
||||
BorderSize, // The size of the left border (mandatory)
|
||||
BorderSize, // The size of the top border (mandatory)
|
||||
BorderSize, // The size of the right border (mandatory)
|
||||
BorderSize, // The size of the bottom border (mandatory)
|
||||
ContainerBorderSize, // The size of the left border (mandatory)
|
||||
ContainerBorderSize, // The size of the top border (mandatory)
|
||||
ContainerBorderSize, // The size of the right border (mandatory)
|
||||
ContainerBorderSize, // The size of the bottom border (mandatory)
|
||||
0, // A child has been added (optional)
|
||||
0, // A child has been deleted (optional)
|
||||
};
|
||||
|
@ -17,15 +17,15 @@
|
||||
#include "gwin_class.h"
|
||||
|
||||
/* Some position values */
|
||||
#define BUTTON_X 18 // Button Width
|
||||
#define BUTTON_Y 18 // Button Height
|
||||
#define BUTTON_I 3 // Button inner margin
|
||||
#define BUTTON_T 2 // Gap from top of window to button
|
||||
#define BUTTON_B 2 // Gap from button to the bottom of the frame title area
|
||||
#define BORDER_L 2 // Left Border
|
||||
#define BORDER_R 2 // Right Border
|
||||
#define BORDER_T (BUTTON_Y+BUTTON_T+BUTTON_B) // Top Border (Title area)
|
||||
#define BORDER_B 2 // Bottom Border
|
||||
#define FRM_BUTTON_X 18 // Button Width
|
||||
#define FRM_BUTTON_Y 18 // Button Height
|
||||
#define FRM_BUTTON_I 3 // Button inner margin
|
||||
#define FRM_BUTTON_T 2 // Gap from top of window to button
|
||||
#define FRM_BUTTON_B 2 // Gap from button to the bottom of the frame title area
|
||||
#define FRM_BORDER_L 2 // Left Border
|
||||
#define FRM_BORDER_R 2 // Right Border
|
||||
#define FRM_BORDER_T (FRM_BUTTON_Y+FRM_BUTTON_T+FRM_BUTTON_B) // Top Border (Title area)
|
||||
#define FRM_BORDER_B 2 // Bottom Border
|
||||
|
||||
/* Internal state flags */
|
||||
#define GWIN_FRAME_USER_FLAGS (GWIN_FRAME_CLOSE_BTN|GWIN_FRAME_MINMAX_BTN)
|
||||
@ -40,10 +40,10 @@
|
||||
#error "GWIN Frame: - Flag definitions don't match"
|
||||
#endif
|
||||
|
||||
static coord_t BorderSizeL(GHandle gh) { (void)gh; return BORDER_L; }
|
||||
static coord_t BorderSizeR(GHandle gh) { (void)gh; return BORDER_R; }
|
||||
static coord_t BorderSizeT(GHandle gh) { (void)gh; return BORDER_T; }
|
||||
static coord_t BorderSizeB(GHandle gh) { (void)gh; return BORDER_B; }
|
||||
static coord_t FrameBorderSizeL(GHandle gh) { (void)gh; return FRM_BORDER_L; }
|
||||
static coord_t FrameBorderSizeR(GHandle gh) { (void)gh; return FRM_BORDER_R; }
|
||||
static coord_t FrameBorderSizeT(GHandle gh) { (void)gh; return FRM_BORDER_T; }
|
||||
static coord_t FrameBorderSizeB(GHandle gh) { (void)gh; return FRM_BORDER_B; }
|
||||
|
||||
static void forceFrameRedraw(GWidgetObject *gw) {
|
||||
// Force a redraw of just the frame.
|
||||
@ -54,42 +54,42 @@ static void forceFrameRedraw(GWidgetObject *gw) {
|
||||
}
|
||||
|
||||
#if GINPUT_NEED_MOUSE
|
||||
static void mouseDown(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
static void FrameMouseDown(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
coord_t pos;
|
||||
|
||||
// We must be clicking on the frame button area to be of interest
|
||||
if (y < BUTTON_T || y >= BUTTON_T+BUTTON_Y)
|
||||
if (y < FRM_BUTTON_T || y >= FRM_BUTTON_T+FRM_BUTTON_Y)
|
||||
return;
|
||||
|
||||
pos = gw->g.width - (BORDER_R+BUTTON_X);
|
||||
pos = gw->g.width - (FRM_BORDER_R+FRM_BUTTON_X);
|
||||
if ((gw->g.flags & GWIN_FRAME_CLOSE_BTN)) {
|
||||
if (x >= pos && x < pos+BUTTON_X) {
|
||||
if (x >= pos && x < pos+FRM_BUTTON_X) {
|
||||
// Close is pressed - force redraw the frame only
|
||||
gw->g.flags |= GWIN_FRAME_CLOSE_PRESSED;
|
||||
forceFrameRedraw(gw);
|
||||
return;
|
||||
}
|
||||
pos -= BUTTON_X;
|
||||
pos -= FRM_BUTTON_X;
|
||||
}
|
||||
if ((gw->g.flags & GWIN_FRAME_MINMAX_BTN)) {
|
||||
if (x >= pos && x < pos+BUTTON_X) {
|
||||
if (x >= pos && x < pos+FRM_BUTTON_X) {
|
||||
// Close is pressed - force redraw the frame only
|
||||
gw->g.flags |= GWIN_FRAME_MAX_PRESSED;
|
||||
forceFrameRedraw(gw);
|
||||
return;
|
||||
}
|
||||
pos -= BUTTON_X;
|
||||
if (x >= pos && x < pos+BUTTON_X) {
|
||||
pos -= FRM_BUTTON_X;
|
||||
if (x >= pos && x < pos+FRM_BUTTON_X) {
|
||||
// Close is pressed - force redraw the frame only
|
||||
gw->g.flags |= GWIN_FRAME_MIN_PRESSED;
|
||||
forceFrameRedraw(gw);
|
||||
return;
|
||||
}
|
||||
pos -= BUTTON_X;
|
||||
pos -= FRM_BUTTON_X;
|
||||
}
|
||||
}
|
||||
|
||||
static void mouseUp(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
static void FrameMouseUp(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
#if GWIN_BUTTON_LAZY_RELEASE
|
||||
if ((gw->g.flags & GWIN_FRAME_CLOSE_PRESSED)) {
|
||||
// Close is released - destroy the window
|
||||
@ -119,12 +119,12 @@ static void forceFrameRedraw(GWidgetObject *gw) {
|
||||
return;
|
||||
|
||||
// We must be releasing over the button
|
||||
if (y >= BUTTON_T && y < BUTTON_T+BUTTON_Y) {
|
||||
if (y >= FRM_BUTTON_T && y < FRM_BUTTON_T+FRM_BUTTON_Y) {
|
||||
coord_t pos;
|
||||
|
||||
pos = gw->g.width - (BORDER_R+BUTTON_X);
|
||||
pos = gw->g.width - (FRM_BORDER_R+FRM_BUTTON_X);
|
||||
if ((gw->g.flags & GWIN_FRAME_CLOSE_BTN)) {
|
||||
if ((gw->g.flags & GWIN_FRAME_CLOSE_PRESSED) && x >= pos && x <= pos+BUTTON_X) {
|
||||
if ((gw->g.flags & GWIN_FRAME_CLOSE_PRESSED) && x >= pos && x <= pos+FRM_BUTTON_X) {
|
||||
// Close is released - destroy the window. This is tricky as we already have the drawing lock.
|
||||
gw->g.flags &= ~(GWIN_FRAME_CLOSE_PRESSED|GWIN_FRAME_MAX_PRESSED|GWIN_FRAME_MIN_PRESSED);
|
||||
forceFrameRedraw(gw);
|
||||
@ -132,25 +132,25 @@ static void forceFrameRedraw(GWidgetObject *gw) {
|
||||
_gwinDestroy(&gw->g, REDRAW_INSESSION);
|
||||
return;
|
||||
}
|
||||
pos -= BUTTON_X;
|
||||
pos -= FRM_BUTTON_X;
|
||||
}
|
||||
if ((gw->g.flags & GWIN_FRAME_MINMAX_BTN)) {
|
||||
if ((gw->g.flags & GWIN_FRAME_MAX_PRESSED) && x >= pos && x <= pos+BUTTON_X) {
|
||||
if ((gw->g.flags & GWIN_FRAME_MAX_PRESSED) && x >= pos && x <= pos+FRM_BUTTON_X) {
|
||||
// Max is released - maximize the window
|
||||
gw->g.flags &= ~(GWIN_FRAME_CLOSE_PRESSED|GWIN_FRAME_MAX_PRESSED|GWIN_FRAME_MIN_PRESSED);
|
||||
forceFrameRedraw(gw);
|
||||
gwinSetMinMax(&gw->g, GWIN_MAXIMIZE);
|
||||
return;
|
||||
}
|
||||
pos -= BUTTON_X;
|
||||
if ((gw->g.flags & GWIN_FRAME_MIN_PRESSED) && x >= pos && x <= pos+BUTTON_X) {
|
||||
pos -= FRM_BUTTON_X;
|
||||
if ((gw->g.flags & GWIN_FRAME_MIN_PRESSED) && x >= pos && x <= pos+FRM_BUTTON_X) {
|
||||
// Min is released - minimize the window
|
||||
gw->g.flags &= ~(GWIN_FRAME_CLOSE_PRESSED|GWIN_FRAME_MAX_PRESSED|GWIN_FRAME_MIN_PRESSED);
|
||||
forceFrameRedraw(gw);
|
||||
gwinSetMinMax(&gw->g, GWIN_MINIMIZE);
|
||||
return;
|
||||
}
|
||||
pos -= BUTTON_X;
|
||||
pos -= FRM_BUTTON_X;
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,8 +173,8 @@ static const gcontainerVMT frameVMT = {
|
||||
gwinFrameDraw_Std, // The default drawing routine
|
||||
#if GINPUT_NEED_MOUSE
|
||||
{
|
||||
mouseDown, // Process mouse down event
|
||||
mouseUp, // Process mouse up events
|
||||
FrameMouseDown, // Process mouse down event
|
||||
FrameMouseUp, // Process mouse up events
|
||||
0, // Process mouse move events
|
||||
},
|
||||
#endif
|
||||
@ -196,10 +196,10 @@ static const gcontainerVMT frameVMT = {
|
||||
},
|
||||
#endif
|
||||
},
|
||||
BorderSizeL, // The size of the left border (mandatory)
|
||||
BorderSizeT, // The size of the top border (mandatory)
|
||||
BorderSizeR, // The size of the right border (mandatory)
|
||||
BorderSizeB, // The size of the bottom border (mandatory)
|
||||
FrameBorderSizeL, // The size of the left border (mandatory)
|
||||
FrameBorderSizeT, // The size of the top border (mandatory)
|
||||
FrameBorderSizeR, // The size of the right border (mandatory)
|
||||
FrameBorderSizeB, // The size of the bottom border (mandatory)
|
||||
0, // A child has been added (optional)
|
||||
0, // A child has been deleted (optional)
|
||||
};
|
||||
@ -238,34 +238,34 @@ void gwinFrameDraw_Transparent(GWidgetObject *gw, void *param) {
|
||||
btn = gdispBlendColor(pcol->edge, contrast, 128);
|
||||
|
||||
// Render the frame
|
||||
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, BORDER_T, gw->text, gw->g.font, contrast, pcol->edge, justifyCenter);
|
||||
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y+BORDER_T, BORDER_L, gw->g.height-(BORDER_T+BORDER_B), pcol->edge);
|
||||
gdispGFillArea(gw->g.display, gw->g.x+gw->g.width-BORDER_R, gw->g.y+BORDER_T, BORDER_R, gw->g.height-(BORDER_T+BORDER_B), pcol->edge);
|
||||
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y+gw->g.height-BORDER_B, gw->g.width, BORDER_B, pcol->edge);
|
||||
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, FRM_BORDER_T, gw->text, gw->g.font, contrast, pcol->edge, justifyCenter);
|
||||
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y+FRM_BORDER_T, FRM_BORDER_L, gw->g.height-(FRM_BORDER_T+FRM_BORDER_B), pcol->edge);
|
||||
gdispGFillArea(gw->g.display, gw->g.x+gw->g.width-FRM_BORDER_R, gw->g.y+FRM_BORDER_T, FRM_BORDER_R, gw->g.height-(FRM_BORDER_T+FRM_BORDER_B), pcol->edge);
|
||||
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y+gw->g.height-FRM_BORDER_B, gw->g.width, FRM_BORDER_B, pcol->edge);
|
||||
|
||||
// Add the buttons
|
||||
pos = gw->g.x+gw->g.width - (BORDER_R+BUTTON_X);
|
||||
pos = gw->g.x+gw->g.width - (FRM_BORDER_R+FRM_BUTTON_X);
|
||||
|
||||
if ((gw->g.flags & GWIN_FRAME_CLOSE_BTN)) {
|
||||
if ((gw->g.flags & GWIN_FRAME_CLOSE_PRESSED))
|
||||
gdispFillArea(pos, gw->g.y+BUTTON_T, BUTTON_X, BUTTON_Y, btn);
|
||||
gdispDrawLine(pos+BUTTON_I, gw->g.y+(BUTTON_T+BUTTON_I), pos+(BUTTON_X-BUTTON_I-1), gw->g.y+(BUTTON_T+BUTTON_Y-BUTTON_I-1), contrast);
|
||||
gdispDrawLine(pos+(BUTTON_X-BUTTON_I-1), gw->g.y+(BUTTON_T+BUTTON_I), pos+BUTTON_I, gw->g.y+(BUTTON_T+BUTTON_Y-BUTTON_I-1), contrast);
|
||||
pos -= BUTTON_X;
|
||||
gdispFillArea(pos, gw->g.y+FRM_BUTTON_T, FRM_BUTTON_X, FRM_BUTTON_Y, btn);
|
||||
gdispDrawLine(pos+FRM_BUTTON_I, gw->g.y+(FRM_BUTTON_T+FRM_BUTTON_I), pos+(FRM_BUTTON_X-FRM_BUTTON_I-1), gw->g.y+(FRM_BUTTON_T+FRM_BUTTON_Y-FRM_BUTTON_I-1), contrast);
|
||||
gdispDrawLine(pos+(FRM_BUTTON_X-FRM_BUTTON_I-1), gw->g.y+(FRM_BUTTON_T+FRM_BUTTON_I), pos+FRM_BUTTON_I, gw->g.y+(FRM_BUTTON_T+FRM_BUTTON_Y-FRM_BUTTON_I-1), contrast);
|
||||
pos -= FRM_BUTTON_X;
|
||||
}
|
||||
|
||||
if ((gw->g.flags & GWIN_FRAME_MINMAX_BTN)) {
|
||||
if ((gw->g.flags & GWIN_FRAME_MAX_PRESSED))
|
||||
gdispFillArea(pos, gw->g.y+BUTTON_T, BUTTON_X, BUTTON_Y, btn);
|
||||
gdispFillArea(pos, gw->g.y+FRM_BUTTON_T, FRM_BUTTON_X, FRM_BUTTON_Y, btn);
|
||||
// the symbol
|
||||
gdispDrawBox(pos+BUTTON_I, gw->g.y+(BUTTON_T+BUTTON_I), BUTTON_X-2*BUTTON_I, BUTTON_Y-2*BUTTON_I, contrast);
|
||||
gdispDrawLine(pos+(BUTTON_I+1), gw->g.y+(BUTTON_T+BUTTON_I+1), pos+(BUTTON_X-BUTTON_I-2), gw->g.y+(BUTTON_T+BUTTON_I+1), contrast);
|
||||
gdispDrawLine(pos+(BUTTON_I+1), gw->g.y+(BUTTON_T+BUTTON_I+2), pos+(BUTTON_X-BUTTON_I-2), gw->g.y+(BUTTON_T+BUTTON_I+2), contrast);
|
||||
pos -= BUTTON_X;
|
||||
gdispDrawBox(pos+FRM_BUTTON_I, gw->g.y+(FRM_BUTTON_T+FRM_BUTTON_I), FRM_BUTTON_X-2*FRM_BUTTON_I, FRM_BUTTON_Y-2*FRM_BUTTON_I, contrast);
|
||||
gdispDrawLine(pos+(FRM_BUTTON_I+1), gw->g.y+(FRM_BUTTON_T+FRM_BUTTON_I+1), pos+(FRM_BUTTON_X-FRM_BUTTON_I-2), gw->g.y+(FRM_BUTTON_T+FRM_BUTTON_I+1), contrast);
|
||||
gdispDrawLine(pos+(FRM_BUTTON_I+1), gw->g.y+(FRM_BUTTON_T+FRM_BUTTON_I+2), pos+(FRM_BUTTON_X-FRM_BUTTON_I-2), gw->g.y+(FRM_BUTTON_T+FRM_BUTTON_I+2), contrast);
|
||||
pos -= FRM_BUTTON_X;
|
||||
if ((gw->g.flags & GWIN_FRAME_MIN_PRESSED))
|
||||
gdispFillArea(pos, gw->g.y+BUTTON_T, BUTTON_X, BUTTON_Y, btn);
|
||||
gdispDrawLine(pos+BUTTON_I, gw->g.y+(BUTTON_T+BUTTON_Y-BUTTON_I-1), pos+(BUTTON_X-BUTTON_I-1), gw->g.y+(BUTTON_T+BUTTON_Y-BUTTON_I-1), contrast);
|
||||
pos -= BUTTON_X;
|
||||
gdispFillArea(pos, gw->g.y+FRM_BUTTON_T, FRM_BUTTON_X, FRM_BUTTON_Y, btn);
|
||||
gdispDrawLine(pos+FRM_BUTTON_I, gw->g.y+(FRM_BUTTON_T+FRM_BUTTON_Y-FRM_BUTTON_I-1), pos+(FRM_BUTTON_X-FRM_BUTTON_I-1), gw->g.y+(FRM_BUTTON_T+FRM_BUTTON_Y-FRM_BUTTON_I-1), contrast);
|
||||
pos -= FRM_BUTTON_X;
|
||||
}
|
||||
|
||||
// Don't touch the client area
|
||||
@ -285,7 +285,7 @@ void gwinFrameDraw_Std(GWidgetObject *gw, void *param) {
|
||||
return;
|
||||
|
||||
// Draw the client area
|
||||
gdispGFillArea(gw->g.display, gw->g.x + BORDER_L, gw->g.y + BORDER_T, gw->g.width - (BORDER_L+BORDER_R), gw->g.height - (BORDER_T+BORDER_B), gw->pstyle->background);
|
||||
gdispGFillArea(gw->g.display, gw->g.x + FRM_BORDER_L, gw->g.y + FRM_BORDER_T, gw->g.width - (FRM_BORDER_L+FRM_BORDER_R), gw->g.height - (FRM_BORDER_T+FRM_BORDER_B), gw->pstyle->background);
|
||||
}
|
||||
|
||||
#if GDISP_NEED_IMAGE
|
||||
@ -304,12 +304,12 @@ void gwinFrameDraw_Std(GWidgetObject *gw, void *param) {
|
||||
return;
|
||||
|
||||
// Draw the client area by tiling the image
|
||||
mx = gw->g.x+gw->g.width - BORDER_R;
|
||||
my = gw->g.y+gw->g.height - BORDER_B;
|
||||
for(y = gw->g.y+BORDER_T, ih = gi->height; y < my; y += ih) {
|
||||
mx = gw->g.x+gw->g.width - FRM_BORDER_R;
|
||||
my = gw->g.y+gw->g.height - FRM_BORDER_B;
|
||||
for(y = gw->g.y+FRM_BORDER_T, ih = gi->height; y < my; y += ih) {
|
||||
if (ih > my - y)
|
||||
ih = my - y;
|
||||
for(x = gw->g.x+BORDER_L, iw = gi->width; x < mx; x += iw) {
|
||||
for(x = gw->g.x+FRM_BORDER_L, iw = gi->width; x < mx; x += iw) {
|
||||
if (iw > mx - x)
|
||||
iw = mx - x;
|
||||
gdispGImageDraw(gw->g.display, gi, x, y, iw, ih, 0, 0);
|
||||
|
@ -16,20 +16,20 @@
|
||||
|
||||
#include "gwin_class.h"
|
||||
|
||||
#define widget(gh) ((GImageObject *)gh)
|
||||
#define gw ((GImageObject *)gh)
|
||||
|
||||
static void _destroy(GWindowObject *gh) {
|
||||
if (gdispImageIsOpen(&widget(gh)->image))
|
||||
gdispImageClose(&widget(gh)->image);
|
||||
static void ImageDestroy(GWindowObject *gh) {
|
||||
if (gdispImageIsOpen(&gw->image))
|
||||
gdispImageClose(&gw->image);
|
||||
}
|
||||
|
||||
#if GWIN_NEED_IMAGE_ANIMATION
|
||||
static void _timer(void *param) {
|
||||
static void ImageTimer(void *param) {
|
||||
_gwinUpdate((GHandle)param);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void _redraw(GHandle gh) {
|
||||
static void ImageRedraw(GHandle gh) {
|
||||
coord_t x, y, w, h, dx, dy;
|
||||
color_t bg;
|
||||
#if GWIN_NEED_IMAGE_ANIMATION
|
||||
@ -46,14 +46,14 @@ static void _redraw(GHandle gh) {
|
||||
bg = gwinGetDefaultBgColor();
|
||||
|
||||
// If the image isn't open just clear the area
|
||||
if (!gdispImageIsOpen(&widget(gh)->image)) {
|
||||
if (!gdispImageIsOpen(&gw->image)) {
|
||||
gdispGFillArea(gh->display, x, y, w, h, bg);
|
||||
return;
|
||||
}
|
||||
|
||||
// Center horizontally if the area is larger than the image
|
||||
if (widget(gh)->image.width < w) {
|
||||
w = widget(gh)->image.width;
|
||||
if (gw->image.width < w) {
|
||||
w = gw->image.width;
|
||||
dx = (gh->width-w)/2;
|
||||
x += dx;
|
||||
if (dx)
|
||||
@ -63,13 +63,13 @@ static void _redraw(GHandle gh) {
|
||||
}
|
||||
|
||||
// Center image horizontally if the area is smaller than the image
|
||||
else if (widget(gh)->image.width > w) {
|
||||
dx = (widget(gh)->image.width - w)/2;
|
||||
else if (gw->image.width > w) {
|
||||
dx = (gw->image.width - w)/2;
|
||||
}
|
||||
|
||||
// Center vertically if the area is larger than the image
|
||||
if (widget(gh)->image.height < h) {
|
||||
h = widget(gh)->image.height;
|
||||
if (gw->image.height < h) {
|
||||
h = gw->image.height;
|
||||
dy = (gh->height-h)/2;
|
||||
y += dy;
|
||||
if (dy)
|
||||
@ -79,19 +79,19 @@ static void _redraw(GHandle gh) {
|
||||
}
|
||||
|
||||
// Center image vertically if the area is smaller than the image
|
||||
else if (widget(gh)->image.height > h) {
|
||||
dy = (widget(gh)->image.height - h)/2;
|
||||
else if (gw->image.height > h) {
|
||||
dy = (gw->image.height - h)/2;
|
||||
}
|
||||
|
||||
// Reset the background color in case it has changed
|
||||
gdispImageSetBgColor(&widget(gh)->image, bg);
|
||||
gdispImageSetBgColor(&gw->image, bg);
|
||||
|
||||
// Display the image
|
||||
gdispGImageDraw(gh->display, &widget(gh)->image, x, y, w, h, dx, dy);
|
||||
gdispGImageDraw(gh->display, &gw->image, x, y, w, h, dx, dy);
|
||||
|
||||
#if GWIN_NEED_IMAGE_ANIMATION
|
||||
// read the delay for the next frame
|
||||
delay = gdispImageNext(&widget((GHandle)gh)->image);
|
||||
delay = gdispImageNext(&gw->image);
|
||||
|
||||
// Wait for that delay if required
|
||||
switch(delay) {
|
||||
@ -104,7 +104,7 @@ static void _redraw(GHandle gh) {
|
||||
// Fall through
|
||||
default:
|
||||
// Start the timer to draw the next frame of the animation
|
||||
gtimerStart(&widget((GHandle)gh)->timer, _timer, (void*)gh, FALSE, delay);
|
||||
gtimerStart(&gw->timer, ImageTimer, (void*)gh, FALSE, delay);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
@ -113,8 +113,8 @@ static void _redraw(GHandle gh) {
|
||||
static const gwinVMT imageVMT = {
|
||||
"Image", // The class name
|
||||
sizeof(GImageObject), // The object size
|
||||
_destroy, // The destroy routine
|
||||
_redraw, // The redraw routine
|
||||
ImageDestroy, // The destroy routine
|
||||
ImageRedraw, // The redraw routine
|
||||
0, // The after-clear routine
|
||||
};
|
||||
|
||||
@ -140,10 +140,10 @@ bool_t gwinImageOpenGFile(GHandle gh, GFILE *f) {
|
||||
if (gh->vmt != (gwinVMT *)&imageVMT)
|
||||
return FALSE;
|
||||
|
||||
if (gdispImageIsOpen(&widget(gh)->image))
|
||||
gdispImageClose(&widget(gh)->image);
|
||||
if (gdispImageIsOpen(&gw->image))
|
||||
gdispImageClose(&gw->image);
|
||||
|
||||
if ((gdispImageOpenGFile(&widget(gh)->image, f) & GDISP_IMAGE_ERR_UNRECOVERABLE))
|
||||
if ((gdispImageOpenGFile(&gw->image, f) & GDISP_IMAGE_ERR_UNRECOVERABLE))
|
||||
return FALSE;
|
||||
|
||||
_gwinUpdate(gh);
|
||||
@ -156,7 +156,8 @@ gdispImageError gwinImageCache(GHandle gh) {
|
||||
if (gh->vmt != (gwinVMT *)&imageVMT)
|
||||
return GDISP_IMAGE_ERR_BADFORMAT;
|
||||
|
||||
return gdispImageCache(&widget(gh)->image);
|
||||
return gdispImageCache(&gw->image);
|
||||
}
|
||||
|
||||
#undef gw
|
||||
#endif // GFX_USE_GWIN && GWIN_NEED_IMAGE
|
||||
|
@ -21,7 +21,7 @@
|
||||
#define GKEYBOARD_FLG_REVERTSET (GWIN_FIRST_CONTROL_FLAG<<0)
|
||||
#define GKEYBOARD_FLG_QUICKUPDATE (GWIN_FIRST_CONTROL_FLAG<<1)
|
||||
|
||||
#define BAD_ROWCOL 255
|
||||
#define GKEY_BAD_ROWCOL 255
|
||||
|
||||
typedef uint8_t utf8;
|
||||
typedef uint16_t utf16;
|
||||
@ -173,13 +173,13 @@ static void SendKeyboardEvent(GKeyboardObject *gk) {
|
||||
|
||||
#if GINPUT_NEED_MOUSE
|
||||
// Find the key from the keyset and the x, y position
|
||||
static void FindKey(GKeyboardObject *gk, coord_t x, coord_t y) {
|
||||
static void KeyFindKey(GKeyboardObject *gk, coord_t x, coord_t y) {
|
||||
const utf8 *krow;
|
||||
fixed f;
|
||||
int idx;
|
||||
|
||||
if (x < 0 || y < 0 || x >= gk->w.g.width || y >= gk->w.g.height) {
|
||||
gk->keyrow = gk->keycol = BAD_ROWCOL;
|
||||
gk->keyrow = gk->keycol = GKEY_BAD_ROWCOL;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -209,14 +209,14 @@ static void SendKeyboardEvent(GKeyboardObject *gk) {
|
||||
}
|
||||
|
||||
// A mouse up has occurred (it may or may not be over the button)
|
||||
static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
static void KeyMouseUp(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
#define gk ((GKeyboardObject *)gw)
|
||||
|
||||
FindKey(gk, x, y);
|
||||
KeyFindKey(gk, x, y);
|
||||
|
||||
// Do we have a valid key?
|
||||
if (gk->keyrow == BAD_ROWCOL) {
|
||||
if (gk->lastkeyrow != BAD_ROWCOL) {
|
||||
if (gk->keyrow == GKEY_BAD_ROWCOL) {
|
||||
if (gk->lastkeyrow != GKEY_BAD_ROWCOL) {
|
||||
gw->g.flags |= GKEYBOARD_FLG_QUICKUPDATE;
|
||||
_gwinUpdate((GHandle)gw);
|
||||
}
|
||||
@ -224,7 +224,7 @@ static void SendKeyboardEvent(GKeyboardObject *gk) {
|
||||
}
|
||||
|
||||
// We are turning off the display of the key
|
||||
gk->keyrow = gk->keycol = BAD_ROWCOL;
|
||||
gk->keyrow = gk->keycol = GKEY_BAD_ROWCOL;
|
||||
|
||||
// Is this one of the special keys
|
||||
if (gk->key < 0x20) {
|
||||
@ -280,10 +280,10 @@ static void SendKeyboardEvent(GKeyboardObject *gk) {
|
||||
}
|
||||
|
||||
// A mouse move has occurred (it may or may not be over the button)
|
||||
static void MouseMove(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
static void KeyMouseMove(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
#define gk ((GKeyboardObject *)gw)
|
||||
|
||||
FindKey(gk, x, y);
|
||||
KeyFindKey(gk, x, y);
|
||||
|
||||
if (gk->keyrow != gk->lastkeyrow || gk->keycol != gk->lastkeycol) {
|
||||
gk->w.g.flags |= GKEYBOARD_FLG_QUICKUPDATE;
|
||||
@ -308,9 +308,9 @@ static const gwidgetVMT keyboardVMT = {
|
||||
gwinKeyboardDraw_Normal, // The default drawing routine
|
||||
#if GINPUT_NEED_MOUSE
|
||||
{
|
||||
MouseMove, // Process mouse down events
|
||||
MouseUp, // Process mouse up events
|
||||
MouseMove, // Process mouse move events
|
||||
KeyMouseMove, // Process mouse down events
|
||||
KeyMouseUp, // Process mouse up events
|
||||
KeyMouseMove, // Process mouse move events
|
||||
},
|
||||
#endif
|
||||
#if GINPUT_NEED_TOGGLE
|
||||
@ -338,7 +338,7 @@ GHandle gwinGKeyboardCreate(GDisplay *g, GKeyboardObject *gk, const GWidgetInit
|
||||
|
||||
gk->keytable = &GWIN_KEYBOARD_DEFAULT_LAYOUT;
|
||||
gk->keyset = gk->keytable->ksets[0];
|
||||
gk->lastkeyrow = gk->lastkeycol = gk->keyrow = gk->keycol = BAD_ROWCOL;
|
||||
gk->lastkeyrow = gk->lastkeycol = gk->keyrow = gk->keycol = GKEY_BAD_ROWCOL;
|
||||
gwinSetVisible((GHandle)gk, pInit->g.show);
|
||||
return (GHandle)gk;
|
||||
}
|
||||
@ -359,7 +359,7 @@ void gwinKeyboardSetLayout(GHandle gh, struct GVKeyTable *layout) {
|
||||
layout = &GWIN_KEYBOARD_DEFAULT_LAYOUT;
|
||||
gk->keytable = layout;
|
||||
gk->keyset = gk->keytable->ksets[0];
|
||||
gk->lastkeyrow = gk->lastkeycol = gk->keyrow = gk->keycol = BAD_ROWCOL;
|
||||
gk->lastkeyrow = gk->lastkeycol = gk->keyrow = gk->keycol = GKEY_BAD_ROWCOL;
|
||||
gk->w.g.flags &= ~(GKEYBOARD_FLG_QUICKUPDATE|GKEYBOARD_FLG_REVERTSET);
|
||||
gwinRedraw(gh);
|
||||
#undef gk
|
||||
|
@ -173,4 +173,6 @@ static void gwinLabelDefaultDraw(GWidgetObject *gw, void *param) {
|
||||
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, w, h, (gw->g.flags & GWIN_FLG_SYSENABLED) ? gw->pstyle->enabled.edge : gw->pstyle->disabled.edge);
|
||||
}
|
||||
|
||||
#undef gh2obj
|
||||
#undef gw2obj
|
||||
#endif // GFX_USE_GWIN && GFX_NEED_LABEL
|
||||
|
@ -19,10 +19,10 @@
|
||||
#include <stdlib.h>
|
||||
|
||||
// user for the default drawing routine
|
||||
#define SCROLLWIDTH 16 // the border from the scroll buttons to the frame
|
||||
#define ARROW 10 // arrow side length
|
||||
#define HORIZONTAL_PADDING 5 // extra horizontal padding for text
|
||||
#define VERTICAL_PADDING 2 // extra vertical padding for text
|
||||
#define LST_SCROLLWIDTH 16 // the border from the scroll buttons to the frame
|
||||
#define LST_ARROW_SZ 10 // arrow side length
|
||||
#define LST_HORIZ_PAD 5 // extra horizontal padding for text
|
||||
#define LST_VERT_PAD 2 // extra vertical padding for text
|
||||
|
||||
// Macro's to assist in data type conversions
|
||||
#define gh2obj ((GListObject *)gh)
|
||||
@ -77,13 +77,13 @@ static void sendListEvent(GWidgetObject *gw, int item) {
|
||||
static void gwinListDefaultDraw(GWidgetObject* gw, void* param);
|
||||
|
||||
#if GINPUT_NEED_MOUSE
|
||||
static void MouseSelect(GWidgetObject* gw, coord_t x, coord_t y) {
|
||||
static void ListMouseSelect(GWidgetObject* gw, coord_t x, coord_t y) {
|
||||
const gfxQueueASyncItem* qi;
|
||||
int item, i;
|
||||
coord_t iheight;
|
||||
(void) x;
|
||||
|
||||
iheight = gdispGetFontMetric(gw->g.font, fontHeight) + VERTICAL_PADDING;
|
||||
iheight = gdispGetFontMetric(gw->g.font, fontHeight) + LST_VERT_PAD;
|
||||
|
||||
// Handle click over the list area
|
||||
item = (gw2obj->top + y) / iheight;
|
||||
@ -111,7 +111,7 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param);
|
||||
}
|
||||
|
||||
// a mouse down has occurred over the list area
|
||||
static void MouseDown(GWidgetObject* gw, coord_t x, coord_t y) {
|
||||
static void ListMouseDown(GWidgetObject* gw, coord_t x, coord_t y) {
|
||||
coord_t iheight, pgsz;
|
||||
|
||||
// Save our mouse start position
|
||||
@ -119,24 +119,24 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param);
|
||||
gw2obj->start_mouse_y = y;
|
||||
gw2obj->last_mouse_y = y;
|
||||
|
||||
// For smooth scrolling, scrolling is done in the MouseMove and selection is done on MouseUp
|
||||
// For smooth scrolling, scrolling is done in the ListMouseMove and selection is done on ListMouseUp
|
||||
if (gw->g.flags & GLIST_FLG_SCROLLSMOOTH)
|
||||
return;
|
||||
|
||||
// Some initial stuff
|
||||
iheight = gdispGetFontMetric(gw->g.font, fontHeight) + VERTICAL_PADDING;
|
||||
iheight = gdispGetFontMetric(gw->g.font, fontHeight) + LST_VERT_PAD;
|
||||
pgsz = gw->g.height-2;
|
||||
|
||||
// Handle click over the scroll bar
|
||||
if (x >= gw->g.width-(SCROLLWIDTH+2) && (gw2obj->cnt > pgsz/iheight || (gw->g.flags & GLIST_FLG_SCROLLALWAYS))) {
|
||||
if (y < 2*ARROW) {
|
||||
if (x >= gw->g.width-(LST_SCROLLWIDTH+2) && (gw2obj->cnt > pgsz/iheight || (gw->g.flags & GLIST_FLG_SCROLLALWAYS))) {
|
||||
if (y < 2*LST_ARROW_SZ) {
|
||||
if (gw2obj->top > 0) {
|
||||
gw2obj->top -= iheight;
|
||||
if (gw2obj->top < 0)
|
||||
gw2obj->top = 0;
|
||||
_gwinUpdate(&gw->g);
|
||||
}
|
||||
} else if (y >= gw->g.height - 2*ARROW) {
|
||||
} else if (y >= gw->g.height - 2*LST_ARROW_SZ) {
|
||||
if (gw2obj->top < gw2obj->cnt * iheight - pgsz) {
|
||||
gw2obj->top += iheight;
|
||||
if (gw2obj->top > gw2obj->cnt * iheight - pgsz)
|
||||
@ -163,10 +163,10 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param);
|
||||
return;
|
||||
}
|
||||
|
||||
MouseSelect(gw, x, y);
|
||||
ListMouseSelect(gw, x, y);
|
||||
}
|
||||
|
||||
static void MouseUp(GWidgetObject* gw, coord_t x, coord_t y) {
|
||||
static void ListMouseUp(GWidgetObject* gw, coord_t x, coord_t y) {
|
||||
// Only act when we are a smooth scrolling list
|
||||
if (!(gw->g.flags & GLIST_FLG_SCROLLSMOOTH))
|
||||
return;
|
||||
@ -175,10 +175,10 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param);
|
||||
if (abs(gw2obj->start_mouse_x - x) > 4 || abs(gw2obj->start_mouse_y - y) > 4)
|
||||
return;
|
||||
|
||||
MouseSelect(gw, x, y);
|
||||
ListMouseSelect(gw, x, y);
|
||||
}
|
||||
|
||||
static void MouseMove(GWidgetObject* gw, coord_t x, coord_t y) {
|
||||
static void ListMouseMove(GWidgetObject* gw, coord_t x, coord_t y) {
|
||||
int iheight, oldtop;
|
||||
(void) x;
|
||||
|
||||
@ -186,7 +186,7 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param);
|
||||
|
||||
if (gw2obj->last_mouse_y != y) {
|
||||
oldtop = gw2obj->top;
|
||||
iheight = gdispGetFontMetric(gw->g.font, fontHeight) + VERTICAL_PADDING;
|
||||
iheight = gdispGetFontMetric(gw->g.font, fontHeight) + LST_VERT_PAD;
|
||||
|
||||
gw2obj->top -= y - gw2obj->last_mouse_y;
|
||||
if (gw2obj->top >= gw2obj->cnt * iheight - (gw->g.height-2))
|
||||
@ -202,7 +202,7 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param);
|
||||
|
||||
#if GINPUT_NEED_TOGGLE
|
||||
// a toggle-on has occurred
|
||||
static void ToggleOn(GWidgetObject *gw, uint16_t role) {
|
||||
static void ListToggleOn(GWidgetObject *gw, uint16_t role) {
|
||||
const gfxQueueASyncItem * qi;
|
||||
const gfxQueueASyncItem * qix;
|
||||
int i;
|
||||
@ -242,19 +242,19 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param);
|
||||
}
|
||||
}
|
||||
|
||||
static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) {
|
||||
static void ListToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) {
|
||||
if (role)
|
||||
gw2obj->t_up = instance;
|
||||
else
|
||||
gw2obj->t_dn = instance;
|
||||
}
|
||||
|
||||
static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) {
|
||||
static uint16_t ListToggleGet(GWidgetObject *gw, uint16_t role) {
|
||||
return role ? gw2obj->t_up : gw2obj->t_dn;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void _destroy(GHandle gh) {
|
||||
static void ListDestroy(GHandle gh) {
|
||||
const gfxQueueASyncItem* qi;
|
||||
|
||||
while((qi = gfxQueueASyncGet(&gh2obj->list_head)))
|
||||
@ -267,25 +267,25 @@ static const gwidgetVMT listVMT = {
|
||||
{
|
||||
"List", // The class name
|
||||
sizeof(GListObject), // The object size
|
||||
_destroy, // The destroy routine
|
||||
ListDestroy, // The destroy routine
|
||||
_gwidgetRedraw, // The redraw routine
|
||||
0, // The after-clear routine
|
||||
},
|
||||
gwinListDefaultDraw, // default drawing routine
|
||||
#if GINPUT_NEED_MOUSE
|
||||
{
|
||||
MouseDown,
|
||||
MouseUp,
|
||||
MouseMove,
|
||||
ListMouseDown,
|
||||
ListMouseUp,
|
||||
ListMouseMove,
|
||||
},
|
||||
#endif
|
||||
#if GINPUT_NEED_TOGGLE
|
||||
{
|
||||
2, // two toggle roles
|
||||
ToggleAssign, // Assign toggles
|
||||
ToggleGet, // get toggles
|
||||
ListToggleAssign, // Assign toggles
|
||||
ListToggleGet, // Get toggles
|
||||
0,
|
||||
ToggleOn, // process toggle on event
|
||||
ListToggleOn, // Process toggle on event
|
||||
},
|
||||
#endif
|
||||
#if GINPUT_NEED_DIAL
|
||||
@ -616,7 +616,7 @@ void gwinListViewItem(GHandle gh, int item) {
|
||||
return;
|
||||
|
||||
// Work out a possible new top for the list
|
||||
iheight = gdispGetFontMetric(gh->font, fontHeight) + VERTICAL_PADDING;
|
||||
iheight = gdispGetFontMetric(gh->font, fontHeight) + LST_VERT_PAD;
|
||||
gh2obj->top = iheight * item;
|
||||
|
||||
// Adjust the list
|
||||
@ -656,8 +656,8 @@ 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} };
|
||||
static const point upArrow[] = { {0, LST_ARROW_SZ}, {LST_ARROW_SZ, LST_ARROW_SZ}, {LST_ARROW_SZ/2, 0} };
|
||||
static const point downArrow[] = { {0, 0}, {LST_ARROW_SZ, 0}, {LST_ARROW_SZ/2, LST_ARROW_SZ} };
|
||||
#endif
|
||||
|
||||
const gfxQueueASyncItem* qi;
|
||||
@ -678,7 +678,7 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param) {
|
||||
return;
|
||||
|
||||
ps = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->enabled : &gw->pstyle->disabled;
|
||||
iheight = gdispGetFontMetric(gw->g.font, fontHeight) + VERTICAL_PADDING;
|
||||
iheight = gdispGetFontMetric(gw->g.font, fontHeight) + LST_VERT_PAD;
|
||||
x = 1;
|
||||
|
||||
// the scroll area
|
||||
@ -693,16 +693,16 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param) {
|
||||
}
|
||||
}
|
||||
} 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));
|
||||
iwidth = gw->g.width - (LST_SCROLLWIDTH+3);
|
||||
gdispGFillArea(gw->g.display, gw->g.x+iwidth+2, gw->g.y+1, LST_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);
|
||||
gdispGFillConvexPoly(gw->g.display, gw->g.x+iwidth+((LST_SCROLLWIDTH-LST_ARROW_SZ)/2+2), gw->g.y+(LST_ARROW_SZ/2+1), upArrow, 3, ps->fill);
|
||||
gdispGFillConvexPoly(gw->g.display, gw->g.x+iwidth+((LST_SCROLLWIDTH-LST_ARROW_SZ)/2+2), gw->g.y+gw->g.height-(LST_ARROW_SZ+LST_ARROW_SZ/2+1), downArrow, 3, ps->fill);
|
||||
#else
|
||||
#warning "GWIN: Lists display better when GDISP_NEED_CONVEX_POLYGON 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);
|
||||
gdispGFillArea(gw->g.display, gw->g.x+iwidth+((LST_SCROLLWIDTH-LST_ARROW_SZ)/2+2), gw->g.y+(LST_ARROW_SZ/2+1), LST_ARROW_SZ, LST_ARROW_SZ, ps->fill);
|
||||
gdispGFillArea(gw->g.display, gw->g.x+iwidth+((LST_SCROLLWIDTH-LST_ARROW_SZ)/2+2), gw->g.y+gw->g.height-(LST_ARROW_SZ+LST_ARROW_SZ/2+1), LST_ARROW_SZ, LST_ARROW_SZ, ps->fill);
|
||||
#endif
|
||||
} else
|
||||
iwidth = gw->g.width - 2;
|
||||
@ -733,18 +733,18 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param) {
|
||||
// Clear the image area
|
||||
if (qi2li->pimg && gdispImageIsOpen(qi2li->pimg)) {
|
||||
// Calculate which image
|
||||
sy = (qi2li->flags & GLIST_FLG_SELECTED) ? 0 : (iheight-VERTICAL_PADDING);
|
||||
sy = (qi2li->flags & GLIST_FLG_SELECTED) ? 0 : (iheight-LST_VERT_PAD);
|
||||
if (!(gw->g.flags & GWIN_FLG_SYSENABLED))
|
||||
sy += 2*(iheight-VERTICAL_PADDING);
|
||||
sy += 2*(iheight-LST_VERT_PAD);
|
||||
while (sy > qi2li->pimg->height)
|
||||
sy -= iheight-VERTICAL_PADDING;
|
||||
sy -= iheight-LST_VERT_PAD;
|
||||
// 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);
|
||||
gdispGImageDraw(gw->g.display, qi2li->pimg, gw->g.x+1, gw->g.y+y, iheight-LST_VERT_PAD, iheight-LST_VERT_PAD, 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);
|
||||
gdispGFillStringBox(gw->g.display, gw->g.x+x+LST_HORIZ_PAD, gw->g.y+y, iwidth-LST_HORIZ_PAD, iheight, qi2li->text, gw->g.font, ps->text, fill, justifyLeft);
|
||||
}
|
||||
|
||||
// Fill any remaining item space
|
||||
@ -752,4 +752,9 @@ static void gwinListDefaultDraw(GWidgetObject* gw, void* param) {
|
||||
gdispGFillArea(gw->g.display, gw->g.x+1, gw->g.y+y, iwidth, gw->g.height-1-y, gw->pstyle->background);
|
||||
}
|
||||
|
||||
#undef gh2obj
|
||||
#undef gw2obj
|
||||
#undef qi2li
|
||||
#undef qix2li
|
||||
#undef ple
|
||||
#endif // GFX_USE_GWIN && GWIN_NEED_LIST
|
||||
|
26
src/gwin/gwin_mk.c
Normal file
26
src/gwin/gwin_mk.c
Normal file
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* This file is subject to the terms of the GFX License. If a copy of
|
||||
* the license was not distributed with this file, you can obtain one at:
|
||||
*
|
||||
* http://ugfx.org/license.html
|
||||
*/
|
||||
|
||||
#include "gwin.c"
|
||||
#include "gwin_widget.c"
|
||||
#include "gwin_wm.c"
|
||||
#include "gwin_console.c"
|
||||
#include "gwin_graph.c"
|
||||
#include "gwin_button.c"
|
||||
#include "gwin_slider.c"
|
||||
#include "gwin_checkbox.c"
|
||||
#include "gwin_image.c"
|
||||
#include "gwin_label.c"
|
||||
#include "gwin_radio.c"
|
||||
#include "gwin_list.c"
|
||||
#include "gwin_progressbar.c"
|
||||
#include "gwin_container.c"
|
||||
#include "gwin_frame.c"
|
||||
#include "gwin_tabset.c"
|
||||
#include "gwin_gl3d.c"
|
||||
#include "gwin_keyboard.c"
|
||||
#include "gwin_keyboard_layout.c"
|
@ -17,7 +17,7 @@
|
||||
#include "gwin_class.h"
|
||||
|
||||
// Reset the display position back to the value predicted by the saved progressbar position
|
||||
static void ResetDisplayPos(GProgressbarObject *gsw) {
|
||||
static void PBResetDisplayPos(GProgressbarObject *gsw) {
|
||||
if (gsw->w.g.width < gsw->w.g.height)
|
||||
gsw->dpos = gsw->w.g.height-1-((gsw->w.g.height-1)*(gsw->pos-gsw->min))/(gsw->max-gsw->min);
|
||||
else
|
||||
@ -25,7 +25,7 @@ static void ResetDisplayPos(GProgressbarObject *gsw) {
|
||||
}
|
||||
|
||||
// We have to deinitialize the timer which auto updates the progressbar if any
|
||||
static void _destroy(GHandle gh) {
|
||||
static void PBDestroy(GHandle gh) {
|
||||
#if GWIN_PROGRESSBAR_AUTO
|
||||
gtimerStop(&((GProgressbarObject *)gh)->gt);
|
||||
gtimerDeinit(&((GProgressbarObject *)gh)->gt);
|
||||
@ -39,7 +39,7 @@ static const gwidgetVMT progressbarVMT = {
|
||||
{
|
||||
"Progressbar", // The classname
|
||||
sizeof(GProgressbarObject), // The object size
|
||||
_destroy, // The destroy routine
|
||||
PBDestroy, // The destroy routine
|
||||
_gwidgetRedraw, // The redraw routine
|
||||
0, // The after-clear routine
|
||||
},
|
||||
@ -83,7 +83,7 @@ GHandle gwinGProgressbarCreate(GDisplay *g, GProgressbarObject *gs, const GWidge
|
||||
gtimerInit(&gs->gt);
|
||||
#endif
|
||||
|
||||
ResetDisplayPos(gs);
|
||||
PBResetDisplayPos(gs);
|
||||
gwinSetVisible((GHandle)gs, pInit->g.show);
|
||||
|
||||
return (GHandle)gs;
|
||||
@ -101,7 +101,7 @@ void gwinProgressbarSetRange(GHandle gh, int min, int max) {
|
||||
gsw->max = max;
|
||||
gsw->pos = min;
|
||||
|
||||
ResetDisplayPos(gsw);
|
||||
PBResetDisplayPos(gsw);
|
||||
|
||||
#undef gsw
|
||||
}
|
||||
@ -122,7 +122,7 @@ void gwinProgressbarSetPosition(GHandle gh, int pos) {
|
||||
else gsw->pos = pos;
|
||||
}
|
||||
|
||||
ResetDisplayPos(gsw);
|
||||
PBResetDisplayPos(gsw);
|
||||
_gwinUpdate(gh);
|
||||
|
||||
#undef gsw
|
||||
@ -153,7 +153,7 @@ void gwinProgressbarIncrement(GHandle gh) {
|
||||
else
|
||||
gsw->pos = gsw->max;
|
||||
|
||||
ResetDisplayPos(gsw);
|
||||
PBResetDisplayPos(gsw);
|
||||
_gwinUpdate(gh);
|
||||
|
||||
#undef gsw
|
||||
@ -172,7 +172,7 @@ void gwinProgressbarDecrement(GHandle gh) {
|
||||
|
||||
gsw->pos -= gsw->res;
|
||||
|
||||
ResetDisplayPos(gsw);
|
||||
PBResetDisplayPos(gsw);
|
||||
_gwinUpdate(gh);
|
||||
|
||||
#undef gsw
|
||||
|
@ -49,7 +49,7 @@ static void SendRadioEvent(GWidgetObject *gw) {
|
||||
|
||||
#if GINPUT_NEED_MOUSE
|
||||
// A mouse down has occurred over the button
|
||||
static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
static void RadioMouseDown(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
(void) x; (void) y;
|
||||
|
||||
gwinRadioPress((GHandle)gw);
|
||||
@ -58,18 +58,18 @@ static void SendRadioEvent(GWidgetObject *gw) {
|
||||
|
||||
#if GINPUT_NEED_TOGGLE
|
||||
// A toggle on has occurred
|
||||
static void ToggleOn(GWidgetObject *gw, uint16_t role) {
|
||||
static void RadioToggleOn(GWidgetObject *gw, uint16_t role) {
|
||||
(void) role;
|
||||
|
||||
gwinRadioPress((GHandle)gw);
|
||||
}
|
||||
|
||||
static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) {
|
||||
static void RadioToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) {
|
||||
(void) role;
|
||||
((GRadioObject *)gw)->toggle = instance;
|
||||
}
|
||||
|
||||
static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) {
|
||||
static uint16_t RadioToggleGet(GWidgetObject *gw, uint16_t role) {
|
||||
(void) role;
|
||||
return ((GRadioObject *)gw)->toggle;
|
||||
}
|
||||
@ -87,7 +87,7 @@ static const gwidgetVMT radioVMT = {
|
||||
gwinRadioDraw_Radio, // The default drawing routine
|
||||
#if GINPUT_NEED_MOUSE
|
||||
{
|
||||
MouseDown, // Process mouse down events
|
||||
RadioMouseDown, // Process mouse down events
|
||||
0, // Process mouse up events (NOT USED)
|
||||
0, // Process mouse move events (NOT USED)
|
||||
},
|
||||
@ -95,10 +95,10 @@ static const gwidgetVMT radioVMT = {
|
||||
#if GINPUT_NEED_TOGGLE
|
||||
{
|
||||
1, // 1 toggle role
|
||||
ToggleAssign, // Assign Toggles
|
||||
ToggleGet, // Get Toggles
|
||||
RadioToggleAssign, // Assign Toggles
|
||||
RadioToggleGet, // Get Toggles
|
||||
0, // Process toggle off events (NOT USED)
|
||||
ToggleOn, // Process toggle on events
|
||||
RadioToggleOn, // Process toggle on events
|
||||
},
|
||||
#endif
|
||||
#if GINPUT_NEED_DIAL
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define GSLIDER_FLG_EXTENDED_EVENTS (GWIN_FIRST_CONTROL_FLAG<<0)
|
||||
|
||||
// Calculate the slider position from the display position
|
||||
static int CalculatePosFromDPos(GSliderObject *gsw) {
|
||||
static int SliderCalcPosFromDPos(GSliderObject *gsw) {
|
||||
int halfbit;
|
||||
|
||||
// Set the new position
|
||||
@ -74,7 +74,7 @@ static void SendSliderEvent(GSliderObject *gsw, uint8_t action) {
|
||||
#endif
|
||||
|
||||
// If it is a cancel or set use the defined position else use the calculated position.
|
||||
pse->position = pse->action >= GSLIDER_EVENT_CANCEL ? gsw->pos : CalculatePosFromDPos(gsw);
|
||||
pse->position = pse->action >= GSLIDER_EVENT_CANCEL ? gsw->pos : SliderCalcPosFromDPos(gsw);
|
||||
|
||||
// Cleanup and send.
|
||||
psl->srcflags = 0;
|
||||
@ -85,7 +85,7 @@ static void SendSliderEvent(GSliderObject *gsw, uint8_t action) {
|
||||
}
|
||||
|
||||
// Reset the display position back to the value predicted by the saved slider position
|
||||
static void ResetDisplayPos(GSliderObject *gsw) {
|
||||
static void SliderResetDisplayPos(GSliderObject *gsw) {
|
||||
if (gsw->w.g.width < gsw->w.g.height)
|
||||
gsw->dpos = gsw->w.g.height-1-(gsw->w.g.height-1)*(gsw->pos-gsw->min)/(gsw->max-gsw->min);
|
||||
else
|
||||
@ -102,14 +102,14 @@ static void ResetDisplayPos(GSliderObject *gsw) {
|
||||
}
|
||||
|
||||
// A mouse up event
|
||||
static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
static void SliderMouseUp(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
#define gsw ((GSliderObject *)gw)
|
||||
|
||||
#if !GWIN_BUTTON_LAZY_RELEASE
|
||||
// Are we over the slider?
|
||||
if (x < 0 || x >= gsw->w.g.width || y < 0 || y >= gsw->w.g.height) {
|
||||
// No - restore the slider
|
||||
ResetDisplayPos(gsw);
|
||||
SliderResetDisplayPos(gsw);
|
||||
_gwinUpdate(&gsw->w.g);
|
||||
SendSliderEvent(gsw, GSLIDER_EVENT_CANCEL);
|
||||
return;
|
||||
@ -118,7 +118,7 @@ static void ResetDisplayPos(GSliderObject *gsw) {
|
||||
|
||||
// Set the new position
|
||||
SetDisplayPosFromMouse(gsw, x, y);
|
||||
gsw->pos = CalculatePosFromDPos(gsw);
|
||||
gsw->pos = SliderCalcPosFromDPos(gsw);
|
||||
|
||||
// Update the display
|
||||
#if GWIN_SLIDER_NOSNAP
|
||||
@ -135,7 +135,7 @@ static void ResetDisplayPos(GSliderObject *gsw) {
|
||||
gsw->dpos = 0;
|
||||
}
|
||||
#else
|
||||
ResetDisplayPos(gsw);
|
||||
SliderResetDisplayPos(gsw);
|
||||
#endif
|
||||
_gwinUpdate(&gsw->w.g);
|
||||
|
||||
@ -146,7 +146,7 @@ static void ResetDisplayPos(GSliderObject *gsw) {
|
||||
}
|
||||
|
||||
// A mouse down event
|
||||
static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
static void SliderMouseDown(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
#define gsw ((GSliderObject *)gw)
|
||||
|
||||
// Determine the display position
|
||||
@ -162,7 +162,7 @@ static void ResetDisplayPos(GSliderObject *gsw) {
|
||||
}
|
||||
|
||||
// A mouse move event
|
||||
static void MouseMove(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
static void SliderMouseMove(GWidgetObject *gw, coord_t x, coord_t y) {
|
||||
#define gsw ((GSliderObject *)gw)
|
||||
|
||||
// Determine the display position
|
||||
@ -180,7 +180,7 @@ static void ResetDisplayPos(GSliderObject *gsw) {
|
||||
|
||||
#if GINPUT_NEED_TOGGLE
|
||||
// A toggle on has occurred
|
||||
static void ToggleOn(GWidgetObject *gw, uint16_t role) {
|
||||
static void SliderToggleOn(GWidgetObject *gw, uint16_t role) {
|
||||
#define gsw ((GSliderObject *)gw)
|
||||
|
||||
if (role) {
|
||||
@ -193,28 +193,28 @@ static void ResetDisplayPos(GSliderObject *gsw) {
|
||||
#undef gsw
|
||||
}
|
||||
|
||||
static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) {
|
||||
static void SliderToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) {
|
||||
if (role)
|
||||
((GSliderObject *)gw)->t_up = instance;
|
||||
else
|
||||
((GSliderObject *)gw)->t_dn = instance;
|
||||
}
|
||||
|
||||
static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) {
|
||||
static uint16_t SliderToggleGet(GWidgetObject *gw, uint16_t role) {
|
||||
return role ? ((GSliderObject *)gw)->t_up : ((GSliderObject *)gw)->t_dn;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if GINPUT_NEED_DIAL
|
||||
// A dial move event
|
||||
static void DialMove(GWidgetObject *gw, uint16_t role, uint16_t value, uint16_t max) {
|
||||
static void SliderDialMove(GWidgetObject *gw, uint16_t role, uint16_t value, uint16_t max) {
|
||||
#define gsw ((GSliderObject *)gw)
|
||||
(void) role;
|
||||
|
||||
// Set the new position
|
||||
gsw->pos = (uint16_t)((uint32_t)value*(gsw->max-gsw->min)/max + gsw->min);
|
||||
|
||||
ResetDisplayPos(gsw);
|
||||
SliderResetDisplayPos(gsw);
|
||||
_gwinUpdate(&gsw->w.g);
|
||||
|
||||
// Generate the event
|
||||
@ -222,12 +222,12 @@ static void ResetDisplayPos(GSliderObject *gsw) {
|
||||
#undef gsw
|
||||
}
|
||||
|
||||
static void DialAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) {
|
||||
static void SliderDialAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) {
|
||||
(void) role;
|
||||
((GSliderObject *)gw)->dial = instance;
|
||||
}
|
||||
|
||||
static uint16_t DialGet(GWidgetObject *gw, uint16_t role) {
|
||||
static uint16_t SliderDialGet(GWidgetObject *gw, uint16_t role) {
|
||||
(void) role;
|
||||
return ((GSliderObject *)gw)->dial;
|
||||
}
|
||||
@ -245,26 +245,26 @@ static const gwidgetVMT sliderVMT = {
|
||||
gwinSliderDraw_Std, // The default drawing routine
|
||||
#if GINPUT_NEED_MOUSE
|
||||
{
|
||||
MouseDown, // Process mouse down events
|
||||
MouseUp, // Process mouse up events
|
||||
MouseMove, // Process mouse move events
|
||||
SliderMouseDown, // Process mouse down events
|
||||
SliderMouseUp, // Process mouse up events
|
||||
SliderMouseMove, // Process mouse move events
|
||||
},
|
||||
#endif
|
||||
#if GINPUT_NEED_TOGGLE
|
||||
{
|
||||
2, // 1 toggle role
|
||||
ToggleAssign, // Assign Toggles
|
||||
ToggleGet, // Get Toggles
|
||||
SliderToggleAssign, // Assign Toggles
|
||||
SliderToggleGet, // Get Toggles
|
||||
0, // Process toggle off events (NOT USED)
|
||||
ToggleOn, // Process toggle on events
|
||||
SliderToggleOn, // Process toggle on events
|
||||
},
|
||||
#endif
|
||||
#if GINPUT_NEED_DIAL
|
||||
{
|
||||
1, // 1 dial roles
|
||||
DialAssign, // Assign Dials
|
||||
DialGet, // Get Dials
|
||||
DialMove, // Process dial move events
|
||||
SliderDialAssign, // Assign Dials
|
||||
SliderDialGet, // Get Dials
|
||||
SliderDialMove, // Process dial move events
|
||||
},
|
||||
#endif
|
||||
};
|
||||
@ -282,7 +282,7 @@ GHandle gwinGSliderCreate(GDisplay *g, GSliderObject *gs, const GWidgetInit *pIn
|
||||
gs->min = 0;
|
||||
gs->max = 100;
|
||||
gs->pos = 0;
|
||||
ResetDisplayPos(gs);
|
||||
SliderResetDisplayPos(gs);
|
||||
gwinSetVisible((GHandle)gs, pInit->g.show);
|
||||
return (GHandle)gs;
|
||||
}
|
||||
@ -298,7 +298,7 @@ void gwinSliderSetRange(GHandle gh, int min, int max) {
|
||||
gsw->min = min;
|
||||
gsw->max = max;
|
||||
gsw->pos = min;
|
||||
ResetDisplayPos(gsw);
|
||||
SliderResetDisplayPos(gsw);
|
||||
#undef gsw
|
||||
}
|
||||
|
||||
@ -317,7 +317,7 @@ void gwinSliderSetPosition(GHandle gh, int pos) {
|
||||
else if (pos < gsw->max) gsw->pos = gsw->max;
|
||||
else gsw->pos = pos;
|
||||
}
|
||||
ResetDisplayPos(gsw);
|
||||
SliderResetDisplayPos(gsw);
|
||||
_gwinUpdate(gh);
|
||||
|
||||
#undef gsw
|
||||
|
@ -19,8 +19,8 @@
|
||||
#include <string.h>
|
||||
|
||||
// Some position values
|
||||
#define BORDER_WIDTH 2
|
||||
#define TEXT_PADDING 5
|
||||
#define GTABSET_BORDER 2
|
||||
#define GTABSET_TXT_PAD 5
|
||||
|
||||
// Some color blending
|
||||
#define GTABSET_TAB_CNR 8 // Diagonal corner on active tab
|
||||
@ -124,7 +124,7 @@ static coord_t CalcTabHeight(GHandle gh) {
|
||||
y = GWIN_TABSET_TABHEIGHT;
|
||||
for(ph = gwinGetFirstChild(gh); ph; ph = gwinGetSibling(ph)) {
|
||||
if (ph->vmt == (gwinVMT *)&tabpageVMT) {
|
||||
w = gdispGetStringWidth(((GWidgetObject *)ph)->text, gh->font) + TEXT_PADDING*2;
|
||||
w = gdispGetStringWidth(((GWidgetObject *)ph)->text, gh->font) + GTABSET_TXT_PAD*2;
|
||||
x += w;
|
||||
if (x > gh->width) {
|
||||
y += GWIN_TABSET_TABHEIGHT;
|
||||
@ -155,7 +155,7 @@ static void FixTabSizePos(GHandle gh) {
|
||||
gwinMove(ph, 0, 0);
|
||||
gwinResize(ph, w, h);
|
||||
} else {
|
||||
gwinMove(ph, ph->x-gh->x-((gh->flags & GWIN_TABSET_BORDER) ? BORDER_WIDTH : 0) , ph->y-oldth-gh->y);
|
||||
gwinMove(ph, ph->x-gh->x-((gh->flags & GWIN_TABSET_BORDER) ? GTABSET_BORDER : 0) , ph->y-oldth-gh->y);
|
||||
}
|
||||
}
|
||||
if (vis && !(vis->flags & GWIN_FLG_VISIBLE)) {
|
||||
@ -164,7 +164,7 @@ static void FixTabSizePos(GHandle gh) {
|
||||
}
|
||||
}
|
||||
|
||||
static coord_t TabSetBorderSize(GHandle gh) { return (gh->flags & GWIN_TABSET_BORDER) ? BORDER_WIDTH : 0; }
|
||||
static coord_t TabSetBorderSize(GHandle gh) { return (gh->flags & GWIN_TABSET_BORDER) ? GTABSET_BORDER : 0; }
|
||||
static coord_t TabSetBorderTop(GHandle gh) { return ((GTabsetObject *)gh)->border_top; }
|
||||
|
||||
#if GINPUT_NEED_MOUSE
|
||||
@ -185,7 +185,7 @@ static coord_t TabSetBorderTop(GHandle gh) { return ((GTabsetObject *)gh)->bord
|
||||
gh = 0;
|
||||
for(ph = gwinGetFirstChild(&gw->g); ph; ph = gwinGetSibling(ph)) {
|
||||
if (ph->vmt == (gwinVMT *)&tabpageVMT) {
|
||||
w = gdispGetStringWidth(((GWidgetObject *)ph)->text, gw->g.font) + TEXT_PADDING*2;
|
||||
w = gdispGetStringWidth(((GWidgetObject *)ph)->text, gw->g.font) + GTABSET_TXT_PAD*2;
|
||||
x += w;
|
||||
if (x > gw->g.width) {
|
||||
y += GWIN_TABSET_TABHEIGHT;
|
||||
@ -464,7 +464,7 @@ static coord_t drawtabs(GWidgetObject *gw) {
|
||||
y = 0;
|
||||
for(ph = gwinGetFirstChild(&gw->g); ph; ph = gwinGetSibling(ph)) {
|
||||
if (ph->vmt == (gwinVMT *)&tabpageVMT) {
|
||||
w = gdispGetStringWidth(((GWidgetObject *)ph)->text, gw->g.font) + TEXT_PADDING*2;
|
||||
w = gdispGetStringWidth(((GWidgetObject *)ph)->text, gw->g.font) + GTABSET_TXT_PAD*2;
|
||||
if (x+w > gw->g.width) {
|
||||
ntarea(gw, y, x, gw->g.width - x);
|
||||
y += GWIN_TABSET_TABHEIGHT;
|
||||
|
@ -515,5 +515,7 @@ bool_t gwinAttachListener(GListener *pl) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#undef gw
|
||||
#undef wvmt
|
||||
#endif /* GFX_USE_GWIN && GWIN_NEED_WIDGET */
|
||||
/** @} */
|
||||
|
@ -17,6 +17,7 @@
|
||||
# GFXBOARD: The uGFX Board to include eg GFXBOARD=Win32
|
||||
# GFXDRIVERS: The uGFX Drivers to include - separate multiple drivers with spaces eg GFXDRIVERS=multiple/uGFXnet
|
||||
# GFXDEMO: Compile a uGFX standard demo? If blank you need to include your own project files. eg GFXDEMO=modules/gwin/widgets
|
||||
# GFXSINGLEMAKE: Compile the entire system (except for board files and drivers) as a single file eg GFXSINGLEMAKE=yes (default is no)
|
||||
#
|
||||
|
||||
PATHLIST += GFXLIB
|
||||
|
Loading…
Reference in New Issue
Block a user