Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.swt.widgets
Class Menu  view Menu download Menu.java

java.lang.Object
  extended byorg.eclipse.swt.widgets.Widget
      extended byorg.eclipse.swt.widgets.Menu

public class Menu
extends Widget

Instances of this class are user interface objects that contain menu items.

Styles:
BAR, DROP_DOWN, POP_UP, NO_RADIO_GROUP
LEFT_TO_RIGHT, RIGHT_TO_LEFT
Events:
Help, Hide, Show

Note: Only one of BAR, DROP_DOWN and POP_UP may be specified. Only one of LEFT_TO_RIGHT or RIGHT_TO_LEFT may be specified.

IMPORTANT: This class is not intended to be subclassed.


Field Summary
(package private)  MenuItem cascade
           
(package private)  boolean hasLocation
           
(package private)  long imHandle
           
(package private)  long imItem
           
(package private)  long imSeparator
           
(package private)  Decorations parent
           
(package private)  MenuItem selectedItem
           
(package private)  int x
           
(package private)  int y
           
 
Fields inherited from class org.eclipse.swt.widgets.Widget
ACTIVATE, BUTTON_PRESS_EVENT, BUTTON_RELEASE_EVENT, CANVAS, CHANGED, CLICKED, COMMIT, CONFIGURE_EVENT, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DELETE_EVENT, DELETE_RANGE, DELETE_TEXT, DISABLED, display, DISPOSED, ENTER_NOTIFY_EVENT, EVENT, EVENT_AFTER, eventTable, EXPOSE_EVENT, FOCUS, FOCUS_IN_EVENT, FOCUS_OUT_EVENT, handle, HANDLE, HIDE, INSERT_TEXT, KEY_PRESS_EVENT, KEY_RELEASE_EVENT, KEYED_DATA, LEAVE_NOTIFY_EVENT, MAP_EVENT, MENU, MNEMONIC_ACTIVATE, MOTION_NOTIFY_EVENT, OBSCURED, POPUP_MENU, PREEDIT_CHANGED, REALIZE, ROW_ACTIVATED, SCROLL_CHILD, SELECT, SHOW, SHOW_HELP, SIZE_ALLOCATE, state, style, STYLE_SET, SWITCH_PAGE, TEST_COLLAPSE_ROW, TEST_EXPAND_ROW, TOGGLED, UNMAP_EVENT, UNREALIZE, VALUE_CHANGED, VISIBILITY_NOTIFY_EVENT, WINDOW_STATE_EVENT
 
Constructor Summary
Menu(Control parent)
          Constructs a new instance of this class given its parent, and sets the style for the instance so that the instance will be a popup menu on the given parent's shell.
Menu(Decorations parent, int style)
          Constructs a new instance of this class given its parent (which must be a Decorations) and a style value describing its behavior and appearance.
Menu(Menu parentMenu)
          Constructs a new instance of this class given its parent (which must be a Menu) and sets the style for the instance so that the instance will be a drop-down menu on the given parent's parent.
Menu(MenuItem parentItem)
          Constructs a new instance of this class given its parent (which must be a MenuItem) and sets the style for the instance so that the instance will be a drop-down menu on the given parent's parent menu.
 
Method Summary
 void _setVisible(boolean visible)
           
(package private)  void addAccelerators(long accelGroup)
           
 void addHelpListener(org.eclipse.swt.events.HelpListener listener)
          Adds the listener to the collection of listeners who will be notified when help events are generated for the control, by sending it one of the messages defined in the HelpListener interface.
 void addMenuListener(org.eclipse.swt.events.MenuListener listener)
          Adds the listener to the collection of listeners who will be notified when menus are hidden or shown, by sending it one of the messages defined in the MenuListener interface.
(package private) static Control checkNull(Control control)
           
(package private) static Menu checkNull(Menu menu)
           
(package private) static MenuItem checkNull(MenuItem item)
           
(package private) static int checkStyle(int style)
           
(package private)  void createHandle(int index)
           
(package private)  void createIMMenu(long imHandle)
           
(package private)  void createWidget(int index)
           
(package private)  void fixMenus(Decorations newParent)
           
 MenuItem getDefaultItem()
          Returns the default menu item or null if none has been previously set.
 boolean getEnabled()
          Returns true if the receiver is enabled, and false otherwise.
 MenuItem getItem(int index)
          Returns the item at the given, zero-relative index in the receiver.
 int getItemCount()
          Returns the number of items contained in the receiver.
 MenuItem[] getItems()
          Returns an array of MenuItems which are the items in the receiver.
(package private)  java.lang.String getNameText()
           
 Decorations getParent()
          Returns the receiver's parent, which must be a Decorations.
 MenuItem getParentItem()
          Returns the receiver's parent item, which must be a MenuItem or null when the receiver is a root.
 Menu getParentMenu()
          Returns the receiver's parent item, which must be a Menu or null when the receiver is a root.
 Shell getShell()
          Returns the receiver's shell.
