Exemple #1
0
        protected override void OnPreRender(System.EventArgs e)
        {
            CurrentStyle.CreateStyle();
            RegisterHiddenFields();

            string parameters = "";

            parameters += "\"" + this.ClientID + "\"";
            parameters += ", " + Movable.ToString().ToLower();
            parameters += ", " + Resizable.ToString().ToLower();
            parameters += ", " + CurrentStyle.BorderSize.Value.ToString();
            parameters += ", " + CurrentStyle.TitleBarSize.Value.ToString();
            if (Closable && AutoPostBack)
            {
                parameters += ", \"" + Page.ClientScript.GetPostBackEventReference(this, null) + "\"";
            }
            else
            {
                parameters += ", null";
            }


            string script = "\r\n" + "Window_" + this.ClientID + " = new WindowControl(" + parameters + ");" + "\r\n";

            ScriptManager.RegisterStartupScript(Page, script);

            base.OnPreRender(e);

            Style.Remove("display");
        }
        public void ResizableExercise2()
        {
            //Resize to maximum and checks
            _page = new Resizable(Driver);

            var resizableWindowBefore = _page.resizableWindow.GetAttribute("style").Contains("width: 200px");

            Builder
            .ClickAndHold(_page.resizableArrow)
            .MoveByOffset(-50, -50)
            .Perform();

            var resizableWindowAfter = _page.resizableWindow.GetAttribute("style").Contains("width: 150px");

            _page.AssertResizable(resizableWindowBefore, resizableWindowAfter);
        }
		void OnResize(Resizable item)
		{
			var size = (item.transform as RectTransform).rect.size;
			Tiles.ForEachComponent(x => {
				if (x.gameObject==item.gameObject)
				{
					return ;
				}
				var rect = x.transform as RectTransform;

				rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, size.x);
				rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, size.y);
			});

			Tiles.Resize();
		}
Exemple #4
0
        void OnResize(Resizable item)
        {
            var size = (item.transform as RectTransform).rect.size;

            Tiles.ForEachComponent(x => {
                if (x.gameObject == item.gameObject)
                {
                    return;
                }
                var rect = x.transform as RectTransform;

                rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, size.x);
                rect.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, size.y);
            });

            Tiles.Resize();
        }
        protected override void ProcessRecord()
        {
            var ctl = new PsGridColumn();

            SetControlProps(ctl);

            ctl.OnClick = OnClick;
            ctl.Name = Name;
            ctl.Icon = Icon;
            ctl.FieldName = FieldName;
            ctl.Sortable = Sortable;
            ctl.SortField = SortField;
            ctl.Sorted = Sorted;

            if (MinWidth.HasValue)
            {
                ctl.MinWidth = MinWidth.Value;
            }

            if (MaxWidth.HasValue)
            {
                ctl.MaxWidth = MaxWidth.Value;
            }

            if (IconOnly.IsPresent)
            {
                ctl.IconOnly = IconOnly.ToBool();
            }

            if (Resizable.IsPresent)
            {
                ctl.Resizable = Resizable.ToBool();
            }

            if (TemplateControls != null)
            {
                foreach (var control in TemplateControls)
                {
                    ctl.TemplateControls.Add(control);
                }
            }

            WriteObject(ctl);
        }
 public void AddObject(Resizable type, Vector2 position)
 {
     switch (type)
     {
         case Resizable.Nothing:
             break;
         case Resizable.BarrelS:
             RZObjects.Add(new Object(_barrelTexture, position, Size.Small));
             break;
         case Resizable.BarrelM:
             RZObjects.Add(new Object(_barrelTexture, position, Size.Medium));
             break;
         case Resizable.BarrelL:
             RZObjects.Add(new Object(_barrelTexture, position, Size.Large));
             break;
         default:
             break;
     }
 }
