/*---------------- FILE HEADER --------------------------------------- This file is part of Geoide. Copyright (C) 2005-2006 by: IDgis B.V. http://www.idgis.nl This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact: Herman Assink IDgis bv P.O. Box 15 7450 AA Holten The Netherlands E-Mail: herman.assink@idgis.nl * @version 1.4.0 * @author IDgis team * ------------------------------------------------------------------------*/ import nl.idgis.giclient.framework.buttons.GIButton; class nl.idgis.giclient.framework.buttons.PaneButton extends GIButton { private var singlePaneComponent:Object = null; private var textSize:Number = 20; private var textColor:Number = 0xffffff; private var labelWidth:Number = 0; function getWidth():Number { return (super.getWidth() + labelWidth); } function setLabel(labelText:String, labelPlacement:String):Void { if (labelText != null) { var textFormat:TextFormat = new TextFormat(); textFormat.font = "Tahoma"; textFormat.size = textSize; //textFormat.bold = true; textFormat.color = textColor; var textExtent:Object = textFormat.getTextExtent(labelText); labelWidth = textExtent.textFieldWidth; var x:Number = 0; var y:Number = (0 - textSize) / 2 - 4; var alignment:String = ""; if (labelPlacement == "Left") { alignment = "right"; x = -18 - labelWidth; } else { alignment = "left"; x = 18; } textFormat.align = alignment; createTextField("label", 0, x, y, labelWidth, textExtent.textFieldHeight); this["label"].setNewTextFormat(textFormat); this["label"].text = labelText; if (labelPlacement == "Left") { _x += labelWidth; } } } function setSinglePaneComponent(singlePaneComponent:Object):Void { this.singlePaneComponent = singlePaneComponent; } function onRelease() { if(name == "LoginButton") { getURL("edit/"); } else { singlePaneComponent.togglePaneVisible(); } } }