(package private)  org.eclipse.swt.graphics.Point getSize()
           
 boolean getVisible()
          Returns true if the receiver is visible, and false otherwise.
(package private)  long gtk_hide(long widget)
           
(package private)  long gtk_show_help(long widget, long helpType)
           
(package private)  long gtk_show(long widget)
           
(package private)  void hookEvents()
           
 int indexOf(MenuItem item)
          Searches the receiver's list starting at the first item (index 0) until an item is found that is equal to the argument, and returns the index of that item.
 boolean isEnabled()
          Returns true if the receiver is enabled and all of the receiver's ancestors are enabled, and false otherwise.
 boolean isVisible()
          Returns true if the receiver is visible and all of the receiver's ancestors are visible and false otherwise.
(package private)  long menuPositionProc(long menu, long x, long y, long push_in, long user_data)
           
(package private)  void releaseChild()
           
(package private)  void releaseWidget()
           
(package private)  void removeAccelerators(long accelGroup)
           
 void removeHelpListener(org.eclipse.swt.events.HelpListener listener)
          Removes the listener from the collection of listeners who will be notified when the help events are generated for the control.
 void removeMenuListener(org.eclipse.swt.events.MenuListener listener)
          Removes the listener from the collection of listeners who will be notified when the menu events are generated for the control.
(package private)  boolean sendHelpEvent(long helpType)
           
 void setDefaultItem(MenuItem item)
          Sets the default menu item to the argument or removes the default emphasis when the argument is null.
 void setEnabled(boolean enabled)
          Enables the receiver if the argument is true, and disables it otherwise.
 void setLocation(int x, int y)
          Sets the receiver's location to the point specified by the arguments which are relative to the display.
 void setLocation(org.eclipse.swt.graphics.Point location)
          Sets the receiver's location to the point specified by the arguments which are relative to the display.
 void setVisible(boolean visible)
          Marks the receiver as visible if the argument is true, and marks it invisible otherwise.
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkBits, checkOrientation, checkParent, checkSubclass, checkWidget, deregister, destroyWidget, dispose, error, filterProc, filters, fixMnemonic, fontHeight, getData, getData, getDisplay, getName, getStyle, gtk_activate, gtk_button_press_event, gtk_button_release_event, gtk_changed, gtk_clicked, gtk_commit, gtk_configure_event, gtk_delete_event, gtk_delete_range, gtk_delete_text, gtk_enter_notify_event, gtk_event_after, gtk_event, gtk_expose_event, gtk_focus_in_event, gtk_focus_out_event, gtk_focus, gtk_insert_text, gtk_key_press_event, gtk_key_release_event, gtk_leave_notify_event, gtk_map_event, gtk_mnemonic_activate, gtk_motion_notify_event, gtk_popup_menu, gtk_preedit_changed, gtk_realize, gtk_row_activated, gtk_scroll_child, gtk_select, gtk_size_allocate, gtk_style_set, gtk_switch_page, gtk_test_collapse_row, gtk_test_expand_row, gtk_timer, gtk_toggled, gtk_unmap_event, gtk_unrealize, gtk_value_changed, gtk_visibility_notify_event, gtk_window_state_event, hooks, hoverProc, isDisposed, isListening, isValidSubclass, isValidThread, isValidWidget, mnemonicHit, mnemonicMatch, notifyListeners, pixbufCellDataProc, postEvent, postEvent, register, releaseHandle, releaseResources, removeDisposeListener, removeListener, removeListener, sendEvent, sendEvent, sendEvent, sendEvent, setData, setData, setInputState, setKeyState, setOrientation, shellMapProc, textCellDataProc, timerProc, topHandle, toString, translateTraversal, treeSelectionProc, windowProc, windowProc, windowProc, windowProc
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

x

int x

y

int y

hasLocation

boolean hasLocation

cascade

MenuItem cascade

selectedItem

MenuItem selectedItem

parent

Decorations parent

imItem

long imItem

imSeparator

long imSeparator

imHandle

long imHandle
Constructor Detail

Menu

public Menu(Control parent)
Constructs a new instance of this class given its parent, and sets the style for the instance so that the instance will be a popup menu on the given parent's shell.


Menu

public Menu(Decorations parent,
            int style)
Constructs a new instance of this class given its parent (which must be a Decorations) and a style value describing its behavior and appearance.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.


Menu

public Menu(Menu parentMenu)
Constructs a new instance of this class given its parent (which must be a Menu) and sets the style for the instance so that the instance will be a drop-down menu on the given parent's parent.


Menu

public Menu(MenuItem parentItem)
Constructs a new instance of this class given its parent (which must be a MenuItem) and sets the style for the instance so that the instance will be a drop-down menu on the given parent's parent menu.

Method Detail

checkNull

static Control checkNull(Control control)

checkNull

static Menu checkNull(Menu menu)

checkNull

static MenuItem checkNull(MenuItem item)

