summaryrefslogtreecommitdiffstats
path: root/kpovmodeler/pmsolidobjectedit.cpp
blob: ea37908103ef63d233df82123591c6aed9a98bd9 (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
/*
**************************************************************************
                                 description
                             --------------------
    copyright            : (C) 2000-2001 by Andreas Zehender
    email                : [email protected]
**************************************************************************

**************************************************************************
*                                                                        *
*  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 "pmsolidobjectedit.h"
#include "pmsolidobject.h"

#include <tqcheckbox.h>
#include <tqlayout.h>
#include <tdelocale.h>

PMSolidObjectEdit::PMSolidObjectEdit( TQWidget* parent, const char* name )
      : Base( parent, name )
{
   m_pDisplayedObject = 0;
}

void PMSolidObjectEdit::createBottomWidgets( )
{
   m_pInverseButton = new TQCheckBox( i18n( "Inverse" ), this );
   m_pHollowButton = new TQCheckBox( i18n( "Hollow" ), this );

   m_pHollowButton->setTristate( true );
   
   topLayout( )->addWidget( m_pInverseButton );
   topLayout( )->addWidget( m_pHollowButton );

   connect( m_pHollowButton, TQ_SIGNAL( clicked( ) ), TQ_SIGNAL( dataChanged( ) ) );
   connect( m_pInverseButton, TQ_SIGNAL( clicked( ) ), TQ_SIGNAL( dataChanged( ) ) );

   Base::createBottomWidgets( );
}

void PMSolidObjectEdit::displayObject( PMObject* o )
{
   if( o->isA( "SolidObject" ) )
   {
      bool readOnly = o->isReadOnly( );
      
      m_pDisplayedObject = ( PMSolidObject* ) o;
      setCheckBox( m_pHollowButton, m_pDisplayedObject->hollow( ) );
      m_pInverseButton->setChecked( m_pDisplayedObject->inverse( ) );

      m_pHollowButton->setEnabled( !readOnly );
      m_pInverseButton->setEnabled( !readOnly );
      
      Base::displayObject( o );
   }
   else
      kdError( PMArea ) << "PMSolidObjectEdit: Can't display object\n";
}

void PMSolidObjectEdit::saveContents( )
{
   if( m_pDisplayedObject )
   {
      m_pDisplayedObject->setHollow( checkBoxState( m_pHollowButton ) );
      m_pDisplayedObject->setInverse( m_pInverseButton->isChecked( ) );
      Base::saveContents( );
   }
}

bool PMSolidObjectEdit::isDataValid( )
{
   return Base::isDataValid( );
}

#include "pmsolidobjectedit.moc"