frame fixes

This commit is contained in:
inmarket 2014-05-11 13:09:36 +10:00
parent a49b095b94
commit bdbe78a8da
5 changed files with 23 additions and 161 deletions

View File

@ -34,89 +34,13 @@
#define GDISP_NEED_TIMERFLUSH FALSE
#define GDISP_NEED_VALIDATION TRUE
#define GDISP_NEED_CLIP TRUE
#define GDISP_NEED_CIRCLE FALSE
#define GDISP_NEED_ELLIPSE FALSE
#define GDISP_NEED_ARC FALSE
#define GDISP_NEED_CONVEX_POLYGON FALSE
#define GDISP_NEED_SCROLL FALSE
#define GDISP_NEED_PIXELREAD FALSE
#define GDISP_NEED_CONTROL FALSE
#define GDISP_NEED_QUERY FALSE
#define GDISP_NEED_MULTITHREAD FALSE
#define GDISP_NEED_STREAMING FALSE
#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 FALSE
#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS10 FALSE
#define GDISP_INCLUDE_FONT_DEJAVUSANS12 TRUE
#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 FALSE
#define GDISP_NEED_IMAGE_NATIVE FALSE
#define GDISP_NEED_IMAGE_GIF FALSE
#define GDISP_NEED_IMAGE_BMP FALSE
#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 FALSE
#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 TRUE
#define GDISP_INCLUDE_FONT_UI2 TRUE
#define GDISP_NEED_CIRCLE TRUE
#define GDISP_NEED_CONVEX_POLYGON TRUE
#define GDISP_NEED_MULTITHREAD TRUE
#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 //
@ -131,7 +55,6 @@
#define GWIN_CONSOLE_HISTORY_ATCREATE TRUE
#define GWIN_CONSOLE_ESCSEQ TRUE
#define GWIN_CONSOLE_USE_BASESTREAM TRUE
#define GWIN_CONSOLE_USE_FLOAT TRUE
#define GWIN_NEED_GRAPH TRUE
#define GWIN_NEED_WIDGET TRUE
@ -159,20 +82,11 @@
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_GEVENT TRUE
#define GEVENT_ASSERT_NO_RESOURCE FALSE
#define GEVENT_MAXIMUM_SIZE 32
#define GEVENT_MAX_SOURCE_LISTENERS 32
///////////////////////////////////////////////////////////////////////////
// GTIMER //
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_GTIMER TRUE
#define GTIMER_THREAD_PRIORITY HIGH_PRIORITY
#define GTIMER_THREAD_WORKAREA_SIZE 2048
///////////////////////////////////////////////////////////////////////////
// GQUEUE //
///////////////////////////////////////////////////////////////////////////
@ -189,59 +103,5 @@
#define GFX_USE_GINPUT TRUE
#define GINPUT_NEED_MOUSE TRUE
#define GINPUT_NEED_KEYBOARD FALSE
#define GINPUT_NEED_TOGGLE FALSE
#define GINPUT_NEED_DIAL FALSE
///////////////////////////////////////////////////////////////////////////
// GFILE //
///////////////////////////////////////////////////////////////////////////
#define GFX_USE_GFILE FALSE
#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 FALSE
#define GFILE_NEED_RAMFS FALSE
#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 */

View File

