// create popup void Form2::CreatePopup(void) { __pPopup = new (std::nothrow) Popup(); __pPopup->Construct(true, Dimension(600, 450)); __pPopup->SetTitleText(L"Input to do"); Rectangle rect; rect = __pPopup->GetClientAreaBounds(); __pEditField = new (std::nothrow) Label(); __pEditField->Construct(Rectangle(50, 50, 450, 100), L"Continue?"); __pPopup->AddControl(*__pEditField); // create "ok" button Button *pButtonOK = new (std::nothrow) Button(); pButtonOK->Construct(Rectangle(50, 230, 150, 74), L"OK"); pButtonOK->SetActionId(ID_BUTTON_POPUP_OK); pButtonOK->AddActionEventListener(*this); __pPopup->AddControl(*pButtonOK); // create "cancel" button Button *pButtonClose = new (std::nothrow) Button(); pButtonClose->Construct(Rectangle(350, 230, 150, 74), L"Cancel"); pButtonClose->SetActionId(ID_BUTTON_POPUP_CANCEL); //if(pButtonClose) //{ pButtonClose->AddActionEventListener(*this); //} __pPopup->AddControl(*pButtonClose); }
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 SelectCalendarPopup::Construct(const Form* pParentForm, RecordId calendarId) { result r = E_SUCCESS; r = Popup::Construct(true, Dimension(650, 800)); TryReturn(!IsFailed(r), r, "[%s] Failed to construct popup.", GetErrorMessage(r)); SetTitleText(L"달력 선택"); __pParentForm = const_cast< Form* >(pParentForm); if (__pParentForm == null) { return E_FAILURE; } __selectedCalendarId = calendarId; __pListView = new (std::nothrow) ListView(); __pListView->Construct(Rectangle(20, 0, GetClientAreaBounds().width - 40, GetClientAreaBounds().height - 89)); __pListView->SetItemProvider(*this); __pListView->AddListViewItemEventListener(*this); AddControl(__pListView); Button* pButtonCancel = new (std::nothrow) Button(); pButtonCancel->Construct(Rectangle((GetClientAreaBounds().width - 180) / 2, GetClientAreaBounds().height - 89, 180, 74), L"Cancel"); pButtonCancel->SetActionId(ID_BUTTON_CANCEL_POPUP); pButtonCancel->AddActionEventListener(*this); AddControl(pButtonCancel); r = GetCalendarlist(); TryReturn(!IsFailed(r), r, "[%s] Failed to get the calendar list.", GetErrorMessage(r)); SetPropagatedKeyEventListener(this); return r; }
result CaseValueChoicePopup::Construct(bool hasTitle, Osp::Graphics::Dimension dim) { result r = E_SUCCESS; // Construct Popup r = Popup::Construct( hasTitle, dim); int POPUP_WIDTH = GetWidth(); int POPUP_HEIGHT = GetHeight(); int BUTTON_WIDTH = POPUP_WIDTH/(_size + 1); int BUTTON_HEIGHT = POPUP_HEIGHT/ (_size + 2); for(int i=0; i<_valueMax; i++) { int value = i+1; int x = 0.5 * BUTTON_WIDTH + /*GetX() + */(i%_size) * BUTTON_WIDTH; int y = 0.5 * BUTTON_HEIGHT/*+ GetY()*/ + (i/_size) * BUTTON_HEIGHT; Button *choiceButton = new Button(); choiceButton->Construct(__R(x, y, BUTTON_WIDTH, BUTTON_HEIGHT)); Osp::Base::String label= ""; label.Insert( value , 0); choiceButton->SetText(label); choiceButton->SetActionId(ID_FIRST_BUTTON + i); choiceButton->AddActionEventListener(*this); Case* currentCase = Game::getInstance()->getCase(_caseId); bool isEnable = currentCase->canAdd(value); choiceButton->SetEnabled(isEnable); AddControl(*choiceButton); _buttons.push_back(choiceButton); //AppLog("Popup: creation button %d, x = %d, y = %d", i, x, y); } //Creation of Button "OK" int butonWidth = POPUP_WIDTH / 3; int x = 0.5 * butonWidth; int y = 0.5 * BUTTON_HEIGHT + /* GetY()+ */_size * BUTTON_HEIGHT; Button *okButton = new Button(); okButton->Construct(__R(x, y, butonWidth, BUTTON_HEIGHT)); okButton->SetText(Osp::Base::String("OK")); okButton->SetActionId(ID_OK_BUTTON); okButton->AddActionEventListener(*this); AddControl(*okButton); _buttons.push_back(okButton); //Creation of Button "CLEAR" x = 0.5 * butonWidth + butonWidth; Button *clearButton = new Button(); clearButton->Construct(__R(x, y, butonWidth, BUTTON_HEIGHT)); clearButton->SetText(Osp::Base::String("CLEAR")); clearButton->SetActionId(ID_CLEAR_BUTTON); clearButton->AddActionEventListener(*this); AddControl(*clearButton); _buttons.push_back(clearButton); 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(); }
void EditPanel::OnActionPerformed(const Tizen::Ui::Control& source, int actionId) { SceneManager* pSceneManager = SceneManager::GetInstance(); AppAssert(pSceneManager); switch(actionId) { case 1: { String *tmp_string; Boolean *tmp_highlight; int i; if(onHighlightStart == true) { for(i=0; i<arr_text_element_highlight.GetCount(); i++) { tmp_highlight = static_cast <Boolean *> (arr_text_element_highlight.GetAt(i)); tmp_string = static_cast< String *> (arr_text_element.GetAt(i)); if(tmp_highlight->ToBool() == true) { popup_edit_string.Append(*tmp_string); arr_text_element_highlight.SetAt(new Boolean(false), i); end_index = i; } } select_index_edit.x = start_index; select_index_edit.y = end_index; } else { for(i=select_index_edit.x; i<=select_index_edit.y - select_index_edit.y; i++) { tmp_string = static_cast< String *> (arr_text_element.GetAt(i)); popup_edit_string.Append(*tmp_string); } } onHighlightStart = false; real_position_end = 0; popup = new Popup; popup->Construct(false, Dimension(600,800)); popup->SetPosition(60,30); popup->SetColor(Color(246,246,246,255)); Label *label_ori, *label_edit, *label_explain; label_ori = new Label; label_ori->Construct(Rectangle(30,20,100,40), L"원문"); popup_ori_area = new EditArea(); popup_ori_area->Construct(Rectangle(50, 60, 500, 150),INPUT_STYLE_OVERLAY); popup_ori_area->SetKeypadEnabled(false); popup_ori_area->SetColor(EDIT_STATUS_NORMAL, Color(216,216,216,255)); popup_ori_area->SetColor(EDIT_STATUS_PRESSED, Color(216,216,216,255)); popup_ori_area->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(216,216,216,255)); popup_ori_area->SetText(popup_edit_string); popup->AddControl(popup_ori_area); popup->AddControl(label_ori); label_edit = new Label; label_edit->Construct(Rectangle(30,220,280,40), L"글을 수정해주세요"); popup_edit_area = new EditArea(); popup_edit_area->Construct(Rectangle(50, 270, 500, 150),INPUT_STYLE_OVERLAY); popup_edit_area->SetFocus(); popup_edit_area->SetText(popup_edit_string); popup_edit_area->SetColor(EDIT_STATUS_NORMAL, Color(255,255,255,255)); popup_edit_area->SetColor(EDIT_STATUS_PRESSED , Color(255,255,255,255)); popup_edit_area->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(255,255,255,255)); popup_edit_area->AddKeyEventListener(*this); popup->AddControl(popup_edit_area); popup->AddControl(label_edit); label_explain = new Label; label_explain->Construct(Rectangle(30,430,200,40), L"피드백 설명"); popup_explain = new EditArea(); popup_explain->Construct(Rectangle(50, 480, 500, 150),INPUT_STYLE_OVERLAY); popup_explain->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(255,255,255,255)); popup_explain->SetColor(EDIT_STATUS_PRESSED, Color(255,255,255,255)); popup_explain->SetColor(EDIT_STATUS_NORMAL, Color(255,255,255,255)); popup->AddControl(popup_explain); popup->AddControl(label_explain); Button* pCloseButton = new Button(); pCloseButton->Construct(Rectangle(20, 630, 250, 80), L"Close Popup"); pCloseButton->SetActionId(2); pCloseButton->AddActionEventListener(*this); // Adds the button to the popup popup->AddControl(pCloseButton); Button* CompletionButton = new Button(); CompletionButton->Construct(Rectangle(20, 630, 250, 80), L"Completion"); CompletionButton->SetActionId(3); CompletionButton->AddActionEventListener(*this); // Adds the button to the popup // popup->AddControl(CompletionButton); // 원문의 단어와 첨삭본의 단어의 개수를 구한다. arr_ori_word.RemoveAll(); arr_edit_word.RemoveAll(); EditWord *tmp_word; int tmp_length = 0; for(i=start_index; i<=end_index; i++) { tmp_string = static_cast< String *> (arr_text_element.GetAt(i)); tmp_word = new EditWord; tmp_word->word = *tmp_string; tmp_word->start_index = tmp_length; AppLog("tmp_word->start_index : %d", tmp_word->start_index); tmp_length += tmp_word->word.GetLength(); tmp_word->end_index = tmp_length; arr_ori_word.Add(*tmp_word); //arr_text_element_editing_mark.Add(new Integer(NONE)); } edit_area_length = popup_edit_string.GetLength(); draw_timer.Cancel(); ShowPopup(); break; } case 2: { int i; Integer *tmp_int; String *tmp_str; Integer *tmp_check; Point *tmp_point; Attached_decision(); SyncText(); TextCorrecting(); if(popup_explain->GetTextLength() > 0){ AppLog("cont %S", popup_explain->GetText().GetPointer()); arr_memo.SetAt(new String(popup_explain->GetText()), start_index); } for(i=start_index; i<=end_index; i++) { //AppLog("cont %d", tmp_string2->GetLength()); arr_binding_start_and_end.SetAt(new Point(start_index, end_index), i); } /*EditWord tmp_word; for(i = 0; i < arr_ori_word.GetCount(); i++) { tmp_int = arr_text_element_editing_mark.GetAt(i); if(tmp_int == 3) AppLog("attach : %S, index : %d", tmp_word.word.GetPointer(), tmp_word.start_index); } for(i = 0; i < arr_edit_word.GetCount(); i++) { tmp_int = arr_text_element_editing_mark.GetAt(i); if(tmp_int == 3) AppLog("attach : %S, index : %d", tmp_word.word.GetPointer(), tmp_word.start_index); }*/ for(i = 0; i < arr_text_element.GetCount(); i++) { tmp_int = static_cast< Integer *> (arr_text_element_editing_mark.GetAt(i)); tmp_str = static_cast< String *> (arr_text_element.GetAt(i)); tmp_check = static_cast< Integer *> (arr_insert_check.GetAt(i)); tmp_point = static_cast< Point *> (arr_binding_start_and_end.GetAt(i)); if(tmp_int->value == 3) AppLog("attach : %S", tmp_str->GetPointer()); else if(tmp_int->value == 2) AppLog("modify : %S", tmp_str->GetPointer()); else if(tmp_int->value == 1) AppLog("delete : %S", tmp_str->GetPointer()); /*else if(tmp_bool->GetTrue() == true) { tmp_str = static_cast< String *> (arr_text_insert.GetAt(i)); AppLog("insert : %S", tmp_str->GetPointer()); }*/ } HidePopup(); popup_edit_string.Clear(); popup->Destroy(); break; } case 10: { popup = new Popup; popup->Construct(false, Dimension(600,400)); popup->SetPosition(60,500); Button *button = new Button; button->Construct(Rectangle(20,200,260, 150), L"삭제합니다"); button->SetActionId(11); button->AddActionEventListener(*this); Button *button2 = new Button; button2->Construct(Rectangle(300,200,260, 150), L"아니오"); button2->SetActionId(12); button2->AddActionEventListener(*this); popup->AddControl(button); popup->AddControl(button2); ShowPopup(); } break; case 11: { for(int i=select_index_edit.x; i<=select_index_edit.y; i++) { arr_insert_check.SetAt(new Integer(0), i); arr_text_insert.SetAt(new String(" "), i); arr_text_element_highlight.SetAt(new Boolean(false), i); arr_text_element_editing_mark.SetAt(new Integer(0), i); arr_binding_start_and_end.SetAt(new Point(1000,1000), i); arr_memo.SetAt(new String("0"), i); } HidePopup(); popup->Destroy(); } break; case 12: { HidePopup(); popup->Destroy(); } break; case 90: { Button *button = new Button; popup = new Popup; AppLog("goood!!!"); popup->Construct(true, Dimension(600,800)); draw_timer.Cancel(); popup->SetPosition(60,60); popup->SetTitleText(L"Ellen Page님의 글"); button->Construct(Rectangle(550,200,50,50),"닫"); button->SetActionId(91); button->AddActionEventListener(*this); EditArea *eng = new EditArea; eng->Construct(Rectangle(0, 0, 550, 800),INPUT_STYLE_OVERLAY); eng->SetKeypadEnabled(false); eng->SetText(Eng); eng->SetColor(EDIT_STATUS_HIGHLIGHTED, Color(255,255,255,255)); eng->SetColor(EDIT_STATUS_PRESSED, Color(255,255,255,255)); eng->SetColor(EDIT_STATUS_NORMAL, Color(255,255,255,255)); popup->SetColor(Color(255,255,255,255)); popup->AddControl(button); popup->AddControl(eng); ShowPopup(); break; } case 91: { HidePopup(); popup->Destroy(); break; } } }
bool GCubeApp::OnAppInitialized(void) { // フレーム作成 Frame *pFrame = new Frame(); pFrame->Construct(); pFrame->SetName(L"GCube"); // フォーム作成 Form *pForm = new Form(); if (settings->showStatusBar) { pForm->Construct(FORM_STYLE_INDICATOR); } else { pForm->Construct(FORM_STYLE_NORMAL); } pForm->AddTouchEventListener(*this); pForm->AddOrientationEventListener(*this); pFrame->AddControl(pForm); pFrame->SetCurrentForm(pForm); // 画面の向き enum Orientation orientation = ORIENTATION_NONE; if (settings->orientationPortrait) { if (settings->orientationLandscapeLeft || settings->orientationLandscapeRight) { orientation = ORIENTATION_AUTOMATIC; } else { orientation = ORIENTATION_PORTRAIT; } } else { if (settings->orientationPortraitUpsideDown) { if (settings->orientationLandscapeLeft || settings->orientationLandscapeRight) { orientation = ORIENTATION_AUTOMATIC_FOUR_DIRECTION; } else { orientation = ORIENTATION_PORTRAIT_REVERSE; } } else { if (settings->orientationLandscapeLeft) { orientation = ORIENTATION_LANDSCAPE_REVERSE; } else { if (settings->orientationLandscapeRight) { orientation = ORIENTATION_LANDSCAPE; } } } } pFrame->SetOrientation(orientation); pForm->SetOrientation(orientation); pFrame->SetMultipointTouchEnabled(true); AddFrame(*pFrame); { __player = new Tizen::Graphics::Opengl::GlPlayer; __player->Construct(Tizen::Graphics::Opengl::EGL_CONTEXT_CLIENT_VERSION_2_X, pForm); __player->SetFps(settings->frameRate); __player->SetEglAttributePreset(Tizen::Graphics::Opengl::EGL_ATTRIBUTES_PRESET_ARGB8888); EGLint eglConfigList[] = { EGL_RED_SIZE, 8, EGL_GREEN_SIZE, 8, EGL_BLUE_SIZE, 8, EGL_ALPHA_SIZE, 8, EGL_DEPTH_SIZE, 16, EGL_SURFACE_TYPE, EGL_WINDOW_BIT, EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, EGL_NONE }; __player->SetEglAttributeList(eglConfigList); __player->Start(); } __renderer = new GlRendererTemplate(); __player->SetIGlRenderer(__renderer); int w = __renderer->GetTargetControlWidth(); int h = __renderer->GetTargetControlHeight(); if (settings->debugButtonPos > 0) { // デバッグボタン作成 // TODO: XMLで作成 int dy = 0; if (settings->showStatusBar) { dy = 60; } Button* pDebugButton = new Button(); if (settings->debugButtonPos == 1) { pDebugButton->Construct(Rectangle(w-80, h-80-dy, 70, 70), L"D"); } else if (settings->debugButtonPos == 2) { pDebugButton->Construct(Rectangle(10, h-80-dy, 70, 70), L"D"); } else if (settings->debugButtonPos == 3) { pDebugButton->Construct(Rectangle(w-80, 10, 70, 70), L"D"); } else { pDebugButton->Construct(Rectangle(10, 10, 70, 70), L"D"); } pDebugButton->SetActionId(ID_DEBUG_BUTTON); pDebugButton->AddActionEventListener(*this); pForm->AddControl(pDebugButton); // ポップアップ作成 __pPopup = new Popup(); __pPopup->Construct(true, Dimension(600, 800)); __pPopup->SetTitleText(L"DebugConsole"); // ポップアップを閉じるボタン作成 Button* pCloseButton = new Button(); pCloseButton->Construct(Rectangle(30, 600, 250, 80), L"Cancel"); pCloseButton->SetActionId(ID_BUTTON_CLOSE_POPUP); pCloseButton->AddActionEventListener(*this); __pPopup->AddControl(pCloseButton); // OKボタン作成 Button* pOKButton = new Button(); pOKButton->Construct(Rectangle(320, 600, 250, 80), L"OK"); pOKButton->SetActionId(ID_BUTTON_OK_POPUP); pOKButton->AddActionEventListener(*this); __pPopup->AddControl(pOKButton); // テキスト入力 __pEditField = new EditField(); __pEditField->Construct(Rectangle(30, 500, 540, 80)); __pPopup->AddControl(__pEditField); // 説明テキスト std::vector<char> textBuff; GCGetResourceData("etc/debug.txt", textBuff); textBuff.push_back('\n'); String text = String(&textBuff[0]); TextBox *pTextBox = new TextBox(); pTextBox->Construct(Rectangle(30, 50, 540, 430)); pTextBox->SetTextSize(18); pTextBox->SetText(text); __pPopup->AddControl(pTextBox); } // サイズを通知 DeviceOrientation o = this->ConvertOrientState(pFrame->GetOrientationStatus()); gcube->onSizeChanged(w, h, o); if (settings->useOrientationSensor) { __sensorManager.Construct(); this->CreateSensor(); } return true; }
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 GameForm::OnInitializing(void) { result r = E_SUCCESS; // Create an OptionKey //SetOptionkeyActionId(ID_OPTIONKEY); //AddOptionkeyActionListener(*this); Game* game = Game::getInstance(); game->setProperties(_size, _casesCount, _rowSize, _valueMax); game->build(); game->setGameForm(this); // Create a Button int APPLICATION_WIDTH = Application::GetInstance()->GetAppFrame()->GetFrame()->GetWidth(); int APPLICATION_HEIGHT = Application::GetInstance()->GetAppFrame()->GetFrame()->GetHeight(); int BUTTON_WIDTH = APPLICATION_WIDTH/ (_rowSize + 1); int BUTTON_HEIGHT = BUTTON_WIDTH * 1.2;//APPLICATION_HEIGHT/12; for(int i = 0; i < _casesCount; i++) { Button *pButton = new Button(); int row = i/ _rowSize; int column = i% _columnSize; int x = column * BUTTON_WIDTH; int y = BUTTON_HEIGHT / 2 + row * BUTTON_HEIGHT; //Add spaces betwin group of cases y += (row / _size) * BUTTON_HEIGHT / 2; //Add spaces betwin group of cases x += (column / _size) * BUTTON_WIDTH / 2; pButton->Construct(__R(x, y, BUTTON_WIDTH, BUTTON_HEIGHT)); AddControl(*pButton); Osp::Base::String label= ""; pButton->SetText(label); //pButton->SetText(L); pButton->SetActionId(ID_FIST_CASE + i); pButton->AddActionEventListener(*this); _buttons.push_back(pButton); } int controlButtonsWidth = APPLICATION_WIDTH * 0.8; int remainingHeight = APPLICATION_HEIGHT - ( BUTTON_HEIGHT * (_columnSize + 1)); int resultButtonHeight = remainingHeight / 5; int controlButtonsY = APPLICATION_HEIGHT - remainingHeight/2 - resultButtonHeight/2;//- (1.75 * resultButtonHeight); Button *resultButton = new Button(); resultButton->Construct(__R(controlButtonsWidth * 0.1, controlButtonsY, controlButtonsWidth/2, resultButtonHeight)); AddControl(*resultButton); resultButton->SetText(L"Solve Me!"); resultButton->SetActionId(ID_RESULT_BUTTON); resultButton->AddActionEventListener(*this); Button *resetButton = new Button(); resetButton->Construct(__R(controlButtonsWidth * 0.1 + controlButtonsWidth/2, controlButtonsY, controlButtonsWidth/2, resultButtonHeight)); AddControl(*resetButton); resetButton->SetText(L"Reset"); resetButton->SetActionId(ID_RESET_BUTTON); resetButton->AddActionEventListener(*this); return r; }