本文整理汇总了C++中CEikLabel::Text方法的典型用法代码示例。如果您正苦于以下问题:C++ CEikLabel::Text方法的具体用法?C++ CEikLabel::Text怎么用?C++ CEikLabel::Text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEikLabel
的用法示例。
在下文中一共展示了CEikLabel::Text方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SizeChanged
void CMainMenuListContainer::SizeChanged()
{
CCoeControl::SizeChanged();
if(iBgContext) {
iBgContext->SetRect(Rect());
if (&Window()) {
iBgContext->SetParentPos(PositionRelativeToScreen());
}
}
CCoeControlArray::TCursor cursor = Components().Find(ETitleLabel);
CEikLabel* label = cursor.Control<CEikLabel>();
const TDesC* titleText = label->Text();
TRect rect = Rect();
CFont* titleFont = FindLargestPossibleFontL(*titleText, rect.Width(), EAknLogicalFontPrimaryFont);
label->SetFont(titleFont);
CEikonEnv::Static()->ScreenDevice()->ReleaseFont(titleFont);
// Set the size of the label, need to think of the descent as well.
TSize size = label->MinimumSize();
size.iWidth = rect.Width();
TInt descent = label->Font()->DescentInPixels();
size.iHeight += descent;
// Set the pos for the listbox, use the height for the label when doing this.
// Also add the descent in pixels to get some space between the label and the
// listbox.
rect.iTl.iY = descent;
TPoint pos(0, descent);
label->SetExtent(rect.iTl, size);
rect.iTl.iY += size.iHeight;
// As default display both rows and hide the scrollbars
HideSecondRow(EFalse);
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
CEikScrollBarFrame::EOff);
// Need to set the rect to get the listbox to update its values
iListBox->SetRect(rect);
TInt listBoxHeight = iListBox->ItemHeight() * iListBox->Model()->NumberOfItems();
if (listBoxHeight > rect.Height()) {
// The listbox is to large to fint, hide the row and check again.
HideSecondRow(ETrue);
iListBox->SetRect(rect);
listBoxHeight = iListBox->ItemHeight() * iListBox->Model()->NumberOfItems();
if (listBoxHeight > rect.Height()) {
// Show scroll bar only if the height of the listbox is larger then
// the rect.
iListBox->ScrollBarFrame()->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
CEikScrollBarFrame::EOn);
iListBox->UpdateScrollBarsL();
}
}
else {
// Setting the first item gets the list box positioned correctly on the screen
iListBox->ScrollToMakeItemVisible(0);
}
}
示例2: Read
void ContactsReader::Read() {
app_state_.Reset();
app_helper_.ReadTitle(&control_tree_, &app_state_);
// return;
const TVwsViewId view_id = app_helper_.ReadView(&control_tree_, &app_state_);
return;
app_helper_.ReadCba(&control_tree_, &app_state_);
CEikMenuBar* menu = control_tree_.MenuBar();
if (menu && menu->IsFocused()) {
CEikMenuPane* pane = menu->MenuPane();
app_helper_.ReadMenu(pane, &app_state_);
if (pane) {
return;
}
}
// TODO(mikie): move tab reading to AppHelper.
CAknTabGroup* tabgroup = control_tree_.TabGroup();
if (tabgroup) {
app_state_.SetSelectedTabIndex(tabgroup->ActiveTabIndex());
app_state_.SetTabCount(tabgroup->TabCount());
const TInt id = tabgroup->ActiveTabId();
CAknTabGroupAccess* access = (CAknTabGroupAccess*)tabgroup;
CArrayPtr<CAknTabAccess>* tabs = access->iTabArray;
for (int i = 0; i < tabs->Count(); ++i) {
CAknTabAccess* tab = tabs->At(i);
CCoeControl* tab_control = (CCoeControl*)tab;
if (tab && tab->iId == id) {
// Not all tabs have text.
CEikLabel* label = tab->iLabel;
if (label) {
app_state_.SetSelectedTabText(*label->Text());
}
break;
}
}
}
if (view_id.iAppUid != ForApplication()) {
return;
}
const TUint view = view_id.iViewUid.iUid;
if (view == 1) {
// Main contacts view
CCoeControl* top = control_tree_.TopFocusedControl();
if (top->CountComponentControls() == 0) return;
CCoeControl* container = top->ComponentControl(0);
if (container->CountComponentControls() < 2) return;
CEikListBox* listbox = (CEikListBox*)container->ComponentControl(0);
CAknSearchField* field = (CAknSearchField*)container->ComponentControl(1);
ReadList(listbox, &app_state_);
HBufC* text = HBufC::NewLC(field->TextLength());
TPtr16 textp = text->Des();
field->GetSearchText(textp);
app_state_.SetSearchFieldText(*text);
CleanupStack::PopAndDestroy(text);
} else if (view == 4) {
// Details (read-only) view
CCoeControl* top = control_tree_.TopFocusedControl();
if (top->CountComponentControls() == 0) return;
CCoeControl* container = top->ComponentControl(0);
if (container->CountComponentControls() < 1) return;
CEikListBox* listbox = (CEikListBox*)container->ComponentControl(0);
ReadList(listbox, &app_state_);
}
}