summaryrefslogtreecommitdiffstats
path: root/experimental/tqtinterface/qt4/src/kernel/tqlayout.h
blob: 5423cad5b6598db28d5865ca09f744ba74dd071b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
/****************************************************************************
**
** Definition of tqlayout classes
**
** Created : 960416
**
** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
**
** This file is part of the kernel module of the TQt GUI Toolkit.
**
** This file may be used under the terms of the GNU General
** Public License versions 2.0 or 3.0 as published by the Free
** Software Foundation and appearing in the files LICENSE.GPL2
** and LICENSE.GPL3 included in the packaging of this file.
** Alternatively you may (at your option) use any later version
** of the GNU General Public License if such license has been
** publicly approved by Trolltech ASA (or its successors, if any)
** and the KDE Free TQt Foundation.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/.
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at sales@trolltech.com.
**
** This file may be used under the terms of the Q Public License as
** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
** included in the packaging of this file.  Licensees holding valid TQt
** Commercial licenses may use this file in accordance with the TQt
** Commercial License Agreement provided with the Software.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
** herein.
**
**********************************************************************/

// TQT TODO:
// 1. TQLayout and TQGridLayout addItem functions may not be able to be subclassed by TQt classes
//    This will probably require an inline redirect from the Qt4 method addItem(QLayoutItem) to the TQt method addItem(TQLayoutItem)
//    See also TQLayout::setGeometry() for an example of how to do this
//    See tqlayout.cpp line 3074 for why this is needed
//    MAYBE?????

#ifndef TQLAYOUT_H
#define TQLAYOUT_H

#include "tqtglobaldefines.h"

#ifndef TQT_H
#include "tqobject.h"
#include "tqsizepolicy.h"
#include "tqwidget.h"
#endif // TQT_H

#include <limits.h>

#ifndef TQT_NO_LAYOUT

#ifdef USE_QT4

#include <Qt/qlayout.h>

#endif // USE_QT4

#if 0
TQ_OBJECT
#endif

static const int TQLAYOUTSIZE_MAX = INT_MAX/256/16;

class TQGridLayoutBox;
class TQGridLayoutData;
class TQLayout;
class TQLayoutItem;
struct TQLayoutData;
class TQMenuBar;
class TQSpacerItem;
class TQWidget;

class TQ_EXPORT TQGLayoutIterator : public TQShared
{
public:
    virtual ~TQGLayoutIterator();
    virtual TQLayoutItem *next() = 0;
    virtual TQLayoutItem *current() = 0;
    virtual TQLayoutItem *takeCurrent() = 0;
};

#ifdef USE_QT4

class TQ_EXPORT TQLayoutIterator
{
public:
    TQLayoutIterator(QLayout *i);
    inline TQLayoutIterator(const TQLayoutIterator &i)
        : layout(i.layout), index(i.index) {}
    inline TQLayoutIterator &operator=(const TQLayoutIterator &i) {
        layout = i.layout;
        index = i.index;
        return *this;
    }
    TQLayoutItem *operator++();
    TQLayoutItem *current();
    TQLayoutItem *takeCurrent();
    void deleteCurrent();

private:
    // hack to avoid deprecated warning
    friend class QLayout;
    friend class TQLayout;
    TQLayoutIterator(QLayout *i, bool);
    TQLayout *layout;
    int index;
};

#else // USE_QT4

class TQ_EXPORT TQLayoutIterator
{
public:
    TQLayoutIterator( TQGLayoutIterator *i ) : it( i ) { }
    TQLayoutIterator( const TQLayoutIterator &i ) : it( i.it ) {
	if ( it )
	    it->ref();
    }
    ~TQLayoutIterator() { if ( it && it->deref() ) delete it; }
    TQLayoutIterator &operator=( const TQLayoutIterator &i ) {
	if ( i.it )
	    i.it->ref();
	if ( it && it->deref() )
	    delete it;
	it = i.it;
	return *this;
    }
    TQLayoutItem *operator++() { return it ? it->next() : 0; }
    TQLayoutItem *current() { return it ? it->current() : 0; }
    TQLayoutItem *takeCurrent() { return it ? it->takeCurrent() : 0; }
    void deleteCurrent();

private:
    TQGLayoutIterator *it;
};

#endif // USE_QT4

#ifdef USE_QT4

// Abstract base classes cannot have their abstract methods modified or added to
// Also, all TQt functions MUST be NON VIRTUAL (and are recommended to be inline as well) <-- this may not always be true
// Virtual functions are resolved at run time, causing all kinds of problems at runtime with the interface layer
class TQ_EXPORT TQLayoutItem : public QLayoutItem, virtual public TQt
{
public:
	TQLayoutItem( int tqalignment = 0 ) : QLayoutItem( (Qt::Alignment)tqalignment ) {}

	inline int tqalignment() const { return alignment(); }

	TQSpacerItem *tqspacerItem();
	inline TQLayout *tqlayout() { return 0; }
	inline TQWidget *widget() { return static_cast<TQWidget*>(QLayoutItem::widget()); }
// 	inline bool hasHeightForWidth() const { return QLayoutItem::hasHeightForWidth(); }
// 	inline int heightForWidth( int i ) const { return QLayoutItem::heightForWidth( i ); }
// 	inline virtual TQLayoutIterator iterator() { return TQLayoutIterator( 0 ); }
	inline TQLayoutIterator iterator() { return TQLayoutIterator( 0 ); }
	inline void tqsetAlignment( int a ) { QLayoutItem::setAlignment((Qt::AlignmentFlag)a); }
	virtual inline void tqinvalidate() { QLayoutItem::invalidate(); }
	virtual inline void invalidate() { tqinvalidate(); }

// 	inline virtual TQSize tqsizeHint() const { return QLayoutItem::sizeHint(); }
// 	inline virtual TQSize tqminimumSize() const { return QLayoutItem::minimumSize(); }
// 	inline virtual TQSize tqmaximumSize() const { return QLayoutItem::maximumSize(); }
// 	inline virtual void setGeometry( const TQRect&r ) { QLayoutItem::setGeometry(r); }
// 	inline virtual TQRect tqgeometry() const { return QLayoutItem::geometry(); }
// 	inline virtual TQ_SPExpandData expandingDirections() const { return QLayoutItem::expandingDirections(); }

