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.menu.Menu;
14:
15: //toolbar button doesnt get rendered and even created when a new object is instantiated. it is rendered at the point it
16: //is added to the toolbar. so we cant register the event handlers with the underlying widget until it is rendered
17:
18: //ie. after it has been added to the toolbar
19: /**
20: * A button that renders into a toolbar.
21: */
22: public class ToolbarButton extends Button {
23:
24: private static JavaScriptObject configPrototype;
25:
26: static {
27: init();
28: }
29:
30: private static native void init()/*-{
31: var c = new $wnd.Ext.Toolbar.Button();
32: @com.gwtext.client.widgets.ToolbarButton::configPrototype = c.initialConfig;
33: }-*/;
34:
35: protected JavaScriptObject getConfigPrototype() {
36: return configPrototype;
37: }
38:
39: public String getXType() {
40: return "tbbutton";
41: }
42:
43: /**
44: * Create a new ToolbarButton.
45: */
46: public ToolbarButton() {
47: }
48:
49: /**
50: * Create a new ToolbarButton.
51: *
52: * @param text the button text
53: */
54: public ToolbarButton(String text) {
55: super (text);
56: }
57:
58: /**
59: * Create a new ToolbarButton.
60: *
61: * @param text the button text
62: * @param menu the button menu
63: */
64: public ToolbarButton(String text, Menu menu) {
65: super (text, menu);
66: }
67:
68: /**
69: * Create a new ToolbarButton.
70: *
71: * @param text the button text
72: * @param listener the button listner
73: */
74: public ToolbarButton(String text, ButtonListener listener) {
75: super (text, listener);
76: }
77:
78: /**
79: * Create a new ToolbarButton.
80: *
81: * @param text the button text
82: * @param listener the button listner
83: * @param icon the button icon image path
84: */
85: public ToolbarButton(String text, ButtonListener listener,
86: String icon) {
87: super (text, listener, icon);
88: }
89:
90: public ToolbarButton(JavaScriptObject jsObj) {
91: super (jsObj);
92: }
93:
94: protected native JavaScriptObject create(JavaScriptObject config) /*-{
95: return new $wnd.Ext.Toolbar.Button(config);
96: }-*/;
97: }
|