org.gnu.gtk
Class UIManager

java.lang.Object
  extended by org.gnu.glib.Struct
      extended by org.gnu.glib.GObject
          extended by org.gnu.gtk.UIManager

public class UIManager
extends GObject

A class to construct a user interface (menus and toolbars) from one or more UI definitions, which reference actions from one or more action groups. The UI definitions are specified in an XML format. See the GTK documentation of GtkUIManager for details of this class and the UI definitions XML format.


Constructor Summary
UIManager()
           
 
Method Summary
 void addListener(UIManagerListener listener)
          Register an object to handle spin events.
 void addUI(int mergeId, java.lang.String path, java.lang.String name, java.lang.String action, UIManagerItemType type, boolean top)
           
 int addUIFromFile(java.lang.String filename)
          Parses a file containing a UI definition and merges it with the current contents of self.
 int addUIFromReader(java.io.Reader reader)
          Parse the contents of a Reader that contains a UI definition and merges it with the current contents of self.
 int addUIFromString(java.lang.String ui)
          Parses a string containing a UI definition and merges it with the current contents of self.
 void ensureUpdate()
           
 AccelGroup getAccelGroup()
           
 Action getAction(java.lang.String path)
           
 java.util.List getActionGroups()
           
 boolean getAddTearoffs()
           
 java.lang.Class getEventListenerClass(java.lang.String signal)
           
 EventType getEventType(java.lang.String signal)
           
 Widget[] getToplevels(UIManagerItemType types)
           
 java.lang.String getUI()
           
 Widget getWidget(java.lang.String path)
           
 void insertActionGroup(ActionGroup group, int position)
           
 int newMergeId()
           
 void removeActionGroup(ActionGroup group)
           
 void removeListener(UIManagerListener listener)
          Removes a listener
 void removeUI(int mergeId)
          Unmerges the part of this UIManager's content identified by mergeId.
 void setAddTearoffs(boolean addTearoffs)
           
 
Methods inherited from class org.gnu.glib.GObject
addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addEventHandler, addListener, collect, freezeNotify, getBooleanProperty, getData, getDoubleProperty, getFloatProperty, getGObjectFromHandle, getIntProperty, getJavaObjectProperty, getLongProperty, getPixbufProperty, getProperty, getStringProperty, hasProperty, notify, removeEventHandler, removeListener, setBooleanProperty, setData, setDoubleProperty, setFloatProperty, setIntProperty, setJavaObjectProperty, setLongProperty, setPixbufProperty, setProperty, setStringProperty, thawNotify
 
Methods inherited from class org.gnu.glib.Struct
equals, getHandle, getNullHandle, hashCode
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UIManager

public UIManager()
Method Detail

setAddTearoffs

public void setAddTearoffs(boolean addTearoffs)

getAddTearoffs

public boolean getAddTearoffs()

insertActionGroup

public void insertActionGroup(ActionGroup group,
                              int position)

removeActionGroup

public void removeActionGroup(ActionGroup group)

getActionGroups

public java.util.List getActionGroups()

getAccelGroup

public AccelGroup getAccelGroup()

getWidget

public Widget getWidget(java.lang.String path)

getToplevels

public Widget[] getToplevels(UIManagerItemType types)

getAction

public Action getAction(java.lang.String path)

addUIFromString

public int addUIFromString(java.lang.String ui)
Parses a string containing a UI definition and merges it with the current contents of self. An enclosing <ui> element is added if it is missing.

Returns:
The merge id for the merged UI. The merge id can be used to unmerge the UI with removeUI(int).
Throws:
java.lang.RuntimeException - If an error occurred adding the UI from the given String.

addUIFromFile

public int addUIFromFile(java.lang.String filename)
Parses a file containing a UI definition and merges it with the current contents of self.

Returns:
The merge id for the merged UI. The merge id can be used to unmerge the UI with removeUI(int).
Throws:
java.lang.RuntimeException - If an error occurred adding the UI from the given String.

addUIFromReader

public int addUIFromReader(java.io.Reader reader)
                    throws java.io.IOException
Parse the contents of a Reader that contains a UI definition and merges it with the current contents of self. The reader will be wrapped in an efficient Reader implementation before the contents are read. The reader will not be closed by this method.

This method reads the contents of the Reader into a String and calls addUIFromString(java.lang.String). You may be interested in using an InputStreamReader here if your contents come from an InputStream (such as when using getClass().getResourceAsStream() or a URL).

Returns:
The merge id for the merged UI. The merge id can be used to unmerge the UI with removeUI(int).
Throws:
java.lang.RuntimeException - If an error occurred adding the UI from the given String.
java.io.IOException - If there was an error reading the contents of the reader.

addUI

public void addUI(int mergeId,
                  java.lang.String path,
                  java.lang.String name,
                  java.lang.String action,
                  UIManagerItemType type,
                  boolean top)

removeUI

public void removeUI(int mergeId)
Unmerges the part of this UIManager's content identified by mergeId.


getUI

public java.lang.String getUI()

ensureUpdate

public void ensureUpdate()

newMergeId

public int newMergeId()

getEventListenerClass

public java.lang.Class getEventListenerClass(java.lang.String signal)
Overrides:
getEventListenerClass in class GObject

getEventType

public EventType getEventType(java.lang.String signal)
Overrides:
getEventType in class GObject

addListener

public void addListener(UIManagerListener listener)
Register an object to handle spin events.

See Also:
SpinListener

removeListener

public void removeListener(UIManagerListener listener)
Removes a listener

See Also:
addListener(UIManagerListener)