	// These functions are pure virtual in Qt4
	inline TQSize tqsizeHint() const { return sizeHint(); }
	inline TQSize tqminimumSize() const { return minimumSize(); }
	inline TQSize tqmaximumSize() const { return maximumSize(); }
// 	inline void setGeometry( const TQRect&r ) { TQ_UNUSED(r); }
	inline TQRect tqgeometry() const { return geometry(); }
};

	// Use the TQt virtual functions, not the built in Qt ones...
	// This requires that the base virtual Qt functions be reimplemented so as to point to the TQt virtual functions instead as shown below.
	// This way, when Trinity overrides a TQt virtual function, the calling Qt code will blithely use the overriden TQt function instead.
#define QLAYOUTITEM_REQUIRED_FUNCTIONS																\
	virtual inline QSize sizeHint() const { return tqsizeHint(); }												\
	virtual inline QSize minimumSize() const { return tqminimumSize(); }											\
	virtual inline QSize maximumSize() const { return tqmaximumSize(); }											\
	virtual inline void setGeometry( const QRect &r ) { return setGeometry( TQT_TQRECT_OBJECT(r) ); }							\
	virtual inline QRect geometry() const { return tqgeometry(); }												
	// inline void setAlignment( Qt::AlignmentFlag a ) { return tqsetAlignment(a); }

// class TQ_EXPORT TQLayoutItem : public QLayoutItem, virtual public TQt
// {
// public:
// 	TQLayoutItem( int tqalignment = 0 ) : QLayoutItem( (Qt::Alignment)tqalignment ) {}
// 	virtual ~TQLayoutItem();
// 
// 	inline int tqalignment() const { return alignment(); }
// 
// 	virtual TQSpacerItem *tqspacerItem();
// 	virtual TQLayout *tqlayout();
// 	virtual TQWidget *widget();
// 	virtual bool hasHeightForWidth() const;
// 	virtual int heightForWidth( int ) const;
// 	virtual TQLayoutIterator iterator();
// 
// 	virtual TQSize tqsizeHint() const = 0;
// 	virtual TQSize tqminimumSize() const = 0;
// 	virtual TQSize tqmaximumSize() const = 0;
// 	virtual void setGeometry( const TQRect& ) = 0;
// 	virtual TQRect tqgeometry() const = 0;
// 	virtual void tqsetAlignment( int a );
// 	virtual void tqinvalidate();
// 	virtual TQ_SPExpandData expandingDirections() const;
// 
// 	// Use the TQt virtual functions, not the built in Qt ones...
// 	// This requires that the base virtual Qt functions be reimplemented so as to point to the TQt virtual functions instead as shown below.
// 	// This way, when Trinity overrides a TQt virtual function, the calling Qt code will blithely use the overriden TQt function instead.
// 	inline QSize sizeHint() const { return tqsizeHint(); }
// 	inline QSize minimumSize() const { return tqminimumSize(); }
// 	inline QSize maximumSize() const { return tqmaximumSize(); }
// 	inline void setGeometry( const QRect &r ) { return TQLayoutItem::setGeometry( r ); }
// 	inline QRect geometry() const { return tqgeometry(); }
// 	inline void setAlignment( Qt::AlignmentFlag a ) { return tqsetAlignment(a); }
// 	inline void invalidate() { return tqinvalidate(); }
// 	inline Qt::Orientations expandingDirections() const { return TQLayoutItem::expandingDirections(); }
// };

#else // USE_QT4

class TQ_EXPORT TQLayoutItem
{
public:
    TQLayoutItem( int tqalignment = 0 ) : align( tqalignment ) { }
    virtual ~TQLayoutItem();
    virtual TQSize tqsizeHint() const = 0;
    virtual TQSize tqminimumSize() const = 0;
    virtual TQSize tqmaximumSize() const = 0;
    virtual TQ_SPExpandData expandingDirections() const = 0;
    virtual void setGeometry( const TQRect& ) = 0;
    virtual TQRect tqgeometry() const = 0;
    virtual bool isEmpty() const = 0;
    virtual bool hasHeightForWidth() const;
    virtual int heightForWidth( int ) const;
    // ### add minimumHeightForWidth( int ) in TQt 4.0
    virtual void tqinvalidate();

    virtual TQWidget *widget();
    virtual TQLayoutIterator iterator();
    virtual TQLayout *tqlayout();
    virtual TQSpacerItem *tqspacerItem();

    int tqalignment() const { return align; }
    virtual void tqsetAlignment( int a );

protected:
    int align;
};

#endif // USE_QT4

#ifdef USE_QT4

class TQ_EXPORT TQSpacerItem : public QSpacerItem, virtual public TQt
{
public:
	TQSpacerItem( int w, int h, TQSizePolicy::SizeType hData = TQSizePolicy::Minimum, TQSizePolicy::SizeType vData = TQSizePolicy::Minimum ) : QSpacerItem( w, h, hData, vData ) {}

	TQSpacerItem *tqspacerItem();															// Used by tqabstractlayout.cpp
	inline void changeSize( int w, int h, TQSizePolicy::SizeType hData = TQSizePolicy::Minimum, TQSizePolicy::SizeType vData = TQSizePolicy::Minimum ) { return QSpacerItem::changeSize( w, h, hData, vData ); }
	TQ_SPExpandData expandingDirections() const;													// Used by tqabstractlayout.cpp
	bool isEmpty() const;																// Used by tqabstractlayout.cpp

	TQSize tqsizeHint() const;
	TQSize tqminimumSize() const;
	TQSize tqmaximumSize() const;
	void setGeometry( const TQRect &qr );
	TQRect tqgeometry() const;

	// Use the TQt virtual functions, not the built in Qt ones...
	// This requires that the base virtual Qt functions be reimplemented so as to point to the TQt virtual functions instead as shown below.
	// This way, when Trinity overrides a TQt virtual function, the calling Qt code will blithely use the overriden TQt function instead.
	inline QSize sizeHint() const { return tqsizeHint(); }
	inline QSize minimumSize() const { return tqminimumSize(); }
	inline QSize maximumSize() const { return tqmaximumSize(); }
	inline void setGeometry( const QRect &r ) { return TQSpacerItem::setGeometry( TQT_TQRECT_OBJECT(r) ); }
	inline QRect geometry() { return tqgeometry(); }
};

#else // USE_QT4