@ -24,14 +24,14 @@ int main(void) {
// Initialize the display
gfxInit();
// Attach the mouse input
gwinAttachMouse(0);
// Set the widget defaults
gwinSetDefaultFont(gdispOpenFont("*"));
gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE);
gdispClear(White);
// Attach the mouse input
gwinAttachMouse(0);
// create the widget
createWidgets();
@ -40,7 +40,7 @@ int main(void) {
gwinAttachListener(&gl);
while(1) {
gfxSleepMilliseconds(1000);
}
return 0;

View File

@ -100,26 +100,26 @@ GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint
if (!(fo = (GFrameObject *)_gcontainerCreate(g, &fo->gc, pInit, &frameVMT)))
return 0;
fo->btnClose = NULL;
fo->btnMin = NULL;
fo->btnMax = NULL;
fo->btnClose = 0;
fo->btnMin = 0;
fo->btnMax = 0;
/* Buttons require a border */
if ((flags & GWIN_FRAME_CLOSE_BTN || flags & GWIN_FRAME_MINMAX_BTN) && !(flags & GWIN_FRAME_BORDER))
if ((flags & (GWIN_FRAME_CLOSE_BTN|GWIN_FRAME_MINMAX_BTN)))
flags |= GWIN_FRAME_BORDER;
/* apply flags */
fo->gc.g.flags |= flags;
/* create and initialize the listener if any button is present. */
if ((flags & GWIN_FRAME_CLOSE_BTN) || (flags & GWIN_FRAME_MINMAX_BTN)) {
if ((flags & (GWIN_FRAME_CLOSE_BTN|GWIN_FRAME_MINMAX_BTN))) {
geventListenerInit(&fo->gl);
gwinAttachListener(&fo->gl);
geventRegisterCallback(&fo->gl, _callbackBtn, (GHandle)fo);
}
/* create close button if necessary */
if (flags & GWIN_FRAME_CLOSE_BTN) {
if ((flags & GWIN_FRAME_CLOSE_BTN)) {
GWidgetInit wi;
gwinWidgetClearInit(&wi);
@ -131,11 +131,11 @@ GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint
wi.g.width = BUTTON_X;
wi.g.height = BUTTON_Y;
wi.text = "X";
fo->btnClose = gwinButtonCreate(NULL, &wi);
fo->btnClose = gwinGButtonCreate(g, 0, &wi);
}
/* create minimize and maximize buttons if necessary */
if (flags & GWIN_FRAME_MINMAX_BTN) {
if ((flags & GWIN_FRAME_MINMAX_BTN)) {
GWidgetInit wi;
gwinWidgetClearInit(&wi);
@ -147,14 +147,14 @@ GHandle gwinGFrameCreate(GDisplay *g, GFrameObject *fo, GWidgetInit *pInit, uint
wi.g.width = BUTTON_X;
wi.g.height = BUTTON_Y;
wi.text = "O";
fo->btnMin = gwinButtonCreate(NULL, &wi);
fo->btnMin = gwinGButtonCreate(g, 0, &wi);
wi.g.x = (flags & GWIN_FRAME_CLOSE_BTN) ? fo->gc.g.width - 3*BORDER_X - 3*BUTTON_X : fo->gc.g.width - BORDER_X - BUTTON_X;
wi.g.y = (BORDER_Y - BUTTON_Y) / 2;
wi.g.width = BUTTON_X;
wi.g.height = BUTTON_Y;
wi.text = "_";
fo->btnMax = gwinButtonCreate(NULL, &wi);
fo->btnMax = gwinGButtonCreate(g, 0, &wi);
}
gwinSetVisible(&fo->gc.g, pInit->g.show);

View File

@ -148,7 +148,7 @@ GHandle _gwindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit
#if GWIN_NEED_CONTAINERS
if (pInit->parent) {
if (!(pInit->parent->flags & GWIN_FLG_CONTAINER) || pgw->display != pgw->parent->display) {
if (!(pInit->parent->flags & GWIN_FLG_CONTAINER) || pgw->display != pInit->parent->display) {
if ((pgw->flags & GWIN_FLG_DYNAMIC))
gfxFree(pgw);
return 0;

View File

@ -217,7 +217,8 @@ static void WM_Size(GHandle gh, coord_t w, coord_t h) {
// Clip to the container
if (gh->x+w > gh->parent->x+gh->parent->width) w = gh->parent->x + gh->parent->width - gh->x;
if (gh->y+h > gh->parent->y+gh->parent->height) h = gh->parent->y + gh->parent->height - gh->y;
((const gcontainerVMT *)gh->parent->vmt)->AdjustSize(gh, &w, &h);
if (((const gcontainerVMT *)gh->parent->vmt)->AdjustSize)
((const gcontainerVMT *)gh->parent->vmt)->AdjustSize(gh, &w, &h);
}
#endif
@ -251,7 +252,8 @@ static void WM_Move(GHandle gh, coord_t x, coord_t y) {
if (y > gh->parent->height-gh->height) y = gh->parent->height-gh->height;
// Allow the parent to adjust it
((const gcontainerVMT *)gh->parent->vmt)->AdjustPosition(gh, &x, &y);
if (((const gcontainerVMT *)gh->parent->vmt)->AdjustPosition)
((const gcontainerVMT *)gh->parent->vmt)->AdjustPosition(gh, &x, &y);
// Convert to absolute position
x += gh->parent->x;