Remove Lth_button and test file
parent
3f5d061bcd
commit
f5fdcd56a9
|
@ -37,7 +37,6 @@ ALLOCMIN=--alloc-min Sta ""
|
|||
## Sources
|
||||
|
||||
SOURCES= \
|
||||
$(SRC)/button.c \
|
||||
$(SRC)/context.c \
|
||||
$(SRC)/control.c \
|
||||
$(SRC)/draw.c \
|
||||
|
@ -52,7 +51,6 @@ SOURCES= \
|
|||
HEADERS= \
|
||||
$(INC)/Lth.h \
|
||||
$(INC)/Lth_assert.h \
|
||||
$(INC)/Lth_button.h \
|
||||
$(INC)/Lth_callback.h \
|
||||
$(INC)/Lth_context.h \
|
||||
$(INC)/Lth_control.h \
|
||||
|
@ -62,6 +60,7 @@ HEADERS= \
|
|||
$(INC)/Lth_hudmessage.h \
|
||||
$(INC)/Lth_linklist.h \
|
||||
$(INC)/Lth_manifest.h \
|
||||
$(INC)/Lth_stdfix.h \
|
||||
$(INC)/Lth_stdlib.h \
|
||||
$(INC)/Lth_token.h \
|
||||
$(INC)/Lth_tokenstream.h \
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#ifndef lithos3__Lth_h
|
||||
#define lithos3__Lth_h
|
||||
|
||||
#include "Lth_stdfix.h"
|
||||
#include <stdbool.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright © 2016 Project Golan
|
||||
//
|
||||
// See "LICENSE" for more information.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Button control.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef lithos3__Lth_button_h
|
||||
#define lithos3__Lth_button_h
|
||||
|
||||
|
||||
// Type Definitions ----------------------------------------------------------|
|
||||
|
||||
//
|
||||
// Lth_ButtonState
|
||||
//
|
||||
enum Lth_ButtonState
|
||||
{
|
||||
Lth_BS_Normal,
|
||||
Lth_BS_Hover,
|
||||
Lth_BS_Depressed,
|
||||
Lth_BS_Clicked,
|
||||
Lth_BS_Max
|
||||
};
|
||||
|
||||
//
|
||||
// Lth_Button
|
||||
//
|
||||
typedef struct Lth_Button
|
||||
{
|
||||
Lth_Inherits(Lth_Control);
|
||||
char *label;
|
||||
int state;
|
||||
} Lth_Button;
|
||||
|
||||
|
||||
// Extern Functions ----------------------------------------------------------|
|
||||
|
||||
Lth_Button *Lth_ButtonNew(char const *label);
|
||||
void Lth_ButtonSetLabel(Lth_Button *ctrl, char const *label);
|
||||
|
||||
#endif//lithos3__Lth_button_h
|
|
@ -1,74 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright © 2016 Project Golan
|
||||
//
|
||||
// See "LICENSE" for more information.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Window functions.
|
||||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "Lth.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
// Static Functions ----------------------------------------------------------|
|
||||
|
||||
//
|
||||
// Lth_ButtonDraw
|
||||
//
|
||||
static void Lth_ButtonDraw(Lth_Button *ctrl)
|
||||
{
|
||||
ACS_SetFont(s"CONFONT");
|
||||
ACS_BeginPrint();
|
||||
Lth_PrintString(ctrl->label);
|
||||
Lth_HudMessagePlain(ctrl->ctx->hid.cur--,
|
||||
ctrl->x - 8 + Lth_A_Cen,
|
||||
ctrl->y - 8 + Lth_A_Cen);
|
||||
Lth_DrawRect(ctrl->ctx, ctrl->x, ctrl->y, ctrl->w, ctrl->h, 0.5k);
|
||||
}
|
||||
|
||||
//
|
||||
// Lth_ButtonDestroy
|
||||
//
|
||||
static void Lth_ButtonDestroy(Lth_Button *ctrl)
|
||||
{
|
||||
if(ctrl->label)
|
||||
free(ctrl->label);
|
||||
}
|
||||
|
||||
|
||||
// Extern Functions ----------------------------------------------------------|
|
||||
|
||||
//
|
||||
// Lth_ButtonNew
|
||||
//
|
||||
Lth_Button *Lth_ButtonNew(char const *label)
|
||||
{
|
||||
Lth_Button *ctrl = calloc(1, sizeof(Lth_Button));
|
||||
Lth_assert(ctrl != NULL);
|
||||
|
||||
Lth_ButtonSetLabel(ctrl, label);
|
||||
Lth_ControlConnect(ctrl, Lth_SIGDRAW, Lth_Callback(Lth_ButtonDraw));
|
||||
Lth_ControlConnect(ctrl, Lth_SIGDESTROY, Lth_Callback(Lth_ButtonDestroy));
|
||||
|
||||
return ctrl;
|
||||
}
|
||||
|
||||
//
|
||||
// Lth_ButtonSetLabel
|
||||
//
|
||||
void Lth_ButtonSetLabel(Lth_Button *ctrl, char const *label)
|
||||
{
|
||||
Lth_assert(ctrl != NULL);
|
||||
|
||||
if(label != NULL)
|
||||
ctrl->label = Lth_strdup(label);
|
||||
else
|
||||
ctrl->label = Lth_strdup("Button");
|
||||
}
|
||||
|
||||
// EOF
|
|
@ -1,3 +0,0 @@
|
|||
Resource1 = 0x30
|
||||
|
||||
// EOF
|
Loading…
Reference in New Issue