UltimateZoneBuilder/Source/Core/Controls/RenderTargetControl.cs
MaxED 1424950d8d Things, Sectors, Liedefs mode, UDMF: map element comments are now shown when highlighting them.
Changed, Edit Text window: the form is no longer accepted when pressing the Enter key, so line breaks can now be added easily.
Versioning: GZDB version is now determined by the first 2 revision digits, so now it's GZDB 2.3, not 1.14.
2015-07-14 09:02:48 +00:00

128 lines
3.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.Drawing;
using System.Windows.Forms;
#endregion
namespace CodeImp.DoomBuilder.Controls
{
public class RenderTargetControl : Panel
{
#region ================== Constants
#endregion
#region ================== Variables
private readonly ToolTip tip; //mxd
#endregion
#region ================== Properties
public event KeyEventHandler OnKeyReleased; //mxd. Sometimes it's handeled here, not by MainForm
#endregion
#region ================== Constructor / Disposer
// Constructor
internal RenderTargetControl()
{
// Initialize
this.SetStyle(ControlStyles.FixedWidth, true);
this.SetStyle(ControlStyles.FixedHeight, true);
//mxd. Create tooltip
tip = new ToolTip();
tip.UseAnimation = false;
tip.UseFading = false;
tip.InitialDelay = 0;
tip.AutoPopDelay = 9000;
}
#endregion
#region ================== Overrides
// Paint method
protected override void OnPaint(PaintEventArgs pe)
{
// Pass on to base
// Do we really want this?
base.RaisePaintEvent(this, pe);
}
//mxd
protected override void OnKeyUp(KeyEventArgs e)
{
if(OnKeyReleased != null) OnKeyReleased(this, e);
}
#endregion
#region ================== Methods
// This sets up the control to display the splash logo
public void SetSplashLogoDisplay()
{
// Change display to show splash logo
this.SetStyle(ControlStyles.SupportsTransparentBackColor, false);
this.SetStyle(ControlStyles.ContainerControl, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.Opaque, false);
this.UpdateStyles();
this.BackColor = SystemColors.ControlDarkDark;
this.BackgroundImage = Properties.Resources.Splash3_trans;
this.BackgroundImageLayout = ImageLayout.Center;
}
// This sets up the control for manual rendering
public void SetManualRendering()
{
// Change display for rendering
this.SetStyle(ControlStyles.SupportsTransparentBackColor, false);
this.SetStyle(ControlStyles.ContainerControl, true);
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.Opaque, true);
this.UpdateStyles();
this.BackColor = Color.Black;
this.BackgroundImage = null;
this.BackgroundImageLayout = ImageLayout.None;
}
//mxd. This shows tooltip at given position
public void ShowToolTip(string title, string text, int x, int y)
{
tip.ToolTipTitle = title;
tip.Show(text, this, x, y);
}
//mxd. This hides it
public void HideToolTip()
{
tip.Hide(this);
}
#endregion
}
}