Control: Add Lth_ControlFont
parent
cceece2216
commit
93377a9dc7
BIN
acs/lithos3.bin
BIN
acs/lithos3.bin
Binary file not shown.
|
@ -1,5 +1,5 @@
|
||||||
Lth_Control
|
Lth_Rect
|
||||||
| Lth_LayoutControl
|
\-Lth_Control
|
||||||
| \ Lth_Button
|
| |-Lth_Button
|
||||||
\ Lth_Window
|
\ \-Lth_Window
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ enum Lth_ButtonState
|
||||||
//
|
//
|
||||||
typedef struct Lth_Button
|
typedef struct Lth_Button
|
||||||
{
|
{
|
||||||
Lth_Inherits(Lth_LayoutControl);
|
Lth_Inherits(Lth_Control);
|
||||||
char *label;
|
char *label;
|
||||||
int state;
|
int state;
|
||||||
} Lth_Button;
|
} Lth_Button;
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
#ifndef lithos3__Lth_context_h
|
#ifndef lithos3__Lth_context_h
|
||||||
#define lithos3__Lth_context_h
|
#define lithos3__Lth_context_h
|
||||||
|
|
||||||
|
#include "Lth_types.h"
|
||||||
|
#include "Lth_font.h"
|
||||||
|
|
||||||
|
|
||||||
// Type Definitions ----------------------------------------------------------|
|
// Type Definitions ----------------------------------------------------------|
|
||||||
|
|
||||||
|
@ -31,6 +34,7 @@
|
||||||
// read-write
|
// read-write
|
||||||
// hid: HUD ID range
|
// hid: HUD ID range
|
||||||
// mapspace: space between newly mapped windows that are auto-positioned
|
// mapspace: space between newly mapped windows that are auto-positioned
|
||||||
|
// font: default font for drawing
|
||||||
//
|
//
|
||||||
typedef struct Lth_Context
|
typedef struct Lth_Context
|
||||||
{
|
{
|
||||||
|
@ -42,6 +46,7 @@ typedef struct Lth_Context
|
||||||
|
|
||||||
Lth_HIDRange hid;
|
Lth_HIDRange hid;
|
||||||
Lth_IVec2 mapspace;
|
Lth_IVec2 mapspace;
|
||||||
|
Lth_Font *font;
|
||||||
} Lth_Context;
|
} Lth_Context;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -56,19 +56,6 @@ typedef struct Lth_Control
|
||||||
Lth_Mixin(Lth_Rect);
|
Lth_Mixin(Lth_Rect);
|
||||||
} Lth_Control;
|
} Lth_Control;
|
||||||
|
|
||||||
//
|
|
||||||
// Lth_LayoutControl
|
|
||||||
//
|
|
||||||
// read-only
|
|
||||||
// lx: layout x
|
|
||||||
// ly: layout y
|
|
||||||
//
|
|
||||||
typedef struct Lth_LayoutControl
|
|
||||||
{
|
|
||||||
Lth_Inherits(Lth_Control);
|
|
||||||
int lx, ly;
|
|
||||||
} Lth_LayoutControl;
|
|
||||||
|
|
||||||
|
|
||||||
// Extern Functions ----------------------------------------------------------|
|
// Extern Functions ----------------------------------------------------------|
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,27 @@
|
||||||
|
|
||||||
// Extern Functions ----------------------------------------------------------|
|
// Extern Functions ----------------------------------------------------------|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Lth_ControlFont
|
||||||
|
//
|
||||||
|
Lth_Font *Lth_ControlFont(void *ctrl_)
|
||||||
|
{
|
||||||
|
Lth_Control *ctrl = ctrl_;
|
||||||
|
|
||||||
|
if(ctrl->font)
|
||||||
|
return ctrl->font;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(Lth_Control *p = ctrl->parent; p; p = p->parent)
|
||||||
|
{
|
||||||
|
if(p->font)
|
||||||
|
return p->font;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ctrl->ctx->font;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Lth_ControlRun
|
// Lth_ControlRun
|
||||||
//
|
//
|
||||||
|
@ -27,7 +48,6 @@ void Lth_ControlRun(void *ctrl_)
|
||||||
Lth_Control *ctrl = ctrl_;
|
Lth_Control *ctrl = ctrl_;
|
||||||
|
|
||||||
Lth_assert(ctrl != NULL);
|
Lth_assert(ctrl != NULL);
|
||||||
Lth_assert(ctrl->ctx != NULL);
|
|
||||||
|
|
||||||
Lth_ControlCall(ctrl, update, ctrl);
|
Lth_ControlCall(ctrl, update, ctrl);
|
||||||
Lth_ControlCall(ctrl, draw, ctrl);
|
Lth_ControlCall(ctrl, draw, ctrl);
|
||||||
|
|
Loading…
Reference in New Issue