--============================================================================
--  style.lua
--  Copyright (c) 2009, Bamtang Games. All Rights Reserved.
------------------------------------------------------------------------------

textFont = gLocalizedPath.."fonts/text_font.mvec";
titleFont = gLocalizedPath.."fonts/title_font.mvec";

BlackColor = Color(0,0,0,255);
WhiteColor = Color(255,255,255,255);
StandarColor = Color(252, 226, 115, 255);

StandardButtonGraphics = {
 "images/gui/buttonup",
 "images/gui/buttondown",
 "images/gui/buttonrollover"
};

CheckboxButtonGraphics = {
    "images/gui/ae_checkpoint_off", 
    "images/gui/ae_checkpoint_on", 
    "images/gui/ae_checkpoint_off", 
    "images/gui/ae_checkpoint_on"
};

PlayButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_play_n",
    gLocalizedPath.."images/buttons/ae_play_d",
    gLocalizedPath.."images/buttons/ae_play_h",
};

TrophiesButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_trophies_n",
    gLocalizedPath.."images/buttons/ae_trophies_d",
    gLocalizedPath.."images/buttons/ae_trophies_h",
};

OptionsButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_options_n",
    gLocalizedPath.."images/buttons/ae_options_d",
    gLocalizedPath.."images/buttons/ae_options_h",
};

HelpButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_help_n",
    gLocalizedPath.."images/buttons/ae_help_d",
    gLocalizedPath.."images/buttons/ae_help_h",
};

QuitButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_quit_n",
    gLocalizedPath.."images/buttons/ae_quit_d",
    gLocalizedPath.."images/buttons/ae_quit_h",
};

ContinueButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_continue_n",
    gLocalizedPath.."images/buttons/ae_continue_d",
    gLocalizedPath.."images/buttons/ae_continue_h",
};

ContinueButtonDifferencesGraphics = {
    gLocalizedPath.."images/differences/ae_continue_n",
    gLocalizedPath.."images/differences/ae_continue_d",
    gLocalizedPath.."images/differences/ae_continue_h",
};

ChangeButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_changeplayer_n",
    gLocalizedPath.."images/buttons/ae_changeplayer_d",
    gLocalizedPath.."images/buttons/ae_changeplayer_h",
};

BackButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_back_n",
    gLocalizedPath.."images/buttons/ae_back_d",
    gLocalizedPath.."images/buttons/ae_back_h",
};

MenuButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_menu_n",
    gLocalizedPath.."images/buttons/ae_menu_d",
    gLocalizedPath.."images/buttons/ae_menu_h",
};

MenuButtonFindObjectsGraphics = {
    gLocalizedPath.."images/findobjects/ae_menu_n",
    gLocalizedPath.."images/findobjects/ae_menu_d",
    gLocalizedPath.."images/findobjects/ae_menu_h",
};

SkipButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_skip_n",
    gLocalizedPath.."images/buttons/ae_skip_d",
    gLocalizedPath.."images/buttons/ae_skip_h",
}

RetryButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_retry_n",
    gLocalizedPath.."images/buttons/ae_retry_d",
    gLocalizedPath.."images/buttons/ae_retry_h"
};

MapButtonGraphics = {
    "images/gui/findobjects/ae_map_n",
    "images/gui/findobjects/ae_map_d",
    "images/gui/findobjects/ae_map_h",
};

HintsButtonGraphics = {
    "images/gui/findobjects/ae_hints_n",
    "images/gui/findobjects/ae_hints_d",
    "images/gui/findobjects/ae_hints_h",
};

YesButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_yes_n",
    gLocalizedPath.."images/buttons/ae_yes_d",
    gLocalizedPath.."images/buttons/ae_yes_h",
};

NoButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_no_n",
    gLocalizedPath.."images/buttons/ae_no_d",
    gLocalizedPath.."images/buttons/ae_no_h",
};

ResumeButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_resumegame_n",
    gLocalizedPath.."images/buttons/ae_resumegame_d",
    gLocalizedPath.."images/buttons/ae_resumegame_h",
};

RestartButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_restartlevel_n",
    gLocalizedPath.."images/buttons/ae_restartlevel_d",
    gLocalizedPath.."images/buttons/ae_restartlevel_h",
};

Help2ButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_help2_n",
    gLocalizedPath.."images/buttons/ae_help2_d",
    gLocalizedPath.."images/buttons/ae_help2_h",
};

MainMenuButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_mainmenu_n",
    gLocalizedPath.."images/buttons/ae_mainmenu_d",
    gLocalizedPath.."images/buttons/ae_mainmenu_h",
};

