From 49094bb340c710d0dabe7a08abd9711d509943c9 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 11 Feb 2017 00:25:07 -0500 Subject: [PATCH] Merged uiFontButton back in, with an updated API that works directly with uiDrawFontDescriptors. --- ui.h | 30 ------------------------------ ui_attrstr.h | 8 ++++++++ 2 files changed, 8 insertions(+), 30 deletions(-) diff --git a/ui.h b/ui.h index ddc9bb63..922d0625 100644 --- a/ui.h +++ b/ui.h @@ -478,26 +478,6 @@ _UI_EXTERN void uiDrawRestore(uiDrawContext *c); // TODO merge back in #include "ui_attrstr.h" -// TODO -#if 0 -struct uiDrawTextFontMetrics { - double Ascent; - double Descent; - double Leading; - // TODO do these two mean the same across all platforms? - double UnderlinePos; - double UnderlineThickness; -}; - -_UI_EXTERN uiDrawTextFont *uiDrawLoadClosestFont(const uiDrawTextFontDescriptor *desc); -_UI_EXTERN void uiDrawFreeTextFont(uiDrawTextFont *font); -_UI_EXTERN uintptr_t uiDrawTextFontHandle(uiDrawTextFont *font); -_UI_EXTERN void uiDrawTextFontDescribe(uiDrawTextFont *font, uiDrawTextFontDescriptor *desc); -// TODO make copy with given attributes methods? -// TODO yuck this name -_UI_EXTERN void uiDrawTextFontGetMetrics(uiDrawTextFont *font, uiDrawTextFontMetrics *metrics); -#endif - _UI_ENUM(uiModifiers) { uiModifierCtrl = 1 << 0, uiModifierAlt = 1 << 1, @@ -577,16 +557,6 @@ struct uiAreaKeyEvent { int Up; }; -#if 0 /* TODO */ -typedef struct uiFontButton uiFontButton; -#define uiFontButton(this) ((uiFontButton *) (this)) -// TODO document this returns a new font -_UI_EXTERN uiDrawTextFont *uiFontButtonFont(uiFontButton *b); -// TOOD SetFont, mechanics -_UI_EXTERN void uiFontButtonOnChanged(uiFontButton *b, void (*f)(uiFontButton *, void *), void *data); -_UI_EXTERN uiFontButton *uiNewFontButton(void); -#endif - typedef struct uiColorButton uiColorButton; #define uiColorButton(this) ((uiColorButton *) (this)) _UI_EXTERN void uiColorButtonColor(uiColorButton *b, double *r, double *g, double *bl, double *a); diff --git a/ui_attrstr.h b/ui_attrstr.h index 052f067d..9fb81513 100644 --- a/ui_attrstr.h +++ b/ui_attrstr.h @@ -164,3 +164,11 @@ _UI_EXTERN double uiDrawTextLayoutByteLocationInLine(uiDrawTextLayout *tl, size_ _UI_EXTERN void uiDrawCaret(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout, size_t pos, int *line); // TODO allow blinking + +typedef struct uiFontButton uiFontButton; +#define uiFontButton(this) ((uiFontButton *) (this)) +// TODO document this returns a new font +_UI_EXTERN void uiFontButtonFont(uiFontButton *b, uiDrawFontDescriptor *desc); +// TOOD SetFont, mechanics +_UI_EXTERN void uiFontButtonOnChanged(uiFontButton *b, void (*f)(uiFontButton *, void *), void *data); +_UI_EXTERN uiFontButton *uiNewFontButton(void);