Esempio n. 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");
        }
        private static float DoTrailing(Rect rect)
        {
            if (!IsRepaintEvent || !Preferences.Trailing || !IsGameObject)
            {
                return(rect.xMax);
            }

            using (ProfilerSample.Get()) {
                var size       = CurrentStyle.CalcSize(Utility.GetTempGUIContent(GameObjectName));
                var iconsWidth = RightIconsWidth + LeftIconsWidth + CalcMiniLabelSize() + Preferences.RightMargin;

                if (size.x < rect.width - iconsWidth + 15f)
                {
                    return(rect.xMax);
                }

                rect.xMin = rect.xMax - iconsWidth - 18f;

                if (Selection.gameObjects.Contains(CurrentGameObject))
                {
                    EditorGUI.DrawRect(rect, ReflectionHelper.HierarchyFocused ? Styles.selectedFocusedColor : Styles.selectedUnfocusedColor);
                }
                else
                {
                    EditorGUI.DrawRect(rect, Styles.normalColor);
                }

                rect.x    -= 16f;
                rect.yMax -= 3f;

                EditorGUI.LabelField(rect, trailingContent, CurrentStyle);

                return(rect.xMin + 28f);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Renders the item for visual designers.
        /// </summary>
        /// <param name="htmlWriter">The HtmlTextWriter object that receives the content.</param>
        protected override void RenderDesignerPath(HtmlTextWriter htmlWriter)
        {
            HtmlInlineWriter writer = new HtmlInlineWriter(htmlWriter);

            if (Orientation == Orientation.Vertical)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            }

            CurrentStyle.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, null);

            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            DesignerContent(writer);

            writer.RenderEndTag();

            writer.AllowNewLine = true;
            writer.WriteLine();

            if (Orientation == Orientation.Vertical)
            {
                writer.RenderEndTag();
            }
        }
Esempio n. 4
0
        private void Initialize()
        {
            double width  = 0;
            double height = 0;

            if (CurrentStyle.ContainsKey("height"))
            {
                var pixelHeight = CurrentStyle["height"];

                if (pixelHeight.EndsWith("px"))
                {
                    height = Convert.ToDouble(pixelHeight.TrimEnd("px".ToCharArray()));
                }
            }

            if (CurrentStyle.ContainsKey("width"))
            {
                var pixelWidth = CurrentStyle["width"];

                if (pixelWidth.EndsWith("px"))
                {
                    width = Convert.ToDouble(pixelWidth.TrimEnd("px".ToCharArray()));
                }
            }

            if (width > 0 && height > 0)
            {
                widthAndHeightAreSet = true;

                Width  = width;
                Height = height;
            }
        }
Esempio n. 5
0
 protected override void Render()
 {
     Rendering.DrawText(new Rectangle(
                            ContentPosition.x,
                            ContentPosition.y,
                            InnerWidth, CurrentStyle.Get <float>(Styles.FontSize)), Text, CurrentStyle);
 }
Esempio n. 6
0
        public ITableBuilder SetCurrentStyle()
        {
            var cell = target.GetCell(navigator.CurrentState.Cursor) ?? target.InsertCell(navigator.CurrentState.Cursor);

            CurrentStyle.ApplyTo(cell);
            return(this);
        }
Esempio n. 7
0
 protected override void Render()
 {
     if (!_initialized)
     {
         if (_toggleSize > 0)
         {
             CurrentStyle.FontSize(_toggleSize);
             _toggleSize = -1;
         }
         _filled.Width = _filled.Height = Utils.CalcSize("a", CurrentStyle).y;
         _initialized  = true;
     }
     base.Render();
 }
