/* ========================================================================== * ÆÄ ÀÏ : TextBox.h * ¸ñ Àû : * ÀÛ ¼º ÀÚ : ±è°¡¶÷ * ÀÛ ¼º ÀÏ : 2006-11-07 * ÁÖÀÇ»çÇ× : *===========================================================================*/ #pragma once #include "TextCtrl.h" #include "UINodeData.h" class cUITextLexerT; class cScrollBar; //class cEditBox; class cUIFuncTextNode; class cUIFuncTextParam; struct sInventory; /// ½ºÅ©·Ñ¹Ù À§Ä¡ enum eScrollbarPosType { eRIGHT_SCROLLBAR, eLEFT_SCROLLBAR, }; /// ¹®ÀÚ¿­ »óÀÚ class cTextBox : public cTextCtrl { public: cTextBox( eUINodeType type = eUINODE_TEXTBOX ); virtual ~cTextBox(); /// ÅØ½ºÆ® ¹Ú½ºÀÇ ÀÖ´Â ³»¿ëÀ» ¸ðµÎ Áö¿î´Ù void Clear(); /// »õ·Î¿î ¶óÀÎ Ãß°¡¿ë int AddNewRow( LPCTSTR text, unsigned long textcolor, sInventory* inventory = 0 ); /// ±âÁ¸¶óÀÎ ¿¬°á Ãß°¡¿ë void AddPasteRow( LPCTSTR text, unsigned long textcolor, sInventory* inventory = 0 ); /// ±â´É¼º ÅØ½ºÆ® Ãß°¡ ( npc_note, quest_note µî ) bool AddFucnText( cUIFuncTextNode* textNode, cUIFuncTextParam* textParam ); /// ¶óÀÎ »ðÀÔ ( ºó °ø¹é ) void AddEmptyRow( unsigned int line ); /// ÇØ´ç ¶óÀÎÀÇ ÅØ½ºÆ® °»½Å void UpdateRowText( int line, LPCTSTR text ); /// ÅØ½ºÆ®¹Ú½º¿¡ µé¾î°¡´Â ÃÖ´ë Çà¼ö unsigned int GetMaxRowInPage(); /// Çà³ôÀÌ °¡Á®¿À±â unsigned int GetRowHeight() const; /// ÅØ½ºÆ®¹Ú½ºÀÇ »çÀÌÁî º¯È­¿¡ µû¸¥ ¸ðµç Á¤º¸ °»½Å void UpdateTextBox( bool add ); /// ÅØ½ºÆ®¹Ú½º ½ºÅ¸ÀÏ Á¶Á¤ °ü·ÃºÎ /// ½ºÅ©·Ñ¹Ù Y À§Ä¡ ¼³Á¤ ( addh °ª¸¸Å­ ³»·Á Âï±â ) void SetScrollbar( unsigned int addh ); /// ÅØ½ºÆ® Ãâ·ÂÀ§Ä¡¸¦ ¾Æ·¡¼­ºÎÅÍ·Î Á¶Á¤ ( Ç÷¡±×°ª) void SetDrawTextBottom( bool down ); /// ÅØ½ºÆ®ÀԷ½à ½ºÅ©·Ñ¹Ù¸¦ ¸Ç¾Æ·¡·Î °»½Å void SetScrollBottom( bool bottom ); void SetChatMode( bool bChat ); protected: /// À̺¥Æ® ó¸® virtual bool HandleEvent( const cUIEvent& event ); virtual void OnRender( cUIFontItemKeeper* pKeeper ); virtual void OnMouseMove( const cUIPos& pos ) {} virtual void OnLButtonDown(const cUIPos& pos, bool ctrl, bool alt, bool ); virtual void OnMouseWheel( const cUIPos& pos, int wheel ); virtual void OnScrollbarMoved( const cUIPos& pos ); virtual bool SetSkin( const cUINodeSkin* pskin ); virtual void UpdateSkin(); virtual void UpdateRect(); /// ÀڽĻý¼º bool OnCreate( cUINodeProperty* pproperty ); /// ¹öư »óÅ üũ void CheckButtonEvent( unsigned int id ); /// »çÀÌÁî°¡ º¯ÇÏ´Â ½ºÅ©·Ñ¹Ù¸¦ ±×·ÁÁÜ. void UpdateScrollBarButton(); /// topindex¿¡ µû¸¥ ½ºÅ©·Ñ¹Ù À§Ä¡ º¯È­ void UpdateScrollBarPos(); /// ÅØ½ºÆ® ÁÂÇ¥ ¾÷µ¥ÀÌÆ® void UpdateText(); /// ÆÄ½Ì bool ParseCommand( cUITextLexerT& lexer ); protected: /// ½ºÅ©·Ñ ½ºÅ² ³×ÀÓ cString mScrollSkin; /// ½ºÅ©·Ñ¹Ù cScrollBar* mpScrollBar; /// ÅØ½ºÆ® Ãâ·Â À§Ä¡ int mTextPosX, mTextPosY, mNextPosY; /// ½ºÅ©·Ñ¹Ù¸¦ À§Ä¡Å¸ÀÔ (ÅØ½ºÆ®¹Ú½º±âÁØ) eScrollbarPosType mScrollbarPosType; /// ÅØ½ºÆ® Ãâ·ÂÀ§Ä¡¸¦ ¾Æ·¡ºÎÅÍ ½ÃÀÛ bool mDrawTextBottom; /// »õ ÅØ½ºÆ® ÀԷ½à ½ºÅ©·Ñ¹Ù À§Ä¡ ¼¼ÆÃ bool mScrollBottom; /// ½ºÅ©·Ñ¹Ù »çÀÌÁî º¸Á¤ unsigned int mFixScrollH; /// ÃÖ´ë Çà¼ö unsigned int mMaxRowInPage; /// ¾ÆÀÌÅÛÀÇ ³ôÀ̼³Á¤ unsigned int mRowHeight; /// Ç¥½Ã ½ÃÀÛ Çà unsigned int mTopRowIdx; /// ±ÛÀÚ»ö unsigned long mTextColor; bool mIncreseTopRowIdx; bool mChatMode; }; inline void cTextBox::SetDrawTextBottom( bool down ) { mDrawTextBottom = down; } inline void cTextBox::SetScrollBottom( bool bottom ) { mScrollBottom = bottom; } inline void cTextBox::SetChatMode( bool bChat ) { mChatMode = bChat; mScrollBottom = false; } inline unsigned int cTextBox::GetRowHeight() const { return mRowHeight; } inline unsigned int cTextBox::GetMaxRowInPage() { mMaxRowInPage = (GetAbsoluteRect().GetHeight() / mRowHeight); return mMaxRowInPage; } ////////////////////////////////////////////////////////////////////////////////// class cTextBoxSkin : public cUINodeSkin { public: cTextBoxSkin( eUINodeType type = eUINODE_TEXTBOX ); virtual ~cTextBoxSkin(); /// ·Îµù virtual bool Load( cParser& parser ); public: /// ½ºÅ©·Ñ¹Ù¸¦ ¿À¸¥ÂÊ¿¡ µÑ°ÍÀÎÁö ¿©ºÎ (ÅØ½ºÆ®¹Ú½º±âÁØÀ¸·Î ¿À¸¥ÂÊ) bool mScrollBarRightPos; /// ÅØ½ºÆ® ¹Ú½º ÇÑÁÙ ³ôÀÌ unsigned int mRowHeight; /// ÅØ½ºÆ®¹Ú½º°¡ ´ãÀ»¼ö ÀÖ´Â ÃÖ´ë °¹¼ö int mTotalMaxNum; /// ½ºÅ©·Ñ ½ºÅ² ³×ÀÓ cString mScrollSkin; };