--============================================================================
--  swt_console.lua
--  Copyright (c) 2009, Bamtang Games. All Rights Reserved.
------------------------------------------------------------------------------
swtConsoleTraceColor = Color(240, 240, 240, 255);
swtConsoleErrorColor = Color(255, 255, 0, 255);
swtConsoleWarningColor = Color(0, 255, 0, 255);
swtConsoleEchoColor = Color(0, 255, 255, 255);

swtConsoleTypeFont = 'swit/console.mvec';
swtConsoleFontSize = 12;

swtConsoleTraceFont = {
    swtConsoleTypeFont,
    swtConsoleFontSize,
    swtConsoleTraceColor
};
swtConsoleErrorFont = {
    swtConsoleTypeFont,
    swtConsoleFontSize,
    swtConsoleErrorColor
};
swtConsoleWarningFont = {
    swtConsoleTypeFont,
    swtConsoleFontSize,
    swtConsoleWarningColor
};
swtConsoleEchoFont = {
    swtConsoleTypeFont,
    swtConsoleFontSize,
    swtConsoleEchoColor
};

function onSwitConsole(strText)
    if gOnSwitConsole then
        if gOnSwitConsole(strText) then
            SetLabel('txtInput', '');
        end
    end
end

MakeDialog {
    name = 'swtConsoleDialog',
    w = 1024;
    h = 768;
    
    Bitmap {
        x = 0;
        y = 0;
        image = 'swit/console';
        alpha = true;
        autoscale = true;
    };

    Text {
        name = 'lblTraces';
        font = swtConsoleTraceFont;
        x = 10;
        y = 10;
        w = 1000;
        h = 750;
    };
    Text {
        name = 'lblWarnings';    
        font = swtConsoleWarningFont;
        x = 10;
        y = 10;
        w = 1000;
        h = 750;
    };
    Text {
        name = 'lblErrors';    
        font = swtConsoleErrorFont;
        x = 10;
        y = 10;
        w = 1000;
        h = 750;
    };
    Text {
        name = 'lblEcho';    
        font = swtConsoleEchoFont;
        x = 750;
        y = 650;
        w = 350;
        h = 150;
    };
    swtTextEdit {
        name = 'txtInput';    
        font = swtConsoleEchoFont;
        length = 100;
        flags = kVAlignCenter + kHAlignLeft;
        utf8 = false;
        onEnterKey = 'onSwitConsole';
        x = 850;
        y = 740;
        w = 200;
        h = 30;
    };
}
