mirror of
https://gitlab.com/Nanolx/homebrewfilter.git
synced 2025-02-21 11:37:10 +01:00
83 lines
2.2 KiB
C++
83 lines
2.2 KiB
C++
|
|
#include <unistd.h>
|
|
|
|
#include "libwiigui/gui.h"
|
|
#include "main.h"
|
|
|
|
/*** Extern variables ***/
|
|
extern GuiWindow * mainWindow;
|
|
|
|
/*** Extern functions ***/
|
|
extern void ResumeGui();
|
|
extern void HaltGui();
|
|
|
|
/****************************************************************************
|
|
* WindowPrompt
|
|
*
|
|
* Displays a prompt window to user, with information, an error message, or
|
|
* presenting a user with a choice
|
|
***************************************************************************/
|
|
void
|
|
debug(const char *msg)
|
|
{
|
|
bool stop = false;
|
|
|
|
GuiWindow promptWindow(520,360);
|
|
promptWindow.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
promptWindow.SetPosition(0, -10);
|
|
GuiImageData btnOutline(Theme.button_small);
|
|
GuiImageData btnOutlineOver(Theme.button_small_focus);
|
|
GuiTrigger trigA;
|
|
trigA.SetSimpleTrigger(-1, WPAD_BUTTON_A | WPAD_CLASSIC_BUTTON_A, PAD_BUTTON_A);
|
|
|
|
GuiImageData dialogBox(Theme.dialog_background);
|
|
GuiImage dialogBoxImg(&dialogBox);
|
|
|
|
GuiText titleTxt("debug", 26, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
|
|
titleTxt.SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
|
titleTxt.SetPosition(0,40);
|
|
GuiText msgTxt(msg, 22, (GXColor){Theme.text_1, Theme.text_2, Theme.text_3, 255});
|
|
msgTxt.SetAlignment(ALIGN_CENTRE, ALIGN_MIDDLE);
|
|
msgTxt.SetPosition(0,-20);
|
|
msgTxt.SetMaxWidth(400);
|
|
|
|
GuiText backTxt(tr("OK"), 22, (GXColor){Theme.button_small_text_1, Theme.button_small_text_2, Theme.button_small_text_3, 255});
|
|
GuiImage backImg(&btnOutline);
|
|
GuiImage backImgOver(&btnOutlineOver);
|
|
GuiButton back(btnOutline.GetWidth(), btnOutline.GetHeight());
|
|
|
|
back.SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
|
back.SetPosition(0, -25);
|
|
|
|
back.SetLabel(&backTxt);
|
|
back.SetImage(&backImg);
|
|
back.SetImageOver(&backImgOver);
|
|
back.SetTrigger(&trigA);
|
|
back.SetState(STATE_SELECTED);
|
|
|
|
promptWindow.Append(&dialogBoxImg);
|
|
promptWindow.Append(&titleTxt);
|
|
promptWindow.Append(&msgTxt);
|
|
promptWindow.Append(&back);
|
|
|
|
HaltGui();
|
|
mainWindow->SetState(STATE_DISABLED);
|
|
mainWindow->Append(&promptWindow);
|
|
mainWindow->ChangeFocus(&promptWindow);
|
|
ResumeGui();
|
|
|
|
while(!stop)
|
|
{
|
|
usleep(100);
|
|
|
|
if(back.GetState() == STATE_CLICKED)
|
|
stop = true;
|
|
}
|
|
|
|
HaltGui();
|
|
mainWindow->Remove(&promptWindow);
|
|
mainWindow->SetState(STATE_DEFAULT);
|
|
ResumeGui();
|
|
}
|
|
|