MiniGUI API Reference (MiniGUI-Threads)
v3.2.0
A mature and proven cross-platform GUI system for embedded and smart IoT devices
|
Data Structures | |
struct | _DTFIRSTLINE |
Macros | |
#define | GetTextCharacterExtra(hdc) GetDCAttr (hdc, DC_ATTR_CHAR_EXTRA) |
Retrieves the current intercharacter spacing for the DC. More... | |
#define | GetTextAboveLineExtra(hdc) GetDCAttr (hdc, DC_ATTR_ALINE_EXTRA) |
Retrieves the current spacing above line for the DC. More... | |
#define | GetTextBellowLineExtra(hdc) GetDCAttr (hdc, DC_ATTR_BLINE_EXTRA) |
Retrieves the current spacing bellow line for the DC. More... | |
#define | SetTextCharacterExtra(hdc, extra) SetDCAttr (hdc, DC_ATTR_CHAR_EXTRA, (DWORD) extra) |
Sets the intercharacter spacing for the DC and returns the old spacing value. More... | |
#define | SetTextAboveLineExtra(hdc, extra) SetDCAttr (hdc, DC_ATTR_ALINE_EXTRA, (DWORD) extra) |
Sets the spacing above line for the DC and returns the old value. More... | |
#define | SetTextBellowLineExtra(hdc, extra) SetDCAttr (hdc, DC_ATTR_BLINE_EXTRA, (DWORD) extra) |
Sets the spacing bellow line for the DC and returns the old value. More... | |
#define | GetTextAlign(hdc) GetDCAttr (hdc, DC_ATTR_TEXT_ALIGN) |
Retrieves the current text-alignment flags of a DC. More... | |
#define | SetTextAlign(hdc, ta_flags) SetDCAttr (hdc, DC_ATTR_TEXT_ALIGN, (DWORD)ta_flags) |
Sets text-alignment flags of a DC. More... | |
#define | TextOut(hdc, x, y, text) TextOutLen (hdc, x, y, text, -1) |
Outputs text. More... | |
#define | TabbedTextOut(hdc, x, y, text) TabbedTextOutLen (hdc, x, y, text, -1) |
Outputs formatted text. More... | |
#define | DrawText(hdc, text, n, rc, format) DrawTextEx2 (hdc, text, n, rc, 0, format, NULL) |
Draws a formatted text in a rectangle. More... | |
#define | DrawTextEx(hdc, text, n, rc, indent, format) DrawTextEx2 (hdc, text, n, rc, indent, format, NULL) |
Draws a formatted text in a rectangle. More... | |
Typedefs | |
typedef struct _DTFIRSTLINE | DTFIRSTLINE |
Functions | |
MG_EXPORT int GUIAPI | GetFontHeight (HDC hdc) |
Retrieves the height of the current logical font in a DC. More... | |
MG_EXPORT int GUIAPI | GetMaxFontWidth (HDC hdc) |
Retrieves the maximal character width of the current logical font in a DC. More... | |
MG_EXPORT int GUIAPI | GetTextExtent (HDC hdc, const char *spText, int len, SIZE *pSize) |
Computes the output extent of a string of text. More... | |
MG_EXPORT int GUIAPI | GetTabbedTextExtent (HDC hdc, const char *spText, int len, SIZE *pSize) |
Computes the output extent of a formatted text. More... | |
MG_EXPORT int GUIAPI | TextOutLen (HDC hdc, int x, int y, const char *spText, int len) |
Outputs a string of text. More... | |
MG_EXPORT int GUIAPI | TextOutOmitted (HDC hdc, int x, int y, const char *mtext, int len, int max_extent) |
Outputs a string of text with omitted format. More... | |
MG_EXPORT int GUIAPI | TabbedTextOutLen (HDC hdc, int x, int y, const char *spText, int len) |
Outputs a formatted text. More... | |
MG_EXPORT int GUIAPI | TabbedTextOutEx (HDC hdc, int x, int y, const char *spText, int nCount, int nTabPositions, int *pTabPositions, int nTabOrigin) |
Writes a character string at a specified location, expanding tabs to the values specified in an anrry of tab-stop positions. More... | |
MG_EXPORT void GUIAPI | GetLastTextOutPos (HDC hdc, POINT *pt) |
Retrieves the last text output position. More... | |
MG_EXPORT int GUIAPI | DrawTextEx2 (HDC hdc, const char *pText, int nCount, RECT *pRect, int nIndent, UINT nFormat, DTFIRSTLINE *firstline) |
Draws a formatted text in a rectangle. More... | |
#define DrawText | ( | hdc, | |
text, | |||
n, | |||
rc, | |||
format | |||
) | DrawTextEx2 (hdc, text, n, rc, 0, format, NULL) |
Draws a formatted text in a rectangle.
Defined as a macro calling DrawTextEx2 passing nIndent as 0 and firstline as NULL.
#define DrawTextEx | ( | hdc, | |
text, | |||
n, | |||
rc, | |||
indent, | |||
format | |||
) | DrawTextEx2 (hdc, text, n, rc, indent, format, NULL) |
Draws a formatted text in a rectangle.
Defined as a macro calling DrawTextEx2 passing firstline as NULL.
#define GetTextAboveLineExtra | ( | hdc | ) | GetDCAttr (hdc, DC_ATTR_ALINE_EXTRA) |
Retrieves the current spacing above line for the DC.
#define GetTextAlign | ( | hdc | ) | GetDCAttr (hdc, DC_ATTR_TEXT_ALIGN) |
Retrieves the current text-alignment flags of a DC.
hdc | The device context. |
#define GetTextBellowLineExtra | ( | hdc | ) | GetDCAttr (hdc, DC_ATTR_BLINE_EXTRA) |
Retrieves the current spacing bellow line for the DC.
#define GetTextCharacterExtra | ( | hdc | ) | GetDCAttr (hdc, DC_ATTR_CHAR_EXTRA) |
Retrieves the current intercharacter spacing for the DC.
Sets the spacing above line for the DC and returns the old value.
Sets text-alignment flags of a DC.
hdc | The device context. |
ta_flags | The flags specify the relationship between a point and a rectangle that bounds the text. The point can be either the current position or coordinates specified by a text-output function. The rectangle that bounds the text is defined by the adjacent character cells in the text string. The ta_flags parameter can be one or more flags from the following three categories. Choose only one flag from each category. |
The first category affects text alignment in the x-direction:
The second category affects text alignment in the y-direction:
The third category determines whether the current position is updated when text is written:
Sets the spacing bellow line for the DC and returns the old value.
Sets the intercharacter spacing for the DC and returns the old spacing value.
#define TabbedTextOut | ( | hdc, | |
x, | |||
y, | |||
text | |||
) | TabbedTextOutLen (hdc, x, y, text, -1) |
Outputs formatted text.
Defined as a macro calling TabbedTextOutLen passing len as -1.
#define TextOut | ( | hdc, | |
x, | |||
y, | |||
text | |||
) | TextOutLen (hdc, x, y, text, -1) |
typedef struct _DTFIRSTLINE DTFIRSTLINE |
First line information of DrawTextEx2
int GUIAPI DrawTextEx2 | ( | HDC | hdc, |
const char * | pText, | ||
int | nCount, | ||
RECT * | pRect, | ||
int | nIndent, | ||
UINT | nFormat, | ||
DTFIRSTLINE * | firstline | ||
) |
Draws a formatted text in a rectangle.
This function draws formatted text (pText) in the specified rectangle (pRect). It formats the text according to the specified method (through nFormat, including expanding tabs, justifying characters, breaking lines, and so forth).
hdc | The device context. |
pText | The formatted text. |
nCount | The length of the text. If it is less than 0, MiniGUI will treat it as a null-terminated string. |
pRect | The output rectangle. |
nIndent | The indent value of the first line. |
nFormat | The methods used to format the text. MiniGUI support the following method to format text so far: |
firstline | If not null, DrawTextEx2 will only calculate the first line will be output in the rectangle, and return the number of the characters and the output width. |
Example:
int GUIAPI GetFontHeight | ( | HDC | hdc | ) |
Retrieves the height of the current logical font in a DC.
This function retrieves the height of the current logical font in the DC hdc.
hdc | The device context. |
Retrieves the last text output position.
hdc | The device context. |
pt | The last text output position will be returned through this pointer. |
int GUIAPI GetMaxFontWidth | ( | HDC | hdc | ) |
Retrieves the maximal character width of the current logical font in a DC.
This function retrieves the maximal character width of the current logical font in the DC hdc.
hdc | The device context. |
Computes the output extent of a formatted text.
This function computes the output extent of the formatted text (spText) with length of len. This function returns the extent in a SIZE struct pointed to by pSize and the width of text as the return value. The output extent will be affected by the default tab size if there are some TAB characters in the text.
hdc | The device context. |
spText | The pointer to the string of text. |
len | The length of the text. |
pSize | The output extent will be returned through this buffer. |
Computes the output extent of a string of text.
This function computes the output extent of the text (spText) with length of len. This function returns the extent in a SIZE struct pointed to by pSize and the width of text as the return value.
hdc | The device context. |
spText | The pointer to the string of text. |
len | The length of the text. |
pSize | The output extent will be returned through this buffer. |
int GUIAPI TabbedTextOutEx | ( | HDC | hdc, |
int | x, | ||
int | y, | ||
const char * | spText, | ||
int | nCount, | ||
int | nTabPositions, | ||
int * | pTabPositions, | ||
int | nTabOrigin | ||
) |
Writes a character string at a specified location, expanding tabs to the values specified in an anrry of tab-stop positions.
This function writes the string spText with length of nCount at a specified locations, expanding tabs to the value spcified in the array pTabPositions of tab-stop positions. The output will start a new line if there is a line feed character '
' in the text.
hdc | The device context. |
x | x,y: The output start position. |
y | x,y: The output start position. |
spText | The formatted text. |
nCount | The length of the text. If it is less than 0, MiniGUI will treat it as a null-terminated string. |
nTabPositions | The length of the array of the tab-stop positions. |
pTabPositions | The array of the tab-stop positions. |
nTabOrigin | The origin of the tab-stops. |
int GUIAPI TabbedTextOutLen | ( | HDC | hdc, |
int | x, | ||
int | y, | ||
const char * | spText, | ||
int | len | ||
) |
Outputs a formatted text.
This function outputs the formatted text spText with length of len at (x,y). This function returns the width of text. The output will start a new line if there is a line feed character '
' in the text. The output will be affected by the default tab size if there are some TAB characters in the text.
hdc | The device context. |
x | x,y: The output start position. |
y | x,y: The output start position. |
spText | The formatted text. |
len | The length of the text. If it is less than 0, MiniGUI will treat it as a null-terminated string. |
int GUIAPI TextOutLen | ( | HDC | hdc, |
int | x, | ||
int | y, | ||
const char * | spText, | ||
int | len | ||
) |
Outputs a string of text.
This function outputs the text spText with length of len at a (x,y). This function returns the width of text.
hdc | The device context. |
x | x,y: The output start position. |
y | x,y: The output start position. |
spText | The string of the text. |
len | The length of the text. If it is less than 0, MiniGUI will treat it as a null-terminated string. |
int GUIAPI TextOutOmitted | ( | HDC | hdc, |
int | x, | ||
int | y, | ||
const char * | mtext, | ||
int | len, | ||
int | max_extent | ||
) |
Outputs a string of text with omitted format.
This function outputs the text mtext with length of len at a (x,y) with omitted format, if width of the text more than max_extent.This function returns the output width of the text.
hdc | The device context. |
x | x,y: The output start position. |
y | x,y: The output start position. |
mtext | The string of the text. |
len | The length of the text. If it is less than 0, MiniGUI will treat it as a null-terminated string. |
max_extent | The max extent of output text. |