// MBOrgFunc.cpp : implementation file
|
//
|
|
#include "stdafx.h"
|
#include "mborg.h"
|
#include "MBOrgFunc.h"
|
|
|
// CMBOrgFunc
|
|
CMBOrgFunc::CMBOrgFunc()
|
{
|
}
|
|
CMBOrgFunc::~CMBOrgFunc()
|
{
|
}
|
|
|
// CMBOrgFunc member functions
|
|
//==================================================
|
// ÅжÏÊÇ·ñΪÔÚÏßÓû§
|
//==================================================
|
bool CMBOrgFunc::IsOnlineUser( int nStatus )
|
{
|
if( nStatus == AM_USERSTATUS_NLN ||
|
nStatus == AM_USERSTATUS_AWY ||
|
nStatus == AM_USERSTATUS_BSY ||
|
nStatus == AM_USERSTATUS_BRB ||
|
nStatus == AM_USERSTATUS_PHN ||
|
nStatus == AM_USERSTATUS_LUN ||
|
nStatus == AM_USERSTATUS_AAY ||
|
nStatus == AM_USERSTATUS_AWM ||
|
nStatus == AM_USERSTATUS_AWP ||
|
nStatus == AM_USERSTATUS_AWO )
|
return true;
|
return false;
|
}
|
int CMBOrgFunc::GetElementCount(CString strStuff,CString strApart)
|
{
|
int nCount = 0;
|
CString strTemp,strTempItem;
|
|
strTemp = strStuff;
|
while( GetElementItem(strTemp, strTempItem,strApart) )
|
nCount++;
|
|
return nCount;
|
}
|
BOOL CMBOrgFunc::GetElementItem(CString &strStuff, CString &strItem,CString strApart)
|
{
|
if( strStuff.GetLength() == 0 )
|
{
|
strItem = _T("");
|
return FALSE;
|
}
|
int pos = strStuff.Find(strApart);
|
if( pos >= 0 )
|
{
|
strItem = strStuff.Left(pos);
|
strStuff = strStuff.Right( strStuff.GetLength() - pos - strApart.GetLength() );
|
}
|
else
|
{
|
strItem = strStuff;
|
strStuff = _T("");
|
}
|
return TRUE;
|
}
|
|
CAutoRefPtr<IBitmap> CMBOrgFunc::GetFixSizeImage(IBitmap * pBitmap,int nWidth,int nHeight)
|
{
|
//if (!m_pSkin) return NULL;
|
CAutoRefPtr<IRenderTarget> pRT;
|
if( !(nWidth > 0 && nHeight > 0 ))
|
{
|
return pBitmap;
|
}
|
SOUI::CRect rc(0,0,nWidth,nHeight);
|
GETRENDERFACTORY->CreateRenderTarget(&pRT, nWidth,nHeight);
|
rc.MoveToXY(0, 0);
|
pRT->ClearRect(&rc, 0);
|
CAutoRefPtr<IBrush> br;
|
pRT->CreateSolidColorBrush(RGBA(0xBA, 0xB3, 0x99, 0xFF), &br);
|
pRT->SelectObject(br);
|
pRT->FillEllipse(&rc);
|
pRT->SetXfermode(kSrcIn_Mode);
|
if( pBitmap != NULL )
|
{
|
FilterLevel fl = FilterLevel::kHigh_FilterLevel;
|
SOUI::CRect rcImg(SOUI::CPoint(0,0),pBitmap->Size());
|
pRT->DrawBitmapEx(rc, pBitmap, &rcImg, MAKELONG(EM_STRETCH, fl));
|
}
|
IBitmap * pBmp = NULL;
|
IBitmap * pTempBmp = (IBitmap*)(pRT->GetCurrentObject(OT_BITMAP));
|
pTempBmp->Clone(&pBmp);
|
return pBmp;
|
}
|