MainMenu2ButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_mainmenu2_n",
    gLocalizedPath.."images/buttons/ae_mainmenu2_d",
    gLocalizedPath.."images/buttons/ae_mainmenu2_h",
};

Options2ButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_options2_n",
    gLocalizedPath.."images/buttons/ae_options2_d",
    gLocalizedPath.."images/buttons/ae_options2_h",
};

CoordinatesArrowLeftButtonGraphics = {
	"images/gui/coordinates/ae_c_arrow_l_n.png",
	"images/gui/coordinates/ae_c_arrow_l_d.png",
	"images/gui/coordinates/ae_c_arrow_l_h.png"
};

CoordinatesArrowRightButtonGraphics = {
	"images/gui/coordinates/ae_but_ok_n.png",
	"images/gui/coordinates/ae_but_ok_d.png",
	"images/gui/coordinates/ae_but_ok_h.png"
};

Room1ButtonGraphics = {
	gLocalizedPath.."images/map/room1Btn1.png",
	gLocalizedPath.."images/map/room1Btn2.png",
	gLocalizedPath.."images/map/room1Btn3.png"
};

Room2ButtonGraphics = {
	gLocalizedPath.."images/map/room2Btn1.png",
	gLocalizedPath.."images/map/room2Btn2.png",
	gLocalizedPath.."images/map/room2Btn3.png"
};

Room3ButtonGraphics = {
	gLocalizedPath.."images/map/room3Btn1.png",
	gLocalizedPath.."images/map/room3Btn2.png",
	gLocalizedPath.."images/map/room3Btn3.png"
};

KitchenButtonGraphics = {
	"images/gui/map/ae_map_level1_kitchen.png",
	"images/gui/map/ae_map_level1_kitchen.png",
	"images/gui/map/ae_map_level1_kitchen.png"
};

BedButtonGraphics = {
	"images/gui/map/ae_map_level1_bedroom.png",
	"images/gui/map/ae_map_level1_bedroom.png",
	"images/gui/map/ae_map_level1_bedroom.png"
};

Bed2ButtonGraphics = {
	"images/gui/map/ae_map_level2_bedroom.png",
	"images/gui/map/ae_map_level2_bedroom.png",
	"images/gui/map/ae_map_level2_bedroom.png"
};

LivingButtonGraphics = {
	"images/gui/map/ae_map_level1_livingroom.png",
	"images/gui/map/ae_map_level1_livingroom.png",
	"images/gui/map/ae_map_level1_livingroom.png"
};

Living2ButtonGraphics = {
	"images/gui/map/ae_map_level2_livingroom.png",
	"images/gui/map/ae_map_level2_livingroom.png",
	"images/gui/map/ae_map_level2_livingroom.png"
};

DinningButtonGraphics = {
	"images/gui/map/ae_map_level2_dinner.png",
	"images/gui/map/ae_map_level2_dinner.png",
	"images/gui/map/ae_map_level2_dinner.png"
};

PavillonButtonGraphics = {
	"images/gui/map/ae_map_level3_pavilion.png",
	"images/gui/map/ae_map_level3_pavilion.png",
	"images/gui/map/ae_map_level3_pavilion.png"
};

GrandButtonGraphics = {
	"images/gui/map/ae_map_level3_gstand.png",
	"images/gui/map/ae_map_level3_gstand.png",
	"images/gui/map/ae_map_level3_gstand.png"
};

ParkingButtonGraphics = {
	"images/gui/map/ae_map_level3_outside.png",
	"images/gui/map/ae_map_level3_outside.png",
	"images/gui/map/ae_map_level3_outside.png"
};

LandButtonGraphics = {
	"images/gui/map/ae_map_level4_landzone.png",
	"images/gui/map/ae_map_level4_landzone.png",
	"images/gui/map/ae_map_level4_landzone.png"
};

CovertisoButtonGraphics = {
	"images/gui/map/ae_map_level4_convertisobarn.png",
	"images/gui/map/ae_map_level4_convertisobarn.png",
	"images/gui/map/ae_map_level4_convertisobarn.png"
};

MotorButtonGraphics = {
	"images/gui/map/ae_map_level4_motorzoom.png",
	"images/gui/map/ae_map_level4_motorzoom.png",
	"images/gui/map/ae_map_level4_motorzoom.png"
};

CamaroteButtonGraphics = {
	"images/gui/map/ae_map_level5_cabin.png",
	"images/gui/map/ae_map_level5_cabin.png",
	"images/gui/map/ae_map_level5_cabin.png"
};