Exemple #7
0
        protected override void CommitProperties()
        {
            base.CommitProperties();

            if (_resizableChanged)
            {
                _resizableChanged = false;
                if (_resizable)
                {
                    if (null == _resizablePlugin)
                    {
                        _resizablePlugin = new Resizable {
                            ShowOverlay = false
                        };
                        Plugins.Add(_resizablePlugin);
                        if (Initialized)
                        {
                            _resizablePlugin.Initialize(this);
                        }
                    }
                    _resizablePlugin.Enabled = true;
                }
                else
                {
                    if (null != _resizablePlugin)
                    {
                        _resizablePlugin.Enabled = _draggable;
                    }
                }

                //if (null == _resizeHandle) // instantiate
                //{
                //    _resizeHandle = new Button { Width = 10, Height = 10, IncludeInLayout = false};
                //    _resizeHandle.X = Width - _resizeHandle.Width;
                //    _resizeHandle.Y = Height - _resizeHandle.Height;
                //    AddChild(_resizeHandle);
                //    _resizeHandle.ValidateNow();
                //}

                //_resizeHandle.Visible = _resizable;
            }
        }
Exemple #8
0
        /// <summary>
        /// Get the popop in JS (Controller eg: return JavaScript(popup.GetPopupJs()); )
        /// (Use HtmlHelper instead to use from View)
        /// </summary>
        public string GetPopupJs()
        {
            string result =
                //The Jquery Popup
                "$(\"" + getPopupHtml() + "\").dialog({" +
                "title: '" + Title + "'," +
                "width: " + (Width == null ? "'auto'" : Width.ToString()) + "," +
                "height: " + (Height == null ? "'auto'" : Height.ToString()) + "," +
                "maxWidth: " + MaxWidth + "," +
                "maxHeight: " + MaxHeight + "," +
                "autoOpen: " + AutoOpen.ToString().ToLower() + "," +
                "resizable: " + Resizable.ToString().ToLower() + "," +
                "modal: " + Modal.ToString().ToLower() + "," +
                "buttons: {" +
                getPopupButtons() +
                "}," +
                "create: function(event,ui){" +
                (Width == null ? "$(this).css('max-width','" + MaxWidth + "px');" : "") +     //Fix maxWidth problem when width = auto
                "}" +
                "});";

            return(result);
        }
Exemple #9
0
 public void SetUp()
 {
     Initialize();
     _rezizablePage = new Resizable(Driver);
     _rezizablePage.NavigateTo();
 }
Exemple #10
0
        protected override void WriteXmlAttributes(XmlWriter writer)
        {
            XmlUtils.WriteRequiredAttributeString(writer, "id", _id);              //NON-NLS-1
            XmlUtils.TryWriteAttributeString(writer, "descriprion", _description); //NON-NLS-1
            XmlUtils.TryWriteAttributeString(writer, "type", _type);               //NON-NLS-1

            if (!string.IsNullOrEmpty(Text))
            {
                XmlUtils.WriteRequiredAttributeString(writer, "text", Text);
            }
            if (!string.IsNullOrEmpty(Format))
            {
                XmlUtils.WriteRequiredAttributeString(writer, "format", Format);
            }
            if (!string.IsNullOrEmpty(Alignment))
            {
                XmlUtils.WriteRequiredAttributeString(writer, "alignment", Alignment);
            }
            if (0 > Width)
            {
                XmlUtils.WriteRequiredAttributeString(writer, "width", Width.ToString());
            }
            if (0 > ContentWidth)
            {
                XmlUtils.WriteRequiredAttributeString(writer, "contentWidth", ContentWidth.ToString());
            }
            if (!string.IsNullOrEmpty(Image))
            {
                XmlUtils.WriteRequiredAttributeString(writer, "image", Image);
            }
            if (!ImageOnRight)
            {
                XmlUtils.WriteRequiredAttributeString(writer, "imageOnRight", ImageOnRight.ToString());
            }
            if (!Visible)
            {
                XmlUtils.WriteRequiredAttributeString(writer, "visible", Visible.ToString());
            }
            if (!Sortable)
            {
                XmlUtils.WriteRequiredAttributeString(writer, "sortable", Sortable.ToString());
            }
            if (!Resizable)
            {
                XmlUtils.WriteRequiredAttributeString(writer, "resizable", Resizable.ToString());
            }
            //if (!string.IsNullOrEmpty(DefaultComparerType))
            //    XmlUtils.WriteRequiredAttributeString(writer, "DefaultComparerType", DefaultComparerType);
            //if (!string.IsNullOrEmpty(SortOrder))
            //    XmlUtils.WriteRequiredAttributeString(writer, "SortOrder", SortOrder);
            if (!Editable)
            {
                XmlUtils.WriteRequiredAttributeString(writer, "editable", Editable.ToString());
            }
            if (!Enabled)
            {
                XmlUtils.WriteRequiredAttributeString(writer, "enabled", Enabled.ToString());
            }
            if (!Selectable)
            {
                XmlUtils.WriteRequiredAttributeString(writer, "selectable", Selectable.ToString());
            }
            if (!string.IsNullOrEmpty(ToolTipText))
            {
                XmlUtils.WriteRequiredAttributeString(writer, "toolTipText", ToolTipText);
            }

            base.WriteXmlAttributes(writer);
        }
 public void SetUp()
 {
     Resizable = new Resizable(driver);
     HomePage.OpenSection("Resizable");
 }