class TQ_EXPORT TQSpacerItem : public TQLayoutItem
{
public:
    TQSpacerItem( int w, int h,
		 TQSizePolicy::SizeType hData = TQSizePolicy::Minimum,
		 TQSizePolicy::SizeType vData = TQSizePolicy::Minimum )
	: width( w ), height( h ), sizeP( hData, vData ) { }
    void changeSize( int w, int h,
		     TQSizePolicy::SizeType hData = TQSizePolicy::Minimum,
		     TQSizePolicy::SizeType vData = TQSizePolicy::Minimum );
    TQSize tqsizeHint() const;
    TQSize tqminimumSize() const;
    TQSize tqmaximumSize() const;
    TQ_SPExpandData expandingDirections() const;
    bool isEmpty() const;
    void setGeometry( const TQRect& );
    TQRect tqgeometry() const;
    TQSpacerItem *tqspacerItem();

private:
    int width;
    int height;
    TQSizePolicy sizeP;
    TQRect rect;
};

#endif // USE_QT4

class TQ_EXPORT TQWidgetItem : public TQLayoutItem
{
public:
    TQWidgetItem( TQWidget *w ) : wid( w ) { }
    TQSize tqsizeHint() const;
    TQSize tqminimumSize() const;
    TQSize tqmaximumSize() const;
    TQ_SPExpandData expandingDirections() const;
    bool isEmpty() const;
    void setGeometry( const TQRect& );
    TQRect tqgeometry() const;
    virtual TQWidget *widget();

    bool hasHeightForWidth() const;
    int heightForWidth( int ) const;

    QLAYOUTITEM_REQUIRED_FUNCTIONS

private:
    TQWidget *wid;
};

#ifdef USE_QT4
// #if 0

extern int menuBarHeightForWidth( QWidget *menubar, int w );

class TQ_EXPORT TQLayout : public QLayout, virtual public TQt
{
	Q_OBJECT
	TQ_OBJECT
public:
	enum ResizeMode {
		FreeResize = QLayout::SetNoConstraint,
		Minimum = QLayout::SetMinimumSize,
		Fixed = QLayout::SetFixedSize,
		Auto = QLayout::SetDefaultConstraint
	};

	TQLayout( QWidget *tqparent, int margin = 0, int spacing = -1, const char *name = 0 );
	TQLayout( QLayout *parentLayout, int spacing = -1, const char *name = 0 );
	TQLayout( int spacing = -1, const char *name = 0 );
	virtual TQ_SPExpandData expandingDirections() const;

	TQLayout *tqlayout();
	virtual TQSize tqsizeHint() const;
	virtual TQSize tqminimumSize() const;
	virtual TQSize tqmaximumSize() const;

	TQWidget *mainWidget();
	virtual void tqinvalidate();
	virtual void invalidate();
	virtual TQRect tqgeometry() const;
	const char *tqname() const;
	const char *name() const;
	int tqalignment() const;

	TQWidget *mainWidget() const;
	void remove(QWidget *w);
	void add(QWidget *w);
	void setResizeMode(SizeConstraint s);
	void setResizeMode(ResizeMode s);
	SizeConstraint resizeMode() const;
	ResizeMode tqresizeMode() const;
	void setAutoAdd(bool a);
	bool autoAdd() const;
	void tqsetAlignment( int a );

//	bool isTopLevel() const;
	void freeze( int w, int h );
	void freeze() { setResizeMode( Fixed ); }

	TQMetaObject *tqmetaObject() const;

	// Required to interface correctly, as QLayout is not a derived class of TQWidget or TQObject
public:
	// TQt handler
// 	virtual bool eventFilter( TQObject *, TQEvent * );

