/* ========================================================================== * ÆÄ ÀÏ : ListBox.h * ¸ñ Àû : * ÀÛ ¼º ÀÚ : ±è°¡¶÷ * ÀÛ ¼º ÀÏ : 2006-10-19 * ÁÖÀÇ»çÇ× : *===========================================================================*/ #pragma once #include "ListCtrl.h" #include "UINodeData.h" class cScrollBar; class cPlaneObject; class cListBox : public cListCtrl { public: cListBox( eUINodeType type = eUINODE_LISTBOX ); virtual ~cListBox(); /// Ŭ¸®¾î virtual void Clear(); virtual int AddRow( LPCTSTR str, unsigned long color, void* pExtraData = 0 ); /// »õ·Î¿î ÇàÀ» »ý¼ºÇϰí ÇϳªÀÇ ¿­À» Ãß°¡ÇÑ´Ù. virtual bool AddColume( unsigned int rowIdx, LPCTSTR str, unsigned long color ); /// ƯÁ¤ ¶óÀο¡ ¿­À» Ãß°¡ÇÑ´Ù. /// void SetExtraData( unsigned int rowIdx, void* pExtraData ); /// ¸®½ºÆ®ÀÇ ¼±ÅÃÀ妽º º¯°æ bool ChangeSelectRow( unsigned int rowIdx, bool changeTop = true ); /// ¸®½ºÆ®ÀÇ Ãâ·Â Ãʱâ À妽º º¯°æ bool ChangeTopIndex( unsigned int topIdx, bool changeSel = true ); void ChangeTextColor( unsigned int rowIdx, unsigned long color ); /// ½ºÅ©·Ñ¹Ù ½ºÅ²À̸§ ¼¼ÆÃ void SetScrollSkin( const cString& name ); inline void SetHoverTextColor( unsigned long color ) { mHoverTextColor = color; } /// ÀÌ¹Ì ¼±ÅõǾîÀÕ´Â ¿­À» ´­·¯µµ À̺¥Æ® º¸³»ÁÜ void SetContinueEvent( bool set ) { mContinueEvent = set; } /// ¼±ÅÃµÈ À妽º ¹Þ¾Æ¿À±â ( ¾ÆÀÌÅÛÀÇ ) unsigned int GetSelectIndex() const; unsigned int GetCurrentTopIndex() const; unsigned int GetRowHeight() { return mRowHeight; } unsigned int GetMaxRowNum() const; unsigned int GetMaxRowInPage() { return mMaxRowInPage; } LPCTSTR GetText( unsigned int rowIdx = 0, unsigned int colIdx = 0 ); // ½ºÅ©¸³Æ® ÀÖ´Â ÇØ´ç Ä÷³ ÃÖ´ë »çÀÌÁî unsigned int GetColumnMaxWidth( unsigned int colIndex ); protected: virtual bool OnCreate( cUINodeProperty* pproperty ); virtual bool HandleEvent( const cUIEvent& event ); virtual void OnRender( cUIFontItemKeeper* pKeeper ); virtual void OnMouseMove( const cUIPos& pos ); virtual void OnMouseLeft( const cUIPos& pos ); virtual void OnLButtonDown( const cUIPos& pos, bool ctrl, bool alt, bool shift ); virtual void OnRButtonDown( const cUIPos& pos, bool ctrl, bool alt, bool shift ); virtual void OnMouseWheel( const cUIPos& pos, int wheel ); virtual void OnLButtonDoubleClick( const cUIPos& pos ); virtual void OnScrollbarMoved( const cUIPos& pos ); virtual bool SetSkin( const cUINodeSkin* pskin ); virtual void UpdateSkin(); virtual void UpdateRect(); /// ½ºÅ©·Ñ¹ÙÀÇ »óÅ º¯°æ virtual void UpdateScrollBar(); /// ¼±Åà À̹ÌÁö ÁÂÇ¥ ¾÷µ¥ÀÌÆ® virtual void UpdateSelectImage(); /// ¹öư »óÅ üũ virtual void CheckButtonEvent( unsigned int id ); /// ¸®½ºÆ® ¹Ú½ºÀÇ ¾ÆÀÌÅÛÀ» ±×·ÁÁÜ. virtual void RenderData( cUIFontItemKeeper* pKeeper ); /// ÅØ½ºÆ® Ãâ·ÂÀ§Ä¡ °è»ê unsigned int UpdateTextPos( eText_Align align, unsigned int strWidth, unsigned int x, unsigned int w ); virtual void CheckShowImage(); /// ¶óÀÎÀÇ Æ¯Á¤ ¿­Á¤º¸¸¦ °¡Á®¿Â´Ù. sData* GetColumeData( unsigned int rowIdx, unsigned int columeIdx ); protected: /// ¸®½ºÆ®¹Ú½º¿ë ½ºÅ² ÀúÀå cUINodeSkin* mpSkin; cString mScrollSkin; /// ½ºÅ©·Ñ¹Ù cScrollBar* mpScrollBar; /// ¾ÆÀÌÅÛ ¼±Åýà ÀÇ À̹ÌÁö cPlaneObject* mpSelectImage; /// ¼±ÅÃ¹Ù Æø unsigned int mSelectBarWidth; /// À̹ÌÁö ÅØ½ºÃÄ ·ºÆ® cUIRect mImageRc; bool mShowImage; /// Ç¥½Ã ½ÃÀÛ Çà unsigned int mTopRowIdx; /// ¼±Åà Çà unsigned int mSelectedRowIdx; /// ¾Æ¹«°Íµµ ¾øÀ»¶§ -1 /// -1 > mHoveredRowIdx, mHoveredRowIdx< mMaxRowInPage int mHoveredRowIdx; int mImageHoveredIdx; unsigned long mHoverTextColor; /// ÇàÀÇ ³ôÀÌ unsigned int mRowHeight; /// ÃÖ´ë Çà¼ö unsigned int mMaxRowInPage; /// ¸®½ºÆ®°¡ ÃÑ ¼ö¿ëÇÏ´Â ¶óÀÎ ¼ö unsigned int mTotalMaxNum; /// µ¿ÀÏÇÑ ¿­À»¼±ÅÃÇØµµ À̺¥Æ® º¸³»ÁÖ´Â Ç÷¡±× bool mContinueEvent; /// ¸®½ºÆ® ÅØ½ºÆ® Ãâ·Â °ø°£¼³Á¤ cUIPos mPrintPos; cUISize mPrintSize; }; inline unsigned int cListBox::GetSelectIndex() const { return mSelectedRowIdx; } inline unsigned int cListBox::GetCurrentTopIndex() const { return mTopRowIdx; } inline unsigned int cListBox::GetMaxRowNum() const { return mTotalMaxNum; } inline void cListBox::SetScrollSkin( const cString& name ) { mScrollSkin = name; } ////////////////////////////////////////////////////////////////////////////// /// ¸®½ºÆ®ÄÁÆ®·Ñ ÀÎÀÚ struct sListCtrlParam { /// Ä÷³ ½ÃÀÛ À§Ä¡ unsigned int mColumnX; /// Ä÷³ ³Êºñ unsigned int mColumnW; /// Ä÷³ ³» Á¤·Ä ŸÀÔ eText_Align mAlign; }; /// class cListBoxSkin : public cUINodeSkin { public: cListBoxSkin( eUINodeType type = eUINODE_LISTBOX ); virtual ~cListBoxSkin(); /// ·Îµù virtual bool Load( cParser& parser ); /// sListCtrlParam* GetCtrlParam( unsigned int index ); public: /// ¸®½ºÆ®¹Ú½ºÀÇ ÇÑÁÙ ³ôÀÌ unsigned int mRowHeight; /// ÅØ½ºÆ®¹Ú½º°¡ ´ãÀ»¼ö ÀÖ´Â ÃÖ´ë °¹¼ö int mTotalMaxNum; public: /// ¸®½ºÆ® ÄÁÆ®·Ñ µ¥ÀÌÅÍ ¹è¿­ typedef tPointerArray cLCtrlParam; cLCtrlParam mCtrlParamArr; cString mScrollSkin; /// À̹ÌÁö »ðÀÔ À§Ä¡ µ¥ÀÌÅÍ sListCtrlParam* mpImgParam; /// NiTexture* mpSelectBarTexture; /// ui image ½ºÅ² Á¤º¸ sSkinInfo* mSelectBarSkin; /// ¼±ÅÃ¹Ù Æø unsigned int mSelectBarWidth; /// ¸®½ºÆ® ÅØ½ºÆ® Ãâ·Â °ø°£¼³Á¤ cUIPos mPrintPos; cUISize mPrintSize; };