PageRenderTime 43ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/Scenes/UserInterfaces/Controls/TODOToolTipPopup.cs

#
C# | 279 lines | 3 code | 32 blank | 244 comment | 0 complexity | ebe0b26b8e82942b51dbe6252aa2a7a8 MD5 | raw file
Possible License(s): Apache-2.0
  1. namespace Delta.Scenes.UserInterfaces.Controls
  2. {
  3. // This class is disabled and probably not needed anymore
  4. ///// <summary>
  5. ///// Tool tip
  6. ///// </summary>
  7. ///// <returns>ISave binary</returns>
  8. //public class ToolTipPopup : ISaveLoadBinary
  9. //{
  10. // #region Public
  11. // #region Text
  12. // /// <summary>
  13. // /// Text
  14. // /// </summary>
  15. // public string Text
  16. // {
  17. // get { return popupControl.Text; } // get
  18. // set { popupControl.Text = value; } // set
  19. // } // Text
  20. // #endregion
  21. // /// <summary>
  22. // /// Defines the minimum wait time (in seconds) before the ToolTip pops up.
  23. // /// </summary>
  24. // public float MinWaitTime { get; set; } // MinWaitTime
  25. // #region RemainingTime (LOOK)
  26. // ///// <summary>
  27. // ///// Life time
  28. // ///// </summary>
  29. // //public float LifeTime { get; set; } // LifeTime
  30. // ///// <summary>
  31. // ///// Remaining time
  32. // ///// </summary>
  33. // //public float RemainingTime { get; set; } // RemainingTime
  34. // #endregion
  35. // #region Fade (LOOK)
  36. // ///// <summary>
  37. // ///// Life time
  38. // ///// </summary>
  39. // //public float FadeOut { get; set; } // LifeTime
  40. // ///// <summary>
  41. // ///// Fade in
  42. // ///// </summary>
  43. // //public float FadeIn { get; set; } // FadeIn
  44. // #endregion
  45. // #endregion
  46. // #region Private
  47. // /// <summary>
  48. // /// Popup control
  49. // /// </summary>
  50. // private Label popupControl;
  51. // /// <summary>
  52. // /// The UI control where this ToolTip belongs to and will be shown.
  53. // /// </summary>
  54. // private BaseControl owner;
  55. // /// <summary>
  56. // /// Represents the time (in seconds) that the mouse is over the owner
  57. // /// control.
  58. // /// </summary>
  59. // private float ownerPointingTime;
  60. // /// <summary>
  61. // /// Is active
  62. // /// </summary>
  63. // private bool isActive;
  64. // #region ShouldBeShown
  65. // /// <summary>
  66. // /// Returns 'true' if the ToolTip should be shown resp. drawn right now
  67. // /// (Just for internal rendering management in "BaseControl")
  68. // /// </summary>
  69. // internal bool ShouldBeShown
  70. // {
  71. // get
  72. // {
  73. // return ownerPointingTime >= MinWaitTime &&
  74. // String.IsNullOrEmpty(popupControl.Text) == false;
  75. // } // get
  76. // } // ShouldBeShown
  77. // #endregion
  78. // #endregion
  79. // #region Constructors
  80. // /// <summary>
  81. // /// Create tool tip control
  82. // /// </summary>
  83. // public ToolTipPopup()
  84. // {
  85. // popupControl = new Label
  86. // {
  87. // AnchorPoint = AnchorType.Middle,
  88. // //// We use here the "Text" layer, because we need a layer which is
  89. // //// rendered above the UI to make sure that a tooltip is always above
  90. // //// the parent control
  91. // //DrawLayer = RenderLayer.Text,
  92. // };
  93. // MinWaitTime = 1.0f; // seconds
  94. // isActive = false;
  95. // } // ToolTipPopup()
  96. // /// <summary>
  97. // /// Create tool tip popup
  98. // /// </summary>
  99. // /// <param name="reader">Reader</param>
  100. // public ToolTipPopup(BinaryReader reader)
  101. // : this()
  102. // {
  103. // Load(reader);
  104. // } // ToolTipPopup(reader)
  105. // #endregion
  106. // #region Methods
  107. // #region Attach (LOOK update positioning)
  108. // /// <summary>
  109. // /// Attaches resp. "registers" the ToolTip to the given UI control.
  110. // /// </summary>
  111. // /// <param name="setOwner">Set owner</param>
  112. // internal void Attach(BaseControl setOwner)
  113. // {
  114. // owner = setOwner;
  115. // //owner.Entered += OnOwnerEntered;
  116. // //owner.CursorMove += OnOwnerCursorMove;
  117. // //owner.Leaved += OnOwnerLeaved;
  118. // } // Attach(setOwner)
  119. // #endregion
  120. // #region Event handling methods
  121. // /// <summary>
  122. // /// On owner entered
  123. // /// </summary>
  124. // /// <param name="sender">Sender</param>
  125. // /// <param name="info">Info</param>
  126. // private void OnOwnerEntered(BaseControl sender, UIEventInfo info)
  127. // {
  128. // ownerPointingTime = 0.0f;
  129. // isActive = true;
  130. // popupControl.LocalPosition = Input.Mouse.Position +
  131. // new Point(0.0f, 0.025f);
  132. // // uneeded: info.IsHandled = true
  133. // // -> we just use that event "silently"
  134. // } // OnOwnerEntered(sender, info)
  135. // /// <summary>
  136. // /// On owner cursor move
  137. // /// </summary>
  138. // /// <param name="sender">Sender</param>
  139. // /// <param name="info">Info</param>
  140. // private void OnOwnerCursorMove(BaseControl sender, UIEventInfo info)
  141. // {
  142. // if (isActive)
  143. // {
  144. // popupControl.LocalPosition = info.AbsoluteEventPosition;
  145. // } // if
  146. // // uneeded: info.IsHandled = true
  147. // // -> we just use that event "silently"
  148. // } // OnOwnerCursorMove(sender, info)
  149. // /// <summary>
  150. // /// On owner leaved
  151. // /// </summary>
  152. // /// <param name="sender">Sender</param>
  153. // /// <param name="info">Info</param>
  154. // private void OnOwnerLeaved(BaseControl sender, UIEventInfo info)
  155. // {
  156. // ownerPointingTime = 0.0f;
  157. // isActive = false;
  158. // // uneeded: info.IsHandled = true
  159. // // -> we just use that event "silently"
  160. // } // OnOwnerLeaved(sender, info)
  161. // #endregion
  162. // #region Update
  163. // /// <summary>
  164. // /// Update
  165. // /// </summary>
  166. // internal void Update()
  167. // {
  168. // if (isActive)
  169. // {
  170. // ownerPointingTime += Time.Delta;
  171. // } // if
  172. // popupControl.Update();
  173. // //if (IsStarted)
  174. // //{
  175. // // float time = Time.Total - startTime;
  176. // // RemainingTime = LifeTime - time;
  177. // // if (RemainingTime > 0)
  178. // // {
  179. // // if (FadeIn - time > 0)
  180. // // {
  181. // // currentAlpha = 1 - ((FadeIn - time) / FadeIn);
  182. // // BlendColor = new Color(BlendColor, currentAlpha);
  183. // // } // if
  184. // // else if (LifeTime - FadeOut < time)
  185. // // {
  186. // // float currentAlpha = 1 - (time - (LifeTime - FadeOut)) /
  187. // // (LifeTime - FadeIn);
  188. // // BlendColor = new Color(BlendColor, currentAlpha);
  189. // // } // else if
  190. // // } // if
  191. // //} // if
  192. // } // Update()
  193. // #endregion
  194. // #region Show
  195. // /// <summary>
  196. // /// Shows the ToolTip.
  197. // /// </summary>
  198. // internal void Show()
  199. // {
  200. // popupControl.Draw();
  201. // } // Show()
  202. // #endregion
  203. // #region Dispose
  204. // /// <summary>
  205. // /// Disposes resp. "unregisters" the ToolTip from owner again.
  206. // /// </summary>
  207. // internal void Dispose()
  208. // {
  209. // // Just ignore that call if this ToolTip control is already disposed
  210. // if (owner == null)
  211. // {
  212. // return;
  213. // } // if
  214. // //owner.Entered -= OnOwnerEntered;
  215. // //owner.CursorMove -= OnOwnerCursorMove;
  216. // //owner.Leaved -= OnOwnerLeaved;
  217. // owner = null;
  218. // } // Dispose()
  219. // #endregion
  220. // #region ISaveLoadBinary Members
  221. // /// <summary>
  222. // /// Is outdated
  223. // /// </summary>
  224. // public bool IsOutdated
  225. // {
  226. // get { throw new NotImplementedException(); } // get
  227. // } // IsOutdated
  228. // /// <summary>
  229. // /// Save
  230. // /// </summary>
  231. // /// <param name="writer">Writer</param>
  232. // public void Save(BinaryWriter writer)
  233. // {
  234. // throw new NotImplementedException();
  235. // } // Save(writer)
  236. // /// <summary>
  237. // /// Load
  238. // /// </summary>
  239. // /// <param name="reader">Reader</param>
  240. // public void Load(BinaryReader reader)
  241. // {
  242. // throw new NotImplementedException();
  243. // } // Load(reader)
  244. // #endregion
  245. // #endregion
  246. //}
  247. }