⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uilistbox.h

📁 嵌入工linux开发的源码
💻 H
字号:
#ifndef _GUI_LISTBOX_H_
#define _GUI_LISTBOX_H_

#include <pr2k.h>
#include <typedefine.h>
#include <uiGui_cfg.h>
#include <uicontrol.h>
#include <uiutility.h>

/**************************************************************
        Macro define
**************************************************************/
// status of listbox item
enum { ITEM_NOT_SELECTED, ITEM_SELECTED };

// type of GetValue()
enum { LISTBOX_COUNT, LISTBOX_SEL_INDEX, LISTBOX_SEL_COUNT, LISTBOX_LAST_HITED};

// max item length by bytes
#define LISTBOX_ITEM_LENGTH 	63

// icon size
#define LISTBOX_ICON_SIZE		10

// style flag
#define LISTBOX_MULTI_SELECT	0x01
#define LISTBOX_ENABLE_ICON		0x02
#define LISTBOX_MULTI_COLUMN	0x04
#define LISTBOX_POPUP			0x08
#define LISTBOX_NONE_BORDER		0x10

//default gap
#define LISTBOX_DEFAULT_GAP		12

//max column
#define LISTBOX_MAX_COLUMN		10

//for message.y,show that second hited same item.
#define LISTBOX_SECOND_CLICK 1
/**************************************************************
        DATA STRUCTURE
**************************************************************/

typedef struct tagListboxItem
{
	char	szCaption[LISTBOX_ITEM_LENGTH+1] ;	// include NULL character
	short	nStatus ;							//selected or no selected	
	BYTE 	*icon;								// icon image
}TListboxItem;

typedef struct tagListbox
{
	TGuiControl base ;
	
	DList *pItemList ;  				// head of item list
	
	// property 
	short nItemCount ;					// count of items
	short nOffset ;						// first visible item 
	short nSelectedCount ;				// count of selected items
	short nLastHited;					//last hited item
	short nLastSelected;				// last selected item 
	
	short nSecondSelect;
	WORD wGap ; 		                // item height
	HNDL hVScroll ;						// scroll bar in listbox 

	short a_nColumn_Start[LISTBOX_MAX_COLUMN]; //this array for column start address
}TListbox;

/**************************************************************
        FUNCTION DECLARATION
**************************************************************/

/* create a listbox */
DLL_EXP(HNDL) guiListbox_Create( WORD left, WORD top, WORD right, WORD bottom, WORD gap, WORD style) ;

/* delete a listbox */
DLL_EXP(STATUS) guiListbox_Delete( HNDL hListbox ) ;

/* enable a listbox */
DLL_EXP(STATUS) guiListbox_Show( HNDL hListbox ) ;

/* append listbox item */
DLL_EXP(STATUS) guiListbox_AddItem( HNDL hListbox, const char *string) ;

/* insert listbox item */
DLL_EXP(STATUS) guiListbox_InsertItem( HNDL hListbox, WORD index, const char *string) ;

/* remove listbox item */
DLL_EXP(STATUS) guiListbox_RemoveItem( HNDL hListbox, WORD index) ;

/* remove all listbox items */
DLL_EXP(STATUS) guiListbox_RemoveAll( HNDL hListbox ) ;

/* get item content */
DLL_EXP(char*) guiListbox_GetItem( HNDL hListbox, WORD index) ;

/* select item */
DLL_EXP(STATUS) guiListbox_Select( HNDL hListbox, WORD index) ;

/* de-select item */
DLL_EXP(STATUS) guiListbox_Deselect( HNDL hListbox, WORD index) ;

/* get item status */
DLL_EXP(BOOL) guiListbox_IsSelected( HNDL hListbox, WORD index) ;

/* get listbox property */
DLL_EXP(short) guiListbox_GetValue( HNDL hListbox, short type) ;

/* set item icon */
DLL_EXP(STATUS) guiListbox_SetIcon( HNDL hListbox, WORD index, const BYTE *icon) ;

/* display move */
DLL_EXP(int) guiListbox_Move( HNDL hListbox, WORD index);

/*set multi column start address.pColumn is a address array,end by -1 */
DLL_EXP(STATUS) guiListbox_SetColumn(HNDL hListbox,short *pColumn);

/* popup a listbox */
DLL_EXP(STATUS) guiListbox_Popup( HNDL hListbox) ;

/* shrink a popuped listbox */
DLL_EXP(STATUS) guiListbox_Shrink(void) ;

/* popup-list handler: used by touch-pen call-back function */
BOOL guiListbox_PopupListHandler( WORD type, WORD x, WORD y );

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -