Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

webobject.h

00001 /**********************************************************************
00002 ** Copyright (C) 2006 froglogic GmbH.
00003 ** All rights reserved.
00004 **
00005 ** This file is part of Squish.
00006 **
00007 ** Licensees holding a valid Squish License Agreement may use this
00008 ** file in accordance with the Squish License Agreement provided with
00009 ** the Software.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See the LICENSE file in the toplevel directory of this package.
00015 **
00016 ** Contact contact@froglogic.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 
00021 #ifndef SQUISH_WEBOBJECT
00022 #define SQUISH_WEBOBJECT
00023 
00024 #include <qstring.h>
00025 #include <qrect.h>
00026 #include "browser.h"
00027 #include <objectmodel/delegate.h>
00028 
00029 #ifndef Q_PROPERTY
00030 #define Q_PROPERTY(a)
00031 #define UNDEF_QPROPERTY
00032 #endif
00033 
00034 #if defined(Q_OS_WIN32)
00035 #define WEB_EXPORT __declspec(dllexport)
00036 #else
00037 #define WEB_EXPORT
00038 #endif
00039 
00040 namespace Squish
00041 {
00042     class WebHook;
00043 }
00044 
00045 class HTML_Object;
00046 
00047 class WEB_EXPORT HTML_Event
00048 {
00049 public:
00050     enum ModifierState {
00051         AltKey = 1,
00052         ControlKey = 2,
00053         ShiftKey = 4,
00054         ControlAlt = AltKey | ControlKey,
00055         ShiftAlt = AltKey | ShiftKey,
00056         ControlShift = ShiftKey | ControlKey
00057     };
00058 };
00059 
00060 class WEB_EXPORT HTML_XPathResult
00061 {
00062     Q_PROPERTY( bool booleanValue READ booleanValue )
00063     Q_PROPERTY( double numberValue READ numberValue )
00064     Q_PROPERTY( char stringValue READ stringValue )
00065     Q_PROPERTY( int snapshotLength READ snapshotLength )
00066 public:
00067     HTML_XPathResult( const QString &jsref ) : jsr( jsref ) {}
00068 
00069     bool booleanValue() const;
00070     double numberValue() const;
00071     HTML_Object *singleNodeValue() const;
00072     const char *stringValue() const;
00073 
00074     int snapshotLength() const;
00075     HTML_Object *snapshotItem( int index ) const;
00076 
00077 private:
00078     QString jsr;
00079 
00080 };
00081 
00082 class WEB_EXPORT HTML_Object
00083 {
00084     Q_PROPERTY( char domClassName READ domClassName )
00085     Q_PROPERTY( char tagName READ tagName )
00086     Q_PROPERTY( char innerText READ innerText )
00087     Q_PROPERTY( char innerHTML READ innerHTML )
00088     Q_PROPERTY( char title READ title )
00089     Q_PROPERTY( int numChildren READ numChildren )
00090     Q_PROPERTY( char id READ id )
00091     Q_PROPERTY( char styleDisplay READ styleDisplay )
00092     Q_PROPERTY( bool visible READ visible )
00093     Q_PROPERTY( int x READ x )
00094     Q_PROPERTY( int y READ y )
00095     Q_PROPERTY( int width READ width )
00096     Q_PROPERTY( int height READ height )
00097 
00098 public:
00099     HTML_Object( const QString &n,
00100                  const QString &jsref )
00101         : nm( n ), jsr( jsref ) {}
00102     virtual ~HTML_Object() {}
00103 
00104     virtual const char *className() const { return "HTML_Object"; }
00105 
00106     const char *domClassName() const;
00107     const char *tagName() const;
00108     const char *innerText() const;
00109     const char *innerHTML() const;
00110     const char *id() const;
00111     const char *title() const;
00112     const char *styleDisplay() const;
00113     bool visible() const;
00114 
00115     int x() const;
00116     int y() const;
00117     int width() const;
00118     int height() const;
00119 
00120     HTML_Object *firstChild();
00121     HTML_Object *lastChild();
00122     int numChildren() const;
00123     HTML_Object *nextSibling();
00124     HTML_Object *previousSibling();
00125     HTML_Object *parentElement();
00126 
00127     HTML_XPathResult evaluateXPath( const char *statement ) const;
00128 
00129     void setProperty( const char *propName, const char *value );
00130     void setProperty( const char *propName, int value );
00131     void setProperty( const char *propName, bool value );
00132     const char *property( const char *propName ) const;
00133 
00134     const char *invoke( const char *methodName ) const;
00135     const char *invoke( const char *methodName, const char *arg1 ) const;
00136     const char *invoke( const char *methodName, const char *arg1,
00137                          const char *arg2 ) const;
00138     operator const char*() const { return qstrdup( jsr.utf8().data() ); }
00139 
00140     void invalidate();
00141 
00142     virtual void click( int mod = 0, int x = 0, int y = 0 );
00143     virtual void doubleClick( int mod = 0, int x = 0, int y = 0 );
00144 
00145     QString name() const;
00146     const char *hierarchicalQualifiedName() const;
00147 
00148 protected:
00149     QString jsReference() const { return jsr; }
00150 
00151     Squish::WebHook *webHook() const;
00152     QString eval( const QString &code ) const;
00153     QRect getElementRect() const;
00154 
00155     QString clickOn( const char *jsref, int m = 0, int x = 0, int y = 0 );
00156     QString dblClickOn( const char *jsref, int m = 0, int x = 0, int y = 0 );
00157 
00158 private:
00159     mutable QString nm;
00160     mutable QString hm;
00161     QString jsr;
00162 
00163 };
00164 
00165 class WEB_EXPORT HTML_Array : public HTML_Object
00166 {
00167     Q_PROPERTY( int length READ length )
00168 
00169 public:
00170     HTML_Array( const QString &n,
00171                 const QString &jsref )
00172         : HTML_Object( n, jsref ) {}
00173 
00174     virtual const char *className() const { return "HTML_Array"; }
00175 
00176     HTML_Object *at( int i ) const;
00177     int length() const;
00178 
00179 };
00180 
00181 class WEB_EXPORT HTML_Document : public HTML_Object
00182 {
00183 public:
00184     HTML_Document( const QString &n,
00185                    const QString &jsref )
00186         : HTML_Object( n, jsref ) {}
00187 
00188     virtual const char *className() const { return "HTML_Document"; }
00189 
00190     HTML_Array getElementsByTagName( const char *tagName ) const;
00191     HTML_Object *getElementById( const char *id ) const;
00192 
00193 };
00194 
00195 class WEB_EXPORT HTML_Form : public HTML_Object
00196 {
00197 public:
00198     HTML_Form( const QString &n,
00199                const QString &jsref )
00200         : HTML_Object( n, jsref ) {}
00201 
00202     virtual const char *className() const { return "HTML_Form"; }
00203 
00204     void submit();
00205 
00206 };
00207 
00208 class WEB_EXPORT HTML_Image : public HTML_Object
00209 {
00210 public:
00211     HTML_Image( const QString &n,
00212                 const QString &jsref )
00213         : HTML_Object( n, jsref ) {}
00214 
00215     virtual const char *className() const { return "HTML_Image"; }
00216 };
00217 
00218 class WEB_EXPORT HTML_FormElement : public HTML_Object
00219 {
00220     Q_PROPERTY( bool disabled READ disabled WRITE setDisabled )
00221     Q_PROPERTY( char type READ type )
00222 
00223 public:
00224     HTML_FormElement( const QString &n,
00225                       const QString &jsref )
00226         : HTML_Object( n, jsref ) {}
00227 
00228     virtual const char *className() const { return "HTML_FormElement"; }
00229     bool disabled() const;
00230     void setDisabled( bool b );
00231 
00232     const char *type() const;
00233 
00234     virtual void focus();
00235 
00236 };
00237 
00238 class WEB_EXPORT HTML_ButtonBase : public HTML_FormElement
00239 {
00240     Q_PROPERTY( char value READ value WRITE setValue )
00241 
00242 public:
00243     HTML_ButtonBase( const QString &n,
00244                      const QString &jsref )
00245         : HTML_FormElement( n, jsref ) {}
00246 
00247     virtual const char *className() const { return "HTML_ButtonBase"; }
00248 
00249     void setValue( const char *t );
00250     const char *value() const;
00251 
00252     virtual void click( int mod = 0, int x = 0, int y = 0 );
00253 
00254 };
00255 
00256 class WEB_EXPORT HTML_Button : public HTML_ButtonBase
00257 {
00258 public:
00259     HTML_Button( const QString &n,
00260                  const QString &jsref )
00261         : HTML_ButtonBase( n, jsref ) {}
00262 
00263     virtual const char *className() const { return "HTML_Button"; }
00264 
00265     void submit();
00266 
00267 };
00268 
00269 class WEB_EXPORT HTML_RadioButton : public HTML_ButtonBase
00270 {
00271     Q_PROPERTY( bool checked READ checked WRITE setChecked )
00272 
00273 public:
00274     HTML_RadioButton( const QString &n,
00275                       const QString &jsref )
00276         : HTML_ButtonBase( n, jsref ) {}
00277 
00278     virtual const char *className() const { return "HTML_RadioButton"; }
00279 
00280     void setChecked( bool b );
00281     bool checked() const;
00282 
00283     void click( int mod = 0, int x = 0, int y = 0 );
00284 };
00285 
00286 class WEB_EXPORT HTML_CheckBox : public HTML_ButtonBase
00287 {
00288     Q_PROPERTY( bool checked READ checked WRITE setChecked )
00289 
00290 public:
00291     HTML_CheckBox( const QString &n,
00292                    const QString &jsref )
00293         : HTML_ButtonBase( n, jsref ) {}
00294 
00295     virtual const char *className() const { return "HTML_CheckBox"; }
00296 
00297     void setChecked( bool b );
00298     bool checked() const;
00299 
00300     void click( int mod = 0, int x = 0, int y = 0 );
00301 };
00302 
00303 class WEB_EXPORT HTML_ImageButton : public HTML_ButtonBase
00304 {
00305 public:
00306     HTML_ImageButton( const QString &n,
00307                       const QString &jsref )
00308         : HTML_ButtonBase( n, jsref ) {}
00309 
00310     virtual const char *className() const { return "HTML_ImageButton"; }
00311 
00312 };
00313 
00314 class WEB_EXPORT HTML_TextBase : public HTML_FormElement
00315 {
00316     Q_PROPERTY( char value READ value WRITE setValue )
00317 
00318 public:
00319     HTML_TextBase( const QString &n,
00320                    const QString &jsref )
00321         : HTML_FormElement( n, jsref ) {}
00322 
00323     virtual const char *className() const { return "HTML_TextBase"; }
00324 
00325     void setValue( const char *t );
00326     const char *value() const;
00327 
00328 };
00329 
00330 class WEB_EXPORT HTML_Text : public HTML_TextBase
00331 {
00332 public:
00333     HTML_Text( const QString &n,
00334                const QString &jsref )
00335         : HTML_TextBase( n, jsref ) {}
00336 
00337     virtual const char *className() const { return "HTML_Text"; }
00338 
00339 };
00340 
00341 class WEB_EXPORT HTML_TextArea : public HTML_TextBase
00342 {
00343 public:
00344     HTML_TextArea( const QString &n,
00345                    const QString &jsref )
00346         : HTML_TextBase( n, jsref ) {}
00347 
00348     virtual const char *className() const { return "HTML_TextArea"; }
00349 
00350 };
00351 
00352 class WEB_EXPORT HTML_Option : public HTML_Object
00353 {
00354     Q_PROPERTY( char value READ value WRITE setValue )
00355     Q_PROPERTY( char text READ text WRITE setText )
00356     Q_PROPERTY( bool defaultSelected READ defaultSelected )
00357     Q_PROPERTY( bool selected READ selected )
00358     Q_PROPERTY( int index READ index )
00359 
00360 public:
00361     HTML_Option( const QString &n,
00362                  const QString &jsref )
00363         : HTML_Object( n, jsref ) {}
00364 
00365     virtual const char *className() const { return "HTML_Option"; }
00366 
00367     bool defaultSelected() const;
00368     int index() const;
00369     bool selected() const;
00370     void setValue( const char *t );
00371     const char *value() const;
00372     void setText( const char *t );
00373     const char *text() const;
00374 
00375 };
00376 
00377 class WEB_EXPORT HTML_Select : public HTML_FormElement
00378 {
00379     Q_PROPERTY( int selectedIndex READ selectedIndex WRITE setSelectedIndex )
00380     Q_PROPERTY( char selectedOption READ selectedOption WRITE setSelectedOption )
00381 
00382 
00383 public:
00384     HTML_Select( const QString &n,
00385                  const QString &jsref,
00386                  bool m )
00387         : HTML_FormElement( n, jsref ), multi( m ) {}
00388 
00389     virtual const char *className() const { return "HTML_Select"; }
00390 
00391     virtual void setSelectedIndex( int i );
00392     virtual int selectedIndex() const;
00393 
00394     virtual void setSelectedOption( const char *text );
00395     virtual const char *selectedOption() const;
00396 
00397     virtual HTML_Array options() const;
00398     HTML_Option *optionAt( int index ) const;
00399 
00400     bool isMulti() const { return multi; }
00401 
00402 private:
00403     bool multi;
00404 };
00405 
00406 class WEB_EXPORT HTML_Anchor : public HTML_Object
00407 {
00408 public:
00409     HTML_Anchor( const QString &n,
00410                  const QString &jsref )
00411         : HTML_Object( n, jsref ) {}
00412 
00413     virtual const char *className() const { return "HTML_Anchor"; }
00414 
00415     void click( int mod = 0, int x = 0, int y = 0 );
00416 
00417 };
00418 
00419 
00420 class WEB_EXPORT HTML_TreeBase : public HTML_FormElement
00421 {
00422 public:
00423     HTML_TreeBase( const QString &n,
00424                    const QString &jsref )
00425         : HTML_FormElement( n, jsref ) {}
00426 
00427     virtual const char *className() const { return "HTML_TreeBase"; }
00428 
00429     virtual void clickHandle( const char *item ) = 0;
00430     virtual void clickItem( const char *item, int m ) = 0;
00431     virtual void doubleClickItem( const char *item, int m = 0 ) {}
00432 
00433     virtual bool hasItem( const char *item ) = 0;
00434     virtual bool isSelected( const char *item ) = 0;
00435     virtual bool isOpen( const char *item ) = 0;
00436 
00437 };
00438 
00439 // --------------------------------- KIWI JS lib ------------------------
00440 
00441 class WEB_EXPORT HTML_KiwiChoice : public HTML_FormElement
00442 {
00443     Q_PROPERTY( int selectedValue READ selectedValue WRITE setSelectedValue )
00444     Q_PROPERTY( char selectedOption READ selectedOption WRITE setSelectedOption )
00445 
00446 
00447 public:
00448     HTML_KiwiChoice( const QString &n,
00449                      const QString &jsref )
00450         : HTML_FormElement( n, jsref ) {}
00451 
00452     virtual const char *className() const { return "HTML_KiwiChoice"; }
00453 
00454     void setSelectedValue( int i );
00455     int selectedValue() const;
00456 
00457     void setSelectedOption( const char *text );
00458     const char *selectedOption() const;
00459 
00460 };
00461 
00462 class WEB_EXPORT HTML_KiwiTree : public HTML_TreeBase
00463 {
00464 public:
00465     HTML_KiwiTree( const QString &n,
00466                    const QString &jsref )
00467         : HTML_TreeBase( n, jsref ) {}
00468 
00469     virtual const char *className() const { return "HTML_KiwiTree"; }
00470 
00471     void clickHandle( const char *item );
00472     void clickItem( const char *item, int m );
00473 
00474     bool hasItem( const char *item );
00475     bool isSelected( const char *item );
00476     bool isOpen( const char *item );
00477 
00478 private:
00479     QString findItem( const char *item );
00480 
00481 };
00482 
00483 class HTML_KiwiTableCell;
00484 class HTML_KiwiTreeTableCell;
00485 
00486 class WEB_EXPORT HTML_KiwiTable : public HTML_FormElement
00487 {
00488     Q_PROPERTY( int numRows READ numRows )
00489     Q_PROPERTY( int numColumns READ numColumns )
00490     Q_PROPERTY( int numGroups READ numGroups )
00491 
00492 public:
00493     HTML_KiwiTable( const QString &n,
00494                    const QString &jsref )
00495         : HTML_FormElement( n, jsref ) {}
00496 
00497     virtual const char *className() const { return "HTML_KiwiTable"; }
00498 
00499     void clickItem( const char *item, int m );
00500     void clickRow( const char *rowText, int m );
00501     void clickRow( int row, int m = 0 );
00502     bool hasItem( const char *item );
00503     bool isSelected( const char *item );
00504     bool rowSelected( int row ) const;
00505     HTML_KiwiTableCell *findItem( const char *item, int startRow = -1 );
00506     HTML_KiwiTableCell *findItem( int row, int col = 0 );
00507 
00508     int numRows() const;
00509     int numColumns() const;
00510     int numGroups() const;
00511 
00512     const char *caption( int column ) const;
00513     const char *groupCaption( int column ) const;
00514     const char *groupCaptionOfColumn( int column ) const;
00515 
00516 private:
00517     QString findItemInternal( const char *item );
00518 
00519 };
00520 
00521 class WEB_EXPORT HTML_KiwiTreeTable : public HTML_FormElement
00522 {
00523     Q_PROPERTY( int numRows READ numRows )
00524     Q_PROPERTY( int numColumns READ numColumns )
00525     Q_PROPERTY( int numGroups READ numGroups )
00526 
00527 public:
00528     HTML_KiwiTreeTable( const QString &n,
00529                    const QString &jsref )
00530         : HTML_FormElement( n, jsref ) {}
00531 
00532     virtual const char *className() const { return "HTML_KiwiTreeTable"; }
00533 
00534     void clickItem( const char *item, int m );
00535     void clickRow( const char *rowText, int m );
00536     void clickRow( int row, int m = 0 );
00537     bool hasItem( const char *item );
00538     bool isSelected( const char *item );
00539     bool rowSelected( int row ) const;
00540     HTML_KiwiTreeTableCell *findItem( const char *item, int startRow = -1 );
00541     HTML_KiwiTreeTableCell *findItem( int row, int col = 0 );
00542 
00543     int numRows() const;
00544     int numColumns() const;
00545     int numGroups() const;
00546 
00547     const char *caption( int column ) const;
00548     const char *groupCaption( int column ) const;
00549     const char *groupCaptionOfColumn( int column ) const;
00550 
00551 private:
00552     QString findItemInternal( const char *item );
00553 
00554 };
00555 
00556 class WEB_EXPORT HTML_KiwiMoreMenuItem : public HTML_FormElement
00557 {
00558     Q_PROPERTY( char itemText READ itemText )
00559 
00560 public:
00561     HTML_KiwiMoreMenuItem( const QString &n,
00562                            const QString &jsref )
00563         : HTML_FormElement( n, jsref ) {}
00564 
00565     virtual const char *className() const { return "HTML_KiwiMoreMenuItem"; }
00566 
00567     const char *itemText() const;
00568 
00569 };
00570 
00571 class WEB_EXPORT HTML_KiwiMoreMenu : public HTML_FormElement
00572 {
00573     Q_PROPERTY( int numItems READ numItems )
00574 
00575 public:
00576     HTML_KiwiMoreMenu( const QString &n,
00577                        const QString &jsref )
00578         : HTML_FormElement( n, jsref ) {}
00579 
00580     virtual const char *className() const { return "HTML_KiwiMoreMenu"; }
00581 
00582     bool activateItem( const char *item );
00583 
00584     int numItems() const;
00585     HTML_KiwiMoreMenuItem *itemAt( int i ) const;
00586 
00587 private:
00588     void getItems() const;
00589 
00590 private:
00591     mutable QString itemsRef;
00592 
00593 };
00594 
00595 class WEB_EXPORT HTML_KiwiTableCell : public HTML_Object
00596 {
00597     Q_PROPERTY( int row READ row )
00598     Q_PROPERTY( int column READ column )
00599     Q_PROPERTY( bool selected READ isSelected )
00600 
00601 public:
00602     HTML_KiwiTableCell( const QString &n,
00603                         const QString &jsref,
00604                         const QString &tjs )
00605       : HTML_Object( n, jsref ), table( tjs ) {}
00606 
00607     virtual const char *className() const { return "HTML_KiwiTableCell"; }
00608 
00609     int row() const;
00610     int column() const;
00611     bool isSelected() const;
00612 
00613 private:
00614     QString table;
00615 
00616 };
00617 
00618 class WEB_EXPORT HTML_KiwiTreeTableCell : public HTML_Object
00619 {
00620     Q_PROPERTY( int row READ row )
00621     Q_PROPERTY( int column READ column )
00622     Q_PROPERTY( bool selected READ isSelected )
00623 
00624 public:
00625     HTML_KiwiTreeTableCell( const QString &n,
00626                         const QString &jsref,
00627                         const QString &tjs )
00628       : HTML_Object( n, jsref ), table( tjs ) {}
00629 
00630     virtual const char *className() const { return "HTML_KiwiTreeTableCell"; }
00631 
00632     int row() const;
00633     int column() const;
00634     bool isSelected() const;
00635 
00636 private:
00637     QString table;
00638 
00639 };
00640 
00641 // --------------------------------- DOJO JS lib ------------------------
00642 
00643 class WEB_EXPORT HTML_DojoTree : public HTML_TreeBase
00644 {
00645 public:
00646     HTML_DojoTree( const QString &n,
00647                    const QString &jsref )
00648         : HTML_TreeBase( n, jsref ) {}
00649 
00650     virtual const char *className() const { return "HTML_DojoTree"; }
00651 
00652     void clickHandle( const char *item );
00653     void clickItem( const char *item, int m );
00654     void doubleClickItem( const char *item, int m = 0 );
00655 
00656     bool hasItem( const char *item );
00657     bool isSelected( const char *item );
00658     bool isOpen( const char *item );
00659 
00660 private:
00661     QString findItem( const char *item );
00662 
00663 };
00664 
00665 class WEB_EXPORT HTML_DojoSplitPane : public HTML_FormElement
00666 {
00667 public:
00668     HTML_DojoSplitPane( const QString &n,
00669                         const QString &jsref )
00670         : HTML_FormElement( n, jsref ) {}
00671 
00672     virtual const char *className() const { return "HTML_DojoSplitPane"; }
00673 
00674     void clickItem( const char *item, int m );
00675 
00676 };
00677 
00678 // --------------------------------- BACKBASE JS lib ------------------------
00679 
00680 class WEB_EXPORT HTML_BackBaseButton : public HTML_ButtonBase
00681 {
00682 public:
00683     HTML_BackBaseButton( const QString &n,
00684                          const QString &jsref )
00685         : HTML_ButtonBase( n, jsref ) {}
00686 
00687     virtual const char *className() const { return "HTML_BackBaseButton"; }
00688 
00689 };
00690 
00691 class WEB_EXPORT HTML_BackBaseComboBox : public HTML_Select
00692 {
00693     Q_PROPERTY( int numOptions READ numOptions )
00694 public:
00695     HTML_BackBaseComboBox( const QString &n,
00696                            const QString &jsref,
00697                            bool m )
00698         : HTML_Select( n, jsref, m ) { }
00699 
00700     virtual const char *className() const { return "HTML_BackBaseComboBox"; }
00701 
00702     virtual void setSelectedIndex( int i );
00703     virtual int selectedIndex() const;
00704 
00705     virtual void setSelectedOption( const char *text );
00706     virtual const char *selectedOption() const;
00707 
00708     int numOptions() const;
00709     const char *optionAt( int idx ) const;
00710 };
00711 
00712 class WEB_EXPORT HTML_BackBaseSpinner : public HTML_FormElement
00713 {
00714     Q_PROPERTY( int startValue READ startValue )
00715     Q_PROPERTY( int value READ value WRITE setValue )
00716     Q_PROPERTY( int endValue READ endValue )
00717     Q_PROPERTY( int step READ step )
00718     Q_PROPERTY( bool isLooping READ isLooping )
00719 public:
00720     HTML_BackBaseSpinner( const QString &n, const QString &jsref )
00721         : HTML_FormElement( n, jsref ) { }
00722 
00723     virtual const char *className() const { return "HTML_BackBaseSpinner"; }
00724 
00725     int startValue() const;
00726     int endValue() const;
00727     int step() const;
00728     bool isLooping() const;
00729 
00730     int value() const;
00731     void setValue( int v );
00732 
00733     virtual void focus();
00734 };
00735 
00736 class WEB_EXPORT HTML_BackBaseListView : public HTML_FormElement
00737 {
00738     Q_PROPERTY( int numRows READ numRows )
00739     Q_PROPERTY( int numColumns READ numColumns )
00740 
00741 public:
00742     HTML_BackBaseListView( const QString &n,
00743                            const QString &jsref )
00744         : HTML_FormElement( n, jsref ) {}
00745 
00746     virtual const char *className() const { return "HTML_BackBaseListView"; }
00747 
00748     void clickItem( const char *item, int m );
00749     bool hasItem( const char *item );
00750     bool isSelected( const char *item );
00751     const char *itemText( int row, int col );
00752 
00753     int numRows() const;
00754     int numColumns() const;
00755 
00756     const char *caption( int column ) const;
00757 
00758 };
00759 
00760 class WEB_EXPORT HTML_GWCFormFieldBox : public HTML_FormElement
00761 {
00762 public:
00763     HTML_GWCFormFieldBox( const QString &n,
00764                           const QString &jsref )
00765         : HTML_FormElement( n, jsref ) {}
00766 
00767     virtual const char *className() const { return "HTML_GWCFormFieldBox"; }
00768 
00769     void clickItem( const char *item, int m );
00770 };
00771 
00772 class WEB_EXPORT HTML_GWCTable : public HTML_FormElement
00773 {
00774 public:
00775     HTML_GWCTable( const QString &n,
00776                    const QString &jsref )
00777         : HTML_FormElement( n, jsref ) {}
00778 
00779     virtual const char *className() const { return "HTML_GWCTable"; }
00780 
00781     void clickItem( const char *item, int m );
00782 };
00783 
00784 class HTML_QxWidgetElement;
00785 
00786 class WEB_EXPORT HTML_QxWidget : public HTML_Object
00787 {
00788     Q_PROPERTY( char qxClassName READ qxClassName )
00789     Q_PROPERTY( int qxChildrenLength READ qxChildrenLength )
00790     Q_PROPERTY( char qxName READ qxName )
00791     Q_PROPERTY( char qxLabel READ qxLabel )
00792     Q_PROPERTY( char qxCaption READ qxCaption )
00793     Q_PROPERTY( bool qxSelected READ qxSelected WRITE qxSetSelected )
00794     Q_PROPERTY( bool qxChecked READ qxChecked WRITE qxSetChecked )
00795 
00796 public:
00797     HTML_QxWidget( const QString &n,
00798                    const QString &jsref )
00799         : HTML_Object( n, jsref ) {}
00800 
00801     virtual const char *className() const { return "HTML_QxWidget"; }
00802     const char *qxClassName() const;
00803     const char *qxLabel() const;
00804     const char *qxName() const;
00805     const char *qxCaption() const;
00806     HTML_QxWidget *qxParent() const;
00807     HTML_Array qxChildren() const;
00808     int qxChildrenLength() const;
00809     HTML_QxWidget *qxChild( int index ) const;
00810     bool qxSelected() const;
00811     bool qxChecked() const;
00812     void qxSetSelected( bool selected );
00813     void qxSetChecked( bool checked );
00814     HTML_QxWidgetElement *qxElement() const;
00815 
00816 };
00817 
00818 class WEB_EXPORT HTML_QxWidgetElement : public HTML_Object
00819 {
00820 public:
00821     HTML_QxWidgetElement( const QString &n,
00822                           const QString &jsref )
00823         : HTML_Object( n, jsref ) {}
00824 
00825     virtual const char *className() const { return "HTML_QxWidgetElement"; }
00826     HTML_QxWidget *qxWidget() const;
00827 };
00828 
00829 // --------------------------------- Custom JS lib ------------------------
00830 
00831 class HTML_CustomItem;
00832 
00833 class WEB_EXPORT HTML_CustomItemView : public HTML_FormElement
00834 {
00835     Q_PROPERTY( char realType READ realType )
00836     Q_PROPERTY( int numColumns READ numColumns )
00837 
00838 public:
00839     HTML_CustomItemView( const QString &n,
00840                          const QString &jsref,
00841                          const QString rt )
00842         : HTML_FormElement( n, jsref ), rtype( rt ) {}
00843 
00844     virtual const char *className() const { return "HTML_CustomItemView"; }
00845 
00846     void clickHandle( const char *item );
00847     void clickItem( const char *item, int m );
00848     void doubleClickItem( const char *item, int m = 0 );
00849 
00850     bool hasItem( const char *item );
00851     bool isSelected( const char *item );
00852     bool isOpen( const char *item );
00853 
00854     HTML_CustomItem *findItem( const char *text );
00855     HTML_CustomItem *childItem( int column = -1 );
00856 
00857     const char *columnCaption( int column );
00858     int numColumns() const;
00859 
00860     const char *realType() const { return qstrdup( rtype.latin1() ); }
00861 
00862 private:
00863     QString rtype;
00864 
00865 };
00866 
00867 class WEB_EXPORT HTML_CustomItem : public HTML_Object
00868 {
00869     Q_PROPERTY( char realType READ realType )
00870     Q_PROPERTY( char text READ text )
00871     Q_PROPERTY( bool open READ isOpen WRITE setOpen )
00872     Q_PROPERTY( bool selected READ isSelected WRITE setSelected )
00873 
00874 public:
00875     HTML_CustomItem( const QString &n,
00876                      const QString &jsref,
00877                      const QString rt )
00878         : HTML_Object( n, jsref ), rtype( rt ) {}
00879 
00880     virtual const char *className() const { return "HTML_CustomItem"; }
00881 
00882     bool isOpen() const;
00883     bool isSelected();
00884 
00885     void setOpen( bool open );
00886     void setSelected( bool selected );
00887 
00888     const char *text() const;
00889 
00890     HTML_Object *itemHandle() const;
00891 
00892     const char *realType() const { return qstrdup( rtype.latin1() ); }
00893 
00894     HTML_CustomItem *childItem( int column = -1 );
00895     HTML_CustomItem *parentItem( int column = -1 );
00896     HTML_CustomItem *nextSibling( int column = -1 );
00897     HTML_CustomItemView *itemView();
00898 
00899 private:
00900     QString rtype;
00901 
00902 };
00903 
00904 
00905 class CustomViewItemPropertyDelegate : public Squish::DynamicPropertyDelegate
00906 {
00907 public:
00908     CustomViewItemPropertyDelegate( const QString &cn = "HTML_CustomItem" );
00909 
00910     int numProperties( Squish::Object::Ptr ) const;
00911     Squish::Object::Ptr property( Squish::Object::Ptr, int num ) const;
00912     Squish::Object::Ptr property( Squish::Object::Ptr object, const QString &name ) const;
00913     QString name( Squish::Object::Ptr ) const;
00914     QString qualifiedName( Squish::Object::Ptr object ) const;
00915 
00916 };
00917 
00918 
00919 #ifdef UNDEF_QPROPERTY
00920 #undef Q_PROPERTY
00921 #endif
00922 
00923 #endif

Generated on Mon Jun 11 15:49:45 2007 for Squish HTML API by  doxygen 1.4.4