//-----------------------------------------------------------------------------
// エディットボックス
//-----------------------------------------------------------------------------

#ifndef _NWEDIT_H_
#define _NWEDIT_H_

//-----------------------------------------------------------------------------

typedef enum {
	NW_NUM_STRING			,
	NW_NUM_DECIMAL			,
	NW_NUM_HEXADECIMAL		,
	NW_NUM_PAD = 0xffffffff
} NWNUMMODE;

class NWEDIT: public NWGRAPHIC {
protected:
	int			nLength;
	int			nMaxLength;
	int			nScrollPos;
	int			nCursorPos;
	int			nSelStart;
	int			nSelEnd;
	int			bInsert;
	NWNUMMODE	eNumMode;
	int			nValue;
	char		xText[512];
	
	NWCOLOR		sSelColor[4];
	NWCOLOR		sCsrColor[4];
	NWCOLOR		sF0Color;
	NWCOLOR		sF1Color;
	
	NWEDIT( void );
	int DefaultDelete( void );
	void Value2Text( void );
	void Text2Value( void );
public:
	NWEDIT( PNWCONTROL pRootControl );
	~NWEDIT( void );
	
	void SetText( char* pStr );
	char* GetText( void );
	void Clear( void );
	
	void SetNumMode( NWNUMMODE eMode );
	NWNUMMODE GetNumMode( void );
	void SetValue( int nNewVal );
	int GetValue( void );
	
	int MsgPaint( PNWMESSAGE pMessage );
	int MsgKeyDown( PNWMESSAGE pMessage );
};

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