void MessageBox::construct(Manager *pManager, uint8_t uStyle, sf::String sText, uint8_t uButtons) { //Save Currently Focused Widget - We need to grab focus to the messagebox so this is needed pFocusPrevious = pManager->GetFocused(); //Setup Focus SetFocusable(true); pManager->AddFocus(this); pManager->SwitchFocus(this); //Assign Texture and Drag Area SetTexture("win_msgbox.bmp"); SetDragArea(0, 0, GetWidth(), 20); //Now for the Buttons int32_t x = -4; if ((uButtons & MSG_CANCEL) != 0) { UI::Button *pButton = new UI::Button(MSGBOX_NBTN, x, -4); pButton->SetTexture("btn_cancel.bmp", pButton->INACTIVE ); pButton->SetTexture("btn_cancel_a.bmp", pButton->ACTIVE ); pButton->SetTexture("btn_cancel_b.bmp", pButton->PRESSED); pButton->SetCallback(MessageBox::SelectButton); pButton->SetAlign(UI::RIGHT, UI::BOTTOM); x -= (4 + pButton->GetWidth()); AddChild(pButton); } if ((uButtons & MSG_OK) != 0) { UI::Button *pButton = new UI::Button(MSGBOX_PBTN, x, -4); pButton->SetTexture("btn_ok.bmp", pButton->INACTIVE ); pButton->SetTexture("btn_ok_a.bmp", pButton->ACTIVE ); pButton->SetTexture("btn_ok_b.bmp", pButton->PRESSED); pButton->SetCallback(MessageBox::SelectButton); pButton->SetAlign(UI::RIGHT, UI::BOTTOM); AddChild(pButton); } //Set selected as NONE - to avoid mischecks selected = MSG_NONE; //Add the Text sf::Vector2i vTextPos = sf::Vector2i(20, GetHeight()/2); SetColor(sf::Color::Blue, FOREGROUND); UpdateTextVA(dwFontID, sText, uStyle, dwCharSize, GetWidth(), 5, 0, vTextPos); }