MBEditor.DoSectionHeader C# (CSharp) Method

DoSectionHeader() public method

public DoSectionHeader ( string caption, Color backgroundColor, bool canToggle ) : bool
caption string
backgroundColor Color
canToggle bool
return bool
    public bool DoSectionHeader(string caption, Color backgroundColor, bool canToggle)
    {
        bool state = true;

        if (canToggle) {
            if (!mSectionToggleState.ContainsKey(caption))
                mSectionToggleState.Add(caption, true);
            state = mSectionToggleState[caption];
            GUILayout.BeginHorizontal();
        }

        GUI.backgroundColor = backgroundColor;
        GUILayout.Label(caption, mStyleHeaderStyle);
        Rect r = GUILayoutUtility.GetLastRect();
        if (canToggle) {
            if (GUI.Button(new Rect(r.xMax-20,r.y,20,20),new GUIContent(mTexToggleZoom, "Show/Hide Section"),GUI.skin.label)) {
                state = !state;
                mSectionToggleState[caption] = state;
            }
            GUILayout.EndHorizontal();
        }
        GUI.backgroundColor = mColDefault;
        return state;
    }