Merged uiFontButton back in, with an updated API that works directly with uiDrawFontDescriptors.

This commit is contained in:
Pietro Gagliardi 2017-02-11 00:25:07 -05:00
parent 230d23765a
commit 49094bb340
2 changed files with 8 additions and 30 deletions

30
ui.h
View File

@ -478,26 +478,6 @@ _UI_EXTERN void uiDrawRestore(uiDrawContext *c);
// TODO merge back in // TODO merge back in
#include "ui_attrstr.h" #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) { _UI_ENUM(uiModifiers) {
uiModifierCtrl = 1 << 0, uiModifierCtrl = 1 << 0,
uiModifierAlt = 1 << 1, uiModifierAlt = 1 << 1,
@ -577,16 +557,6 @@ struct uiAreaKeyEvent {
int Up; 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; typedef struct uiColorButton uiColorButton;
#define uiColorButton(this) ((uiColorButton *) (this)) #define uiColorButton(this) ((uiColorButton *) (this))
_UI_EXTERN void uiColorButtonColor(uiColorButton *b, double *r, double *g, double *bl, double *a); _UI_EXTERN void uiColorButtonColor(uiColorButton *b, double *r, double *g, double *bl, double *a);

View File

@ -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); _UI_EXTERN void uiDrawCaret(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout, size_t pos, int *line);
// TODO allow blinking // 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);