UltimateZoneBuilder/Source/Windows/AngleForm.cs
2009-01-15 10:54:51 +00:00

109 lines
No EOL
2.3 KiB
C#

#region ================== Copyright (c) 2007 Pascal vd Heiden
/*
* Copyright (c) 2007 Pascal vd Heiden, www.codeimp.com
* This program is released under GNU General Public License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#endregion
#region ================== Namespaces
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Map;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.IO;
using System.IO;
using CodeImp.DoomBuilder.Config;
using CodeImp.DoomBuilder.Editing;
using CodeImp.DoomBuilder.Controls;
#endregion
namespace CodeImp.DoomBuilder.Windows
{
public partial class AngleForm : DelayedForm
{
#region ================== Variables
private bool setup;
private int value;
#endregion
#region ================== Properties
public int Value { get { return value; } }
#endregion
#region ================== Constructor
// Constructor
public AngleForm()
{
InitializeComponent();
}
#endregion
#region ================== Events
// Cancel clicked
private void cancel_Click(object sender, EventArgs e)
{
// Close
DialogResult = DialogResult.Cancel;
this.Close();
}
// OK clicked
private void apply_Click(object sender, EventArgs e)
{
this.value = angle.Value;
// Done
DialogResult = DialogResult.OK;
this.Close();
}
#endregion
#region ================== Methods
// Setup from EnumList
public void Setup(int value)
{
setup = true;
this.value = value;
angle.Value = value;
setup = false;
}
// This shows the dialog
// Returns the flags or the same flags when cancelled
public static int ShowDialog(IWin32Window owner, int value)
{
int result = value;
AngleForm f = new AngleForm();
f.Setup(value);
if(f.ShowDialog(owner) == DialogResult.OK) result = f.Value;
f.Dispose();
return result;
}
#endregion
}
}