1 package org.splat.wapp;
6 public class ToolBar extends ContextualMenu {
8 // ==============================================================================================================================
10 // ==============================================================================================================================
12 public ToolBar (int size) {
13 // -------------------------
18 // ==============================================================================================================================
20 // ==============================================================================================================================
22 public void addTool (String name, String icon, String command) {
23 // --------------------------------------------------------------
24 addTool(name, new ToolButton(icon).action(command) );
27 public void addTool (String name, String icon, String command, String arg) {
28 // --------------------------------------------------------------------------
29 addTool(name, new ToolButton(icon).action(command).argument(arg) );
32 public void addTool (String name, String icon, String tip, String command, String arg) {
33 // --------------------------------------------------------------------------------------
34 addTool(name, new ToolButton(icon).tooltip(tip).action(command).argument(arg) );
37 public void addTool (String name, ToolButton item) {
38 // --------------------------------------------------
39 item.width = this.height;
40 item.height = this.height;
41 this.width += item.width;
42 if (!this.isEmpty()) width += 6; // Gap between icons
43 super.addItem(name, item);
46 public void addSeparator () {
47 // ---------------------------
49 super.addItem("", new ToolButton());
52 @SuppressWarnings({"rawtypes","unchecked"})
53 public List<ToolButton> asList () {
54 // ---------------------------------
58 public ToolButton item (String name) {
59 // ------------------------------------
60 return (ToolButton)items.get(indices.get(name));