Home
Categories
Dictionary
Download
Project Details
Changes Log
What Links Here
How To
Syntax
FAQ
License

Developing the editor menus



This article explains how to add editor menus. Menus are specified in an XML file.

Adding menus to the editor is only possible for the library development.

Grammar

See the editor menus Schema.

Structure of the file

The file contains the following top-level elements:
  • enumerations which define the enumeration types which can used in menus
  • fileTypes which define the types of Editor XML elements on which menus will apply, and which menus apply on each kind of element

Enumeration types

Enumeration types define enumerations which can be used in menus, for example:
   <enum name="alignment">
      <enumValue value="left" />
      <enumValue value="center" />
      <enumValue value="right" />
   </enum>
For example:
dev-menu-enum

File types

The fileTypes element define the types of Editor XML elements on which menus will apply, and which menus apply on each kind of element:

Declaration of menus in any editor XML element

Each Editor XML element has any of the following children:
  • The menuGroup element defines a parent menu group
  • The menuGroupRef element defines a reference to a menu group defined previously in the file
  • The menu element defines a menu
  • The menuRef element defines a reference to a menu defined previously in the file

menuGroupRef and menuRef elements allow to reuse a previously defined menuGroup or menu and avoid to define it again.
The menuGroup element defines a parent menu group. A menu group can contain menu groups and menus.
  • The name attribute specifies the name of the menu group
  • The id attribute (optional) specifies the id of the menu group, which will be usable in menuGroupRef elements
For example:
   <menuGroup name="Lists" id="lists">
      <menu name="ul" title="Unordered list" tooltip="Add an unordered list" mixed="true">           
         <property name="bullet" argumentType="enum" enumType="ulStyle" tooltip="The bullet style" defaultValue="default" />      
      </menu> 
      <menu name="ol" title="Ordered list" tooltip="Add an ordered list" mixed="true">           
         <property name="bullet" argumentType="enum" enumType="olStyle" tooltip="The bullet style" defaultValue="default" />      
         <property name="start" argumentType="string" tooltip="The start value" defaultValue="" />      
      </menu>       
      <menu name="li" title="List item" tooltip="Add an item in the list" mixed="true">           
         <contentProperty name="desc" title="Content" argumentType="string" editor="textarea" tooltip="The list item content" />   
      </menu>                
   </menuGroup>
Will show:
dev-menu-menugroup The menuGroupRef element defines a reference to a menu group defined previously in the file.
  • The id attribute specifies the id of the menu group which is reused
For example:
   <menuGroupRef id="lists"/>
The menu element defines a menu. A me nu contains a list of properties.

The attributes of the menu element are:
  • The name attribute specifies the name of the menu. By default the title of the menu will use the name attribute
  • The id attribute (optional) specifies the id of the menu, which will be usable in menuRef elements
  • The title attribute (optional) specifies the title of the menu
  • The tooltip attribute (optional) specifies the tooltip of the menu
  • The mixed attribute (optional) specifies the mixed type of the element
  • The multipleLines attribute (optional) specifies that here can be text lines under the element
  • The includedInReplace attribute (optional) specifies that the menu will be included when replacing content
The children elements of the menu element are:
  • The group element specifies a group of properties in the menu
  • The title element specifies a titled line
  • The property element specifies a property
  • The compoundProperty element specifies a group of properties which can be enabled globally
  • The contentProperty element specifies a poperty which specifies the text content of the element
  • The propertyAdapter element specifies a property which will change thee result of several other properties

contentProperty

The contentProperty element specifies a property which specifies the text content of the element.

For example:
   <menu name="b" title="Bold" tooltip="Set text in Bold" includedInReplace="true">               
      <contentProperty name="b" title="Content" argumentType="string" editor="textarea" tooltip="The Bold content" useInReplace="true"/>
   </menu>
Will show:
dev-menu-content
The result will be:
dev-menu-content1
There can be only one contentProperty in the menu.

group

The group element specifies a group of properties in a menu.

The attributes of the group element are:
  • The orientation attribute specifies if the group is horizontal or vertical
  • The border attribute (optional) specifies if the group has a border
  • The title attribute (optional) specifies the title of the group
  • The enabler attribute (optional) specifies if there is a checkbox in the group which will enable or disable all elements under the group
For example:
   <menu name="title" tooltip="Add a Title">      
      <property name="title" argumentType="string" mandatory="true"/>         
      <group orientation="horizontal">   
         <property name="level" argumentType="int" defaultValue="1" />
         <property name="keepCase" argumentType="boolean" defaultValue="false" />                            
      </group>      
   </menu>
Will show:
dev-menu-group
There can even be only one element in the group.
The menuRef element defines a reference to a menu defined previously in the file.
  • The id attribute specifies the id of the menu which is reused
For example:
   <menuRef id="code" />

See also


Categories: Development

docJGenerator Copyright (c) 2016-2023 Herve Girod. All rights reserved.