
require( "scripts/style.lua" );

local yes = "yes" ;
local yesname = "yes" ;
local no = "no" ; 
local noname = "no";
local name = "yesnobox";
local yescmd = gDialogTable.yes;
local nocmd = gDialogTable.no;
 
if (gDialogTable.yeslabel) then
    yes = gDialogTable.yeslabel ;
end
if (gDialogTable.nolabel) then
    no = gDialogTable.nolabel ;
end
if (gDialogTable.yesname) then
    yesname = gDialogTable.yesname;
end
if (gDialogTable.noname) then
    noname = gDialogTable.noname;
end

if (gDialogTable.name) then
 name = gDialogTable.name;
end

--function processBtnPressed(button)
--    if (button == "btnYes") then
--        if (yescmd) then 
--            yescmd(); 
--        end
--    elseif (button == "btnNo") then
--        if (nocmd) then
--            nocmd();
--        end
--    end
--
--    PopModal(name);
--end

MakeDialog {
    name = name, -- Remember, this is like saying table['name']=name, so it works.

    YesNoWindow {
        x = 0,
        y = 0,
        w = 800,
        h = 600,

        Bitmap {
            name = "bmpPanelBlack",
            image = "images/gui/ae_background",
            alpha = true;
            x = 0, y = 0,
            w = 800, h = 600,
        },

        Bitmap {
            name = "bmpPanelContainer",
            image = "images/gui/ae_panelquit",
            x = kCenter,
            y = 154,

    --        SetStyle(DialogTitleText),
    --        Text {
    --            name = "yesnotitle",
    --            label = gDialogTable.title,
    --            x = 24, y = 13,
    --            w = 50, h = 30
    --        };

            SetStyle(DialogBodyText),
            Text {
                name = "yesnobody",
                label = gDialogTable.body,
            };

            SetStyle(ButtonStyle),
            Button {
                command =
                    function()
                        if (yescmd) then 
                            yescmd(); 
                        end
                    end;
                close = true,
                flags = 5,
                name = yesname,
                graphics = YesButtonGraphics,
                x = kCenter, 
                y = 94,
            },
            Button {
                command=
                    function() 
                        if (nocmd) then
                            nocmd();
                        end
                    end;
                close = true,
                flags = 5,
                name = noname,
                graphics = NoButtonGraphics,
                x = kCenter,
                y = 143,
            },
        },
    }
} -- MakeDialog
