OpenLayers OpenLayers

Ticket #872: button.patch

File button.patch, 3.1 kB (added by tschaub, 1 year ago)

button

  • 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</body> 
     17</html> 
  • tests/list-tests.html

    old new  
    7373    <li>Tile/test_WFS.html</li> 
    7474    <li>test_Control.html</li> 
    7575    <li>Control/test_Attribution.html</li> 
     76    <li>Control/test_Button.html</li> 
    7677    <li>Control/test_DragFeature.html</li> 
    7778    <li>Control/test_DragPan.html</li> 
    7879    <li>Control/test_LayerSwitcher.html</li> 
  • lib/OpenLayers/Control/Button.js

    old new  
     1/* Copyright (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 
     9/** 
     10 * Class: OpenLayers.Control.Button  
     11 * A very simple button controlfor use with <OpenLayers.Control.Panel>. 
     12 * When clicked, the function trigger() is executed. 
     13 *  
     14 * Inherits from: 
     15 *  - <OpenLayers.Control> 
     16 * 
     17 * Use: 
     18 * (code) 
     19 * var button = new OpenLayers.Control.Button({ 
     20 *     displayClass: "MyButton", trigger: myFunction 
     21 * }); 
     22 * panel.addControls([button]); 
     23 * (end) 
     24 *  
     25 * Will create a button with CSS class MyButtonItemInactive, that 
     26 *     will call the function MyFunction() when clicked. 
     27 */ 
     28OpenLayers.Control.Button = OpenLayers.Class(OpenLayers.Control, { 
     29    /** 
     30     * Property: type 
     31     * {Integer} OpenLayers.Control.TYPE_BUTTON. 
     32     */ 
     33    type: OpenLayers.Control.TYPE_BUTTON, 
     34     
     35    /* 
     36     * Method: trigger 
     37     * Called by a control panel when the button is clicked. 
     38     */ 
     39    trigger: function() {}, 
     40 
     41    CLASS_NAME: "OpenLayers.Control.Button" 
     42}); 
  • lib/OpenLayers.js

    old new  
    129129            "OpenLayers/Handler/Keyboard.js", 
    130130            "OpenLayers/Control.js", 
    131131            "OpenLayers/Control/Attribution.js", 
     132            "OpenLayers/Control/Button.js", 
    132133            "OpenLayers/Control/ZoomBox.js", 
    133134            "OpenLayers/Control/ZoomToMaxExtent.js", 
    134135            "OpenLayers/Control/DragPan.js",