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; }
result VideoviewForm::OnInitializing(void) { result r = E_SUCCESS; // Sets an overlay region area int widthVideo = 720; int HeightVideo = 480; Rectangle overlayRectangle(0, 100, widthVideo, HeightVideo); // Evaluates bounds of overlay region bool modified = false; OverlayRegion::EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_GREATER_THAN, overlayRectangle, modified); // Gets an overlay region pOverlayRegion = GetOverlayRegionN(overlayRectangle, OVERLAY_REGION_TYPE_NORMAL); // Gets buffer information BufferInfo bufferInfo; pOverlayRegion->GetBackgroundBufferInfo(bufferInfo); // Gets a video file path String videoFilePath = App::GetInstance()->GetAppResourcePath() + L"tizen.mp4"; Uri playUri; Label* pLabel = new Label(); // Button* pButton = new Button(); // Creates an instance of Player pPlayer = new Player(); r = pPlayer->Construct(*this, &bufferInfo); TryCatch(r == E_SUCCESS, , "Failed pPlayer->Construct"); pPlayer->SetLooping(true); /* playUri.SetUri(L"http://cs518400v4.vk.me/u16423084/videos/442a33813f.720.mp4"); TryCatch(r == E_SUCCESS, , "Failed pPlayer->Play()"); AppLog("Opening URI"); r = pPlayer->OpenUrl(playUri); TryCatch(r == E_SUCCESS, , "Failed pPlayer->Play()"); r = pPlayer->Play(); TryCatch(r == E_SUCCESS, , "Failed pPlayer->Play()"); AppLog("Playing..."); */ // Creates instaces of Button and Label and adds controls to the panel pLabel->Construct(Rectangle(0, 50, 400, 80),L"OverlayRegion Sample"); pLabel->SetTextColor(Color::GetColor(COLOR_ID_RED)); AddControl(pLabel); // pButton->Construct(Rectangle(positionX + widthVideo - 200, positionX + HeightVideo - 100, 180, 80),L"BUTTON"); // AddControl(pButton); return r; CATCH: AppLogException("CreateItem is failed. %s", GetErrorMessage(r)); return r; }
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; }
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); }
TableViewGroupItem* UsersPanel::CreateGroupItem(int groupIndex, int itemWidth) { TableViewGroupItem * pItem; pItem = new TableViewGroupItem(); pItem->Construct(Dimension(itemWidth, GetDefaultGroupItemHeight())); String name = _pCurrentModel->GetGroupName(groupIndex); Label * pLabel = new Label(); pLabel->Construct(Rectangle(0, 0, itemWidth, GetDefaultGroupItemHeight()), name); pLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pItem->AddControl(pLabel); return pItem; }
Tizen::Ui::Controls::TableViewItem* ConfigForm::CreateItem(int itemIndex, int itemWidth) { if ( !m_pCountryList || m_pCountryList->GetCount() <= itemIndex ) return null; TableViewItem * pItem = new (std::nothrow) TableViewItem(); pItem->Construct( Dimension(GetWidth(), ITEM_HEIGHT), TABLE_VIEW_ANNEX_STYLE_RADIO); pItem->SetBackgroundColor( Color( 0xE0, 0xE0, 0xE0 ) ); Label * label = new Label(); String * country = dynamic_cast<String*>(m_pCountryList->GetAt(itemIndex)); label->Construct(Rectangle(0, 0, GetWidth(), ITEM_HEIGHT), *country); label->SetTextHorizontalAlignment( ALIGNMENT_LEFT ); pItem->AddControl(*label); return pItem; }
TableViewItem* UsersPanel::CreateItem(int groupIndex, int itemIndex, int itemWidth) { result r = E_SUCCESS; TableViewItem * pItem; RelativeLayout layout; layout.Construct(); pItem = new TableViewItem(); pItem->Construct(layout, Dimension(itemWidth, GetDefaultItemHeight()), TABLE_VIEW_ANNEX_STYLE_NORMAL); JsonObject *userJson; r = _pCurrentModel->GetUserFromGroup(groupIndex, itemIndex, userJson); String name, nextName, photo100; JsonParseUtils::GetString(*userJson, L"first_name", name); name += L" "; JsonParseUtils::GetString(*userJson, L"last_name", nextName); name += nextName; JsonParseUtils::GetString(*userJson, L"photo_100", photo100); Label *pNameLabel = new Label(); pNameLabel->Construct(Rectangle(0, 0, itemWidth, 90), name); pNameLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); RoundedAvatar *pAvatar = new RoundedAvatar(AVATAR_NORMAL); pAvatar->Construct(Rectangle(0, 0, 108, 108), photo100); pItem->AddControl(pAvatar); pItem->AddControl(pNameLabel); layout.SetRelation(*pAvatar, pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT); layout.SetCenterAligned(*pAvatar, CENTER_ALIGN_VERTICAL); layout.SetMargin(*pAvatar, 30, 0, 0, 0); layout.SetRelation(*pNameLabel, pAvatar, RECT_EDGE_RELATION_LEFT_TO_RIGHT); layout.SetCenterAligned(*pNameLabel, CENTER_ALIGN_VERTICAL); layout.SetMargin(*pNameLabel, 10, 0, 0, 0); return pItem; }
void ProjectGiraffeTab4::showLoginButton(void) { RemoveAllControls(); Label* loginLabel = new Label(); loginLabel->Construct(Rectangle(0, 0, 600, 80), "To view this tab, please log in first."); centerHorizontally(loginLabel, this); loginLabel->SetName("loginLabel"); AddControl(*loginLabel); Button* loginButton = new Button(); loginButton->Construct(Rectangle(0, 100, 300, 80), "Log In"); centerHorizontally(loginButton, this); loginButton->SetName("loginButton"); loginButton->SetActionId(ID_BUTTON_LOGIN); loginButton->AddActionEventListener(*this); AddControl(*loginButton); Draw(); }
result EditEventForm::OnInitializing(void) { result r = E_SUCCESS; Header* pHeader = GetHeader(); AppAssert(pHeader); pHeader->SetStyle(HEADER_STYLE_TITLE); pHeader->SetTitleText(L"Edit event"); Footer* pFooter = GetFooter(); AppAssert(pFooter); pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT); FooterItem footerSave; footerSave.Construct(ID_FOOTER_SAVE); footerSave.SetText(L"Save"); pFooter->AddItem(footerSave); pFooter->AddActionEventListener(*this); SetFormBackEventListener(this); static const unsigned int COLOR_BACKGROUND_LABEL = 0xFFEFEDE5; static const unsigned int COLOR_TITLE_LABEL = 0xFF808080; static const unsigned int COLOR_TIMEZONE_DATA = 0xFF444444; static const int UI_X_POSITION_GAP = 20; static const int UI_WIDTH = GetClientAreaBounds().width - 40; static const int UI_X_POSITION_MIDDLE = UI_WIDTH / 4; static const int UI_HEIGHT = 112; static const int BUTTON_HEIGHT = 74; static const int UI_SPACE = 32; static const int FONT_SIZE = 36; int yPosition = 0; ScrollPanel* pScrollPanel = new (std::nothrow) ScrollPanel(); pScrollPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height)); // Subject __pSubjectEditField = new (std::nothrow) EditField(); __pSubjectEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_FULLSCREEN, EDIT_FIELD_TITLE_STYLE_TOP); __pSubjectEditField->SetTitleText(L"Subject"); __pSubjectEditField->SetGuideText(L"Enter the subject"); pScrollPanel->AddControl(__pSubjectEditField); int minYear = Calendarbook::GetMinDateTime().GetYear() + 1; int maxYear = Calendarbook::GetMaxDateTime().GetYear() - 1; // Start Date Label* pStartDateLabel = new (std::nothrow) Label(); pStartDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), L"Start"); pStartDateLabel->SetTextVerticalAlignment(ALIGNMENT_TOP); pStartDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pStartDateLabel->SetTextColor(COLOR_TITLE_LABEL); pStartDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL); pScrollPanel->AddControl(pStartDateLabel); __pStartEditDate = new (std::nothrow) EditDate(); __pStartEditDate->Construct(Point(UI_X_POSITION_GAP, yPosition + 10)); __pStartEditDate->SetCurrentDate(); __pStartEditDate->SetYearRange(minYear, maxYear); __pStartEditDate->AddDateChangeEventListener(*this); pScrollPanel->AddControl(__pStartEditDate); __pStartEditTime = new (std::nothrow) EditTime(); __pStartEditTime->Construct(Point(UI_X_POSITION_MIDDLE * 2 + UI_SPACE, yPosition + 10)); __pStartEditTime->SetCurrentTime(); __pStartEditTime->AddTimeChangeEventListener(*this); pScrollPanel->AddControl(__pStartEditTime); // End Date Label* pEndDateLabel = new (std::nothrow) Label(); pEndDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"End"); pEndDateLabel->SetTextVerticalAlignment(ALIGNMENT_TOP); pEndDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pEndDateLabel->SetTextColor(COLOR_TITLE_LABEL); 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); __pReminderEditField = new (std::nothrow) EditField(); __pReminderEditField->Construct(Rectangle(UI_X_POSITION_GAP + UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH / 4, UI_HEIGHT), EDIT_FIELD_STYLE_NUMBER, INPUT_STYLE_FULLSCREEN, false, 5); __pReminderEditField->SetGuideText(L"0 ~ "); __pReminderEditField->SetName(L"Reminder"); __pReminderEditField->SetTextAlignment(ALIGNMENT_CENTER); pScrollPanel->AddControl(__pReminderEditField); __pReminderContextButton = new (std::nothrow) Button(); __pReminderContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE * 2 + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH / 2, BUTTON_HEIGHT), L"Minute(s)"); __pReminderContextButton->SetActionId(ID_BUTTON_REMINDER); __pReminderContextButton->AddActionEventListener(*this); pScrollPanel->AddControl(__pReminderContextButton); __pReminderContextMenu = new (std::nothrow) ContextMenu(); __pReminderContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 3 / 4, yPosition + UI_HEIGHT * 2), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD); __pReminderContextMenu->AddItem(L"Minute(s)", ID_CONTEXT_REMINDER_MINUTE); __pReminderContextMenu->AddItem(L"Hour(s)", ID_CONTEXT_REMINDER_HOUR); __pReminderContextMenu->AddItem(L"Day(s)", ID_CONTEXT_REMINDER_DAY); __pReminderContextMenu->AddItem(L"Week(s)", ID_CONTEXT_REMINDER_WEEK); __pReminderContextMenu->AddActionEventListener(*this); // Recurrence Label* pRecurrenceLabel = new (std::nothrow) Label(); pRecurrenceLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Recurrence"); pRecurrenceLabel->SetTextConfig(29, LABEL_TEXT_STYLE_NORMAL); pRecurrenceLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pRecurrenceLabel->SetTextColor(COLOR_TITLE_LABEL); pRecurrenceLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL)); pScrollPanel->AddControl(pRecurrenceLabel); __pSetRecurrenceButton = new (std::nothrow) Button(); __pSetRecurrenceButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"None"); __pSetRecurrenceButton->SetActionId(ID_BUTTON_RECURRENCE); __pSetRecurrenceButton->AddActionEventListener(*this); pScrollPanel->AddControl(__pSetRecurrenceButton); // Priority Label* pPriorityLabel = new (std::nothrow) Label(); pPriorityLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), L"Priority"); pPriorityLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pPriorityLabel->SetTextColor(COLOR_TITLE_LABEL); pPriorityLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL); pScrollPanel->AddControl(pPriorityLabel); __pPriorityContextButton = new (std::nothrow) Button(); __pPriorityContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"Low"); __pPriorityContextButton->SetActionId(ID_BUTTON_PRIORITY); __pPriorityContextButton->AddActionEventListener(*this); pScrollPanel->AddControl(__pPriorityContextButton); __pPriorityContextMenu = new (std::nothrow) ContextMenu(); __pPriorityContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 5 / 8, yPosition + UI_HEIGHT * 2), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD); __pPriorityContextMenu->AddItem(L"High", ID_CONTEXT_PRIORITY_HIGH); __pPriorityContextMenu->AddItem(L"Normal", ID_CONTEXT_PRIORITY_NORMAL); __pPriorityContextMenu->AddItem(L"Low", ID_CONTEXT_PRIORITY_LOW); __pPriorityContextMenu->AddActionEventListener(*this); // Sensitivity Label* pSensitivityLabel = new (std::nothrow) Label(); pSensitivityLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Sensitivity"); pSensitivityLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pSensitivityLabel->SetTextColor(COLOR_TITLE_LABEL); pSensitivityLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL); pScrollPanel->AddControl(pSensitivityLabel); __pSensitivityContextButton = new (std::nothrow) Button(); __pSensitivityContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"Public"); __pSensitivityContextButton->SetActionId(ID_BUTTON_SENSITIVITY); __pSensitivityContextButton->AddActionEventListener(*this); pScrollPanel->AddControl(__pSensitivityContextButton); __pSensitivityContextMenu = new (std::nothrow) ContextMenu(); __pSensitivityContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 5 / 8, yPosition + UI_HEIGHT * 2), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD); __pSensitivityContextMenu->AddItem(L"Public", ID_CONTEXT_SENSITIVITY_PUBLIC); __pSensitivityContextMenu->AddItem(L"Private", ID_CONTEXT_SENSITIVITY_PRIVATE); __pSensitivityContextMenu->AddItem(L"Confidential", ID_CONTEXT_SENSITIVITY_CONFIDENTIAL); __pSensitivityContextMenu->AddActionEventListener(*this); // Status Label* pStatusLabel = new (std::nothrow) Label(); pStatusLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), L"Status"); pStatusLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pStatusLabel->SetTextColor(COLOR_TITLE_LABEL); pStatusLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL); pScrollPanel->AddControl(pStatusLabel); __pStatusContextButton = new (std::nothrow) Button(); __pStatusContextButton->Construct(Rectangle(UI_X_POSITION_MIDDLE + UI_X_POSITION_GAP, yPosition + 19, UI_WIDTH * 3 / 4, BUTTON_HEIGHT), L"None"); __pStatusContextButton->SetActionId(ID_BUTTON_STATUS); __pStatusContextButton->AddActionEventListener(*this); pScrollPanel->AddControl(__pStatusContextButton); __pStatusContextMenu = new (std::nothrow) ContextMenu(); __pStatusContextMenu->Construct(Point(UI_X_POSITION_GAP + UI_WIDTH * 5 / 8, yPosition + UI_HEIGHT * 2), CONTEXT_MENU_STYLE_LIST, CONTEXT_MENU_ANCHOR_DIRECTION_UPWARD); __pStatusContextMenu->AddItem(L"None", ID_CONTEXT_STATUS_NONE); __pStatusContextMenu->AddItem(L"Confirmed", ID_CONTEXT_STATUS_CONFIRMED); __pStatusContextMenu->AddItem(L"Cancelled", ID_CONTEXT_STATUS_CANCELLED); __pStatusContextMenu->AddItem(L"Tentative", ID_CONTEXT_STATUS_TENTATIVE); __pStatusContextMenu->AddActionEventListener(*this); AddControl(pScrollPanel); return r; }
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; }
result ConfigForm::Construct(IActionEventListener * mainListener) { VerticalBoxLayout layout; layout.Construct(VERTICAL_DIRECTION_DOWNWARD); Form::Construct(layout, FORM_STYLE_NORMAL | FORM_STYLE_FOOTER); Label * label = new Label(); label->Construct(Rectangle(0, 0, 48, 50), L"Device model:"); AddControl(*label); layout.SetHorizontalFitPolicy(*label, FIT_POLICY_PARENT); layout.SetVerticalFitPolicy(*label, FIT_POLICY_FIXED); __pModelEditField = new EditField; __pModelEditField->Construct(Rectangle(0, 0, 150, 110), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_FULLSCREEN); __pModelEditField->SetText(L"GT-I8800"); AddControl(*__pModelEditField); layout.SetHorizontalFitPolicy(*__pModelEditField, FIT_POLICY_PARENT); layout.SetVerticalFitPolicy(*__pModelEditField, FIT_POLICY_FIXED); label = new Label(); label->Construct(Rectangle(0, 0, 48, 50), L"MNC:"); AddControl(*label); layout.SetHorizontalFitPolicy(*label, FIT_POLICY_PARENT); layout.SetVerticalFitPolicy(*label, FIT_POLICY_FIXED); __pMncEditField = new EditField; __pMncEditField->Construct(Rectangle(0, 0, 150, 110), EDIT_FIELD_STYLE_NUMBER, INPUT_STYLE_FULLSCREEN); AddControl(*__pMncEditField); layout.SetHorizontalFitPolicy(*__pMncEditField, FIT_POLICY_PARENT); layout.SetVerticalFitPolicy(*__pMncEditField, FIT_POLICY_FIXED); __pMncEditField->SetText(L"01"); label = new Label(); label->Construct(Rectangle(0, 0, 48, 50), L"Developer flag:"); AddControl(*label); layout.SetHorizontalFitPolicy(*label, FIT_POLICY_PARENT); layout.SetVerticalFitPolicy(*label, FIT_POLICY_FIXED); __pDevRadioGroup = new RadioGroup; __pDevRadioGroup->Construct(); CheckButton * devbutton = new CheckButton; devbutton->Construct(Rectangle(0, 0, 150, 110), CHECK_BUTTON_STYLE_RADIO, BACKGROUND_STYLE_DEFAULT, false, "Developer mode, always success"); devbutton->SetActionId(BuyConfigInfo::AlwaysSuccess, BuyConfigInfo::AlwaysSuccess); devbutton->AddActionEventListener(*this); AddControl(*devbutton); __pDevRadioGroup->Add(*devbutton); layout.SetHorizontalFitPolicy(*devbutton, FIT_POLICY_PARENT); layout.SetVerticalFitPolicy(*devbutton, FIT_POLICY_FIXED); AppLog("chkbtn %p", devbutton); __pDevRadioGroup->SetSelectedItem(*devbutton); devbutton = new CheckButton; devbutton->Construct(Rectangle(0, 0, 150, 110), CHECK_BUTTON_STYLE_RADIO, BACKGROUND_STYLE_DEFAULT, false, "Normal"); devbutton->SetActionId(BuyConfigInfo::Normal, BuyConfigInfo::Normal); devbutton->AddActionEventListener(*this); AddControl(*devbutton); __pDevRadioGroup->Add(*devbutton); layout.SetHorizontalFitPolicy(*devbutton, FIT_POLICY_PARENT); layout.SetVerticalFitPolicy(*devbutton, FIT_POLICY_FIXED); AddControl(*__pDevRadioGroup); AppLog("chkbtn %p", devbutton); TableView * pTableView = new TableView(); pTableView->Construct( Rectangle(0, 0, GetWidth(), 600), false, TABLE_VIEW_SCROLL_BAR_STYLE_NONE); AddControl(*pTableView); m_pTableView = pTableView; pTableView->SetItemProvider(this); pTableView->AddTableViewItemEventListener(*this); layout.SetHorizontalFitPolicy(*pTableView, FIT_POLICY_PARENT); layout.SetVerticalFitPolicy(*pTableView, FIT_POLICY_FIXED); GetFooter()->SetStyle(FOOTER_STYLE_BUTTON_TEXT); GetFooter()->AddActionEventListener(*this); __pMainListener = mainListener; BuyConfigInfo info; info.m_developerFlag = BuyConfigInfo::AlwaysSuccess; info.m_model = "GT-I8800"; info.m_mcc = "000"; info.m_mnc = "00"; __pEngine = new BuyEngine(this, info); result r = __pEngine->RequestCountryList(0); if ( IsFailed(r) ) AppLog(GetErrorMessage(r)); UpdateConfirmButtonState(); return E_SUCCESS; }
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); } else { if (_peerId > 2000000000) { itemLayout.SetRelation(*pMessageBubble, pAvatar, RECT_EDGE_RELATION_LEFT_TO_RIGHT); itemLayout.SetMargin(*pMessageBubble, 10, 0, 0, 0); } else { itemLayout.SetRelation(*pMessageBubble, *pItem, RECT_EDGE_RELATION_LEFT_TO_LEFT); itemLayout.SetMargin(*pMessageBubble, 10, 0, 0, 0); } itemLayout.SetRelation(*pTimeStamp, *pMessageBubble, RECT_EDGE_RELATION_LEFT_TO_RIGHT); itemLayout.SetRelation(*pTimeStamp, *pItem, RECT_EDGE_RELATION_BOTTOM_TO_BOTTOM); itemLayout.SetMargin(*pTimeStamp, 10, 0, 0, 30); } // colors if (out == 1 && readState == 0) { bgColor = Color(LIST_ITEM_UNREAD_COLOR, false); } else { bgColor = Color::GetColor(COLOR_ID_BLACK); } pItem->SetBackgroundColor(bgColor, TABLE_VIEW_ITEM_DRAWING_STATUS_NORMAL); pItem->SetBackgroundColor(bgColor, TABLE_VIEW_ITEM_DRAWING_STATUS_PRESSED); pItem->SetBackgroundColor(bgColor, TABLE_VIEW_ITEM_DRAWING_STATUS_HIGHLIGHTED); pItem->RequestRedraw(true); AppLog("Returning item"); return pItem; CATCH: AppLogException("$${Function:CreateItem} is failed. %s", GetErrorMessage(r)); return null; }
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(); }
result CreateProfileForm::OnInitializing(void) { result r = E_SUCCESS; Header* pHeader = GetHeader(); AppAssert(pHeader); pHeader->SetStyle(HEADER_STYLE_TITLE); String getProfileCreationTitle; Application::GetInstance()->GetAppResource()->GetString(IDS_CREATE_TITLE, getProfileCreationTitle); pHeader->SetTitleText(getProfileCreationTitle); Footer* pFooter = GetFooter(); AppAssert(pFooter); pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT); FooterItem footerSave; footerSave.Construct(ID_BUTTON_SAVE); String getSave; Application::GetInstance()->GetAppResource()->GetString(IDS_SAVE, getSave); footerSave.SetText(getSave); pFooter->AddItem(footerSave); pFooter->AddActionEventListener(*this); SetFormBackEventListener(this); static const unsigned int COLOR_BACKGROUND_LABEL = 0xFFEFEDE5; static const unsigned int COLOR_TITLE_LABEL = 0xFF808080; static const int UI_X_POSITION_GAP = 20; static const int UI_WIDTH = GetClientAreaBounds().width - 40; static const int UI_X_POSITION_MIDDLE = UI_WIDTH / 4; static const int UI_HEIGHT = 112; static const int UI_SPACE = 26; int yPosition = 0; __pScrollPanel = new (std::nothrow) ScrollPanel(); __pScrollPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height)); // Subject __pSubjectEditField = new (std::nothrow) EditField(); __pSubjectEditField->Construct(Rectangle(UI_X_POSITION_GAP, yPosition, UI_WIDTH, UI_HEIGHT), EDIT_FIELD_STYLE_NORMAL, INPUT_STYLE_FULLSCREEN, EDIT_FIELD_TITLE_STYLE_TOP); String getProfileName, getProfileNameGuid; Application::GetInstance()->GetAppResource()->GetString(IDS_PROFILE_NAME, getProfileName); Application::GetInstance()->GetAppResource()->GetString(IDS_PROFILE_GUIDE, getProfileNameGuid); __pSubjectEditField->SetGuideText(getProfileNameGuid); __pSubjectEditField->SetName(L"Subject"); __pSubjectEditField->SetTitleText(getProfileName); __pSubjectEditField->SetOverlayKeypadCommandButtonVisible(false); __pScrollPanel->AddControl(__pSubjectEditField); // Start Date int minYear = Calendarbook::GetMinDateTime().GetYear() + 1; int maxYear = Calendarbook::GetMaxDateTime().GetYear() - 1; Label* pStartDateLabel = new (std::nothrow) Label(); String getStartDateTime, getEndDateTime; Application::GetInstance()->GetAppResource()->GetString(IDS_START_DATETIME, getStartDateTime); Application::GetInstance()->GetAppResource()->GetString(IDS_END_DATETIME, getEndDateTime); pStartDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), getStartDateTime); pStartDateLabel->SetTextVerticalAlignment(ALIGNMENT_TOP); pStartDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pStartDateLabel->SetTextColor(COLOR_TITLE_LABEL); pStartDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL); __pScrollPanel->AddControl(pStartDateLabel); __pStartEditDate = new (std::nothrow) EditDate(); __pStartEditDate->Construct(Point(UI_X_POSITION_GAP, yPosition + 10)); __pStartEditDate->SetCurrentDate(); __pStartEditDate->SetYearRange(minYear, maxYear); __pStartEditDate->AddDateChangeEventListener(*this); __pScrollPanel->AddControl(__pStartEditDate); __pStartEditTime = new (std::nothrow) EditTime(); __pStartEditTime->Construct(Point(UI_X_POSITION_MIDDLE * 2 + UI_SPACE, yPosition + 10)); __pStartEditTime->SetCurrentTime(); __pStartEditTime->AddTimeChangeEventListener(*this); __pScrollPanel->AddControl(__pStartEditTime); // Due Date Label* pDueDateLabel = new (std::nothrow) Label(); pDueDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), getEndDateTime); pDueDateLabel->SetTextVerticalAlignment(ALIGNMENT_TOP); pDueDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pDueDateLabel->SetTextColor(COLOR_TITLE_LABEL); pDueDateLabel->SetBackgroundColor(COLOR_BACKGROUND_LABEL); __pScrollPanel->AddControl(pDueDateLabel); __pDueEditDate = new (std::nothrow) EditDate(); __pDueEditDate->Construct(Point(UI_X_POSITION_GAP, yPosition + 10)); __pDueEditDate->SetCurrentDate(); __pDueEditDate->SetYearRange(minYear, maxYear); __pDueEditDate->AddDateChangeEventListener(*this); __pScrollPanel->AddControl(__pDueEditDate); DateTime endTime; endTime = __pStartEditTime->GetTime(); endTime.AddHours(1); __pDueEditTime = new (std::nothrow) EditTime(); __pDueEditTime->Construct(Point(UI_X_POSITION_MIDDLE * 2 + UI_SPACE, yPosition + 10)); __pDueEditTime->SetTime(endTime); __pDueEditTime->AddTimeChangeEventListener(*this); __pScrollPanel->AddControl(__pDueEditTime); // Location String getLocationGuide; Application::GetInstance()->GetAppResource()->GetString(IDS_LOCATION_GUIDE, getLocationGuide); __pLocationButton = new (std::nothrow) Button(); __pLocationButton->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), getLocationGuide); __pLocationButton->SetActionId(ID_LOCATION_BUTTON); __pLocationButton->AddActionEventListener(*this); __pScrollPanel->AddControl(__pLocationButton); // Volume String getVolume; Application::GetInstance()->GetAppResource()->GetString(IDS_VOLUME, getVolume); __pVolumeSlider = new (std::nothrow) Slider(); __pVolumeSlider->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH/*GetClientAreaBounds().width*/, UI_HEIGHT + 30), BACKGROUND_STYLE_DEFAULT, true, 0, 15); __pVolumeSlider->SetValue(5); __pVolumeSlider->SetTitleText(getVolume); __pVolumeSlider->AddAdjustmentEventListener(*this); __pScrollPanel->AddControl(__pVolumeSlider); // Wifi String getWifi; Application::GetInstance()->GetAppResource()->GetString(IDS_WIFI, getWifi); __pWifiCheckButton = new (std::nothrow) CheckButton(); __pWifiCheckButton->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), CHECK_BUTTON_STYLE_ONOFF_SLIDING, BACKGROUND_STYLE_DEFAULT, false, getWifi); __pWifiCheckButton->SetActionId(ID_BUTTON_CHECKED, ID_BUTTON_UNCHECKED, ID_BUTTON_SELECTED); __pWifiCheckButton->AddActionEventListener(*this); __pScrollPanel->AddControl(__pWifiCheckButton); // Description String getDescription, getDescriptionGuide; Application::GetInstance()->GetAppResource()->GetString(IDS_DESCRIPTION, getDescription); Application::GetInstance()->GetAppResource()->GetString(IDS_DESCRIPTION_GUIDE, getDescriptionGuide); __pDescriptionEditField = new (std::nothrow) EditField(); __pDescriptionEditField->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); __pDescriptionEditField->SetGuideText(getDescriptionGuide); __pDescriptionEditField->SetName(L"Description"); __pDescriptionEditField->SetTitleText(getDescription); __pDescriptionEditField->SetOverlayKeypadCommandButtonVisible(false); __pScrollPanel->AddControl(__pDescriptionEditField); AddControl(__pScrollPanel); return r; }
result SettingForm::OnInitializing(void) { result r = E_SUCCESS; // TODO: Add your initialization code here FooterItem footerItem[5]; AppResource* pAppResource = Application::GetInstance()->GetAppResource(); Image inActivation_Image[5]; String inActivation_Path[5]; Image Activation_Image[5]; String Activation_Path[5]; for(int i=0; i<5; i++) { inActivation_Image[i].Construct(); inActivation_Path[i] = App::GetInstance()->GetAppResourcePath(); Activation_Image[i].Construct(); Activation_Path[i] = App::GetInstance()->GetAppResourcePath(); } inActivation_Path[0] += L"screen-density-xhigh/TimeLine_InAct.png"; Activation_Path[0] += L"screen-density-xhigh/TimeLine_Act.png"; footerItem[0].Construct(ID_FOOTER_ITEM1); footerItem[0].SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL, inActivation_Image[0].DecodeN(inActivation_Path[0], BITMAP_PIXEL_FORMAT_ARGB8888)); footerItem[0].SetBackgroundBitmap(FOOTER_ITEM_STATUS_PRESSED, Activation_Image[0].DecodeN(Activation_Path[0], BITMAP_PIXEL_FORMAT_ARGB8888)); inActivation_Path[1] += L"screen-density-xhigh/Chatting_InAct.png"; Activation_Path[1] += L"screen-density-xhigh/Chatting_Act.png"; footerItem[1].Construct(ID_FOOTER_ITEM2); footerItem[1].SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL, inActivation_Image[1].DecodeN(inActivation_Path[1], BITMAP_PIXEL_FORMAT_ARGB8888)); footerItem[1].SetBackgroundBitmap(FOOTER_ITEM_STATUS_PRESSED, Activation_Image[1].DecodeN(Activation_Path[1], BITMAP_PIXEL_FORMAT_ARGB8888)); inActivation_Path[2] += L"screen-density-xhigh/PartnerList_InAct.png"; Activation_Path[2] += L"screen-density-xhigh/PartnerList_Act.png"; footerItem[2].Construct(ID_FOOTER_ITEM3); footerItem[2].SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL, inActivation_Image[2].DecodeN(inActivation_Path[2], BITMAP_PIXEL_FORMAT_ARGB8888)); footerItem[2].SetBackgroundBitmap(FOOTER_ITEM_STATUS_PRESSED, Activation_Image[2].DecodeN(Activation_Path[2], BITMAP_PIXEL_FORMAT_ARGB8888)); inActivation_Path[3] += L"screen-density-xhigh/PartnerResearch_InAct.png"; Activation_Path[3] += L"screen-density-xhigh/PartnerResearch_Act.png"; footerItem[3].Construct(ID_FOOTER_ITEM4); footerItem[3].SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL, inActivation_Image[3].DecodeN(inActivation_Path[3], BITMAP_PIXEL_FORMAT_ARGB8888)); footerItem[3].SetBackgroundBitmap(FOOTER_ITEM_STATUS_PRESSED, Activation_Image[3].DecodeN(Activation_Path[3], BITMAP_PIXEL_FORMAT_ARGB8888)); inActivation_Path[4] += L"screen-density-xhigh/Setting_InAct.png"; Activation_Path[4] += L"screen-density-xhigh/Setting_Act.png"; footerItem[4].Construct(ID_FOOTER_ITEM5); footerItem[4].SetBackgroundBitmap(FOOTER_ITEM_STATUS_PRESSED, inActivation_Image[4].DecodeN(inActivation_Path[4], BITMAP_PIXEL_FORMAT_ARGB8888)); footerItem[4].SetBackgroundBitmap(FOOTER_ITEM_STATUS_NORMAL, Activation_Image[4].DecodeN(Activation_Path[4], BITMAP_PIXEL_FORMAT_ARGB8888)); Label* pLabel; pLabel = new Label(); pLabel->Construct(Rectangle(0,0,this->GetWidth(),this->GetHeight()),L""); AppLog("%d ,,,,%d", this->GetWidth(),this->GetHeight()); pLabel->SetBackgroundBitmap(*pAppResource->GetBitmapN(L"fakepicture.png")); pLabel->Draw(); AddControl(pLabel); Footer* pFooter = GetFooter(); if (pFooter) { pFooter->AddActionEventListener(*this); } pFooter->AddItem(footerItem[0]); pFooter->AddItem(footerItem[1]); pFooter->AddItem(footerItem[2]); pFooter->AddItem(footerItem[3]); pFooter->AddItem(footerItem[4]); // Setup back event listener SetFormBackEventListener(this); // Get a button via resource ID return r; }
void UserProfileForm::OnTransactionReadyToRead(HttpSession& httpSession, HttpTransaction& httpTransaction, int availableBodyLen) { AppLogDebug("OnTransactionReadyToRead,..availableBodyLen=%d",availableBodyLen); count++; HttpResponse* pHttpResponse = httpTransaction.GetResponse(); if(pHttpResponse->GetHttpStatusCode() == HTTP_STATUS_OK) { __pBuffer = pHttpResponse->ReadBodyN(); } if(__pProfileName==NULL) { ParseJsonData(); Label *pLabel = new Label(); String labelText(L"Welcome "); labelText.Append(*__pProfileName); AppLog("labelText is =%ls",labelText.GetPointer()); pLabel->Construct(Rectangle(05, 50, 500, 100), labelText); AddControl(*pLabel); Draw(); Show(); __pSession->CloseTransaction(httpTransaction); delete __pSession; __pSession = null; } //Get Profile Picture String imageurl; imageurl.Append(L"https://graph.facebook.com/me"); imageurl.Append(L"/picture?"); imageurl.Append(L"access_token="); imageurl.Append(__accessToken); SendRequestGet(imageurl); __pProfileImage = new Image(); __pProfileImage->Construct(); Bitmap *pBitmap; pBitmap=__pProfileImage->DecodeN(*__pBuffer,IMG_FORMAT_JPG,BITMAP_PIXEL_FORMAT_ARGB8888,150,150); Label *pImageLabel = new Label(); pImageLabel->Construct(Rectangle(150,150, 150, 150),""); pImageLabel->SetBackgroundBitmap(*pBitmap); AddControl(*pImageLabel); Button* pGetFriends = new Button(); pGetFriends->Construct(Rectangle(30,330, 350, 70), L"Get Friends"); pGetFriends->SetActionId(ID_BUTTON_FRIENDS_CLICKED); pGetFriends->AddActionEventListener(*this); AddControl(*pGetFriends); Button* pLogout = new Button(); pLogout->Construct(Rectangle(30,430, 350, 70), L"Logout"); pLogout->SetActionId(ID_BUTTON_LOGOUT_CLICKED); pLogout->AddActionEventListener(*this); AddControl(*pLogout); Draw(); Show(); }
result ProfileDetailForm::OnInitializing(void) { result r = E_SUCCESS; Header* pHeader = GetHeader(); AppAssert(pHeader); pHeader->SetStyle(HEADER_STYLE_TITLE); String getDetails; Application::GetInstance()->GetAppResource()->GetString(IDS_DETAILS, getDetails); pHeader->SetTitleText(getDetails); Footer* pFooter = GetFooter(); AppAssert(pFooter); pFooter->SetStyle(FOOTER_STYLE_BUTTON_TEXT); String getEdit; Application::GetInstance()->GetAppResource()->GetString(IDS_EDIT, getEdit); FooterItem footerEdit; footerEdit.Construct(ID_FOOTER_EDIT); footerEdit.SetText(getEdit); pFooter->AddItem(footerEdit); String getDelete; Application::GetInstance()->GetAppResource()->GetString(IDS_DELETE, getDelete); FooterItem footerDelete; footerDelete.Construct(ID_FOOTER_DELETE); footerDelete.SetText(getDelete); pFooter->AddItem(footerDelete); pFooter->AddActionEventListener(*this); SetFormBackEventListener(this); static const unsigned int COLOR_BACKGROUND_LABEL = 0xFFEFEDE5; static const unsigned int COLOR_TITLE_LABEL = 0xFF808080; static const int UI_X_POSITION_GAP = 20; static const int UI_WIDTH = GetClientAreaBounds().width - 40; static const int UI_X_POSITION_MIDDLE = UI_WIDTH / 4 + UI_X_POSITION_GAP; static const int UI_HEIGHT = 112; static const int UI_SPACE = 26; int yPosition = 0; ScrollPanel* pScrollPanel = new (std::nothrow) ScrollPanel(); pScrollPanel->Construct(Rectangle(0, 0, GetClientAreaBounds().width, GetClientAreaBounds().height)); String date; DateTime displayStartDate; DateTime displayDueDate; // Subject Label* pSubjectLabel = new (std::nothrow) Label(); String getProfileName; Application::GetInstance()->GetAppResource()->GetString(IDS_PROFILE_NAME, getProfileName); pSubjectLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition, UI_WIDTH, UI_HEIGHT), getProfileName); pSubjectLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pSubjectLabel->SetTextColor(COLOR_TITLE_LABEL); pSubjectLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL)); pScrollPanel->AddControl(pSubjectLabel); __pSubjectLabelData = new (std::nothrow) Label(); __pSubjectLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L""); __pSubjectLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pScrollPanel->AddControl(__pSubjectLabelData); // Start Date Label* pStartDateLabel = new (std::nothrow) Label(); String getStartDatetime; Application::GetInstance()->GetAppResource()->GetString(IDS_START_DATETIME, getStartDatetime); pStartDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), getStartDatetime); pStartDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pStartDateLabel->SetTextColor(COLOR_TITLE_LABEL); pStartDateLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL)); pScrollPanel->AddControl(pStartDateLabel); __pStartDateLabelData = new (std::nothrow) Label(); __pStartDateLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L""); __pStartDateLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pScrollPanel->AddControl(__pStartDateLabelData); // Due Date Label* pDueDateLabel = new (std::nothrow) Label(); String getEndDatetime; Application::GetInstance()->GetAppResource()->GetString(IDS_END_DATETIME, getEndDatetime); pDueDateLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), getEndDatetime); pDueDateLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pDueDateLabel->SetTextColor(COLOR_TITLE_LABEL); pDueDateLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL)); pScrollPanel->AddControl(pDueDateLabel); __pDueDateLabelData = new (std::nothrow) Label(); __pDueDateLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L""); __pDueDateLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pScrollPanel->AddControl(__pDueDateLabelData); // Location Label* pLocationLabel = new (std::nothrow) Label(); String getLocation; Application::GetInstance()->GetAppResource()->GetString(IDS_LOCATION, getLocation); pLocationLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), getLocation); pLocationLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pLocationLabel->SetTextColor(COLOR_TITLE_LABEL); pLocationLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL)); pScrollPanel->AddControl(pLocationLabel); __pLocationLabelData = new (std::nothrow) Label(); __pLocationLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L""); __pLocationLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pScrollPanel->AddControl(__pLocationLabelData); // Volume Label* pVolumeLabel = new (std::nothrow) Label(); String getVolume; Application::GetInstance()->GetAppResource()->GetString(IDS_VOLUME, getVolume); pVolumeLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), getVolume); pVolumeLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pVolumeLabel->SetTextColor(COLOR_TITLE_LABEL); pVolumeLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL)); pScrollPanel->AddControl(pVolumeLabel); __pVolumeLabelData = new (std::nothrow) Label(); __pVolumeLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L""); __pVolumeLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pScrollPanel->AddControl(__pVolumeLabelData); // Wifi Label* pWifiLabel = new (std::nothrow) Label(); String getWifi; Application::GetInstance()->GetAppResource()->GetString(IDS_WIFI, getWifi); pWifiLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT, UI_WIDTH, UI_HEIGHT), getWifi); pWifiLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pWifiLabel->SetTextColor(COLOR_TITLE_LABEL); pWifiLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL)); pScrollPanel->AddControl(pWifiLabel); __pWifiLabelData = new (std::nothrow) Label(); __pWifiLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L""); __pWifiLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pScrollPanel->AddControl(__pWifiLabelData); // Description Label* pDescriptionLabel = new (std::nothrow) Label(); String getMemo; Application::GetInstance()->GetAppResource()->GetString(IDS_DESCRIPTION, getMemo); pDescriptionLabel->Construct(Rectangle(UI_X_POSITION_GAP, yPosition += UI_HEIGHT + UI_SPACE, UI_WIDTH, UI_HEIGHT), getMemo); pDescriptionLabel->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pDescriptionLabel->SetTextColor(COLOR_TITLE_LABEL); pDescriptionLabel->SetBackgroundColor(Color(COLOR_BACKGROUND_LABEL)); pScrollPanel->AddControl(pDescriptionLabel); __pDescriptionLabelData = new (std::nothrow) Label(); __pDescriptionLabelData->Construct(Rectangle(UI_X_POSITION_MIDDLE, yPosition, UI_WIDTH * 3 / 4, UI_HEIGHT), L""); __pDescriptionLabelData->SetTextHorizontalAlignment(ALIGNMENT_LEFT); pScrollPanel->AddControl(__pDescriptionLabelData); AddControl(pScrollPanel); return r; }