	// Qt4 handler interface
	bool eventFilter( QObject *q, QEvent *e );

// TQt event handlers
protected:
	virtual bool event( TQEvent *e );

// 	TQFocusData *focusData();
	bool event( QEvent *e );
// 	virtual void mousePressEvent( TQMouseEvent * );				// NOTE: All event handlers that can be subclassed must be declared here, and
// 	virtual void mouseReleaseEvent( TQMouseEvent * );			// declared virtual, so that run time dynamic call resolution will occur
// 	virtual void mouseDoubleClickEvent( TQMouseEvent * );
// 	virtual void mouseMoveEvent( TQMouseEvent * );
// #ifndef TQT_NO_WHEELEVENT
// 	virtual void wheelEvent( TQWheelEvent * );
// #endif
// 	virtual void keyPressEvent( TQKeyEvent * );
// 	virtual void keyReleaseEvent( TQKeyEvent * );
// 	virtual void focusInEvent( TQFocusEvent * );
// 	virtual void focusOutEvent( TQFocusEvent * );
// 	virtual void enterEvent( TQEvent * );
// 	virtual void leaveEvent( TQEvent * );
// 	virtual void paintEvent( TQPaintEvent * );
// 	virtual void moveEvent( TQMoveEvent * );
// 	virtual void resizeEvent( TQResizeEvent * );
// 	virtual void closeEvent( TQCloseEvent * );
// 	virtual void contextMenuEvent( TQContextMenuEvent * );
// 	virtual void imStartEvent( TQIMEvent * );
// 	virtual void imComposeEvent( TQIMEvent * );
// 	virtual void imEndEvent( TQIMEvent * );
// 	virtual void tabletEvent( TQTabletEvent * );
// 
// #ifndef TQT_NO_DRAGANDDROP
// 	virtual void dragEnterEvent( TQDragEnterEvent * );
// 	virtual void dragMoveEvent( TQDragMoveEvent * );
// 	virtual void dragLeaveEvent( TQDragLeaveEvent * );
// 	virtual void dropEvent( TQDropEvent * );
// #endif
// 
// 	virtual void showEvent( TQShowEvent * );
// 	virtual void hideEvent( TQHideEvent * );

// // Qt4 event handler interface
// protected:
// 	inline virtual void mousePressEvent(QMouseEvent *e) { mousePressEvent(static_cast<TQMouseEvent*>(e)); } // QLayout::mousePressEvent(e) }
// 	inline virtual void mouseReleaseEvent(QMouseEvent *e) { mouseReleaseEvent(static_cast<TQMouseEvent*>(e)); } // QLayout::mouseReleaseEvent(e) }
// 	inline virtual void mouseDoubleClickEvent(QMouseEvent *e) { mouseDoubleClickEvent(static_cast<TQMouseEvent*>(e)); } // QLayout::mouseDoubleClickEvent(e) }
// 	inline virtual void mouseMoveEvent(QMouseEvent *e) { mouseMoveEvent(static_cast<TQMouseEvent*>(e)); } // QLayout::mouseMoveEvent(e) }
// #ifndef QT_NO_WHEELEVENT
// 	inline virtual void wheelEvent(QWheelEvent *e) { wheelEvent(static_cast<TQWheelEvent*>(e)); } // QLayout::wheelEvent(e) }
// #endif
// 	inline virtual void keyPressEvent(QKeyEvent *e) { keyPressEvent(static_cast<TQKeyEvent*>(e)); } // QLayout::keyPressEvent(e) }
// 	inline virtual void keyReleaseEvent(QKeyEvent *e) { keyReleaseEvent(static_cast<TQKeyEvent*>(e)); } // QLayout::keyReleaseEvent(e) }
// 	inline virtual void focusInEvent(QFocusEvent *e) { focusInEvent(static_cast<TQFocusEvent*>(e)); } // QLayout::focusInEvent(e) }
// 	inline virtual void focusOutEvent(QFocusEvent *e) { focusOutEvent(static_cast<TQFocusEvent*>(e)); } // QLayout::focusOutEvent(e) }
// 	inline virtual void enterEvent(QEvent *e) { enterEvent(static_cast<TQEvent*>(e)); } // QLayout::enterEvent(e) }
// 	inline virtual void leaveEvent(QEvent *e) { leaveEvent(static_cast<TQEvent*>(e)); } // QLayout::leaveEvent(e) }
// 	inline virtual void paintEvent(QPaintEvent *e) { paintEvent(static_cast<TQPaintEvent*>(e)); } // QLayout::paintEvent(e) }
// 	inline virtual void moveEvent(QMoveEvent *e) { moveEvent(static_cast<TQMoveEvent*>(e)); } // QLayout::moveEvent(e) }
// 	inline virtual void resizeEvent(QResizeEvent *e) { resizeEvent(static_cast<TQResizeEvent*>(e)); } // QLayout::resizeEvent(e) }
// 	inline virtual void closeEvent(QCloseEvent *e) { closeEvent(static_cast<TQCloseEvent*>(e)); } // QLayout::closeEvent(e) }
// #ifndef QT_NO_CONTEXTMENU
// 	inline virtual void contextMenuEvent(QContextMenuEvent *e) { contextMenuEvent(static_cast<TQContextMenuEvent*>(e)); } // QLayout::contextMenuEvent(e); }
// #endif
// #ifndef QT_NO_TABLETEVENT
// 	inline virtual void tabletEvent(QTabletEvent *e) { tabletEvent(static_cast<TQTabletEvent*>(e)); } // QLayout::tabletEvent(e) }
// #endif
// #ifndef QT_NO_ACTION
// // 	inline virtual void actionEvent(QActionEvent *e) { actionEvent(static_cast<TQActionEvent*>(e)); QLayout::actionEvent(e) }
// #endif
// 
// // #ifndef QT_NO_DRAGANDDROP
// // 	inline virtual void dragEnterEvent(QDragEnterEvent *e) { dragEnterEvent(static_cast<TQDragEnterEvent*>(e)); QLayout::dragEnterEvent(e) }
// // 	inline virtual void dragMoveEvent(QDragMoveEvent *e) { dragMoveEvent(static_cast<TQDragMoveEvent*>(e)); QLayout::dragMoveEvent(e) }
// // 	inline virtual void dragLeaveEvent(QDragLeaveEvent *e) { dragLeaveEvent(static_cast<TQDragLeaveEvent*>(e)); QLayout::dragLeaveEvent(e) }
// // 	inline virtual void dropEvent(QDropEvent *e) { dropEvent(static_cast<TQDropEvent*>(e)); QLayout::dropEvent(e) }
// // #endif
// 
// 	inline virtual void showEvent(QShowEvent *e) { showEvent(static_cast<TQShowEvent*>(e)); } // QLayout::showEvent(e) }
// 	inline virtual void hideEvent(QHideEvent *e) { hideEvent(static_cast<TQHideEvent*>(e)); } // QLayout::hideEvent(e) }

// TQt event handlers
protected:
	virtual void timerEvent( TQTimerEvent * );
	virtual void childEvent( TQChildEvent * );
	virtual void customEvent( TQCustomEvent * );

// Qt4 event handler interface
protected:
	virtual void timerEvent(QTimerEvent *e);
	virtual void childEvent(QChildEvent *e);
	virtual void customEvent(QEvent *e);

protected:
	bool eventFilter( TQObject *o, TQEvent *e );

public:
	// Interoperability
	static const TQLayout& convertFromQLayout( QLayout& ql );

// 	virtual void addItem( TQLayoutItem * ) = 0;
	TQLayoutIterator iterator();

	QLayout *layout();
	virtual void setGeometry(const TQRect &r);

	QLAYOUTITEM_REQUIRED_FUNCTIONS

protected:
	void setSupportsMargin( bool );		// Implemented in tqabstractlayout.cpp
	TQRect alignmentRect( const TQRect& qr ) const;
	void deleteAllItems();

public Q_SLOTS:
	void tqt_handle_qt_destroyed(QObject* obj);

Q_SIGNALS:
	void destroyed( TQObject* obj );

private:
	bool autoNewChild;
	mutable TQString static_object_name;
};

// Interoperability
inline static const TQLayout& convertFromQLayout( const QLayout& ql ) {
	return (*static_cast<const TQLayout*>(&ql));
}

#else // USE_QT4

class TQ_EXPORT TQLayout : public TQObject, public TQLayoutItem
{
    Q_OBJECT
    TQ_OBJECT
    TQ_ENUMS( ResizeMode )
    Q_PROPERTY( int margin READ margin WRITE setMargin )
    Q_PROPERTY( int spacing READ spacing WRITE setSpacing )
    Q_PROPERTY( ResizeMode resizeMode READ resizeMode WRITE setResizeMode )

public:
    // ### TQt 4.0: put 'Auto' first in enum
    enum ResizeMode { FreeResize, Minimum, Fixed, Auto };

    TQLayout( TQWidget *tqparent, int margin = 0, int spacing = -1,
	     const char *name = 0 );
    TQLayout( TQLayout *parentLayout, int spacing = -1, const char *name = 0 );
    TQLayout( int spacing = -1, const char *name = 0 );
    ~TQLayout();

    int margin() const { return outsideBorder; }
    int spacing() const { return insideSpacing; }

    virtual void setMargin( int );
    virtual void setSpacing( int );

    int defaultBorder() const { return insideSpacing; }
    void freeze( int w, int h );
    void freeze() { setResizeMode( Fixed ); }

    void setResizeMode( ResizeMode );
    ResizeMode resizeMode() const;

#ifndef TQT_NO_MENUBAR
    virtual void setMenuBar( TQMenuBar *w );
    TQMenuBar *menuBar() const { return menubar; }
#endif

    TQWidget *mainWidget();
    bool isTopLevel() const { return topLevel; }