CubiertaButtonGraphics = {
	"images/gui/map/ae_map_level5_deckboat.png",
	"images/gui/map/ae_map_level5_deckboat.png",
	"images/gui/map/ae_map_level5_deckboat.png"
};

ShipButtonGraphics = {
	"images/gui/map/ae_map_level5_porthawaii.png",
	"images/gui/map/ae_map_level5_porthawaii.png",
	"images/gui/map/ae_map_level5_porthawaii.png"
};

HangarButtonGraphics = {
	"images/gui/map/ae_map_level6_hangar.png",
	"images/gui/map/ae_map_level6_hangar.png",
	"images/gui/map/ae_map_level6_hangar.png"
};

PistaButtonGraphics = {
	"images/gui/map/ae_map_level6_tracktarrizaje.png",
	"images/gui/map/ae_map_level6_tracktarrizaje.png",
	"images/gui/map/ae_map_level6_tracktarrizaje.png"
};

CabineButtonGraphics = {
	"images/gui/map/ae_map_level6_cabin.png",
	"images/gui/map/ae_map_level6_cabin.png",
	"images/gui/map/ae_map_level6_cabin.png"
};

BeachButtonGraphics = {
	"images/gui/map/ae_map_level7_beach.png",
	"images/gui/map/ae_map_level7_beach.png",
	"images/gui/map/ae_map_level7_beach.png"
};

ForestButtonGraphics = {
	"images/gui/map/ae_map_level7_forest.png",
	"images/gui/map/ae_map_level7_forest.png",
	"images/gui/map/ae_map_level7_forest.png"
};

CampButtonGraphics = {
	"images/gui/map/ae_map_level7_camp.png",
	"images/gui/map/ae_map_level7_camp.png",
	"images/gui/map/ae_map_level7_camp.png"
};

RedplaneButtonGraphics = {
	"images/gui/map/ae_map_level8_room.png",
	"images/gui/map/ae_map_level8_room.png",
	"images/gui/map/ae_map_level8_room.png"
};

EntranceButtonGraphics = {
	"images/gui/map/ae_map_level8_entrancemuseum.png",
	"images/gui/map/ae_map_level8_entrancemuseum.png",
	"images/gui/map/ae_map_level8_entrancemuseum.png"
};

AirsterButtonGraphics = {
	"images/gui/map/ae_map_level8_airster.png",
	"images/gui/map/ae_map_level8_airster.png",
	"images/gui/map/ae_map_level8_airster.png"
};

ExitInventoryButtonGraphics = {
    "images/gui/findobjects/ae_x_n", 
    "images/gui/findobjects/ae_x_d", 
    "images/gui/findobjects/ae_x_h"
};

EditNameButtonGraphics = {
    gLocalizedPath.."images/chooseplayer/ae_editname_n", 
    gLocalizedPath.."images/chooseplayer/ae_editname_d", 
    gLocalizedPath.."images/chooseplayer/ae_editname_h"
};

OkNameButtonGraphics = {
    gLocalizedPath.."images/chooseplayer/ae_ok_n", 
    gLocalizedPath.."images/chooseplayer/ae_ok_d", 
    gLocalizedPath.."images/chooseplayer/ae_ok_h"
};

NewPlayerButtonGraphics = {
    gLocalizedPath.."images/chooseplayer/ae_newplayer_n", 
    gLocalizedPath.."images/chooseplayer/ae_newplayer_d", 
    gLocalizedPath.."images/chooseplayer/ae_newplayer_h"
};

DeletePlayerButtonGraphics = {
    gLocalizedPath.."images/chooseplayer/ae_deleteplayer_n", 
    gLocalizedPath.."images/chooseplayer/ae_deleteplayer_d", 
    gLocalizedPath.."images/chooseplayer/ae_deleteplayer_h"
};

TimeButtonGraphics = {
    "images/gui/ae_checkpoint_off", 
    "images/gui/ae_checkpoint_on",
    "images/gui/ae_checkpoint_off",
    "images/gui/ae_checkpoint_on"
};

CancelButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_cancel_n", 
    gLocalizedPath.."images/buttons/ae_cancel_d", 
    gLocalizedPath.."images/buttons/ae_cancel_h"
};

OkButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_ok_n", 
    gLocalizedPath.."images/buttons/ae_ok_d", 
    gLocalizedPath.."images/buttons/ae_ok_h"
};

CreditsButtonGraphics = {
    gLocalizedPath.."images/buttons/ae_credits_n", 
    gLocalizedPath.."images/buttons/ae_credits_d", 
    gLocalizedPath.."images/buttons/ae_credits_h"
};

StandardButtonFont = {
    textFont,
    18,
    BlackColor
};

