2
* Copyright (C) 2007-2008 Camptocamp
4
* This file is part of MapFish Client
6
* MapFish Client is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* MapFish Client is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with MapFish Client. If not, see <http://www.gnu.org/licenses/>.
20
Ext.namespace('mapfish.widgets.toolbar');
23
* Class: mapfish.widgets.toolbar.MenuItem
24
* A Menu item is associated with an OpenLayers Control of type BUTTON and will call trigger on it.
25
* This class also add quicktips.
27
* Simple example usage:
29
* var menuItem = new mapfish.widgets.toolbar.MenuItem({
30
* text: 'My menu item',
31
* tooltip: 'My tooltip',
32
* icon: 'lib/openlayers/theme/default/img/icon_roi_feature.png',
33
* control: new OpenLayers.Control.ROISelect({map: map})
42
* Constructor: mapfish.widgets.toolbar.MenuItem
43
* Create a new MenuItem.
46
* config - {Object} Config object
49
mapfish.widgets.toolbar.MenuItem = function(config) {
50
Ext.apply(this, config);
51
mapfish.widgets.toolbar.MenuItem.superclass.constructor.call(this);
54
Ext.extend(mapfish.widgets.toolbar.MenuItem, Ext.menu.Item, {
57
initComponent: function() {
58
mapfish.widgets.toolbar.MenuItem.superclass.initComponent.call(this);
62
this.handler = function() { this.control.trigger(); };
67
onRender : function(container, position) {
68
mapfish.widgets.toolbar.MenuItem.superclass.onRender.apply(this, arguments);
70
this.el.dom.qtip = this.tooltip;
74
Ext.reg('menuitem', mapfish.widgets.toolbar.MenuItem);