    virtual void setAutoAdd( bool );
    bool autoAdd() const { return autoNewChild; }

    void tqinvalidate();
    TQRect tqgeometry() const;
    bool activate();

    void add( TQWidget *w ) { addItem( new TQWidgetItem(w) ); }
    virtual void addItem( TQLayoutItem * ) = 0;

    void remove( TQWidget *w );
    void removeItem( TQLayoutItem * );

    TQ_SPExpandData expandingDirections() const;
    TQSize tqminimumSize() const;
    TQSize tqmaximumSize() const;
    void setGeometry( const TQRect& ) = 0;
    TQLayoutIterator iterator() = 0;
    bool isEmpty() const;

    int totalHeightForWidth( int w ) const;
    TQSize totalMinimumSize() const;
    TQSize totalMaximumSize() const;
    TQSize totalSizeHint() const;
    TQLayout *tqlayout();

    bool supportsMargin() const { return marginImpl; }

    void setEnabled( bool );
    bool isEnabled() const;

protected:
    bool eventFilter( TQObject *, TQEvent * );
    void childEvent( TQChildEvent *e );
    void addChildLayout( TQLayout *l );
    void deleteAllItems();

    void setSupportsMargin( bool );
    TQRect alignmentRect( const TQRect& ) const;

private:
    void setWidgetLayout( TQWidget *, TQLayout * );
    void init();
    int insideSpacing;
    int outsideBorder;
    uint topLevel : 1;
    uint enabled : 1;
    uint autoNewChild : 1;
    uint frozen : 1;
    uint activated : 1;
    uint marginImpl : 1;
    uint autoMinimum : 1;
    uint autoResizeMode : 1;
    TQRect rect;
    TQLayoutData *extraData;
#ifndef TQT_NO_MENUBAR
    TQMenuBar *menubar;
#endif

private:
#if defined(TQ_DISABLE_COPY)
    TQLayout( const TQLayout & );
    TQLayout &operator=( const TQLayout & );
#endif

    static void propagateSpacing( TQLayout *tqlayout );
};

inline void TQLayoutIterator::deleteCurrent()
{
    delete takeCurrent();
}
#endif // USE_QT4

#define QLAYOUT_REQUIRED_METHOD_DECLARATIONS						\
	int count() const;								\
	TQLayoutItem* itemAt(int index) const;						\
	TQLayoutItem* takeAt(int index);						\
	virtual inline QSize sizeHint() const { return tqsizeHint(); }												\
	virtual inline QSize minimumSize() const { return tqminimumSize(); }											\
	virtual inline QSize maximumSize() const { return tqmaximumSize(); }											\
	virtual inline void setGeometry( const QRect &r ) { return setGeometry( TQT_TQRECT_OBJECT(r) ); }							\
	virtual inline QRect geometry() const { return tqgeometry(); }												

#define QLAYOUT_REQUIRED_METHOD_IMPLEMENTATIONS								\
	inline int count() const {									\
		return data->list.count();								\
	}												\
													\
	inline TQLayoutItem* itemAt(int index) const {							\
		return index >= 0 && index < data->list.count() ? data->list.at(index)->item : 0;	\
	}												\
													\
	inline TQLayoutItem* takeAt(int index) {							\
		if (index < 0 || index >= data->list.count())						\
			return 0;									\
		TQBoxLayoutItem *b = data->list.take(index);						\
		TQLayoutItem *item = b->item;								\
		b->item = 0;										\
		delete b;										\
													\
		invalidate();										\
		return item;										\
	}

#if 0

class TQ_EXPORT TQGridLayout : public QGridLayout, virtual public TQt
{
	Q_OBJECT
	TQ_OBJECT
public:
	TQGridLayout( TQWidget *tqparent, int nRows = 1, int nCols = 1, int border = 0, int spacing = -1, const char *name = 0 ) : QGridLayout( tqparent ), autoNewChild(false)
	{
		expand(nRows, nCols);
		setMargin(border);
		setSpacing(spacing < 0 ? border : spacing);
		setObjectName(QString::fromAscii(name));
		if ( tqparent ) tqparent->installEventFilter( this );
		TQT_TQOBJECT_REQUIRED_INITIALIZATION(tqparent)
	}
	TQGridLayout( int nRows = 1, int nCols = 1, int spacing = -1, const char *name = 0 ) : QGridLayout(), autoNewChild(false)
	{
		expand(nRows, nCols);
		setSpacing(spacing);
		setObjectName(QString::fromAscii(name));
	}
	TQGridLayout( QLayout *parentLayout, int nRows = 1, int nCols = 1, int spacing = -1, const char *name = 0 ) : QGridLayout(), autoNewChild(false)
	{
		expand(nRows, nCols);
		if (spacing == -1) {setSpacing(parentLayout->spacing());} else {setSpacing(spacing);};
		setObjectName(QString::fromAscii(name));
		if ( parentLayout ) parentLayout->addItem(this);
		if ( parentLayout ) parentLayout->installEventFilter( this );
		TQT_TQOBJECT_REQUIRED_INITIALIZATION(parentLayout)
	}

	void expand( int rows, int cols ) {
		// Nasty, nasty HACK
		// Yet another example of lost functionality in Qt4...sigh...
		QSpacerItem *hack= new QSpacerItem(1,1);
		addItem(hack, (rows != -1) ? rows-1 : 0, (cols != -1) ? cols-1 : 0);
		QGridLayout::removeItem(hack);
		delete hack;
	}

	inline TQSize tqsizeHint() const { return sizeHint(); }
	inline TQSize tqminimumSize() const { return minimumSize(); }
	inline TQSize tqmaximumSize() const { return maximumSize(); }
	inline void tqinvalidate() { invalidate(); }

	inline TQRect tqgeometry() const { return geometry(); }

	inline TQWidget *mainWidget() const { return TQT_TQWIDGET(parentWidget()); }
	inline void remove(QWidget *w) { removeWidget(w); }
	inline void add(QWidget *w) { addWidget(w); }
	inline void setResizeMode(SizeConstraint s) {setSizeConstraint(s);}
	inline void setResizeMode(TQLayout::ResizeMode s) {setResizeMode((SizeConstraint)s);}
	inline SizeConstraint resizeMode() const {return sizeConstraint();}
	inline void setAutoAdd(bool a) { autoNewChild = a; }
	inline bool autoAdd() const { return autoNewChild; }

