Esempio n. 1
0
//设置控件文本大小颜色
TFont CtrlSetFont(TCtrl *pCtrl, Int32 nFontSize, ColorRefType nColor)
{
	TFont tFont;
	tFont.Create(nFontSize, nFontSize);
	pCtrl->SetColor(CTL_COLOR_TYPE_FORE, nColor);
	return pCtrl->SetFont(tFont);
}
Esempio n. 2
0
Int32 CtrlAddItemToWin_Label(TWindow*pWin, Coord nX, Coord nY, Coord nWidth, Int32 FontSize, TUChar* pszString, ColorRefType Color)
{
	TLabel* pLabel = new TLabel();
	Int32  nLabelID = 0;

	if(pLabel->Create(pWin))	
	{
		TRectangle obBtnRec(0,0,0,0);
		if(nWidth == 0)
		{
			nWidth = 80;
			obBtnRec.SetRect(nX, nY, nWidth, FontSize);
			pLabel->SetBounds(&obBtnRec);
			pLabel->SetAutoSize(TRUE);

			CtrlSetFont((TCtrl*)pLabel, FontSize, Color);
			pLabel->SetCaption(pszString,FALSE);
		}
		else
		{
			obBtnRec.SetRect(nX, nY, nWidth, FontSize);
			pLabel->SetBounds(&obBtnRec);
			pLabel->SetAutoSize(FALSE);
			pLabel->SetScrollMode(lsmNone);

			TFont tFont;
			tFont.Create(FontSize, FontSize);
			ShowAsShort((TCtrl *)pLabel, pszString, tFont);
			pLabel->SetFont(tFont);
			pLabel->SetColor(CTL_COLOR_TYPE_FORE, Color);
		}
	}
	return nLabelID;
}
Esempio n. 3
0
//添加Label控件到CoolBarList, 
// pszString必须是动态的(非Static)
// nWidth 为0 -- 自动长度
Int32 CtrlAddItemToCoolBarList_Lable(TWindow*pWin,  TBarListItem* pListItem, Coord nX, Coord nY, Coord nWidth, Int32 FontSize, TUChar* pszString, ColorRefType Color)
{
	TRectangle obBtnRec(0,0,0,0);
	Int32 nLabelNameId = pListItem->AddCtrl(CTL_CLASS_LABEL, 0, 0);
	TLabel* pLabelName = static_cast<TLabel*>(pWin->GetControlPtr(nLabelNameId));
	if(nWidth == 0)
	{
		nWidth = 80;
		obBtnRec.SetRect(nX, nY, nWidth, FontSize);
		pLabelName->SetBounds(&obBtnRec);
		pLabelName->SetAutoSize(TRUE);

		CtrlSetFont((TCtrl*)pLabelName, FontSize, Color);
		pLabelName->SetCaption(pszString,FALSE);
	}
	else
	{
		obBtnRec.SetRect(nX, nY, nWidth, FontSize+6);	//调整高度,防止字体底部被截断
		pLabelName->SetBounds(&obBtnRec);
		pLabelName->SetAutoSize(FALSE);
		pLabelName->SetScrollMode(lsmNone);

		TFont tFont;
		tFont.Create(FontSize, FontSize);
		ShowAsShort((TCtrl *)pLabelName, pszString, tFont);
		pLabelName->SetFont(tFont);
		pLabelName->SetColor(CTL_COLOR_TYPE_FORE, Color);
	}

	pLabelName->SetEnabled(FALSE);
	
	return nLabelNameId;
}
void __fastcall TCustomDrawDemoEditorForm::sbFontClick(TObject *Sender)
{
  if (FontDialog->Execute()){
    TFont *AFont = new TFont();
    AFont->Assign(FontDialog->Font);
    GetSelectedDrawItem()->Font = AFont;
    CustomDrawDemoMainForm->cxDBVerticalGrid->Invalidate();
  }
}
Esempio n. 5
0
//创建应用标题默认居中
//pApp --应用指针
//TitleStringResId --标题字串ID, 默认为0
//TitleString --标题字串,默认为空NULL
//color--标题颜色,默认为白:RGB_COLOR_WHITE
//nFontSize 字体大小
//返回控件ID
Int32 SetAppTilte(TWindow * pWindow, Int32 nTitleStringResId, TUChar* pTitleString, ColorRefType Color, Int32 nFontSize)
{
	Int32 m_TitleCtlID = 0;

	TCtrl *m_TitleContrl;
	TRectangle TitleRC(0,0,0,0);
	TRectangle WindowRC(0, 0, 0, 0);
	TFont tFont;
	Int32 nTitleWidth = 0;
	Boolean bNeedShort = FALSE;
	TUChar sTitleString[128] ={0};

	if(nTitleStringResId == 0)//说明传进的是字串
	{
		if(pTitleString)
		{
			TUString::StrNCopy(sTitleString, pTitleString, sizeof(sTitleString));
		}
	}
	else
	{
		TUString::StrNCopy(sTitleString, TResource::LoadConstString(nTitleStringResId), sizeof(sTitleString));
	}
	
	tFont.Create(nFontSize, nFontSize,  FONT_STYLE_BOLD);
	nTitleWidth = GetShowAllStringWidth(sTitleString,tFont);
	if(nTitleWidth > SCR_W - (TITLE_BUTTON_X + TITLE_BUTTON_W)*2 )
	{
		bNeedShort = TRUE;
		nTitleWidth = SCR_W - (TITLE_BUTTON_X + TITLE_BUTTON_W)*2 - 10;
	}
	
	pWindow->GetBounds(&WindowRC);	
	TitleRC.SetRect((WindowRC.Width()-nTitleWidth)/2, (TITLEBAR_H- nFontSize)/2, nTitleWidth, nFontSize);
	
	m_TitleContrl = new TLabel;
	
	if(m_TitleContrl->Create(pWindow))
	{		
		m_TitleContrl->SetBounds(&TitleRC);	
		m_TitleCtlID = m_TitleContrl->GetId();	

		m_TitleContrl->SetFont(tFont);
		m_TitleContrl->SetColor(CTL_COLOR_TYPE_FORE,Color);
		m_TitleContrl->SetEnabled(FALSE);
		m_TitleContrl->SetCaption(sTitleString,FALSE);
		if(bNeedShort)
			ShowAsShort(m_TitleContrl, sTitleString, tFont);
		m_TitleContrl->Show(TRUE);
	}

	return m_TitleCtlID;
}
Esempio n. 6
0
/**
 * 创建功能按键
 *
 * \param pApp
 *
 * \return 
 */
