-<html>\r
-<head>\r
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> \r
- <title>The source code</title>\r
- <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />\r
- <script type="text/javascript" src="../resources/prettify/prettify.js"></script>\r
-</head>\r
-<body onload="prettyPrint();">\r
- <pre class="prettyprint lang-js"><div id="cls-Ext.SplitButton"></div>/**\r
- * @class Ext.SplitButton\r
- * @extends Ext.Button\r
- * A split button that provides a built-in dropdown arrow that can fire an event separately from the default\r
- * click event of the button. Typically this would be used to display a dropdown menu that provides additional\r
- * options to the primary button action, but any custom handler can provide the arrowclick implementation. Example usage:\r
- * <pre><code>\r
-// display a dropdown menu:\r
-new Ext.SplitButton({\r
- renderTo: 'button-ct', // the container id\r
- text: 'Options',\r
- handler: optionsHandler, // handle a click on the button itself\r
- menu: new Ext.menu.Menu({\r
- items: [\r
- // these items will render as dropdown menu items when the arrow is clicked:\r
- {text: 'Item 1', handler: item1Handler},\r
- {text: 'Item 2', handler: item2Handler}\r
- ]\r
- })\r
-});\r
-\r
-// Instead of showing a menu, you provide any type of custom\r
-// functionality you want when the dropdown arrow is clicked:\r
-new Ext.SplitButton({\r
- renderTo: 'button-ct',\r
- text: 'Options',\r
- handler: optionsHandler,\r
- arrowHandler: myCustomHandler\r
-});\r
-</code></pre>\r
- * @cfg {Function} arrowHandler A function called when the arrow button is clicked (can be used instead of click event)\r
- * @cfg {String} arrowTooltip The title attribute of the arrow\r
- * @constructor\r
- * Create a new menu button\r
- * @param {Object} config The config object\r
- * @xtype splitbutton\r
- */\r
-Ext.SplitButton = Ext.extend(Ext.Button, {\r
- // private\r
- arrowSelector : 'em',\r
- split: true,\r
-\r
- // private\r
- initComponent : function(){\r
- Ext.SplitButton.superclass.initComponent.call(this);\r
- /**\r
- * @event arrowclick\r
- * Fires when this button's arrow is clicked\r
- * @param {MenuButton} this\r
- * @param {EventObject} e The click event\r
- */\r
- this.addEvents("arrowclick");\r
- },\r
-\r
- // private\r
- onRender : function(){\r
- Ext.SplitButton.superclass.onRender.apply(this, arguments);\r
- if(this.arrowTooltip){\r
- this.el.child(this.arrowSelector).dom[this.tooltipType] = this.arrowTooltip;\r
- }\r
- },\r
-\r
- /**\r
- * Sets this button's arrow click handler.\r
- * @param {Function} handler The function to call when the arrow is clicked\r
- * @param {Object} scope (optional) Scope for the function passed above\r
- */\r
- setArrowHandler : function(handler, scope){\r
- this.arrowHandler = handler;\r
- this.scope = scope;\r
- },\r
-\r
- getMenuClass : function(){\r
- return 'x-btn-split' + (this.arrowAlign == 'bottom' ? '-bottom' : '');\r
- },\r
-\r
- isClickOnArrow : function(e){\r
- if (this.arrowAlign != 'bottom') {\r
- var visBtn = this.el.child('em.x-btn-split');\r
- var right = visBtn.getRegion().right - visBtn.getPadding('r');\r
- return e.getPageX() > right;\r
- } else {\r
- return e.getPageY() > this.btnEl.getRegion().bottom;\r
- }\r
- },\r
-\r
- // private\r
- onClick : function(e, t){\r
- e.preventDefault();\r
- if(!this.disabled){\r
- if(this.isClickOnArrow(e)){\r
- if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){\r
- this.showMenu();\r
- }\r
- this.fireEvent("arrowclick", this, e);\r
- if(this.arrowHandler){\r
- this.arrowHandler.call(this.scope || this, this, e);\r
- }\r
- }else{\r
- if(this.enableToggle){\r
- this.toggle();\r
- }\r
- this.fireEvent("click", this, e);\r
- if(this.handler){\r
- this.handler.call(this.scope || this, this, e);\r
- }\r
- }\r
- }\r
- },\r
-\r
- // private\r
- isMenuTriggerOver : function(e){\r
- return this.menu && e.target.tagName == this.arrowSelector;\r
- },\r
-\r
- // private\r
- isMenuTriggerOut : function(e, internal){\r
- return this.menu && e.target.tagName != this.arrowSelector;\r
- }\r
-});\r
-\r
-Ext.reg('splitbutton', Ext.SplitButton);</pre> \r
-</body>\r
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <title>The source code</title>
+ <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
+ <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
+</head>
+<body onload="prettyPrint();">
+ <pre class="prettyprint lang-js">/*!
+ * Ext JS Library 3.2.1
+ * Copyright(c) 2006-2010 Ext JS, Inc.
+ * licensing@extjs.com
+ * http://www.extjs.com/license
+ */
+<div id="cls-Ext.SplitButton"></div>/**
+ * @class Ext.SplitButton
+ * @extends Ext.Button
+ * A split button that provides a built-in dropdown arrow that can fire an event separately from the default
+ * click event of the button. Typically this would be used to display a dropdown menu that provides additional
+ * options to the primary button action, but any custom handler can provide the arrowclick implementation. Example usage:
+ * <pre><code>
+// display a dropdown menu:
+new Ext.SplitButton({
+ renderTo: 'button-ct', // the container id
+ text: 'Options',
+ handler: optionsHandler, // handle a click on the button itself
+ menu: new Ext.menu.Menu({
+ items: [
+ // these items will render as dropdown menu items when the arrow is clicked:
+ {text: 'Item 1', handler: item1Handler},
+ {text: 'Item 2', handler: item2Handler}
+ ]
+ })
+});
+
+// Instead of showing a menu, you provide any type of custom
+// functionality you want when the dropdown arrow is clicked:
+new Ext.SplitButton({
+ renderTo: 'button-ct',
+ text: 'Options',
+ handler: optionsHandler,
+ arrowHandler: myCustomHandler
+});
+</code></pre>
+ * @cfg {Function} arrowHandler A function called when the arrow button is clicked (can be used instead of click event)
+ * @cfg {String} arrowTooltip The title attribute of the arrow
+ * @constructor
+ * Create a new menu button
+ * @param {Object} config The config object
+ * @xtype splitbutton
+ */
+Ext.SplitButton = Ext.extend(Ext.Button, {
+ // private
+ arrowSelector : 'em',
+ split: true,
+
+ // private
+ initComponent : function(){
+ Ext.SplitButton.superclass.initComponent.call(this);
+ /**
+ * @event arrowclick
+ * Fires when this button's arrow is clicked
+ * @param {MenuButton} this
+ * @param {EventObject} e The click event
+ */
+ this.addEvents("arrowclick");
+ },
+
+ // private
+ onRender : function(){
+ Ext.SplitButton.superclass.onRender.apply(this, arguments);
+ if(this.arrowTooltip){
+ this.el.child(this.arrowSelector).dom[this.tooltipType] = this.arrowTooltip;
+ }
+ },
+
+ /**
+ * Sets this button's arrow click handler.
+ * @param {Function} handler The function to call when the arrow is clicked
+ * @param {Object} scope (optional) Scope for the function passed above
+ */
+ setArrowHandler : function(handler, scope){
+ this.arrowHandler = handler;
+ this.scope = scope;
+ },
+
+ getMenuClass : function(){
+ return 'x-btn-split' + (this.arrowAlign == 'bottom' ? '-bottom' : '');
+ },
+
+ isClickOnArrow : function(e){
+ if (this.arrowAlign != 'bottom') {
+ var visBtn = this.el.child('em.x-btn-split');
+ var right = visBtn.getRegion().right - visBtn.getPadding('r');
+ return e.getPageX() > right;
+ } else {
+ return e.getPageY() > this.btnEl.getRegion().bottom;
+ }
+ },
+
+ // private
+ onClick : function(e, t){
+ e.preventDefault();
+ if(!this.disabled){
+ if(this.isClickOnArrow(e)){
+ if(this.menu && !this.menu.isVisible() && !this.ignoreNextClick){
+ this.showMenu();
+ }
+ this.fireEvent("arrowclick", this, e);
+ if(this.arrowHandler){
+ this.arrowHandler.call(this.scope || this, this, e);
+ }
+ }else{
+ if(this.enableToggle){
+ this.toggle();
+ }
+ this.fireEvent("click", this, e);
+ if(this.handler){
+ this.handler.call(this.scope || this, this, e);
+ }
+ }
+ }
+ },
+
+ // private
+ isMenuTriggerOver : function(e){
+ return this.menu && e.target.tagName == this.arrowSelector;
+ },
+
+ // private
+ isMenuTriggerOut : function(e, internal){
+ return this.menu && e.target.tagName != this.arrowSelector;
+ }
+});
+
+Ext.reg('splitbutton', Ext.SplitButton);</pre>
+</body>