	inline void addRowSpacing(int row, int minsize) { addItem(new QSpacerItem(0,minsize), row, 0); }
	inline void addColSpacing(int col, int minsize) { addItem(new QSpacerItem(minsize,0), 0, col); }
	inline void addMultiCellWidget(QWidget *w, int fromRow, int toRow, int fromCol, int toCol, Qt::Alignment _align = 0) { addWidget(w, fromRow, fromCol, (toRow < 0) ? -1 : toRow - fromRow + 1, (toCol < 0) ? -1 : toCol - fromCol + 1, _align); }
	inline void addMultiCell(QLayoutItem *l, int fromRow, int toRow, int fromCol, int toCol, Qt::Alignment _align = 0) { addItem(l, fromRow, fromCol, (toRow < 0) ? -1 : toRow - fromRow + 1, (toCol < 0) ? -1 : toCol - fromCol + 1, _align); }
	inline void addMultiCellLayout(QLayout *layout, int fromRow, int toRow, int fromCol, int toCol, Qt::Alignment _align = 0) { addLayout(layout, fromRow, fromCol, (toRow < 0) ? -1 : toRow - fromRow + 1, (toCol < 0) ? -1 : toCol - fromCol + 1, _align); }

	inline int numRows() const { return rowCount(); }
	inline int numCols() const { return columnCount(); }
	inline void setColStretch(int col, int stretch) {setColumnStretch(col, stretch); }
	inline int colStretch(int col) const {return columnStretch(col); }
	inline void setColSpacing(int col, int minSize) { setColumnMinimumWidth(col, minSize); }
	inline int colSpacing(int col) const { return columnMinimumWidth(col); }
	inline void setRowSpacing(int row, int minSize) {setRowMinimumHeight(row, minSize); }
	inline int rowSpacing(int row) const {return rowMinimumHeight(row); }

	virtual void tqsetAlignment( int a );

	// Required to interface correctly, as QLayout is not a derived class of TQWidget or TQObject
public:
	// TQt handler
// 	virtual bool eventFilter( TQObject *, TQEvent * );

	// Qt4 handler interface
	inline bool eventFilter( QObject *q, QEvent *e ) { return eventFilter(static_cast<TQObject*>(q), static_cast<TQEvent*>(e)); }

// TQt event handlers
protected:
// 	virtual bool event( TQEvent *e );

// 	TQFocusData *focusData();
// 	inline bool event( QEvent *e ) { return event(static_cast<TQEvent*>(e)); }
	virtual void mousePressEvent( TQMouseEvent * );			// NOTE: All event handlers that can be subclassed must be declared here, and 
	virtual void mouseReleaseEvent( TQMouseEvent * );		// declared virtual, so that run time dynamic call resolution will occur
	virtual void mouseDoubleClickEvent( TQMouseEvent * );
	virtual void mouseMoveEvent( TQMouseEvent * );
#ifndef TQT_NO_WHEELEVENT
	virtual void wheelEvent( TQWheelEvent * );
#endif
	virtual void keyPressEvent( TQKeyEvent * );
	virtual void keyReleaseEvent( TQKeyEvent * );
	virtual void focusInEvent( TQFocusEvent * );
	virtual void focusOutEvent( TQFocusEvent * );
	virtual void enterEvent( TQEvent * );
	virtual void leaveEvent( TQEvent * );
	virtual void paintEvent( TQPaintEvent * );
	virtual void moveEvent( TQMoveEvent * );
	virtual void resizeEvent( TQResizeEvent * );
	virtual void closeEvent( TQCloseEvent * );
	virtual void contextMenuEvent( TQContextMenuEvent * );
	virtual void imStartEvent( TQIMEvent * );
	virtual void imComposeEvent( TQIMEvent * );
	virtual void imEndEvent( TQIMEvent * );
	virtual void tabletEvent( TQTabletEvent * );

#ifndef TQT_NO_DRAGANDDROP
	virtual void dragEnterEvent( TQDragEnterEvent * );
	virtual void dragMoveEvent( TQDragMoveEvent * );
	virtual void dragLeaveEvent( TQDragLeaveEvent * );
	virtual void dropEvent( TQDropEvent * );
#endif

