Exemple #1
0
        public void LayoutDrawUnwind(Rect rect, EditorGUILayoutState state)
        {
            if (state.ShouldUseVisibility())
            {
                if (Event.current.type == EventType.Repaint)
                {
                    Rect new_visible_rect = GUIUtilityExtensions.GetVisibleRect();

                    if (new_visible_rect.height <= Screen.height && new_visible_rect.height >= 16.0f)
                    {
                        visible_rect = new_visible_rect;
                    }
                }
            }
            else
            {
                visible_rect = rect;
            }

            if (rect.width > 16.0f)
            {
                int draw_id = next_draw_id++;

                element.Plan(rect.width, state);
                element.Layout(rect.min);

                element.Draw(draw_id, visible_rect);
                element.Unwind(draw_id);
            }
        }
Exemple #2
0
        public float Plan(float width, EditorGUILayoutState state)
        {
            float total_weight  = elements.Convert(e => e.GetDimension().GetWeight()).Sum();
            float total_minimum = elements.Convert(e => e.GetDimension().GetMinimum()).Sum();

            height = elements.Convert(e => e.Plan(width, total_weight, total_minimum, state)).Max();
            return(height);
        }
Exemple #3
0
        public override float ModifyFootprintHeight(float height, EditorGUILayoutState state)
        {
            if (HasLabel())
            {
                return(height + label_height);
            }

            return(height);
        }
Exemple #4
0
 static public EditorGUILayoutState GetWithShouldAlwaysShowRecoveryFields(this EditorGUILayoutState item, bool should)
 {
     return(new EditorGUILayoutState(
                item.GetCurrentLabelWidth(),
                item.ShouldAutoSizeLabels(),
                item.GetAutoSizeLabelMargin(),
                item.ShouldUseVisibility(),
                should
                ));
 }
Exemple #5
0
 static public EditorGUILayoutState GetWithCurrentLabelWidth(this EditorGUILayoutState item, float width)
 {
     return(new EditorGUILayoutState(
                width,
                item.ShouldAutoSizeLabels(),
                item.GetAutoSizeLabelMargin(),
                item.ShouldUseVisibility(),
                item.ShouldAlwaysShowRecoveryFields()
                ));
 }
Exemple #6
0
        public float Plan(float width, EditorGUILayoutState state)
        {
            if (width != footprint_width || state != layout_state || is_plan_invalid)
            {
                footprint_width = width;
                layout_state    = state;

                DoPlan();
            }

            return(footprint_height);
        }
Exemple #7
0
        public EditorGUIElement()
        {
            is_plan_invalid   = true;
            is_layout_invalid = true;

            layout_state = new EditorGUILayoutState();

            attachments            = new List <EditorGUIElementAttachment>();
            surpressed_attachments = new List <EditorGUIElementAttachment>();

            AddAttachment(new EditorGUIElementAttachment_Singular_Margin(1.0f));
        }
Exemple #8
0
        protected override float DoPlanInternal()
        {
            EditorGUILayoutState state = GetLayoutState();

            if (state.ShouldAutoSizeLabels())
            {
                state = state.GetWithCurrentLabelWidth(
                    GetChildren()
                    .Convert(c => c.GetAttachments <EditorGUIElementAttachment_Singular_Label_GUIContent_Inline>())
                    .Flatten()
                    .Convert(a => a.GetLabel().GetLabelLayoutWidth())
                    .Max() + state.GetAutoSizeLabelMargin()
                    );
            }

            return(GetChildren().Convert(e => e.Plan(GetContentsWidth(), state)).Sum());
        }
Exemple #9
0
 public override EditorGUIElementPlan PlanContentsInternal(EditorGUIElementPlan plan, EditorGUILayoutState state)
 {
     return(plan.Shrink(left, right, bottom, top));
 }
Exemple #10
0
        public override EditorGUIElementPlan PlanElementInternal(EditorGUIElementPlan plan, EditorGUILayoutState state)
        {
            if (HasLabel())
            {
                plan.SplitAtLeftOffset(state.GetCurrentLabelWidth(), out label_plan, out plan);
            }

            return(plan);
        }
Exemple #11
0
 public virtual float ModifyFootprintHeight(float height, EditorGUILayoutState state)
 {
     return(height);
 }
Exemple #12
0
 public float Plan(float width, EditorGUILayoutState state)
 {
     return(element.Plan(width, state));
 }
Exemple #13
0
        public override EditorGUIElementPlan PlanContentsInternal(EditorGUIElementPlan plan, EditorGUILayoutState state)
        {
            plan.SplitAtLeftOffset(state.GetCurrentLabelWidth(), out index_plan, out plan);

            return(plan);
        }
Exemple #14
0
        public override EditorGUIElementPlan PlanElementInternal(EditorGUIElementPlan plan, EditorGUILayoutState state)
        {
            box_plan = plan;

            return(plan);
        }
Exemple #15
0
 public override float ModifyFootprintHeight(float height, EditorGUILayoutState state)
 {
     return(height + bottom + top);
 }
Exemple #16
0
        public override EditorGUIElementPlan PlanContentsInternal(EditorGUIElementPlan plan, EditorGUILayoutState state)
        {
            if (HasLabel())
            {
                plan.SplitAtBottomOffset(label_height, out label_plan, out plan);
            }

            return(plan.Shrink(indent_width, 0.0f, 0.0f, 0.0f));
        }
Exemple #17
0
 public float Plan(float total_width, float total_weight, float total_minimum, EditorGUILayoutState state)
 {
     return(Plan(dimension.Calculate(total_width, total_weight, total_minimum), state));
 }
Exemple #18
0
 public virtual EditorGUIElementPlan PlanContentsInternal(EditorGUIElementPlan plan, EditorGUILayoutState state)
 {
     return(plan);
 }