added guiDeleteElement

This commit is contained in:
Tectu 2012-06-27 10:10:45 +02:00
parent 3d041a9d4b
commit db7d8d0aea
2 changed files with 17 additions and 1 deletions

10
gui.c
View File

@ -29,7 +29,7 @@ static uint16_t addNode(struct guiNode_t *newNode) {
return 1;
}
static void deleteNode(char *name) {
static uint8_t deleteNode(char *name) {
struct guiNode_t *pointer, *pointer1;
if(firstGUI != NULL) {
@ -53,7 +53,11 @@ static void deleteNode(char *name) {
}
}
return 1; // successful
}
return 0; // not successful
}
void guiPrintNodes(BaseSequentialStream *chp) {
@ -127,6 +131,10 @@ Thread *guiInit(uint16_t interval, tprio_t priority) {
return tp;
}
uint8_t guiDeleteElement(char *name) {
return deleteNode(name);
}
uint8_t guiDrawButton(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, char *str, uint16_t fontColor, uint16_t buttonColor, char *name, uint8_t *active, uint8_t *state) {
struct guiNode_t *newNode;

8
gui.h
View File

@ -48,6 +48,14 @@ Thread *guiInit(uint16_t interval, tprio_t priority);
*/
void guiPrintNode(BaseSequentialStream *chp);
/*
* Description: deletes a GUI element from the linked list
*
* param: - name: name of the element (parameter of each guiDrawXXX function)
*
* return: 1 if successful, 0 otherwise
*/
uint8_t guiDeleteElement(char *name);
/*
* Description: draws a button on the screen and keeps it's state up to date
*