	virtual void showEvent( TQShowEvent * );
	virtual void hideEvent( TQHideEvent * );

// Qt4 event handler interface
protected:
	inline virtual void mousePressEvent(QMouseEvent *e) { mousePressEvent(static_cast<TQMouseEvent*>(e)); } // QGridLayout::mousePressEvent(e) }
	inline virtual void mouseReleaseEvent(QMouseEvent *e) { mouseReleaseEvent(static_cast<TQMouseEvent*>(e)); } // QGridLayout::mouseReleaseEvent(e) }
	inline virtual void mouseDoubleClickEvent(QMouseEvent *e) { mouseDoubleClickEvent(static_cast<TQMouseEvent*>(e)); } // QGridLayout::mouseDoubleClickEvent(e) }
	inline virtual void mouseMoveEvent(QMouseEvent *e) { mouseMoveEvent(static_cast<TQMouseEvent*>(e)); } // QGridLayout::mouseMoveEvent(e) }
#ifndef QT_NO_WHEELEVENT
	inline virtual void wheelEvent(QWheelEvent *e) { wheelEvent(static_cast<TQWheelEvent*>(e)); } // QGridLayout::wheelEvent(e) }
#endif
	inline virtual void keyPressEvent(QKeyEvent *e) { keyPressEvent(static_cast<TQKeyEvent*>(e)); } // QGridLayout::keyPressEvent(e) }
	inline virtual void keyReleaseEvent(QKeyEvent *e) { keyReleaseEvent(static_cast<TQKeyEvent*>(e)); } // QGridLayout::keyReleaseEvent(e) }
	inline virtual void focusInEvent(QFocusEvent *e) { focusInEvent(static_cast<TQFocusEvent*>(e)); } // QGridLayout::focusInEvent(e) }
	inline virtual void focusOutEvent(QFocusEvent *e) { focusOutEvent(static_cast<TQFocusEvent*>(e)); } // QGridLayout::focusOutEvent(e) }
	inline virtual void enterEvent(QEvent *e) { enterEvent(static_cast<TQEvent*>(e)); } // QGridLayout::enterEvent(e) }
	inline virtual void leaveEvent(QEvent *e) { leaveEvent(static_cast<TQEvent*>(e)); } // QGridLayout::leaveEvent(e) }
	inline virtual void paintEvent(QPaintEvent *e) { paintEvent(static_cast<TQPaintEvent*>(e)); } // QGridLayout::paintEvent(e) }
	inline virtual void moveEvent(QMoveEvent *e) { moveEvent(static_cast<TQMoveEvent*>(e)); } // QGridLayout::moveEvent(e) }
	inline virtual void resizeEvent(QResizeEvent *e) { resizeEvent(static_cast<TQResizeEvent*>(e)); } // QGridLayout::resizeEvent(e) }
	inline virtual void closeEvent(QCloseEvent *e) { closeEvent(static_cast<TQCloseEvent*>(e)); } // QGridLayout::closeEvent(e) }
#ifndef QT_NO_CONTEXTMENU
	inline virtual void contextMenuEvent(QContextMenuEvent *e { contextMenuEvent(static_cast<TQContextMenuEvent*>(e)); QGridLayout::contextMenuEvent(e) }
#endif
#ifndef QT_NO_TABLETEVENT
	inline virtual void tabletEvent(QTabletEvent *e) { tabletEvent(static_cast<TQTabletEvent*>(e)); } // QGridLayout::tabletEvent(e) }
#endif
#ifndef QT_NO_ACTION
// 	inline virtual void actionEvent(QActionEvent *e) { actionEvent(static_cast<TQActionEvent*>(e)); QGridLayout::actionEvent(e) }
#endif

// #ifndef QT_NO_DRAGANDDROP
// 	inline virtual void dragEnterEvent(QDragEnterEvent *e) { dragEnterEvent(static_cast<TQDragEnterEvent*>(e)); QGridLayout::dragEnterEvent(e) }
// 	inline virtual void dragMoveEvent(QDragMoveEvent *e) { dragMoveEvent(static_cast<TQDragMoveEvent*>(e)); QGridLayout::dragMoveEvent(e) }
// 	inline virtual void dragLeaveEvent(QDragLeaveEvent *e) { dragLeaveEvent(static_cast<TQDragLeaveEvent*>(e)); QGridLayout::dragLeaveEvent(e) }
// 	inline virtual void dropEvent(QDropEvent *e) { dropEvent(static_cast<TQDropEvent*>(e)); QGridLayout::dropEvent(e) }
// #endif

	inline virtual void showEvent(QShowEvent *e) { showEvent(static_cast<TQShowEvent*>(e)); } // QGridLayout::showEvent(e) }
	inline virtual void hideEvent(QHideEvent *e) { hideEvent(static_cast<TQHideEvent*>(e)); } // QGridLayout::hideEvent(e) }

// TQt event handlers
protected:
	virtual void timerEvent( TQTimerEvent * );
	virtual void childEvent( TQChildEvent * );
	virtual void customEvent( TQCustomEvent * );

// Qt4 event handler interface
protected:
	inline virtual void timerEvent(QTimerEvent *e) { timerEvent(static_cast<TQTimerEvent*>(e)); } // QGridLayout::timerEvent(e) }
	inline virtual void childEvent(QChildEvent *e) { TQT_TQOBJECT_CHILDEVENT_CONDITIONAL childEvent(static_cast<TQChildEvent*>(e)); } // QGridLayout::childEvent(e) }
// 	inline virtual void customEvent(QCustomEvent *e) { customEvent(static_cast<TQCustomEvent*>(e)); }

// protected:
// 	bool eventFilter( TQObject *o, TQEvent *e ) {
// 		TQ_UNUSED(o);
// 		if (e->type() == TQEvent::ChildInserted) {
// 			if (autoNewChild) {
// 				QChildEvent *c = (QChildEvent *)e;
// 				if (c->child()->isWidgetType()) {
// 					QWidget *w = (QWidget *)c->child();
// 					if (!w->isWindow()) {
// 						addWidget(w);
// 					}
// 				}
// 			}
// 		}
// 		else if (e->type() == TQEvent::LayoutHint) {
// // 			d->activated = false;
// 			if (parent()) {
// 				if (static_cast<QWidget *>(parent())->isVisible()) {
// 					activate();
// 				}
// 			}
// 		}
// 		return FALSE;
// 	}

// Taken from TQLayout above
protected:
	bool eventFilter( TQObject *o, TQEvent *e ) {
		TQ_UNUSED(o);

		if (e->type() == TQEvent::Resize) {
			activate();
			TQResizeEvent *r = (TQResizeEvent *)e;
			int mbh = 0;
#ifndef TQT_NO_MENUBAR
			mbh = menuBarHeightForWidth( menuBar(), r->size().width() );
#endif
// 			int b = marginImpl ? 0 : outsideBorder;
			int b = 0;
			setGeometry( TQRect( b, mbh + b, r->size().width() - 2 * b, r->size().height() - mbh - 2 * b ) );
		}

		else if (e->type() == TQEvent::ChildInserted) {
			if (autoNewChild) {
				QChildEvent *c = (QChildEvent *)e;
				if (c->child()->isWidgetType()) {
					QWidget *w = (QWidget *)c->child();
					if (!w->isWindow()) {
// #if !defined(QT_NO_MENUBAR) && !defined(QT_NO_TOOLBAR)
// 						if (qobject_cast<QMenuBar*>(w) && !qobject_cast<QToolBar*>(w->parentWidget())) {
// 							setMenuBar( (QMenuBar *)w );
// 							invalidate();
// 						} else
// #endif
// #ifndef QT_NO_SIZEGRIP
// 						if (qobject_cast<QSizeGrip*>(w) ) {
// 							//SizeGrip is handled by the dialog itself.
// 						} else
// #endif
// 							addItem(QLayoutPrivate::createWidgetItem(this, w));
							addWidget(w);
					}
				}
			}
		}
		else if (e->type() == TQEvent::LayoutHint) {
// 			d->d = false;
			if (parent()) {
				if (static_cast<QWidget *>(parent())->isVisible()) {
					activate();
				}
			}
		}
		return FALSE;
	}

public:
	virtual void setGeometry(const TQRect &r) { return QGridLayout::setGeometry(r); }
	virtual inline void setGeometry(const QRect &r) { return setGeometry(TQT_TQRECT_OBJECT(r)); }

public Q_SLOTS:
	void tqt_handle_qt_destroyed(QObject* obj) { emit destroyed(TQT_TQOBJECT(obj)); }

Q_SIGNALS:
	void destroyed( TQObject* obj );

private:
	bool autoNewChild;
};

#else // USE_QT4

class TQ_EXPORT TQGridLayout : public TQLayout
{
    Q_OBJECT
    TQ_OBJECT
public:
    TQGridLayout( TQWidget *tqparent, int nRows = 1, int nCols = 1, int border = 0,
		 int spacing = -1, const char *name = 0 );
    TQGridLayout( int nRows = 1, int nCols = 1, int spacing = -1,
		 const char *name = 0 );
    TQGridLayout( TQLayout *parentLayout, int nRows = 1, int nCols = 1,
		 int spacing = -1, const char *name = 0 );
    ~TQGridLayout();

