#include "StdAfx.h" #include "FriendListbox.h" #include "ListBox.h" #include "UIImage.h" #include "FontAgent.h" cFriendListbox::cFriendListbox( eUINodeType type ) : cListBox( type ) { } cFriendListbox::~cFriendListbox() { } /// ÁÖÀÇ»çÇ× : ¸®½ºÆ® ¾ÆÀÌÅÛ ±×·ÁÁÖ±â void cFriendListbox::RenderData( cUIFontItemKeeper* pKeeper ) { /// Àüü ¸®½ºÆ®¸¦ ¾ò¾î¿È if( GetRowCount() <= 0 ) return; /// ½ºÅ² ¹Þ¾Æ¿À±â cListBoxSkin* pListSkin = (cListBoxSkin*)mpSkin; if( !pListSkin ) return; /// ¸®½ºÆ® ¹Ú½ºÀÇ ÁÂÇ¥ ¹Þ¾Æ¿À±â int textposX = 0; int textPosY = GetAbsoluteRect().mTop; unsigned int rowCount = ( mMaxRowInPage > GetRowCount() )? GetRowCount() : mMaxRowInPage; for( unsigned int row = mTopRowIdx; row < mTopRowIdx + rowCount; ++row ) { sRowData* rData = GetRowData( row ); if( !rData ) continue; /// image Ãâ·Â if( rData->mImage ) { cUIImage* image = rData->mImage; sListCtrlParam* pParam = pListSkin->mpImgParam; unsigned int imageX = pParam->mColumnX; unsigned int imageY = textPosY + (int)((mRowHeight-image->GetHeight())*0.5f); image->SetPos( GetAbsoluteRect().mLeft + imageX, imageY ); image->Draw(); } /// ¸®½ºÆ® µ¥ÀÌÅÍ Ãâ·Â unsigned int colCount = rData->mColumes.GetSize(); unsigned int fixposY = textPosY; for( unsigned int col = 0; col< colCount; ++col ) { /// °¢ Ä÷³ µ¥ÀÌÅÍ °¡Á®¿À±â sData* data = rData->mColumes[col]; sListCtrlParam* pParam = pListSkin->GetCtrlParam( col ); unsigned int tX = 0; unsigned int tW = 0; eText_Align align = eALIGN_LEFT; if( pParam ) { tX = pParam->mColumnX; tW = pParam->mColumnW; align = pParam->mAlign; } /// ÃÖÁ¾ Ãâ·Â ÁÂÇ¥ °è»ê unsigned int strWidth = FONTAGENT->GetTextExtent( cFontAgent::eFont_System, (LPTSTR)data->mText.Cstr(), data->mText.GetLength() ); textposX = UpdateTextPos( align, strWidth, tX, tW ); /// Hover µÈ ¾ÆÀÌÅÛÀº ´Ù¸¥ »öÀ¸·Î Ç¥½Ã unsigned color = data->mTextColor; if( mHoveredRowIdx != -1 && row - mTopRowIdx == (unsigned int)mHoveredRowIdx ) color = eCOLOR_RED; pKeeper->AddFontItem( cFontAgent::eFont_System, (LPTSTR)data->mText.Cstr(), textposX, fixposY + 5, color ); /// µÎ¹øÂ° Ä÷³ºÎÅÍ´Â ¹Ù·Î ÇÑÁÙ ¹Ø¿¡ Âï´Â´Ù fixposY += FONTAGENT->GetTextHeight(cFontAgent::eFont_System) + 2; } textPosY += mRowHeight; } }