| 44 | bool CUIMessageBox::OnMouse(float x, float y, EUIMessages mouse_action) { return inherited::OnMouse(x, y, mouse_action); } |
| 45 | |
| 46 | void CUIMessageBox::Init(LPCSTR box_template) |
| 47 | { |
| 48 | Clear(); |
| 49 | CUIXml uiXml; |
| 50 | bool xml_result = uiXml.Init(CONFIG_PATH, UI_PATH, "message_box.xml"); |
| 51 | R_ASSERT3(xml_result, "xml file not found", "message_box.xml"); |
| 52 | |
| 53 | CUIXmlInit xml_init; |
| 54 | |
| 55 | string512 str; |
| 56 | |
| 57 | strconcat(sizeof(str), str, box_template, ":picture"); |
| 58 | m_UIStaticPicture = xr_new<CUIStatic>(); |
| 59 | AttachChild(m_UIStaticPicture); |
| 60 | xml_init.InitStatic(uiXml, str, 0, m_UIStaticPicture); |
| 61 | |
| 62 | strconcat(sizeof(str), str, box_template, ":message_text"); |
| 63 | if (uiXml.NavigateToNode(str, 0)) |
| 64 | { |
| 65 | m_UIStaticText = xr_new<CUIStatic>(); |
| 66 | AttachChild(m_UIStaticText); |
| 67 | xml_init.InitStatic(uiXml, str, 0, m_UIStaticText); |
| 68 | } |
| 69 | |
| 70 | strcpy_s(str, box_template); |
| 71 | xml_init.InitStatic(uiXml, str, 0, this); |
| 72 | |
| 73 | LPCSTR _type = uiXml.ReadAttrib(str, 0, "type", NULL); |
| 74 | R_ASSERT(_type); |
| 75 | |
| 76 | m_eMessageBoxStyle = MESSAGEBOX_OK; |
| 77 | if (0 == _stricmp(_type, "ok")) |
| 78 | { |
| 79 | m_eMessageBoxStyle = MESSAGEBOX_OK; |
| 80 | } |
| 81 | else if (0 == _stricmp(_type, "yes_no")) |
| 82 | { |
| 83 | m_eMessageBoxStyle = MESSAGEBOX_YES_NO; |
| 84 | } |
| 85 | else if (0 == _stricmp(_type, "yes_no_cancel")) |
| 86 | { |
| 87 | m_eMessageBoxStyle = MESSAGEBOX_YES_NO_CANCEL; |
| 88 | } |
| 89 | else if (0 == _stricmp(_type, "direct_ip")) |
| 90 | { |
| 91 | m_eMessageBoxStyle = MESSAGEBOX_DIRECT_IP; |
| 92 | } |
| 93 | else if (0 == _stricmp(_type, "password")) |
| 94 | { |
| 95 | m_eMessageBoxStyle = MESSAGEBOX_PASSWORD; |
| 96 | } |
| 97 | else if (0 == _stricmp(_type, "quit_windows")) |
| 98 | { |
| 99 | m_eMessageBoxStyle = MESSAGEBOX_QUIT_WINDOWS; |
| 100 | } |
| 101 | else if (0 == _stricmp(_type, "quit_game")) |
| 102 | { |
| 103 | m_eMessageBoxStyle = MESSAGEBOX_QUIT_GAME; |
nothing calls this directly
no test coverage detected