Exemple #12
0
        public override string ToString()
        {
            StringBuilder strRet = new StringBuilder();

            strRet.Append("{");
            //ZOrder int
            if (ZOrder != null)
            {
                strRet.AppendFormat("order:{0}", ZOrder.ToString());
            }
            //Heading string
            if (Name != string.Empty)
            {
                strRet.AppendFormat(", name:'{0}'", Name);
                //strRet.AppendFormat(", index:'{0}'", ZOrder.ToString());
                strRet.AppendFormat(", index:'{0}'", DataMappingName);
            }
            //DataType
            if (DataType != string.Empty)
            {
                strRet.AppendFormat(", sorttype:'{0}'", DataType);
            }
            //DataAlign
            if (DataAlign != string.Empty)
            {
                strRet.AppendFormat(", align:'{0}'", DataAlign);
            }
            //width
            if (Width != null)
            {
                strRet.AppendFormat(", width:{0}", Width.ToString());
            }
            //IsSortable
            if (Sortable != null)
            {
                strRet.AppendFormat(", sortable:{0}", (bool)Sortable ? "true" : "false");
            }
            //IsEditable
            if (IsEditable != null)
            {
                strRet.AppendFormat(", editable:{0}", (bool)IsEditable ? "true" : "false");
            }
            //EditOptions
            if (EditOptions != string.Empty)
            {
                strRet.AppendFormat(", editoptions:{0}", EditOptions);
            }
            //FreezeIndex int
            if (Index != string.Empty)
            {
                strRet.AppendFormat(", index:'{0}'", Index);
            }
            //FreezeIndex int
            if (IsHidden != null)
            {
                strRet.AppendFormat(", hidden:{0}", IsHidden.ToString().ToLower());
            }
            if (Format != string.Empty)
            {
                strRet.AppendFormat(", formatter: {0}", Format);
                strRet.AppendFormat(", sformatter: '{0}'", Format);
            }
            if (Resizable != null)
            {
                strRet.AppendFormat(", resizable:{0}", Resizable.ToString().ToLower());
            }
            if (Classes != string.Empty)
            {
                strRet.AppendFormat(", classes: '{0}'", Classes);
            }
            if (IsDynamic != null)
            {
                strRet.AppendFormat(", isdynamic:{0}", (bool)IsDynamic ? "true" : "false");
            }
            if (Frozen != null)
            {
                strRet.AppendFormat(", frozen:{0}", (bool)Frozen ? "true" : "false");
            }
            if (SummaryType != string.Empty)
            {
                if (SummaryType.Contains("fn:"))
                {
                    strRet.AppendFormat(", summaryType: {0}", SummaryType.Replace("fn:", ""));
                }
                else
                {
                    strRet.AppendFormat(", summaryType: '{0}'", SummaryType);
                }
            }
            if (SummaryTemplate != string.Empty)
            {
                strRet.AppendFormat(", summaryTpl: '{0}'", SummaryTemplate);
            }
            if (ConditionStyleName != string.Empty)
            {
                strRet.AppendFormat(", ConditionStyleName: '{0}'", ConditionStyleName);
            }
            if (FontItalic != null)
            {
                strRet.AppendFormat(", FontItalic:{0}", (bool)FontItalic ? "true" : "false");
            }
            if (FontBold != null)
            {
                strRet.AppendFormat(", FontBold:{0}", (bool)FontBold ? "true" : "false");
            }
            if (FontColor != string.Empty)
            {
                strRet.AppendFormat(", FontColor: '{0}'", FontColor);
            }
            if (BackColor != string.Empty)
            {
                strRet.AppendFormat(", BackColor: '{0}'", BackColor);
            }
            if (iCSS != string.Empty)
            {
                strRet.AppendFormat(", iCSS: '{0}'", iCSS);
            }


            if (AdditionAttribute != string.Empty && AdditionAttribute != null)
            {
                string[] arr = AdditionAttribute.Split(',');
                if (arr.Length > 0)
                {
                    for (int i = 0; i < arr.Length; i++)
                    {
                        strRet.AppendFormat(", {0}: {1}", arr[i].Split(':')[0], arr[i].Split(':')[1]);
                    }
                }
            }
            strRet.Append("}");
            return(strRet.ToString());
        }
