/// <summary> /// Draws the TextSprite to the CurrentRenderTarget /// </summary> /// #endregion Constructors #region Methods public void Draw(IRenderTarget target, RenderStates states) { if (Shadowed) { var oldPos = SFMLTextSprite.Position; var oldColor = SFMLTextSprite.FillColor; SFMLTextSprite.Position += ShadowOffset.Convert(); SFMLTextSprite.FillColor = ShadowColor.Convert(); SFMLTextSprite.Draw(target.SFMLTarget, states.SFMLRenderStates); SFMLTextSprite.Position = oldPos; SFMLTextSprite.FillColor = oldColor; } SFMLTextSprite.Draw(target.SFMLTarget, states.SFMLRenderStates); if (CluwneLib.Debug.DebugTextboxes) { var fr = SFMLTextSprite.GetGlobalBounds().Convert(); CluwneLib.drawHollowRectangle((int)fr.Left, (int)fr.Top, (int)fr.Width, (int)fr.Height, 1.0f, Color.Red); } }
protected override void OnPreRender(EventArgs e) { StringBuilder startupScript = new StringBuilder(2048); string DhId = DragHandleID; if (string.IsNullOrEmpty(DragHandleID)) { DragHandleID = ClientID; } Control Ctl = FindControl(DragHandleID); if (Ctl != null) { DhId = Ctl.ClientID; } startupScript.AppendLine("\t$('#" + ClientID + "')"); if (Closable && !string.IsNullOrEmpty(DragHandleID)) { string imageUrl = CloseBoxImage; if (imageUrl == "WebResource") { imageUrl = ScriptProxy.GetWebResourceUrl(this, GetType(), WebResources.CLOSE_ICON_RESOURCE); } StringBuilder closableOptions = new StringBuilder("imageUrl: '" + imageUrl + "'"); if (!string.IsNullOrEmpty(DragHandleID)) { closableOptions.Append(",handle: $('#" + DragHandleID + "')"); } if (!string.IsNullOrEmpty(ClientDialogHandler)) { closableOptions.Append(",handler: " + ClientDialogHandler); } if (FadeOnClose) { closableOptions.Append(",fadeOut: 'slow'"); } startupScript.AppendLine("\t\t.closable({ " + closableOptions + "})"); } string options = ""; if (Draggable) { // force auto stacking of windows (last dragged to top of zIndex) options = "{ stack: \"*\", opacity: 0.80, dragDelay: " + DragDelay.ToString(); if (!string.IsNullOrEmpty(DragHandleID)) { options += ",handle:'#" + DragHandleID + "'"; } if (!string.IsNullOrEmpty(Cursor)) { options += ",cursor:'" + Cursor + "'"; } options += " }"; startupScript.AppendLine("\t\t.draggable(" + options + " )"); } if (ShadowOffset != 0) { startupScript.AppendLine( "\t\t.shadow({ opacity:" + ShadowOpacity.ToString(CultureInfo.InvariantCulture.NumberFormat) + ",offset:" + ShadowOffset.ToString() + "})"); } if (Centered) { startupScript.AppendLine( "\t\t.centerInClient()"); } startupScript.Length = startupScript.Length - 2; // strip last CR/LF \r\n startupScript.AppendLine(";"); string script = "$( function() {\r\n" + startupScript + "});"; ScriptProxy.RegisterStartupScript(this, GetType(), ID + "_DragBehavior", script, true); base.OnPreRender(e); }