Esempio n. 8
0
        // on document starting show tag input form to the user and initialize document tags
        private void _printDoc_DocumentStarting(object sender, EventArgs e)
        {
            DateTime     start        = _schedule.VisibleDates[0].Date;
            DateTime     end          = _schedule.VisibleDates[_schedule.VisibleDates.Count - 1].Date;
            CalendarInfo calendarInfo = _schedule.CalendarHelper.Info;

            // Show tag input form to end-user.
            // This is a default form shown by the C1PrintDocument control.
            // You can create your own form for this purpose, show it, and set C1PrintDocumentTags
            // according to the user's input.
            PrintDocument.EditTags();

            CurrentStyle.SetupTags(PrintDocument, _schedule.DataStorage.AppointmentStorage.Appointments,
                                   _currentAppointments, start, end, HidePrivateAppointments, calendarInfo);
        }
Esempio n. 9
0
        void DrawNullableRow(string propertyName, Func <bool, object> draw)
        {
            var exists = CurrentStyle.HasValue(propertyName);

            GUILayout.BeginHorizontal();
            var enabled = Toggle(exists);

            GUI.enabled = enabled;

            var result = draw(enabled);

            CurrentStyle.SetStyleValue(propertyName, enabled ? result : null);

            GUILayout.EndHorizontal();
            GUI.enabled = true;
        }
Esempio n. 10
0
        /// <summary>
        /// Renders the item for visual designers.
        /// </summary>
        /// <param name="writer">The HtmlTextWriter object that receives the content.</param>
        protected override void RenderDesignerPath(HtmlTextWriter writer)
        {
            CurrentStyle.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, null);
            if (Orientation == Orientation.Vertical)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            }
            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            DesignerContent(writer);

            writer.RenderEndTag();  // TD
            if (Orientation == Orientation.Vertical)
            {
                writer.RenderEndTag();
            }
            writer.WriteLine();
        }
Esempio n. 11
0
        protected override void Render()
        {
            base.Render();

            if (!Box.Contains(Utils.MousePosition()))
            {
                _currentHoveredLabel = null;
            }

            if (_currentHoveredLabel != null || _currentDraggingLabel != null)
            {
                var l = _currentHoveredLabel;
                if (l == null)
                {
                    l = _currentDraggingLabel;
                }
                var rect = new Rectangle(l.Box.x, l.Box.y + l.Box.height * 0.9f, l.Box.width, l.Box.height * 0.1f);
                Rendering.DrawRect(rect, CurrentStyle.FontColor());
            }
        }
Esempio n. 12
0
        private void Initialize()
        {
            double width  = 0;
            double height = 0;

            if (CurrentStyle.ContainsKey("height"))
            {
                var pixelHeight = CurrentStyle["height"];

                if (pixelHeight.EndsWith("px"))
                {
                    height = Convert.ToDouble(pixelHeight.TrimEnd("px".ToCharArray()));
                }
            }

            if (CurrentStyle.ContainsKey("width"))
            {
                var pixelWidth = CurrentStyle["width"];

                if (pixelWidth.EndsWith("px"))
                {
                    width = Convert.ToDouble(pixelWidth.TrimEnd("px".ToCharArray()));
                }
            }

            if (width > 0 && height > 0)
            {
                widthAndHeightAreSet = true;

                Width  = width;
                Height = height;

                CategoryScale.Output = new ScaleRange {
                    Start = MarginLeft, End = Width.Value - MarginRight
                };
                ValueScale.Output = new ScaleRange {
                    Start = Height.Value - MarginBottom, End = MarginTop
                };
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Renders the item for downlevel browsers.
        /// </summary>
        /// <param name="writer">The HtmlTextWriter object that receives the content.</param>
        protected override void RenderDownLevelPath(HtmlTextWriter writer)
        {
            if (Orientation == Orientation.Vertical)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            }

            HtmlInlineWriter inlineWriter = (writer is HtmlInlineWriter) ? (HtmlInlineWriter)writer : new HtmlInlineWriter(writer);
            CurrentStyle.AddAttributesToRender(inlineWriter);
            inlineWriter.AddAttribute(HtmlTextWriterAttribute.Nowrap, null);
            inlineWriter.RenderBeginTag(HtmlTextWriterTag.Td);

            DownLevelContent(inlineWriter);

            inlineWriter.RenderEndTag();

            if (Orientation == Orientation.Vertical)
            {
                writer.RenderEndTag();
            }
            // If the inline writer was passed in, then the WriteLine won't happen
            writer.WriteLine();
        }
        private void BtnGenerate_Click(object sender, RoutedEventArgs e)
        {
            EInclude include = EInclude.Empty;

            if (chkInclID.IsChecked == true)
            {
                include |= EInclude.ID;
            }
            if (chkInclGUID.IsChecked == true)
            {
                include |= EInclude.GUID;
            }
            if (chkInclName.IsChecked == true)
            {
                include |= EInclude.Name;
            }
            if (chkInclType.IsChecked == true)
            {
                include |= EInclude.Type;
            }

            txtOutput.Text = CurrentStyle.Create(OrderedRecords, include);
        }
Esempio n. 15
0
        /// <summary>
        /// Renders the item for downlevel browsers.
        /// </summary>
        /// <param name="htmlWriter">The HtmlTextWriter object that receives the content.</param>
        protected override void RenderDownLevelPath(HtmlTextWriter htmlWriter)
        {
            HtmlInlineWriter writer = new HtmlInlineWriter(htmlWriter);

            if (Orientation == Orientation.Vertical)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.Tr);
            }

            CurrentStyle.AddAttributesToRender(writer);
            writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, null);

            if (!Enabled)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Disabled, "true");
            }

            if (ToolTip != String.Empty)
            {
                writer.AddAttribute(HtmlTextWriterAttribute.Title, ToolTip);
            }

            writer.RenderBeginTag(HtmlTextWriterTag.Td);

            DownLevelContent(writer);

            writer.RenderEndTag();

            writer.AllowNewLine = true;
            writer.WriteLine();

            if (Orientation == Orientation.Vertical)
            {
                writer.RenderEndTag();
            }
        }
