GH_Layout

References
Represents a complete ribbon layout.

Constructors

GH_Layout

#
public GH_Layout()
Create a new Ribbon layout

GH_Layout

#
public GH_Layout(GH_Layout other)
Duplicate an existing layout.
other (GH_Layout)Layout to duplicate.

Properties

FilePath

#
public string FilePath { get; set; }
Gets or sets the file path of the custom layout. Typically the path should only be set during Save operations. The FilePath field is not included in (de)serialization.

ItemCount

#
public int ItemCount { get; }
Gets the total number of Items defined in this layout.

Items

#
public IEnumerable<GH_LayoutItem> Items { get; }
Gets an enumerator for all the items in this layout.

Name

#
public string Name { get; }
Gets the name of the layout as indicated by the filepath or "unnamed"

PanelCount

#
public int PanelCount { get; }
Gets the total number of Panels defined in this layout.

TabCount

#
public int TabCount { get; }
Gets the total number of Tabs defined in this layout.

Tabs

#
public List<GH_LayoutTab> Tabs { get; }
Gets the internal list of ribbon tab names. Eventhough items define tabs, this separate list is required in order to specify the order of tabs.

Methods

AddItem

#
public void AddItem(string category, string subcategory, GH_LayoutItem item)
Add a new item to this layout.
category (string)Item category. If no category with this name exists yet, it will be created.
subcategory (string)Item subcategory. If no subcategory with this name exists yet, it will be created.
item (GH_LayoutItem)Item to add.

AddItem

#
public void AddItem(string category, string subcategory, Guid id, GH_Exposure exposure)
Add a new item to this layout.
category (string)Item category. If no category with this name exists yet, it will be created.
subcategory (string)Item subcategory. If no subcategory with this name exists yet, it will be created.
id (Guid)ID of item.
exposure (GH_Exposure)Exposure of item.

AddItem

#
public void AddItem(string category, string subcategory, Guid id)
Add a new item to this layout.
category (string)Item category. If no category with this name exists yet, it will be created.
subcategory (string)Item subcategory. If no subcategory with this name exists yet, it will be created.
id (Guid)ID of item.

AddTab

#
public GH_LayoutTab AddTab()
Add a new tab to this layout. The tab will receive a default name.

AddTab

#
public GH_LayoutTab AddTab(string name)
Add a new tab to this layout. If a tab with a similar name already exists, nothing is done.
name (string)Name of tab.

Deserialize

#
public bool Deserialize(string filepath)
Deserialize this layout from a *.ghlayout file. If this function returns False, the state of this object is undefined.
filepath (string)File to deserialize from.
True on success, false on failure.

FindTab

#
public GH_LayoutTab FindTab(string name)
Find the first tab which matches the given name.
name (string)Name to search for (not case sensitive)
The first tab that matches the name, or null if no matching tab could be found.

Read

#
public bool Read(GH_IReader reader)
reader (GH_IReader)
Read

Serialize

#
public bool Serialize(string filepath)
Serialize this layout to a *.ghlayout file.
filepath (string)File to serialize to.
True on success, false on failure.

Serialize

#
public string Serialize()
Serialize this layout as an xml string.

StringSort

#
public static int StringSort(string a, string b)
For: RH-83156. Specifically handle leading whitespace for sorting purposes.
a (string)
b (string)

Write

#
public bool Write(GH_IWriter writer)
writer (GH_IWriter)
Write