    TQSize tqsizeHint() const;
    TQSize tqminimumSize() const;
    TQSize tqmaximumSize() const;

    // ### remove 'virtual' in 4.0 (or add 'virtual' to set{Row,Col}Spacing())
    virtual void setRowStretch( int row, int stretch );
    virtual void setColStretch( int col, int stretch );
    int rowStretch( int row ) const;
    int colStretch( int col ) const;

    void setRowSpacing( int row, int minSize );
    void setColSpacing( int col, int minSize );
    int rowSpacing( int row ) const;
    int colSpacing( int col ) const;

    int numRows() const;
    int numCols() const;
    TQRect cellGeometry( int row, int col ) const;

    bool hasHeightForWidth() const;
    int heightForWidth( int ) const;
    int minimumHeightForWidth( int ) const;

    TQ_SPExpandData expandingDirections() const;
    void tqinvalidate();

    void addItem( QLayoutItem * );
    void addItem( QLayoutItem *item, int row, int col );
    void addMultiCell( QLayoutItem *, int fromRow, int toRow,
			       int fromCol, int toCol, int align = 0 );

    void addWidget( TQWidget *, int row, int col, int align = 0 );
    void addMultiCellWidget( TQWidget *, int fromRow, int toRow,
			     int fromCol, int toCol, int align = 0 );
    void addLayout( TQLayout *tqlayout, int row, int col);
    void addMultiCellLayout( TQLayout *tqlayout, int fromRow, int toRow,
			     int fromCol, int toCol, int align = 0 );
    void addRowSpacing( int row, int minsize );
    void addColSpacing( int col, int minsize );

    void expand( int rows, int cols );

    enum Corner { TopLeft, TopRight, BottomLeft, BottomRight };
    void setOrigin( Corner );
    Corner origin() const;
//     TQLayoutIterator iterator();
    void setGeometry( const TQRect& );

#ifdef USE_QT4

    QLAYOUT_REQUIRED_METHOD_DECLARATIONS

#endif // USE_QT4

protected:
    bool tqfindWidget( TQWidget* w, int *r, int *c );
    void add( TQLayoutItem*, int row, int col );

private:
#if defined(TQ_DISABLE_COPY)
    TQGridLayout( const TQGridLayout & );
    TQGridLayout &operator=( const TQGridLayout & );
#endif

    void init( int rows, int cols );
    TQGridLayoutData *data;
};

#endif // USE_QT4

class TQBoxLayoutData;
class TQDockWindow;

class TQ_EXPORT TQBoxLayout : public TQLayout
{
    Q_OBJECT
    TQ_OBJECT
public:
    enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop,
		     Down = TopToBottom, Up = BottomToTop };

    TQBoxLayout( TQWidget *tqparent, Direction, int border = 0, int spacing = -1,
		const char *name = 0 );
    TQBoxLayout( TQLayout *parentLayout, Direction, int spacing = -1,
		const char *name = 0 );
    TQBoxLayout( Direction, int spacing = -1, const char *name = 0 );
    ~TQBoxLayout();

    void addItem( QLayoutItem * );

    Direction direction() const { return dir; }
    void setDirection( Direction );

    void addSpacing( int size );
    void addStretch( int stretch = 0 );
    void addWidget( TQWidget *, int stretch = 0, int tqalignment = 0 );
    void addLayout( TQLayout *tqlayout, int stretch = 0 );
    void addStrut( int );

    void insertSpacing( int index, int size );
    void insertStretch( int index, int stretch = 0 );
    void insertWidget( int index, TQWidget *widget, int stretch = 0,
		       int tqalignment = 0 );
    void insertLayout( int index, TQLayout *tqlayout, int stretch = 0 );

    bool setStretchFactor( TQWidget*, int stretch );
    bool setStretchFactor( TQLayout *l, int stretch );

    TQSize tqsizeHint() const;
    TQSize tqminimumSize() const;
    TQSize tqmaximumSize() const;

    bool hasHeightForWidth() const;
    int heightForWidth( int ) const;
    int minimumHeightForWidth( int ) const;

    TQ_SPExpandData expandingDirections() const;
    void tqinvalidate();
//     TQLayoutIterator iterator();
    void setGeometry( const TQRect& );

    int tqfindWidget( TQWidget* w );

#ifdef USE_QT4

    QLAYOUT_REQUIRED_METHOD_DECLARATIONS

#endif // USE_QT4

protected:
    void insertItem( int index, TQLayoutItem * );

private:
    friend class TQDockWindow;
#if defined(TQ_DISABLE_COPY)
    TQBoxLayout( const TQBoxLayout & );
    TQBoxLayout &operator=( const TQBoxLayout & );
#endif

    void setupGeom();
    void calcHfw( int );
    TQBoxLayoutData *data;
    Direction dir;
    TQBoxLayout *createTmpCopy();
};

class TQ_EXPORT TQHBoxLayout : public TQBoxLayout
{
    Q_OBJECT
    TQ_OBJECT
public:
    TQHBoxLayout( TQWidget *tqparent, int border = 0,
		 int spacing = -1, const char *name = 0 );
    TQHBoxLayout( TQLayout *parentLayout,
		 int spacing = -1, const char *name = 0 );
    TQHBoxLayout( int spacing = -1, const char *name = 0 );

    ~TQHBoxLayout();

private:	// Disabled copy constructor and operator=
#if defined(TQ_DISABLE_COPY)
    TQHBoxLayout( const TQHBoxLayout & );
    TQHBoxLayout &operator=( const TQHBoxLayout & );
#endif
};

class TQ_EXPORT TQVBoxLayout : public TQBoxLayout
{
    Q_OBJECT
    TQ_OBJECT
public:
    TQVBoxLayout( TQWidget *tqparent, int border = 0,
		 int spacing = -1, const char *name = 0 );
    TQVBoxLayout( TQLayout *parentLayout,
		 int spacing = -1, const char *name = 0 );
    TQVBoxLayout( int spacing = -1, const char *name = 0 );

    ~TQVBoxLayout();

private:	// Disabled copy constructor and operator=
#if defined(TQ_DISABLE_COPY)
    TQVBoxLayout( const TQVBoxLayout & );
    TQVBoxLayout &operator=( const TQVBoxLayout & );
#endif
};

#endif // TQT_NO_LAYOUT
#endif // TQLAYOUT_H