Esempio n. 16
0
        public void RecalculateBox()
        {
            _position = CurrentStyle.Position();
            _margin   = CurrentStyle.Get <Dim>(Styles.Margin);
            _padding  = CurrentStyle.Get <Dim>(Styles.Padding);
            _border   = CurrentStyle.Get <Dim>(Styles.Border);

            _innerWidth  = InnerWidth;
            _innerHeight = InnerHeight;

            _contentBox = new Rectangle(ContentPosition.x, ContentPosition.y, _innerWidth, _innerHeight);

            if (!CurrentStyle.Get <bool>(Styles.Hidden))
            {
                _box   = new Rectangle();
                _box.x = Position.x;
                _box.y = Position.y;
                // margin left right border padding width
                _box.width = _margin.Left + _border.Left + _padding.Left
                             + _margin.Right + _border.Right + _padding.Right + _innerWidth;
                _box.height = _margin.Top + _border.Top + _padding.Top
                              + _margin.Bottom + _border.Bottom + _padding.Bottom + _innerHeight;
            }
        }
Esempio n. 17
0
        void OnGUI()
        {
            if (CurrentStyle == null)
            {
                CurrentStyle = new NodeStyle();
            }
            if (CurrentLayout == null)
            {
                CurrentLayout = new YogaNode();
            }

            var flex = Selection.activeGameObject?.GetComponent <FlexElement>();

            if (!flex)
            {
                PreviousFlex = null;
                GUILayout.Label("Select an element to start editing");
                return;
            }

            if (PreviousFlex != flex)
            {
                if (flex.Style != null)
                {
                    CurrentStyle.CopyStyle(flex.Style);
                }
                if (flex.Layout != null)
                {
                    CurrentLayout.CopyStyle(flex.Layout);
                }

                CurrentStyleDefaults  = flex.Component?.DefaultStyle;
                CurrentLayoutDefaults = flex.Component?.DefaultLayout;

                CurrentStyle.Parent = flex.Component?.Parent?.Style;

                PreviousFlex = flex;
            }


            GUILayout.BeginHorizontal();
            AutoApply   = EditorGUILayout.Toggle("Auto Apply changes", AutoApply);
            GUI.enabled = !AutoApply;
            if (GUILayout.Button("Apply"))
            {
                ApplyStyles();
            }
            GUILayout.EndHorizontal();
            GUI.enabled = true;


            GUILayout.BeginHorizontal();
            if (GUILayout.Button("Copy Json"))
            {
                CopyStyleAndLayout();
            }
            GUILayout.EndHorizontal();

            if (AutoApply)
            {
                EditorGUI.BeginChangeCheck();
            }

            var wide = EditorGUIUtility.wideMode;

            EditorGUIUtility.wideMode = true;
            scrollPosition            = GUILayout.BeginScrollView(scrollPosition);

            DrawStyles();
            DrawLayout();

            GUILayout.EndScrollView();
            EditorGUIUtility.wideMode = wide;

            if (AutoApply && EditorGUI.EndChangeCheck())
            {
                ApplyStyles();
            }
        }
