/* * $Id$ */ /* * Harbour Project source code: * Editing and Forms Class for HTMLLIB * * Copyright 2000 Manos Aspradakis * www - http://www.harbour-project.org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version, with one exception: * * The exception is that if you link the Harbour Runtime Library (HRL) * and/or the Harbour Virtual Machine (HVM) with other files to produce * an executable, this does not by itself cause the resulting executable * to be covered by the GNU General Public License. Your use of that * executable is in no way restricted on account of linking the HRL * and/or HVM code into it. * * This program 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 General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA (or visit * their web site at http://www.gnu.org/). * */ /* * The following parts are Copyright of the individual authors. * www - http://www.harbour-project.org * * Copyright 2000 Luiz Rafael Culik * Porting this library to Harbour * * See doc/license.txt for licensing terms. * */ #include "hbclass.ch" #include "default.ch" #include "forms.ch" #include "html.ch" #define _OPTION_TEXT 1 #define _OPTION_VALUE 2 #define _OPTION_LABEL 3 #define _OPTION_SELECTED 4 #define _OPTION_DISABLED 5 STATIC soForm /**** * * Class HControl() * * */ CLASS HControl // ALIAS hCtr DATA nH DATA Document DATA Form DATA Caption DATA lBreak INIT .F. DATA Type INIT "TEXT" DATA Name DATA Value DATA Size DATA rows, cols DATA cOutPut INIT "" DATA Picture INIT "@X" DATA aOptions INIT {} // SELECT options DATA TabIndex INIT 0 DATA disabled INIT .F. DATA readOnly INIT .F. DATA Multiple INIT .F. DATA style DATA id DATA MaxLength // length in chars DATA MaxChars // length on screen DATA Checked INIT .F. // checkboxes... DATA lLabel init .f. DATA Source, Align // images... DATA Wrap // textarea DATA onBlur DATA onChange DATA onFocus DATA onSelect DATA onClick DATA onMouseOver DATA onMouseOut DATA onMouseDown DATA onMouseup DATA onKeyPress DATA onKeyDown DATA onKeyUp DATA onSelect METHOD SetName( c ) INLINE ::Name := c METHOD SetValue( c ) INLINE ::Value := c METHOD SetStyle( c ) INLINE ::Style := c METHOD SetId( c ) INLINE ::id := c METHOD SetRows( c ) INLINE ::Rows := c METHOD SetCols( c ) INLINE ::Cols := c METHOD SetCaption(c) INLINE ::Caption := c METHOD SetPicture(c) INLINE ::picture := c METHOD SetOnBlur(c) INLINE ::onBlur := c METHOD SetOnChange(c) INLINE ::onChange := c METHOD SetOnFocus(c) INLINE ::onFocus := c METHOD SetOnSelect(c) INLINE ::onSelect := c METHOD SetOnClick(c) INLINE ::onClick := c METHOD SetOnMsOver(c) INLINE ::onMouseOver := c METHOD SetOnMsOut(c) INLINE ::onMouseOut := c METHOD SetSize( n ) INLINE ::Size := n METHOD SetMaxChars( n ) INLINE ::MaxChars := n METHOD SetChecked( l ) INLINE ::Checked := l METHOD SetAlign( c ) INLINE ::Align := c METHOD SetWrap( c ) INLINE ::wrap := c METHOD SetSource( c ) INLINE ::Source := c METHOD SetReadOnly( l ) INLINE ::readOnly := l METHOD SetDisabled( l ) INLINE ::disabled := l METHOD SetMultiple( l ) INLINE ::multiple := l METHOD SetOnMsDown(c) INLINE ::onMouseDown := c METHOD SetOnMsUp(c) INLINE ::onMouseup := c METHOD SetOnKPress(c) INLINE ::onKeyPress := c METHOD SetOnKDown(c) INLINE ::onKeyDown := c METHOD SetOnKUp(c) INLINE ::onKeyUp := c METHOD SetOnSelect(c) INLINE ::onSelect := c METHOD SetLabel(l) INLINE ::lLabel := l //METHOD Debug() INLINE __clsDebug( self ) METHOD Put(lPut) METHOD AddOption( cOption, cValue, cLabel, lSelected, lDisabled ) METHOD SetControl( name,rows,cols,size,maxchars,value,onfocus,; onblur,onchange,onselect,onclick,onmsover,onmsout,; onmsdown,onmsup,onkdown,onkup,onkprs, ; pic,cap,dis,ro,lMulti,checked,; align,wrap,type, Style, Id ,lLabel) ENDCLASS /**** * * HControl():Put() * * */ method Put(lPut) CLASS HControl LOCAL i, cStr := "" ::nH := pageHandle() ::form := currentForm() ::cOutput += IF( ::lBreak, CRLF()+"
", CRLF() ) IF ::lLabel ::cOutPut+=CRLF()+"