<Window x:Class="TwoMbit.MainWindow" SizeChanged="Window_SizeChanged" ResizeMode="CanMinimize"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        BorderThickness="0 0 0 0"
        Title="TwoMbit" LostKeyboardFocus="minimizer" FocusableChanged="_FocusChanged" StateChanged="_StateChanged" Activated="_Activated"  Deactivated="_Deactivated" SizeToContent="WidthAndHeight" Name="Window" VisualClearTypeHint="Auto" WindowStartupLocation="CenterScreen"  Closed="closeWindow">
    
    <Window.Resources>
        <RoutedUICommand x:Key="toggleFullscreen" Text="Do toggleFullscreen" />
        <Style x:Key="menu" TargetType="Menu">
            <Setter Property="Background" Value="white" />
            <Setter Property="Padding" Value="0" />
            
            <Style.Triggers>
                <Trigger Property="MenuItem.IsHighlighted" Value="true">
                    <Setter Property="BorderBrush" Value="#7998f1" />
                    <Setter Property="BorderThickness" Value="0"/>
                    <Setter Property="Margin" Value="0" />
                    <Setter Property="Foreground" Value="black" />
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="mitem" TargetType="MenuItem">
            <Setter Property="Foreground" Value="black" />
            <Setter Property="Background" Value="transparent"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Padding" Value="2" /> 
            <Setter Property="Margin" Value="2" />
            <Setter Property="Height" Value="20" />
            <Setter Property="FontSize" Value="12" />
            <Style.Triggers>
                <Trigger Property="MenuItem.IsHighlighted" Value="true">
                    <Setter Property="BorderBrush" Value="#7998f1" />
                    <Setter Property="BorderThickness" Value="1"/>
                    <Setter Property="Margin" Value="2" />
                    <Setter Property="Foreground" Value="black" />
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="mainitem" TargetType="MenuItem">
            <Setter Property="FontSize" Value="12" />
            <Style.Triggers>
                <Trigger Property="MenuItem.IsHighlighted" Value="true">
                    <Setter Property="Foreground" Value="black" />
                </Trigger>
            </Style.Triggers>
        </Style>
    </Window.Resources>

    <Window.CommandBindings>
        <CommandBinding Command="{StaticResource toggleFullscreen}" Executed="toggleFullscreenExecuted" CanExecute="toggleFullscreenCanExecute" />
    </Window.CommandBindings>

    <Window.InputBindings>
        <KeyBinding Command="{StaticResource toggleFullscreen}" Key="Enter" Modifiers="Alt"/>
    </Window.InputBindings>

    <Grid Name="_Grid" Background="Black" Height="250" Width="300" >
        <Menu BorderThickness="0 0 0 0" MouseEnter="_DeactivatedMenu" MouseLeave="_ActivatedMenu" Name="_Menu" Style="{StaticResource menu}"  VerticalAlignment="Top" Height="22" MinWidth="256" IsMainMenu="True" >
            <MenuItem Name="file" Style="{StaticResource mainitem}" Header="File" IsEnabled="True" >
                <MenuItem Name="load_sms" Style="{StaticResource mitem}" Header="Load SMS" Click="loadRomDialogSMS" IsCheckable="False" >
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/load.png" Height="16" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Name="load_snes" Style="{StaticResource mitem}" Header="Load Snes" Click="loadRomDialogSNES" IsCheckable="False" >
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/load.png" Height="16" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Name="unload" Style="{StaticResource mitem}" Header="Unload" IsCheckable="False" IsEnabled="False" Click="unloadCart">
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/unload.png" Height="16" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Name="load_state" Style="{StaticResource mitem}" Header="Load State (F5)" IsEnabled="False" >
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/load_state.png" Height="16" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Name="save_state" Style="{StaticResource mitem}" Header="Save State (F8)" IsEnabled="False" >
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/save_state.png" Height="16" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Name="change_slot" Style="{StaticResource mitem}" Header="Change Slot (F6-F7)" IsEnabled="False" >
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/change_slot.png" Height="16" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Name="cheat_codes" Style="{StaticResource mitem}" Header="Cheat Codes" IsEnabled="False" Click="openSettingWindow" >
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/cheat.png" Height="16" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Name="power" Style="{StaticResource mitem}" Header="Power" IsEnabled="False" Click="powerSystem" >
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/power.png" Height="16" />
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Name="reset" Style="{StaticResource mitem}" Header="Reset" IsEnabled="False" Click="resetSystem" >
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/reset.png" Height="16" />
                    </MenuItem.Icon>
                </MenuItem>
                <Separator />
                <MenuItem Name="recent_roms" Style="{StaticResource mitem}" Header="Recent Roms" >
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/recent.png" Height="16" />
                    </MenuItem.Icon>
                    <MenuItem Name="lock_recent" Style="{StaticResource mitem}" Header="lock" Click="lockRecent">
                        <MenuItem.Icon>
                            <Image Source="/TwoMbit;component/Images/uncheck.png" Height="16" />
                        </MenuItem.Icon>
                    </MenuItem>
                    <MenuItem Name="clear_recent" Style="{StaticResource mitem}" Header="clear" Click="clearRecent">
                        <MenuItem.Icon>
                            <Image Source="/TwoMbit;component/Images/clear.png" Height="16" />
                        </MenuItem.Icon>
                    </MenuItem>   
                </MenuItem>
                <Separator />
                <MenuItem Name="exit" Style="{StaticResource mitem}" Header="Exit" Click="exitApp" >
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/exit.png" Height="16" />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Name="video" Style="{StaticResource mainitem}" Header="Video">
                <MenuItem Name="window_size" Style="{StaticResource mitem}" Header="Window Size">
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/screen.png" Width="18" Height="16"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Name="fullscreen" Style="{StaticResource mitem}" Header="Fullscreen">
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/screen.png" Width="18" Height="16"/>
                    </MenuItem.Icon>
                    <MenuItem Name="set_fullscreen" Command="{StaticResource toggleFullscreen}" InputGestureText="Alt+Enter" Style="{StaticResource mitem}" Header="Fullscreen" Click="setFullscreen" IsEnabled="False">
                        <MenuItem.Icon>
                            <Image Source="/TwoMbit;component/Images/screen.png" Width="18" Height="16"/>
                        </MenuItem.Icon>
                    </MenuItem>
                </MenuItem>
                <Separator />
                <MenuItem Name="region" Style="{StaticResource mitem}" Header="Region">
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/region.png" Width="15" Height="15"/>
                    </MenuItem.Icon>
                    <MenuItem Name="region_auto" Style="{StaticResource mitem}" Header="AUTO" Click="setRegion">
                    </MenuItem>
                    <MenuItem Name="region_us" Style="{StaticResource mitem}" Header="USA" Click="setRegion">
                    </MenuItem>
                    <MenuItem Name="region_jp" Style="{StaticResource mitem}" Header="JAPAN" Click="setRegion">
                    </MenuItem>
                    <MenuItem Name="region_eu" Style="{StaticResource mitem}" Header="EUROPE" Click="setRegion">
                    </MenuItem>
                </MenuItem>
                <MenuItem Name="video_filter" Header="Video Filter" Style="{StaticResource mitem}">
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/filter.png" Width="18" Height="16"/>
                    </MenuItem.Icon>
                    <MenuItem Name="video_filter_hw_point" Style="{StaticResource mitem}" Header="point" Click="setHWFilter">
                    </MenuItem>
                    <MenuItem Name="video_filter_hw_linear" Style="{StaticResource mitem}" Header="linear" Click="setHWFilter">
                    </MenuItem>
                    <Separator/>
                    <MenuItem Name="video_filter_sw_normal" Style="{StaticResource mitem}" Header="normal" Click="setSWFilter">
                    </MenuItem>
                    <MenuItem Name="video_filter_sw_ntsc" Style="{StaticResource mitem}" Header="ntsc" Click="setSWFilter">
                    </MenuItem>
                </MenuItem>
                <MenuItem Name="vsync" Header="Vsync" Style="{StaticResource mitem}" Click="setVsync">
    
                </MenuItem>
                <MenuItem Name="adjust_video" Style="{StaticResource mitem}" Header="Adjust Video" Click="openSettingWindow">
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/sun.png" Width="18" Height="16"/>
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
            <MenuItem Name="config" Style="{StaticResource mainitem}" Header="Config" >
                <MenuItem Name="set_input" Style="{StaticResource mitem}" Header="Set Input" InputGestureText="" IsEnabled="True" Click="openSettingWindow">
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/joypad.png" Width="18" Height="16"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Name="set_paths" Style="{StaticResource mitem}" Header="Set Paths" Click="openSettingWindow">
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/folder.png" Width="18" Height="16"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Name="adjust_audio" Style="{StaticResource mitem}" Header="Adjust Audio" Click="openSettingWindow">
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/audio.png" Width="18" Height="16"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Name="set_speed" Style="{StaticResource mitem}" Header="Speed">
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/speed.png" Width="18" Height="16"/>
                    </MenuItem.Icon>
                </MenuItem>
                <MenuItem Name="show_fps" Style="{StaticResource mitem}" Header="Show FPS" Click="setFps" />
                <MenuItem Name="audio_active" Style="{StaticResource mitem}" Header="Audio active" Click="setAudio" />
               
            </MenuItem>
            <MenuItem Name="help" Style="{StaticResource mainitem}" Header="Help">
                <MenuItem Name="about" Style="{StaticResource mitem}" Header="About" Click="showHelp">
                    <MenuItem.Icon>
                        <Image Source="/TwoMbit;component/Images/about.png" Width="18" Height="16" />
                    </MenuItem.Icon>
                </MenuItem>
            </MenuItem>
        </Menu>
        <Border Name="ControlHostElement"
        HorizontalAlignment="Left"
        VerticalAlignment="Bottom"
        Background="Black"
        BorderBrush="Black"
        BorderThickness="0 0 0 0"
        />
    </Grid>
</Window>
