summaryrefslogtreecommitdiffstats
path: root/kompare/libdialogpages/pagebase.cpp
blob: bf13986b600398be55511125b3653e958e3654fc (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
/***************************************************************************
                                prefsbase.cpp  -  description
                                -------------------
        begin                   : Sun Mar 4 2001
        copyright               : (C) 2001 by Otto Bruggeman
                                  and John Firebaugh
        email                   : otto.bruggeman@home.nl
                                  jfirebaugh@kde.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.
**
***************************************************************************/

#include <tqlayout.h>
#include <tqobjectlist.h>

#include "pagebase.h"

PageBase::PageBase( TQWidget* tqparent ) : KTabCtl( tqparent )
{

}

PageBase::~PageBase()
{

}

/** No descriptions */
TQSize PageBase::sizeHintForWidget( TQWidget* widget )
{
	//
	// The size is computed by adding the tqsizeHint().height() of all
	// widget tqchildren and taking the width of the widest child and adding
	// tqlayout()->margin() and tqlayout()->spacing()
	//

	// this code in this method has been ripped out of a file in kbabel
	// so copyright goes to the kbabel authors.

	TQSize size;

	int numChild = 0;
	TQObjectList l = widget->childrenListObject();

	for( uint i=0; i < l.count(); i++ )
	{
		TQObject *o = l.at(i);
		if( o->isWidgetType() )
		{
			numChild += 1;
			TQWidget *w=((TQWidget*)o);

			TQSize s = w->tqsizeHint();
			if( s.isEmpty() == true )
			{
				s = TQSize( 50, 100 ); // Default size
			}
			size.setHeight( size.height() + s.height() );
			if( s.width() > size.width() )
			{
				size.setWidth( s.width() );
			}
		}
	}

	if( numChild > 0 )
	{
		size.setHeight( size.height() + widget->tqlayout()->spacing()*(numChild-1) );
		size += TQSize( widget->tqlayout()->margin()*2, widget->tqlayout()->margin()*2 + 1 );
	}
	else
	{
		size = TQSize( 1, 1 );
	}

	return( size );
}

/** No descriptions */
void PageBase::apply()
{

}

/** No descriptions */
void PageBase::restore()
{

}

/** No descriptions */
void PageBase::setDefaults()
{

}

#include "pagebase.moc"