--============================================================================
--  yesno.lua
--  Copyright (c) 2010, Bamtang Games. All Rights Reserved.
------------------------------------------------------------------------------
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

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

    Bitmap {
        name = "bmpBgAlpha";
        image = "gpx/screens/transparent_background";
        x = 0; y = 0;
        alpha = true;
    };

    wndMove {
        x = kCenter; y = kCenter;
        w = kMax; h = kMax;

        Bitmap {
            x = kCenter; y = kCenter;
            --image = "gpx/screens/panel05";
            image = "gpx/screens/panel06";

            Bitmap {
                image = "gpx/screens/trophy_icon_01";
                scale = 0.8;
                x = 1; y = 2;
            };

            Bitmap {
                image = "gpx/screens/trophy_icon_02";
                scale = 0.8;
                x = 314; y = 2;
            };

            clsText {
                name = "lblTitle";
                font = Font40; --35;
                flags = kHAlignCenter + kVAlignCenter;
                label = gDialogTable.title;
                x = 0; y = 10; w = 394; h = 70;
                Scale = 0.4;
                Space = -10;
            };

            Text {
                name = "yesnobody",
                font = Font16;
                label = "#"..gDialogTable.body,
                flags = kHAlignCenter + kVAlignCenter;
                x = 40; y = 82; w = 314; h = 82;
            };

            SetStyle(SmallButtonStyle);
            Button {
                name = yesname;
                label = "btnYes";
                x = 243; y = 180;
                close = true;
                flags = 5;
                command =
                    function()
                        if (yescmd) then
                            yescmd();
                        end
                    end;
            },
            Button {
                name = noname;
                label = "btnNo";
                x = 45; y = 180;
                flags = 5;
                close = true;
                command =
                    function()
                        if (nocmd) then
                            nocmd();
                        end
                    end;
            };
        };
    };
}
