image widget implementation work in progress
This commit is contained in:
parent
b8b149591f
commit
de27a6c2db
4 changed files with 116 additions and 0 deletions
|
@ -746,10 +746,15 @@ extern "C" {
|
||||||
#if GWIN_NEED_CONSOLE || defined(__DOXYGEN__)
|
#if GWIN_NEED_CONSOLE || defined(__DOXYGEN__)
|
||||||
#include "gwin/console.h"
|
#include "gwin/console.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if GWIN_NEED_GRAPH || defined(__DOXYGEN__)
|
#if GWIN_NEED_GRAPH || defined(__DOXYGEN__)
|
||||||
#include "gwin/graph.h"
|
#include "gwin/graph.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if GWIN_NEED_IMAGE || defined(__DOXYGEN__)
|
||||||
|
#include "gwin/image.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* GFX_USE_GWIN */
|
#endif /* GFX_USE_GWIN */
|
||||||
|
|
||||||
#endif /* _GWIN_H */
|
#endif /* _GWIN_H */
|
||||||
|
|
47
include/gwin/image.h
Normal file
47
include/gwin/image.h
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
/*
|
||||||
|
* 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://chibios-gfx.com/license.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file include/gwin/image.h
|
||||||
|
* @brief GWIN image widget header file.
|
||||||
|
*
|
||||||
|
* @defgroup Image Image
|
||||||
|
* @ingroup GWIN
|
||||||
|
*
|
||||||
|
* @details GWIN allos it to create an image widget. The widget
|
||||||
|
* takes no user input.
|
||||||
|
*
|
||||||
|
* @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h
|
||||||
|
* @pre GWIN_NEED_IMAGE must be set to TRUE in your gfxconf.h
|
||||||
|
*
|
||||||
|
* @{
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _GWIN_IMAGE_H
|
||||||
|
#define _GWIN_IMAGE_H
|
||||||
|
|
||||||
|
// This file is included within "gwin/gwin.h"
|
||||||
|
|
||||||
|
// An image window
|
||||||
|
typedef struct GImageWidget_t {
|
||||||
|
GWindowObject g;
|
||||||
|
} GImageWidget;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
GHandle gwinImageCreate(GImageWidget *widget, GWindowInit *pInit);
|
||||||
|
void gwinImageDisplay(GImageWidget *widget, gdispImage *image);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // _GWIN_IMAGE_H
|
||||||
|
/** @} */
|
||||||
|
|
|
@ -6,4 +6,5 @@ GFXSRC += $(GFXLIB)/src/gwin/gwin.c \
|
||||||
$(GFXLIB)/src/gwin/button.c \
|
$(GFXLIB)/src/gwin/button.c \
|
||||||
$(GFXLIB)/src/gwin/slider.c \
|
$(GFXLIB)/src/gwin/slider.c \
|
||||||
$(GFXLIB)/src/gwin/checkbox.c \
|
$(GFXLIB)/src/gwin/checkbox.c \
|
||||||
|
$(GFXLIB)/src/gwin/image.c \
|
||||||
|
|
||||||
|
|
63
src/gwin/image.c
Normal file
63
src/gwin/image.c
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/*
|
||||||
|
* 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://chibios-gfx.com/license.html
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file src/gwin/image.c
|
||||||
|
* @brief GWIN sub-system image code.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "gfx.h"
|
||||||
|
|
||||||
|
#if GFX_USE_GWIN && GWIN_NEED_IMAGE
|
||||||
|
|
||||||
|
#include "gwin/class_gwin.h"
|
||||||
|
|
||||||
|
static void _destroy(GWindowObject *gh) {
|
||||||
|
(void)gh;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _redraw(GWindowObject *gh) {
|
||||||
|
(void)gh;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void _afterClear(GWindowObject *gh) {
|
||||||
|
((GImageWidget *)gh)->cx = 0;
|
||||||
|
((GImageWidget *)gh)->cy = 0;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const gwinVMT imageVMT = {
|
||||||
|
"Image", // The class name
|
||||||
|
sizeof(GImageWidget), // The object size
|
||||||
|
_destroy, // The destroy routine
|
||||||
|
_redraw, // The redraw routine
|
||||||
|
_afterClear, // The after-clear routine
|
||||||
|
};
|
||||||
|
|
||||||
|
GHandle gwinImageCreate(GImageWidget *widget, GWindowInit *pInit) {
|
||||||
|
if (!(widget = (GImageWidget *)_gwindowCreate(&widget->g, pInit, &imageVMT, 0)))
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
widget->cx = 0;
|
||||||
|
widget->cy = 0;
|
||||||
|
gwinSetVisible((GHandle)widget, pInit->show);
|
||||||
|
|
||||||
|
return (GHandle)widget;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gwinImageDisplay(GImageWidget *widget, gdispImage *image) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // GFX_USE_GWIN && GWIN_NEED_IMAGE
|
||||||
|
/** @} */
|
||||||
|
|
Loading…
Add table
Reference in a new issue