DialogTitleFont = {
    titleFont,
    20,
    Color(252, 226, 115, 255)
};

DialogBodyFont = {
    titleFont,
    18,
    Color(252, 226, 115, 255)
};

CheckboxButtonFont = {
    titleFont,
    18,
    Color(252, 226, 115, 255)
};

DefaultStyle = {
    font = DialogBodyFont
};

DialogTitleText = {
    parent = DefaultStyle,
    font = DialogTitleFont,
    flags = kVAlignCenter + kHAlignLeft,
    x=16, y=12, w=kMax, h=30
};

DialogBodyText = {
    parent = DefaultStyle,
    font = DialogTitleFont,
    flags = kVAlignCenter + kHAlignCenter,
--    x=4,y=46,w=kMax-4,h=kMax-60
    x = kCenter, y = 52, 
    w = 250, h = 50
};

SliderStyle = {
    parent = DefaultStyle,
    railtop = "images/gui/ae_slider_bar_00",
    railmid = "images/gui/ae_slider_bar_01",
    railbot = "images/gui/ae_slider_bar_02",
    sliderimage = "images/gui/ae_slider_arrow",
    sliderrollimage = "images/gui/ae_slider_arrow",

    yoffset = -1, -- scoot the slider down by one pixel to center it.
};

kDefaultButtonSound="audio/sfx/snd_button_click.ogg";
kDefaultButtonRollOverSound = "";

ButtonStyle = {
    font = StandardButtonFont,
    sound = kDefaultButtonSound,
    rolloversound = kDefaultButtonRollOverSound,
    type= kPush,
    graphics = StandardButtonGraphics,
};

CheckboxButtonStyle = {
    parent = DefaultStyle,
    font = CheckboxButtonFont,
    type = kToggle,
    sound = kDefaultButtonSound,
    graphics = CheckboxButtonGraphics,
    tx = 0,
};

RadioStyle = {
    type = kRadio,
    flags = kHAlignCenter + kVAlignCenter,
    graphics = TimeButtonGraphics,
    sound = kDefaultButtonSound,
    tx = 0;
};

SetDefaultStyle(DefaultStyle);

-- Create a TButton with a label
--
-- We're overriding the default "Button" here with
-- some custom behavior. Specifically, we're layering
-- a Text{} object on top of every button, and it's placed
-- on all layers (up, down, roll-over).
function Button( button )
    return function()
        -- Grab the label from the button or current style
        if (GetTag(button,"label")) then

            -- Look for text dimensions
            local tx = GetTag(button,"tx");
            local ty = GetTag(button,"ty");
            local tw = GetTag(button,"tw");
            local th = GetTag(button,"th");

            -- Set defaults
            if (not tx) then
                tx = 0;
            end
            if (not ty) then
                ty = 0;
            end
            if (not tw) then
                tw=kMax ;
            end
            if (not th) then
                th=kMax ;
            end

-- 4.0.15 -- Begin new hotkey support
            -- Get the label
            local label = GetTag(button,"label");
            local hotkey = GetTag(button,"hotkey");

            label,labelkey = StripKeyFromLabel( GetString(label) );

            -- If no hotkey was specified explicitly, then
            -- use the translated key.
            if not hotkey then
                -- change our local
                hotkey = labelkey
            end;

            RegisterHotkey( hotkey, GetTag(button,"name") );
-- 4.0.15 -- End new hotkey support (more below!)

            local defflags = kPushButtonAlignment ;
            if (GetTag(button,"type")==kToggle) then
                defflags = kToggleButtonAlignment ;
            elseif (GetTag(button,"type")==kRadio) then
                defflags = kRadioButtonAlignment ;
            end

            local textfactory = GetTag(button,"textfactory");
            if (not textfactory) then
                textfactory = "_text"
            end
            table.insert(button,
                SelectLayer( kAllLayers )
            );
            -- Grow our window to encompass any children we've added
            -- already.
            table.insert(button,
                FitToChildren()
            );

            table.insert(button,
                AppendStyle{ font=button.font; flags=button.flags; }
            );

            table.insert(button,
                Text {
-- 4.0.15 -- Begin new hotkey support
                    label="#"..TagHotKey( hotkey, label ),
-- 4.0.15 -- End new hotkey support
                    x=tx, y=ty, w=tw, h=th,
                    name='label',
                    defflags =defflags
                }
            )
        end

        -- Type name of window to create; in our case, "Button".
        -- If you want to create a derived button type, you can do that here.
        button.typename='Button';
        DoWindow( button )
    end
end

kIllegalNameChars = "!@#$%^&*()><\\\"\'[]{}|?/+=~`.,;:-";
