org.vishia.gral.swt

## Class SwtMenu

- java.lang.Object
- - org.vishia.gral.base.GralMenu._GraphicImpl
  - - org.vishia.gral.swt.SwtMenu

-     public class SwtMenu
      extends GralMenu._GraphicImpl

  This class describes either the menu bar of a window or a context menu of any widget. It wraps the SWT Menu. All sub menus are contained in a tree parallel to the menu tree of the implementation platform.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `(package private) static class` | `SwtMenu.ActionUserMenuItem` This class wraps the `GralUserAction` for a menu action in Swt.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private org.eclipse.swt.widgets.Menu` | `menuSwt` It is the first level of menu hierarchy.
    `protected org.eclipse.swt.widgets.Shell` | `window`

    - ### Fields inherited from class org.vishia.gral.base.GralMenu._GraphicImpl

      `widgg`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `SwtMenu(GralMenu gralMenu, GralWidget widgg, org.eclipse.swt.widgets.Control parent)` Constructor of a context menu of any widget.
    `protected` | `SwtMenu(GralMenu gralMenu, GralWidget widgg, org.eclipse.swt.widgets.Shell window)` Constructor for the menu bar of a window.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `_implMenuItem(java.lang.Object oParentMenu, GralMenu.MenuEntry gralEntry)` Creates the implementation for a menu node or entry.
    `org.eclipse.swt.widgets.Menu` | `getMenuImpl()` Returns the implementation instance for the menu.
    `void` | `setVisible()` Adds with a given widget.
    `private void` | `XXXaddMenuItemGthread(GralWidget widggP, java.lang.String nameWidg, java.lang.String sMenuPath, org.eclipse.swt.events.SelectionListener action)` Adds an action with the menu path to this menu.

    - ### Methods inherited from class org.vishia.gral.base.GralMenu._GraphicImpl

      `_implMenu`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### window

          protected final org.eclipse.swt.widgets.Shell window

    - #### menuSwt

          private final org.eclipse.swt.widgets.Menu menuSwt

      It is the first level of menu hierarchy.

  - ### Constructor Detail

    - #### SwtMenu

          protected SwtMenu(GralMenu gralMenu,
                            GralWidget widgg,
                            org.eclipse.swt.widgets.Control parent)

      Constructor of a context menu of any widget.
      Parameters:
        `sName` -
        `parent` -
        `mng` -

    - #### SwtMenu

          protected SwtMenu(GralMenu gralMenu,
                            GralWidget widgg,
                            org.eclipse.swt.widgets.Shell window)

      Constructor for the menu bar of a window. It creates the window's menu if it isn't existing yet.
      Parameters:
        `sName` -
        `window` -
        `mng` -

  - ### Method Detail

    - #### XXXaddMenuItemGthread

          private void XXXaddMenuItemGthread(GralWidget widggP,
                                             java.lang.String nameWidg,
                                             java.lang.String sMenuPath,
                                             org.eclipse.swt.events.SelectionListener action)

      Adds an action with the menu path to this menu. This method is package private. It is used by `SwtTable` to add a context menu with a special SelectionListener.
      Parameters:
        `nameWidg` -
        `sMenuPath` -
        `action` -

    - #### _implMenuItem

          public void _implMenuItem(java.lang.Object oParentMenu,
                                    GralMenu.MenuEntry gralEntry)

      Creates the implementation for a menu node or entry.
      Specified by:
        `_implMenuItem` in class `GralMenu._GraphicImpl`
      Parameters:
        `oParentMenu` - return value of `getMenuImpl()` or the `GralMenu.MenuEntry#menuImpl`, that is a menu node.
        `gralEntry` - The entry in the menu tree

    - #### setVisible

          public void setVisible()

      Description copied from class: `GralMenu._GraphicImpl`
      Adds with a given widget. Note the widget is in difference with the `GralMenu._GraphicImpl.widgg` of the constructor. Check what is happen. Therefore:
      Specified by:
        `setVisible` in class `GralMenu._GraphicImpl`

    - #### getMenuImpl

          public org.eclipse.swt.widgets.Menu getMenuImpl()

      Description copied from class: `GralMenu._GraphicImpl`
      Returns the implementation instance for the menu.
      Specified by:
        `getMenuImpl` in class `GralMenu._GraphicImpl`