0ad/binaries/data/mods/mod/gui/common/functions_msgbox.js
Angen f1874ec196 Add color mixer
Add option to pick colour with sliders

Differential revision: D4597
Comments by: @Stan, @vladislavbelov, @Langbart, @elexis
This was SVN commit r27188.
2022-11-01 11:46:14 +00:00

59 lines
1.3 KiB
JavaScript

function messageBox(mbWidth, mbHeight, mbMessage, mbTitle, mbButtonCaptions, mbBtnCode, mbCallbackArgs)
{
Engine.PushGuiPage(
"page_msgbox.xml",
{
"width": mbWidth,
"height": mbHeight,
"message": mbMessage,
"title": mbTitle,
"buttonCaptions": mbButtonCaptions
},
btnCode => {
if (mbBtnCode !== undefined && mbBtnCode[btnCode])
mbBtnCode[btnCode](mbCallbackArgs ? mbCallbackArgs[btnCode] : undefined);
});
}
function timedConfirmation(width, height, message, timeParameter, timeout, title, buttonCaptions, btnCode, callbackArgs)
{
Engine.PushGuiPage(
"page_timedconfirmation.xml",
{
"width": width,
"height": height,
"message": message,
"timeParameter": timeParameter,
"timeout": timeout,
"title": title,
"buttonCaptions": buttonCaptions
},
button => {
if (btnCode !== undefined && btnCode[button])
btnCode[button](callbackArgs ? callbackArgs[button] : undefined);
});
}
function colorMixer(color, callback)
{
Engine.PushGuiPage(
"page_colormixer.xml",
color,
result => {
callback(result);
}
);
}
function openURL(url)
{
Engine.OpenURL(url);
messageBox(
600, 200,
sprintf(
translate("Opening %(url)s\n in default web browser. Please wait…"),
{ "url": url }
),
translate("Opening page"));
}