20#include "KWSplitCellDia.h"
21#include "KWSplitCellDia.moc"
22#include "KWTableDia.h"
30KWSplitCellDia::KWSplitCellDia( TQWidget* parent,
const char* name,
unsigned int columns,
unsigned int rows)
31 : KDialogBase( Plain, i18n(
"Split Cell"), Ok | Cancel, Ok, parent, name, true)
36 setInitialSize( TQSize(400, 300) );
38 TQWidget *page = plainPage();
39 TQGridLayout *grid =
new TQGridLayout( page, 4, 2, KDialog::marginHint(), KDialog::spacingHint() );
41 TQLabel *lRows =
new TQLabel( i18n(
"Number of rows:" ), page );
42 grid->addWidget( lRows, 0, 0 );
44 nRows =
new TQSpinBox( 1, 128, 1, page );
45 nRows->setValue( m_rows );
46 grid->addWidget( nRows, 1, 0 );
48 TQLabel *lCols =
new TQLabel( i18n(
"Number of columns:" ), page );
49 grid->addWidget( lCols, 2, 0 );
51 nCols =
new TQSpinBox( 1, 128, 1, page );
52 nCols->setValue( m_cols );
53 grid->addWidget( nCols, 3, 0 );
55 preview =
new KWTablePreview( page, m_rows, m_cols );
56 preview->setBackgroundColor( white );
57 grid->addMultiCellWidget( preview, 0, 4, 1, 1 );
59 grid->addRowSpacing( 0, lRows->height() );
60 grid->addRowSpacing( 1, nRows->height() );
61 grid->addRowSpacing( 2, lCols->height() );
62 grid->addRowSpacing( 3, nCols->height() );
63 grid->addRowSpacing( 4, 150 - ( lRows->height() + nRows->height() + lCols->height() + nCols->height() ) );
64 grid->setRowStretch( 0, 0 );
65 grid->setRowStretch( 1, 0 );
66 grid->setRowStretch( 2, 0 );
67 grid->setRowStretch( 3, 0 );
68 grid->setRowStretch( 4, 1 );
70 grid->addColSpacing( 0, lRows->width() );
71 grid->addColSpacing( 0, nRows->width() );
72 grid->addColSpacing( 0, lCols->width() );
73 grid->addColSpacing( 0, nCols->width() );
74 grid->addColSpacing( 1, 150 );
75 grid->setColStretch( 0, 0 );
76 grid->setColStretch( 1, 1 );
79 enableButtonOK( !(m_rows==1 && m_cols==1) );
81 connect( nRows, TQ_SIGNAL( valueChanged(
int ) ),
this, TQ_SLOT( rowsChanged(
int ) ) );
82 connect( nCols, TQ_SIGNAL( valueChanged(
int ) ),
this, TQ_SLOT( colsChanged(
int ) ) );
86void KWSplitCellDia::rowsChanged(
int rows ) {
88 preview->setRows( m_rows );
89 enableButtonOK( !(m_rows==1 && m_cols==1) );
92void KWSplitCellDia::colsChanged(
int cols ) {
94 preview->setCols( m_cols );
95 enableButtonOK( !(m_rows==1 && m_cols==1) );