21#include <tqgroupbox.h>
26#include <karbon_view.h>
27#include <karbon_part.h>
28#include <shapes/vrectangle.h>
29#include "vrectangletool.h"
30#include <KoUnitWidgets.h>
33VRectangleTool::VRectangleOptionsWidget::VRectangleOptionsWidget(
KarbonPart *part, TQWidget* parent,
const char* name )
34 : KDialogBase( parent, name, true, i18n(
"Insert Rectangle" ), Ok | Cancel ), m_part( part )
36 TQGroupBox *group =
new TQGroupBox( 2, TQt::Horizontal, i18n(
"Properties" ),
this );
38 m_widthLabel =
new TQLabel( i18n(
"object width",
"Width:" ), group );
39 m_width =
new KoUnitDoubleSpinBox( group, 0.0, 1000.0, 0.5, 100.0, KoUnit::U_MM );
41 m_heightLabel =
new TQLabel( i18n(
"Height:" ), group );
42 m_height =
new KoUnitDoubleSpinBox( group, 0.0, 1000.0, 0.5, 100.0, KoUnit::U_MM );
46 group->setInsideMargin( 4 );
47 group->setInsideSpacing( 2 );
49 setMainWidget( group );
54VRectangleTool::VRectangleOptionsWidget::width()
const
56 return m_width->value();
60VRectangleTool::VRectangleOptionsWidget::height()
const
62 return m_height->value();
66VRectangleTool::VRectangleOptionsWidget::setWidth(
double value )
68 m_width->setValue( value );
72VRectangleTool::VRectangleOptionsWidget::setHeight(
double value )
74 m_height->setValue( value );
78VRectangleTool::VRectangleOptionsWidget::refreshUnit()
80 m_width->setUnit( m_part->unit() );
81 m_height->setUnit( m_part->unit() );
84VRectangleTool::VRectangleTool( KarbonView *
view )
85 : VShapeTool(
view,
"tool_rectangle" )
88 m_optionWidget =
new VRectangleOptionsWidget( view->part() );
92VRectangleTool::~VRectangleTool()
94 delete( m_optionWidget );
100 m_optionWidget->refreshUnit();
104VRectangleTool::shape(
bool interactive )
const
112 m_optionWidget->width(),
113 m_optionWidget->height() );
127 return m_optionWidget->exec() == TQDialog::Accepted;
131VRectangleTool::setup( TDEActionCollection *collection )
133 m_action =
static_cast<TDERadioAction *
>(collection ->
action( name() ) );
137 m_action =
new TDERadioAction( i18n(
"Rectangle Tool" ),
"14_rectangle", TQt::Key_Plus+TQt::Key_F9,
this, TQ_SLOT(
activate() ), collection, name() );
138 m_action->setToolTip( i18n(
"Rectangle" ) );
139 m_action->setExclusiveGroup(
"shapes" );
Keeps track of visual per document properties.
A composite path consists of one or many subpaths.