{"name":"Eden Editor: Configuring Menu Bar","title":"Eden Editor: Configuring Menu Bar","type":"topic","url":"https://community.bistudio.com/wiki/Eden_Editor:_Configuring_Menu_Bar","revid":347885,"updated":"2023-10-31T13:12:43Z","aliases":["Eden Editor: Menu Bar: Modding","Eden Editor: Modding Menu Bar"],"markdown":"Menu Bar is the central control element of the Eden Editor, where all available options and tools are available.\nWhen adding a new functionality to the editor, you should strongly consider listing the feature there.\n\nThe menu bar is configured as a CT_MENU_STRIP, and it is possible to freely modify it from an addon.\nBecause anyone can access the configuration, remember to tag your class names to make them unique (i.e., **TAG_AwesomeTool** instead of just **AwesomeTool**).\n\nFollowing code examples will show the most common ways how to extend the menu bar.\n\n### Tool\n\nWhen adding a tool which has its own isolated functionality, **Tools** section is the best place where to put it.\n\n#### Single\n\n```cpp\nclass ctrlMenuStrip;\nclass display3DEN\n{\n    class Controls\n    {\n        class MenuStrip : ctrlMenuStrip\n        {\n            class Items\n            {\n                class Tools\n                {\n                    items[] += { \"TAG_MyTool\" }; // += must be used; you want to expand the array, not override it!\n                };\n\n                class TAG_MyTool\n                {\n                    text = \"My Awesome Tool\"; // Item text\n                    picture = \"\\MyAddon\\data\\myAwesomeTool_ca.paa\"; // Item picture\n                    action = \"[] call TAG_fnc_MyAwesomeTool;\"; // Expression called upon clicking; ideally, it should call your custom function\n                    opensNewWindow = 1;// Adds '...' to the name of the menu entry, indicating the user that a new window will be opened.\n                };\n            };\n        };\n    };\n};\n```\n\n#### Folder\n\nIf your feature is more complex and one menu item would not be enough to control it, you can instead add a folder with all required options inside.\n\n```cpp\nclass ctrlMenuStrip;\nclass display3DEN\n{\n    class Controls\n    {\n        class MenuStrip : ctrlMenuStrip\n        {\n            class Items\n            {\n                class Tools\n                {\n                    items[] += {\"TAG_MyFolder\"};\n                };\n\n                class TAG_MyFolder\n                {\n                    text = \"My Awesome Folder...\";\n                    items[] = { \"TAG_MyTool1\", \"TAG_MyTool1\" }; // Links to items inside the folder\n                };\n\n                class TAG_MyTool1\n                {\n                    text = \"My Awesome Tool 1\";\n                };\n\n                class TAG_MyTool2\n                {\n                    text = \"My Awesome Tool 1\";\n                };\n            };\n        };\n    };\n};\n```\n\n#### Separators\n\nTo ensure the user is not overwhelmed by the sheer amount of tools it is recommended to not only use folders, but also **separators**. You can add a separator like so:\n\n```cpp\nclass ctrlMenuStrip;\nclass display3DEN\n{\n    class Controls\n    {\n        class MenuStrip : ctrlMenuStrip\n        {\n            class Items\n            {\n                class Tools\n                {\n                    items[] += { \"TAG_MyFolder\" };\n                };\n\n                class TAG_MyFolder\n                {\n                    text = \"My Awesome Folder...\";\n                    items[] = { \"TAG_MyTool1\", \"Separator\", \"TAG_MyTool1\" }; // The separator is treated like any other tool\n                };\n\n                class TAG_MyTool1\n                {\n                    text = \"My Awesome Tool 1\";\n                };\n\n                class TAG_MyTool2\n                {\n                    text = \"My Awesome Tool 1\";\n                };\n            };\n        };\n    };\n};\n```\n\n### Scenario Attributes\n\nWhen you add a new window with scenario attributes (see Attributes Modding to learn how it can be achieved), the user will still need a way how to access it.\nThe best way is to add a link to the window at the end of **Attributes** option.\n\n```cpp\nclass ctrlMenuStrip;\nclass display3DEN\n{\n    class Controls\n    {\n        class MenuStrip : ctrlMenuStrip\n        {\n            class Items\n            {\n                class Attributes\n                {\n                    items[] += { \"TAG_MyAttributes\" };\n                };\n\n                class TAG_MyAttributes\n                {\n                    text = \"My Awesome Attributes\";\n                    action = \"edit3DENMissionAttributes 'MyScenarioAttributes';\";\n                };\n            };\n        };\n    };\n};\n```","sections":[{"heading":null,"level":1,"markdown":"Menu Bar is the central control element of the Eden Editor, where all available options and tools are available.\nWhen adding a new functionality to the editor, you should strongly consider listing the feature there.\n\nThe menu bar is configured as a CT_MENU_STRIP, and it is possible to freely modify it from an addon.\nBecause anyone can access the configuration, remember to tag your class names to make them unique (i.e., **TAG_AwesomeTool** instead of just **AwesomeTool**).\n\nFollowing code examples will show the most common ways how to extend the menu bar."},{"heading":"Tool","level":3,"markdown":"When adding a tool which has its own isolated functionality, **Tools** section is the best place where to put it."},{"heading":"Single","level":4,"markdown":"```cpp\nclass ctrlMenuStrip;\nclass display3DEN\n{\n    class Controls\n    {\n        class MenuStrip : ctrlMenuStrip\n        {\n            class Items\n            {\n                class Tools\n                {\n                    items[] += { \"TAG_MyTool\" }; // += must be used; you want to expand the array, not override it!\n                };\n\n                class TAG_MyTool\n                {\n                    text = \"My Awesome Tool\"; // Item text\n                    picture = \"\\MyAddon\\data\\myAwesomeTool_ca.paa\"; // Item picture\n                    action = \"[] call TAG_fnc_MyAwesomeTool;\"; // Expression called upon clicking; ideally, it should call your custom function\n                    opensNewWindow = 1;// Adds '...' to the name of the menu entry, indicating the user that a new window will be opened.\n                };\n            };\n        };\n    };\n};\n```"},{"heading":"Folder","level":4,"markdown":"If your feature is more complex and one menu item would not be enough to control it, you can instead add a folder with all required options inside.\n\n```cpp\nclass ctrlMenuStrip;\nclass display3DEN\n{\n    class Controls\n    {\n        class MenuStrip : ctrlMenuStrip\n        {\n            class Items\n            {\n                class Tools\n                {\n                    items[] += {\"TAG_MyFolder\"};\n                };\n\n                class TAG_MyFolder\n                {\n                    text = \"My Awesome Folder...\";\n                    items[] = { \"TAG_MyTool1\", \"TAG_MyTool1\" }; // Links to items inside the folder\n                };\n\n                class TAG_MyTool1\n                {\n                    text = \"My Awesome Tool 1\";\n                };\n\n                class TAG_MyTool2\n                {\n                    text = \"My Awesome Tool 1\";\n                };\n            };\n        };\n    };\n};\n```"},{"heading":"Separators","level":4,"markdown":"To ensure the user is not overwhelmed by the sheer amount of tools it is recommended to not only use folders, but also **separators**. You can add a separator like so:\n\n```cpp\nclass ctrlMenuStrip;\nclass display3DEN\n{\n    class Controls\n    {\n        class MenuStrip : ctrlMenuStrip\n        {\n            class Items\n            {\n                class Tools\n                {\n                    items[] += { \"TAG_MyFolder\" };\n                };\n\n                class TAG_MyFolder\n                {\n                    text = \"My Awesome Folder...\";\n                    items[] = { \"TAG_MyTool1\", \"Separator\", \"TAG_MyTool1\" }; // The separator is treated like any other tool\n                };\n\n                class TAG_MyTool1\n                {\n                    text = \"My Awesome Tool 1\";\n                };\n\n                class TAG_MyTool2\n                {\n                    text = \"My Awesome Tool 1\";\n                };\n            };\n        };\n    };\n};\n```"},{"heading":"Scenario Attributes","level":3,"markdown":"When you add a new window with scenario attributes (see Attributes Modding to learn how it can be achieved), the user will still need a way how to access it.\nThe best way is to add a link to the window at the end of **Attributes** option.\n\n```cpp\nclass ctrlMenuStrip;\nclass display3DEN\n{\n    class Controls\n    {\n        class MenuStrip : ctrlMenuStrip\n        {\n            class Items\n            {\n                class Attributes\n                {\n                    items[] += { \"TAG_MyAttributes\" };\n                };\n\n                class TAG_MyAttributes\n                {\n                    text = \"My Awesome Attributes\";\n                    action = \"edit3DENMissionAttributes 'MyScenarioAttributes';\";\n                };\n            };\n        };\n    };\n};\n```"}],"categories":["Eden Editor: Modding"],"groups":["Mission Editing"]}