2009-04-19 18:07:22 +00:00
|
|
|
|
|
|
|
#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
|
|
|
|
{
|
2009-08-21 14:11:18 +00:00
|
|
|
public class RenderTargetControl : Panel
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
#region ================== Constants
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Variables
|
|
|
|
|
2015-07-14 09:02:48 +00:00
|
|
|
private readonly ToolTip tip; //mxd
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Properties
|
2013-03-18 13:52:27 +00:00
|
|
|
public event KeyEventHandler OnKeyReleased; //mxd. Sometimes it's handeled here, not by MainForm
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Constructor / Disposer
|
|
|
|
|
|
|
|
// Constructor
|
2009-08-21 14:11:18 +00:00
|
|
|
internal RenderTargetControl()
|
2009-04-19 18:07:22 +00:00
|
|
|
{
|
|
|
|
// Initialize
|
|
|
|
this.SetStyle(ControlStyles.FixedWidth, true);
|
|
|
|
this.SetStyle(ControlStyles.FixedHeight, true);
|
2015-07-14 09:02:48 +00:00
|
|
|
|
|
|
|
//mxd. Create tooltip
|
|
|
|
tip = new ToolTip();
|
|
|
|
tip.UseAnimation = false;
|
|
|
|
tip.UseFading = false;
|
|
|
|
tip.InitialDelay = 0;
|
|
|
|
tip.AutoPopDelay = 9000;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region ================== Overrides
|
|
|
|
|
|
|
|
// Paint method
|
|
|
|
protected override void OnPaint(PaintEventArgs pe)
|
|
|
|
{
|
|
|
|
// Pass on to base
|
|
|
|
// Do we really want this?
|
|
|
|
base.RaisePaintEvent(this, pe);
|
|
|
|
}
|
2013-03-18 13:52:27 +00:00
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
//mxd
|
2014-12-03 23:15:26 +00:00
|
|
|
protected override void OnKeyUp(KeyEventArgs e)
|
|
|
|
{
|
2013-09-11 09:47:53 +00:00
|
|
|
if(OnKeyReleased != null) OnKeyReleased(this, e);
|
|
|
|
}
|
2011-07-26 18:16:52 +00:00
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#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();
|
2015-03-05 23:19:10 +00:00
|
|
|
this.BackColor = SystemColors.ControlDarkDark;
|
2014-02-21 14:42:12 +00:00
|
|
|
this.BackgroundImage = Properties.Resources.Splash3_trans;
|
|
|
|
this.BackgroundImageLayout = ImageLayout.Center;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// 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;
|
2014-02-21 14:42:12 +00:00
|
|
|
this.BackgroundImageLayout = ImageLayout.None;
|
2009-04-19 18:07:22 +00:00
|
|
|
}
|
|
|
|
|
2015-07-14 09:02:48 +00:00
|
|
|
//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);
|
|
|
|
}
|
|
|
|
|
2009-04-19 18:07:22 +00:00
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|