Int32 TMainMenuForm::_CreateFunctionButtons(TApplication* pApp)
{
	Int32 bnRetCod = 0; 
	TRectangle obBtnRec(0,0,0,0); //初始(left, top, w, h)
	TFont tFont;	

	tFont.Create(FONT_BUTTON_CAPTION, FONT_BUTTON_CAPTION);
	
	//use to function buttons ID
	for(int i=0; i<ARR_SIZE(m_nFunMenuBtnID); i++)
	{
		m_nFunMenuBtnID[i] = 0;

		const TBitmap * pImgNormal = TResource::LoadConstBitmap(MainMenuItems[i].nNmIconID);
		const TBitmap * pImgDown = TResource::LoadConstBitmap(MainMenuItems[i].nHLIconID);
		obBtnRec.SetRect(FUNCTION_BUTTON_X + (FUNCTION_BUTTON_W *(i%3)) , FUNCTION_BUTTON_Y + (FUNCTION_BUTTON_H *(i/3)), FUNCTION_BUTTON_W, FUNCTION_BUTTON_H);
		TMaskButton* pFunMenuBtn =new TMaskButton;
		if(pFunMenuBtn->Create(this))
		{
			Int32 CaptionX = 0;
			TFont tFont;	

			tFont.Create(FONT_BUTTON_CAPTION, FONT_BUTTON_CAPTION);
			pFunMenuBtn->SetBounds(&obBtnRec); 	
			m_nFunMenuBtnID[i] = pFunMenuBtn->GetId();
			pFunMenuBtn->SetImage(pImgNormal,(FUNCTION_BUTTON_W-pImgNormal->GetWidth())/2,(FUNCTION_BUTTON_H-pImgNormal->GetHeight())/2 - 10); 
			pFunMenuBtn->SetSelImage(pImgDown,(FUNCTION_BUTTON_W-pImgDown->GetWidth())/2,(FUNCTION_BUTTON_H-pImgDown->GetHeight())/2 - 10);	
			if(TUString::StrLen(MainMenuItems[i].pszTitle) == 0)
			{
				CaptionX = (FUNCTION_BUTTON_W - GetShowAllStringWidth((TUChar *)TResource::LoadConstString(MainMenuItems[i].nStrID), tFont))/2;			
				pFunMenuBtn->SetCaption(TResource::LoadConstString(MainMenuItems[i].nStrID), CaptionX, FUNCTION_CAPTION_Y);
			}
			else
			{
				CaptionX = (FUNCTION_BUTTON_W - GetShowAllStringWidth((TUChar *)MainMenuItems[i].pszTitle, tFont))/2;			
				pFunMenuBtn->SetCaption(MainMenuItems[i].pszTitle, CaptionX, FUNCTION_CAPTION_Y);			
			}
			pFunMenuBtn->SetColor(RGB_COLOR_BLACK,RGB_COLOR_WHITE,RGB_COLOR_BLACK,RGB_COLOR_WHITE,RGB_COLOR_BLACK,RGB_COLOR_WHITE);
			pFunMenuBtn->SetFont(tFont);
			pFunMenuBtn->SetEnabled(TRUE);
		}
		else
		{
			bnRetCod ++;
		}
	}
			
	return bnRetCod;
}
Esempio n. 7
0
//如果内容太长显示不完则用省略号表示
void  ShowAsShort(TCtrl *pTCtrl, TUChar* pCaptionString, TFont objFontType)
{
	TRectangle Rc_TCtrl;
	pTCtrl->GetBounds(&Rc_TCtrl);
	
	int nStrLen = TUString::StrLen(TUString::StrTrimUnVisible(pCaptionString));
	//int nShortWidth = GetShowAllStringWidth((TUChar*)L"...",objFontType);
	int nShortWidth = GetShowAllStringWidth((TUChar*)TUSTR_Kx_Ellipsis,objFontType);	
	int nShowLen = objFontType.WordWrapNoLF(TUString::StrTrimUnVisible(pCaptionString), Rc_TCtrl.Width()- nShortWidth*2);

	if (nShowLen < nStrLen)
	{
		//Add one more label to show
		
		TUChar* pszTemp = new TUChar[nShowLen + 10];
		MemSet( (void *)pszTemp, 0x0, sizeof(TUChar) * (nShowLen + 10) );
		TUString::StrNCopy(pszTemp,TUString::StrTrimUnVisible(pCaptionString),nShowLen);
		TUString::StrCat(pszTemp,TUSTR_Kx_Ellipsis);//(const TUChar*)L"..."
		pTCtrl->SetCaption(pszTemp,FALSE);
		delete pszTemp;	
	}
	else
	{
		pTCtrl->SetCaption(TUString::StrTrimUnVisible(pCaptionString),FALSE);//StrTrim
	}	
}
Esempio n. 8
0
void
TButtonTextGadget::GetTextSize(TSize& size)
{
  TFont* font = Font;
  if (font == 0)
    font = &(GetGadgetWindow()->GetFont());

  if (font == 0)
    return;

  TEXTMETRIC tm;
  font->GetTextMetrics(tm);

  size.cx += tm.tmAveCharWidth * NumChars;
  size.cy += tm.tmHeight + 2;
}
Esempio n. 9
0
static int tvterm_put_uchar(struct TVterm* p, u_int ch)
{
	TFont *pf = &gFont[p->utf8Idx];
	u_int w;
	if(p->pen.x == p->xmax) {
		p->wrap = true;
		p->pen.x--;
	}

	if(p->wrap) {
		p->pen.x -= p->xmax - 1;

		if (p->pen.y == p->ymax - 1) {
			p->scroll++;
		} else {
			p->pen.y++;
		}

		p->wrap = false;

		return -1;
	}

	pf->conv(pf, ch, &w);

	if(pf->width == w) {
		INSERT_N_CHARS_IF_NEEDED(p, 1);
		tvterm_uput1(p, p->utf8Idx, ch);
		p->pen.x++;
	} else {
		INSERT_N_CHARS_IF_NEEDED(p, 2);
		tvterm_uput2(p, p->utf8Idx, ch);
		p->pen.x += 2;
	}

	p->utf8remain = 0;
	p->ucs2ch = 0;

	return 0;
}
Esempio n. 10
0
//设置应用标题栏按钮
Int32 SetAppTitleButton(TWindow * pWindow, Int32 nResId, int ButtonPosition)
{
	Int32 m_BtnID = 0;
	TButton *pBtn;
	TRectangle BtnRC_Left(TITLE_BUTTON_X, TITLE_BUTTON_Y, TITLE_BUTTON_W, TITLE_BUTTON_H);	
	TRectangle BtnRC_Right(SCR_W-TITLE_BUTTON_X-TITLE_BUTTON_W, TITLE_BUTTON_Y, TITLE_BUTTON_W, TITLE_BUTTON_H);
	TFont tFont;

	const TBitmap * pNormalBmp = TResource::LoadConstBitmap(APP_KA_ID_BITMAP_button53);
	const TBitmap * pOverBmp = TResource::LoadConstBitmap(APP_KA_ID_BITMAP_button53_over);

	if(TUString::StrLen(TResource::LoadConstString(nResId)) <= 2)
		tFont.Create(FONT_NORMAL, FONT_NORMAL, FONT_STYLE_BOLD);
	else
		tFont.Create(FONT_MIDDLE, FONT_MIDDLE, FONT_STYLE_BOLD);
	pBtn = new TButton;	
	if(pBtn->Create(pWindow))
	{		
		if(ButtonPosition == TITLE_BUTTON_LEFT)
			pBtn->SetBounds(&BtnRC_Left);	
		else
			pBtn->SetBounds(&BtnRC_Right);	
		m_BtnID = pBtn->GetId();	

		pBtn->SetFont(tFont);
		pBtn->SetColor(CTL_COLOR_TYPE_FORE,RGB_COLOR_WHITE);
		pBtn->SetColor(CTL_COLOR_TYPE_BACK,RGB_COLOR_WHITE);
		pBtn->SetColor(CTL_COLOR_TYPE_FOCUS_FORE,RGB_COLOR_WHITE);
		pBtn->SetColor(CTL_COLOR_TYPE_FOCUS_BACK,RGB_COLOR_WHITE);
		
		pBtn->SetCaption(TResource::LoadConstString(nResId),FALSE);
		pBtn->SetStyles(BTN_STYLES_GRAPGICS);
		pBtn->SetImage(pNormalBmp,0);
		pBtn->SetImage(pOverBmp,1);		
		pBtn->Show(TRUE);
	}

	return m_BtnID;
}
Esempio n. 11
0
//根据字体计算出显示整个字串所需的像素
//Todo::WordWrapNoLF有问题, 如果第一个字节为空格,返回的nShowLen长度有问题,需要做去头空格处理
Int32 GetShowAllStringWidth(TUChar* pCaptionString, TFont objFontType)
{
	Int32 Width = 1;
	Int32 tempWidth = 0;//从像素0开始
	Int32 nStringLen = TUString::StrLen(pCaptionString);
	Int32 nShowLen = 0;
	do
	{
		tempWidth ++;
		nShowLen = objFontType.WordWrapNoLF(TUString::StrTrimUnVisible(pCaptionString), tempWidth);
		
	}while(nShowLen < nStringLen);

	return tempWidth + 4;//刚刚好的长度显示字串时有问题,故再加两个像素
}
Esempio n. 12
0
//
/// Respond to the virtual call to let this gadget's Window know how big this
/// text gadget wants to be based on the text size.
//
/// If shrink-wrapping is requested, GetDesiredSize returns the size needed to
/// accommodate the borders, margins, and text; otherwise, if shrink-wrapping is not
/// requested, it returns the gadget's current width and height.
//
void
TTextGadget::GetDesiredSize(TSize& size)
{
  TGadget::GetDesiredSize(size);
  TFont* font = Font;
  if (font == 0)
    font = &(GetGadgetWindow()->GetFont());

  if (font == 0)
    return;

  if (ShrinkWrapWidth)
    size.cx += font->GetTextExtent(Text).cx;
  else {
    int  left, right, top, bottom;
    GetOuterSizes(left, right, top, bottom);

    int newW = font->GetMaxWidth() * NumChars;
    size.cx += newW + left + right - Bounds.Width();  // Old bounds already considered
  }

  if (ShrinkWrapHeight)
    size.cy += font->GetHeight() + 2;
}
Esempio n. 13
0
//
/// The TFont copy constructor.
//
TFont::TFont(const TFont& src)
{
#if !defined(NO_GDI_SHARE_HANDLES)
  Handle = src.Handle;
  RefAdd(Handle, Font);
#else
  LOGFONT logFont;
  src.GetObject(logFont);
  Handle = ::CreateFontIndirect(&logFont);
  WARNX(OwlGDI, !Handle, 0, _T("Cannot create TFont from TFont @") <<
        hex << uint32(LPVOID(&src)));
  CheckValid();
  RefAdd(Handle, Font);
#endif
}
Esempio n. 14
0
	CCXBitmapDC::CCXBitmapDC(const char *text, CGSize dimensions, UITextAlignment alignment, const char *fontName, float fontSize)
        : m_pBitmap(NULL)
	{
        TUChar *pText = NULL; 
        do 
        {
            // create font
            TFont font;
            CCX_BREAK_IF(! font.Create(0, (Int32)fontSize));

            // text
            Int32 len = strlen(text) + 1;
            CCX_BREAK_IF(! (pText = new TUChar[len]));
            TUString::StrGBToUnicode(pText, (Char*)text);

            // calculate text size
            if (CGSize::CGSizeEqualToSize(dimensions, CGSizeZero))
            {
                m_tSize.width = font.CharsWidth(pText,len);
                m_tSize.height = font.LineHeight();
            }else
            {
                m_tSize = dimensions;
            }

            Int16 width = (Int16)m_tSize.width;
            Int16 height = (Int16)m_tSize.height;

            // create bitmap
            CCX_BREAK_IF(! (m_pBitmap = TBitmap::Create(width, height, 32)));

            // create memory window
            if (s_pMemWnd)
            {
                TRectangle rcMemWnd(0, 0, 0, 0);
                s_pMemWnd->GetClientBounds(&rcMemWnd);
                if (rcMemWnd.Width() < width || rcMemWnd.Height() < height)
                {
                    s_pMemWnd->CloseWindow();
                    s_pMemWnd = NULL;
                }
            }

            do 
            {
                // if memery window is already break
                CCX_BREAK_IF(s_pMemWnd);

                CCX_BREAK_IF(! (s_pMemWnd = new TWindow(CCXApplication::sharedApplication())));

                Coord nCurrentWidth = CCXApplication::GetCurrentApplication()->GetScreenWidth();
                Coord nCurrentHeight = CCXApplication::GetCurrentApplication()->GetScreenHeight();
                
                Coord nMemWndW = (width >= nCurrentWidth) ? width : nCurrentWidth;
                Coord nMemWndH = (height >= nCurrentHeight) ? height : nCurrentHeight;
                CCX_BREAK_IF(s_pMemWnd->CreateMemWindow(nMemWndW, nMemWndH,screenTransparentFormat));
                delete s_pMemWnd;
                s_pMemWnd = NULL;
            } while (0);

            CCX_BREAK_IF(! s_pMemWnd);
            
            // create DC
            TDC dc(s_pMemWnd);
            // set DC styles
            UInt32 styles = GUI_API_STYLE_SPECIFY_FORE_COLOR |  GUI_API_STYLE_ROP_MODE_TRANSPARENT |
                GUI_API_STYLE_SPECIFY_BACK_COLOR | GUI_API_STYLE_ALIGNMENT_MIDDLE | GUI_API_STYLE_SPECIFY_FONT;

            switch (alignment)
            {
            case UITextAlignmentLeft:
                styles |= GUI_API_STYLE_ALIGNMENT_LEFT;
                break;
            case UITextAlignmentCenter:
                styles |= GUI_API_STYLE_ALIGNMENT_CENTER;
                break;
            case UITextAlignmentRight:
                styles |= GUI_API_STYLE_ALIGNMENT_RIGHT;
                break;
            default:
                styles |= GUI_API_STYLE_ALIGNMENT_CENTER;
                break;
            }

            s_pMemWnd->GetMemWindowTBitmapPtr()->Fill32(RGBA(0, 0, 0, 0), 0, 0, width, height);

            TRectangle rect(0, 0, width, height);
            dc.DrawTextInRectangleEx(pText, 0, RGBA(255,255,255,255), RGBA(0,0,0,255), font, &rect, styles);

            dc.ReadBitmap(m_pBitmap, 0, 0);

        } while (0);
        if (pText)
        {
            delete[] pText;
            pText = NULL;
        }
	}
