From 8944a3fc5528445b9027b1294b6c86bae03eeb89 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sun, 18 Mar 2018 15:11:03 -0400 Subject: [PATCH] Finally documented the remaining functions in ui_attrstr.h. --- _future/unittest/checklist_attrstr | 1 + ui_attrstr.h | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/_future/unittest/checklist_attrstr b/_future/unittest/checklist_attrstr index 47117def..7ba0f244 100644 --- a/_future/unittest/checklist_attrstr +++ b/_future/unittest/checklist_attrstr @@ -22,3 +22,4 @@ should uiNewFamilyAttribute() accept NULL it is an error in ForEach too invalid values for uiDrawTextAlign empty text layouts have one line +TODO figure out what to do if any field (particularly the font family name) in uiFontDescriptor is unset diff --git a/ui_attrstr.h b/ui_attrstr.h index 3486b4e9..66eaf1ce 100644 --- a/ui_attrstr.h +++ b/ui_attrstr.h @@ -488,11 +488,20 @@ _UI_EXTERN void uiDrawTextLayoutExtents(uiDrawTextLayout *tl, double *width, dou // TODO number of lines visible for clipping rect, range visible for clipping rect? +// uiFontButton is a button that allows users to choose a font when they click on it. typedef struct uiFontButton uiFontButton; #define uiFontButton(this) ((uiFontButton *) (this)) +// uiFontButtonFont() returns the font currently selected in the uiFontButton in desc. +// uiFontButtonFont() allocates resources in desc; when you are done with the font, call uiFreeFontButtonFont() to release them. +// uiFontButtonFont() does not allocate desc itself; you must do so. // TODO have a function that sets an entire font descriptor to a range in a uiAttributedString at once, for SetFont? _UI_EXTERN void uiFontButtonFont(uiFontButton *b, uiFontDescriptor *desc); // TOOD SetFont, mechanics +// uiFontButtonOnChanged() sets the function that is called when the font in the uiFontButton is changed. _UI_EXTERN void uiFontButtonOnChanged(uiFontButton *b, void (*f)(uiFontButton *, void *), void *data); +// uiNewFontButton() creates a new uiFontButton. The default font selected into the uiFontButton is OS-defined. _UI_EXTERN uiFontButton *uiNewFontButton(void); +// uiFreeFontButtonFont() frees resources allocated in desc by uiFontButtonFont(). +// After calling uiFreeFontButtonFont(), the contents of desc should be assumed to be undefined (though since you allocate desc itself, you can safely reuse desc for other font descriptors). +// Calling uiFreeFontButtonFont() on a uiFontDescriptor not returned by uiFontButtonFont() results in undefined behavior. _UI_EXTERN void uiFreeFontButtonFont(uiFontDescriptor *desc);