/** * Draw GUI components. */ void TabPanelScript::draw() { // do all form drawing here, create widgets, set properties lblScriptName = new QLabel( getPanel(), "lblScriptName" ); lblScriptName->setGeometry( QRect( 10, 11, 151, 16 ) ); QFont lblScriptName_font( lblScriptName->font() ); lblScriptName_font.setPointSize( 12 ); lblScriptName_font.setBold( FALSE ); lblScriptName->setFont( lblScriptName_font ); lblScriptName->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignLeft ) ); txtScriptBody = new QTextEdit( getPanel(), "txtScriptBody" ); txtScriptBody->setGeometry( QRect( 9, 68, 490, 560 ) ); txtScriptBody->setReadOnly(true); lblScriptDuration = new QLabel( getPanel(), "lblScriptDuration" ); lblScriptDuration->setGeometry( QRect( 240, 11, 60, 16 ) ); QFont lblScriptDuration_font( lblScriptDuration->font() ); lblScriptDuration_font.setPointSize( 12 ); lblScriptDuration_font.setBold( FALSE ); lblScriptDuration->setFont( lblScriptDuration_font ); lblScriptDuration->setAlignment( int( QLabel::AlignVCenter | QLabel::AlignLeft ) ); btnScriptDone = new QPushButton( getPanel(), "btnScriptDone" ); btnScriptDone->setGeometry( QRect( 330, 26, 171, 30 ) ); QFont btnScriptDone_font( btnScriptDone->font() ); btnScriptDone_font.setPointSize( 12 ); btnScriptDone_font.setBold( FALSE ); btnScriptDone->setFont( btnScriptDone_font ); txtScriptName = new QLineEdit( getPanel(), "txtScriptName" ); txtScriptName->setGeometry( QRect( 10, 30, 220, 21 ) ); txtScriptName->setReadOnly(true); txtScriptDuration = new QLineEdit( getPanel(), "txtScriptDuration" ); txtScriptDuration->setGeometry( QRect( 238, 30, 70, 21 ) ); txtScriptDuration->setReadOnly(true); lblScriptName->setText( tr( "Item Name:" ) ); lblScriptDuration->setText( tr( "Duration:" ) ); btnScriptDone->setText( tr( "Finished" ) ); connect( btnScriptDone, SIGNAL( clicked() ), this, SLOT( btnScriptDoneClicked() ) ); }
Node* MsgBox::getControl(int tagPanel, int tagControl){ Node* control = getPanel(tagPanel)->getChildByTag(tagControl); return control; }
void LLPanelMainInventory::doCreate(const LLSD& userdata) { menu_create_inventory_item(getPanel()->getRootFolder(), NULL, userdata); }
void LLPanelMainInventory::closeAllFolders() { getPanel()->getRootFolder()->closeAllFolders(); }
void LLPanelMainInventory::doToSelected(const LLSD& userdata) { getPanel()->getRootFolder()->doToSelected(&gInventory, userdata); }
void mouseDoubleClick (const MouseEvent&) { getPanel().panelHeaderDoubleClicked (component); }
void mouseDown (const MouseEvent&) { mouseDownY = getY(); dragStartSizes = getPanel().getFittedSizes(); }
LLPanelPathfindingRebakeNavmesh* LLPanelPathfindingRebakeNavmesh::getInstance() { static LLPanelPathfindingRebakeNavmesh* panel = getPanel(); return panel; }
void LLPanelMainInventory::onExpandButtonClicked() { getPanel()->openAllFolders(); }
// ## Zi: Inventory Collapse and Expand Buttons void LLPanelMainInventory::onCollapseButtonClicked() { // mFilterEditor->clear(); onFilterEdit(""); getPanel()->closeAllFolders(); }
// function for showing the AI menu and editing the felevent settings int AIsettingMenu(windowRef w, GameRef game) { int quit = 0; int retVal = 0; buttonRef continueBtn = getBtn(continueImgFile, (WSw / 2) - BtnRectWidth / 2, 4.8 * (WSh / 6)); if (continueBtn == NULL){ perror("ERROR: failed getBtn"); return ERROR; } buttonRef minimaxDepthBtn = getBtn(minimaxDepthImgFile, (3 * WSw / 4) - BtnRectWidth / 2, 1.15 * (WSh / 6)); if (minimaxDepthBtn == NULL){ perror("ERROR: failed getBtn"); return ERROR; } buttonRef minimax1Btn = getBtn(minimax1ImgFile, (3 * WSw / 4) - BtnRectWidth / 2, 1.6 * (WSh / 6)); if (minimax1Btn == NULL){ perror("ERROR: failed getBtn"); return ERROR; } buttonRef minimax2Btn = getBtn(minimax2ImgFile, (3 * WSw / 4) - BtnRectWidth / 2, 2.2 * (WSh / 6)); if (minimax2Btn == NULL){ perror("ERROR: failed getBtn"); return ERROR; } buttonRef minimax3Btn = getBtn(minimax3ImgFile, (3 * WSw / 4) - BtnRectWidth / 2, 2.8 * (WSh / 6)); if (minimax3Btn == NULL){ perror("ERROR: failed getBtn"); return ERROR; } buttonRef minimax4Btn = getBtn(minimax4ImgFile, (3 * WSw / 4) - BtnRectWidth / 2, 3.4 * (WSh / 6)); if (minimax4Btn == NULL){ perror("ERROR: failed getBtn"); return ERROR; } buttonRef bestDepthBtn = getBtn(bestDepthImgFile, (3 * WSw / 4) - BtnRectWidth / 2, 4 * (WSh / 6)); if (bestDepthBtn == NULL){ perror("ERROR: failed getBtn"); return ERROR; } buttonRef userColorBtn = getBtn(userColorImgFile, (WSw / 4) - BtnRectWidth / 2, 1.15 * (WSh / 6)); if (userColorBtn == NULL){ perror("ERROR: failed getBtn"); return ERROR; } buttonRef whiteBtn = getBtn(whiteImgFile, (WSw / 4) - BtnRectWidth / 2, 1.6 * (WSh / 6)); if (whiteBtn == NULL){ perror("ERROR: failed getBtn"); return ERROR; } buttonRef blackBtn = getBtn(blackImgFile, (WSw / 4) - BtnRectWidth / 2, 2.2 * (WSh / 6)); if (blackBtn == NULL){ perror("ERROR: failed getBtn"); return ERROR; } panelRef topPanel = getPanel(0, 0, WSw, WSh); if (topPanel == NULL){ perror("ERROR: failed getPanel"); return ERROR; } lableRef topPanelLbl = getLbl(backImgFile, 0, 0); if (topPanelLbl == NULL){ perror("ERROR: failed getLabel"); return ERROR; } setLblHightWigth(topPanelLbl, WSw, WSh); while (!quit) { // Clear window to WHITE if (fillWindow(w, 255, 255, 255) == 1) { quit = QUIT; retVal = ERROR; perror("ERROR: failed fillWindow"); break; } fillPanel(topPanel, 255, 255, 255); if (drowImgOnLblPnl(topPanelLbl, topPanel) == 1) { quit = QUIT; retVal = ERROR; perror("ERROR: failed drowImg"); break; } // Draw images if (drowImgOnBtn(continueBtn, w) == 1) { quit = QUIT; retVal = ERROR; perror("ERROR: failed drowImg"); break; } if (drowImgOnBtn(minimaxDepthBtn, w) == 1) { quit = QUIT; retVal = ERROR; perror("ERROR: failed drowImg"); break; } if (drowImgOnBtn(minimax1Btn, w) == 1) { quit = QUIT; retVal = ERROR; perror("ERROR: failed drowImg"); break; } if (drowImgOnBtn(minimax2Btn, w) == 1) { quit = QUIT; retVal = ERROR; perror("ERROR: failed drowImg"); break; } if (drowImgOnBtn(minimax3Btn, w) == 1) { quit = QUIT; retVal = ERROR; perror("ERROR: failed drowImg"); break; } if (drowImgOnBtn(minimax4Btn, w) == 1) { quit = QUIT; retVal = ERROR; perror("ERROR: failed drowImg"); break; } if (drowImgOnBtn(bestDepthBtn, w) == 1) { quit = QUIT; retVal = ERROR; perror("ERROR: failed drowImg"); break; } if (drowImgOnBtn(userColorBtn, w) == 1) { quit = QUIT; retVal = ERROR; perror("ERROR: failed drowImg"); break; } if (drowImgOnBtn(whiteBtn, w) == 1) { quit = QUIT; retVal = ERROR; perror("ERROR: failed drowImg"); break; } if (drowImgOnBtn(blackBtn, w) == 1) { quit = QUIT; retVal = ERROR; perror("ERROR: failed drowImg"); break; } if (SDL_Flip(w->window) != 0) { perror("ERROR: failed perform SDL_Flip in MainMenu"); return ERROR; } //Poll for keyboard & mouse events SDL_Event e = { 0 }; while (SDL_PollEvent(&e) != 0 && quit == 0 && retVal == 0) { switch (e.type) { case (SDL_QUIT) : quit = QUIT; retVal = QUIT; break; case (SDL_KEYUP) : if (e.key.keysym.sym == SDLK_ESCAPE){ quit = QUIT; retVal = QUIT; } case (SDL_MOUSEBUTTONUP) : if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(continueBtn, e)){ quit = QUIT; retVal = setOrGame(w, game, 2); } if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(minimax1Btn, e)){ unmarkAll(minimax1Btn, minimax2Btn, minimax3Btn, minimax4Btn, bestDepthBtn); reloadImgToBtn(minimax1Btn, minimax1PressImgFile); game->minimaxDepth = 1; } if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(minimax2Btn, e)){ unmarkAll(minimax1Btn, minimax2Btn, minimax3Btn, minimax4Btn, bestDepthBtn); reloadImgToBtn(minimax2Btn, minimax2PressImgFile); game->minimaxDepth = 2; } if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(minimax3Btn, e)){ unmarkAll(minimax1Btn, minimax2Btn, minimax3Btn, minimax4Btn, bestDepthBtn); reloadImgToBtn(minimax3Btn, minimax3PressImgFile); game->minimaxDepth = 3; } if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(minimax4Btn, e)){ unmarkAll(minimax1Btn, minimax2Btn, minimax3Btn, minimax4Btn, bestDepthBtn); reloadImgToBtn(minimax4Btn, minimax4PressImgFile); game->minimaxDepth = 4; } if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(bestDepthBtn, e)){ unmarkAll(minimax1Btn, minimax2Btn, minimax3Btn, minimax4Btn, bestDepthBtn); reloadImgToBtn(bestDepthBtn, bestDepthPressImgFile); game->minimaxDepth = 5; } if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(whiteBtn, e)){ reloadImgToBtn(whiteBtn, whitePressImgFile); reloadImgToBtn(blackBtn, blackImgFile); game->userColor = WHITE; game->computerColor = BLACK; } if ((e.button.button == SDL_BUTTON_LEFT) && BtnArea(blackBtn, e)){ reloadImgToBtn(blackBtn, blackPressImgFile); reloadImgToBtn(whiteBtn, whiteImgFile); game->userColor = BLACK; game->computerColor = WHITE; } } } SDL_Delay(0); } // free allocated mem freePanel(topPanel); freeBtn(continueBtn); freeBtn(minimaxDepthBtn); freeBtn(minimax1Btn); freeBtn(minimax2Btn); freeBtn(minimax3Btn); freeBtn(minimax4Btn); freeBtn(bestDepthBtn); freeBtn(whiteBtn); freeBtn(blackBtn); freeLbl(topPanelLbl); freeBtn(userColorBtn); return retVal; }
void Fixture::drawGui() { getPanel()->draw(); }