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.
addListener
public void addListener(UIManagerListener listener)
Register an object to handle spin events.
addUI
public void addUI(int mergeId,
String path,
String name,
String action,
UIManagerItemType type,
boolean top)
addUIFromFile
public int addUIFromFile(String filename)
Parses a file containing a UI definition and merges it with the current
contents of self.
- The merge id for the merged UI. The merge id can be used to
unmerge the UI with
removeUI(int)
.
addUIFromReader
public int addUIFromReader(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(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).
- The merge id for the merged UI. The merge id can be used to
unmerge the UI with
removeUI(int)
.
addUIFromString
public int addUIFromString(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.
- The merge id for the merged UI. The merge id can be used to
unmerge the UI with
removeUI(int)
.
ensureUpdate
public void ensureUpdate()
getAction
public Action getAction(String path)
getActionGroups
public List getActionGroups()
getAddTearoffs
public boolean getAddTearoffs()
getEventListenerClass
public Class getEventListenerClass(String signal)
getEventType
public EventType getEventType(String signal)
getUI
public String getUI()
getWidget
public Widget getWidget(String path)
insertActionGroup
public void insertActionGroup(ActionGroup group,
int position)
newMergeId
public int newMergeId()
removeActionGroup
public void removeActionGroup(ActionGroup group)
removeListener
public void removeListener(UIManagerListener listener)
Removes a listener
removeUI
public void removeUI(int mergeId)
Unmerges the part of this UIManager's content identified by
mergeId.
setAddTearoffs
public void setAddTearoffs(boolean addTearoffs)