Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        public override float ModifyFootprintHeight(float height, EditorGUILayoutState state)
        {
            if (HasLabel())
            {
                return(height + label_height);
            }

            return(height);
        }
Ejemplo n.º 4
0
 static public EditorGUILayoutState GetWithShouldAlwaysShowRecoveryFields(this EditorGUILayoutState item, bool should)
 {
     return(new EditorGUILayoutState(
                item.GetCurrentLabelWidth(),
                item.ShouldAutoSizeLabels(),
                item.GetAutoSizeLabelMargin(),
                item.ShouldUseVisibility(),
                should
                ));
 }
Ejemplo n.º 5
0
 static public EditorGUILayoutState GetWithCurrentLabelWidth(this EditorGUILayoutState item, float width)
 {
     return(new EditorGUILayoutState(
                width,
                item.ShouldAutoSizeLabels(),
                item.GetAutoSizeLabelMargin(),
                item.ShouldUseVisibility(),
                item.ShouldAlwaysShowRecoveryFields()
                ));
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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());
        }
Ejemplo n.º 9
0
 public override EditorGUIElementPlan PlanContentsInternal(EditorGUIElementPlan plan, EditorGUILayoutState state)
 {
     return(plan.Shrink(left, right, bottom, top));
 }
Ejemplo n.º 10
0
        public override EditorGUIElementPlan PlanElementInternal(EditorGUIElementPlan plan, EditorGUILayoutState state)
        {
            if (HasLabel())
            {
                plan.SplitAtLeftOffset(state.GetCurrentLabelWidth(), out label_plan, out plan);
            }

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

            return(plan);
        }
Ejemplo n.º 14
0
        public override EditorGUIElementPlan PlanElementInternal(EditorGUIElementPlan plan, EditorGUILayoutState state)
        {
            box_plan = plan;

            return(plan);
        }
Ejemplo n.º 15
0
 public override float ModifyFootprintHeight(float height, EditorGUILayoutState state)
 {
     return(height + bottom + top);
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 18
0
 public virtual EditorGUIElementPlan PlanContentsInternal(EditorGUIElementPlan plan, EditorGUILayoutState state)
 {
     return(plan);
 }