Exemple #13
0
        public override string ToString()
        {
            Sort();

            StringBuilder sb = new StringBuilder();

            sb.AppendLine("using System;");
            sb.AppendLine("using Server;");
            sb.AppendLine("using Server.Items;");
            sb.AppendLine("using Server.Network;");
            sb.AppendLine("using Server.Commands;\n");

            sb.AppendLine("namespace Server.Gumps");
            sb.AppendLine("{");
            sb.AppendFormat("\tpublic class {0}Gump : Gump\n", Name);
            sb.AppendLine("\t{");

            sb.AppendFormat("\t\tpublic {0}Gump() : base({1}, {2})\n", Name, X, Y);
            sb.AppendLine("\t\t{");
            sb.AppendFormat("\t\t\tClosable = {0};\n", Closable.ToString().ToLower());
            sb.AppendFormat("\t\t\tDragable = {0};\n", Dragable.ToString().ToLower());
            sb.AppendFormat("\t\t\tResizable = {0};\n", Resizable.ToString().ToLower());

            for (int i = Items.Count - 1; i >= 0; i--)            // Items.Count; i++)
            {
                sb.AppendLine("\t" + Items[i].ToString());
            }

            sb.AppendLine("\t\t}\n");

            List <BaseGump> enumTypes = new List <BaseGump>();

            enumTypes.AddRange(FindGumpsByType <ButtonGump>());
            enumTypes.AddRange(FindGumpsByType <CheckboxGump>());
            enumTypes.AddRange(FindGumpsByType <RadioGump>());
            enumTypes.AddRange(FindGumpsByType <TextEntryGump>());

            if (enumTypes.Count > 0)
            {
                sb.AppendLine("\t\tpublic enum ButtonTypes");
                sb.AppendLine("\t\t{");
                for (int i = 0; i < enumTypes.Count; i++)
                {
                    int value = -1;

                    if (enumTypes[i].GetType() == typeof(ButtonGump))
                    {
                        value = ((ButtonGump)enumTypes[i]).Value;
                    }
                    if (enumTypes[i].GetType() == typeof(CheckboxGump))
                    {
                        value = ((CheckboxGump)enumTypes[i]).Value;
                    }
                    if (enumTypes[i].GetType() == typeof(RadioGump))
                    {
                        value = ((RadioGump)enumTypes[i]).Value;
                    }
                    if (enumTypes[i].GetType() == typeof(TextEntryGump))
                    {
                        value = ((TextEntryGump)enumTypes[i]).EntryId;
                    }

                    sb.AppendFormat("\t\t\t{0} = {1}{2}\n",
                                    string.IsNullOrEmpty(enumTypes[i].Name) ? enumTypes[i].GetType().ToString() + i.ToString() : enumTypes[i].Name,
                                    value, (i + 1 == Items.Count) ? "" : ",");
                }

                sb.AppendLine("\t\t}\n");
            }

            sb.AppendLine("\t\tpublic override void OnResponse( NetState sender, RelayInfo info )");
            sb.AppendLine("\t\t{");
            sb.AppendLine("\t\t\tMobile from = sender.Mobile;");
            sb.AppendLine("\t\t}");
            sb.AppendLine("\t}");
            sb.AppendLine("}");

            return(sb.ToString());
        }