Esempio n. 18
0
 public static bool SaveCurrentStyle( )
 {
     return(CurrentStyle.Save(userStylePath, false));
 }
Esempio n. 19
0
 private void OnClickPlay()
 {
     CurrentStyle.GetComponent <Animator>().enabled = true;
 }
Esempio n. 20
0
 private void OnClickStop()
 {
     CurrentStyle.GetComponent <Animator>().enabled = false;
 }
Esempio n. 21
0
        public void Draw()
        {
            if (!_isThemeApplied)
            {
                Initialize();
            }

            if (CurrentStyle.Get <bool>(Styles.Hidden))
            {
                return;
            }

            RecalculateBox();

            // update all events
            UpdateEvents();
            var marginOffset = new Vec2(Position.x + _margin.Left, Position.y + _margin.Top);
            // Raw background
            var contentBox = ContentBox;

            contentBox.height += _padding.Top + _padding.Bottom;
            contentBox.width  += _padding.Left + _padding.Right;
            contentBox.x      -= _padding.Left;
            contentBox.y      -= _padding.Top;
            var bg = CurrentStyle.Get <Col>(Styles.BackgroundColor);

            if (bg.a > 0.001f)
            {
                Rendering.DrawRect(contentBox, bg);
            }

            // Draw border
            var   borderColor      = CurrentStyle.Get <Col>(Styles.BorderColor);
            float widthWithBorder  = _border.Left + InnerWidth + _padding.Left + _border.Right + _padding.Right;
            float heightWithBorder = _border.Top + InnerHeight + _padding.Top + _border.Bottom + _padding.Bottom;

            if (_border.Top > float.Epsilon)
            {
                Rendering.DrawRect(new Rectangle(marginOffset.x + _border.Left, marginOffset.y,
                                                 widthWithBorder - _border.Right - _border.Left, _border.Top), borderColor);
            }

            if (_border.Left > float.Epsilon)
            {
                Rendering.DrawRect(new Rectangle(marginOffset.x, marginOffset.y,
                                                 _border.Left, heightWithBorder), borderColor);
            }

            if (_border.Right > float.Epsilon)
            {
                Rendering.DrawRect(new Rectangle(marginOffset.x + _border.Left + _padding.Left + InnerWidth + _padding.Right,
                                                 marginOffset.y,
                                                 _border.Right, heightWithBorder), borderColor);
            }

            if (_border.Bottom > float.Epsilon)
            {
                Rendering.DrawRect(new Rectangle(marginOffset.x + _border.Left,
                                                 marginOffset.y + _border.Top + _padding.Top + InnerHeight + _padding.Bottom,
                                                 widthWithBorder - _border.Right - _border.Left, _border.Bottom), borderColor);
            }

            Render();
            foreach (var child in Children)
            {
                var drawable = (child as Widget);
                if (drawable != null)
                {
                    drawable.DeferRender();
                }
            }

            if (CurrentStyle.Exists(Styles.Outline))
            {
                var outline = CurrentStyle.Get <GUIPanels.Outline>(Styles.Outline);
                Rendering.DrawLineBox(contentBox, outline.Width, outline.Color);
            }

            if (_shouldShowTooltip)
            {
                if (_tooltip != null)
                {
                    _tooltip.Draw();
                }
            }
        }