01: /*
02: * GWT-Ext Widget Library
03: * Copyright(c) 2007-2008, GWT-Ext.
04: * licensing@gwt-ext.com
05: *
06: * http://www.gwt-ext.com/license
07: */
08:
09: package com.gwtext.client.widgets;
10:
11: import com.google.gwt.core.client.JavaScriptObject;
12: import com.gwtext.client.widgets.event.ButtonListener;
13: import com.gwtext.client.widgets.event.SplitButtonListener;
14: import com.gwtext.client.widgets.menu.Menu;
15:
16: /**
17: * A menu button that renders into a toolbar. Also known as ToolbarSplitButton.
18: */
19: public class ToolbarMenuButton extends SplitButton {
20:
21: private static JavaScriptObject configPrototype;
22:
23: static {
24: init();
25: }
26:
27: private static native void init()/*-{
28: var c = new $wnd.Ext.Toolbar.SplitButton();
29: @com.gwtext.client.widgets.ToolbarMenuButton::configPrototype = c.initialConfig;
30: }-*/;
31:
32: protected JavaScriptObject getConfigPrototype() {
33: return configPrototype;
34: }
35:
36: public String getXType() {
37: return "tbsplit";
38: }
39:
40: /**
41: * Create a new ToolbarMenuButton.
42: */
43: public ToolbarMenuButton() {
44: }
45:
46: /**
47: * Create a new ToolbarMenuButton.
48: *
49: * @param text the button text
50: */
51: public ToolbarMenuButton(String text) {
52: super (text);
53: }
54:
55: /**
56: * Create a new ToolbarMenuButton.
57: *
58: * @param text the button text
59: * @param listener the button listner
60: */
61: public ToolbarMenuButton(String text, SplitButtonListener listener) {
62: super (text, listener);
63: }
64:
65: /**
66: * Create a new ToolbarMenuButton.
67: *
68: * @param text the button text
69: * @param menu the button menu
70: */
71: public ToolbarMenuButton(String text, Menu menu) {
72: if (text != null)
73: setText(text);
74: setMenu(menu);
75: }
76:
77: public ToolbarMenuButton(JavaScriptObject jsObj) {
78: super (jsObj);
79: }
80:
81: protected native JavaScriptObject create(JavaScriptObject config) /*-{
82: return new $wnd.Ext.Toolbar.SplitButton(config);
83: }-*/;
84: }
|