本文整理汇总了C++中Label::SetTextConfig方法的典型用法代码示例。如果您正苦于以下问题:C++ Label::SetTextConfig方法的具体用法?C++ Label::SetTextConfig怎么用?C++ Label::SetTextConfig使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label::SetTextConfig方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createTableViewItem
TableViewItem* TizenTextOptionView::createTableViewItem(int itemWidth, int defaultItemHeight) {
TableViewAnnexStyle style = TABLE_VIEW_ANNEX_STYLE_NORMAL;
//TableViewAnnexStyle style = TABLE_VIEW_ANNEX_STYLE_DETAILED;
//TableViewAnnexStyle style = TABLE_VIEW_ANNEX_STYLE_MARK;
TableViewItem* pItem = new TableViewItem();
pItem->Construct(Dimension(itemWidth, 2*defaultItemHeight-25), style);
pItem->SetFocusable(false);
Label* pLabel = new Label();
pLabel->Construct(Rectangle(0, 0, itemWidth, defaultItemHeight-10), myCaption);
pLabel->SetTextConfig(30.0f, LABEL_TEXT_STYLE_NORMAL);
pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pItem->AddControl(pLabel);
// Creates an instance of TextBox
TextBox* __pTextBox = new TextBox();
__pTextBox->Construct(Rectangle(10, defaultItemHeight-30, itemWidth-20, defaultItemHeight-10), TEXT_BOX_BORDER_ROUNDED);
// Sets properties on the text box
__pTextBox->SetTextSize(30);
__pTextBox->SetText(myText);
__pTextBox->SetTextColor(TEXT_BOX_TEXT_COLOR_HIGHLIGHTED, Color::GetColor(COLOR_ID_RED));
//__pTextBox->SetTextSize(40);
//__pTextBox->AppendText(L"\nTizen SDK");
pItem->AddControl(__pTextBox);
pItem->SetIndividualSelectionEnabled(pLabel, true);
pItem->SetIndividualSelectionEnabled(__pTextBox, true);
return pItem;
}
示例2: Construct
result AttachPhotoElement::Construct(const Tizen::Graphics::Rectangle & rect, const Tizen::Base::String &url) {
result r = E_SUCCESS;
r = AttachElement::Construct(rect);
RelativeLayout * layout = dynamic_cast<RelativeLayout *>(GetLayoutN());
_url = String(url);
int slash = -111;
// r = _url.LastIndexOf(L'/', 0, slash);
for (int i=0; i<_url.GetLength(); i++) {
wchar_t sym;
_url.GetCharAt(i, sym);
if (sym == L'/')
slash = i;
}
slash++;
String fileName;
_url.SubString(slash, fileName);
_icon = new LocalImageView();
_icon->Construct(Rectangle(0, 0, 72, 72), "icon_photo.png");
// r = layout->SetCenterAligned(*_icon, CENTER_ALIGN_VERTICAL);
Label *label = new Label();
label->Construct(Rectangle(0, 0, rect.width, 40), fileName);
label->SetTextConfig(30, LABEL_TEXT_STYLE_NORMAL);
_pProgress = new SaneProgressBar();
_pProgress->Construct(Rectangle(0, 0, rect.width-20, 20), 0, 100);
_pProgress->SetProgress(0);
r = AddControl(label);
r = AddControl(_icon);
r = AddControl(_pProgress);
r = layout->SetCenterAligned(*_icon, CENTER_ALIGN_HORIZONTAL);
r = layout->SetRelation(*_icon, this, RECT_EDGE_RELATION_TOP_TO_TOP);
r = layout->SetMargin(*_icon, 0, 0, 20, 0);
r = layout->SetRelation(*label, _icon, RECT_EDGE_RELATION_TOP_TO_BOTTOM);
r = layout->SetCenterAligned(*label, CENTER_ALIGN_HORIZONTAL);
r = layout->SetMargin(*label, 10, 10, 10, 0);
r = layout->SetRelation(*_pProgress, label, RECT_EDGE_RELATION_TOP_TO_BOTTOM);
r = layout->SetMargin(*_pProgress, 10, 10, 20, 0);
r = layout->SetCenterAligned(*_pProgress, CENTER_ALIGN_HORIZONTAL);
_loading = true;
RequestRedraw(true);
SetUploaded(false);
StartUpload(_url);
return r;
}
示例3: Label
void ProjectGiraffeTab1::displayNoGraffiti(){
Label* noGraffitiLabel = new Label();
noGraffitiLabel->Construct(Rectangle(0, 80, GetBounds().width, 40), "posts");
noGraffitiLabel->SetTextConfig(32, LABEL_TEXT_STYLE_BOLD);
noGraffitiLabel->SetTextHorizontalAlignment(ALIGNMENT_CENTER);
noGraffitiLabel->SetName("noGraffitiLabel");
noGraffitiLabel->SetText(L"No nearby graffiti");
AddControl(*noGraffitiLabel);
}
示例4: GetHeader
//.........这里部分代码省略.........
pEndDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
pScrollPanel->AddControl(pEndDateLabel);
__pEndEditDate = new (std::nothrow) EditDate();
__pEndEditDate->Construct(Point(UI_X_POSITION_GAP, yPosition + 10));
__pEndEditDate->SetCurrentDate();
__pEndEditDate->SetYearRange(minYear, maxYear);
__pEndEditDate->AddDateChangeEventListener(*this);
pScrollPanel->AddControl(__pEndEditDate);
DateTime endTime;
endTime = __pStartEditTime->GetTime();
endTime.AddHours(1);
__pEndEditTime = new (std::nothrow) EditTime();
__pEndEditTime->Construct(Point(UI_X_POSITION_MIDDLE * 2 + UI_SPACE, yPosition + 10));
__pEndEditTime->SetTime(endTime);
__pEndEditTime->AddTimeChangeEventListener(*this);
pScrollPanel->AddControl(__pEndEditTime);
// TimeZone
Label* pTimeZoneLabel = new (std::nothrow) Label();
pTimeZoneLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"TimeZone");
pTimeZoneLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pTimeZoneLabel->SetTextColor(COLOR_TITLE_LABEL);
pTimeZoneLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
pScrollPanel->AddControl(pTimeZoneLabel);
Label* pTimeZoneDataLabel = new (std::nothrow) Label();
pTimeZoneDataLabel->Construct(Rectangle(UI_X_POSITION_GAP + UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L"");
pTimeZoneDataLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pTimeZoneDataLabel->SetText(GetTimezoneString());
pTimeZoneDataLabel->SetTextColor(COLOR_TIMEZONE_DATA);
pTimeZoneDataLabel->SetTextConfig(FONT_SIZE, LABEL_TEXT_STYLE_NORMAL);
pTimeZoneDataLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL);
pScrollPanel->AddControl(pTimeZoneDataLabel);
// All day Event
__pIsAllDayButton = new (std::nothrow) CheckButton();
__pIsAllDayButton->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), CHECK_BUTTON_STYLE_ONOFF_SLIDING, BACKGROUND_STYLE_DEFAULT, false, L"All day Event");
__pIsAllDayButton->SetActionId(ID_CHKBUTTON_ISALLDAY_CHECKED, ID_CHKBUTTON_ISALLDAY_UNCHECKED);
__pIsAllDayButton->SetTextColor(COLOR_TITLE_LABEL);
__pIsAllDayButton->AddActionEventListener(*this);
pScrollPanel->AddControl(__pIsAllDayButton);
// Location
__pLocationEditField = new (std::nothrow) EditField();
__pLocationEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_FULLSCREEN, EDIT_FIELD_TITLE_STYLE_TOP);
__pLocationEditField->SetTitleText(L"Location");
__pLocationEditField->SetGuideText(L"Enter the location");
pScrollPanel->AddControl(__pLocationEditField);
// Description
__pDescriptionEditField = new (std::nothrow) EditField();
__pDescriptionEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_FULLSCREEN, EDIT_FIELD_TITLE_STYLE_TOP);
__pDescriptionEditField->SetTitleText(L"Description");
__pDescriptionEditField->SetGuideText(L"Enter the description");
pScrollPanel->AddControl(__pDescriptionEditField);
// Reminder
Label* pReminderLabel = new (std::nothrow) Label();
pReminderLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), L"Reminder");
pReminderLabel->SetTextColor(COLOR_TITLE_LABEL);
pReminderLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL));
pReminderLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
pScrollPanel->AddControl(pReminderLabel);
示例5: Construct
result MessageDocElement::Construct(const Tizen::Graphics::Rectangle & rect, JsonObject * docObject, int out) {
result r = E_SUCCESS;
_pDocObject = docObject->CloneN();
RelativeLayout layout;
layout.Construct();
AppResource* pAppResource = VKUApp::GetInstance()->GetAppResource();
String docName;
JsonParseUtils::GetString(*docObject, L"title", docName);
int size;
JsonParseUtils::GetInteger(*docObject, L"size", size);
r = Panel::Construct(layout, rect);
r = SetSize(Dimension(rect.width, rect.height));
const String filename = (out == 1) ? L"doc_out.#.png" : L"doc_in.#.png";
_pBitmap = pAppResource->GetBitmapN(filename);
// TryCatch(GetLastResult() == E_SUCCESS, r = GetLastResult(), "Failed pAppResource->GetBitmapN");
_pIcon = new LocalImageView();
_pIcon->Construct(Rectangle(0, 0, 72, 72), L"icon_document.png");
r = AddControl(_pIcon);
Label *docLabel = new Label();
docLabel->Construct(Rectangle(0, 0, rect.width-72, 35), docName);
docLabel->SetMargin(0, 0);
docLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
docLabel->SetTextConfig(30, LABEL_TEXT_STYLE_BOLD);
r = AddControl(docLabel);
Label *sizeLabel = new Label();
sizeLabel->Construct(Rectangle(0, 0, rect.width-72, 30), GetSizeString(size));
sizeLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
sizeLabel->SetTextConfig(25, LABEL_TEXT_STYLE_NORMAL);
sizeLabel->SetMargin(0, 0);
r = AddControl(sizeLabel);
layout.SetRelation(*_pIcon, this, RECT_EDGE_RELATION_LEFT_TO_LEFT);
layout.SetCenterAligned(*_pIcon, CENTER_ALIGN_VERTICAL);
layout.SetMargin(*_pIcon, 0, 0, 0, 0);
layout.SetRelation(*docLabel, this, RECT_EDGE_RELATION_TOP_TO_TOP);
layout.SetRelation(*docLabel, this, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
layout.SetRelation(*docLabel, _pIcon, RECT_EDGE_RELATION_LEFT_TO_RIGHT);
layout.SetMargin(*docLabel, 0, 10, 10, 0);
layout.SetHorizontalFitPolicy(*docLabel, FIT_POLICY_CONTENT);
layout.SetRelation(*sizeLabel, docLabel, RECT_EDGE_RELATION_TOP_TO_BOTTOM);
layout.SetRelation(*sizeLabel, _pIcon, RECT_EDGE_RELATION_LEFT_TO_RIGHT);
layout.SetMargin(*sizeLabel, 0, 10, 5, 0);
layout.SetHorizontalFitPolicy(*sizeLabel, FIT_POLICY_CONTENT);
SetSize(Dimension(rect.width, 90));
SetPropagatedTouchEventListener(this);
return r;
}
示例6: ScrollPanel
void
ProjectGiraffeTab4::showProfile(void)
{
RemoveAllControls();
//add scroll panel
ScrollPanel *scrollPanel = new ScrollPanel();
scrollPanel->Construct(Rectangle(0, 160, GetBounds().width, GetBounds().height - 160));
User *cUser = User::currentUser();
// Avatar button? image?
Button* avatarButton = new Button();
avatarButton->Construct(Rectangle(10, 10, 250, 250), "");
avatarButton->SetName("avatarButton");
avatarButton->SetActionId(ID_BUTTON_AVATAR);
avatarButton->AddActionEventListener(*this);
AddControl(*avatarButton);
if (_avatarContextMenu == null) {
_avatarContextMenu = new ContextMenu();
_avatarContextMenu->Construct(Point(135, 420), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD);
_avatarContextMenu->AddItem("Choose from library", ID_CONTEXT_CHOOSE);
_avatarContextMenu->AddItem("Take photo", ID_CONTEXT_TAKE);
_avatarContextMenu->AddActionEventListener(*this);
_avatarContextMenu->SetShowState(false);
_avatarContextMenu->Invalidate(true);
}
Label* usernameLabel = new Label();
usernameLabel->Construct(Rectangle(270, 10, GetBounds().width - 20, 60), cUser->username());
usernameLabel->SetTextConfig(48, LABEL_TEXT_STYLE_BOLD);
usernameLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
usernameLabel->SetName("usernameLabel");
AddControl(*usernameLabel);
Label* postsLabel = new Label();
postsLabel->Construct(Rectangle(270, 80, GetBounds().width/3, 40), "posts");
postsLabel->SetTextConfig(32, LABEL_TEXT_STYLE_BOLD);
postsLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT);
postsLabel->SetName("postsLabel");
AddControl(*postsLabel);
/*
// logout button
Button* logoutButton = new Button();
logoutButton->Construct(Rectangle(GetBounds().width/2 + 30, 10, 300, 80), "Logout");
// centerHorizontally(updateButton1, this);
logoutButton->SetName("logoutButton");
logoutButton->SetActionId(ID_BUTTON_LOGOUT);
logoutButton->AddActionEventListener(*this);
scrollPanel->AddControl(*logoutButton);
// Avatar button? image?
Button* avatarButton = new Button();
avatarButton->Construct(Rectangle(10, 10, 250, 250), "");
avatarButton->SetName("avatarButton");
avatarButton->SetActionId(ID_BUTTON_AVATAR);
avatarButton->AddActionEventListener(*this);
scrollPanel->AddControl(*avatarButton);
if (_avatarContextMenu == null) {
_avatarContextMenu = new ContextMenu();
_avatarContextMenu->Construct(Point(135, 420), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_DOWNWARD);
_avatarContextMenu->AddItem("Choose from library", ID_CONTEXT_CHOOSE);
_avatarContextMenu->AddItem("Take photo", ID_CONTEXT_TAKE);
_avatarContextMenu->AddActionEventListener(*this);
_avatarContextMenu->SetShowState(false);
_avatarContextMenu->Invalidate(true);
}
*/
// Create tableView
_tableView = new TableView();
_tableView->Construct(Rectangle(0,270,GetBounds().width, GetBounds().height-270), \
true, TABLE_VIEW_SCROLL_BAR_STYLE_FADE_OUT);
_tableView->SetItemProvider(this);
_tableView->AddTableViewItemEventListener(*this);
AddControl(*_tableView);
_items = new (std::nothrow) ArrayList();
updateItems();
Draw();
}
示例7: CreateItem
TableViewItem* VKUMessagesListItemProvider::CreateItem(int index, int itemWidth) {
result r;
AppLog("VKUMessagesListItemProvider::CreateItem");
RoundedAvatar *pAvatar; // NOTE: used only if chat and message is out==0
MessageBubble* pMessageBubble;
RelativeLayout itemLayout;
Color bgColor;
JsonObject *itemObject;
IJsonValue *itemValue;
TableViewItem* pItem;
JsonNumber outNumber;
ArrayList *pMessageElements;
Label *pTimeStamp;
String timespampText;
int timestampValue;
String messageText(L"no text????");
int out = 0, readState = 0;
// reverse list
int reversedIndex = _messagesJson->GetCount() - 1 - index;
AppLog("Item %d of %d", reversedIndex, GetItemCount());
// get message string
r = _messagesJson->GetAt(reversedIndex, itemValue);
TryCatch(r == E_SUCCESS, , "Failed GetAt");
itemObject = static_cast<JsonObject *>(itemValue);
JsonParseUtils::GetInteger(*itemObject, L"out", out);
JsonParseUtils::GetInteger(*itemObject, L"date", timestampValue);
JsonParseUtils::GetInteger(*itemObject, L"read_state", readState);
TimeUtils::GetDialogsTime(timestampValue, timespampText);
// create rich text panel
AppLog("Message is %d == out", out);
pMessageBubble = new MessageBubble();
r = pMessageBubble->Construct(Dimension(itemWidth, LIST_HEIGHT));
TryCatch(r == E_SUCCESS, , "Failed Construct RichTextPanel");
pMessageBubble->SetOut(out);
AppLog("RTPanel created and constructed");
itemLayout.Construct();
// get available elements
pMessageElements = GetMessageElementsN(itemObject, itemWidth);
// message text element
for (int i=0; i<pMessageElements->GetCount(); i++) {
AppLog("Adding element %d to pItem", i);
MessageElement *pElement = static_cast<MessageElement *>(pMessageElements->GetAt(i));
pMessageBubble->AddElement(pElement);
AppLog("Added element %d to pItem with size of %dx%d", i, pElement->GetWidth(), pElement->GetHeight());
}
// timestamp label
pTimeStamp = new Label();
pTimeStamp->Construct(Rectangle(0, 0, 100, 28), timespampText);
pTimeStamp->SetTextConfig(28, LABEL_TEXT_STYLE_NORMAL);
pTimeStamp->SetTextColor(Color(TIMESTAMP_TEXT_COLOR, false));
// create table item
pItem = new TableViewItem();
r = pItem->Construct(itemLayout, Dimension(itemWidth, pMessageBubble->GetHeight() + 2*BUBBLE_VERTICAL_MARGIN));
TryCatch(r == E_SUCCESS, , "Failed GetAt");
if (out == 0 && _peerId > 2000000000) {
int fromId;
JsonParseUtils::GetInteger(*itemObject, L"from_id", fromId);
AppLog("Finding avatar for %d", fromId);
pAvatar = new RoundedAvatar(AVATAR_NORMAL);
String * avatarUrl = static_cast<String *>(_pUserIdAvatarMap->GetValue(Integer(fromId)));
pAvatar->Construct(Rectangle(0, 0, 80, 80), *avatarUrl);
r = pItem->AddControl(pAvatar);
itemLayout.SetRelation(*pAvatar, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT);
itemLayout.SetRelation(*pAvatar, pItem, RECT_EDGE_RELATION_TOP_TO_TOP);
itemLayout.SetMargin(*pAvatar, 10, 0, 10, 0);
}
// add rich text panel to table item
r = pItem->AddControl(pMessageBubble);
TryCatch(r == E_SUCCESS, , "Failed AddControl");
r = pItem->AddControl(pTimeStamp);
itemLayout.SetCenterAligned(*pMessageBubble, CENTER_ALIGN_VERTICAL);
itemLayout.SetHorizontalFitPolicy(*pTimeStamp, FIT_POLICY_CONTENT);
if (out == 1) {
itemLayout.SetRelation(*pMessageBubble, *pItem, RECT_EDGE_RELATION_RIGHT_TO_RIGHT);
itemLayout.SetMargin(*pMessageBubble, 0, 10, 0, 0);
itemLayout.SetRelation(*pTimeStamp, *pMessageBubble, RECT_EDGE_RELATION_RIGHT_TO_LEFT);
itemLayout.SetRelation(*pTimeStamp, *pItem, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM);
itemLayout.SetMargin(*pTimeStamp, 0, 10, 0, 30);
//.........这里部分代码省略.........