mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-30 17:57:57 +01:00
Fix the Fill computations for layout, by only special casing the Pos.Center scenarios and unrolling the rest
This commit is contained in:
51
Designer/Designer.csproj
Normal file
51
Designer/Designer.csproj
Normal file
@@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||
<ProjectGuid>{1228D992-C801-49BB-839A-7BD28A3FFF0A}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Designer</RootNamespace>
|
||||
<AssemblyName>Designer</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug</OutputPath>
|
||||
<DefineConstants>DEBUG;</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ExternalConsole>true</ExternalConsole>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ExternalConsole>true</ExternalConsole>
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="NStack">
|
||||
<HintPath>..\packages\NStack.Core.0.11.0\lib\netstandard1.5\NStack.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Terminal.Gui\Terminal.Gui.csproj">
|
||||
<Project>{00F366F8-DEE4-482C-B9FD-6DB0200B79E5}</Project>
|
||||
<Name>Terminal.Gui</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
45
Designer/Program.cs
Normal file
45
Designer/Program.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using Terminal.Gui;
|
||||
|
||||
namespace Designer {
|
||||
class Surface : Window {
|
||||
public Surface () : base ("Designer")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
class MainClass {
|
||||
public static void Main (string [] args)
|
||||
{
|
||||
Application.Init ();
|
||||
|
||||
var menu = new MenuBar (new MenuBarItem [] {
|
||||
new MenuBarItem ("_File", new MenuItem [] {
|
||||
new MenuItem ("_Quit", "", () => { Application.RequestStop (); })
|
||||
}),
|
||||
new MenuBarItem ("_Edit", new MenuItem [] {
|
||||
new MenuItem ("_Copy", "", null),
|
||||
new MenuItem ("C_ut", "", null),
|
||||
new MenuItem ("_Paste", "", null)
|
||||
}),
|
||||
});
|
||||
|
||||
var login = new Label ("Login: ") { X = 3, Y = 6 };
|
||||
var password = new Label ("Password: ") {
|
||||
X = Pos.Left (login),
|
||||
Y = Pos.Bottom (login) + 1
|
||||
};
|
||||
|
||||
var surface = new Surface () {
|
||||
X = 0,
|
||||
Y = 1,
|
||||
Width = Dim.Percent (80),
|
||||
Height = Dim.Fill ()
|
||||
};
|
||||
|
||||
//Application.Top.Add (menu);
|
||||
Application.Top.Add (login, password);
|
||||
Application.Run ();
|
||||
}
|
||||
}
|
||||
}
|
||||
26
Designer/Properties/AssemblyInfo.cs
Normal file
26
Designer/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
// Information about this assembly is defined by the following attributes.
|
||||
// Change them to the values specific to your project.
|
||||
|
||||
[assembly: AssemblyTitle ("Designer")]
|
||||
[assembly: AssemblyDescription ("")]
|
||||
[assembly: AssemblyConfiguration ("")]
|
||||
[assembly: AssemblyCompany ("")]
|
||||
[assembly: AssemblyProduct ("")]
|
||||
[assembly: AssemblyCopyright ("${AuthorCopyright}")]
|
||||
[assembly: AssemblyTrademark ("")]
|
||||
[assembly: AssemblyCulture ("")]
|
||||
|
||||
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
|
||||
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
|
||||
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
|
||||
|
||||
[assembly: AssemblyVersion ("1.0.*")]
|
||||
|
||||
// The following attributes are used to specify the signing key for the assembly,
|
||||
// if desired. See the Mono documentation for more information about signing.
|
||||
|
||||
//[assembly: AssemblyDelaySign(false)]
|
||||
//[assembly: AssemblyKeyFile("")]
|
||||
4
Designer/packages.config
Normal file
4
Designer/packages.config
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="NStack.Core" version="0.11.0" targetFramework="net47" />
|
||||
</packages>
|
||||
@@ -217,7 +217,7 @@ static class Demo {
|
||||
X = 0,
|
||||
Y = 1,
|
||||
Width = Dim.Fill (),
|
||||
Height = Dim.Fill () - 1
|
||||
Height = Dim.Fill ()
|
||||
};
|
||||
#else
|
||||
var win = new Window (new Rect (0, 1, tframe.Width, tframe.Height - 1), "Hello");
|
||||
|
||||
@@ -1006,38 +1006,46 @@ namespace Terminal.Gui {
|
||||
|
||||
/// <summary>
|
||||
/// Computes the RelativeLayout for the view, given the frame for its container.
|
||||
|
||||
/// </summary>
|
||||
/// <param name="hostFrame">The Frame for the host.</param>
|
||||
internal void RelativeLayout (Rect hostFrame)
|
||||
{
|
||||
int w, h, _x, _y;
|
||||
if (width == null)
|
||||
w = hostFrame.Width;
|
||||
else
|
||||
w = width.Anchor (hostFrame.Width);
|
||||
|
||||
if (x == null)
|
||||
_x = 0;
|
||||
else {
|
||||
if (x is Pos.PosCenter)
|
||||
_x = x.Anchor (hostFrame.Width - w);
|
||||
if (x is Pos.PosCenter) {
|
||||
if (width == null)
|
||||
w = hostFrame.Width;
|
||||
else
|
||||
w = width.Anchor (hostFrame.Width);
|
||||
_x = x.Anchor (hostFrame.Width - w);
|
||||
} else {
|
||||
if (x == null)
|
||||
_x = 0;
|
||||
else
|
||||
_x = x.Anchor (hostFrame.Width);
|
||||
if (width == null)
|
||||
w = hostFrame.Width;
|
||||
else
|
||||
w = width.Anchor (hostFrame.Width - _x);
|
||||
}
|
||||
if (height == null)
|
||||
h = hostFrame.Height;
|
||||
else
|
||||
h = height.Anchor (hostFrame.Height);
|
||||
|
||||
if (y == null)
|
||||
_y = 0;
|
||||
else {
|
||||
if (y is Pos.PosCenter)
|
||||
_y = y.Anchor (hostFrame.Height - h);
|
||||
if (y is Pos.PosCenter) {
|
||||
if (height == null)
|
||||
h = hostFrame.Height;
|
||||
else
|
||||
h = height.Anchor (hostFrame.Height);
|
||||
_y = y.Anchor (hostFrame.Height - h);
|
||||
} else {
|
||||
if (y == null)
|
||||
_y = 0;
|
||||
else
|
||||
_y = y.Anchor (hostFrame.Height);
|
||||
if (height == null)
|
||||
h = hostFrame.Height;
|
||||
else
|
||||
h = height.Anchor (hostFrame.Height - _y);
|
||||
}
|
||||
|
||||
Frame = new Rect (_x, _y, w, h);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example\Example", "Example\Example.csproj", "{B0A602CD-E176-449D-8663-64238D54F857}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example", "Example\Example.csproj", "{B0A602CD-E176-449D-8663-64238D54F857}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Terminal.Gui", "Terminal.Gui\Terminal.Gui.csproj", "{00F366F8-DEE4-482C-B9FD-6DB0200B79E5}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Designer", "Designer\Designer.csproj", "{1228D992-C801-49BB-839A-7BD28A3FFF0A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x86 = Debug|x86
|
||||
@@ -19,6 +21,10 @@ Global
|
||||
{00F366F8-DEE4-482C-B9FD-6DB0200B79E5}.Debug|x86.Build.0 = Debug|Any CPU
|
||||
{00F366F8-DEE4-482C-B9FD-6DB0200B79E5}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{00F366F8-DEE4-482C-B9FD-6DB0200B79E5}.Release|x86.Build.0 = Release|Any CPU
|
||||
{1228D992-C801-49BB-839A-7BD28A3FFF0A}.Debug|x86.ActiveCfg = Debug|x86
|
||||
{1228D992-C801-49BB-839A-7BD28A3FFF0A}.Debug|x86.Build.0 = Debug|x86
|
||||
{1228D992-C801-49BB-839A-7BD28A3FFF0A}.Release|x86.ActiveCfg = Release|x86
|
||||
{1228D992-C801-49BB-839A-7BD28A3FFF0A}.Release|x86.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(MonoDevelopProperties) = preSolution
|
||||
Policies = $0
|
||||
|
||||
Reference in New Issue
Block a user