21#include "KWInsertDia.h"
22#include "KWTableFrameSet.h"
29#include <tqradiobutton.h>
30#include <tqbuttongroup.h>
33KWInsertDia::KWInsertDia( KWView *parent, KWTableFrameSet *table, InsertType type, int insertHint)
34 : KDialogBase( Plain, (type==insertRow?i18n( "Insert Row") : i18n( "Insert Column")), Ok | Cancel, Ok, parent, "Insert Table items dialog", true )
40 setupTab1(insertHint);
43void KWInsertDia::setupTab1( int insertHint)
45 TQWidget *tab1 = plainPage();
46 TQGridLayout *grid1 = new TQGridLayout( tab1, 2, 2, 0, KDialog::spacingHint() );
48 TQButtonGroup *grp = new TQButtonGroup( m_type == insertRow ? i18n( "Insert New Row" ) : i18n( "Insert New Column" ), tab1 );
50 TQGridLayout *grid2 = new TQGridLayout( grp, 3, 1, KDialog::marginHint(), KDialog::spacingHint() );
52 m_rBefore = new TQRadioButton( i18n( "Before" ), grp, "before_radio_button" );
53 grp->insert( m_rBefore );
54 grid2->addWidget( m_rBefore, 1, 0 );
56 TQRadioButton *rAfter = new TQRadioButton( i18n( "After" ), grp, "after_radio_button");
57 grp->insert( rAfter );
58 grid2->addWidget( rAfter, 2, 0 );
59 rAfter->setChecked( true );
61 grid2->addRowSpacing( 0, 7 );
63 grid1->addMultiCellWidget ( grp, 0, 0, 0, 1 );
65 TQLabel *rc = new TQLabel( m_type == insertRow ? i18n( "Row:" ) : i18n( "Column:" ), tab1 );
66 grid1->addWidget( rc, 1, 0 );
68 m_value = new TQSpinBox( 1, m_type == insertRow ? m_table->getRows() : m_table->getColumns(),
69 1, tab1, "row_col_spinbox" );
70 m_value->setValue( insertHint + 1 );
72 grid1->addWidget( m_value, 1, 1 );
75void KWInsertDia::slotOk()
77 unsigned int insert = m_value->value() - ( m_rBefore->isChecked() ? 1 : 0 );
78 if ( m_type == insertRow )
79 m_view->tableInsertRow(insert, m_table);
81 m_view->tableInsertCol(insert, m_table);
82 KDialogBase::slotOk();
85#include "KWInsertDia.moc"
This class implements tables by acting as the manager for the frame(set)s which make up the table cel...
|