OpenLayers OpenLayers

Ticket #872: generic_button.patch

File generic_button.patch, 2.9 kB (added by crschmidt, 1 year ago)
  • tests/Control/test_Button.html

    old new  
     1<html> 
     2<head> 
     3  <script src="../../lib/OpenLayers.js"></script> 
     4  <script type="text/javascript"> 
     5    function test_Control_Button_constructor (t) { 
     6        t.plan( 2 ); 
     7     
     8        control = new OpenLayers.Control.Button(); 
     9        t.ok( control instanceof OpenLayers.Control.Button, "new OpenLayers.Control returns object" ); 
     10        t.eq( control.displayClass,  "olControlButton", "displayClass is correct" ); 
     11    } 
     12 
     13  </script> 
     14</head> 
     15<body> 
     16    <div id="map" style="width: 1024px; height: 512px;"/> 
     17</body> 
     18</html> 
  • tests/list-tests.html

    old new  
    6464    <li>Tile/test_WFS.html</li> 
    6565    <li>test_Control.html</li> 
    6666    <li>Control/test_Attribution.html</li> 
     67    <li>Control/test_Button.html</li> 
    6768    <li>Control/test_SelectFeature.html</li> 
    6869    <li>Control/test_DragFeature.html</li> 
    6970    <li>Control/test_ModifyFeature.html</li> 
  • lib/OpenLayers/Control/Button.js

    old new  
     1/* Cpyright (c) 2006-2007 MetaCarta, Inc., published under a modified BSD license. 
     2 * See http://svn.openlayers.org/trunk/openlayers/repository-license.txt  
     3 * for the full text of the license. */ 
     4 
     5/** 
     6 * @requires OpenLayers/Control.js 
     7 * 
     8 * Class: OpenLayers.Control.Button  
     9 * A very simple button controlfor use with <OpenLayers.Control.Panel>. 
     10 * When clicked, the function trigger() is executed. 
     11 *  
     12 * Inherits from: 
     13 *  - <OpenLayers.Control> 
     14 * 
     15 * Use: 
     16 *  panel.addControls([ 
     17 *   new OpenLayers.Control.GenericButton( 
     18 *   {displayClass: 'MyButton', trigger: myFunction}); 
     19 *  ]); 
     20 * will create a button with CSS class MyButtonItemInactive, that 
     21 * will call the function MyFunction() when clicked. 
     22 */ 
     23OpenLayers.Control.Button = OpenLayers.Class(OpenLayers.Control, { 
     24    /** 
     25     * Property: type 
     26     * TYPE_BUTTON. 
     27     */ 
     28    type: OpenLayers.Control.TYPE_BUTTON, 
     29     
     30    /* 
     31     * Method: trigger 
     32     */ 
     33    trigger: function() {}, 
     34 
     35    CLASS_NAME: "OpenLayers.Control.Button" 
     36}); 
  • lib/OpenLayers.js

    old new  
    126126            "OpenLayers/Handler/Keyboard.js", 
    127127            "OpenLayers/Control.js", 
    128128            "OpenLayers/Control/Attribution.js", 
     129            "OpenLayers/Control/Button.js", 
    129130            "OpenLayers/Control/ZoomBox.js", 
    130131            "OpenLayers/Control/ZoomToMaxExtent.js", 
    131132            "OpenLayers/Control/DragPan.js",