checkStyle

static int checkStyle(int style)

_setVisible

public void _setVisible(boolean visible)

addAccelerators

void addAccelerators(long accelGroup)

addMenuListener

public void addMenuListener(org.eclipse.swt.events.MenuListener listener)
Adds the listener to the collection of listeners who will be notified when menus are hidden or shown, by sending it one of the messages defined in the MenuListener interface.


addHelpListener

public void addHelpListener(org.eclipse.swt.events.HelpListener listener)
Adds the listener to the collection of listeners who will be notified when help events are generated for the control, by sending it one of the messages defined in the HelpListener interface.


createHandle

void createHandle(int index)
Overrides:
createHandle in class Widget

createIMMenu

void createIMMenu(long imHandle)

createWidget

void createWidget(int index)
Overrides:
createWidget in class Widget

fixMenus

void fixMenus(Decorations newParent)

getDefaultItem

public MenuItem getDefaultItem()
Returns the default menu item or null if none has been previously set.


getEnabled

public boolean getEnabled()
Returns true if the receiver is enabled, and false otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.


getItem

public MenuItem getItem(int index)
Returns the item at the given, zero-relative index in the receiver. Throws an exception if the index is out of range.


getItemCount

public int getItemCount()
Returns the number of items contained in the receiver.


getItems

public MenuItem[] getItems()
Returns an array of MenuItems which are the items in the receiver.

Note: This is not the actual structure used by the receiver to maintain its list of items, so modifying the array will not affect the receiver.


getNameText

java.lang.String getNameText()
Overrides:
getNameText in class Widget

getParent

public Decorations getParent()
Returns the receiver's parent, which must be a Decorations.


getParentItem

public MenuItem getParentItem()
Returns the receiver's parent item, which must be a MenuItem or null when the receiver is a root.


getParentMenu

public Menu getParentMenu()
Returns the receiver's parent item, which must be a Menu or null when the receiver is a root.


getShell

public Shell getShell()
Returns the receiver's shell. For all controls other than shells, this simply returns the control's nearest ancestor shell. Shells return themselves, even if they are children of other shells.


getSize

org.eclipse.swt.graphics.Point getSize()

getVisible

public boolean getVisible()
Returns true if the receiver is visible, and false otherwise.

If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, this method may still indicate that it is considered visible even though it may not actually be showing.


gtk_hide

long gtk_hide(long widget)
Overrides:
gtk_hide in class Widget

gtk_show

long gtk_show(long widget)
Overrides:
gtk_show in class Widget

gtk_show_help

long gtk_show_help(long widget,
                   long helpType)
Overrides:
gtk_show_help in class Widget

hookEvents

void hookEvents()
Overrides:
hookEvents in class Widget

indexOf

public int indexOf(MenuItem item)
Searches the receiver's list starting at the first item (index 0) until an item is found that is equal to the argument, and returns the index of that item. If no item is found, returns -1.


isEnabled

public boolean isEnabled()
Returns true if the receiver is enabled and all of the receiver's ancestors are enabled, and false otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.


isVisible

public boolean isVisible()
Returns true if the receiver is visible and all of the receiver's ancestors are visible and false otherwise.


menuPositionProc

long menuPositionProc(long menu,
                      long x,
                      long y,
                      long push_in,
                      long user_data)
Overrides:
menuPositionProc in class Widget

releaseChild

void releaseChild()
Overrides:
releaseChild in class Widget

releaseWidget

void releaseWidget()
Overrides:
releaseWidget in class Widget

removeMenuListener

public void removeMenuListener(org.eclipse.swt.events.MenuListener listener)
Removes the listener from the collection of listeners who will be notified when the menu events are generated for the control.


removeAccelerators

void removeAccelerators(long accelGroup)

removeHelpListener

public void removeHelpListener(org.eclipse.swt.events.HelpListener listener)
Removes the listener from the collection of listeners who will be notified when the help events are generated for the control.


sendHelpEvent

boolean sendHelpEvent(long helpType)

setDefaultItem

public void setDefaultItem(MenuItem item)
Sets the default menu item to the argument or removes the default emphasis when the argument is null.


setEnabled

public void setEnabled(boolean enabled)
Enables the receiver if the argument is true, and disables it otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.


setLocation

public void setLocation(int x,
                        int y)
Sets the receiver's location to the point specified by the arguments which are relative to the display.

Note: This is different from most widgets where the location of the widget is relative to the parent.


setLocation

public void setLocation(org.eclipse.swt.graphics.Point location)
Sets the receiver's location to the point specified by the arguments which are relative to the display.

Note: This is different from most widgets where the location of the widget is relative to the parent.

Since:
2.1

setVisible

public void setVisible(boolean visible)
Marks the receiver as visible if the argument is true, and marks it invisible otherwise.

If one of the receiver's ancestors is not visible or some other condition makes the receiver not visible, marking it visible may not actually cause it to be displayed.