44
iwMsgbox::iwMsgbox(const std::string& title, const std::string& text, Window *parent, MsgboxButton button, unsigned short icon, unsigned int msgboxid)
45
: IngameWindow(CGI_MSGBOX, 0xFFFF, 0xFFFF, 420, 140, title, LOADER.GetImageN("resource", 41), true), parent(parent), button(button), msgboxid(msgboxid), text(text)
44
iwMsgbox::iwMsgbox(const std::string& title, const std::string& text, Window* parent, MsgboxButton button, unsigned short icon, unsigned int msgboxid)
45
: IngameWindow(CGI_MSGBOX, 0xFFFF, 0xFFFF, 420, 140, title, LOADER.GetImageN("resource", 41), true), parent(parent), button(button), msgboxid(msgboxid), text(text)
47
AddImage(0, 42, 42, LOADER.GetImageN("io", icon));
48
//ctrlMultiline *multiline = AddMultiline(1, 77, 34, 400, 90, TC_GREEN2, NormalFont);
49
//multiline->AddText(text, COLOR_YELLOW);
50
/*AddText(1, 80, 30, text, COLOR_YELLOW, 0, NormalFont);*/
52
// Umbrechungsinformationen vom Text holen
53
glArchivItem_Font::WrapInfo wi;
54
NormalFont->GetWrapInfo(text,330,330,wi);
55
// Einzelne Zeilen-Strings erzeugen
56
strings = new std::string[wi.positions.size()];
57
wi.CreateSingleStrings(text,strings);
58
lines_count = wi.positions.size();
65
AddButton(0, width / 2 - 45, _("OK"), TC_GREEN2);
66
VideoDriverWrapper::inst().SetMousePos(GetX() + width / 2, GetY() + 110);
71
AddButton(0, width / 2 - 3 - 90, _("OK"), TC_GREEN2);
72
AddButton(1, width / 2 + 3, _("Cancel"), TC_RED1);
73
VideoDriverWrapper::inst().SetMousePos(GetX() + width / 2 + 3 + 45, GetY() + 110);
78
AddButton(0, width / 2 - 3 - 90, _("Yes"), TC_GREEN2);
79
AddButton(1, width / 2 + 3, _("No"), TC_RED1);
80
VideoDriverWrapper::inst().SetMousePos(GetX() + width / 2 + 3 + 45, GetY() + 110);
85
AddButton(0, width / 2 - 45 - 6 - 90, _("Yes"), TC_GREEN2);
86
AddButton(1, width / 2 - 45, _("No"), TC_RED1);
87
AddButton(2, width / 2 + 45 + 6, _("Cancel"), TC_GREY);
88
VideoDriverWrapper::inst().SetMousePos(GetX() + width / 2 + 6 + 90, GetY() + 110);
47
AddImage(0, 42, 42, LOADER.GetImageN("io", icon));
48
//ctrlMultiline *multiline = AddMultiline(1, 77, 34, 400, 90, TC_GREEN2, NormalFont);
49
//multiline->AddText(text, COLOR_YELLOW);
50
/*AddText(1, 80, 30, text, COLOR_YELLOW, 0, NormalFont);*/
52
// Umbrechungsinformationen vom Text holen
53
glArchivItem_Font::WrapInfo wi;
54
NormalFont->GetWrapInfo(text, 330, 330, wi);
55
// Einzelne Zeilen-Strings erzeugen
56
strings = new std::string[wi.positions.size()];
57
wi.CreateSingleStrings(text, strings);
58
lines_count = wi.positions.size();
65
AddButton(0, width / 2 - 45, _("OK"), TC_GREEN2);
66
VideoDriverWrapper::inst().SetMousePos(GetX() + width / 2, GetY() + 110);
71
AddButton(0, width / 2 - 3 - 90, _("OK"), TC_GREEN2);
72
AddButton(1, width / 2 + 3, _("Cancel"), TC_RED1);
73
VideoDriverWrapper::inst().SetMousePos(GetX() + width / 2 + 3 + 45, GetY() + 110);
78
AddButton(0, width / 2 - 3 - 90, _("Yes"), TC_GREEN2);
79
AddButton(1, width / 2 + 3, _("No"), TC_RED1);
80
VideoDriverWrapper::inst().SetMousePos(GetX() + width / 2 + 3 + 45, GetY() + 110);
85
AddButton(0, width / 2 - 45 - 6 - 90, _("Yes"), TC_GREEN2);
86
AddButton(1, width / 2 - 45, _("No"), TC_RED1);
87
AddButton(2, width / 2 + 45 + 6, _("Cancel"), TC_GREY);
88
VideoDriverWrapper::inst().SetMousePos(GetX() + width / 2 + 6 + 90, GetY() + 110);
93
93
iwMsgbox::~iwMsgbox()
99
99
const MsgboxResult RET_IDS[4][3] =
101
{MSR_OK, MSR_NOTHING, MSR_NOTHING},
102
{MSR_OK, MSR_CANCEL, MSR_NOTHING},
103
{MSR_YES, MSR_NO, MSR_NOTHING},
104
{MSR_YES, MSR_NO, MSR_CANCEL}
101
{MSR_OK, MSR_NOTHING, MSR_NOTHING},
102
{MSR_OK, MSR_CANCEL, MSR_NOTHING},
103
{MSR_YES, MSR_NO, MSR_NOTHING},
104
{MSR_YES, MSR_NO, MSR_CANCEL}
107
107
void iwMsgbox::Msg_ButtonClick(const unsigned int ctrl_id)
110
parent->Msg_MsgBoxResult(msgboxid,RET_IDS[button][ctrl_id-2]);
110
parent->Msg_MsgBoxResult(msgboxid, RET_IDS[button][ctrl_id - 2]);
114
114
void iwMsgbox::Msg_PaintAfter()
117
for(unsigned i = 0;i<lines_count;++i)
118
NormalFont->Draw(GetX()+80,GetY()+30+NormalFont->getHeight()*i,strings[i],glArchivItem_Font::DF_LEFT,0xFFFFFF00);
117
for(unsigned i = 0; i < lines_count; ++i)
118
NormalFont->Draw(GetX() + 80, GetY() + 30 + NormalFont->getHeight()*i, strings[i], glArchivItem_Font::DF_LEFT, 0xFFFFFF00);
121
121
void iwMsgbox::AddButton(unsigned short id, int x, const std::string& text, const TextureColor tc)
123
Window::AddTextButton(2 + id, x, 100, 90, 20, tc, text,NormalFont);
123
Window::AddTextButton(2 + id, x, 100, 90, 20, tc, text, NormalFont);