Esempio n. 15
0
// 窗口初始化
Boolean TGardenListForm::_OnWinInitEvent(TApplication * pApp, EventType * pEvent)
{
	int iRet = eFailed;
	int nIndex = 0;
	TBarRowList *lpRowList = NULL;
	TRectangle Rc_CoolBarList;

	nListItems =0;
	Response = NULL;
	iRet = KaiXinAPI_JsonParse(KX_GardenList, (void **)&Response);

	m_BackBtn = SetAppBackButton(this); 
	SetAppTilte(this, APP_KA_ID_STRING_Garden);	

	if(iRet == 1)
	{
		TBarRow *lpRow = NULL;
		TCoolBarList* pCoolBarList = static_cast<TCoolBarList*>(GetControlPtr(APP_KA_ID_GardenListForm_GardenListCoolBarList));
		if (pCoolBarList)
		{
			TBarListItem* lpItem = NULL;

			pCoolBarList->SetBounds(RC_LIST_LARGE);
			pCoolBarList->GetBounds(&Rc_CoolBarList);
			lpRowList = pCoolBarList->Rows();
			//add row
			if (lpRowList)
			{
				lpRowList->BeginUpdate();
				lpRowList->Clear();
				lpRow = lpRowList->AppendRow();
				lpRowList->EndUpdate();
				if(lpRow)
				{
					//Title 
					lpItem = lpRow->AppendItem();
					if(lpItem)	
					{
						TFont objFontType;
						Int32 ItemHeight = 0;
						TRectangle rect;
						TRectangle Rc_Temp;
						TUChar pszSubTitle[64] = {0};

						lpItem->GetBounds(rect);
						lpItem->SetCaption(NULL);						
						lpItem->SetIndicatorType(itNone);

						ItemHeight = ItemHeight + 30;

						TUString::StrPrintF(pszSubTitle, TResource::LoadConstString(APP_KA_ID_STRING_SubTitleGarden),TResource::LoadConstString(APP_KA_ID_STRING_Friend));
						Int32 nTitlelabelId = lpItem->AddCtrl(CTL_CLASS_LABEL, 20, 5);
						TLabel* pTitlelabel = static_cast<TLabel*>(GetControlPtr(nTitlelabelId));
						TRectangle Rc_Titlelabel(OFFSET_X, ItemHeight, SCR_W - 20, 20);
						pTitlelabel->SetBounds(&Rc_Titlelabel);
						objFontType = pTitlelabel->GetFont();
						objFontType.Create(FONT_CONTENT, FONT_CONTENT);
						pTitlelabel->SetFont(objFontType); 
						pTitlelabel->SetCaption(pszSubTitle,FALSE);
						pTitlelabel->GetBounds(&Rc_Temp);

						ItemHeight = ItemHeight + Rc_Temp.Height() + 30;					
						lpItem->SetHeight(ItemHeight);	
					}						

					// 好友列表
					nListItems = Response->nSize_friends;
					if(nListItems == 0)
					{
						lpItem = lpRow->AppendItem();
						if(lpItem)
						{
							TFont objFontType;
							TUChar pszFriendName[32] = {0};
							Int32 ItemHeight = 0;
							TRectangle rect;
							TRectangle Rc_Temp;

							lpItem->GetBounds(rect);
							lpItem->SetCaption(NULL);						
							lpItem->SetIndicatorType(itNone);

							ItemHeight = ItemHeight + rect.Y() + 15;

							//好友的花园里还没有成熟的果实				
							Int32 nNoneHarvestId = lpItem->AddCtrl(CTL_CLASS_LABEL, 20, 5);
							TLabel* pNoneHarvest = static_cast<TLabel*>(GetControlPtr(nNoneHarvestId));
							TRectangle Rc_NoneHarvest(OFFSET_X, ItemHeight, SCR_W - 40 , 20);
							pNoneHarvest->SetBounds(&Rc_NoneHarvest);
							objFontType = pNoneHarvest->GetFont();
							objFontType.Create(FONT_CONTENT_DETAIL, FONT_CONTENT_DETAIL);
							pNoneHarvest->SetFont(objFontType);
							pNoneHarvest->SetColor(CTL_COLOR_TYPE_FORE,RGB_COLOR_GRAY);
							pNoneHarvest->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_NoneHarvestGarden),FALSE);
							pNoneHarvest->GetBounds(&Rc_Temp);		
							ItemHeight = ItemHeight + Rc_Temp.Height() + 10;

							lpItem->SetHeight(ItemHeight - (rect.Y() - Rc_CoolBarList.Y()) + 10 );
						}
					}
					else
					{
						for( nIndex = 0; nIndex < nListItems; nIndex++)			
						{
							lpItem = lpRow->AppendItem();
							if(lpItem)
							{
								TFont objFontType;
								TUChar pszFriendName[32] = {0};
								Int32 ItemHeight = 0;
								TRectangle rect;
								TRectangle Rc_Temp;

								lpItem->GetBounds(rect);
								lpItem->SetCaption(NULL);						
								lpItem->SetIndicatorType(itNone);

								ItemHeight = ItemHeight + rect.Y() + 15;

								//好友名字							
								TUString::StrUtf8ToStrUnicode(pszFriendName, (const Char *)Response->friends[nIndex].fname);
								nFriendNameId[nIndex] = lpItem->AddCtrl(CTL_CLASS_RICHVIEW, 20, 5);
								TRichView* pFriendName = static_cast<TRichView*>(GetControlPtr(nFriendNameId[nIndex]));
								TRectangle Rc_FriendName(OFFSET_X, ItemHeight, SCR_W - 40 , 20);
								pFriendName->SetBounds(&Rc_FriendName);
								objFontType = pFriendName->GetFont();
								objFontType.Create(FONT_CONTENT_DETAIL, FONT_CONTENT_DETAIL);
								pFriendName->SetFont(objFontType); 
								//pFriendName->SetColor(CTL_COLOR_TYPE_FORE,RGB_COLOR_BLUE);
								pFriendName->SetWordWrapAttr(TRUE);
								pFriendName->SetTransparent(TRUE);
								pFriendName->SetEnabled(TRUE);
								pFriendName->SetScrollBarMode(CTL_SCL_MODE_NONE);
								pFriendName->SetMaxVisibleLines(1, TRUE);
								pFriendName->SetCaption(pszFriendName,FALSE);
								pFriendName->GetBounds(&Rc_Temp);		
								ItemHeight = ItemHeight + Rc_Temp.Height() + 5;

								lpItem->SetHeight(ItemHeight - (rect.Y() - Rc_CoolBarList.Y()) + 10 );
							}
						}					
					}					

				}

				//:TODO:Add subject info

				lpRowList->BeginUpdate();
				lpRow = lpRowList->AppendRow();
				lpRowList->EndUpdate(); 

				//add Item
				if(lpRow)
				{
					//nothing to do 				
				}
			}
		}
	}
	return TRUE;
}
Esempio n. 16
0
Int32 TCommentDetailForm::_OnCommentDetailControl(TApplication * pApp)
{
	Int32 bnRetCod = 0;	
	TPanel* pTPanel;	
	TRectangle obBtnRec(100,50,150,30);	//初始(left, top, w, h)
	TFont tFont;

	Int32 nShowItemNum = 0;
	Int32 itemHeight = 150;

	m_nTitleReplyBtnID = SetTilteButton(pApp); 
	m_nTitleLblID = SetFormTilte(pApp); 

	//创建TPanel: CommentForm_CommentDetailPanel
	m_obContrl[m_nCtlIDCount] =new TPanel;	
	obBtnRec.SetRect(0, TITLEBAR_H, SCR_W, 370);
	if(m_obContrl[m_nCtlIDCount]->Create(this))
	{		
		m_obContrl[m_nCtlIDCount]->SetBounds(&obBtnRec);	
		m_iaCreateCtlID[m_nCtlIDCount] = m_obContrl[m_nCtlIDCount]->GetId();
		m_iaTPanelID[0] = m_obContrl[m_nCtlIDCount]->GetId();//Save TPanel ID

		m_obContrl[m_nCtlIDCount]->SetTransparent(TRUE);//设置透明
		m_obContrl[m_nCtlIDCount]->SetFrameWidth(0);//设置边框	
		m_obContrl[m_nCtlIDCount]->SetEnabled(TRUE);
		m_obContrl[m_nCtlIDCount]->Show(TRUE);	
	}
	else
	{
		bnRetCod++;
	}
	m_nCtlIDCount++;


	//创建普通button: 回复
	m_obContrl[m_nCtlIDCount] =new TButton ;
	obBtnRec.SetRect(80,420,50,30);
	if(m_obContrl[m_nCtlIDCount]->Create(this))
	{
		m_obContrl[m_nCtlIDCount]->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_Reply),TRUE);
		m_obContrl[m_nCtlIDCount]->SetBounds(&obBtnRec);
		tFont = m_obContrl[m_nCtlIDCount]->GetFont();
		tFont.Create(14, 14);
		m_obContrl[m_nCtlIDCount]->SetFont(tFont);
		// 保存控件ID,以便处理消息
		m_iaCreateCtlID[m_nCtlIDCount] = m_obContrl[m_nCtlIDCount]->GetId();
		m_nReplyBtnID = m_obContrl[m_nCtlIDCount]->GetId();//save reply button ID
		m_obContrl[m_nCtlIDCount]->Show(TRUE);		
	}
	else
	{
		bnRetCod++;
	}
	// 增加生成控件数量
	m_nCtlIDCount++;

	//创建普通button: 删除
	m_obContrl[m_nCtlIDCount] =new TButton ;
	obBtnRec.SetRect(160,420,50,30);
	if(m_obContrl[m_nCtlIDCount]->Create(this))
	{
		m_obContrl[m_nCtlIDCount]->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_Delete),TRUE);
		m_obContrl[m_nCtlIDCount]->SetBounds(&obBtnRec);
		tFont = m_obContrl[m_nCtlIDCount]->GetFont();
		tFont.Create(14, 14);
		m_obContrl[m_nCtlIDCount]->SetFont(tFont);
		// 保存控件ID,以便处理消息
		m_iaCreateCtlID[m_nCtlIDCount] = m_obContrl[m_nCtlIDCount]->GetId();
		m_nDeleteBtnID = m_obContrl[m_nCtlIDCount]->GetId();//save delete button ID
		m_obContrl[m_nCtlIDCount]->Show(TRUE);		
	}
	else
	{
		bnRetCod++;
	}
	// 增加生成控件数量
	m_nCtlIDCount++;



	//一下的控件都在TPanel中
	//创建Label 悄悄话		

	pTPanel = static_cast< TPanel* >(this->GetControlPtr(m_iaTPanelID[0]));

	if(pTPanel)
	{	
		CreateDetailItemControl(0,itemHeight, pTPanel, 0);	

		nShowItemNum = (this->m_nCommentDetailItemNum>COMMENTDETAIL_MAXITEM)?(COMMENTDETAIL_MAXITEM-1):(m_nCommentDetailItemNum-1);
		int startItem = (this->m_nCommentDetailItemNum>COMMENTDETAIL_MAXITEM)?(this->m_nCommentDetailItemNum-COMMENTDETAIL_MAXITEM):1;
		//历史留言详情
		int ctrlGroupIndex = 1;
		for(int i=startItem; i< this->m_nCommentDetailItemNum; i++)
		{			
			CreateDetailItemControl(i,itemHeight, pTPanel, ctrlGroupIndex);
			ctrlGroupIndex++;
		}

		pTPanel->Show(TRUE);
	}

	return bnRetCod;

}
Esempio n. 17
0
Int32 TCommentDetailForm::CreateDetailItemControl(Int32 itemIndex,Int32 itemHeight, TPanel *pTPanel, int ctrlGroupIndex)
{
	Int32 bnRetCod = 0;	
	TRectangle obBtnRec(100,50,150,30);	//初始(left, top, w, h)
	TFont tFont;

	Int32 nCtrlHeight = (itemIndex == 0)?0:(itemHeight*(ctrlGroupIndex)-20);

	TUChar pszNameString[32];
	TUChar pszDateTimeString[32];
	TUChar pszContentString[1024];
	TUChar pszTemp[32];

	memset(pszNameString, 0, sizeof(pszNameString));
	memset(pszDateTimeString, 0, sizeof(pszDateTimeString));
	memset(pszContentString, 0, sizeof(pszContentString));
	memset(pszTemp, 0, sizeof(pszTemp));


	if(m_pResponse == NULL) return  bnRetCod;


	Int32 Fuid = 0;
	TUChar TUCharFuid[32];
	TUString::StrUtf8ToStrUnicode(TUCharFuid,(const Char *)KaiXinUserInfo.uid);
	Fuid = TUString::StrAToI(TUCharFuid);
	if(m_pResponse->comments[itemIndex].fuid == Fuid)
	{
		TUString::StrCopy(pszNameString, TResource::LoadConstString(APP_KA_ID_STRING_Me));
	}
	else	
	{
		TUString::StrUtf8ToStrUnicode(pszNameString , (const Char *)m_pResponse->comments[itemIndex].fname);
	}

	if(itemIndex==0)
	{
		if(this->m_appCommentDetailType == ReceivedUserCommentDetail||this->m_appCommentDetailType == SentUserCommentDetail)
		{
			//TUString::StrUtf8ToStrUnicode(pszTemp , TResource::LoadConstString(APP_KA_ID_STRING_UserCommentIs));
			TUString::StrCat(pszNameString,TResource::LoadConstString(APP_KA_ID_STRING_UserCommentIs));										
		}
		else if(this->m_appCommentDetailType == FriendCommentDetail)
		{
			TUString::StrUtf8ToStrUnicode(pszTemp ,(const Char *)m_pResponse->title);
			TUString::StrCopy(pszNameString,pszTemp);
			//TUString::StrUtf8ToStrUnicode(pszTemp ,TResource::LoadConstString(APP_KA_ID_STRING_CommentIs));
			TUString::StrCat(pszNameString,TResource::LoadConstString(APP_KA_ID_STRING_CommentIs));						
		}
		else
		{
			TUString::StrUtf8ToStrUnicode(pszTemp ,(const Char *)m_pResponse->title);
			TUString::StrCat(pszNameString,pszTemp);
			//TUString::StrUtf8ToStrUnicode(pszTemp ,TResource::LoadConstString(APP_KA_ID_STRING_CommentIs));
			TUString::StrCat(pszNameString,TResource::LoadConstString(APP_KA_ID_STRING_CommentIs));						
		}
	}
	else
	{
		//TUString::StrUtf8ToStrUnicode(pszTemp , TResource::LoadConstString(APP_KA_ID_STRING_ReplyIs));
		TUString::StrCat(pszNameString,TResource::LoadConstString(APP_KA_ID_STRING_ReplyIs));										
	}




	//ctime
	//TUString::StrIToA(pszDateTimeString , m_pResponse->comments[itemIndex].ctime);

	//content
	TUString::StrUtf8ToStrUnicode( pszContentString , (const Char *)m_pResponse->comments[itemIndex].abscont ); 


	//const TBitmap * pImgBg = TResource::LoadConstBitmap(APP_KA_ID_BITMAP_UserCommentReplyBG);
	//SetBackGroundBitmap(pImgBg,0);

	if(pTPanel)
	{		
		if(itemIndex == 0)//First item
		{

			m_obContrl[m_nCtlIDCount] =new TLabel;		
			obBtnRec.SetRect(5,5,60,12);
			if(m_obContrl[m_nCtlIDCount]->Create(pTPanel))
			{	
				TUChar pszMTypeString[32];

				m_obContrl[m_nCtlIDCount]->SetBounds(&obBtnRec);	
				m_iaCreateCtlID[m_nCtlIDCount] = m_obContrl[m_nCtlIDCount]->GetId();	

				TUString::StrUtf8ToStrUnicode(pszMTypeString , (const Char *)m_pResponse->mtype);					
				if( TUString::StrAToI(pszMTypeString) )//悄悄话//m_pResponse->comments[i].mtype 
				{
					m_obContrl[m_nCtlIDCount]->SetCaption(TUSTR_Kx_UserComment_QQH,FALSE);
				}
				else
				{
					m_obContrl[m_nCtlIDCount]->SetCaption(TUSTR_Kx_Profile_None_Title,FALSE);
				}
				//自适应文字大小
				((TLabel*)m_obContrl[m_nCtlIDCount])->SetAutoSize(TRUE);
				//((TLabel*)m_obContrl[m_nCtlIDCount])->SetScrollMode(lsmSlide);

				tFont = m_obContrl[m_nCtlIDCount]->GetFont();
				tFont.Create(11, 11);
				m_obContrl[m_nCtlIDCount]->SetFont(tFont);

				//设置颜色
				m_obContrl[m_nCtlIDCount]->SetColor(CTL_COLOR_TYPE_FORE, RGB(255, 0, 0));
				m_obContrl[m_nCtlIDCount]->SetEnabled(FALSE);
				m_obContrl[m_nCtlIDCount]->Show(TRUE);		
			}
			else
			{
				bnRetCod++;
			}
			m_nCtlIDCount++;


		}

		//创建TImage 头像
		m_obContrl[m_nCtlIDCount] =new TImage;		
		obBtnRec.SetRect(5,35+nCtrlHeight,40,35);
		const TBitmap * pImgNormal = TResource::LoadConstBitmap(APP_KA_ID_BITMAP_Default);

		if(m_obContrl[m_nCtlIDCount]->Create(pTPanel))
		{		
			m_obContrl[m_nCtlIDCount]->SetBounds(&obBtnRec);	
			m_iaCreateCtlID[m_nCtlIDCount] = m_obContrl[m_nCtlIDCount]->GetId();
			m_iaTImageID[itemIndex] = m_obContrl[m_nCtlIDCount]->GetId();//save TImage ID
			if(pBmp[itemIndex])
			{
				((TImage*)m_obContrl[m_nCtlIDCount])->SetBitmap(pBmp[itemIndex]);
			}
			else
			{
				((TImage*)m_obContrl[m_nCtlIDCount])->SetBitmap(pImgNormal);
			}
			//((TImage*)m_obContrl[m_nCtlIDCount])->SetBitmapByResId(APP_KA_ID_BITMAP_Default);
			m_obContrl[m_nCtlIDCount]->SetEnabled(FALSE);
			((TImage*)m_obContrl[m_nCtlIDCount])->SetTransVisible(TRUE);
			m_obContrl[m_nCtlIDCount]->SetFrameWidth(2);
			m_obContrl[m_nCtlIDCount]->Show(TRUE);		
		}
		else
		{
			bnRetCod++;
		}
		m_nCtlIDCount++;

		//创建姓名标签 for comment username
		m_obContrl[m_nCtlIDCount] =new TLabel;		
		obBtnRec.SetRect(65+5,35+nCtrlHeight+8,130,12);
		if(m_obContrl[m_nCtlIDCount]->Create(pTPanel))
		{		
			m_obContrl[m_nCtlIDCount]->SetBounds(&obBtnRec);	
			m_iaCreateCtlID[m_nCtlIDCount] = m_obContrl[m_nCtlIDCount]->GetId();	

			m_obContrl[m_nCtlIDCount]->SetCaption(pszNameString,FALSE);//TResource::LoadConstString()TUSTR_Kx_UserComment_QQH
			//自适应文字大小
			((TLabel*)m_obContrl[m_nCtlIDCount])->SetAutoSize(TRUE);
			//((TLabel*)m_obContrl[m_nCtlIDCount])->SetScrollMode(lsmSlide);

			tFont = m_obContrl[m_nCtlIDCount]->GetFont();
			tFont.Create(12, 12);
			m_obContrl[m_nCtlIDCount]->SetFont(tFont);

			//设置颜色
			m_obContrl[m_nCtlIDCount]->SetColor(CTL_COLOR_TYPE_FORE, RGB(0, 0, 0));
			m_obContrl[m_nCtlIDCount]->SetEnabled(FALSE);
			m_obContrl[m_nCtlIDCount]->Show(TRUE);		
		}
		else
		{
			bnRetCod++;
		}
		m_nCtlIDCount++;

		//创建日期标签 for comment datetime
		m_obContrl[m_nCtlIDCount] =new TLabel;		
		obBtnRec.SetRect(245,35+nCtrlHeight-5,60,12);
		if(m_obContrl[m_nCtlIDCount]->Create(pTPanel))
		{		
			m_obContrl[m_nCtlIDCount]->SetBounds(&obBtnRec);	
			m_iaCreateCtlID[m_nCtlIDCount] = m_obContrl[m_nCtlIDCount]->GetId();	

			//m_obContrl[m_nCtlIDCount]->SetCaption(pszDateTimeString,FALSE);
			TUChar* pszDateTime = NULL;
			cUnixTime_ConvertUnixTimeToFormatString( m_pResponse->comments[itemIndex].ctime, KX_TIME_FORMAT_MM_DD_HH_MM, &pszDateTime );
			m_obContrl[m_nCtlIDCount]->SetCaption(pszDateTime,FALSE);
			if(pszDateTime) 
			{
				delete[] pszDateTime; 
				pszDateTime = NULL;
			}
			//自适应文字大小
			((TLabel*)m_obContrl[m_nCtlIDCount])->SetAutoSize(TRUE);
			//((TLabel*)m_obContrl[m_nCtlIDCount])->SetScrollMode(lsmSlide);

			tFont = m_obContrl[m_nCtlIDCount]->GetFont();
			tFont.Create(10, 10);
			m_obContrl[m_nCtlIDCount]->SetFont(tFont);

			//设置颜色
			m_obContrl[m_nCtlIDCount]->SetColor(CTL_COLOR_TYPE_FORE, RGB(0, 0, 255));
			m_obContrl[m_nCtlIDCount]->Show(TRUE);		
		}
		else
		{
			bnRetCod++;
		}
		m_nCtlIDCount++;


		//创建  TRichView for content
		m_obContrl[m_nCtlIDCount] =new TRichView;	
		if(itemIndex == 0)//First item
		{
			obBtnRec.SetRect(65+5,35+30+nCtrlHeight,245,80);		
		}
		else
		{
			obBtnRec.SetRect(65+5,35+30+nCtrlHeight,245,80); 	
		}		

		if(m_obContrl[m_nCtlIDCount]->Create(pTPanel))
		{		
			m_obContrl[m_nCtlIDCount]->SetBounds(&obBtnRec);	
			m_iaCreateCtlID[m_nCtlIDCount] = m_obContrl[m_nCtlIDCount]->GetId();
			tFont = m_obContrl[m_nCtlIDCount]->GetFont();
			tFont.Create(12, 12);
			m_obContrl[m_nCtlIDCount]->SetFont(tFont);
			m_obContrl[m_nCtlIDCount]->SetColor(CTL_COLOR_TYPE_FORE, RGB(111, 0, 255));
			m_obContrl[m_nCtlIDCount]->SetCaption(pszContentString,FALSE);//TResource::LoadConstString()
			m_obContrl[m_nCtlIDCount]->SetFrameWidth(2);
			m_obContrl[m_nCtlIDCount]->SetEnabled(TRUE);//FALSE

			//((TRichView*)m_obContrl[m_nCtlIDCount])->SetScrollBarMode(CTL_SCL_MODE_VERTICAL);
			((TRichView*)m_obContrl[m_nCtlIDCount])->SetBorderStyle(bsSingle, FALSE);
			m_obContrl[m_nCtlIDCount]->Show(TRUE);	
		}
		else
		{
			bnRetCod++;
		}
		m_nCtlIDCount++;
	}
	return bnRetCod;
}
Esempio n. 18
0
bool TWindow::CreateInputContext()
{
	if (!fInputContext)
	{
		XIM xim = gApplication->GetInputMethod();
		if (!xim)
			return false;
		
		XIMStyles* supportedStyles;
		XGetIMValues(xim, XNQueryInputStyle, &supportedStyles, NULL, NULL);
		if (!supportedStyles || supportedStyles->count_styles == 0)
			return false;
			
		XIMStyle* bestStyle = NULL;
		for (unsigned short i = 0; i < supportedStyles->count_styles; i++)
		{
			XIMStyle* style = &supportedStyles->supported_styles[i];
			
			// first check to see if it is supported
			if ((*style & (XIMPreeditPosition | XIMPreeditNothing | XIMPreeditNone)) &&
				(*style & ( /*XIMStatusCallbacks |*/ XIMStatusNothing | XIMStatusNone)))
			{
				if (bestStyle)
				{
					if (((*style & XIMPreeditPosition) && !(*bestStyle & XIMPreeditPosition)) ||
						((*style & XIMStatusCallbacks) && !(*bestStyle & XIMStatusCallbacks)))
						bestStyle = style;			
					else if (((*style & XIMPreeditNothing) && !(*bestStyle & (XIMPreeditPosition | XIMPreeditNothing))) ||
							 ((*style & XIMStatusNothing) && !(*bestStyle & (XIMStatusCallbacks | XIMStatusNothing))))
						bestStyle = style;			
				}
				else
					bestStyle = style;
			}
		}
		
		XIMStyle style = (bestStyle ? *bestStyle : 0);
		XFree(supportedStyles);
		if (!bestStyle)
			return false;
		
		XPoint point;
		point.x = point.y = 0;
		XRectangle rect;
		rect.x = rect.y = 0;
		rect.width = rect.height = 0x7fff;
		
		TFont* font = GetFont();
		ASSERT(font && font->GetFontSet());
		XVaNestedList	preeditAttributes = XVaCreateNestedList(0, XNFontSet, font->GetFontSet(), XNSpotLocation, &point, XNArea, &rect, NULL);
		ASSERT(preeditAttributes);
	//	XVaNestedList	statusAttributes = XVaCreateNestedList(0, XNFontSet, font->GetFontSet(), NULL);
	//	ASSERT(statusAttributes);
	
		XIC xic = XCreateIC(xim, XNInputStyle, style, XNClientWindow, fWindow, XNFocusWindow, fWindow, XNPreeditAttributes, preeditAttributes, /*XNStatusAttributes, statusAttributes, */ NULL);
		if (xic)
			fInputContext = new TInputContext(xic);
			
		/*if (fInputContext)
		{
			long mask;
			XGetICValues(fInputContext->GetXIC(), XNFilterEvents, &mask, NULL);
			printf("XIC mask = %lx\n", mask);
 	   }*/
	}
		
	return (fInputContext != NULL);
}
Esempio n. 19
0
Int32 GetShowAllStringWidthEx(TUChar* pCaptionString, Int32 FontSize)
{
	TFont objFontType;
	objFontType.Create(FontSize, FontSize);
	return GetShowAllStringWidth(pCaptionString, objFontType);
}
Esempio n. 20
0
Int32 SetAppTitleButton(TWindow * pWindow, const TUChar* pszResTxt, int ButtonPosition)
{
	Int32 m_BtnID = 0;
	
	TRectangle BtnRC_Left(TITLE_BUTTON_X, TITLE_BUTTON_Y, TITLE_BUTTON_W, TITLE_BUTTON_H);
	TRectangle BtnRC_Right(SCR_W-TITLE_BUTTON_X-TITLE_BUTTON_W, TITLE_BUTTON_Y, TITLE_BUTTON_W, TITLE_BUTTON_H);
	
	Coord  nWidth = 0;
	Int32 nResIDNormal = 0;
	Int32 nResIDOver = 0;
	int nFontSize = 0;

	//根据显示文本的长短设置图标及文字大小
	switch( TUString::StrLen(pszResTxt) )
	{
		case 2:
			{
			 nWidth = TITLE_BUTTON_W;
			nFontSize = FONT_NORMAL;
			nResIDNormal = APP_KA_ID_BITMAP_button53;
			nResIDOver = APP_KA_ID_BITMAP_button53_over;				
			}
			break;
		case 3:
			{
			 nWidth = TITLE_BUTTON_W;
			nFontSize = FONT_NORMAL;
			nResIDNormal = APP_KA_ID_BITMAP_button53;
			nResIDOver = APP_KA_ID_BITMAP_button53_over;				
			}
			break;
		case 4:
			{
			 nWidth = TITLE_BUTTON_W;
			nFontSize = FONT_NORMAL;
			nResIDNormal = APP_KA_ID_BITMAP_button53;
			nResIDOver = APP_KA_ID_BITMAP_button53_over;				
			}
			break;
		case 5:
			{
			 nWidth = TITLE_BUTTON_W;
			nFontSize = FONT_MIDDLE;
			nResIDNormal = APP_KA_ID_BITMAP_button53;
			nResIDOver = APP_KA_ID_BITMAP_button53_over;				
			}
			break;
		case 6:
		default:
			{
			 nWidth = TITLE_BUTTON_W;
			nFontSize = FONT_SMALL;
			nResIDNormal = APP_KA_ID_BITMAP_button53;
			nResIDOver = APP_KA_ID_BITMAP_button53_over;				
			}
			break;

	}

	TFont tFont;	
	const TBitmap* pNormalBmp = TResource::LoadConstBitmap(nResIDNormal);
	const TBitmap* pOverBmp = TResource::LoadConstBitmap(nResIDOver);
	tFont.Create(nFontSize, nFontSize, FONT_STYLE_BOLD);
	
	TButton* pBtn = new TButton;	
	if(pBtn->Create(pWindow))
	{		
		BtnRC_Left.SetWidth(nWidth);
		BtnRC_Right.SetWidth(nWidth);
		BtnRC_Right.SetX(SCR_W-TITLE_BUTTON_X-nWidth);
			
		if(ButtonPosition == TITLE_BUTTON_LEFT)
			pBtn->SetBounds(&BtnRC_Left);	
		else
			pBtn->SetBounds(&BtnRC_Right);
		
		m_BtnID = pBtn->GetId();	

		pBtn->SetFont(tFont);
		pBtn->SetColor(CTL_COLOR_TYPE_FORE,RGB_COLOR_WHITE);
		pBtn->SetColor(CTL_COLOR_TYPE_BACK,RGB_COLOR_WHITE);
		pBtn->SetColor(CTL_COLOR_TYPE_FOCUS_FORE,RGB_COLOR_WHITE);
		pBtn->SetColor(CTL_COLOR_TYPE_FOCUS_BACK,RGB_COLOR_WHITE);
		
		pBtn->SetCaption(pszResTxt,FALSE);
		pBtn->SetStyles(BTN_STYLES_GRAPGICS);
		pBtn->SetImage(pNormalBmp,0);
		pBtn->SetImage(pOverBmp,1);		
		pBtn->Show(TRUE);
	}

	return m_BtnID;
}
Esempio n. 21
0
void TUserInfoDetailForm::_SetDataToCtrls(TApplication* pApp)
{
	if(this->Response && Response->nSize_friends != 0)
	{
		TFont objFontType;				
		TUChar pszState[1024] = {0};
		TUChar pszStateTime[32] = {0};	
		TUChar pszLogoPath[256] = {0};	
		TUChar pszUserName[32] = {0};	
		TRectangle Rc_Temp;
		TRectangle rect;

		TMaskButton* pUserHeadMBtn = static_cast<TMaskButton*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_UserDetailHeadMaskButton));

		TBitmap* pDownLoadBitmap = NULL;
		//Photo, 先读取磁盘cache
		pDownLoadBitmap = LoadImgByUrl(Response->friends[0].flogo90);
		//磁盘cache无文件,再下载
		if( pDownLoadBitmap == NULL)
		{
			TRectangle rc;

			KaiXinAPICommon_DownloadPhoto(Response->friends[0].flogo90, this->GetWindowHwndId(), 0 );	
			const TBitmap * pBmp = TResource::LoadConstBitmap(APP_KA_ID_BITMAP_Default);
			pUserHeadMBtn->GetBounds(&rc);
			pUserHeadMBtn->SetEnabled(FALSE);
			pUserHeadMBtn->SetCaption(TUSTR_Kx_NULL,0,0);
			pUserHeadMBtn->SetImage(pBmp,(rc.Width()-pBmp->GetWidth())/2, (rc.Height()-pBmp->GetHeight())/2);			
		}
		else
		{
			TRectangle rc;				
			pUserHeadMBtn->GetBounds(&rc);
			pUserHeadMBtn->SetEnabled(FALSE);
			pUserHeadMBtn->SetCaption(TUSTR_Kx_NULL,0,0);

			pPhotoBmp = TBitmap::Create(PHOTO_W, PHOTO_H, pDownLoadBitmap->GetDepth());
			pPhotoBmp->QuickZoom(pDownLoadBitmap, TRUE, TRUE,RGBA(0,0,0,255));	

			pUserHeadMBtn->SetImage(pPhotoBmp,(rc.Width()-pPhotoBmp->GetWidth())/2, (rc.Height()-pPhotoBmp->GetHeight())/2);			

			//释放图片
			pDownLoadBitmap->Destroy();
			pDownLoadBitmap = NULL;			
		}


		//用户名
		TRichView *pUserName = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_NameLbl));
		if(pUserName)
		{
			TUString::StrUtf8ToStrUnicode(pszUserName , (const Char *)Response->friends[0].fname);			
			objFontType = pUserName->GetFont();
			objFontType.Create(FONT_LARGE_NAME, FONT_LARGE_NAME);
			pUserName->SetFont(objFontType);
			pUserName->SetColor(CTL_COLOR_TYPE_FORE, RGB(67, 67, 135));
			pUserName->SetTransparent(TRUE);
			pUserName->SetCaption(pszUserName, FALSE);
			pUserName->SetEnabled(TRUE);			
		}

		//用户状态
		TPanel*pPanel = static_cast<TPanel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_StateContPanel));
		TRichView* pRichView = new TRichView();
		Int32 nRichViewId = 0;
		if(pRichView->Create(pPanel))	
		{
			TRectangle obBtnRec(0,0,0,0);
			pPanel->GetBounds(&obBtnRec);
			obBtnRec.SetX(0);
			obBtnRec.SetY(0);
			pRichView->SetBounds(&obBtnRec);
		
			TUString::StrUtf8ToStrUnicode(pszState, (Char*)Response->friends[0].state);
			objFontType = pRichView->GetFont();
			objFontType.Create(FONT_STATE, FONT_STATE);
			pRichView->SetFont(objFontType);
			pRichView->SetCaption(pszState,FALSE);

			pRichView->SetEnabled(FALSE);
			pRichView->SetWordWrapAttr(TRUE);
			pRichView->SetTransparent(TRUE);
			pRichView->SetScrollBarMode(CTL_SCL_MODE_NONE);
			pRichView->SetUnderLine(TRUE);
			Int32 nLineCount =  pRichView->GetLinesCount();
			if(nLineCount <7)
				nLineCount = 7;
		
			pRichView->SetMaxVisibleLines(nLineCount, TRUE);
		}		
		

		//状态更新时间
		TRichView* pStateTime = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_StateTimeLbl));		
		if(pStateTime)
		{
			objFontType = pStateTime->GetFont();
			objFontType.Create(FONT_OTHER_INFO, FONT_OTHER_INFO);
			pStateTime->SetFont(objFontType); 
			pStateTime->SetColor(CTL_COLOR_TYPE_FORE, RGB_COLOR_GRAY);
			pStateTime->SetTransparent(TRUE);
			//pStateTime->SetCaption(pszStateTime, FALSE);
			pStateTime->SetEnabled(TRUE);

			if(strcmp(Response->friends[0].state,"")==0)
			{				
				TUString::StrCat(pszStateTime, TUSTR_Kx_Left_Parenthesis);
				TUString::StrCat(pszStateTime, TResource::LoadConstString(APP_KA_ID_STRING_NoState));
				TUString::StrCat(pszStateTime, TUSTR_Kx_Right_Parenthesis);

				pStateTime->SetCaption(pszStateTime, FALSE);
			}
			else
			{
				TUChar* pszDateTime = NULL;
				cUnixTime_ConvertUnixTimeToFormatString( Response->friends[0].statetime, KX_TIME_FORMAT_YY_MM_DD, &pszDateTime );
				if(pszDateTime != NULL)
				{
					TUString::StrCat(pszStateTime, TUSTR_Kx_Left_Parenthesis);
					TUString::StrCat(pszStateTime, pszDateTime);
					TUString::StrCat(pszStateTime, TUSTR_Kx_Right_Parenthesis);
				}

				pStateTime->SetCaption(pszStateTime, FALSE);


				if(pszDateTime != NULL)
				{
					delete pszDateTime;
					pszDateTime = NULL;
				}
			}			

		}		


		//Set InfoCoolBar	Ctrls data
		//基本信息
		objFontType.Create(14, 14);


		/*"性别"*/
		TLabel* pGenderLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_GenderLbl));
		TLabel* pGenderValueLble = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_GenderValueLbl));
		if(pGenderLbl)
		{
			pGenderLbl->SetFont(objFontType);
			pGenderLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pGenderValueLble)
		{	
			pGenderValueLble->SetFont(objFontType);
			if(Response->friends[0].gender == 1)
			{
				pGenderValueLble->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_Female),FALSE);		
			}
			else
			{
				pGenderValueLble->SetCaption(TResource::LoadConstString(APP_KA_ID_STRING_Male),FALSE);		
			}
		}	

		/*"出生日期"*/	
		TUChar pszBirthdayValue[32] = {0};
		TUString::StrUtf8ToStrUnicode(pszBirthdayValue , (const Char *)Response->friends[0].birthday);
		TLabel* pBirthdayLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_BirthdayLbl));
		TLabel* pBirthdayValueLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_BirthdayValueLbl));
		if(pBirthdayLbl)
		{
			pBirthdayLbl->SetFont(objFontType);
			pBirthdayLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pBirthdayValueLbl)
		{
			pBirthdayValueLbl->SetFont(objFontType);
			pBirthdayValueLbl->SetCaption(pszBirthdayValue,FALSE);		
		}

		/*"现居住地"*/
		TUChar pszCityValue[64] = {0};
		TUString::StrUtf8ToStrUnicode(pszCityValue , (const Char *)Response->friends[0].city);
		TLabel* pCityLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_CityLbl));
		TRichView* pCityValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_CityValueView));
		if(pCityLbl)
		{
			pCityLbl->SetFont(objFontType);
			pCityLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pCityValueView)
		{		
			pCityValueView->SetCaption(pszCityValue,FALSE);
			pCityValueView->SetFont(objFontType); 				
			pCityValueView->SetWordWrapAttr(TRUE);
			pCityValueView->SetTransparent(TRUE);
			pCityValueView->SetEnabled(FALSE);
			pCityValueView->SetScrollBarMode(CTL_SCL_MODE_NONE);
			pCityValueView->SetMaxVisibleLines(pCityValueView->GetLinesCount(), TRUE);
			pCityValueView->GetBounds(&Rc_Temp);
		}

		/*" 家乡"*/
		TUChar pszHomeTownValue[256*3] = {0};
		TUString::StrUtf8ToStrUnicode(pszHomeTownValue , (const Char *)Response->friends[0].hometown);
		TLabel* pHomeTownLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_HomeTownLbl));
		TRichView* pHomeTownValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_HomeTownValueView));
		if(pHomeTownLbl)
		{
			pHomeTownLbl->SetFont(objFontType);
			pHomeTownLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pHomeTownValueView)
		{
			pHomeTownValueView->SetCaption(pszHomeTownValue,FALSE);
			pHomeTownValueView->SetFont(objFontType); 				
			pHomeTownValueView->SetWordWrapAttr(TRUE);
			pHomeTownValueView->SetTransparent(TRUE);
			pHomeTownValueView->SetEnabled(FALSE);
			pHomeTownValueView->SetScrollBarMode(CTL_SCL_MODE_NONE);
			pHomeTownValueView->SetMaxVisibleLines(pHomeTownValueView->GetLinesCount(), TRUE);
			pHomeTownValueView->GetBounds(&Rc_Temp);
		}

		/*"兴趣爱好"*/
		TUChar pszInterestValue[1024*3] = {0};
		TUString::StrUtf8ToStrUnicode(pszInterestValue , (const Char *)Response->friends[0].interest);
		TLabel* pInterestLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_InterestLbl));
		TRichView* pInterestValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_InterestValueView));
		if(pInterestLbl)
		{
			pInterestLbl->SetFont(objFontType);
			pInterestLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pInterestValueView)
		{
			pInterestValueView->SetCaption(pszInterestValue,FALSE);
			pInterestValueView->SetFont(objFontType); 				
			pInterestValueView->SetWordWrapAttr(TRUE);
			pInterestValueView->SetTransparent(TRUE);
			pInterestValueView->SetEnabled(FALSE);
			pInterestValueView->SetScrollBarMode(CTL_SCL_MODE_NONE);
			pInterestValueView->SetMaxVisibleLines(pInterestValueView->GetLinesCount(), TRUE);
			pInterestValueView->GetBounds(&Rc_Temp);
		}

		//其他信息
		/*"手机"*/
		TUChar pszMobileValue[32] = {0};
		TUString::StrUtf8ToStrUnicode(pszMobileValue , (const Char *)Response->friends[0].mobile);
		TLabel* pMobileLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_MobileLbl));
		TRichView* pMobileValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_MobileValueView));
		if(pMobileLbl)
		{
			pMobileLbl->SetFont(objFontType);
			pMobileLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pMobileValueView)
		{
			pMobileValueView->SetCaption(pszMobileValue,FALSE);
			pMobileValueView->SetFont(objFontType); 				
			pMobileValueView->SetWordWrapAttr(TRUE);
			pMobileValueView->SetTransparent(TRUE);
			pMobileValueView->SetEnabled(FALSE);
			pMobileValueView->SetScrollBarMode(CTL_SCL_MODE_NONE);
			pMobileValueView->SetMaxVisibleLines(pMobileValueView->GetLinesCount(), TRUE);
			pMobileValueView->GetBounds(&Rc_Temp);
		}

		/*"电话"*/				
		TUChar pszTelValue[32] = {0};
		TUString::StrUtf8ToStrUnicode(pszTelValue , (const Char *)Response->friends[0].tel);
		TLabel* pTelLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_TelLbl));
		TRichView* pTelValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_TelValueView));
		if(pTelLbl)
		{
			pTelLbl->SetFont(objFontType);
			pTelLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pTelValueView)
		{
			pTelValueView->SetCaption(pszTelValue,FALSE);
			pTelValueView->SetFont(objFontType); 				
			pTelValueView->SetWordWrapAttr(TRUE);
			pTelValueView->SetTransparent(TRUE);
			pTelValueView->SetEnabled(FALSE);
			pTelValueView->SetScrollBarMode(CTL_SCL_MODE_NONE);
			pTelValueView->SetMaxVisibleLines(pTelValueView->GetLinesCount(), TRUE);
			pTelValueView->GetBounds(&Rc_Temp);
		}

		/*"QQ号"*/
		TUChar pszQQValue[32] = {0};
		TUString::StrUtf8ToStrUnicode(pszQQValue , (const Char *)Response->friends[0].qq);		
		TLabel* pQQLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_QQLbl));
		TRichView* pQQValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_QQValueView));
		if(pQQLbl)
		{
			pQQLbl->SetFont(objFontType);
			pQQLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pQQValueView)
		{
			pQQValueView->SetCaption(pszQQValue,FALSE);
			pQQValueView->SetFont(objFontType); 				
			pQQValueView->SetWordWrapAttr(TRUE);
			pQQValueView->SetTransparent(TRUE);
			pQQValueView->SetEnabled(FALSE);
			pQQValueView->SetScrollBarMode(CTL_SCL_MODE_NONE);
			pQQValueView->SetMaxVisibleLines(pQQValueView->GetLinesCount(), TRUE);
			pQQValueView->GetBounds(&Rc_Temp);
		}

		/*"MSN账号"*/			
		TUChar pszMSNValue[128] = {0};
		TUString::StrUtf8ToStrUnicode(pszMSNValue , (const Char *)Response->friends[0].msn);
		TLabel* pMSNLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_MSNLbl));
		TRichView* pMSNValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_MSNValueView));
		if(pMSNLbl)
		{
			pMSNLbl->SetFont(objFontType);
			pMSNLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pMSNValueView)
		{
			pMSNValueView->SetCaption(pszMSNValue,FALSE);
			pMSNValueView->SetFont(objFontType); 				
			pMSNValueView->SetWordWrapAttr(TRUE);
			pMSNValueView->SetTransparent(TRUE);
			pMSNValueView->SetEnabled(FALSE);
			pMSNValueView->SetScrollBarMode(CTL_SCL_MODE_NONE);
			pMSNValueView->SetMaxVisibleLines(pMSNValueView->GetLinesCount(), TRUE);
		}

		/*"地址"*/
		TUChar pszAddressValue[1024] = {0};
		TUString::StrUtf8ToStrUnicode(pszAddressValue , (const Char *)Response->friends[0].address);
		TLabel* pAddressLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_AddressLbl));
		TRichView* pAddressValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_AddressValueView));
		if(pAddressLbl)
		{
			pAddressLbl->SetFont(objFontType);
			pAddressLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pAddressValueView)
		{
			pAddressValueView->SetCaption(pszAddressValue,FALSE);
			pAddressValueView->SetFont(objFontType); 				
			pAddressValueView->SetWordWrapAttr(TRUE);
			pAddressValueView->SetTransparent(TRUE);
			pAddressValueView->SetEnabled(FALSE);
			pAddressValueView->SetScrollBarMode(CTL_SCL_MODE_NONE);
			pAddressValueView->SetMaxVisibleLines(pAddressValueView->GetLinesCount(), TRUE);
			pAddressValueView->GetBounds(&Rc_Temp);
		}

		/*"邮编"*/
		TUChar pszZipValue[32] = {0};
		TUString::StrUtf8ToStrUnicode(pszZipValue , (const Char *)Response->friends[0].zip);
		TLabel* pZipLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_ZipLbl));
		TRichView* pZipValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_ZipValueView));
		if(pZipLbl)
		{
			pZipLbl->SetFont(objFontType);
			pZipLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pZipValueView)
		{
			pZipValueView->SetCaption(pszZipValue,FALSE);
			pZipValueView->SetFont(objFontType); 				
			pZipValueView->SetWordWrapAttr(TRUE);
			pZipValueView->SetTransparent(TRUE);
			pZipValueView->SetEnabled(FALSE);
			pZipValueView->SetScrollBarMode(CTL_SCL_MODE_NONE);
			pZipValueView->SetMaxVisibleLines(pZipValueView->GetLinesCount(), TRUE);
			pZipValueView->GetBounds(&Rc_Temp);
		}

		/*"电子邮件"*/				
		TUChar pszEmailValue[128] = {0};
		TUString::StrUtf8ToStrUnicode(pszEmailValue , (const Char *)Response->friends[0].email);
		TLabel* pEmailLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_EmailLbl));
		TRichView* pEmailValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_EmailValueView));
		if(pEmailLbl)
		{
			pEmailLbl->SetFont(objFontType);
			pEmailLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pEmailValueView)
		{
			pEmailValueView->SetCaption(pszEmailValue,FALSE);
			pEmailValueView->SetFont(objFontType); 				
			pEmailValueView->SetWordWrapAttr(TRUE);
			pEmailValueView->SetTransparent(TRUE);
			pEmailValueView->SetEnabled(FALSE);
			pEmailValueView->SetScrollBarMode(CTL_SCL_MODE_NONE);
			pEmailValueView->SetMaxVisibleLines(pEmailValueView->GetLinesCount(), TRUE);
			pEmailValueView->GetBounds(&Rc_Temp);
		}

		/*"教育背景"*/				
		TUChar pszEduValue[1024] = {0};	

		for(int i=0; i<Response->friends[0].nSize_education; i++)
		{
			TUChar pszTemp[128*3] = {0};
			TUChar pszYear[32] = {0};	

			//院校名
			TUString::StrUtf8ToStrUnicode(pszTemp , (const Char *)Response->friends[0].education[i].school);
			TUString::StrCat(pszEduValue,pszTemp);
			TUString::StrCat(pszEduValue, TUSTR_Kx_Empty_Cell);

			//班级
			TUString::StrUtf8ToStrUnicode(pszTemp , (const Char *)Response->friends[0].education[i].classEx);
			TUString::StrCat(pszEduValue,pszTemp);
			TUString::StrCat(pszEduValue, TUSTR_Kx_Ellipsis);

			//届
			TUString::StrUtf8ToStrUnicode(pszYear , (const Char *)Response->friends[0].education[i].year);
			TUString::StrCat(pszEduValue,pszYear);					
			TUString::StrCat(pszEduValue, (const TUChar*)TUSTR_Kx_Newline_Character);
		}		
		TLabel* pEduLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_EduLbl));
		TRichView* pEduValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_EduValueView));
		if(pEduLbl)
		{
			pEduLbl->SetFont(objFontType);
			pEduLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pEduValueView)
		{
			pEduValueView->SetCaption(pszEduValue,FALSE);
			pEduValueView->SetFont(objFontType); 				
			pEduValueView->SetWordWrapAttr(TRUE);
			pEduValueView->SetTransparent(TRUE);
			pEduValueView->SetEnabled(FALSE);
			pEduValueView->SetScrollBarMode(CTL_SCL_MODE_NONE);
			pEduValueView->SetMaxVisibleLines(pEduValueView->GetLinesCount(), TRUE);
			pEduValueView->GetBounds(&Rc_Temp);
		}

		/*"工作经历"*/				
		TUChar pszCareerValue[1024] = {0};
		for(int i=0; i<Response->friends[0].nSize_career; i++)
		{
			TUChar pszTemp[128*3] = {0};
			TUChar pszYear[8] = {0};
			TUChar pszMonth[8] = {0};	

			//公司名
			TUString::StrUtf8ToStrUnicode(pszTemp , (const Char *)Response->friends[0].career[i].company);
			TUString::StrCat(pszCareerValue,pszTemp);
			TUString::StrCat(pszCareerValue, TUSTR_Kx_Empty_Cell);

			//部门名
			TUString::StrUtf8ToStrUnicode(pszTemp , (const Char *)Response->friends[0].career[i].dept);
			TUString::StrCat(pszCareerValue,pszTemp);
			TUString::StrCat(pszCareerValue, TUSTR_Kx_Empty_Cell);

			//开始年月
			TUString::StrUtf8ToStrUnicode(pszYear , (const Char *)Response->friends[0].career[i].beginyear);
			TUString::StrCat(pszCareerValue,pszYear);			
			TUString::StrCat(pszCareerValue, TResource::LoadConstString(APP_KA_ID_STRING_Year));

			TUString::StrUtf8ToStrUnicode(pszMonth , (const Char *)Response->friends[0].career[i].beginmonth);
			TUString::StrCat(pszCareerValue,pszMonth);			
			TUString::StrCat(pszCareerValue, TResource::LoadConstString(APP_KA_ID_STRING_Month));		

			//分隔符-
			TUString::StrCat(pszCareerValue, TUSTR_Kx_Separator);	

			//结束年月
			TUString::StrUtf8ToStrUnicode(pszYear , (const Char *)Response->friends[0].career[i].endyear);
			if(TUString::StrLen(pszYear)==0)
			{
				TUString::StrCat(pszCareerValue, TResource::LoadConstString(APP_KA_ID_STRING_Now));
			}
			else
			{
				TUString::StrCat(pszCareerValue,pszYear);			
				TUString::StrCat(pszCareerValue, TResource::LoadConstString(APP_KA_ID_STRING_Year));

				TUString::StrUtf8ToStrUnicode(pszMonth , (const Char *)Response->friends[0].career[i].endmonth);
				TUString::StrCat(pszCareerValue,pszMonth);			
				TUString::StrCat(pszCareerValue, TResource::LoadConstString(APP_KA_ID_STRING_Month));
			}

			TUString::StrCat(pszCareerValue, (const TUChar*)TUSTR_Kx_Newline_Character);
		}
		TLabel* pCareerLbl = static_cast<TLabel*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_CareerLbl));
		TRichView* pCareerValueView = static_cast<TRichView*>(GetControlPtr(APP_KA_ID_UserInfoDetailForm_CareerValueView));
		if(pCareerLbl)
		{
			pCareerLbl->SetFont(objFontType);
			pCareerLbl->SetColor(CTL_COLOR_TYPE_FORE, GRAY);
		}
		if(pCareerValueView)
		{
			pCareerValueView->SetCaption(pszCareerValue,FALSE);
			pCareerValueView->SetFont(objFontType); 				
			pCareerValueView->SetWordWrapAttr(TRUE);
			pCareerValueView->SetTransparent(TRUE);
			pCareerValueView->SetEnabled(FALSE);
			pCareerValueView->SetScrollBarMode(CTL_SCL_MODE_NONE);
			pCareerValueView->SetMaxVisibleLines(pCareerValueView->GetLinesCount(), TRUE);
			pCareerValueView->GetBounds(&Rc_Temp);
		}
	}
}