Skip to content

Commit

Permalink
add option to move buttons to bottom
Browse files Browse the repository at this point in the history
  • Loading branch information
duchuule committed Sep 27, 2015
1 parent 0d794b0 commit 95ff2c5
Show file tree
Hide file tree
Showing 11 changed files with 478 additions and 247 deletions.
51 changes: 27 additions & 24 deletions DirectXPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,31 +77,34 @@
IsTabStop="False"
Background="Transparent"
>
<SplitView.Pane >
<RelativePanel >
<!-- A custom ListView to display the items in the pane. The automation Name is set in the ContainerContentChanging event. -->
<controls:NavMenuListView x:Name="NavMenuList"
IsTabStop="False"
Margin="0,48,0,0"
VerticalAlignment="Bottom"
ContainerContentChanging="NavMenuItemContainerContentChanging"
ItemContainerStyle="{StaticResource NavMenuItemContainerStyle}"
ItemTemplate="{StaticResource NavMenuItemTemplate}"
ItemInvoked="NavMenuList_ItemInvoked"
>
<!--<controls:NavMenuListView.Header>
-->
<!-- Using this custom back navigation button until the system-provided back button is enabled. -->
<!--
<Button x:Name="BackButton"
TabIndex="2"
Style="{StaticResource NavigationBackButtonStyle}"
IsEnabled="{x:Bind AppFrame.CanGoBack, Mode=OneWay}"
HorizontalAlignment="{Binding ItemsPanelRoot.HorizontalAlignment, ElementName=NavMenuList}"
Click="BackButton_Click"/>
</controls:NavMenuListView.Header>-->
<SplitView.Pane >
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- A custom ListView to display the items in the pane. The automation Name is set in the ContainerContentChanging event. -->
<controls:NavMenuListView x:Name="NavMenuList"
IsTabStop="False"
Margin="0,48,0,0"
VerticalAlignment="Top"
ContainerContentChanging="NavMenuItemContainerContentChanging"
ItemContainerStyle="{StaticResource NavMenuItemContainerStyle}"
ItemTemplate="{StaticResource NavMenuItemTemplate}"
ItemInvoked="NavMenuList_ItemInvoked"
>
<!--<controls:NavMenuListView.Header>
-->
<!-- Using this custom back navigation button until the system-provided back button is enabled. -->
<!--
<Button x:Name="BackButton"
TabIndex="2"
Style="{StaticResource NavigationBackButtonStyle}"
IsEnabled="{x:Bind AppFrame.CanGoBack, Mode=OneWay}"
HorizontalAlignment="{Binding ItemsPanelRoot.HorizontalAlignment, ElementName=NavMenuList}"
Click="BackButton_Click"/>
</controls:NavMenuListView.Header>-->
</controls:NavMenuListView>
</RelativePanel>
</Grid>

</SplitView.Pane>

Expand Down
26 changes: 26 additions & 0 deletions DirectXPage.xaml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ DirectXPage::DirectXPage():
TypeName(HelpPage::typeid)));

NavMenuList->ItemsSource = navlist;

//set command position
this->ChangeCommandPosition();


//load settings
auto settings = ApplicationData::Current->LocalSettings->Values;

Expand Down Expand Up @@ -237,6 +242,27 @@ DirectXPage::DirectXPage():
}



void DirectXPage::ChangeCommandPosition()
{

//move position of hamburger button to bottom if settings say so
if ((EmulatorSettings::Current->CommandButtonPosition == 0 && Windows::Foundation::Metadata::ApiInformation::IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
|| EmulatorSettings::Current->CommandButtonPosition == 2)
{
TogglePaneButton->VerticalAlignment = Windows::UI::Xaml::VerticalAlignment::Bottom;
NavMenuList->Margin = Windows::UI::Xaml::Thickness(0, 0, 0, 48);
NavMenuList->VerticalAlignment = Windows::UI::Xaml::VerticalAlignment::Bottom;
}
else
{
TogglePaneButton->VerticalAlignment = Windows::UI::Xaml::VerticalAlignment::Top;
NavMenuList->Margin = Windows::UI::Xaml::Thickness(0, 48, 0, 0);
NavMenuList->VerticalAlignment = Windows::UI::Xaml::VerticalAlignment::Top;
}

}

void DirectXPage::OnNavigatedTo(Windows::UI::Xaml::Navigation::NavigationEventArgs^ e)
{
}
Expand Down
1 change: 1 addition & 0 deletions DirectXPage.xaml.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ namespace VBA10
void Reset();
void SelectSaveState(int slot);
void EditButtonLayout();
void ChangeCommandPosition();


//from AppShell
Expand Down
2 changes: 1 addition & 1 deletion EmulatorSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ using namespace Windows::Foundation;
#define DEFAULT_DPAD_STYLE 1
#define DEFAULT_DEADZONE_VALUE 10.0f
#define DEFAULT_MONITOR_TYPE MONITOR_60HZ
#define DEFAULT_SAVE_CONFIRM false
#define DEFAULT_SAVE_CONFIRM true
#define DEFAULT_LOAD_CONFIRM false
#define DEFAULT_LINEAR_FILTER true

Expand Down
14 changes: 14 additions & 0 deletions EmulatorSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,18 @@ namespace VBA10
}
}

property int CommandButtonPosition
{
int get()
{
return GetValueOrDefault<int>(CommandButtonPositionKey, CommandButtonPositionDefault);
}
void set(int value)
{
AddOrUpdateValue(CommandButtonPositionKey, value);
}
}

#pragma region Button positions

property double PadLeftP
Expand Down Expand Up @@ -660,6 +672,7 @@ namespace VBA10
Platform::String^ TurboBehaviorKey = "TurboBehaviorKey";
Platform::String^ PixelFilterKey = "PixelFilterKey";
Platform::String^ PixelShaderKey = "PixelShaderKey";
Platform::String^ CommandButtonPositionKey = "CommandButtonPositionKey";

#pragma region button positions
Platform::String^ PadLeftPKey = "PadLeftPKey";
Expand Down Expand Up @@ -717,6 +730,7 @@ namespace VBA10
const int TurboBehaviorDefault = 0;
const int PixelFilterDefault = 0; //0: none
const int PixelShaderDefault = 1; //0: nearest neighbor, 1: bilinear
const int CommandButtonPositionDefault = 0; //auto


#pragma region button positions (in cm based on 6x10cm phone)
Expand Down
Loading

0 comments on commit 95ff2c5

Please sign in to comment.