GLabel work in progress
This commit is contained in:
parent
f188613d30
commit
931c465265
4 changed files with 128 additions and 1 deletions
|
@ -724,6 +724,10 @@ extern "C" {
|
|||
#include "gwin/image.h"
|
||||
#endif
|
||||
|
||||
#if GWIN_NEED_LABEL || defined(__DOXYGEN__)
|
||||
#include "gwin/label.h"
|
||||
#endif
|
||||
|
||||
#endif /* GFX_USE_GWIN */
|
||||
|
||||
#endif /* _GWIN_H */
|
||||
|
|
55
include/gwin/label.h
Normal file
55
include/gwin/label.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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/label.h
|
||||
* @brief GWIN label widget header file.
|
||||
*
|
||||
* @defgroup Label Label
|
||||
* @ingroup GWIN
|
||||
*
|
||||
* @details GWIN allos it to create an label widget. The widget
|
||||
* takes no user input.
|
||||
*
|
||||
* @pre GFX_USE_GDISP must be set to TRUE in your gfxconf.h
|
||||
* @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h
|
||||
* @pre GDISP_NEED_TEXT must be set to TRUE in your gfxconf.h
|
||||
* @pre GWIN_NEED_LABEL must be set to TRUE in your gfxconf.h
|
||||
* @pre The font you want to use must be enabled in your gfxconf.h
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#ifndef _GWIN_LABEL_H
|
||||
#define _GWIN_LABEL_H
|
||||
|
||||
// This file is included within "gwin/gwin.h"
|
||||
|
||||
// An label window
|
||||
typedef struct GLabelWidget_t {
|
||||
GWindowObject g;
|
||||
|
||||
char* text;
|
||||
} GLabelWidget;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
GHandle gwinLabelCreate(GLabelWidget *widget, GWindowInit *pInit);
|
||||
void gwinLabelSetColor(GHandle gh, color_t color);
|
||||
void gwinLabelSetBgColor(GHandle gh, color_t bgColor);
|
||||
void gwinLabelSetText(GHandle gh, char* text);
|
||||
void gwinLabelDraw(GHandle gh);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _GWIN_LABEL_H
|
||||
/** @} */
|
||||
|
|
@ -7,4 +7,5 @@ GFXSRC += $(GFXLIB)/src/gwin/gwin.c \
|
|||
$(GFXLIB)/src/gwin/slider.c \
|
||||
$(GFXLIB)/src/gwin/checkbox.c \
|
||||
$(GFXLIB)/src/gwin/image.c \
|
||||
|
||||
$(GFXLIB)/src/gwin/label.c \
|
||||
|
||||
|
|
67
src/gwin/label.c
Normal file
67
src/gwin/label.c
Normal file
|
@ -0,0 +1,67 @@
|
|||
/*
|
||||
* 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/label.h
|
||||
* @brief GWIN label widget header file.
|
||||
*
|
||||
* @defgroup Label Label
|
||||
* @ingroup GWIN
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
|
||||
#include "gfx.h"
|
||||
|
||||
#if GFX_USE_GWIN && GWIN_NEED_LABEL
|
||||
|
||||
#include "gwin/class_gwin.h"
|
||||
|
||||
#define widget(gh) ((GLabelWidget*)gh)
|
||||
|
||||
static void _destroy(GWindowObject *gh) {
|
||||
(void)gh;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void _redraw(GWindowObject *gh) {
|
||||
(void)gh;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void _afterClear(GWindowObject *gh) {
|
||||
(void)gh;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GHandle gwinLabelCreate(GLabelWidget *widget, GWindowInit *pInit) {
|
||||
|
||||
}
|
||||
|
||||
void gwinLabelSetColor(GHandle gh, color_t color) {
|
||||
widget(gh)->g.color = color;
|
||||
}
|
||||
|
||||
void gwinLabelSetBgColor(GHandle gh, color_t bgColor) {
|
||||
widget(gh)->g.bgcolor = bgColor;
|
||||
}
|
||||
|
||||
void gwinLabelSetText(GHandle gh, char* text) {
|
||||
widget(gh)->text = text;
|
||||
|
||||
gwinLabelDraw(gh);
|
||||
}
|
||||
|
||||
void gwinLabelDraw(GHandle gh) {
|
||||
|
||||
}
|
||||
|
||||
#endif // GFX_USE_GWIN && GFX_NEED_LABEL
|
||||
|
Loading…
Add table
Reference in a new issue