本文整理汇总了C++中TFont类的典型用法代码示例。如果您正苦于以下问题:C++ TFont类的具体用法?C++ TFont怎么用?C++ TFont使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TFont类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: CtrlSetFont
//设置控件文本大小颜色
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);
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:8,代码来源:gui_common.cpp
示例2: CtrlAddItemToWin_Label
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;
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:34,代码来源:gui_common.cpp
示例3: CtrlAddItemToCoolBarList_Lable
//添加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;
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:36,代码来源:gui_common.cpp
示例4: TFont
void __fastcall TCustomDrawDemoEditorForm::sbFontClick(TObject *Sender)
{
if (FontDialog->Execute()){
TFont *AFont = new TFont();
AFont->Assign(FontDialog->Font);
GetSelectedDrawItem()->Font = AFont;
CustomDrawDemoMainForm->cxDBVerticalGrid->Invalidate();
}
}
开发者ID:chinnyannieb,项目名称:Meus-Projetos,代码行数:9,代码来源:CustomDrawDemoEditor.cpp
示例5: SetAppTilte
//创建应用标题默认居中
//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;
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:60,代码来源:gui_common.cpp
示例6: obBtnRec
/**
* 创建功能按键
*
* \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;
}
开发者ID:pengjohn,项目名称:RenRen,代码行数:56,代码来源:RenRenForm_MainMenu.cpp
示例7: ShowAsShort
//如果内容太长显示不完则用省略号表示
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
}
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:27,代码来源:gui_common.cpp
示例8:
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;
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:16,代码来源:btntextg.cpp
示例9: tvterm_put_uchar
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;
}
开发者ID:takeutch-kemeco,项目名称:jfbterm-0.4.7.1,代码行数:40,代码来源:vterm.c
示例10: SetAppTitleButton
//设置应用标题栏按钮
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;
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:40,代码来源:gui_common.cpp
示例11: GetShowAllStringWidth
//根据字体计算出显示整个字串所需的像素
//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;//刚刚好的长度显示字串时有问题,故再加两个像素
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:17,代码来源:gui_common.cpp
示例12: GetOuterSizes
//
/// 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;
}
开发者ID:AlleyCat1976,项目名称:Meridian59_103,代码行数:32,代码来源:textgadg.cpp
示例13: RefAdd
//
/// 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
}
开发者ID:Darkman-M59,项目名称:Meridian59_115,代码行数:18,代码来源:font.cpp
示例14: m_pBitmap
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;
}
}
开发者ID:geniikw,项目名称:myFirst2DGame,代码行数:98,代码来源:CCXBitmapDC.cpp
示例15: KaiXinAPI_JsonParse
// 窗口初始化
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 );
}
//.........这里部分代码省略.........
开发者ID:pengjohn,项目名称:kaixin,代码行数:101,代码来源:KaiXinAPI_GardenList.cpp
示例16: obBtnRec
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);
//.........这里部分代码省略.........
开发者ID:pengjohn,项目名称:kaixin,代码行数:101,代码来源:KaiXinAPI_CommentDetail.cpp
示例17: XGetIMValues
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);
}
开发者ID:mikevoydanoff,项目名称:zoinks,代码行数:68,代码来源:TWindow.cpp
示例18: GetShowAllStringWidthEx
Int32 GetShowAllStringWidthEx(TUChar* pCaptionString, Int32 FontSize)
{
TFont objFontType;
objFontType.Create(FontSize, FontSize);
return GetShowAllStringWidth(pCaptionString, objFontType);
}
开发者ID:pengjohn,项目名称:kaixin,代码行数:6,代码来源:gui_common.cpp
示例19: _SetDataToCtrls
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);
//.........这里部分代码省略.........
开发者ID:pengjohn,项目名称:kaixin,代码行数:101,代码来源:KaiXinAPI_UserInfoDetail.cpp
注:本文中的TFont类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论