📄 listbox.h
字号:
//! Sets the text color of a listbox widget.
//!
//! \param pWidget is a pointer to the listbox widget to be modified.
//! \param ulColor is the 24-bit RGB color to use to draw text on the listbox.
//!
//! This function changes the color used to draw text on the listbox on the
//! display. The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ListBoxTextColorSet(pWidget, ulColor) \
do \
{ \
tListBoxWidget *pW = pWidget; \
pW->ulTextColor = ulColor; \
} \
while(0)
//*****************************************************************************
//
//! Sets the text color of the selected element in a listbox widget.
//!
//! \param pWidget is a pointer to the listbox widget to be modified.
//! \param ulColor is the 24-bit RGB color to use to draw the selected text
//! on the listbox.
//!
//! This function changes the color used to draw the selected element text
//! on the display. The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ListBoxSelectedTextColorSet(pWidget, ulColor) \
do \
{ \
tListBoxWidget *pW = pWidget; \
pW->ulSelectedTextColor = ulColor; \
} \
while(0)
//*****************************************************************************
//
//! Changes the text associated with an element in the listbox widget.
//!
//! \param pWidget is a pointer to the listbox widget to be modified.
//! \param pcTxt is a pointer to the new text string.
//! \param ulIndex is the index of the element whose string is to be replaced.
//!
//! This function replaces the string associated with one of the listbox
//! elements. This call should only be used to replace a string for an
//! already-populated element. To add a new string, use ListBoxTextAdd().
//! The display is not updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ListBoxTextSet(pWidget, pcTxt, ulIndex) \
do \
{ \
tListBoxWidget *pW = pWidget; \
const char *pcT = pcTxt; \
if(ulIndex < pW->usMaxEntries) \
{ \
pW->ppcText[ulIndex] = pcT; \
} \
} \
while(0)
//*****************************************************************************
//
//! Locks a listbox making it ignore attempts to select elements.
//!
//! \param pWidget is a pointer to the listbox widget to modify.
//!
//! This function locks a listbox widget and makes it ignore attempts to
//! select or deselect an element. When locked, a listbox acts as a passive
//! indicator. Strings may be added and the selected element changed via
//! calls to ListBoxSelectioSet() but pointer activity will not change the
//! selection and no callbacks will be made. In this mode, the user may still
//! use the pointer to scroll the content of the listbox assuming it contains
//! more strings that can be displayed in the widget area.
//!
//! \return None.
//
//*****************************************************************************
#define ListBoxLock(pWidget) \
do \
{ \
tListBoxWidget *pW = pWidget; \
pW->ulStyle |= LISTBOX_STYLE_LOCKED; \
} \
while(0)
//*****************************************************************************
//
//! Unlocks a listbox making it respond to pointer input.
//!
//! \param pWidget is a pointer to the listbox widget to modify.
//!
//! This function unlocks a listbox widget. When unlocked, a listbox will
//! respond to pointer input by setting its selected element appropriately and
//! informing the application of changes via callbacks.
//!
//! \return None.
//
//*****************************************************************************
#define ListBoxUnlock(pWidget) \
do \
{ \
tListBoxWidget *pW = pWidget; \
pW->ulStyle &= ~(LISTBOX_STYLE_LOCKED); \
} \
while(0)
//*****************************************************************************
//
//! Enables wrapping in a listbox.
//!
//! \param pWidget is a pointer to the listbox widget to modify.
//!
//! This function enables text wrapping in a listbox widget. With wrapping
//! enabled, calls to ListBoxTextAdd() made when the widget string table is
//! full will discard the oldest string in favor of the new one. If wrapping
//! is disabled, these calls will fail.
//!
//! \return None.
//
//*****************************************************************************
#define ListBoxWrapEnable(pWidget) \
do \
{ \
tListBoxWidget *pW = pWidget; \
pW->ulStyle &= ~(LISTBOX_STYLE_WRAP); \
} \
while(0)
//*****************************************************************************
//
//! Disables text wrapping in a listbox.
//!
//! \param pWidget is a pointer to the listbox widget to modify.
//!
//! This function disables text wrapping in a listbox widget. With wrapping
//! enabled, calls to ListBoxTextAdd() made when the widget string table is
//! full will discard the oldest string in favor of the new one. If wrapping
//! is disabled, these calls will fail.
//!
//! \return None.
//
//*****************************************************************************
#define ListBoxWrapDisable(pWidget) \
do \
{ \
tListBoxWidget *pW = pWidget; \
pW->ulStyle |= LISTBOX_STYLE_WRAP; \
} \
while(0)
//*****************************************************************************
//
//! Empties the listbox.
//!
//! \param pWidget is a pointer to the listbox widget to modify.
//!
//! This function removes all text from a listbox widget. The display is not
//! updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ListBoxClear(pWidget) \
do \
{ \
tListBoxWidget *pW = pWidget; \
pW->usPopulated = 0; \
pW->sSelected = (short)0xFFFF; \
pW->usStartEntry = 0; \
pW->usOldestEntry = 0; \
} \
while(0)
//*****************************************************************************
//
//! Sets the current selection within the listbox.
//!
//! \param pWidget is a pointer to the listbox widget to modify.
//! \param sSel is the index of the item to select.
//!
//! This function selects an item within the list box. The display is not
//! updated until the next paint request.
//!
//! \return None.
//
//*****************************************************************************
#define ListBoxSelectionSet(pWidget, sSel) \
do \
{ \
tListBoxWidget *pW = pWidget; \
if((sSel) < pW->usPopulated) \
{ \
pW->sSelected = (sSel); \
} \
} \
while(0)
//*****************************************************************************
//
//! Gets the index of the current selection within the listbox.
//!
//! \param pWidget is a pointer to the listbox widget to be queried.
//!
//! This function returns the index of the item currently selected in a
//! listbox. If no selection has been made, 0xFFFF (-1) is returned.
//!
//! \return None.
//
//*****************************************************************************
#define ListBoxSelectionGet(pWidget) (((tListBoxWidget *)(pWidget))->sSelected)
//*****************************************************************************
//
// Prototypes for the listbox widget APIs.
//
//*****************************************************************************
extern long ListBoxMsgProc(tWidget *pWidget, unsigned long ulMsg,
unsigned long ulParam1, unsigned long ulParam2);
extern void ListBoxInit(tListBoxWidget *pWidget, const tDisplay *pDisplay,
const char **ppcText, unsigned short usMaxEntries,
unsigned short usPopulatedEntries, long lX, long lY,
long lWidth, long lHeight);
extern long ListBoxTextAdd(tListBoxWidget *pWidget, const char *pcTxt);
//*****************************************************************************
//
// Mark the end of the C bindings section for C++ compilers.
//
//*****************************************************************************
#ifdef __cplusplus
}
#endif
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************
#endif // __LISTBOX_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -