//-----------------------------------------------------------------------------
// LISTBOX
//-----------------------------------------------------------------------------

#ifndef _NWLISTBOX_H_
#define _NWLISTBOX_H_

class NWLBSCR;
typedef NWLBSCR *PNWLBSCR;

//-----------------------------------------------------------------------------
class NWLBSCR: public NWSCROLL {
	friend class NWLISTBOX;
protected:
	NWLBSCR( void );
public:
	NWLBSCR( PNWCONTROL pRootControl );
	~NWLBSCR( void );
	
	void GoScroll( int nTag, int nVal );
	int MsgMouseMove( PNWMESSAGE pMessage );
};
//-----------------------------------------------------------------------------

typedef struct {
	int		nFlags;
	int		nIconIndex;
	int		nData;
	void*	pData;
} NWBOXITEM, *PNWBOXITEM;

class NWLISTBOX: public NWGRAPHIC {
	friend class NWLBSCR;
protected:
	PNWLBSCR	pScroll;
	int			nMaxLength;
	int			nCapacity;
	int			nItemHeight;
	void*		pItems;
	
	int			nPosition;
	int			nSelect;
	
	NWCOLOR		sSelColor[4];
	NWCOLOR		sFontColor;
	NWCOLOR		sFontColorR;
	
	void Grow( void );
	void SetCapacity( int nNewCapacity );
	void Scroll( void );
	NWLISTBOX( void );
public:
	int			nCount;
	
	NWLISTBOX( PNWCONTROL pRootControl );
	~NWLISTBOX( void );
	
	PNWBOXITEM Get( int nIndex );
	char* GetString( int nIndex );
	int AddItem( int nIconIndex, int nData, void* pData, char *pString );
	void SetMaxLength( int nMax );
	void Clear( void );
	
	void SetItemHeight( int nNewHeight );
	int GetItemHeight( void );
	
	int GetPosition( void );
	void SetSelect( int nNo );
	int GetSelect( void );
	
	int MsgPaint( PNWMESSAGE pMessage );
	int MsgMouseDown( PNWMESSAGE pMessage );
	int MsgMouseUp( PNWMESSAGE pMessage );
	int MsgMouseMove( PNWMESSAGE pMessage );
	int MsgShortCut( PNWMESSAGE pMessage );
};

//-----------------------------------------------------------------------------
#endif
