--============================================================================
--  message_item.lua
--  Copyright (c) 2009, Bamtang Games. All Rights Reserved.
------------------------------------------------------------------------------
require("scripts/style.lua");

BodyFont = {
    titleFont,
    18,
    BlackColor,
}

function DoBorder(id, posX, posY)
    return Group {
        Bitmap {
            name = "bmpBorder"..id,
            image = "images/gui/borderframetext",
            x = posX,
            y = posY,
        }
    }
end

function MakeBorders(initX, initY, height)
    local windows = {};
    local count = 0;
    for k = 0, 1 do
        for p = 0, 2 do
            table.insert(windows, DoBorder(count, initX + 295*p, initY + height*k));
            count = count + 1;
        end
    end
    return Group(windows);
end

MakeDialog {
    -- Name the modal dialog
    name = "MessageItem",

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

        Bitmap {
            name = "bmpBackground", 
            image = "images/gui/ae_background", 
            x = 0, y = 0,
            alpha = true;
        },

        Bitmap {
            align = kHAlignLeft,
            name = "bmpCharacter",
            image = "images/characters/ae_amy_01",
            x = 0, y = 69, 
        },

        Bitmap {
            align = kHAlignLeft,
            name = "bmpFrameText",
            image = "images/gui/frametext",
            x = -35, y = 471,
        },

        MakeBorders(0, 470, 110),

        Bitmap {
            name = "bmpCharName",
            image = "images/gui/title_amy",
            x = 51, y = 433,
        },

        Text {
            name = "txtMessage",
            font = BodyFont,
            x = 36, y = 493,
            w = 640, h = 70,
            flags = kHAlignLeft + kVAlignCenter,
            label = "#Mesage here...",
        },

        Bitmap {
            name = "bmpBgIcon",
            image = "images/items_message/ae_base_circle";
            x = 681, y = 477,
        },

        Bitmap {
            name = "bmpIcon",
            image = "images/items_message/gadget";
            x = 681, y = 477,
        },

        SetStyle(ButtonStyle),
        Button {
            name = "btnContinue", 
            graphics = ContinueButtonDifferencesGraphics, 
            x = kCenter, 
            y = 560, 
            scale = 0.8, 
            command = 
                function()
                    onMessageItemContinue();
                end
        }
    }
}
