#pragma warning ( disable: 4251 )
#endif
+/*!
+ \class CAF_Application
+ Defines application configuration and behaviour for application with
+ link to standard OCC OCAF data model. Allows to use OCC OCAF serives
+ (for example, undo/redo)
+*/
class CAF_EXPORT CAF_Application : public STD_Application
{
Q_OBJECT
#include <Standard.hxx>
class CAF_Study;
+//! OCC OCAF Std document
class Handle(TDocStd_Document);
+/*!
+ \class CAF_Operation
+ Base operation for all operations used in CAF package
+ Operation has link to OCC OCAF std document
+*/
class CAF_EXPORT CAF_Operation : public SUIT_Operation
{
Q_OBJECT
#pragma warning ( disable: 4251 )
#endif
+/*!
+ \class CAF_Study
+ Represents study for using in CAF, contains reference
+ to OCAF std document and allows to use OCAF services.
+ Provides necessary functionality for OCC transactions management.
+*/
class CAF_EXPORT CAF_Study : public SUIT_Study
{
Q_OBJECT
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.hxx>
+/*!
+ \class CAF_Tools
+ Prodives set of auxiliary static methods
+*/
class CAF_EXPORT CAF_Tools : public SUIT_Tools
{
public:
#pragma warning( disable:4251 )
#endif
+/*!
+ \class CAM_Application
+ Defines application configuration and behaviour for application with modules.
+ Every module has own data model, necessary windows and viewers, etc.
+ Application provides all necessary functionality for module management
+ (loading of modules/activation/deactivation, etc)
+*/
class CAM_EXPORT CAM_Application : public STD_Application
{
Q_OBJECT
class CAM_Study;
class SUIT_DataObject;
+/*!
+ \class CAM_DataModel
+ Base class for all data models used in CAM-based applications.
+ Represents data model of CAM module. Provides necessary interface (default implementation is empty)
+*/
class CAM_EXPORT CAM_DataModel : public QObject
{
Q_OBJECT
class CAM_Module;
class CAM_DataModel;
+/*!
+ \class CAM_DataObject
+ Provides only additional link to CAM_DataModel
+*/
class CAM_EXPORT CAM_DataObject : public SUIT_DataObject
{
public:
/*! Create tool.
* Insert QAction with id \a id from action map(myActionMap) to tool manager.
- *\param a - QAction
- *\param tBar - integer
*\param id - integer
+ *\param tBar - integer
*\param idx - integer
*\retval integer id of new action in tool manager.
*\retval Return -1 if something wrong.
/*! Create tool.
* Insert QAction with id \a id from action map(myActionMap) to tool manager.
- *\param a - QAction
- *\param tBar - QString&
*\param id - integer
+ *\param tBar - QString&
*\param idx - integer
*\retval integer id of new action in tool manager.
*\retval Return -1 if something wrong.
#pragma warning( disable:4251 )
#endif
+/*!
+ \class CAM_Study
+ Represents study for using in CAM, contains list of
+ data model references from all modules. Provides
+ necessary functionality for data models management.
+*/
class CAM_EXPORT CAM_Study : public SUIT_Study
{
Q_OBJECT
static pthread_t myThread;
#endif
+/*!
+ \return thread id
+*/
void SALOME_Event::GetSessionThread(){
#ifdef WIN32
myThread = ::GetCurrentThreadId();
#endif
}
+/*!
+ \return true if it is session thread
+*/
bool SALOME_Event::IsSessionThread(){
bool aResult = false;
#ifdef WIN32
}
-//===========================================================
/*!
- * SALOME_Event::SALOME_Event
- * Constructor
- */
-//===========================================================
+ Constructor
+*/
SALOME_Event::SALOME_Event(){
// if(MYDEBUG) MESSAGE( "SALOME_Event::SALOME_Event(): this = "<<this );
// Prepare the semaphore
*mySemaphore += 2;
}
-//===========================================================
/*!
- * SALOME_Event::~SALOME_Event
- * Destructor
- */
-//===========================================================
+ Destructor
+*/
SALOME_Event::~SALOME_Event(){
// if(MYDEBUG) MESSAGE( "SALOME_Event::~SALOME_Event(): this = "<<this );
if ( mySemaphore->available() < mySemaphore->total() )
delete mySemaphore;
}
-//===========================================================
/*!
- * SALOME_Event::process
- * Posts the event and optionally waits for its completion
- */
-//===========================================================
+ Posts the event and optionally waits for its completion
+*/
void SALOME_Event::process()
{
QThread::postEvent( qApp, new QCustomEvent( SALOME_EVENT, (void*)this ) );
// if(MYDEBUG) MESSAGE( "SALOME_Event::process(): this = "<<this<<" - COMPLETED" );
}
-//===========================================================
/*!
- * SALOME_Event::processed
- * Signals that this event has been processed
- */
-//===========================================================
+ Signals that this event has been processed
+*/
void SALOME_Event::processed()
{
// if(MYDEBUG) MESSAGE( "SALOME_Event::processed(): this = "<<this );
class QSemaphore;
-//===========================================================
/*!
- * Class: SALOME_Event
+ * \class SALOME_Event
* Description:
* This class encapsulates data and functionality required for
* posting component-specific events to perform arbitrary operations in main GUI thread.
* Caveats:
* There is no.
*/
-//===========================================================
#include <Event.h>
};
-// Template classes for member function
-//-------------------------------------
-template<class TObject, typename TRes>
-class EVENT_EXPORT TMemFunEvent: public SALOME_Event{
+/*!
+ \class TMemFunEvent
+ \brief Template class for member function
+*/
+template<class TObject, typename TRes> class EVENT_EXPORT TMemFunEvent: public SALOME_Event{
public:
typedef TRes TResult;
TResult myResult;
};
-template<class TObject>
-class EVENT_EXPORT TVoidMemFunEvent: public SALOME_Event{
+/*!
+ \class TVoidMemFunEvent
+ \brief Template class for member function
+*/
+template<class TObject> class EVENT_EXPORT TVoidMemFunEvent: public SALOME_Event{
public:
typedef void (TObject::* TAction)();
TVoidMemFunEvent(TObject* theObject, TAction theAction):
};
-// Template for member function with one argument
-//-----------------------------------------------
-template<class TObject, typename TRes,
- typename TArg, typename TStoreArg = TArg>
-class EVENT_EXPORT TMemFun1ArgEvent: public SALOME_Event{
+/*!
+ \class TMemFun1ArgEvent
+ \brief Template for member function with one argument
+*/
+template<class TObject, typename TRes, typename TArg, typename TStoreArg = TArg> class EVENT_EXPORT TMemFun1ArgEvent:
+public SALOME_Event{
public:
typedef TRes TResult;
TResult myResult;
};
-template<class TObject, typename TArg, typename TStoreArg = TArg>
-class EVENT_EXPORT TVoidMemFun1ArgEvent: public SALOME_Event{
+/*!
+ \class TVoidMemFun1ArgEvent
+ \brief Template for member function with one argument
+*/
+template<class TObject, typename TArg, typename TStoreArg = TArg> class EVENT_EXPORT TVoidMemFun1ArgEvent: public SALOME_Event{
public:
typedef void (TObject::* TAction)(TArg);
TVoidMemFun1ArgEvent(TObject* theObject, TAction theAction, TArg theArg):
};
-// Template for member function with one argument
-//-----------------------------------------------
-template<class TObject, typename TRes,
- typename TArg, typename TArg1,
- typename TStoreArg = TArg, typename TStoreArg1 = TArg1>
-class EVENT_EXPORT TMemFun2ArgEvent: public SALOME_Event{
+/*!
+ \class TMemFun2ArgEvent
+ \brief Template for member function with two arguments
+*/
+template<class TObject, typename TRes, typename TArg, typename TArg1, typename TStoreArg = TArg, typename TStoreArg1 = TArg1> class
+EVENT_EXPORT TMemFun2ArgEvent: public SALOME_Event{
public:
typedef TRes TResult;
TResult myResult;
};
-template<class TObject, typename TArg, typename TArg1,
- typename TStoreArg = TArg, typename TStoreArg1 = TArg1>
-class EVENT_EXPORT TVoidMemFun2ArgEvent: public SALOME_Event{
+/*!
+ \class TVoidMemFun2ArgEvent
+ \brief Template for member function with two arguments
+*/
+template<class TObject, typename TArg, typename TArg1, typename TStoreArg = TArg, typename TStoreArg1 = TArg1> class
+EVENT_EXPORT TVoidMemFun2ArgEvent: public SALOME_Event{
public:
typedef void (TObject::* TAction)(TArg,TArg1);
TVoidMemFun2ArgEvent(TObject* theObject, TAction theAction, TArg theArg, TArg1 theArg1):
};
-// Template function for processing events with result returing
+/*!
+ \fn ProcessEvent
+ \brief Template function for processing events with result returing
+*/
template<class TEvent> inline typename TEvent::TResult ProcessEvent(TEvent* theEvent){
typename TEvent::TResult aResult;
if(SALOME_Event::IsSessionThread()){
}
-// Template function for processing events without result
+/*!
+ \fn ProcessEvent
+ \brief Template function for processing events without result
+*/
inline void ProcessVoidEvent(SALOME_Event* theEvent){
if(SALOME_Event::IsSessionThread()){
theEvent->Execute();
// File: GLViewer_AspectLine.cxx
// Created: 26/05/2005 3:17:00 PM
-//================================================================
-// Class : GLViewer_AspectLine
-// Description : Substitution of Prs2d_AspectLine for OpenGL
-//================================================================
#include "GLViewer_AspectLine.h"
-//=======================================================================
-// Function: GLViewer_AspectLine
-// Purpose :
-//=======================================================================
+/*!
+ Default constructor
+*/
GLViewer_AspectLine::GLViewer_AspectLine()
{
myNColor = QColor( 255, 255, 255 );
myLineType = 0;
}
-//=======================================================================
-// Function: GLViewer_AspectLine
-// Purpose :
-//=======================================================================
+/*!
+ Constructor
+ \param type: 0 for normal line and 1 for strip line
+ \param width - width of line
+*/
GLViewer_AspectLine::GLViewer_AspectLine( int type, float width )
{
myNColor = QColor( 255, 255, 255 );
myLineType = 0;
}
-//=======================================================================
-// Function: ~GLViewer_AspectLine
-// Purpose :
-//=======================================================================
+/*!
+ Destructor
+*/
GLViewer_AspectLine::~GLViewer_AspectLine()
{
}
-//=======================================================================
-// Function: setLineColors
-// Purpose :
-//=======================================================================
+/*!
+ Sets line color
+ \param nc - normal color
+ \param hc - hilighting color
+ \param sc - selection color
+*/
void GLViewer_AspectLine::setLineColors( QColor nc, QColor hc, QColor sc )
{
myNColor = nc;
mySColor = sc;
}
-//=======================================================================
-// Function: setLineType
-// Purpose :
-//=======================================================================
+/*!
+ Sets type of line
+ \param type: 0 for normal line and 1 for strip line
+*/
int GLViewer_AspectLine::setLineType( const int type )
{
if( type == 1 || type == 0 )
return 1;
}
-//=======================================================================
-// Function: setLineWidth
-// Purpose :
-//=======================================================================
+/*!
+ Sets width of line
+ \param width - new width of line
+*/
int GLViewer_AspectLine::setLineWidth( const float width )
{
if( width > 0 )
return 1;
}
-//=======================================================================
-// Function: getLineColors
-// Purpose :
-//=======================================================================
+/*!
+ \return colors of line
+ \param nc - variable for normal color
+ \param hc - variable for hilighting color
+ \param sc - variable for selection color
+*/
void GLViewer_AspectLine::getLineColors( QColor& nc, QColor& hc, QColor& sc ) const
{
nc = myNColor;
sc = mySColor;
}
-//=======================================================================
-// Function: getByteCopy
-// Purpose :
-//=======================================================================
+/*!
+ \return binary representation of line aspect
+*/
QByteArray GLViewer_AspectLine::getByteCopy() const
{
int anISize = sizeof( int );
return aResult;
}
-//=======================================================================
-// Function: fromByteCopy
-// Purpose :
-//=======================================================================
+/*!
+ Sets line aspect from binary representation
+*/
GLViewer_AspectLine* GLViewer_AspectLine::fromByteCopy( QByteArray theBytes )
{
#endif
/*!
- * Class GLViewer_AspectLine
- * Substitution of Prs2d_AspectLine for OpenGL
- */
+ \Class GLViewer_AspectLine
+ Substitution of Prs2d_AspectLine for OpenGL
+*/
class GLVIEWER_API GLViewer_AspectLine
{
#include <GL/glx.h>
#endif
-/***************************************************************************
-** Class: GLViewer_MarkerDrawer
-** Descr: Drawer for GLViewer_MarkerSet
-** Module: GLViewer
-** Created: UI team, 03.10.01
-****************************************************************************/
-
GLfloat sin_table[SEGMENTS];
GLfloat cos_table[SEGMENTS];
+/*!
+ Default constructor
+*/
GLViewer_MarkerDrawer::GLViewer_MarkerDrawer()
: GLViewer_Drawer()
{
myObjectType = "GLViewer_MarkerSet";
}
+/*!
+ Destructor
+*/
GLViewer_MarkerDrawer::~GLViewer_MarkerDrawer()
{
}
+/*! Draws object in GLViewer
+ \param xScale - current scale along X-direction
+ \param yScale - current scale along Y-direction
+ \param onlyUpdate - = true if only update highlight-select information
+*/
void GLViewer_MarkerDrawer::create( float xScale, float yScale, bool onlyUpdate )
{
QValueList<int>::Iterator it;
}
}
+/*! Draws marker
+ \param theXCoord - X position
+ \param theYCoord - Y position
+ \param theRadius - radius
+ \param theColor - color
+ \param theAspectLine - line aspect
+*/
void GLViewer_MarkerDrawer::drawMarker( float& theXCoord, float& theYCoord,
float& theRadius, QColor& theColor, GLViewer_AspectLine* theAspectLine )
{
glEnd();
}
-/***************************************************************************
-** Class: GLViewer_PolylineDrawer
-** Descr: Drawer for GLViewer_Polyline
-** Module: GLViewer
-** Created: UI team, 03.10.01
-****************************************************************************/
+/*!
+ Default constructor
+*/
GLViewer_PolylineDrawer::GLViewer_PolylineDrawer()
:GLViewer_Drawer()
{
myObjectType = "GLViewer_Polyline";
}
+/*!
+ Destructor
+*/
GLViewer_PolylineDrawer::~GLViewer_PolylineDrawer()
{
}
+/*! Draws object in GLViewer
+ \param xScale - current scale along X-direction
+ \param yScale - current scale along Y-direction
+ \param onlyUpdate - = true if only update highlight-select information
+*/
void GLViewer_PolylineDrawer::create( float xScale, float yScale, bool onlyUpdate )
{
QValueList<GLViewer_Object*>::Iterator aObjectIt = myObjects.begin();
}
}
-/***************************************************************************
-** Class: GLViewer_TextDrawer
-** Descr:
-** Module: GLViewer
-** Created: UI team, 27.02.04
-****************************************************************************/
-
+/*!
+ Default constructor
+*/
GLViewer_TextDrawer::GLViewer_TextDrawer()
: GLViewer_Drawer()
{
myObjectType = "GLViewer_TextObject";
}
+/*!
+ Destructor
+*/
GLViewer_TextDrawer::~GLViewer_TextDrawer()
{
}
+/*! Draws object in GLViewer
+ \param xScale - current scale along X-direction
+ \param yScale - current scale along Y-direction
+ \param onlyUpdate - = true if only update highlight-select information
+*/
void GLViewer_TextDrawer::create( float xScale, float yScale, bool onlyUpdate )
{
QValueList<GLViewer_Object*>::Iterator aObjectIt = myObjects.begin();
}
}
+/*!
+ Updates objects after updating font
+*/
void GLViewer_TextDrawer::updateObjects()
{
QValueList<GLViewer_Object*>::Iterator aObjectIt = myObjects.begin();
#pragma warning( disable:4251 )
#endif
-/*! Class GLViewer_MarkerDrawer
-* Drawer for GLViewer_MarkerSet
- */
+/*!
+ \class GLViewer_MarkerDrawer
+ Drawer for GLViewer_MarkerSet
+*/
class GLVIEWER_API GLViewer_MarkerDrawer : public GLViewer_Drawer
{
void drawMarker( float& x, float& y, float& radius, QColor& color, GLViewer_AspectLine* aspect );
};
-/*! Class GLViewer_PolylineDrawer
-* Drawer for GLViewer_Polyline
+/*!
+ \class GLViewer_PolylineDrawer
+ Drawer for GLViewer_Polyline
*/
class GLVIEWER_API GLViewer_PolylineDrawer : public GLViewer_Drawer
virtual void create( float, float, bool );
};
-/* Class GLViewer_TextDrawer
-* Drawer for GLViewer_Text
+/*!
+ \class GLViewer_TextDrawer
+ Drawer for GLViewer_Text
*/
class GLVIEWER_API GLViewer_TextDrawer: public GLViewer_Drawer
// Author : OPEN CASCADE
//
-/***************************************************************************
-** Class: GLViewer_BaseObjects
-** Descr: Internal OpenGL Objects
-** Module: GLViewer
-** Created: UI team, 02.09.02
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_BaseObjects.h"
#include "GLViewer_BaseDrawers.h"
//#include <cmath>
//using namespace std;
-/***************************************************************************
-** Class: GLViewer_MarkerSet
-** Descr: OpenGL MarkerSet
-** Module: GLViewer
-** Created: UI team, 03.09.02
-****************************************************************************/
-
+/*!
+ Constructor
+*/
GLViewer_MarkerSet::GLViewer_MarkerSet( int number, float size, const QString& toolTip ) :
GLViewer_Object(),
myNumber( 0 ),
setNumMarkers( number );
}
+/*!
+ Destructor
+*/
GLViewer_MarkerSet::~GLViewer_MarkerSet()
{
if ( myXCoord )
delete[] myYCoord;
}
+/*!
+ Adds coords to text buffer in HPGL format
+ \param buffer - text buffer
+ \param command - command to be added with coords
+ \param aViewerCS - viewer co-ordinates system
+ \param aPaperCS - paper co-ordinates system
+ \param x - x co-ordinate
+ \param y - y co-ordinate
+ \param NewLine - adds new line to buffer
+*/
void AddCoordsToHPGL( QString& buffer, QString command, GLViewer_CoordSystem* aViewerCS,
GLViewer_CoordSystem* aPaperCS, double x, double y, bool NewLine = true )
{
buffer += ";\n";
}
+/*!
+ Adds coords to text buffer in PostScript format
+ \param buffer - text buffer
+ \param command - command to be added with coords
+ \param aViewerCS - viewer co-ordinates system
+ \param aPaperCS - paper co-ordinates system
+ \param x - x co-ordinate
+ \param y - y co-ordinate
+ \param NewLine - adds new line to buffer
+*/
void AddCoordsToPS( QString& buffer, QString command, GLViewer_CoordSystem* aViewerCS,
GLViewer_CoordSystem* aPaperCS, double x, double y, bool NewLine = true )
{
buffer += "\n";
}
+/*!
+ Adds line aspect description to text buffer in PostScript format
+ \param buffer - text buffer
+ \param anAspect - line aspect
+ \param aViewerCS - viewer co-ordinates system
+ \param aPaperCS - paper co-ordinates system
+*/
void AddLineAspectToPS( QString& buffer, GLViewer_AspectLine* anAspect,
GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPaperCS )
{
}
#ifdef WIN32
+/*!
+ Adds line aspect description EMF image
+ \param hDC - descriptor of EMF
+ \param anAspect - line aspect
+ \param aViewerCS - viewer co-ordinates system
+ \param aPaperCS - paper co-ordinates system
+*/
HPEN AddLineAspectToEMF( HDC hDC, GLViewer_AspectLine* anAspect,
GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPaperCS )
{
}
#endif
+/*!
+ Saves to file PostScript set of markers
+ \param hFile - file instance
+ \param aViewerCS - viewer co-ordinates system
+ \param aPSCS - paper co-ordinates system
+*/
bool GLViewer_MarkerSet::translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS )
{
int noPoints = 20;
return true;
}
+/*!
+ Saves to file HPGL set of markers
+ \param hFile - file instance
+ \param aViewerCS - viewer co-ordinates system
+ \param aHPGLCS - paper co-ordinates system
+*/
bool GLViewer_MarkerSet::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS,
GLViewer_CoordSystem* aHPGLCS )
{
}
#ifdef WIN32
+/*!
+ Saves to EMF image set of markers
+ \param dc - EMF image descriptor
+ \param aViewerCS - viewer co-ordinates system
+ \param aEMFCS - paper co-ordinates system
+*/
bool GLViewer_MarkerSet::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS )
{
int noPoints = 20;
}
#endif
-
+/*!
+ Computes all necessary information about object for presentation in drawer
+*/
void GLViewer_MarkerSet::compute()
{
// cout << "GLViewer_MarkerSet::compute" << endl;
myRect->setBottom( ya - myYGap );
}
+/*!
+ Creates corresponding drawer
+*/
GLViewer_Drawer* GLViewer_MarkerSet::createDrawer()
{
// cout << "GLViewer_MarkerSet::createDrawer" << endl;
return myDrawer = new GLViewer_MarkerDrawer();
}
-
+/*!
+ Computes highlight presentation
+ \param x - x coord
+ \param y - y coord
+ \param tol - tolerance of detecting
+ \param isCircle - true if sensitive area of detection is round
+ \return true if highlight status is changed
+*/
GLboolean GLViewer_MarkerSet::highlight( GLfloat x, GLfloat y, GLfloat tol, GLboolean isCircle )
{
if( !myIsVisible )
return update;
}
+/*!
+ Unhilights object
+*/
GLboolean GLViewer_MarkerSet::unhighlight()
{
if( !myHNumbers.isEmpty() )
return GL_FALSE;
}
+/*!
+ Selects marker set
+ /param x, y - co-ordinates of mouse
+ /param tol - tolerance
+ /param rect - rectangle (in case of rectangular selection)
+ /param isFull - if it is true, then object may selected only if it lays whole in selection zone
+ \param isCircle - true if sensitive area of detection is round
+ \param isShift - true if selection exec with append option
+*/
GLboolean GLViewer_MarkerSet::select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull,
GLboolean isCircle, GLboolean isShift )
{
return myIsSel;
}
+/*!
+ Unselects marker set
+*/
GLboolean GLViewer_MarkerSet::unselect()
{
if( !mySelNumbers.isEmpty() )
return GL_FALSE;
}
+/*!
+ \return update object rectangle
+ Does not equal getRect() if object have a persistence to some viewer transformations
+*/
GLViewer_Rect* GLViewer_MarkerSet::getUpdateRect()
{
GLViewer_Rect* rect = new GLViewer_Rect();
return rect;
}
-
+/*!
+ Sets array of x coords of points
+ \param xCoord - array of co-ordinates
+ \param size - array size
+*/
void GLViewer_MarkerSet::setXCoord( GLfloat* xCoord, int size )
{
myXCoord = new GLfloat[ size ];
myXCoord[i] = xCoord[i];
}
+/*!
+ Sets array of y coords of points
+ \param yCoord - array of co-ordinates
+ \param size - array size
+*/
void GLViewer_MarkerSet::setYCoord( GLfloat* yCoord, int size )
{
myYCoord = new GLfloat[ size ];
myYCoord[i] = yCoord[i];
}
+/*!
+ Sets number of markers
+ \param number - new number of markers
+*/
void GLViewer_MarkerSet::setNumMarkers( GLint number )
{
if ( myNumber == number )
myXCoord = new GLfloat[ myNumber ];
myYCoord = new GLfloat[ myNumber ];
}
-/*
-void GLViewer_MarkerSet::onSelectionDone( bool append)
-{
- mySelectedIndexes.Clear();
- QValueList<int>::Iterator it;
- //for( it = myMarkers->mySelNumbers.begin(); it != myMarkers->mySelNumbers.end(); ++it )
- // mySelectedIndexes.Append( *it / 2 ); //!!!
- emit dvMarkersSelected( mySelectedIndexes );
-}
-void GLViewer_MarkerSet::onSelectionCancel()
-{
- mySelectedIndexes.Clear();
- emit dvMarkersSelected( mySelectedIndexes );
-}
+/*!
+ Export numbers of highlighted/selected lines
*/
void GLViewer_MarkerSet::exportNumbers( QValueList<int>& highlight,
QValueList<int>& unhighlight,
myUHNumbers = myHNumbers;
}
+/*!
+ Adds or remove selected number
+ \param index - selected index
+*/
bool GLViewer_MarkerSet::addOrRemoveSelected( int index )
{
if( index < 0 || index > myNumber )
return TRUE;
}
+/*!
+ Adds some selected numbers
+ \param seq - sequence of indices
+*/
void GLViewer_MarkerSet::addSelected( const TColStd_SequenceOfInteger& seq )
{
for ( int i = 1; i <= seq.Length(); i++ )
mySelNumbers.append( seq.Value( i ) - 1 );
}
+/*!
+ Sets some numbers as selected
+ \param seq - sequence of indices
+*/
void GLViewer_MarkerSet::setSelected( const TColStd_SequenceOfInteger& seq )
{
// for( QValueList<int>::Iterator it = mySelNumbers.begin(); it != mySelNumbers.end(); ++it )
mySelNumbers.append( seq.Value( i ) - 1 );
}
+/*! Moves object by recomputing
+ \param dx - moving along X coord
+ \param dy - moving along Y coord
+ \param fromGroup - is true if this method called from group
+*/
void GLViewer_MarkerSet::moveObject( float theX, float theY, bool fromGroup )
{
if( !fromGroup && myGroup)
compute();
}
+/*!
+ Codes marker set as byte copy
+ \return byte array
+*/
QByteArray GLViewer_MarkerSet::getByteCopy()
{
int i = 0;
return aResult;
}
+/*!
+ Initialize marker set by byte array
+ \param theArray - byte array
+*/
bool GLViewer_MarkerSet::initializeFromByteCopy( QByteArray theArray )
{
int i = 0;
return true;
}
-/***************************************************************************
-** Class: GLViewer_Polyline
-** Descr: OpenGL Polyline
-** Module: GLViewer
-** Created: UI team, 03.09.02
-****************************************************************************/
+/*!
+ \class GLViewer_Polyline
+ OpenGL Polyline
+*/
#define SECTIONS 100
#define DISTANTION 5
+/*!
+ Constructor
+ \param number - number of segments
+ \param size - size of polyline
+ \param toolTip - tool tip of polyline
+*/
GLViewer_Polyline::GLViewer_Polyline( int number, float size, const QString& toolTip ):
GLViewer_Object(),
myNumber( 0 ),
myToolTipText = toolTip;
}
+/*!
+ Destructor, destroys internal arrays of co-ordinates
+*/
GLViewer_Polyline::~GLViewer_Polyline()
{
if ( myXCoord )
delete[] myYCoord;
}
+/*!
+ Saves polyline to file PostScript
+ \param hFile - file instance
+ \param aViewerCS - viewer co-ordinates system
+ \param aPSCS - paper co-ordinates system
+*/
bool GLViewer_Polyline::translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS )
{
QString aBuffer = "newpath\n";
return true;
}
+/*!
+ Saves polyline to file HPGL
+ \param hFile - file instance
+ \param aViewerCS - viewer co-ordinates system
+ \param aHPGLCS - paper co-ordinates system
+*/
bool GLViewer_Polyline::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS )
{
QString aBuffer = "";
}
#ifdef WIN32
+/*!
+ Saves polyline to EMF image
+ \param dc - EMF image descriptor
+ \param aViewerCS - viewer co-ordinates system
+ \param aEMFCS - paper co-ordinates system
+*/
bool GLViewer_Polyline::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS )
{
if( !aViewerCS || !aEMFCS )
}
#endif
+/*!
+ Computes all necessary information about object for presentation in drawer
+*/
void GLViewer_Polyline::compute()
{
// cout << "GLViewer_MarkerSet::compute" << endl;
myRect->setBottom( ya - yGap );
}
+/*!
+ \return update object rectangle
+ Does not equal getRect() if object have a persistence to some viewer transformations
+*/
GLViewer_Rect* GLViewer_Polyline::getUpdateRect()
{
GLViewer_Rect* rect = new GLViewer_Rect();
return rect;
}
+/*!
+ Creates corresponding drawer
+*/
GLViewer_Drawer* GLViewer_Polyline::createDrawer()
{
// cout << "GLViewer_MarkerSet::createDrawer" << endl;
return myDrawer = new GLViewer_PolylineDrawer();
}
+/*!
+ Computes highlight presentation
+ \param x - x coord
+ \param y - y coord
+ \param tol - tolerance of detecting
+ \param isCircle - true if sensitive area of detection is round
+ \return true if highlight status is changed
+*/
GLboolean GLViewer_Polyline::highlight( GLfloat x, GLfloat y, GLfloat tol, GLboolean isCircle )
{
if( !myIsVisible )
return update;
}
+/*!
+ Unhilights object
+*/
GLboolean GLViewer_Polyline::unhighlight()
{
// if( !myHNumbers.isEmpty() )
return GL_FALSE;
}
+/*!
+ Selects polyline
+ /param x, y - co-ordinates of mouse
+ /param tol - tolerance
+ /param rect - rectangle (in case of rectangular selection)
+ /param isFull - if it is true, then object may selected only if it lays whole in selection zone
+ \param isCircle - true if sensitive area of detection is round
+ \param isShift - true if selection exec with append option
+*/
GLboolean GLViewer_Polyline::select( GLfloat x, GLfloat y, GLfloat tol, GLViewer_Rect rect, GLboolean isFull,
GLboolean isCircle, GLboolean isShift )
{
return myIsSel;
}
+/*!
+ Unselects polyline
+*/
GLboolean GLViewer_Polyline::unselect()
{
// if( !mySelNumbers.isEmpty() )
return GL_FALSE;
}
+/*!
+ Sets array of abscisses for points of polyline
+ \param xCoord - array of of abscisses
+ \param size - size of array
+*/
void GLViewer_Polyline::setXCoord( GLfloat* xCoord, int size )
{
myXCoord = new GLfloat[ size ];
myXCoord[i] = xCoord[i];
}
+/*!
+ Sets array of ordinates for points of polyline
+ \param xCoord - array of of ordinates
+ \param size - size of array
+*/
void GLViewer_Polyline::setYCoord( GLfloat* yCoord, int size )
{
myYCoord = new GLfloat[ size ];
myYCoord[i] = yCoord[i];
}
+/*!
+ Sets number of points
+ \param number - new number of points
+*/
void GLViewer_Polyline::setNumber( GLint number )
{
if ( myNumber == number )
myXCoord = new GLfloat[ myNumber ];
myYCoord = new GLfloat[ myNumber ];
}
-/*
-void GLViewer_Polyline::onSelectionDone( bool append)
-{
- mySelectedIndexes.Clear();
- QValueList<int>::Iterator it;
- //for( it = myMarkers->mySelNumbers.begin(); it != myMarkers->mySelNumbers.end(); ++it )
- // mySelectedIndexes.Append( *it / 2 ); //!!!
-}
-void GLViewer_Polyline::onSelectionCancel()
-{
- mySelectedIndexes.Clear();
-}
+/*!
+ Export numbers of highlighted/selected lines
*/
void GLViewer_Polyline::exportNumbers( QValueList<int>& highlight,
QValueList<int>& unhighlight,
unselect = myUSelNumbers;
}
+/*!
+ Moves object by recomputing
+ \param dx - moving along X coord
+ \param dy - moving along Y coord
+ \param fromGroup - is true if this method called from group
+*/
void GLViewer_Polyline::moveObject( float theX, float theY, bool fromGroup )
{
if( !fromGroup && myGroup)
compute();
}
+/*!
+ Codes polyline as byte copy
+ \return byte array
+*/
QByteArray GLViewer_Polyline::getByteCopy()
{
int i = 0;
}
+/*!
+ Initialize polyline by byte array
+ \param theArray - byte array
+*/
bool GLViewer_Polyline::initializeFromByteCopy( QByteArray theArray )
{
int i = 0;
return true;
}
-/***************************************************************************
-** Class: GLViewer_TextObject
-** Descr: Text as Object for OpenGL
-** Module: GLViewer
-** Created: UI team, 12.02.04
-****************************************************************************/
+
+/*!
+ Constructor
+ \param theStr - text string
+ \param xPos - x position
+ \param yPos - y position
+ \param color - color of text
+ \param toolTip - tooltip of text object
+*/
GLViewer_TextObject::GLViewer_TextObject( const QString& theStr, float xPos, float yPos,
const QColor& color, const QString& toolTip )
: GLViewer_Object()
myToolTipText = toolTip;
}
+
+/*!
+ Destructor
+*/
GLViewer_TextObject::~GLViewer_TextObject()
{
if ( myGLText )
delete myGLText;
}
+/*!
+ Saves text object to file PostScript
+ \param hFile - file instance
+ \param aViewerCS - viewer co-ordinates system
+ \param aPSCS - paper co-ordinates system
+*/
bool GLViewer_TextObject::translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS )
{
QString aText = myGLText->getText();
return true;
}
+/*!
+ Saves text object to file HPGL
+ \param hFile - file instance
+ \param aViewerCS - viewer co-ordinates system
+ \param aHPGLCS - paper co-ordinates system
+*/
bool GLViewer_TextObject::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS )
{
QString aText = myGLText->getText();
}
#ifdef WIN32
+/*!
+ Saves text object to EMF image
+ \param dc - EMF image descriptor
+ \param aViewerCS - viewer co-ordinates system
+ \param aEMFCS - paper co-ordinates system
+*/
bool GLViewer_TextObject::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS )
{
QString aText = myGLText->getText();
}
#endif
+/*!
+ Creates corresponding drawer
+*/
GLViewer_Drawer* GLViewer_TextObject::createDrawer()
{
myDrawer = new GLViewer_TextDrawer();
return myDrawer;
}
+/*!
+ Computes all necessary information about object for presentation in drawer
+*/
void GLViewer_TextObject::compute()
{
float xPos, yPos;
myRect->setBottom( yPos );
}
+/*!
+ Installing already exist drawer with same type
+ \param theDrawer - new drawer
+*/
void GLViewer_TextObject::setDrawer( GLViewer_Drawer* theDrawer )
{
myDrawer = theDrawer;
//compute();
}
+/*!
+ \return update object rectangle
+ Does not equal getRect() if object have a persistence to some viewer transformations
+*/
GLViewer_Rect* GLViewer_TextObject::getUpdateRect()
{
GLViewer_Rect* rect = new GLViewer_Rect();
return rect;
}
+/*!
+ Computes highlight presentation
+ \param x - x coord
+ \param y - y coord
+ \param tol - tolerance of detecting
+ \param isCircle - true if sensitive area of detection is round
+ \return true if highlight status is changed
+*/
GLboolean GLViewer_TextObject::highlight( GLfloat theX, GLfloat theY, GLfloat theTol, GLboolean isCircle )
{
if( !myIsVisible )
return myIsHigh;
}
+/*!
+ Unhilights object
+*/
GLboolean GLViewer_TextObject::unhighlight()
{
if( myIsHigh )
return GL_FALSE;
}
+/*!
+ Selects text object
+ /param x, y - co-ordinates of mouse
+ /param tol - tolerance
+ /param rect - rectangle (in case of rectangular selection)
+ /param isFull - if it is true, then object may selected only if it lays whole in selection zone
+ \param isCircle - true if sensitive area of detection is round
+ \param isShift - true if selection exec with append option
+*/
GLboolean GLViewer_TextObject::select( GLfloat theX, GLfloat theY, GLfloat theTol, GLViewer_Rect rect,
GLboolean isFull, GLboolean isCircle, GLboolean isShift )
{
return myIsSel;
}
+/*!
+ Unselects text object
+*/
GLboolean GLViewer_TextObject::unselect()
{
if( myIsSel )
return GL_FALSE;
}
+/*!
+ Moves object by recomputing
+ \param dx - moving along X coord
+ \param dy - moving along Y coord
+ \param fromGroup - is true if this method called from group
+*/
void GLViewer_TextObject::moveObject( float theX, float theY, bool fromGroup )
{
if( !fromGroup && myGroup)
compute();
}
+/*!
+ Codes text object as byte copy
+ \return byte array
+*/
QByteArray GLViewer_TextObject::getByteCopy()
{
QByteArray aObject = GLViewer_Object::getByteCopy();
return aObject;
}
+/*!
+ Initialize text object by byte array
+ \param theArray - byte array
+*/
bool GLViewer_TextObject::initializeFromByteCopy( QByteArray theArray )
{
if( !GLViewer_Object::initializeFromByteCopy( theArray ) || myType != "GLViewer_TextObject" )
#endif
/*!
- * Class GLViewer_MarkerSet
- * OpenGL MarkerSet
- */
-
+ \class GLViewer_MarkerSet
+ OpenGL MarkerSet
+*/
class GLVIEWER_API GLViewer_MarkerSet : public GLViewer_Object
{
public:
};
/*!
- * Class GLViewer_Polyline
- * OpenGL Polyline
- */
-
+ \class GLViewer_Polyline
+ OpenGL Polyline
+*/
class GLVIEWER_API GLViewer_Polyline: public GLViewer_Object
{
public:
//! Checks highlight as whole object status
GLboolean isHighSelAll() const { return myHighSelAll; }
- //! Export numbers of heghlighted/selected lines
+ //! Export numbers of highlighted/selected lines
void exportNumbers( QValueList<int>& high, QValueList<int>& unhigh,
QValueList<int>& sel, QValueList<int>& unsel );
GLboolean myHighFlag;
};
-// Class: GLViewer_TextObject
-// Descr: Text as Object for OpenGL
-
+/*!
+ \class GLViewer_TextObject
+ Text as Object for OpenGL
+*/
class GLVIEWER_API GLViewer_TextObject : public GLViewer_Object
{
public:
// File: GLViewer_Compass.cxx
// Created: November, 2004
-//================================================================
-// Class : GLViewer_Compass
-// Description : Class implement representatiof of compass in one of corner in GLViewer
-//================================================================
-
#include "GLViewer_Compass.h"
#include "GLViewer_Drawer.h"
-//=======================================================================
-// Function: GLViewer_Compass
-// Purpose :
-//=======================================================================
+/*!
+ Constructor
+ \param color - a color of compass
+ \param size - a diameter of compass
+ \param pos - a position
+ \param WidthTop - width of wide part of arrow
+ \param WidthBottom - width of base part of arrow
+ \param HeightTop - height of arrow header
+ \param HeightBottom - height of arrow cut on bottom
+*/
GLViewer_Compass::GLViewer_Compass ( const QColor& color, const int size, const Position pos,
const int WidthTop, const int WidthBottom, const int HeightTop,
const int HeightBottom )
//myFont->generateTexture();
}
-//=======================================================================
-// Function: ~GLViewer_Compass
-// Purpose :
-//=======================================================================
+/*!
+ Destructor
+*/
GLViewer_Compass::~GLViewer_Compass()
{
delete myFont;
}
-//=======================================================================
-// Function: setCompass
-// Purpose :
-//=======================================================================
+/*!
+ Sets parameters of compass
+ \param color - a color of compass
+ \param size - a diameter of compass
+ \param pos - a position
+*/
void GLViewer_Compass::setCompass( const QColor& color, const int size, const Position pos )
{
myCol = color;
myPos = pos;
}
-//=======================================================================
-// Function: setVisible
-// Purpose :
-//=======================================================================
+/*!
+ Sets visibility of compass
+ \param vis - new visibility state
+*/
void GLViewer_Compass::setVisible( const bool vis )
{
myIsVisible = vis;
}
-//=======================================================================
-// Function: setSize
-// Purpose :
-//=======================================================================
+/*!
+ Sets size of compass
+ \param size - new size
+*/
void GLViewer_Compass::setSize( const int size )
{
if( size > 0 )
mySize=size;
}
-//=======================================================================
-// Function: setArrowWidthTop
-// Purpose :
-//=======================================================================
+/*!
+ Sets arrow width top
+ \param WidthTop - new arrow width top
+*/
void GLViewer_Compass::setArrowWidthTop( const int WidthTop )
{
if( WidthTop < myArrowWidthBottom || WidthTop > mySize )
myArrowWidthTop=WidthTop;
}
-//=======================================================================
-// Function: setArrowWidthBottom
-// Purpose :
-//=======================================================================
+/*!
+ Sets arrow width bottom
+ \param WidthBot - new arrow width bottom
+*/
void GLViewer_Compass::setArrowWidthBottom( const int WidthBot )
{
if( WidthBot > myArrowWidthTop || WidthBot < 1 )
myArrowWidthBottom=WidthBot;
}
-//=======================================================================
-// Function: setArrowHeightTop
-// Purpose :
-//=======================================================================
+/*!
+ Sets arrow height top
+ \param HeightTop - new arrow height top
+*/
void GLViewer_Compass::setArrowHeightTop( const int HeightTop )
{
if( HeightTop > (2*mySize-myArrowHeightBottom ) || HeightTop < 1 )
myArrowHeightTop=HeightTop;
}
-//=======================================================================
-// Function: setArrowHeightBottom
-// Purpose :
-//=======================================================================
+/*!
+ Sets arrow height bottom
+ \param HeightBot - new arrow height bottom
+*/
void GLViewer_Compass::setArrowHeightBottom( const int HeightBot )
{
if( HeightBot > ( 2*mySize-myArrowHeightTop ) || HeightBot < 1)
myArrowHeightBottom=HeightBot;
}
-//=======================================================================
-// Function: getFont
-// Purpose :
-//=======================================================================
+/*!
+ \return font of compass
+*/
GLViewer_TexFont* GLViewer_Compass::getFont()
{
if(!isGenereted)
return myFont;
}
-//=======================================================================
-// Function: setFont
-// Purpose :
-//=======================================================================
+/*!
+ Sets font of compass
+ \param theFont - new font
+*/
void GLViewer_Compass::setFont( QFont theFont )
{
delete myFont;
#pragma warning( disable:4251 )
#endif
+class GLViewer_TexFont;
+
/*! Class GLViewer_Compass
* Class implement representatiof of compass in one of corner in GLViewer.
* Compass it's a some round visual pointer rotated with view window and
* located in fixed place (in one fixed corner)
*/
-
-class GLViewer_TexFont;
-
class GLVIEWER_API GLViewer_Compass
{
public:
// File: GLViewer_Context.cxx
// Created: November, 2004
-//================================================================
-// Class : GLViewer_AspectLine
-// Description : Class for manage of presentations in GLViewer
-//================================================================
+/*!
+ \class GLViewer_AspectLine
+ \brief Class for manage of presentations in GLViewer
+*/
#include "GLViewer_Context.h"
#define TOLERANCE 12
-//=======================================================================
-// Function: GLViewer_Context
-// Purpose :
-//=======================================================================
+/*!
+ Constructor
+*/
GLViewer_Context::GLViewer_Context( GLViewer_Viewer2d* v ) :
myGLViewer2d( v ),
myHighlightColor( Quantity_NOC_CYAN1 ),
mySelCurIndex = 0;
}
-//=======================================================================
-// Function: ~GLViewer_Context
-// Purpose :
-//=======================================================================
+/*!
+ Destructor
+*/
GLViewer_Context::~GLViewer_Context()
{
myActiveObjects.clear();
mySelectedObjects.clear();
}
-//=======================================================================
-// Function: MoveTo
-// Purpose :
-//=======================================================================
+/*!
+ Hiilights objects under cursor
+ \param x - X coord of mouse cursor
+ \param y - Y coord of mouse cursor
+ \param byCircle - true if needs round sensitive area around mouse cursor, else rectangle
+ function search object rectangle which intersect with sensitive area and call object highlight method
+*/
int GLViewer_Context::MoveTo( int xi, int yi, bool byCircle )
{
GLfloat x = (GLfloat)xi;
return 0;
}
-//=======================================================================
-// Function: Select
-// Purpose :
-//=======================================================================
+/*! Selects already highlighting object by calling object method select
+ \param Append - true if new selection will be append to existing selection, false - another
+ \param byCircle - true if needs round selection area in complex object
+*/
int GLViewer_Context::Select( bool Append, bool byCircle )
{
ObjList::Iterator it, itEnd, oit, oitEnd;
return SS_NoChanged;
}
-//=======================================================================
-// Function: SelectByRect
-// Purpose :
-//=======================================================================
+/*! Selects objects on scene by rectangle
+ \param theRect - rectangle of selection
+ \param Append - true if new selection will be append to existing selection, false - another
+ function search object rectangle which intersect with theRect and call object select method
+*/
int GLViewer_Context::SelectByRect( const QRect& theRect, bool Append )
{
GLfloat aXScale;
return status;
}
-//=======================================================================
-// Function: SetHighlightColor
-// Purpose :
-//=======================================================================
+/*!
+ Sets color of hilighting
+ \param aCol - new color of highlighting
+*/
void GLViewer_Context::SetHighlightColor( Quantity_NameOfColor aCol )
{
myHighlightColor = aCol;
myGLViewer2d->updateColors( colH, colS);
}
-//=======================================================================
-// Function: SetSelectionColor
-// Purpose :
-//=======================================================================
+/*!
+ Sets color of selection
+ \param aCol - new color of selection
+*/
void GLViewer_Context::SetSelectionColor( Quantity_NameOfColor aCol )
{
mySelectionColor = aCol;
myGLViewer2d->updateColors( colH, colS);
}
-//=======================================================================
-// Function: NbSelected
-// Purpose :
-//=======================================================================
+/*!
+ \return number of selected objects
+*/
int GLViewer_Context::NbSelected()
{
return mySelectedObjects.count();
}
-//=======================================================================
-// Function: InitSelected
-// Purpose :
-//=======================================================================
+/*!
+ Inits iteration through selected objects
+*/
void GLViewer_Context::InitSelected()
{
mySelCurIndex = 0;
}
-//=======================================================================
-// Function: MoreSelected
-// Purpose :
-//=======================================================================
+/*!
+ Checks if iteration through selected objects may be continued
+*/
bool GLViewer_Context::MoreSelected()
{
return ( mySelCurIndex < NbSelected() );
}
-//=======================================================================
-// Function: NextSelected
-// Purpose :
-//=======================================================================
+/*!
+ Iterates to next selected object
+*/
bool GLViewer_Context::NextSelected()
{
if ( mySelCurIndex >= 0 && mySelCurIndex < NbSelected() )
return FALSE;
}
-//=======================================================================
-// Function: SelectedObject
-// Purpose :
-//=======================================================================
+/*!
+ \return current selected object (must be used only in cycle as "for( InitSelected(); MoreSelected(); NextSelected() ) {...}" )
+*/
GLViewer_Object* GLViewer_Context::SelectedObject()
{
return mySelectedObjects[ mySelCurIndex ];
}
-//=======================================================================
-// Function: isSelected
-// Purpose :
-//=======================================================================
+/*!
+ \return true if object is selected
+ \param theObj - object to be checked
+*/
bool GLViewer_Context::isSelected( GLViewer_Object* theObj )
{
return mySelectedObjects.contains( theObj );
}
-//=======================================================================
-// Function: insertObject
-// Purpose :
-//=======================================================================
+/*! Inserts new object in context
+ \param theObject - object to be inserted
+ \param display - true if needs display object immediatly after inserting, else false
+ \param isActive - true if needs inserting object in active list
+*/
int GLViewer_Context::insertObject( GLViewer_Object* object, bool display, bool isActive )
{
// cout << "GLViewer_Context::insertObject" << endl;
return myActiveObjects.count() + myInactiveObjects.count();
}
-//=======================================================================
-// Function: replaceObject
-// Purpose :
-//=======================================================================
+/*!
+ Replaces object in context
+ \param oldObject - object to be replaced
+ \param newObject - object for replacing
+*/
bool GLViewer_Context::replaceObject( GLViewer_Object* oldObject, GLViewer_Object* newObject )
{
if( !oldObject || !newObject )
return false;
}
-//=======================================================================
-// Function: updateScales
-// Purpose :
-//=======================================================================
+/*!
+ Updates scales of all objects in context
+*/
void GLViewer_Context::updateScales( GLfloat scX, GLfloat scY )
{
if( scX <= 0 || scY <= 0 )
(*it)->setScale( scX, scY );
}
-//=======================================================================
-// Function: clearHighlighted
-// Purpose :
-//=======================================================================
+/*!
+ Clears hilighting of objects
+ \param updateViewer - if it is true, viewer must be updated
+*/
void GLViewer_Context::clearHighlighted( bool updateViewer )
{
if( myHFlag && myLastPicked )
}
}
-//=======================================================================
-// Function: clearSelected
-// Purpose :
-//=======================================================================
+/*!
+ Clears selection of objects
+ \param updateViewer - if it is true, viewer must be updated
+*/
void GLViewer_Context::clearSelected( bool updateViewer )
{
if( !mySFlag )
mySelectedObjects.clear();
}
-//=======================================================================
-// Function: setSelected
-// Purpose :
-//=======================================================================
+/*!
+ Selects object, other selected objects are left as selected
+ \param updateViewer - if it is true, viewer must be updated
+*/
void GLViewer_Context::setSelected( GLViewer_Object* object, bool updateViewer )
{
if( !object )
myGLViewer2d->activateDrawer( object, TRUE, TRUE );
}
-//=======================================================================
-// Function: remSelected
-// Purpose :
-//=======================================================================
+/*!
+ Unselects object, other selected objects are left as selected
+ \param updateViewer - if it is true, viewer must be updated
+*/
void GLViewer_Context::remSelected( GLViewer_Object* object, bool updateViewer )
{
if( !object || !mySelectedObjects.contains( object ) )
myGLViewer2d->activateDrawer( object, TRUE, TRUE );
}
-//=======================================================================
-// Function: eraseObject
-// Purpose :
-//=======================================================================
+/*!
+ Erases object in viewer
+ \param theUpdateViewer - if it is true, viewer must be updated
+*/
void GLViewer_Context::eraseObject( GLViewer_Object* theObject, bool theUpdateViewer )
{
if( !theObject || !myActiveObjects.contains( theObject ) )
myGLViewer2d->updateAll();
}
-//=======================================================================
-// Function: deleteObject
-// Purpose :
-//=======================================================================
+/*!
+ Deletes object in
+ \param updateViewer - if it is true, viewer must be updated
+*/
void GLViewer_Context::deleteObject( GLViewer_Object* theObject, bool updateViewer )
{
if( !theObject ||
myGLViewer2d->updateAll();
}
-//=======================================================================
-// Function: setActive
-// Purpose :
-//=======================================================================
+/*!
+ Installs active status to object
+ \param theObject
+*/
bool GLViewer_Context::setActive( GLViewer_Object* theObject )
{
if( !theObject || !myInactiveObjects.contains( theObject ) )
return true;
}
-//=======================================================================
-// Function: setInactive
-// Purpose :
-//=======================================================================
+/*!
+ Installs inactive status to object
+ \param theObject
+*/
bool GLViewer_Context::setInactive( GLViewer_Object* theObject )
{
if( !theObject || !myActiveObjects.contains( theObject ) )
// Created: November, 2004
-/*! Class GLViewer_Context
- * Class for manage of presentations in GLViewer
- */
-
#ifndef GLVIEWER_CONTEXT_H
#define GLVIEWER_CONTEXT_H
#pragma warning( disable:4251 )
#endif
+/*! \class GLViewer_Context
+ * Class for manage of presentations in GLViewer
+ */
class GLVIEWER_API GLViewer_Context
{
public:
*function search object rectangle which intersect with sensitive area and call object highlight method
*/
int MoveTo( int x, int y, bool byCircle = FALSE );
- //! A function selecting already highlighting object by calling object method select
- /*!
+ /*! A function selecting already highlighting object by calling object method select
*\param Append - true if new selection will be append to existing selection, false - another
*\param byCircle - true if needs round selection area in complex object
*/
int Select( bool Append = FALSE, bool byCircle = FALSE );
- //! A function selecting objects on scene by rectangle
- /*!
+ /*! A function selecting objects on scene by rectangle
*\param theRect - rectangle of selection
*\param Append - true if new selection will be append to existing selection, false - another
*function search object rectangle which intersect with theRect and call object select method
int insertObject( GLViewer_Object* theObject, bool display = false, bool isActive = true );
//! Replacing objects in context
/*!
- * Function search activ and incative objects
+ * Function search active and incative objects
*/
bool replaceObject( GLViewer_Object* oldObject, GLViewer_Object* newObject );
//! A function updating scales of all objects in context
//! Returns list of context objects
/*!
- * Returns active objects if isActive = true, else inactive objects
+ * \return active objects if isActive = true, else inactive objects
*/
const ObjList& getObjects( bool isActive = true )
{ return isActive ? myActiveObjects : myInactiveObjects; }
// File: GLViewer_Context.cxx
// Created: November, 2004
-//================================================================
-// Class : GLViewer_CoordSystem
-// Description : Class implementing mathematical model of 2D coordinate system
-//================================================================
#include "GLViewer_CoordSystem.h"
#include <math.h>
-//=======================================================================
-// Function: GLViewer_CoordSystem
-// Purpose :
-//=======================================================================
+/*!
+ Constructor
+ \param aType - type of CS
+ \param X0 - X of origin in reference CS
+ \param Y0 - Y of origin in reference CS
+ \param XUnit - X unit in reference CS
+ \param YUnit - Y unit in reference CS
+ \param Rotation - rotation relative reference CS
+*/
GLViewer_CoordSystem::GLViewer_CoordSystem( CSType aType, double X0, double Y0,
double XUnit, double YUnit, double Rotation )
{
setRotation( Rotation );
}
-//=======================================================================
-// Function: getOrigin
-// Purpose :
-//=======================================================================
+/*!
+ \return origin in reference CS
+*/
void GLViewer_CoordSystem::getOrigin( double& x, double& y ) const
{
x = myX0;
y = myY0;
}
-//=======================================================================
-// Function: setOrigin
-// Purpose :
-//=======================================================================
+/*!
+ Sets origin in reference CS
+*/
void GLViewer_CoordSystem::setOrigin( double x, double y )
{
myX0 = x;
myY0 = y;
}
-//=======================================================================
-// Function: getUnits
-// Purpose :
-//=======================================================================
+/*!
+ \return units
+*/
void GLViewer_CoordSystem::getUnits( double& x, double& y ) const
{
x = myXUnit;
y = myYUnit;
}
-//=======================================================================
-// Function: setUnits
-// Purpose :
-//=======================================================================
+/*!
+ Sets units
+*/
void GLViewer_CoordSystem::setUnits( double x, double y )
{
if( x>0 )
else
myYUnit = 1.0;
}
-//=======================================================================
-// Function: getRotation
-// Purpose :
-//=======================================================================
+
+/*!
+ \return rotation
+*/
double GLViewer_CoordSystem::getRotation() const
{
return myRotation;
}
-//=======================================================================
-// Function: setRotation
-// Purpose :
-//=======================================================================
+/*!
+ Sets rotation
+*/
void GLViewer_CoordSystem::setRotation( double rotation )
{
myRotation = rotation;
}
-//=======================================================================
-// Function: getType
-// Purpose :
-//=======================================================================
+/*!
+ \return type
+*/
GLViewer_CoordSystem::CSType GLViewer_CoordSystem::getType() const
{
return myType;
}
-//=======================================================================
-// Function: setType
-// Purpose :
-//=======================================================================
+/*!
+ Sets type
+*/
void GLViewer_CoordSystem::setType( CSType type )
{
myType = type;
}
-//=======================================================================
-// Function: toReference
-// Purpose :
-//=======================================================================
+/*!
+ Recalculate co-ordinates to reference co-ordinates
+ \param x, y - co-ordinates
+*/
void GLViewer_CoordSystem::toReference( double& x, double& y )
{
if( myType==Cartesian )
}
}
-//=======================================================================
-// Function: fromReference
-// Purpose :
-//=======================================================================
+/*!
+ Recalculate co-ordinates from reference co-ordinates
+ \param x, y - co-ordinates
+*/
void GLViewer_CoordSystem::fromReference( double& x, double& y )
{
x = (x - myX0) / myXUnit;
}
}
-//=======================================================================
-// Function: transform
-// Purpose :
-//=======================================================================
+/*!
+ Recalculate co-ordinates to co-ordinates of other CS
+ \param aSystem - other CS
+ \param x, y - co-ordinates
+*/
void GLViewer_CoordSystem::transform( GLViewer_CoordSystem& aSystem, double& x, double& y )
{
toReference( x, y );
aSystem.fromReference( x, y );
}
-//=======================================================================
-// Function: getStretching
-// Purpose :
-//=======================================================================
+/*!
+ \return stretching of CS along X and Y axis
+*/
void GLViewer_CoordSystem::getStretching( GLViewer_CoordSystem& aSystem, double& theX, double& theY )
{
theX = myXUnit / aSystem.myXUnit;
#pragma warning( disable:4251 )
#endif
+/*!
+ \class GLViewer_CoordSystem
+ \brief Class implementing mathematical model of 2D coordinate system
+*/
class GLVIEWER_API GLViewer_CoordSystem
{
public:
GLfloat modelMatrix[16];
-//================================================================
-// Class : GLViewer_TexFont
-// Description :
-//================================================================
+
//! code of first font symbol
static int FirstSymbolNumber = 32;
//! code of last font symbol
QMap<GLViewer_TexFindId,GLViewer_TexIdStored> GLViewer_TexFont::TexFontBase;
QMap<GLViewer_TexFindId,GLuint> GLViewer_TexFont::BitmapFontCache;
-//=======================================================================
-// Function: clearTextBases
-// Purpose :
-//=======================================================================
+/*!
+ Clears all generated fonts
+*/
void GLViewer_TexFont::clearTextBases()
{
//cout << "Clear font map" << endl;
BitmapFontCache.clear();
}
-//======================================================================
-// Function: GLViewer_TexFont
-// Purpose :
-//=======================================================================
+/*!
+ Default constructor
+*/
GLViewer_TexFont::GLViewer_TexFont()
: myMaxRowWidth( 0 ), myFontHeight( 0 )
{
init();
}
-//======================================================================
-// Function: GLViewer_TexFont
-// Purpose :
-//=======================================================================
+/*!
+ Constructor
+ \param theFont - a base font
+ \param theSeparator - separator between letters
+ \param theIsResizeable - specifies whether text drawn by this object can be scaled along with the scene
+ \param theMinMagFilter - min/mag filter, affects text sharpness
+*/
GLViewer_TexFont::GLViewer_TexFont( QFont* theFont, int theSeparator, bool theIsResizeable, GLuint theMinMagFilter )
: myMaxRowWidth( 0 ), myFontHeight( 0 )
{
init();
}
-//======================================================================
-// Function: ~GLViewer_TexFont
-// Purpose :
-//=======================================================================
+/*!
+ Destructor
+*/
GLViewer_TexFont::~GLViewer_TexFont()
{
delete[] myWidths;
delete[] myPositions;
}
-//======================================================================
-// Function: init
-// Purpose :
-//=======================================================================
+/*!
+ Initializes font parameters
+*/
void GLViewer_TexFont::init()
{
myNbSymbols = LastSymbolNumber - FirstSymbolNumber + 1;
myTexFontHeight = 0;
}
-//======================================================================
-// Function: generateTexture
-// Purpose :
-//=======================================================================
+/*!
+ Generating font texture
+*/
bool GLViewer_TexFont::generateTexture()
{
GLViewer_TexFindId aFindFont;
return true;
}
-//======================================================================
-// Function: drawString
-// Purpose :
-//=======================================================================
+/*!
+ Drawing string in viewer
+ \param theStr - string to be drawn
+ \param theX - X position
+ \param theY - Y position
+ \param theScale - scale coefficient
+*/
void GLViewer_TexFont::drawString( QString theStr, GLdouble theX , GLdouble theY, GLfloat theScale )
{
// Adding some pixels to have a gap between rows
glPopAttrib();
}
-//======================================================================
-// Function: getStringWidth
-// Purpose :
-//=======================================================================
+/*!
+ \return width of string in pixels
+*/
int GLViewer_TexFont::getStringWidth( QString theStr )
{
int aWidth = 0;
return aWidth;
}
-//======================================================================
-// Function: getStringHeight
-// Purpose :
-//=======================================================================
+/*!
+ \return height of string in pixels
+*/
int GLViewer_TexFont::getStringHeight()
{
QFontMetrics aFM( myQFont );
return aFM.height();
}
-//! function for generation list base for bitmap fonts
+/*!
+ Generates list base for bitmap fonts
+*/
static GLuint displayListBase( QFont* theFont )
{
if ( !theFont )
return aList;
}
-/***************************************************************************
-** Class: GLViewer_Drawer
-** Descr: Drawer for GLViewer_Object
-** Module: GLViewer
-** Created: UI team, 01.10.01
-****************************************************************************/
-//======================================================================
-// Function: GLViewer_Drawer
-// Purpose :
-//=======================================================================
+/*!
+ Default constructor
+*/
GLViewer_Drawer::GLViewer_Drawer()
: myFont( "Helvetica", 10, QFont::Bold )
{
myTextScale = 0.125;
}
-//======================================================================
-// Function: ~GLViewer_Drawer
-// Purpose :
-//=======================================================================
+/*!
+ Destructor
+*/
GLViewer_Drawer::~GLViewer_Drawer()
{
myObjects.clear();
glDeleteLists( myTextList, 1 );
}
-//======================================================================
-// Function: destroyAllTextures
-// Purpose :
-//=======================================================================
+/*!
+ Clears all generated textures
+*/
void GLViewer_Drawer::destroyAllTextures()
{
QMap<GLViewer_TexFindId,GLViewer_TexIdStored>::Iterator anIt= GLViewer_TexFont::TexFontBase.begin();
glDeleteTextures( 1, &(anIt.data().myTexFontId) );
}
-//=======================================================================
-// Function: setAntialiasing
-// Purpose : The function enables and disables antialiasing in Open GL (for points, lines and polygons).
-//=======================================================================
+/*!
+ Enables and disables antialiasing in Open GL (for points, lines and polygons).
+ \param on - if it is true, antialiasing is enabled
+*/
void GLViewer_Drawer::setAntialiasing(const bool on)
{
if (on)
}
}
-//======================================================================
-// Function: loadTexture
-// Purpose :
-//=======================================================================
+/*! Loads texture from file
+ \param fileName - the name of texture file
+ \param x_size - the horizontal size of picture ( less or equal texture horizontal size )
+ \param y_size - the vertical size of picture ( less or equal texture vertical size )
+ \param t_size - the size of texture ( texture vertical size equals texture horizontal size )
+*/
GLuint GLViewer_Drawer::loadTexture( const QString& fileName,
GLint* x_size,
GLint* y_size,
return texture;
}
-//======================================================================
-// Function: drawTexture
-// Purpose :
-//=======================================================================
+/*! Draw square texture
+ \param texture - the texture ID
+ \param size - the size of square texture
+ \param x - x coord
+ \param y - y coord
+*/
void GLViewer_Drawer::drawTexture( GLuint texture, GLint size, GLfloat x, GLfloat y )
{
/*float xScale = myXScale;
drawTexture( texture, size, size, x, y );
}
-//======================================================================
-// Function: drawTexture
-// Purpose :
-//=======================================================================
+/*! Draw texture
+ \param texture - the texture ID
+ \param x_size - the horizontal size of texture
+ \param y_size - the vertical size of texture
+ \param x - x coord
+ \param y - y coord
+*/
void GLViewer_Drawer::drawTexture( GLuint texture, GLint x_size, GLint y_size, GLfloat x, GLfloat y )
{
/*float xScale = myXScale;
drawTexturePart( texture, 1.0, 1.0, x_size, y_size, x, y );
}
-//======================================================================
-// Function: drawTexture
-// Purpose :
-//=======================================================================
+/*! Draw texture part
+ \param texture - the texture ID
+ \param x_ratio - the horizontal ratio of texture part
+ \param y_ratio - the vertical ratio of texture part
+ \param x_size - the horizontal size of texture
+ \param y_size - the vertical size of texture
+ \param x - x coord
+ \param y - y coord
+ \param scale - common scale factor ( if = 0, use drawer scales )
+*/
void GLViewer_Drawer::drawTexturePart( GLuint texture,
GLfloat x_ratio,
GLfloat y_ratio,
glDisable( GL_TEXTURE_2D );
}
-//======================================================================
-// Function: drawText
-// Purpose :
-//=======================================================================
+/*!
+ Draw text
+ \param text - text to be drawn
+ \param xPos - x position
+ \param yPos - y position
+ \param color - color of text
+ \param theFont - font of text
+ \param theSeparator - letter separator
+ \param theFormat - text format (by default DTF_BITMAP)
+*/
void GLViewer_Drawer::drawText( const QString& text, GLfloat xPos, GLfloat yPos,
const QColor& color, QFont* theFont, int theSeparator, DisplayTextFormat theFormat )
{
}
}
-//======================================================================
-// Function: drawText
-// Purpose :
-//=======================================================================
+/*!
+ Draws object-text
+*/
void GLViewer_Drawer::drawText( GLViewer_Object* theObject )
{
if( !theObject )
drawText( aText->getText(), aPosX, aPosY, aText->getColor(), &aTmpVarFont, aText->getSeparator(), aText->getDisplayTextFormat() );
}
-//======================================================================
-// Function: drawGLText
-// Purpose :
-//=======================================================================
+/*! Draw text
+ \param text - the text string
+ \param x - x coord
+ \param y - y coord
+ \param hPosition - horizontal alignment
+ \param vPosition - vertical alignment
+ \param color - text color
+ \param smallFont - font format
+*/
void GLViewer_Drawer::drawGLText( QString text, float x, float y,
int hPosition, int vPosition, QColor color, bool smallFont )
{
drawText( text, x, y, color, &aFont, 2, myTextFormat );
}
-//======================================================================
-// Function: textRect
-// Purpose :
-//=======================================================================
+/*!
+ \return a rectangle of text (without viewer scale)
+*/
GLViewer_Rect GLViewer_Drawer::textRect( const QString& text ) const
{
GLfloat scale = textScale() > 0. ? textScale() : 1.;
return GLViewer_Rect( 0, width, height, 0 );
}
-//======================================================================
-// Function: drawRectangle
-// Purpose :
-//=======================================================================
+/*!
+ Draws rectangle
+ \param rect - instance of primitive
+ \param color - color of primitive
+*/
void GLViewer_Drawer::drawRectangle( GLViewer_Rect* rect, QColor color )
{
if( !rect )
glEnd();
}
-//======================================================================
-// Function: translateToHPGL
-// Purpose :
-//=======================================================================
+/*!
+ Saves object to file with format of HPGL
+ \param hFile - file
+ \param aViewerCS - viewer co-ordinate system
+ \param aHPGLCS - paper co-ordinate system
+*/
bool GLViewer_Drawer::translateToHPGL( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aHPGLCS )
{
bool result = true;
return result;
}
-//======================================================================
-// Function: translateToPS
-// Purpose :
-//=======================================================================
+/*!
+ Saves object to file with format of PostScript
+ \param hFile - file
+ \param aViewerCS - viewer co-ordinate system
+ \param aPSCS - paper co-ordinate system
+*/
bool GLViewer_Drawer::translateToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS )
{
bool result = true;
}
#ifdef WIN32
-//======================================================================
-// Function: translateToEMF
-// Purpose :
-//=======================================================================
+/*!
+ Saves object to file with format of EMF
+ \param hFile - file
+ \param aViewerCS - viewer co-ordinate system
+ \param aEMFCS - paper co-ordinate system
+*/
bool GLViewer_Drawer::translateToEMF( HDC hDC, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS )
{
bool result = true;
}
#endif
-//======================================================================
-// Function: drawRectangle
-// Purpose :
-//=======================================================================
+/*!
+ Draws rectangle
+ \param rect - instance of primitive
+ \param lineWidth - width of line
+ \param gap - gap of rectangle
+ \param color - color of primitive
+ \param filled - if it is true, then rectangle will be drawn filled with color "fillingColor"
+ \param fillingColor - color of filling
+*/
void GLViewer_Drawer::drawRectangle( GLViewer_Rect* rect, GLfloat lineWidth, GLfloat gap,
QColor color, bool filled, QColor fillingColor )
{
glEnd();
}
-//======================================================================
-// Function: drawContour
-// Purpose :
-//=======================================================================
+/*!
+ Draws contour
+ \param pntList - list of points
+ \param color - color of contour
+ \param lineWidth - width of line
+*/
void GLViewer_Drawer::drawContour( const GLViewer_PntList& pntList, QColor color, GLfloat lineWidth )
{
glColor3f( ( GLfloat )color.red() / 255,
glEnd();
}
-//======================================================================
-// Function: drawContour
-// Purpose :
-//=======================================================================
+/*!
+ Draws rectangular contour
+ \param rect - instance of rectangle
+ \param color - color of primitive
+ \param lineWidth - width of line
+ \param pattern - pattern of line
+ \param isStripe - enables line stipple
+*/
void GLViewer_Drawer::drawContour( GLViewer_Rect* rect, QColor color, GLfloat lineWidth,
GLushort pattern, bool isStripe )
{
glDisable( GL_LINE_STIPPLE );
}
-//======================================================================
-// Function: drawPolygon
-// Purpose :
-//=======================================================================
+/*!
+ Draws polygon
+ \param pntList - list of points
+ \param color - color of polygon
+*/
void GLViewer_Drawer::drawPolygon( const GLViewer_PntList& pntList, QColor color )
{
glColor3f( ( GLfloat )color.red() / 255,
glEnd();
}
-//======================================================================
-// Function: drawPolygon
-// Purpose :
-//=======================================================================
+/*!
+ Draws rectangle
+ \param rect - instance of rectangle
+ \param color - color of polygon
+ \param pattern - pattern of line
+ \param isStripe - enables line stipple
+*/
void GLViewer_Drawer::drawPolygon( GLViewer_Rect* rect, QColor color,
GLushort pattern, bool isStripe )
{
glDisable( GL_LINE_STIPPLE );
}
-//======================================================================
-// Function: drawVertex
-// Purpose :
-//=======================================================================
GLubyte rasterVertex[5] = { 0x70, 0xf8, 0xf8, 0xf8, 0x70 };
+
+/*!
+ Draws vertex
+ \param x - x position
+ \param y - y position
+ \param color - color of vertex
+*/
void GLViewer_Drawer::drawVertex( GLfloat x, GLfloat y, QColor color )
{
glColor3f( ( GLfloat )color.red() / 255, ( GLfloat )color.green() / 255, ( GLfloat )color.blue() / 255 );
glBitmap( 5, 5, 2, 2, 0, 0, rasterVertex );
}
-//======================================================================
-// Function: drawCross
-// Purpose :
-//=======================================================================
GLubyte rasterCross[7] = { 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82 };
+
+/*!
+ Draws cross
+ \param x - x position
+ \param y - y position
+ \param color - color of cross
+*/
void GLViewer_Drawer::drawCross( GLfloat x, GLfloat y, QColor color )
{
glColor3f( ( GLfloat )color.red() / 255, ( GLfloat )color.green() / 255, ( GLfloat )color.blue() / 255 );
glBitmap( 7, 7, 3, 3, 0, 0, rasterCross );
}
-//======================================================================
-// Function: drawArrow
-// Purpose :
-//=======================================================================
+/*!
+ Draws arrow
+ \param red, green, blue - components of color
+ \param lineWidth - width of line
+ \param staff -
+ \param length - length of arrow
+ \param width - width of arrow
+ \param x - x position
+ \param y - y position
+ \param angle - angle of arrow
+ \param filled - drawn as filled
+*/
void GLViewer_Drawer::drawArrow( const GLfloat red, const GLfloat green, const GLfloat blue,
GLfloat lineWidth,
GLfloat staff, GLfloat length, GLfloat width,
}
};
-/***************************************************************************
-** Class: GLViewer_TexFont
-** Descr: Font for GLViewer_Drawer
-** Module: GLViewer
-** Created: UI team, 03.10.01
-****************************************************************************/
+/*!
+ \class GLViewer_TexFont
+ Font for GLViewer_Drawer, Drawing bitmap and texture fonts in GLViewer
+*/
-/*!
- * Class GLViewer_TexFont
- * Drawing bitmap and texture fonts in GLViewer
- */
class GLVIEWER_API GLViewer_TexFont
{
public:
int myMaxRowWidth;
};
-/***************************************************************************
-** Class: GLViewer_Drawer
-** Descr: Drawer for GLObject
-** Module: GLViewer
-** Created: UI team, 03.10.01
-****************************************************************************/
/*!
- * Class GLViewer_Drawer
- * Drawer for GLViewer_Objects.
- * Drawer creates only one times per one type of object
- */
+ \class GLViewer_Drawer
+ Drawer for GLViewer_Objects.
+ Drawer creates only one times per one type of object
+*/
class GLVIEWER_API GLViewer_Drawer
{
public:
// Author : OPEN CASCADE
//
-/***************************************************************************
-** Class: GLViewer_Geom
-** Descr:
-** Module: GLViewer
-** Created: UI team, 16.11.04
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include <GLViewer_Geom.h>
#define FAR_POINT 1e10 // Value used as a "very distant" co-ordinate
#define TOLERANCE 1e-3
-//================================================================
-// Function : GLViewer_Segment
-// Purpose : constructs a real segment bounded by two points
-//================================================================
+/*!
+ constructs a real segment bounded by two points
+*/
GLViewer_Segment::GLViewer_Segment( const GLViewer_Pnt& thePnt1,
const GLViewer_Pnt& thePnt2 )
: myPnt1( thePnt1 ),
myC = myPnt1.x() * myPnt2.y() - myPnt2.x() * myPnt1.y();
}
-//================================================================
-// Function : GLViewer_Segment
-// Purpose : constructs a ray starting at <thePnt> and directed
-// along positive X axis direction (or Y axis if vertical )
-//================================================================
+/*!
+ constructs a ray starting at <thePnt> and directed along positive X axis direction (or Y axis if vertical )
+*/
GLViewer_Segment::GLViewer_Segment( const GLViewer_Pnt& thePnt,
const GLfloat theA,
const GLfloat theB,
myPnt2 = GLViewer_Pnt( FAR_POINT, - myA / myB * FAR_POINT - myC / myB );
}
-//================================================================
-// Function : GLViewer_Segment
-// Purpose : destructor, does nothing
-//================================================================
+/*!
+ destructor, does nothing
+*/
GLViewer_Segment::~GLViewer_Segment()
{
}
-//================================================================
-// Function : HasIntersection
-// Purpose : detects intersection with segment <theOther>
-//================================================================
+/*!
+ detects intersection with segment <theOther>
+*/
bool GLViewer_Segment::HasIntersection( const GLViewer_Segment& theOther ) const
{
bool aRes = false;
return aRes;
}
-//================================================================
-// Function : GLViewer_Poly
-// Purpose : constructs a closed polygon from the given ordered list of points
-//================================================================
+/*!
+ constructs a closed polygon from the given ordered list of points
+*/
GLViewer_Poly::GLViewer_Poly( const GLViewer_PntList* thePoints )
: myPoints( (GLViewer_PntList*)thePoints )
{
}
-//================================================================
-// Function : ~GLViewer_Poly
-// Purpose : destructor, <myPoints> mustn't be deleted here!
-//================================================================
+/*!
+ destructor, <myPoints> mustn't be deleted here!
+*/
GLViewer_Poly::~GLViewer_Poly()
{
}
-//================================================================
-// Function : IsIn
-// Purpose : returns true if <thePnt> lies within this polygon
-//================================================================
+/*!
+ \return true if <thePnt> lies within this polygon
+*/
bool GLViewer_Poly::IsIn( const GLViewer_Pnt& thePnt ) const
{
if ( !myPoints )
return ( aNbInter % 2 == 1 );
}
+/*!
+ \return true if <thePnt> lies within this polygon
+*/
/*
-//================================================================
-// Function : IsIn
-// Purpose : returns true if <thePnt> lies within this polygon
-//================================================================
bool GLViewer_Poly::IsIn( const GLViewer_Pnt& thePnt, const float tolerance ) const
{
if ( !myPoints )
return res;
}
*/
-//================================================================
-// Function : IsCovers
-// Purpose : returns true if <thePoly> covers this polygon
-//================================================================
+/*!
+ \return true if <thePoly> covers this polygon
+*/
bool GLViewer_Poly::IsCovers( const GLViewer_Poly& thePoly ) const
{
if ( !myPoints || !thePoly.Count() )
return true;
}
-//================================================================
-// Function : IsCovers
-// Purpose : returns true if <theRect> covers this polygon
-//================================================================
+/*!
+ \return true if <theRect> covers this polygon
+*/
bool GLViewer_Poly::IsCovers( const GLViewer_Rect& theRect ) const
{
if ( !myPoints ) //needs check for <theRect>
return IsCovers( GLViewer_Poly( &aList ) );
}
-//================================================================
-// Function : HasIntersection
-// Purpose : looks for any
-//================================================================
+/*!
+ \return true if polygon has intersection with segment or ray
+ \param theSegment - segment to check intersection
+*/
bool GLViewer_Poly::HasIntersection( const GLViewer_Segment& theSegment ) const
{
if ( !myPoints )
#include <Precision.hxx>
#include <qglobal.h>
+/*!
+ Default constructor
+*/
GLViewer_Grid::GLViewer_Grid() :
myGridList( 0 ), myGridHeight( (GLfloat)0.0 ), myGridWidth( (GLfloat)0.0 ),
myWinW( (GLfloat)0.0 ), myWinH( (GLfloat)0.0 ), myXSize( (GLfloat)0.0 ), myYSize( (GLfloat)0.0 ),
myAxisColor[2] = 0.75;
}
+/*!
+ Constructor
+ \param width and \param height - width and height of grid
+ \param winW and \param winH - width and height of window
+ \param xSize and \param ySize - steps along x and y direction
+ \param xPan and \param yPan - offsets along x and y direction
+ \param xScale and \param yScal - scale factors along x and y direction
+*/
GLViewer_Grid::GLViewer_Grid( GLfloat width, GLfloat height,
GLfloat winW, GLfloat winH,
GLfloat xSize, GLfloat ySize,
myAxisColor[2] = 0.75;
}
+/*!
+ Destructor
+*/
GLViewer_Grid::~GLViewer_Grid()
{
}
+/*!
+ Performs OpenGL drawing
+*/
void GLViewer_Grid::draw()
{
if ( myGridList == 0 || myIsUpdate )
glCallList( myGridList );
}
+/*!
+ Changes color of grid
+ \param r, g, b - components of color
+*/
void GLViewer_Grid::setGridColor( GLfloat r, GLfloat g, GLfloat b )
{
if( myGridColor[0] == r && myGridColor[1] == g && myGridColor[2] == b )
myIsUpdate = GL_TRUE;
}
+/*!
+ Changes color of axis
+ \param r, g, b - components of color
+*/
void GLViewer_Grid::setAxisColor( GLfloat r, GLfloat g, GLfloat b )
{
if( myAxisColor[0] == r && myAxisColor[1] == g && myAxisColor[2] == b )
myIsUpdate = GL_TRUE;
}
+/*!
+ Changes grid width
+ \param w - new grid width
+*/
void GLViewer_Grid::setGridWidth( float w )
{
if( myGridWidth == w )
myIsUpdate = GL_TRUE;
}
+/*!
+ Sets Radius of center point( begin coords )
+ \param r - new radius
+*/
void GLViewer_Grid::setCenterRadius( int r )
{
if( myCenterRadius == r )
myIsUpdate = GL_TRUE;
}
+/*!
+ Sets grid size along X and Y axis
+ \param xSize - size along X axis
+ \param ySize - size along Y axis
+*/
void GLViewer_Grid::setSize( float xSize, float ySize )
{
if( myXSize == xSize && myYSize == ySize )
myIsUpdate = GL_TRUE;
}
+/*!
+ Sets panning of grid
+ \param xPan - panning along X axis
+ \param yPan - panning along Y axis
+*/
void GLViewer_Grid::setPan( float xPan, float yPan )
{
if( myXPan == xPan && myYPan == yPan )
myIsUpdate = GL_TRUE;
}
+/*!
+ Sets zoom
+ \param zoom - new coefficient of zooming
+*/
bool GLViewer_Grid::setZoom( float zoom )
{
if( zoom == 1.0 )
return true;
}
+/*!
+ Sets parameters of grid by zoom coefficient and window size
+ \param WinW - window width
+ \param WinH - window height
+ \param zoom - zoom coefficient
+*/
void GLViewer_Grid::setResize( float WinW, float WinH, float zoom )
{
if( myWinW == WinW && myWinH == WinH && zoom == 1.0 )
myIsUpdate = GL_TRUE;
}
+/*!
+ \return grid size along x and y axis
+ \param xSize - for size along x axis
+ \param ySize - for size along y axis
+*/
void GLViewer_Grid::getSize( float& xSize, float& ySize ) const
{
xSize = myXSize;
ySize = myYSize;
}
+/*!
+ \return panning along x and y axis
+ \param xPan - for panning along x axis
+ \param yPan - for panning along y axis
+*/
void GLViewer_Grid::getPan( float& xPan, float& yPan ) const
{
xPan = myXPan;
yPan = myYPan;
}
+/*!
+ \return scaling along x and y axis
+ \param xScale - for scaling along x axis
+ \param yScale - for scaling along y axis
+*/
void GLViewer_Grid::getScale( float& xScale, float& yScale ) const
{
xScale = myXScale;
yScale = myYScale;
}
+/*!
+ Initialize grid display list
+*/
bool GLViewer_Grid::initList()
{
myIsUpdate = GL_FALSE;
#include "GLViewer_Group.h"
#include "GLViewer_Object.h"
-/***************************************************************************
-** Class: GLViewer_Group
-** Descr: Group of GLViewer_Objects
-** Module: GLViewer
-** Created: UI team, 25.03.05
-****************************************************************************/
-
-//--------------------------------------------------------------------------
-//Function: GLViewer_Group()
-//Description: constructor
-//--------------------------------------------------------------------------
+/*!
+ constructor
+*/
GLViewer_Group::GLViewer_Group()
{
mySelObjNum = 0;
}
-//--------------------------------------------------------------------------
-//Function: GLViewer_Group()
-//Description: destructor
-//--------------------------------------------------------------------------
+/*!
+ destructor
+*/
GLViewer_Group::~GLViewer_Group()
{
}
-//--------------------------------------------------------------------------
-//Function: isEmpty
-//Description: detection of empty group
-//--------------------------------------------------------------------------
+/*!
+ detection of empty group
+*/
bool GLViewer_Group::isEmpty()
{
return myList.empty();
}
-//--------------------------------------------------------------------------
-//Function: count
-//Description: number of elements
-//--------------------------------------------------------------------------
+/*!
+ \return number of elements
+*/
int GLViewer_Group::count()
{
return myList.size();
}
-//--------------------------------------------------------------------------
-//Function: contains
-//Description: return the position of object, else -1
-//--------------------------------------------------------------------------
+/*!
+ \return the position of object if group contains it, else -1
+*/
int GLViewer_Group::contains( GLViewer_Object* theObject )
{
if( !theObject )
return -1;
}
-//--------------------------------------------------------------------------
-//Function: addObject
-//Description: adding object to group
-//--------------------------------------------------------------------------
+/*!
+ adding object to group
+*/
int GLViewer_Group::addObject( GLViewer_Object* theObject )
{
if( theObject && contains( theObject ) == -1 )
return count();
}
-//--------------------------------------------------------------------------
-//Function: removeObject
-//Description: removing object from group
-//--------------------------------------------------------------------------
+/*!
+ removing object from group
+*/
int GLViewer_Group::removeObject( GLViewer_Object* theObject )
{
if( theObject )
return count();
}
-//--------------------------------------------------------------------------
-//Function: dragingObjects
-//Description:
-//--------------------------------------------------------------------------
+/*!
+ Dragging operation
+ \param Once is true, if this operation calls only one time for all object
+ \param x, y - dragging position
+*/
void GLViewer_Group::dragingObjects( float x, float y, bool once )
{
if( !once )
(*it)->moveObject( x, y, true );
}
-//--------------------------------------------------------------------------
-//Function: updateZoom
-//Description:
-//--------------------------------------------------------------------------
+/*!
+ Updates zoom of object
+ \param sender - object to be updated
+ \param zoom - zoom coefficient
+*/
void GLViewer_Group::updateZoom( GLViewer_Object* sender, float zoom )
{
OGIterator it = myList.begin();
// Author : OPEN CASCADE
//
-/***************************************************************************
-** Class: GLViewer_MimeSource
-** Descr: Needs for a work with QClipboard
-** Module: GLViewer
-** Created: UI team, 22.03.04
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_MimeSource.h"
#include "GLViewer_BaseObjects.h"
//#include <cmath>
//using namespace std;
+/*!
+ Destructor
+*/
GLViewer_MimeSource::~GLViewer_MimeSource()
{
}
+/*!
+ Translate objects to byte array
+ \param theObjects - list of objects
+*/
bool GLViewer_MimeSource::setObjects( QValueList<GLViewer_Object*> theObjects )
{
if( !theObjects.empty() )
return false;
}
-//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
-//If you want to use new class, following two method must be redefined
-//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+/*!
+ Creates object by it's representation (byte array)
+ \param theArray - byte array
+ \param theType - type of object
+*/
GLViewer_Object* GLViewer_MimeSource::getObject( QByteArray theArray, QString theType )
{
if( !theArray.isEmpty() )
return NULL;
}
+/*!
+ Creates list of objects by its representation (byte array)
+ \param theArray - byte array
+ \param theType - type of object
+*/
QValueList<GLViewer_Object*> GLViewer_MimeSource::getObjects( QByteArray theArray, QString theType )
{
if( !theArray.isEmpty() )
return QValueList<GLViewer_Object*>();
}
+/*!
+ \return format by index
+ \param theIndex - index
+*/
const char* GLViewer_MimeSource::format( int theIndex ) const
{
switch( theIndex )
}
+/*!
+ \return internal byte array
+*/
QByteArray GLViewer_MimeSource::encodedData( const char* theObjectType ) const
{
if( theObjectType == "GLViewer_Objects" )
class GLViewer_Object;
-/*! Class GLViewer_MimeSource
-* Needs for a work with QClipboard
+/*!
+ \class GLViewer_MimeSource
+ Needs for a work with QClipboard
*/
-
class GLVIEWER_API GLViewer_MimeSource: public QMimeSource
{
public:
// Author : OPEN CASCADE
//
-/***************************************************************************
-** Class: GLViewer_Object
-** Descr: OpenGL Object
-** Module: GLViewer
-** Created: UI team, 03.09.02
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_Object.h"
#include "GLViewer_Drawer.h"
//#include <cmath>
//using namespace std;
+/*!
+ Default constructor
+*/
GLViewer_Object::GLViewer_Object()
{
myXScale = 1.0;
myGroup = NULL;
}
+/*!
+ Destructor
+*/
GLViewer_Object::~GLViewer_Object()
{
if( myRect )
delete myAspectLine;
}
+/*!
+ \return priority of object
+*/
int GLViewer_Object::getPriority() const
{
return myDrawer ? myDrawer->getPriority() : 0;
}
+/*!
+ \return true if object is inside rectangle
+ \param theRect - rectangle
+*/
GLboolean GLViewer_Object::isInside( GLViewer_Rect theRect )
{
return theRect.toQRect().contains( myRect->toQRect() );
}
+/*!
+ Sets zoom factor
+ \param zoom - zoom factor
+*/
GLboolean GLViewer_Object::setZoom( GLfloat zoom, bool, bool )
{
if( myZoom == zoom )
return GL_TRUE;
}
+/*!
+ Performs zoom change by step
+ \param zoomIn - to increase to decrease zoom
+*/
GLboolean GLViewer_Object::updateZoom( bool zoomIn )
{
float newZoom;
return setZoom( newZoom, true );
}
+/*!
+ Codes object as byte copy
+ \return byte array
+*/
QByteArray GLViewer_Object::getByteCopy()
{
int i = 0;
return aResult;
}
+/*!
+ Initialize object by byte array
+ \param theArray - byte array
+*/
bool GLViewer_Object::initializeFromByteCopy( QByteArray theArray )
{
int i = 0;
return true;
}
+/*!
+ Sets object's group
+ \param theGroup - group
+*/
void GLViewer_Object::setGroup( GLViewer_Group* theGroup )
{
if ( myGroup == theGroup )
myGroup->addObject( this );
}
+/*!
+ \return object's group
+*/
GLViewer_Group* GLViewer_Object::getGroup() const
{
return myGroup;
#pragma warning( disable:4251 )
#endif
-/*!
- * Class GLViewer_Object
- * Base Object for GLViewer
- */
class GLViewer_Drawer;
class GLViewer_AspectLine;
class GLViewer_Group;
class GLViewer_Text;
class GLViewer_Owner;
+/*!
+ * Class GLViewer_Object
+ * Base Object for all GLViewer objects
+ */
class GLVIEWER_API GLViewer_Object
{
public:
// File: GLViewer_Selector.cxx
// Created: November, 2004
-/****************************************************************************
-** Class: GLViewer_Selector
-** Descr: Base class for object selection in QAD-based application
-** Module: GLViewer
-** Created: UI team, 22.09.00
-*****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_Selector.h"
// File: GLViewer_Selector.h
// Created: November, 2004
-/****************************************************************************
-** Class: GLViewer_Selector
-** Descr: Base class for object selection in QAD-based application
-** Module: GLViewer
-** Created: UI team, 22.09.00
-*****************************************************************************/
#ifndef GLVIEWER_SELECTOR_H
#define GLVIEWER_SELECTOR_H
class GLViewer_Viewer;
-/*! Class GLViewer_Selector
-* Based select manager for GLViewer
+/*!
+ \Class GLViewer_Selector
+ Base class for object selection in SUIT-based application
*/
-
class GLVIEWER_API GLViewer_Selector : public QObject
{
Q_OBJECT
// File: GLViewer_Selector2d.cxx
// Created: November, 2004
-/****************************************************************************
-** Class: GLViewer_Selector2d
-** Descr: OpenGL Selector 2D
-** Module: GLViewer
-** Created: UI team, 20.09.02
-*****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_Selector2d.h"
#include "GLViewer_Viewer2d.h"
#include "GLViewer_Context.h"
#include "GLViewer_ViewPort2d.h"
+/*!
+ Constructor
+*/
GLViewer_Selector2d::GLViewer_Selector2d( GLViewer_Viewer2d* v2d, GLViewer_Context* glc ) :
GLViewer_Selector( v2d ),
myGLContext( glc )
// myGLContext->SetSelectionColor( Quantity_NOC_RED );
}
+/*!
+ Destructor
+*/
GLViewer_Selector2d::~GLViewer_Selector2d()
{
}
+/*!
+ Changes hilight color of context
+ \param color - new hilight color
+*/
void GLViewer_Selector2d::setHilightColor( Quantity_NameOfColor color )
{
myGLContext->SetHighlightColor( color );
}
+/*!
+ Changes selection color of context
+ \param color - new selection color
+*/
void GLViewer_Selector2d::setSelectColor( Quantity_NameOfColor color )
{
myGLContext->SetSelectionColor( color );
}
+/*!
+ Detects object at point
+ \param x, y - point co-ordinates
+*/
void GLViewer_Selector2d::detect( int x, int y )
{
//cout << "GLViewer_Selector2d : detect ( " << x << " , " << y << " )" << endl;
myGLContext->MoveTo( x, y );
}
+/*!
+ Undetects all objects
+*/
void GLViewer_Selector2d::undetectAll()
{
if ( myLocked || !myGLContext || !myViewer || !myViewer->getActiveView() ||
myGLContext->clearHighlighted( true );
}
+/*!
+ Selects previously hilighted objects
+ \param append - append objects to selection
+*/
void GLViewer_Selector2d::select( bool append )
{
//cout << "GLViewer_Selector2d : select ( " << (int)append << " )" << endl;
checkSelection( selBefore, append, status );
}
+/*!
+ Selects objects in rectangle
+ \param selRect - selection rectangle
+ \param append - append objects to selection
+*/
void GLViewer_Selector2d::select( const QRect& selRect, bool append )
{
GLViewer_Viewer::SelectionMode selMode = myViewer->getSelectionMode();
checkSelection( selBefore, append, aStatus );
}
+/*!
+ Unselects all objects
+*/
void GLViewer_Selector2d::unselectAll()
{
if ( myLocked || !myViewer )
if ( hadSelection ) emit selSelectionCancel();
}
-/* Checks selection state and emits 'selSelectionDone' or 'selSelectionCancel'
- Should be called by after non-interactive selection. */
+/*!
+ Checks selection state and emits 'selSelectionDone' or 'selSelectionCancel'
+ Should be called by after non-interactive selection.
+*/
void GLViewer_Selector2d::checkSelection( int selBefore, bool append, int aStatus )
{
int selAfter = numSelected();
}
}
+/*!
+ \return number of selected objects
+*/
int GLViewer_Selector2d::numSelected() const
{
return myGLContext->NbSelected();
// File: GLViewer_Selector2d.h
// Created: November, 2004
-/****************************************************************************
-** Class: GLViewer_Selector2d
-** Descr: OpenGL Selector 2D
-** Module: GLViewer
-** Created: UI team, 20.09.02
-*****************************************************************************/
#ifndef GLVIEWER_SELECTOR2D_H
#define GLVIEWER_SELECTOR2D_H
class GLViewer_Viewer2d;
class GLViewer_Context;
-/*! Class GLViewer_Selector2d
-* 2D select manager for GLViewer
+/*!
+ \class GLViewer_Selector2d
+ 2D select manager for GLViewer
*/
class GLVIEWER_API GLViewer_Selector2d : public GLViewer_Selector
{
// Author : OPEN CASCADE
//
-/***************************************************************************
-** Class: GLViewer_Text
-** Descr: Substitution of Prs3d_Text for OpenGL
-** Module: GLViewer
-** Created: UI team, 10.07.03
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_Text.h"
+/*!
+ Constructor
+*/
GLViewer_Text::GLViewer_Text( const QString& text, float xPos, float yPos, const QColor& color )
{
myText = text;
myDTF = DTF_BITMAP;
}
+/*!
+ Constructor
+*/
GLViewer_Text::GLViewer_Text( const QString& text, float xPos, float yPos, const QColor& color, QFont theFont, int theSeparator )
{
myText = text;
myDTF = DTF_BITMAP;
}
+/*!
+ Destructor
+*/
GLViewer_Text::~GLViewer_Text()
{
}
+/*!
+ \return width of text
+*/
int GLViewer_Text::getWidth()
{
int aResult = 0;
return aResult;
}
+/*!
+ \return height of text
+*/
int GLViewer_Text::getHeight()
{
QFontMetrics aFM( myQFont );
return aFM.height();
}
+/*!
+ Codes object as byte copy
+ \return byte array
+*/
QByteArray GLViewer_Text::getByteCopy() const
{
int i;
return aResult;
}
+/*!
+ Initialize text from binary representation
+ \param theBuf - byte array
+*/
GLViewer_Text* GLViewer_Text::fromByteCopy( QByteArray theBuf )
{
int i = 0;
#pragma warning( disable:4251 )
#endif
-/* Class GLViewer_Text
-* Substitution of Prs3d_Text for OpenGL */
-
+/*!
+ \class GLViewer_Text
+ Substitution of Prs3d_Text for OpenGL
+*/
class GLVIEWER_API GLViewer_Text
{
public:
#include <qapplication.h>
#include <qtooltip.h>
-/***************************************************************************
-** Class: GLViewer_ToolTip
-** Descr: ToolTip of GLViewer_Objects
-** Module: GLViewer
-** Created: UI team, 25.03.05
-****************************************************************************/
-
-//--------------------------------------------------------------------------
-//Function: GLViewer_ToolTip()
-//Description: constructor
-//--------------------------------------------------------------------------
+/*!
+ constructor
+*/
GLViewer_ObjectTip::GLViewer_ObjectTip( GLViewer_ViewPort2d* theParent )
:QObject(),
myText(),
connect( mypTimer, SIGNAL( timeout() ), this, SLOT( showTip() ) );
}
-//--------------------------------------------------------------------------
-//Function: GLViewer_ToolTip()
-//Description: destructor
-//--------------------------------------------------------------------------
+/*!
+ destructor
+*/
GLViewer_ObjectTip::~GLViewer_ObjectTip()
{
// delete mypRect;
}
-//--------------------------------------------------------------------------
-//Function: GLViewer_ToolTip()
-//Description: destructor
-//--------------------------------------------------------------------------
+/*!
+ It is called when there is a possibility that a tool tip should be shown
+ \param p - position of tooltip
+*/
bool GLViewer_ObjectTip::maybeTip( const QPoint &p )
{
*/
}
+/*!
+ Custom event filter
+*/
bool GLViewer_ObjectTip::eventFilter( QObject* theObj, QEvent* e )
{
hideTipAndSleep();
return false;
}
-
+/*!
+ Hides tooltip and stops timer
+*/
void GLViewer_ObjectTip::hideTipAndSleep()
{
//if( mypPoint )
mypTimer->stop();
}
+/*!
+ Shows tooltip
+*/
void GLViewer_ObjectTip::showTip()
{
if( maybeTip( myPoint ) )
}
}
+/*!
+ Restarts timer
+*/
void GLViewer_ObjectTip::wakeup( int theTime )
{
if( mypTimer->isActive() )
class GLViewer_ViewPort2d;
class QLabel;
-/***************************************************************************
-** Class: GLViewer_ObjectTip
-** Descr: ToolTip of GLViewer_Objects
-** Module: GLViewer
-** Created: UI team, 28.03.05
-****************************************************************************/
+/*!
+ \class GLViewer_ObjectTip
+ ToolTip of GLViewer_Objects
+*/
class GLVIEWER_API GLViewer_ObjectTip: public QObject//QToolTip//QtxToolTip
{
Q_OBJECT
#include <iostream.h>
-/****************************************************************************
-** Class: GLViewer_LineList
-** Descr: Tools for distinct line
-** Module: GLViewer
-** Created: UI team, 27.10.05
-*****************************************************************************/
+/*!
+ Constructor
+ \param size - size of internal array
+*/
GLViewer_LineList::GLViewer_LineList( int size )
{
myRealSize = 2*size;
memset( myArray, 0, myRealSize*sizeof(double) );
}
+/*!
+ Destructor
+*/
GLViewer_LineList::~GLViewer_LineList()
{
delete myArray;
}
+/*!
+ Adds new line segment to list
+ \param coord1, coord2 - co-ordinates of points
+*/
bool GLViewer_LineList::addSegment( double coord1, double coord2 )
{
if( coord1 > coord2 )
return true;
}
+/*!
+ Gets info about segment
+ \param theIndex - index of segment
+ \param coord1, coord2 - co-ordinates of points
+*/
bool GLViewer_LineList::readSegment( int theIndex, double& coord1, double& coord2 )
{
if( theIndex > mySegmentNumber || !myArray)
return true;
}
+/*!
+ \return true if line list covers point
+ \param thePoint - point co-ordinate
+*/
int GLViewer_LineList::contains( double thePoint ) const
{
if( !myArray || mySegmentNumber == 0 )
}
+/*!
+ Removes segment
+ \param theIndex - segment index
+*/
bool GLViewer_LineList::removeSegment( int theIndex )
{
if( theIndex > mySegmentNumber || !myArray)
return true;
}
+/*!
+ Removes segment from line list
+ \param coord1, coord2 - co-ordinates of points
+*/
bool GLViewer_LineList::removeSegment( double coord1, double coord2 )
{
if( coord1 > coord2 )
return true;
}
+/*!
+ Clears line list
+*/
void GLViewer_LineList::clear()
{
if( myArray )
memset( myArray, 0, myRealSize*sizeof(double) );
}
+/*!
+ Prints debug info about line list
+*/
void GLViewer_LineList::print()
{
cout << "MainCoord: " << myMainCoord <<" SIZE: " << myRealSize << " ENum: " << mySegmentNumber << " :::";
cout << endl;
}
+/*!
+ Draws line list with help of OpenGL
+ \param theDim - dimension
+*/
void GLViewer_LineList::show( FieldDim theDim )
{
if( !myArray )
}
}
-/****************************************************************************
-** Class: GLViewer_LineField
-** Descr: Tools for solving
-** Module: GLViewer
-** Created: UI team, 27.10.05
-*****************************************************************************/
+
+/*!
+ Constructor
+*/
GLViewer_LineField::GLViewer_LineField()
{
myCurArrayIndex = 0;
myXLineArray = NULL;
myYLineArray = NULL;
}
+
+/*!
+ Constructor
+*/
GLViewer_LineField::GLViewer_LineField( const int theMAXSize, const int theXN, const int theYN )
{
myCurArrayIndex = 0;
}
}
+/*!
+ Destructor
+*/
GLViewer_LineField::~GLViewer_LineField()
{
if( myXLineArray )
delete myGraphArray2;
}
+/*!
+ Adds line
+*/
void GLViewer_LineField::addLine( FieldDim theDim, GLViewer_LineList* )
{
//not implemented
}
+/*!
+ Adds line
+ \param theDim - dimension
+ \param theMC - main co-ordinate
+ \param theBegin - start co-ordinate
+ \param theEnd - end co-ordinate
+*/
void GLViewer_LineField:: addLine( FieldDim theDim, double theMC, double theBegin, double theEnd )
{
GLViewer_LineList* aLL = new GLViewer_LineList( 1 );
addLine( theDim, aLL );
}
-
+/*!
+ Adds line
+ \param theDim - dimension
+ \param theLL - main co-ordinate
+ \param thePosition - index in list
+*/
int GLViewer_LineField::insertLine( FieldDim theDim, GLViewer_LineList* theLL, int thePosition )
{
if( !myXLineArray || !myYLineArray )
return -1;
}
+/*!
+ Adds line
+ \param theDim - dimension
+ \param theMainCoord - main co-ordinate
+ \param theBegin - start co-ordinate
+ \param theEnd - end co-ordinate
+ \param thePosition - index in list
+*/
int GLViewer_LineField::insertLine( FieldDim theDim, double theMainCoord, double theBegin, double theEnd, int thePosition )
{
GLViewer_LineList* aLL = new GLViewer_LineList( 1 );
return insertLine( theDim, aLL, thePosition );
}
-
+/*!
+ \return other dimension
+*/
FieldDim GLViewer_LineField::invertDim( FieldDim theFD )
{
if( theFD == FD_X )
return FD_X;
}
+/*!
+ \return line list
+ \param theIndex - index in list
+ \param tehFD - dimension
+*/
GLViewer_LineList* GLViewer_LineField::getLine( int theIndex, FieldDim theFD )
{
if( !myXLineArray || !myYLineArray )
return NULL;
}
+/*!
+ Sets borders of field
+ \param X1, X2 - minimal and maximal abscisses
+ \param Y1, Y2 - minimal and maximal ordinates
+*/
void GLViewer_LineField::setBorders( double X1, double X2, double Y1, double Y2 )
{
if( !myXLineArray || !myYLineArray )
}
}
+/*!
+ Adds rectangle
+ \param top, right - a corner of rectangle
+ \param bottom, left - other corner of rectangle
+*/
void GLViewer_LineField::addRectangle( double top, double right, double bottom, double left )
{
if( !myXLineArray || !myYLineArray )
}
}
+/*!
+ Prints debug info about line field
+*/
void GLViewer_LineField::print()
{
cout << "My X matrix Number: " << myXSize << endl;
myYLineArray[j]->print();
}
+/*!
+ Draws field with help of OpenGL
+*/
void GLViewer_LineField::show()
{
for( int i = 0; i < myXSize; i++ )
cout << "Show function" << endl;
}
+/*!
+ \return size
+ \param theDim - dimension
+*/
int GLViewer_LineField::getDimSize( FieldDim theDim )
{
if( theDim == FD_X )
return -1;
}
+/*!
+ \return array of intersected indexes
+ \param theDim - dimension
+ \param theIndex - index
+ \param theLL - line with that intersection is checked
+ \param theSize - to return value of array size
+*/
int* GLViewer_LineField::intersectIndexes( FieldDim theDim, int theIndex, const GLViewer_LineList* theLL, int& theSize )
{
theSize = 0;
return anArray;
}
-
+/*!
+ Sets start/end search point
+ \param thePoint - type of point (start: FP_Start; end: FP_End )
+ \param theX, theY - point co-ordinates
+*/
bool GLViewer_LineField::setPoint( FieldPoint thePoint, double theX, double theY )
{
if( !myXLineArray || !myYLineArray )
return false;
}
+/*!
+ \return number of segments
+*/
int GLViewer_LineField::segmentNumber()
{
if( !(myXLineArray || myYLineArray) )
return aNumber;
}
+/*!
+ Removes all multiple segments
+*/
void GLViewer_LineField::optimize()
{
if( !myXLineArray || !myYLineArray )
}
}
+/*!
+ Some prepare actions
+ Needs call setPoint before
+*/
void GLViewer_LineField::initialize()
{
if( !myXLineArray || !myYLineArray )
}
}
+/*!
+ One iteration of algorithm
+*/
void GLViewer_LineField::iteration()
{
int aParam = myCurCount;
delete[] aNodes;
}
+/*!
+ Checks for complete status
+*/
GLViewer_LineField::IterationStatus GLViewer_LineField::checkComplete()
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
return IS_NOT_SOLVED;
}
+/*!
+ Finds LineList by counts and returns indexes
+*/
int* GLViewer_LineField::findByCount( int& theParam )
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
return anArray;
}
+/*!
+ Finds LineList by segment and dimension
+*/
int GLViewer_LineField::findBySegment( FieldDim theDim, int theLineIndex, int theSegment, bool inCurArray )
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 || getDimSize( theDim ) <= theLineIndex )
return -1;
}
+/*!
+ Main method, performs algorithm execution
+*/
GLViewer_LineField::EndStatus GLViewer_LineField::startAlgorithm()
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
return ES_SOLVED;
}
+/*!
+ \return solution and size of solution
+*/
double* GLViewer_LineField::solution( int& theSize )
{
if( !myXLineArray || !myYLineArray || !myGraphArray1 || !myGraphArray2 )
return anArray;
}
+/*!
+ \return current solution array
+*/
GraphNode* GLViewer_LineField::getCurArray()
{
if( !myGraphArray1 || !myGraphArray2 )
return myGraphArray2;
}
+/*!
+ \return other solution array
+*/
GraphNode* GLViewer_LineField::getSecArray()
{
if( !myGraphArray1 || !myGraphArray2 )
return myGraphArray1;
}
+/*!
+ \return maximum segment number
+*/
int GLViewer_LineField::maxSegmentNum()
{
if( !myXLineArray || !myYLineArray )
return max_num;
}
+/*!
+ \return list of LileList by dimension
+ \param theDim - dimension
+*/
GLViewer_LineList** GLViewer_LineField::getLLArray( FieldDim theDim )
{
if( theDim == FD_X )
class GLViewer_LineField;
-/****************************************************************************
-** Class: GLViewer_Tools
-** Descr: Tools for Viewer
-** Module: GLViewer
-** Created: UI team, 27.10.05
-*****************************************************************************/
+/*!
+ \class GLViewer_Tools
+ Tools for Viewer
+*/
class GLVIEWER_API GLViewer_Tools
{
public:
};
/*!
- Class GLViewer_LineList
+ \class GLViewer_LineList
Tools for distinct line
This class implmented interface for segment operations:
add, cut, remove and etc.
int mySolveIndex;
};
-/*! Class GLViewer_LineField
-* Tools for solving algorithm of finding shortest path on rare grid with minimum of
-* line turns number
+/*!
+ \class GLViewer_LineField
+ Tools for solving algorithm of finding shortest path on rare grid with minimum of
+ line turns number
*/
class GLViewer_LineField
{
//! Checks for complete status
IterationStatus checkComplete();
- //! Finds LileList by counts and returns indexes
+ //! Finds LineList by counts and returns indexes
int* findByCount( int& theParam );
- //! Finds LileList by segment and dimension
+ //! Finds LineList by segment and dimension
int findBySegment( FieldDim, int coord1, int coord2, bool inCurArray = true );
//! Returns current solution array
// File: GLViewer_ViewFrame.cxx
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_ViewFrame
-** Descr: Frame window for viewport in QAD-based application
-** Module: QAD
-** Created: UI team, 05.09.00
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_ViewFrame.h"
#include "GLViewer_Viewer.h"
{
}
-//================================================================
-// Function : createActions
-// Purpose :
-//================================================================
+/*!
+ Creates actions of GL view frame
+*/
void GLViewer_ViewFrame::createActions()
{
if (!myActionsMap.isEmpty()) return;
myActionsMap[ ResetId ] = aAction;
}
-//================================================================
-// Function : createToolBar
-// Purpose :
-//================================================================
+/*!
+ Creates toolbar of GL view frame
+*/
void GLViewer_ViewFrame::createToolBar()
{
myActionsMap[DumpId]->addTo(myToolBar);
{
QWidget* p = parentWidget();
if ( p && p->inherits( "QWorkspaceChild" ) )
- p = p->parentWidget(); /* QWorkspaceChild: internal impl class in QWorkspace */
+ p = p->parentWidget();
if ( !p )
return QMainWindow::sizeHint();
return QSize( 9 * p->width() / 10 , 9 * p->height() / 10 );
//#include <windows.h>
+/*!
+ SLOT: called on dump view operation is activated, stores scene to raster file
+*/
void GLViewer_ViewFrame::onViewDump()
{
GLViewer_Widget* aWidget = ((GLViewer_ViewPort2d*)myVP)->getGLWidget();
}
}
+/*!
+ Start panning
+*/
void GLViewer_ViewFrame::onViewPan()
{
myViewer->activateTransform( GLViewer_Viewer::Pan );
}
+/*!
+ Start zooming
+*/
void GLViewer_ViewFrame::onViewZoom()
{
myViewer->activateTransform( GLViewer_Viewer::Zoom );
}
+/*!
+ Start fit all
+*/
void GLViewer_ViewFrame::onViewFitAll()
{
myViewer->activateTransform( GLViewer_Viewer::FitAll );
}
+/*!
+ Start fit area
+*/
void GLViewer_ViewFrame::onViewFitArea()
{
myViewer->activateTransform( GLViewer_Viewer::FitRect );
}
+/*!
+ Start fit selected
+*/
void GLViewer_ViewFrame::onViewFitSelect()
{
myViewer->activateTransform( GLViewer_Viewer::FitSelect );
}
+/*!
+ Start global panning
+*/
void GLViewer_ViewFrame::onViewGlobalPan()
{
myViewer->activateTransform( GLViewer_Viewer::PanGlobal );
}
+/*!
+ Start rotating
+*/
void GLViewer_ViewFrame::onViewRotate()
{
//myViewer->activateTransform( GLViewer_Viewer::Rotate );
}
+/*!
+ Start reset default view aspects
+*/
void GLViewer_ViewFrame::onViewReset()
{
myViewer->activateTransform( GLViewer_Viewer::Reset );
}
-
-//================================================================
-// Function : mouseEvent
-// Purpose : dispatches mouse events
-//================================================================
+
+/*!
+ Dispatches mouse events
+*/
void GLViewer_ViewFrame::mouseEvent( QMouseEvent* e )
{
switch ( e->type() )
}
}
-//================================================================
-// Function : keyEvent
-// Purpose : dispatches key events
-//================================================================
+/*!
+ Dispatches key events
+*/
void GLViewer_ViewFrame::keyEvent( QKeyEvent* e )
{
switch ( e->type() )
}
}
-//================================================================
-// Function : wheelEvent
-// Purpose : dispatches wheel events
-//================================================================
+/*!
+ Dispatches wheel events
+*/
void GLViewer_ViewFrame::wheelEvent( QWheelEvent* e )
{
switch ( e->type() )
}
}
-/*! The method returns the visual parameters of this view as a formated string
- */
+/*!
+ \return the visual parameters of this view as a formated string
+*/
QString GLViewer_ViewFrame::getVisualParameters()
{
QString retStr;
return retStr;
}
-/* The method restors visual parameters of this view from a formated string
- */
+/*!
+ The method restores visual parameters of this view from a formated string
+*/
void GLViewer_ViewFrame::setVisualParameters( const QString& parameters )
{
QStringList paramsLst = QStringList::split( '*', parameters, true );
// File: GLViewer_ViewFrame.h
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_ViewFrame
-** Descr: Frame window for viewport in QAD-based application
-** Module: QAD
-** Created: UI team, 05.09.00
-****************************************************************************/
#ifndef GLVIEWER_VIEWFRAME_H
#define GLVIEWER_VIEWFRAME_H
#pragma warning( disable:4251 )
#endif
-/*! Class GLViewer_ViewFrame
-* Frame window for viewport in GLViewer
+/*!
+ \class GLViewer_ViewFrame
+ Frame window for viewport in QAD-based application
*/
class GLVIEWER_API GLViewer_ViewFrame: public SUIT_ViewWindow
int GLViewer_ViewManager::myMaxId = 0;
-//***************************************************************
+/*!Constructor.*/
GLViewer_ViewManager::GLViewer_ViewManager( SUIT_Study* theStudy, SUIT_Desktop* theDesktop )
: SUIT_ViewManager( theStudy, theDesktop )
{
setViewModel( new GLViewer_Viewer2d( "GLViewer" ) );
}
-//***************************************************************
+/*!Destructor.*/
GLViewer_ViewManager::~GLViewer_ViewManager()
{
}
-//***************************************************************
+/*!Sets view name for view window \a theView.*/
void GLViewer_ViewManager::setViewName(SUIT_ViewWindow* theView)
{
int aPos = myViews.find(theView);
theView->setCaption( QString( "GL scene:%1 - viewer:%2" ).arg(myId).arg(aPos+1));
}
-//***************************************************************
+/*!Context menu popup for \a popup.*/
void GLViewer_ViewManager::contextMenuPopup( QPopupMenu* popup )
{
SUIT_ViewManager::contextMenuPopup( popup );
// File: GLViewer_ViewPort.cxx
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_ViewPort
-** Descr: Visualisation canvas of QAD-based application
-** Module: QAD
-** Created: UI team, 05.09.00
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#if !(defined WNT) && !(defined QT_CLEAN_NAMESPACE)
#include <Xw_Window.hxx>
#include <Graphic3d_GraphicDevice.hxx>
+/*!
+ \struct CMapEntry
+ Map of indexed colors
+ For internal purposes
+*/
struct CMapEntry
{
CMapEntry();
XStandardColormap scmap;
};
+/*!
+ Constructor
+*/
CMapEntry::CMapEntry()
{
cmap = 0;
scmap.colormap = 0;
}
+/*!
+ Destructor
+*/
CMapEntry::~CMapEntry()
{
if ( alloc )
setBackgroundColor( selColor );
}
+/*!
+ Custom context menu event handler
+*/
void GLViewer_ViewPort::contextMenuEvent( QContextMenuEvent* e )
{
//if ( e->reason() != QContextMenuEvent::Mouse )
// File: GLViewer_ViewPort.h
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_ViewPort
-** Descr: Visualisation canvas of GLViewer
-** Created: UI team, 05.09.04
-****************************************************************************/
#ifndef GLVIEWER_VIEWPORT_H
#define GLVIEWER_VIEWPORT_H
BS_Dragging = 0x0004
};
-/*!
- * Class GLViewer_ViewPort
- * Visualisation canvas of GLViewer
- */
+/*!
+ \class GLViewer_ViewPort
+ Visualisation canvas of GLViewer
+*/
class GLVIEWER_API GLViewer_ViewPort: public QWidget
{
Q_OBJECT
theY = aTempY;
}
+/*!
+ Constructor
+*/
GLViewer_ViewPort2d::GLViewer_ViewPort2d( QWidget* parent, GLViewer_ViewFrame* theViewFrame ) :
GLViewer_ViewPort( parent ),
myMargin( MARGIN ), myWidth( WIDTH ), myHeight( HEIGHT ),
// myGLWidget->installEventFilter( myObjectTip );
}
+/*!
+ Destructor
+*/
GLViewer_ViewPort2d::~GLViewer_ViewPort2d()
{
if( myCompass )
delete myGLWidget;
}
+/*!
+ SLOT: initializes drag process
+*/
void GLViewer_ViewPort2d::onStartDragObject( )
{
if( myIsDragProcess == noDrag )
}
}
+/*!
+ SLOT: cuts object to clipboard
+*/
void GLViewer_ViewPort2d::onCutObject()
{
/*GLViewer_Object* aMovingObject = ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext()->getCurrentObject();
}
}
+/*!
+ SLOT: copies object to clipboard
+*/
void GLViewer_ViewPort2d::onCopyObject()
{
/*GLViewer_Object* aMovingObject = ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext()->getCurrentObject();
}
}
+/*!
+ SLOT: pastes object from clipboard
+*/
void GLViewer_ViewPort2d::onPasteObject()
{
/*QClipboard *aClipboard = QApplication::clipboard();
*/
}
+/*!
+ SLOT: called when object is being dragged
+*/
void GLViewer_ViewPort2d::onDragObject( QMouseEvent* e )
{
//cout << "---GLViewer_ViewPort2d::onDragObject()---" << endl;
}
}
+/*!
+ Custom mouse double click event handler
+*/
void GLViewer_ViewPort2d::mouseDoubleClickEvent( QMouseEvent * e )
{
//redefined to block mouse release after mouse double click
GLViewer_ViewPort::mouseDoubleClickEvent( e );
}
+/*!
+ Creates or deletes compass
+ \param on - if it is true, then to create
+*/
void GLViewer_ViewPort2d::turnCompass( GLboolean on )
{
if( on )
delete myCompass;
}
+/*!
+ Creates or deletes grid
+ \param on - if it is true, then to create
+*/
void GLViewer_ViewPort2d::turnGrid( GLboolean on )
{
if( on )
delete myGrid;
}
+/*!
+ Changes grid color
+ \param gridColor - new grid color
+ \param axisColor - new axis color
+*/
void GLViewer_ViewPort2d::setGridColor( const QColor gridColor, const QColor axisColor )
{
if( myGrid )
}
}
+/*!
+ Changes background color
+ \param color - new background color
+*/
void GLViewer_ViewPort2d::setBackgroundColor( const QColor& color )
{
GLViewer_ViewPort::setBackgroundColor( color );
myGLWidget->repaint();
}
+/*!
+ \return background color
+*/
QColor GLViewer_ViewPort2d::backgroundColor() const
{
return GLViewer_ViewPort::backgroundColor();
}
+/*!
+ Resize view
+*/
void GLViewer_ViewPort2d::initResize( int x, int y )
{
float xa, xb, ya, yb;
myGLWidget->setScale( myXScale, myYScale, 1.0 );
}
+/*!
+ Custom paint event handler
+*/
void GLViewer_ViewPort2d::paintEvent( QPaintEvent* e )
{
//cout << "GLViewer_ViewPort2d::paintEvent" << endl;
GLViewer_ViewPort::paintEvent( e );
}
+/*!
+ Custom resize event handler
+*/
void GLViewer_ViewPort2d::resizeEvent( QResizeEvent* e )
{
//cout << "GLViewer_ViewPort2d::resizeEvent" << endl;
GLViewer_ViewPort::resizeEvent( e );
}
+/*!
+ Resets view to start state
+*/
void GLViewer_ViewPort2d::reset()
{
//cout << "GLViewer_ViewPort2d::reset" << endl;
myGLWidget->updateGL();
}
+/*!
+ Sets offset to view
+ \param dx - X offset
+ \param dy - Y offset
+*/
void GLViewer_ViewPort2d::pan( int dx, int dy )
{
//cout << "GLViewer_ViewPort2d::pan " << dx << " " << dy << endl;
myGLWidget->updateGL();
}
+/*!
+ Sets view center in global coords
+ \param x, y - global co-ordinates of center
+*/
void GLViewer_ViewPort2d::setCenter( int x, int y )
{
//cout << "GLViewer_ViewPort2d::setCenter" << endl;
myGLWidget->updateGL();
}
+/*!
+ Process zoming transformation with mouse tracking from ( x0, y0 ) to ( x1, y1 )
+*/
void GLViewer_ViewPort2d::zoom( int x0, int y0, int x, int y )
{
//cout << "GLViewer_ViewPort2d::zoom" << endl;
}
}
+/*!
+ Transforms view by rectangle
+ \param rect - rectangle
+*/
void GLViewer_ViewPort2d::fitRect( const QRect& rect )
{
float x0, x1, y0, y1;
myGLWidget->updateGL();
}
+/*!
+ Transforms view by selection
+*/
void GLViewer_ViewPort2d::fitSelect()
{
GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer();
}
}
+/*!
+ Transform view by view borders
+ \param keepScale - if it is true, zoom does not change
+*/
void GLViewer_ViewPort2d::fitAll( bool keepScale, bool withZ )
{
//cout << "GLViewer_ViewPort2d::fitAll" << endl;
emit vpUpdateValues();
}
+/*!
+ Begins rotation
+ \param x, y - start point
+*/
void GLViewer_ViewPort2d::startRotation( int x, int y )
{
myGLWidget->setRotationStart( x, y, 1.0 );
}
+/*!
+ Performs rotation
+ \param intX, intY - current point
+*/
void GLViewer_ViewPort2d::rotate( int intX, int intY )
{
GLint val[4];
myGLWidget->updateGL();
}
+/*!
+ Finishes rotation
+*/
void GLViewer_ViewPort2d::endRotation()
{
float ra, rx, ry, rz;
myGLWidget->setRotationAngle( ra );
}
+/*!
+ Draws compass
+*/
void GLViewer_ViewPort2d::drawCompass()
{
if( !myCompass->getVisible() )
glCallList( aTextList );
}
+/*!
+ \return blocking status for current started operations
+*/
BlockStatus GLViewer_ViewPort2d::currentBlock()
{
if( myIsDragProcess == inDrag && myCurDragPosX != NULL && myCurDragPosY != NULL)
return BS_NoBlock;
}
+/*!
+ Initializes rectangle selection
+ \param x, y - start point
+*/
void GLViewer_ViewPort2d::startSelectByRect( int x, int y )
{
if( !mypFirstPoint && !mypLastPoint )
mypLastPoint = new QPoint( x, y );
}
}
+
+/*!
+ Draws rectangle selection
+ \param x, y - current point
+*/
void GLViewer_ViewPort2d::drawSelectByRect( int x, int y )
{
if( mypFirstPoint && mypLastPoint )
}
}
+
+/*!
+ Finishes rectangle selection
+*/
void GLViewer_ViewPort2d::finishSelectByRect()
{
if( mypFirstPoint && mypLastPoint )
}
}
+/*!
+ \return rectangle selection
+*/
QRect GLViewer_ViewPort2d::selectionRect()
{
QRect aRect;
return aRect;
}
+/*!
+*/
bool GLViewer_ViewPort2d::startPulling( GLViewer_Pnt point )
{
GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer();
return false;
}
+/*!
+*/
void GLViewer_ViewPort2d::drawPulling( GLViewer_Pnt point )
{
GLViewer_Viewer2d* aViewer = (GLViewer_Viewer2d*)getViewFrame()->getViewer();
myPullingObject->pull( point, aLockedObject );
}
+/*!
+*/
void GLViewer_ViewPort2d::finishPulling()
{
myIsPulling = false;
setCursor( *getDefaultCursor() );
}
+/*!
+ Convert rectangle in window co-ordinates to GL co-ordinates
+ \return converted rectangle
+*/
GLViewer_Rect GLViewer_ViewPort2d::win2GLV( const QRect& theRect ) const
{
GLViewer_Rect aRect;
return aRect;
}
+/*!
+ Convert rectangle in GL co-ordinates to window co-ordinates
+ \return converted rectangle
+*/
QRect GLViewer_ViewPort2d::GLV2win( const GLViewer_Rect& theRect ) const
{
QRect aRect;
return aRect;
}
+/*!
+ SLOT: called when tooltip should be shown
+*/
void GLViewer_ViewPort2d::onMaybeTip( QPoint thePoint, QString& theText, QFont& theFont, QRect& theTextReg, QRect& theRegion )
{
GLViewer_Context* aContext = ((GLViewer_Viewer2d*)getViewFrame()->getViewer())->getGLContext();
virtual void setCenter( int x, int y );
//! Process zoming transformation with mouse tracking from ( x0, y0 ) to ( x1, y1 )
virtual void zoom( int x0, int y0, int x1, int y1 );
- //! Transforms view by certangle
+ //! Transforms view by rectangle
virtual void fitRect( const QRect& );
//! Transforms view by selection
virtual void fitSelect();
// File: GLViewer_Viewer.cxx
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_Viewer
-** Descr: Viewer for QAD-based application
-** Module: QAD
-** Created: UI team, 05.09.00
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_Viewer.h"
#include "GLViewer_Selector.h"
delete mySelector;
}
-//================================================================
-// Function : setViewManager
-// Purpose :
-//================================================================
+/*!
+ Sets new view manager
+ \param theViewManager - new view manager
+*/
void GLViewer_Viewer::setViewManager(SUIT_ViewManager* theViewManager)
{
SUIT_ViewModel::setViewManager(theViewManager);
}
}
-//================================================================
-// Function : contextMenuPopup
-// Purpose :
-//================================================================
+/*!
+ Builds popup for GL viewer
+*/
void GLViewer_Viewer::contextMenuPopup( QPopupMenu* thePopup )
{
if( thePopup->count() > 0 )
startOperations( e );
}
-/****************************************************************
-** Class: GLViewer_ViewTransformer
-** Level: Public
-*****************************************************************/
int GLViewer_ViewTransformer::panBtn = Qt::MidButton;
int GLViewer_ViewTransformer::zoomBtn = Qt::LeftButton;
int GLViewer_ViewTransformer::fitRectBtn = Qt::LeftButton;
}
-/****************************************************************
-** Class: GLViewer_ViewSketcher
-** Level: Public
-*****************************************************************/
int GLViewer_ViewSketcher::sketchBtn = LeftButton;
/*!
#endif
/*!
- * Class GLViewer_Object
- * Base Viewer for GLViewer
- */
+ \class GLViewer_Object
+ Base Viewer for GLViewer
+*/
class GLVIEWER_API GLViewer_Viewer: public SUIT_ViewModel
{
Q_OBJECT
GLViewer_ViewTransformer* myTransformer; /* transform manipulator */
};
-/****************************************************************
-** Class: GLViewer_ViewTransformer
-**
-*****************************************************************/
class GLVIEWER_API GLViewer_ViewTransformer : public QObject
{
public:
int myMajorBtn;
};
-/****************************************************************
-** Class: GLViewer_ViewSketcher
-**
-*****************************************************************/
class GLVIEWER_API GLViewer_ViewSketcher : public QObject
{
public:
// File: GLViewer_Viewer2d.cxx
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_Viewer2d
-** Descr: OpenGL Viewer 2D
-** Module: GLViewer
-** Created: UI team, 04.09.02
-****************************************************************************/
-
//#include <GLViewerAfx.h>
#include "GLViewer_Viewer2d.h"
#include "GLViewer_Object.h"
#include <qpointarray.h>
#include <qcolordialog.h>
+/*!
+ Constructor
+ \param title - viewer title
+*/
GLViewer_Viewer2d::GLViewer_Viewer2d( const QString& title) :
GLViewer_Viewer( title )
{
myDrawers.clear();
}
+/*!
+ Destructor
+*/
GLViewer_Viewer2d::~GLViewer_Viewer2d()
{
//myGLSketcher = 0;
GLViewer_TexFont::clearTextBases();
}
+/*!Create new instance of view window on desktop \a theDesktop.
+ *\retval SUIT_ViewWindow* - created view window pointer.
+ */
SUIT_ViewWindow* GLViewer_Viewer2d::createView( SUIT_Desktop* theDesktop )
{
return new GLViewer_ViewFrame( theDesktop, this );
}
+/*!
+ Adds item for change background color
+ \param thePopup - menu
+*/
void GLViewer_Viewer2d::addPopupItems( QPopupMenu* thePopup )
{
// CTH8434. "Change background color" menu item is available if there are no selected objects
}
}
+/*!
+ Changes background color
+*/
void GLViewer_Viewer2d::onChangeBgColor()
{
if( !getActiveView() )
}
}
+/*!
+ Updates colors for all drawers (does not work)
+*/
void GLViewer_Viewer2d::updateColors( QColor colorH, QColor colorS )
{
// cout << "GLViewer_Viewer2d::updateColors" << endl;
activateAllDrawers( TRUE );
}
+/*!
+ Updates rect of global scene by adding new rectangle
+ \param theRect - rectangle
+*/
void GLViewer_Viewer2d::updateBorders( GLViewer_Rect* theRect )
{
QPtrVector<SUIT_ViewWindow> views = getViewManager()->getViews();
}
}
+/*!
+ Recomputes global scene rect
+*/
void GLViewer_Viewer2d::updateBorders()
{
QPtrVector<SUIT_ViewWindow> views = getViewManager()->getViews();
}
}
+/*!
+ Redraws all active objects by updating all drawers in all views
+*/
void GLViewer_Viewer2d::updateAll()
{
if ( !getActiveView() )
( ( GLViewer_ViewPort2d* )( ( GLViewer_ViewFrame* )views[i] )->getViewPort() )->getGLWidget()->updateGL();
}
+/*!
+ \param onlyUpdate is passed to method activateAllDrawers drawers
+*/
void GLViewer_Viewer2d::updateDrawers( GLboolean update, GLfloat scX, GLfloat scY )
{
// cout << "GLViewer_Viewer2d::updateDrawers" << endl;
activateAllDrawers( update );
}
+/*!
+ Activates drawers for objects from list \param theObjects only
+*/
void GLViewer_Viewer2d::activateDrawers( QValueList<GLViewer_Object*>& theObjects, bool onlyUpdate, GLboolean swap )
{
//cout << "GLViewer_Viewer2d::activateDrawers " << (int)onlyUpdate << " " << (int)swap << endl;
( ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() )->getGLWidget()->makeCurrent();
}
+/*!
+ Activates drawer for \param theObject
+*/
void GLViewer_Viewer2d::activateDrawer( GLViewer_Object* theObject, bool onlyUpdate, GLboolean swap )
{
ObjList aList;
activateDrawers( aList, onlyUpdate, swap );
}
+/*!
+ \param onlyUpdate is passed to drawers
+*/
void GLViewer_Viewer2d::activateAllDrawers( bool onlyUpdate, GLboolean swap )
{
if ( !getActiveView() )
activateDrawers( anActiveObjs, onlyUpdate, swap );
}
+/*!
+ Creates set of marker
+ \param theMarkersNum - number of markers
+ \param theMarkersRad - radius of markers
+*/
void GLViewer_Viewer2d::onCreateGLMarkers( int theMarkersNum, int theMarkersRad )
{
if ( !getActiveView() )
delete[] anYCoord;
}
+/*!
+ Creates GL polyline
+ \param theAnglesNum - number of angles
+ \param theRadius - radius
+ \param thePolylineNumber - number
+*/
void GLViewer_Viewer2d::onCreateGLPolyline( int theAnglesNum, int theRadius, int thePolylineNumber )
{
if ( !getActiveView() )
delete[] anYCoord;
}
+/*!
+ Creates text
+ \param theStr - text string
+ \param theTextNumber - number
+*/
void GLViewer_Viewer2d::onCreateGLText( QString theStr, int theTextNumber )
{
if ( !getActiveView() )
activateAllDrawers( false );
}
+/*!
+ Translates point from global CS to curreent viewer CS
+ \param x, y - co-ordinates to be translated
+*/
void GLViewer_Viewer2d::transPoint( GLfloat& x, GLfloat& y )
{
if ( !getActiveView() )
y -= yPan;
}
+/*!
+ \return object rect in window CS
+ \param theObject - object
+*/
QRect* GLViewer_Viewer2d::getWinObjectRect( GLViewer_Object* theObject )
{
if ( !getActiveView() )
return newRect;
}
+/*!
+ Translates rect in window CS to rect in global CS
+ \param theRect - rectangle to be translated
+ \return transformed rect
+*/
GLViewer_Rect GLViewer_Viewer2d::getGLVRect( const QRect& theRect ) const
{
if ( !getActiveView() )
return vp->win2GLV( theRect );
}
+/*!
+ Translates rect in global CS to rect in window CS
+ \param theRect - rectangle to be translated
+ \return transformed rect
+*/
QRect GLViewer_Viewer2d::getQRect( const GLViewer_Rect& theRect ) const
{
if ( !getActiveView() )
return vp->GLV2win( theRect );
}
+/*!
+ \return new selector
+*/
GLViewer_Selector* GLViewer_Viewer2d::createSelector()
{
return new GLViewer_Selector2d( this, getGLContext() );
}
+/*!
+ \return new Transformer
+ \param type - type of new transformer
+*/
GLViewer_ViewTransformer* GLViewer_Viewer2d::createTransformer( int type )
{
return new GLViewer_View2dTransformer( this, type );
}
-/*
-GLViewer_Sketcher* GLViewer_Viewer2d::createGLSketcher( int type )
-{
- return new GLViewer_Sketcher( this, type );
-}
-void GLViewer_Viewer2d::activateGLSketching( int type )
-{
- GLViewer_ViewPort2d* vp = 0;
- if ( !getActiveView() || !( vp = ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() ) )
- return;
-
- // Finish current sketching
- if ( type == None )
- {
- if ( myGLSketcher->getType() != None )
- {
- myGLSketcher->setType( None );
- finishSketching();
- }
- }
- // Activate new sketching
- else
- {
- activateGLSketching( None ); // concurrency not supported
- myGLSketcher->setType( type );
- startSketching();
- }
-}
-
-void GLViewer_Viewer2d::startSketching()
-{
- GLViewer_ViewPort2d* avp = (GLViewer_ViewPort2d*)getActiveView()->getViewPort();
- avp->setCursor( *avp->getSketchCursor() );
- //avp->enablePopup( false );
- myGLSketcher->startSketching();
-}
-
-void GLViewer_Viewer2d::finishSketching()
-{
- GLViewer_ViewPort2d* avp = (GLViewer_ViewPort2d*)getActiveView()->getViewPort();
- avp->setCursor( *avp->getDefaultCursor() );
- //avp->enablePopup( true );
- myGLSketcher->finishSketching();
-}
-
-bool GLViewer_Viewer2d::isSketchingActive()
-{
- return myGLSketcher->getType() != None;
-}
-
-int GLViewer_Viewer2d::getSketchingType()
-{
- return myGLSketcher->getType();
-}
-
-void GLViewer_Viewer2d::onSketchDelObject()
-{
- GLViewer_ViewPort2d* avp = (GLViewer_ViewPort2d*)getActiveView()->getViewPort();
- avp->setCursor( *avp->getDefaultCursor() );
- myGLSketcher->finishSketching( true );
-}
-
-void GLViewer_Viewer2d::onSketchUndoLast()
-{
-
-}
-
-void GLViewer_Viewer2d::onSketchFinish()
-{
- finishSketching();
-}
+/*!
+ Custom mouse event handler
*/
void GLViewer_Viewer2d::onMouseEvent( SUIT_ViewWindow*, QMouseEvent* e )
{
GLViewer_Viewer::onMouseEvent( 0, e );
}
+/*!
+ Rotation transformation
+*/
bool GLViewer_Viewer2d::testRotation( QMouseEvent* e )
{
if ( ( e->button() == GLViewer_View2dTransformer::rotateButton() ) &&
return false;
}
-
+/*!
+ Inserts text lines as header for file
+ \param aType - file type
+ \param hFile - file instance
+*/
void GLViewer_Viewer2d::insertHeader( VectorFileType aType, QFile& hFile )
{
if( aType == POST_SCRIPT )
}
}
+/*!
+ Inserts text lines as ending for file
+ \param aType - file type
+ \param hFile - file instance
+*/
void GLViewer_Viewer2d::insertEnding( VectorFileType aType, QFile& hFile )
{
if( aType == POST_SCRIPT )
#endif
}
+/*!
+ Translates current view content to vector file
+ \param aType - type of file
+ \param FileName - name of file,
+ \param aPType - paper size type
+ \param mmLeft, mmRight, mmTop, mmBottom - margins
+*/
bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, PaperType aPType,
double mmLeft, double mmRight, double mmTop, double mmBottom )
{
return true;
}
-
+/*!
+ Repaints view
+ \param theView - view to be repainted. If it is NULL then all views will be repainted
+*/
void GLViewer_Viewer2d::repaintView( GLViewer_ViewFrame* theView, bool makeCurrent )
{
GLViewer_ViewFrame* aCurView;
// ( ( GLViewer_ViewPort2d* )getActiveView()->getViewPort() )->getGLWidget()->makeCurrent();
}
+/*!
+ Starts some operation on mouse event
+*/
void GLViewer_Viewer2d::startOperations( QMouseEvent* e )
{
GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)getActiveView())->getViewPort();
vp->startSelectByRect( e->x(), e->y() );
}
+/*!
+ Updates started operation on mouse event
+*/
bool GLViewer_Viewer2d::updateOperations( QMouseEvent* e )
{
GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)getActiveView())->getViewPort();
return false;
}
+/*!
+ Completes started operation on mouse event
+*/
void GLViewer_Viewer2d::finishOperations( QMouseEvent* e )
{
GLViewer_ViewPort2d* vp = ( GLViewer_ViewPort2d* )((GLViewer_ViewFrame*)getActiveView())->getViewPort();
}
}
+/*!
+ Starts some operation on mouse wheel event
+*/
void GLViewer_Viewer2d::startOperations( QWheelEvent* e )
{
bool zoomIn = e->delta() > 0;
}
-/****************************************************************
-** Class: GLViewer_View2dTransformer
-**
-*****************************************************************/
-
int GLViewer_View2dTransformer::rotateBtn = RightButton;
+/*!
+ Constructor
+*/
GLViewer_View2dTransformer::GLViewer_View2dTransformer( GLViewer_Viewer* viewer, int typ )
: GLViewer_ViewTransformer( viewer, typ )
{
initTransform( true );
}
+/*!
+ Destructor
+*/
GLViewer_View2dTransformer::~GLViewer_View2dTransformer()
{
if ( type() == GLViewer_Viewer::Rotate )
// File: GLViewer_Viewer2d.h
// Created: November, 2004
-/***************************************************************************
-** Class: GLViewer_Viewer2d
-** Descr: OpenGL Viewer 2D
-** Module: GLViewer
-** Created: UI team, 04.09.04
-****************************************************************************/
#ifndef GLVIEWER_VIEWER2D_H
#define GLVIEWER_VIEWER2D_H
#pragma warning( disable:4251 )
#endif
-/*!
- * Class GLViewer_Object
- * 2D viewer for GLViewer
- */
+/*!
+ \class GLViewer_Viewer2d
+ OpenGL Viewer 2D
+*/
+
class GLVIEWER_API GLViewer_Viewer2d : public GLViewer_Viewer
{
Q_OBJECT
//GLViewer_Sketcher* myGLSketcher;
};
-/****************************************************************
-** Class: GLViewer_View2dTransformer
-**
-*****************************************************************/
class GLVIEWER_API GLViewer_View2dTransformer : public GLViewer_ViewTransformer
{
public:
// File: GLViewer_Widget.cxx
// Created: November, 2004
-//================================================================
-// Class : GLViewer_Widget
-// Description : OpenGL QWidget for GLViewer
-//================================================================
-
#include "GLViewer_Widget.h"
#include "GLViewer_ViewPort2d.h"
#include "GLViewer_Viewer2d.h"
#include <qsize.h>
#include <qtooltip.h>
-//=======================================================================
-// Function: GLViewer_Widget
-// Purpose :
-//=======================================================================
+/*!
+ A constructor
+ Parameters using for QOGLWidget as is
+*/
GLViewer_Widget::GLViewer_Widget( QWidget* parent, const char* name ):
QGLWidget( parent, 0/*, WRepaintNoErase | WResizeNoErase*/ )
{
setMouseTracking( true );
}
-//=======================================================================
-// Function: GLViewer_Widget
-// Purpose :
-//=======================================================================
+/*!
+ Destructor
+*/
GLViewer_Widget::~GLViewer_Widget()
{
}
-//=======================================================================
-// Function: ~GLViewer_Widget
-// Purpose :
-//=======================================================================
+/*!
+ \return offset parameters of Window in OpenGL global scene
+*/
void GLViewer_Widget::getPan( GLfloat& xPan, GLfloat& yPan, GLfloat& zPan )
{
xPan = myXPan;
zPan = myZPan;
}
-//=======================================================================
-// Function: setPan
-// Purpose :
-//=======================================================================
+/*!
+ A function for installing the offset parameters of Window in OpenGL global scene
+*/
void GLViewer_Widget::setPan( GLfloat xPan, GLfloat yPan, GLfloat zPan )
{
myXPan = xPan;
myZPan = zPan;
}
-//=======================================================================
-// Function: getScale
-// Purpose :
-//=======================================================================
+/*!
+ \return scales on OpenGL scene along 3 directions in 2d scene zScale = 1.0
+*/
void GLViewer_Widget::getScale( GLfloat& xScale, GLfloat& yScale, GLfloat& zScale )
{
xScale = myXScale;
zScale = myZScale;
}
-//=======================================================================
-// Function: setScale
-// Purpose :
-//=======================================================================
+/*!
+ A function for installing the scales of OpenGL scene
+*/
void GLViewer_Widget::setScale( GLfloat xScale, GLfloat yScale, GLfloat zScale )
{
if ( xScale > 0 && yScale > 0 && zScale > 0 )
}
}
-//=======================================================================
-// Function: getRotationStart
-// Purpose :
-//=======================================================================
+/*!
+ \return start point of curren rotation of Window in OpenGL global scene
+*/
void GLViewer_Widget::getRotationStart( GLfloat& rotationStartX,
GLfloat& rotationStartY,
GLfloat& rotationStartZ )
rotationStartZ = myRotationStartZ;
}
-//=======================================================================
-// Function: setRotationStart
-// Purpose :
-//=======================================================================
+/*!
+ A function for installing the rotation angle of Window in OpenGL global scene in degree (Only in 2D)
+*/
void GLViewer_Widget::setRotationStart( GLfloat rotationStartX,
GLfloat rotationStartY,
GLfloat rotationStartZ )
myRotationStartZ = rotationStartZ;
}
-//=======================================================================
-// Function: getRotation
-// Purpose :
-//=======================================================================
+/*!
+ \return parameters of rotation
+ \param rotationAngle - angle
+ \param rotationCenterX - center x
+ \param rotationCenterY - center y
+ \param rotationCenterZ - center z
+*/
void GLViewer_Widget::getRotation( GLfloat& rotationAngle,
GLfloat& rotationCenterX,
GLfloat& rotationCenterY,
rotationCenterZ = myRotationCenterZ;
}
-//=======================================================================
-// Function: setRotation
-// Purpose :
-//=======================================================================
+/*!
+ Sets parameters of rotation
+ \param rotationAngle - angle
+ \param rotationCenterX - center x
+ \param rotationCenterY - center y
+ \param rotationCenterZ - center z
+*/
void GLViewer_Widget::setRotation( GLfloat rotationAngle,
GLfloat rotationCenterX,
GLfloat rotationCenterY,
myRotationCenterZ = rotationCenterZ;
}
-//=======================================================================
-// Function: setBackground
-// Purpose :
-//=======================================================================
+
+/*!
+ Sets image as background
+ \param filename - name of file
+*/
void GLViewer_Widget::setBackground( QString filename )
{
}
}
-//=======================================================================
-// Function: addToolTip
-// Purpose :
-//=======================================================================
+/*!
+ Adds tooltip
+ \param theString - tooltip text
+ \param theRect - tooltip rectangle
+*/
void GLViewer_Widget::addToolTip( QString theString, QRect theRect )
{
myToolTipRect = theRect;
QToolTip::add( this, myToolTipRect, theString );
}
-//=======================================================================
-// Function: removeToolTip
-// Purpose :
-//=======================================================================
+/*!
+ Removes tooltip
+*/
void GLViewer_Widget::removeToolTip()
{
QToolTip::remove( this, myToolTipRect );
}
-//=======================================================================
-// Function: initializeGL
-// Purpose :
-//=======================================================================
+/*!
+ Initialization (redefined virtual from QGLWidget)
+*/
void GLViewer_Widget::initializeGL()
{
setAutoBufferSwap( true );
isLoadBackground = false;
}
-//=======================================================================
-// Function: paintGL
-// Purpose :
-//=======================================================================
+/*!
+ Paints content
+*/
void GLViewer_Widget::paintGL()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
v->repaintView( getViewPort()->getViewFrame() );
}
-//=======================================================================
-// Function: resizeGL
-// Purpose :
-//=======================================================================
+/*!
+ Resets OpenGl parameters after resize
+ \param w - new width
+ \param h - new height
+*/
void GLViewer_Widget::resizeGL( int w, int h )
{
glLoadIdentity();
}
-//=======================================================================
-// Function: exportRepaint
-// Purpose :
-//=======================================================================
+/*!
+ Provides repaint in export mode
+*/
void GLViewer_Widget::exportRepaint()
{
isExportMode = true;
isExportMode = false;
}
-//=======================================================================
-// Function: paintEvent
-// Purpose :
-//=======================================================================
+/*!
+ Custom paint event handler
+*/
void GLViewer_Widget::paintEvent( QPaintEvent* e )
{
QApplication::sendEvent( myViewPort, e );
}
-//=======================================================================
-// Function: mouseMoveEvent
-// Purpose :
-//=======================================================================
+/*!
+ Custom mouse move event handler
+*/
void GLViewer_Widget::mouseMoveEvent( QMouseEvent* e )
{
QApplication::sendEvent( myViewPort, e );
}
-//=======================================================================
-// Function: mousePressEvent
-// Purpose :
-//=======================================================================
+/*!
+ Custom mouse press event handler
+*/
void GLViewer_Widget::mousePressEvent( QMouseEvent* e )
{
QApplication::sendEvent( myViewPort, e );
}
-//=======================================================================
-// Function: mouseReleaseEvent
-// Purpose :
-//=======================================================================
+/*!
+ Custom mouse release event handler
+*/
void GLViewer_Widget::mouseReleaseEvent( QMouseEvent* e )
{
QApplication::sendEvent( myViewPort, e );
}
-//=======================================================================
-// Function: enterEvent
-// Purpose :
-//=======================================================================
+/*!
+ Custom enter event handler
+*/
void GLViewer_Widget::enterEvent( QEvent* e )
{
updateGL();
}
-//=======================================================================
-// Function: leaveEvent
-// Purpose :
-//=======================================================================
+/*!
+ Custom leave event handler
+*/
void GLViewer_Widget::leaveEvent( QEvent* e )
{
updateGL();
}
-//=======================================================================
-//! Function: hex
-//! Purpose : Returns the hex code of digit < 16
-//=======================================================================
+/*!
+ \return the hex code of digit < 16
+ \param c - digit
+*/
inline char hex( uchar c )
{
if( c<=9 )
return ' ';
}
-//=======================================================================
-//! Function: AddImagePart
-//! Purpose : Translates path of image to PS format
-/*! Image inside rectangle from w1 to w2 and from h2 to h1*/
-//=======================================================================
+/*!
+ Translates part of image inside rectangle from w1 to w2 and from h2 to h1 to PS format
+ \param hFile - PostScript file
+ \param image - image to be tarnslated
+ \param w1 - x start position
+ \param w2 - x end position
+ \param h1 - y start position
+ \param h2 - y end position
+ \param aViewerCS - viewer co-ordinate system
+ \param aPSCS - paper co-ordinate system
+ \param a
+ \param b
+ \param c
+ \param d
+ \param dw
+ \param dh
+*/
void AddImagePart( QFile& hFile, QImage& image, int w1, int w2, int h1, int h2,
GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS,
double a, double b, double c, double d, double dw, double dh )
}
}
-//=======================================================================
-// Function: getBackgroundRectInViewerCS
-// Purpose :
-//=======================================================================
+/*!
+ \return background rectangle in viewer CS
+*/
void GLViewer_Widget::getBackgroundRectInViewerCS( double& left, double& top, double& right, double& bottom )
{
left = -myIW/2; right = myIW/2;
top = myIH/2; bottom = -myIH/2;
}
-//=======================================================================
-// Function: translateBackgroundToPS
-// Purpose :
-//=======================================================================
+/*!
+ Translates background to PostScript
+ \param hFile - PostScript file
+ \param aViewerCS - viewer co-ordinate system
+ \param aPSCS - paper co-ordinate system
+*/
void GLViewer_Widget::translateBackgroundToPS( QFile& hFile, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aPSCS )
{
QImage buf;
}
}
-//=======================================================================
-//! Function: DecodeScanLine
-//! Purpose : Translate image line with one color depth to line wiht other depth
-//=======================================================================
+/*!
+ Translates image line with one color depth to line with other depth
+*/
void DecodeScanLine( int width, uchar* dest, int dest_depth, uchar* source, int source_depth )
{
#ifndef WIN32
}
}
-//=======================================================================
-// Function: translateBackgroundToEMF
-// Purpose :
-//=======================================================================
#ifdef WIN32
+/*!
+ Translates background to EMF
+ \param dc - descriptor of EMF
+ \param aViewerCS - viewer co-ordinate system
+ \param aPSCS - paper co-ordinate system
+*/
void GLViewer_Widget::translateBackgroundToEMF( HDC dc, GLViewer_CoordSystem* aViewerCS, GLViewer_CoordSystem* aEMFCS )
{
QImage buf;
// File: GLViewer_Widget.h
// Created: November, 2004
-/*! Class GLViewer_Widget
- * Class for visualization OpenGL scene (widget) for GLViewer
- */
#ifndef GLVIEWER_WIDGET_H
#define GLVIEWER_WIDGET_H
class GLViewer_ViewPort2d;
class GLViewer_CoordSystem;
+/*!
+ \class GLViewer_Widget
+ Widget for visualization of OpenGL scene
+*/
class GLVIEWER_API GLViewer_Widget : public QGLWidget
{
Q_OBJECT
//using namespace std;
#include "SALOME_AISShape.ixx"
-SALOME_AISShape::SALOME_AISShape(const TopoDS_Shape& shape): AIS_Shape(shape) {
+/*!
+ Constructor
+ \param shape - TopoDS shape
+*/
+SALOME_AISShape::SALOME_AISShape(const TopoDS_Shape& shape)
+: AIS_Shape(shape)
+{
}
#include "SALOME_DataMapIteratorOfDataMapOfIOMapOfInteger.hxx"
#endif
using namespace std;
+
+/*!
+ Destructor
+*/
SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::~SALOME_DataMapNodeOfDataMapOfIOMapOfInteger() {}
+/*!
+ \return OCC Handle Type
+*/
Standard_EXPORT Handle_Standard_Type& SALOME_DataMapNodeOfDataMapOfIOMapOfInteger_Type_()
{
}
-// DownCast method
-// allow safe downcasting
-//
+/*!
+ DownCast method: allows safe downcasting
+*/
const Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) _anOtherObject;
return _anOtherObject ;
}
+
+/*!
+ \return OCC Handle dynamic Type
+*/
const Handle(Standard_Type)& SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::DynamicType() const
{
return STANDARD_TYPE(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) ;
}
+
+/*!
+ \return true if other type is the same
+ \param AType - type to be checked
+*/
Standard_Boolean SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(SALOME_DataMapNodeOfDataMapOfIOMapOfInteger) == AType || TCollection_MapNode::IsKind(AType));
}
+/*!
+ Destructor
+*/
Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger::~Handle_SALOME_DataMapNodeOfDataMapOfIOMapOfInteger() {}
#define TheKey Handle_SALOME_InteractiveObject
#define TheKey_hxx "SALOME_InteractiveObject.hxx"
#include "SALOME_InteractiveObject.ixx"
+/*!
+ Default constructor
+*/
SALOME_InteractiveObject::SALOME_InteractiveObject()
{
myEntry = "";
myReference = "";
}
+/*!
+ Constructor
+ \param anEntry - entry of object
+ \param aComponentDataType - component data type name
+ \param aName - name of object
+*/
SALOME_InteractiveObject::SALOME_InteractiveObject(const char* anEntry,
const char* aComponentDataType,
const char* aName):
myReference("")
{}
+/*!
+ Sets entry
+ \param anEntry - new entry of object
+*/
void SALOME_InteractiveObject::setEntry(const char* anEntry){
myEntry = anEntry;
}
+/*!
+ \return entry
+*/
const char* SALOME_InteractiveObject::getEntry(){
return myEntry.c_str();
}
+/*!
+ Sets component data type
+ \param aComponentDataType - component data type name
+*/
void SALOME_InteractiveObject::setComponentDataType(const char* aComponentDataType){
myComponentDataType = aComponentDataType;
}
+/*!
+ \return component data type
+*/
const char* SALOME_InteractiveObject::getComponentDataType(){
return myComponentDataType.c_str();
}
+/*!
+ Sets name
+ \param aName - new name of object
+*/
void SALOME_InteractiveObject::setName(const char* aName){
myName = aName;
}
+/*!
+ \return name
+*/
const char* SALOME_InteractiveObject::getName(){
return myName.c_str();
}
+/*!
+ \return true if entry isn't empty
+*/
Standard_Boolean SALOME_InteractiveObject::hasEntry(){
return myEntry != "";
}
+/*!
+ \return true if objects have same entries
+ \param anIO - other object
+*/
Standard_Boolean SALOME_InteractiveObject::isSame(const Handle(SALOME_InteractiveObject)& anIO ){
if ( anIO->hasEntry() && this->hasEntry() ) {
if ( myEntry == anIO->getEntry() )
return Standard_False;
}
+/*!
+ \return true if component data types are same
+ \param ComponentDataType - component data type to be checked
+*/
Standard_Boolean SALOME_InteractiveObject::isComponentType(const char* ComponentDataType){
if ( myComponentDataType == ComponentDataType )
return Standard_True;
return Standard_False;
}
+/*!
+ \return true if object has reference
+*/
Standard_Boolean SALOME_InteractiveObject::hasReference()
{
return myReference != "";
}
+/*!
+ \return reference
+*/
const char* SALOME_InteractiveObject::getReference()
{
return myReference.c_str();
}
+/*!
+ Sets reference
+ \param aReference - new reference
+*/
void SALOME_InteractiveObject::setReference(const char* aReference)
{
myReference = aReference;
#include "SALOME_ListIteratorOfListIO.hxx"
#endif
using namespace std;
+
+/*!
+ Destructor
+*/
SALOME_ListNodeOfListIO::~SALOME_ListNodeOfListIO() {}
-
+/*!
+ \return OCC Handle Type
+*/
Standard_EXPORT Handle_Standard_Type& SALOME_ListNodeOfListIO_Type_()
{
}
-// DownCast method
-// allow safe downcasting
-//
+/*!
+ DownCast method, allows safe downcasting
+*/
const Handle(SALOME_ListNodeOfListIO) Handle(SALOME_ListNodeOfListIO)::DownCast(const Handle(Standard_Transient)& AnObject)
{
Handle(SALOME_ListNodeOfListIO) _anOtherObject;
return _anOtherObject ;
}
+
+/*!
+ \return OCC Handle dynamic Type
+*/
const Handle(Standard_Type)& SALOME_ListNodeOfListIO::DynamicType() const
{
return STANDARD_TYPE(SALOME_ListNodeOfListIO) ;
}
+
+/*!
+ \return true if other type is the same
+ \param AType - type to be checked
+*/
Standard_Boolean SALOME_ListNodeOfListIO::IsKind(const Handle(Standard_Type)& AType) const
{
return (STANDARD_TYPE(SALOME_ListNodeOfListIO) == AType || TCollection_MapNode::IsKind(AType));
}
+/*!
+ Destructor
+*/
Handle_SALOME_ListNodeOfListIO::~Handle_SALOME_ListNodeOfListIO() {}
#define Item Handle_SALOME_InteractiveObject
#define Item_hxx "SALOME_InteractiveObject.hxx"
#include "SALOME_InteractiveObject.hxx"
using namespace std;
+/*!
+ Constructor
+ \param TheKind - type of filter
+*/
SALOME_TypeFilter::SALOME_TypeFilter(const Standard_CString TheKind):
myKind(TheKind){}
+/*!
+ \return true if object passes filter
+ \param anObj - object to be checked
+*/
Standard_Boolean SALOME_TypeFilter::IsOk(const Handle(SALOME_InteractiveObject)& anObj) const
{
return anObj->isComponentType( myKind );
class OB_ListView;
class OB_ListItem;
+/*!
+ \class OB_Browser
+ Represents object browser. Allows to get/set selection,
+ to drag-n-drop of objects, to determine item by SUIT object and
+ vice versa
+*/
class OB_EXPORT OB_Browser : public QFrame, public SUIT_PopupClient
{
Q_OBJECT
class SUIT_DataObject;
+/*!
+ \class OB_Filter
+ Base class for ObjectBrowser filter.
+ Filters selected objects by some condition.
+*/
class OB_EXPORT OB_Filter
{
public:
{
}
+/*!
+ Paints item
+*/
template<class T>
void ListItemF<T>::paintC( QPainter* p, QColorGroup& cg, int c, int w, int align )
{
//myT.paintCell( p, colorGrp, c, itemW, align );
}
+/*!
+ Paints focused item
+*/
template<class T>
void ListItemF<T>::paintFoc( QPainter* p, QColorGroup& cg, const QRect& r )
{
//myT.paintFocus( p, cg, rect );
}
+/*!
+ Set selection of item
+ \param s - selected state
+*/
template<class T>
void ListItemF<T>::setSel( bool s )
{
//myT.setSelected( s );
}
+/*!
+ Updates name and pixmap of item
+*/
template<class T>
void ListItemF<T>::update()
{
class SUIT_DataObject;
-/*
- base template class for ListViewItems and CheckListItems
+/*!
+ \class ListItemF
+ Base template class for ListViewItems and CheckListItems
*/
-
template<class T> class ListItemF
{
public:
T* myT;
};
-/*
- ListViewItem class
+/*!
+ \class OB_ListItem
+ Provides custom list item for Object Browser tree
*/
-
class OB_EXPORT OB_ListItem : public ListItemF<QListViewItem>, public QListViewItem
{
public:
static int RTTI();
};
-/*
- CheckListItem class
+/*!
+ \class OB_CheckListItem
+ Provides custom list item with check box
*/
-
class OB_EXPORT OB_CheckListItem : public ListItemF<QCheckListItem>, public QCheckListItem
{
public:
class QListViewItem;
class SUIT_DataObject;
+/*!
+ \class OB_ListView
+ Special list view for ObjectBrowser.
+ Allows drag-n-drop, filtering of selected objects, column management.
+*/
class OB_EXPORT OB_ListView : public QtxListView
{
Q_OBJECT
typedef QValueList<short> QShortList;
typedef QValueList<double> QDoubleList;
+/*!
+ \class Qtx
+ \brief Set of auxiliary static methods
+*/
class QTX_EXPORT Qtx : public Qt
{
public:
QMap<QWidget*,int> myIds;
};
+
+/*!
+ Constructor for menu action
+ \param text - description text
+ \param menutext - menu text
+ \param parent - parent object
+ \param id - integer identificator of action
+ \param allowEmpty - if it is true, it makes possible to add this action with empty popup to menu
+*/
+
QtxActionMenuMgr::MenuAction::MenuAction( const QString& text,
const QString& menuText,
QObject* parent,
myPopup = new QPopupMenu();
}
+/*!
+ Destructor: deletes internal popup
+*/
QtxActionMenuMgr::MenuAction::~MenuAction()
{
delete myPopup;
}
+/*!
+ Adds action to widget, for example, to popup menu or menu bar
+*/
bool QtxActionMenuMgr::MenuAction::addTo( QWidget* w )
{
if ( !w )
return true;
}
+/*!
+ Removes action from widget, for example, from popup menu or menu bar
+*/
bool QtxActionMenuMgr::MenuAction::removeFrom( QWidget* w )
{
if ( !w )
return false;
}
+/*!
+ \return internal popup of action
+*/
QPopupMenu* QtxActionMenuMgr::MenuAction::popup() const
{
return myPopup;
Class: QtxActionMenuMgr
Level: Public
*/
-
-
QtxActionMenuMgr::QtxActionMenuMgr( QMainWindow* p )
: QtxActionMgr( p ),
myMenu( p ? p->menuBar() : 0 )
}
}
+/*!
+ Constructor
+*/
QtxActionMenuMgr::QtxActionMenuMgr( QWidget* mw, QObject* p )
: QtxActionMgr( p ),
myMenu( mw )
connect( myMenu, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
}
+/*!
+ Destructor
+*/
QtxActionMenuMgr::~QtxActionMenuMgr()
{
for ( NodeListIterator it( myRoot.children ); it.current() && myMenu; ++it )
delete itr.data();
}
+/*!
+ \return whether menu item corresponding to action is visible
+ \param actId - identificator of action
+ \param place - identificator of some parent action
+*/
bool QtxActionMenuMgr::isVisible( const int actId, const int place ) const
{
MenuNode* node = find( actId, place );
return node && node->visible;
}
+/*!
+ Sets visible state of action
+ \param actId - identificator of action
+ \param place - identificator of some parent action
+ \param v - visibility state
+*/
void QtxActionMenuMgr::setVisible( const int actId, const int place, const bool v )
{
MenuNode* node = find( actId, place );
node->visible = v;
}
+/*!
+ Insert action as children menu item
+ \param id - identificator of action
+ \param menus - few names of parent menu items, separated by '|'. It means sequence of menu items,
+ for example "File|Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.
+ \param group - group identificator
+ \param idx - index inside Qt menu
+*/
int QtxActionMenuMgr::insert( const int id, const QString& menus, const int group, const int idx )
{
return insert( id, QStringList::split( "|", menus ), group, idx );
}
+/*!
+ Insert action as children menu item
+ \param a - action
+ \param menus - few names of parent menu items, separated by '|'. It means sequence of menu items,
+ for example "File|Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.
+ \param group - group identificator
+ \param idx - index inside Qt menu
+*/
int QtxActionMenuMgr::insert( QAction* a, const QString& menus, const int group, const int idx )
{
return insert( a, QStringList::split( "|", menus ), group, idx );
}
+/*!
+ Insert action as children menu item
+ \param id - identificator of action
+ \param menus - list of names of parent menu items, separated by |. It means sequence of menu items,
+ for example "File|Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.
+ \param group - group identificator
+ \param idx - index inside Qt menu
+*/
int QtxActionMenuMgr::insert( const int id, const QStringList& menus, const int group, const int idx )
{
int pId = createMenu( menus, -1 );
return insert( id, pId, group, idx );
}
+/*!
+ Insert action as children menu item
+ \param a - action
+ \param menus - list of names of parent menu items. It means sequence of menu items,
+ for example "File|Edit" means File->Edit submenu. If submenu doesn't exist, it will be created.
+ \param group - group identificator
+ \param idx - index inside Qt menu
+*/
int QtxActionMenuMgr::insert( QAction* a, const QStringList& menus, const int group, const int idx )
{
int pId = createMenu( menus, -1 );
return insert( a, pId, group, idx );
}
+/*!
+ Insert action as children menu item
+ \param id - identificator of action
+ \param pId - identificator of action corresponding to parent menu item
+ \param group - group identificator
+ \param idx - index inside Qt menu
+*/
int QtxActionMenuMgr::insert( const int id, const int pId, const int group, const int idx )
{
if ( id == -1 )
return node->id;
}
+/*!
+ Insert action as children menu item
+ \param a - action
+ \param pId - identificator of action corresponding to parent menu item
+ \param group - group identificator
+ \param idx - index inside Qt menu
+*/
int QtxActionMenuMgr::insert( QAction* a, const int pId, const int group, const int idx )
{
return insert( registerAction( a ), pId, group, idx );
}
+/*!
+ Create and insert action as children menu item
+ \return identificator of inserted action
+ \param title - menu text of action
+ \param pId - identificator of action corresponding to parent menu item
+ \param group - group identificator
+ \param id - identificator of new action
+ \param idx - index inside Qt menu
+ \param allowEmpty - indicates, that it is possible to add this action with empty popup menu to other menu
+*/
int QtxActionMenuMgr::insert( const QString& title, const int pId, const int group, const int id, const int idx, const bool allowEmpty )
{
MenuNode* pNode = pId == -1 ? &myRoot : find( pId );
return node->id;
}
+/*!
+ Create and insert action as children menu item
+ \return identificator of inserted action
+ \param title - menu text of action
+ \param menus - string list of parents' menu texts, separated by |
+ \param group - group identificator
+ \param id - identificator of new action
+ \param idx - index inside Qt menu
+ \param allowEmpty - indicates, that it is possible to add this action with empty popup menu to other menu
+*/
int QtxActionMenuMgr::insert( const QString& title, const QString& menus, const int group, const int id, const int idx, const bool allowEmpty )
{
return insert( title, QStringList::split( "|", menus ), group, id, idx, allowEmpty );
}
+/*!
+ Create and insert action as children menu item
+ \return identificator of inserted action
+ \param title - menu text of action
+ \param menus - list of parents menu items
+ \param group - group identificator
+ \param id - identificator of new action
+ \param idx - index inside Qt menu
+ \param allowEmpty - indicates, that it is possible to add this action with empty popup menu to other menu
+*/
int QtxActionMenuMgr::insert( const QString& title, const QStringList& menus, const int group, const int id, const int idx, const bool allowEmpty )
{
int pId = createMenu( menus, -1 );
return insert( title, pId, group, id, idx, allowEmpty );
}
+/*!
+ Create and append action as last children
+ \return identificator of inserted action
+ \param title - menu text of action
+ \param pId - id of action corresponding to parent menu item
+ \param group - group identificator
+ \param id - identificator of new action
+ \param allowEmpty - indicates, that it is possible to add this action with empty popup menu to other menu
+*/
int QtxActionMenuMgr::append( const QString& title, const int pId, const int group, const int id, const bool allowEmpty )
{
return insert( title, pId, group, id, allowEmpty );
}
+/*!
+ Create and append action as last children
+ \return identificator of inserted action
+ \param id - identificator of existing action
+ \param pId - id of action corresponding to parent menu item
+ \param group - group identificator
+*/
int QtxActionMenuMgr::append( const int id, const int pId, const int group )
{
return insert( id, pId, group );
}
+/*!
+ Create and append action as last children
+ \return identificator of inserted action
+ \param a - action
+ \param pId - id of action corresponding to parent menu item
+ \param group - group identificator
+*/
int QtxActionMenuMgr::append( QAction* a, const int pId, const int group )
{
return insert( a, pId, group );
}
+/*!
+ Create and insert action as first children
+ \return identificator of inserted action
+ \param title - menu text of action
+ \param pId - id of action corresponding to parent menu item
+ \param group - group identificator
+ \param id - identificator of new action
+ \param allowEmpty - indicates, that it is possible to add this action with empty popup menu to other menu
+*/
int QtxActionMenuMgr::prepend( const QString& title, const int pId, const int group, const int id, const bool allowEmpty )
{
return insert( title, pId, group, id, 0, allowEmpty );
}
+/*!
+ Create and insert action as last children
+ \return identificator of inserted action
+ \param id - identificator of existing action
+ \param pId - id of action corresponding to parent menu item
+ \param group - group identificator
+*/
int QtxActionMenuMgr::prepend( const int id, const int pId, const int group )
{
return insert( id, pId, group, 0 );
}
+/*!
+ Create and insert action as last children
+ \return identificator of inserted action
+ \param a - action
+ \param pId - id of action corresponding to parent menu item
+ \param group - group identificator
+*/
int QtxActionMenuMgr::prepend( QAction* a, const int pId, const int group )
{
return insert( a, pId, group, 0 );
}
+/*!
+ Removes menu item corresponding to action
+ \param id - identificator of action
+*/
void QtxActionMenuMgr::remove( const int id )
{
removeMenu( id, 0 );
update();
}
+/*!
+ Removes menu item
+ \param id - identificator of action
+ \param pId - identificator of action corresponding to parent menu item
+ \param group - group identificator
+*/
void QtxActionMenuMgr::remove( const int id, const int pId, const int group )
{
MenuNode* pNode = pId == -1 ? &myRoot : find( pId );
updateMenu( pNode, false );
}
+/*!
+ Shows menu item corresponding to action
+ \param id - identificator of action
+*/
void QtxActionMenuMgr::show( const int id )
{
setShown( id, true );
}
+/*!
+ Hides menu item corresponding to action
+ \param id - identificator of action
+*/
void QtxActionMenuMgr::hide( const int id )
{
setShown( id, false );
}
+/*!
+ \return shown status of menu item corresponding to action
+ \param id - identificator of action
+*/
bool QtxActionMenuMgr::isShown( const int id ) const
{
bool res = false;
return res;
}
+/*!
+ Sets shown status of menu item corresponding to action
+ \param id - identificator of action
+ \param on - new shown status
+*/
void QtxActionMenuMgr::setShown( const int id, const bool on )
{
NodeList aNodes;
updateMenu( itr.key(), false );
}
+/*!
+ SLOT: called when corresponding menu is destroyed, clears internal pointer to menu
+*/
void QtxActionMenuMgr::onDestroyed( QObject* obj )
{
if ( myMenu == obj )
myMenu = 0;
}
+/*!
+ SLOT: called when menu item is highlighted
+*/
void QtxActionMenuMgr::onHighlighted( int id )
{
const QObject* snd = sender();
}
}
+/*!
+ Assignes new menu with manager
+ \param mw - new menu
+*/
void QtxActionMenuMgr::setWidget( QWidget* mw )
{
if ( myMenu == mw )
connect( myMenu, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
}
+/*!
+ \return menu node by it's place description
+ \param actId - identificator of action
+ \param pId - identificator of action corresponding to start menu item
+ \param rec - recursive search
+*/
QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int actId, const int pId, const bool rec ) const
{
return find( actId, find( pId ), rec );
}
+/*!
+ \return menu node by it's place description
+ \param actId - identificator of action
+ \param startNode - start menu item
+ \param rec - recursive search
+*/
QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const int id, MenuNode* startNode, const bool rec ) const
{
MenuNode* node = 0;
return node;
}
+/*!
+ Finds menu node
+ \return true if at least one node is found
+ \param id - identificator of action
+ \param lst - list to be filled with found nodes
+ \param startNode - start menu item
+*/
bool QtxActionMenuMgr::find( const int id, NodeList& lst, MenuNode* startNode ) const
{
MenuNode* start = startNode ? startNode : (MenuNode*)&myRoot;
return !lst.isEmpty();
}
+/*!
+ Finds menu node
+ \return menu node
+ \param title - menu text of searched node
+ \param pId - id of action corresponding to start menu item
+ \param rec - recursive searching
+*/
QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const QString& title, const int pId, const bool rec ) const
{
return find( title, find( pId ), rec );
}
+/*!
+ Finds menu node
+ \return true if at least one node is found
+ \param title - menu text of node
+ \param lst - list to be filled with found nodes
+ \param startNode - start menu item
+*/
bool QtxActionMenuMgr::find( const QString& title, NodeList& lst, MenuNode* startNode ) const
{
MenuNode* start = startNode ? startNode : (MenuNode*)&myRoot;
return !lst.isEmpty();
}
+/*!
+ Finds menu node
+ \return menu node
+ \param title - menu text of searched node
+ \param startNode - start menu item
+ \param rec - recursive searching
+*/
QtxActionMenuMgr::MenuNode* QtxActionMenuMgr::find( const QString& title, MenuNode* startNode, const bool rec ) const
{
MenuNode* node = 0;
return node;
}
+/*!
+ Find id among children
+ \return id (>0) if on success or -1 on fail
+ \param id - id to be searched
+ \param pid - id of parent, among children of that 'id' must be searched
+*/
int QtxActionMenuMgr::findId( const int id, const int pid ) const
{
MenuNode* start = pid != -1 ? find( pid ) : (MenuNode*)&myRoot;
return -1;
}
+/*!
+ Removes child
+ \param id - id of child to be removed
+ \param startNode - parent menu item
+*/
void QtxActionMenuMgr::removeMenu( const int id, MenuNode* startNode )
{
MenuNode* start = startNode ? startNode : &myRoot;
}
}
+/*!
+ \return menu item action by id
+ \param id - id of action
+*/
QAction* QtxActionMenuMgr::itemAction( const int id ) const
{
return action( id );
}
+/*!
+ \return menu action by id
+ \param id - id of action
+*/
QtxActionMenuMgr::MenuAction* QtxActionMenuMgr::menuAction( const int id ) const
{
MenuAction* a = 0;
return a;
}
+/*!
+ Updates menu ( isUpdatesEnabled() must return true )
+ \param startNode - first menu item to be updated
+ \param rec - recursive update
+ \param updParent - update also parent item (without recursion)
+ \sa isUpdatesEnabled()
+*/
void QtxActionMenuMgr::updateMenu( MenuNode* startNode, const bool rec, const bool updParent )
{
if ( !isUpdatesEnabled() )
updateMenu( node->parent, false );
}
+/*!
+ Updates menu (virtual variant). To be redefined for custom activity on menu updating
+*/
void QtxActionMenuMgr::internalUpdate()
{
if ( isUpdatesEnabled() )
updateMenu();
}
+/*!
+ \return true if widget is non-empty menu
+ \param wid - widget to be checked
+*/
bool QtxActionMenuMgr::checkWidget( QWidget* wid ) const
{
if ( !wid )
return md ? md->count() : false;
}
+/*!
+ \return popup of menu item
+ \param node - menu item
+*/
QWidget* QtxActionMenuMgr::menuWidget( MenuNode* node) const
{
if ( !node || node == &myRoot )
return myMenus[node->id]->popup();
}
+/*!
+ Removes excess separators of menu
+ \param wid - menu to be processed
+*/
void QtxActionMenuMgr::simplifySeparators( QWidget* wid )
{
if ( wid && wid->inherits( "QPopupMenu" ) )
Qtx::simplifySeparators( (QPopupMenu*)wid, false );
}
+/*!
+ Removes special symbols (&) from string
+ \param txt - string to be processed
+ \return clear variant of string
+*/
QString QtxActionMenuMgr::clearTitle( const QString& txt ) const
{
QString res = txt;
return res;
}
+/*!
+ Creates and inserts many menu items
+ \param lst - list of menu texts
+ \param pId - id of action corresponding to parent menu item
+*/
int QtxActionMenuMgr::createMenu( const QStringList& lst, const int pId )
{
if ( lst.isEmpty() )
return insert( title, parentId, -1 );
}
+/*!
+ Loads actions description from file
+ \param fname - name of file
+ \param r - reader of file
+ \return true on success
+*/
bool QtxActionMenuMgr::load( const QString& fname, QtxActionMgr::Reader& r )
{
MenuCreator cr( &r, this );
return r.read( fname, cr );
}
+/*!
+ \return true if item has such child
+ \param title - menu text of child
+ \param pid - id of action corresponding to item
+*/
bool QtxActionMenuMgr::containsMenu( const QString& title, const int pid ) const
{
return (bool)find( title, pid, false );
}
+/*!
+ \return true if item has such child
+ \param id - id of action corresponding to child
+ \param pid - id of action corresponding to item
+*/
bool QtxActionMenuMgr::containsMenu( const int id, const int pid ) const
{
return (bool)find( id, pid, false );
}
+
/*!
- Class: QtxActionMenuMgr::MenuCreator
- Level: Public
+ Constructor
+ \param r - menu reader
+ \param mgr - menu manager
*/
-
QtxActionMenuMgr::MenuCreator::MenuCreator( QtxActionMgr::Reader* r,
QtxActionMenuMgr* mgr )
: QtxActionMgr::Creator( r ),
{
}
+/*!
+ Destructor
+*/
QtxActionMenuMgr::MenuCreator::~MenuCreator()
{
}
+/*!
+ Appends new menu items
+ \param tag - tag of item
+ \param subMenu - it has submenu
+ \param attr - list of attributes
+ \param pId - id of action corresponding to parent item
+*/
int QtxActionMenuMgr::MenuCreator::append( const QString& tag, const bool subMenu,
const ItemAttributes& attr, const int pId )
{
#pragma warning( disable:4251 )
#endif
+/*!
+ \class QtxActionMenuMgr
+ Allows to use set of action to automatically build main menu.
+ With help of methods insert/append/remove it is possible to
+ describe whole structure of menu. Method hide allows
+ to temporary remove some items from menu, method show allows to
+ recreate them.
+ Actions can be grouped with help of group identifictor.
+ Inside popup or menu bar items have order by increasing group id.
+ This manager is able to attune menu: to remove excess separators,
+ to remove empty popup menu etc.
+*/
class QTX_EXPORT QtxActionMenuMgr : public QtxActionMgr
{
Q_OBJECT
typedef QPtrList<MenuNode> NodeList;
typedef QPtrListIterator<MenuNode> NodeListIterator;
+ /*!
+ \class MenuNode
+ Represents a menu item inside main menu structure.
+ For internal purposes only
+ */
class MenuNode
{
public:
MenuMap myMenus;
};
+/*!
+ \class QtxActionMenuMgr::MenuCreator
+ Allows to create automatically main menu by data read from file
+*/
class QtxActionMenuMgr::MenuCreator : public QtxActionMgr::Creator
{
public:
QMap<QToolBar*, QWidgetList> myTools;
};
+/*!
+ Constructor
+*/
QtxActionMgr::SeparatorAction::SeparatorAction( QObject* parent )
: QtxAction( parent )
{
}
+/*!
+ Destructor
+*/
QtxActionMgr::SeparatorAction::~SeparatorAction()
{
}
+/*!
+ Adds action to widget
+ \param wid - widget
+*/
bool QtxActionMgr::SeparatorAction::addTo( QWidget* wid )
{
if ( !wid )
return res;
}
+/*!
+ Removes action from widget
+ \param wid - widget
+*/
bool QtxActionMgr::SeparatorAction::removeFrom( QWidget* wid )
{
if ( !wid )
Level: Public
*/
+/*!
+ Constructor
+*/
QtxActionMgr::QtxActionMgr( QObject* parent )
: QObject( parent ),
myUpdate( true )
{
}
+/*!
+ Destructor
+*/
QtxActionMgr::~QtxActionMgr()
{
}
+/*!
+ Stores action in internal map
+ If action with such id is registered already, then it will be unregistered
+ \param a - action to be registered
+ \param userId - proposed id (if it is less than 0, then id will be generated automatically)
+*/
int QtxActionMgr::registerAction( QAction* a, const int userId )
{
if ( !a )
return theId;
}
+/*!
+ Removes action from internal map
+ \param id - action id
+*/
void QtxActionMgr::unRegisterAction( const int id )
{
if( contains( id ) )
myActions.remove( id );
}
+/*!
+ \return action by id
+ \param id - action id
+*/
QAction* QtxActionMgr::action( const int id ) const
{
if ( contains( id ) )
return 0;
}
+/*!
+ \return id by action
+ \param a - action
+*/
int QtxActionMgr::actionId( const QAction* a ) const
{
if ( !a )
return theId;
}
+/*!
+ \return true if internal map contains such id
+ \param id - action id
+*/
bool QtxActionMgr::contains( const int id ) const
{
return myActions.contains( id );
}
+/*!
+ \return count of actions in internal map
+*/
int QtxActionMgr::count() const
{
return myActions.count();
}
+/*!
+ \return true if internal map is empty
+*/
bool QtxActionMgr::isEmpty() const
{
return myActions.isEmpty();
}
+/*!
+ Fills list with ids of registered actions
+*/
void QtxActionMgr::idList( QIntList& lst ) const
{
lst = myActions.keys();
}
+/*!
+ \return true if updates are enabled
+*/
bool QtxActionMgr::isUpdatesEnabled() const
{
return myUpdate;
}
+/*!
+ Enables/disables updates
+ \param upd - new state
+*/
void QtxActionMgr::setUpdatesEnabled( const bool upd )
{
myUpdate = upd;
}
+/*!
+ \return true if action is visible (by default \return always true)
+*/
bool QtxActionMgr::isVisible( const int, const int ) const
{
return true;
}
+/*!
+ Sets visibility of action (by default, empty implementation)
+*/
void QtxActionMgr::setVisible( const int, const int, const bool )
{
}
+/*!
+ Updates actions, check isUpdatesEnabled() and call internalUpdate()
+ \sa isUpdatesEnabled(), internalUpdate()
+*/
void QtxActionMgr::update()
{
if ( isUpdatesEnabled() )
internalUpdate();
}
+/*!
+ Real update (to be redefined in successors)
+*/
void QtxActionMgr::internalUpdate()
{
}
+/*!
+ \return global free id
+*/
int QtxActionMgr::generateId() const
{
static int id = -1;
return --id;
}
+/*!
+ \return true if action is enabled
+ \param id - action id
+*/
bool QtxActionMgr::isEnabled( const int id ) const
{
QAction* a = action( id );
return false;
}
+/*!
+ Enables/disables action
+ \param id - action id
+ \param en - new state
+*/
void QtxActionMgr::setEnabled( const int id, const bool en )
{
QAction* a = action( id );
a->setEnabled( en );
}
+/*!
+ \return action for separator
+ If this action doesn't exist, then it will be created
+ \param individual - if it is false, then action will be shared, otherwise it will be created on every call
+*/
QAction* QtxActionMgr::separator( const bool individual )
{
if ( individual )
Level: Public
*/
+/*!
+ Constructor
+*/
QtxActionMgr::Reader::Reader()
{
}
+/*!
+ Destructor
+*/
QtxActionMgr::Reader::~Reader()
{
}
+/*!
+ \return list of options
+*/
QStringList QtxActionMgr::Reader::options() const
{
return myOptions.keys();
}
+/*!
+ \return value of option
+ \param name - option name
+ \param def - default option value (is returned, if there is no such option)
+*/
QString QtxActionMgr::Reader::option( const QString& name, const QString& def ) const
{
if( myOptions.contains( name ) )
return def;
}
+/*!
+ Sets value of option
+ \param name - option name
+ \param value - option value
+*/
void QtxActionMgr::Reader::setOption( const QString& name, const QString& value )
{
myOptions[ name ] = value;
/*!
- Class: QtxActionMgr::XMLReader
- Level: Public
+ Constructor
*/
QtxActionMgr::XMLReader::XMLReader( const QString& root,
const QString& item,
setOption( QString( "toggle" ), QString( "toggle-id" ) );
}
+/*!
+ Destructor
+*/
QtxActionMgr::XMLReader::~XMLReader()
{
}
+/*!
+ Reads file and fills action manager with help of creator
+ \param fname - file name
+ \param cr - creator
+*/
bool QtxActionMgr::XMLReader::read( const QString& fname, Creator& cr ) const
{
bool res = false;
return res;
}
+/*!
+ Create item by xml node
+ \param parent_node - parent node
+ \param parent_id - parent id
+ \param cr - creator
+*/
void QtxActionMgr::XMLReader::read( const QDomNode& parent_node,
const int parent_id,
Creator& cr ) const
}
}
+/*!
+ \return true if node satisfies pattern
+*/
bool QtxActionMgr::XMLReader::isNodeSimilar( const QDomNode& node,
const QString& pattern ) const
{
/*!
- Class: QtxActionMgr::Creator
- Level: Public
+ \return integer value by attributes
+ \param attrs - attributes
+ \param name - name of attribute
+ \param def - default value (is returned on fail)
*/
int QtxActionMgr::Creator::intValue( const ItemAttributes& attrs,
const QString& name, int def )
return def;
}
+/*!
+ \return string value by attributes
+ \param attrs - attributes
+ \param name - name of attribute
+ \param def - default value (is returned on fail)
+*/
QString QtxActionMgr::Creator::strValue( const ItemAttributes& attrs,
const QString& name,
const QString& def )
return def;
}
+/*!
+ Constructor
+*/
QtxActionMgr::Creator::Creator( QtxActionMgr::Reader* r )
: myReader( r )
{
}
+/*!
+ Destructor
+*/
QtxActionMgr::Creator::~Creator()
{
}
+/*!
+ \return corresponding reader
+*/
QtxActionMgr::Reader* QtxActionMgr::Creator::reader() const
{
return myReader;
}
+/*!
+ Connects action to some slots (default implementation is empty)
+*/
void QtxActionMgr::Creator::connect( QAction* ) const
{
}
+/*!
+ Loads pixmap
+ \param fname - file name
+ \param pix - to return loaded pixmap
+*/
bool QtxActionMgr::Creator::loadPixmap( const QString& fname, QPixmap& pix ) const
{
if( !reader() )
#pragma warning( disable:4251 )
#endif
+
+/*!
+ \class QtxActionMgr
+ Contains set of actions accessible by id.
+ Base class for menu, popup creators and other action containers.
+*/
class QTX_EXPORT QtxActionMgr : public QObject
{
Q_OBJECT
QTX_EXPORT typedef QMap<QString, QString> ItemAttributes;
+/*!
+ \class QtxActionMgr::Creator
+ Allows to fill automatically action manager with actions created by data from file
+*/
class QtxActionMgr::Creator
{
public:
QtxActionMgr::Reader* myReader;
};
+/*!
+ \class QtxActionMgr::Reader
+ This class is used to read files of some format
+ to create actions and to fill action manager automatically
+*/
class QtxActionMgr::Reader
{
public:
QMap< QString, QString > myOptions;
};
+/*!
+ \class QtxActionMgr::Reader
+ This class is used to read files of XML format
+ to create actions and to fill action manager automatically
+*/
class QtxActionMgr::XMLReader : public Reader
{
public:
#include <qmainwindow.h>
#include <qobjectlist.h>
+/*!
+ Constructor
+*/
QtxActionToolMgr::QtxActionToolMgr( QMainWindow* p )
: QtxActionMgr( p ),
myMainWindow( p )
{
}
+/*!
+ Destructor
+*/
QtxActionToolMgr::~QtxActionToolMgr()
{
}
+/*!
+ \return desktop
+*/
QMainWindow* QtxActionToolMgr::mainWindow() const
{
return myMainWindow;
}
+/*!
+ Creates toolbar
+ \return id of just created toolbar
+ \param name - name of toolbar
+ \param tid - proposed id (if such id is used already, then it will be returned without creation)
+*/
int QtxActionToolMgr::createToolBar( const QString& name, const int tid )
{
static int _toolBarId = -1;
return tbId;
}
+/*!
+ \return toolbar by title
+ \param label - toolbar title
+ \param mw - desktop
+*/
QToolBar* QtxActionToolMgr::find( const QString& label, QMainWindow* mw ) const
{
if ( !mw )
return res;
}
+/*!
+ Removes toolbar
+ \param tid - toolbar id
+*/
void QtxActionToolMgr::removeToolBar( const int tid )
{
if ( !myToolBars.contains( tid ) )
myToolBars.remove( tid );
}
+/*!
+ Removes toolbar
+ \param tname - toolbar name
+*/
void QtxActionToolMgr::removeToolBar( const QString& tname )
{
removeToolBar( find( tname ) );
}
+/*!
+ Insert action into toolbar
+ \param id - identificator of action
+ \param tId - identificator of toolbar
+ \param idx - position inside toolbar
+*/
int QtxActionToolMgr::insert( const int id, const int tid, const int idx )
{
if ( !contains( id ) || !hasToolBar( tid ) )
return id;
}
+/*!
+ Insert action into toolbar
+ \param act - action
+ \param tId - identificator of toolbar
+ \param pos - position inside toolbar
+*/
int QtxActionToolMgr::insert( QAction* act, const int tid, const int pos )
{
return insert( registerAction( act ), tid, pos );
}
+/*!
+ Insert action into toolbar
+ \param id - identificator of action
+ \param tname - name of toolbar
+ \param pos - position inside toolbar
+*/
int QtxActionToolMgr::insert( const int id, const QString& tname, const int pos )
{
return insert( id, createToolBar( tname ), pos );
}
+/*!
+ Insert action into toolbar
+ \param act - action
+ \param tname - name of toolbar
+ \param pos - position inside toolbar
+*/
int QtxActionToolMgr::insert( QAction* act, const QString& tname, const int pos )
{
return insert( registerAction( act ), createToolBar( tname ), pos );
}
+/*!
+ Append action into toolbar as last toolbutton
+ \param id - identificator of action
+ \param tId - identificator of toolbar
+*/
int QtxActionToolMgr::append( const int id, const int tid )
{
return insert( id, tid );
}
+/*!
+ Append action into toolbar as last toolbutton
+ \param act - action
+ \param tId - identificator of toolbar
+*/
int QtxActionToolMgr::append( QAction* act, const int tid )
{
return insert( act, tid );
}
+/*!
+ Append action into toolbar as last toolbutton
+ \param id - identificator of action
+ \param tname - toolbar name
+*/
int QtxActionToolMgr::append( const int id, const QString& tname )
{
return insert( id, tname );
}
+/*!
+ Append action into toolbar as last toolbutton
+ \param act - action
+ \param tname - toolbar name
+*/
int QtxActionToolMgr::append( QAction* act, const QString& tname )
{
return insert( act, tname );
}
+/*!
+ Append action into toolbar as first toolbutton
+ \param id - identificator of action
+ \param tId - identificator of toolbar
+*/
int QtxActionToolMgr::prepend( const int id, const int tid )
{
return insert( id, tid, 0 );
}
+/*!
+ Append action into toolbar as first toolbutton
+ \param act - action
+ \param tId - identificator of toolbar
+*/
int QtxActionToolMgr::prepend( QAction* act, const int tid )
{
return insert( act, tid, 0 );
}
+/*!
+ Append action into toolbar as first toolbutton
+ \param id - identificator of action
+ \param tname - toolbar name
+*/
int QtxActionToolMgr::prepend( const int id, const QString& tname )
{
return insert( id, tname, 0 );
}
+/*!
+ Append action into toolbar as first toolbutton
+ \param act - action
+ \param tname - toolbar name
+*/
int QtxActionToolMgr::prepend( QAction* act, const QString& tname )
{
return insert( act, tname, 0 );
}
+/*!
+ Remove action from toolbar
+ \param id - identificator of action
+ \param tId - identificator of toolbar
+*/
void QtxActionToolMgr::remove( const int id, const int tid )
{
if ( !myToolBars.contains( tid ) )
updateToolBar( tid );
}
+/*!
+ Remove action from toolbar
+ \param id - identificator of action
+ \param tname - name of toolbar
+*/
void QtxActionToolMgr::remove( const int id, const QString& tname )
{
remove( id, find( tname ) );
}
+/*!
+ \return toolbar by it's id
+ \param tId - identificator of toolbar
+*/
QToolBar* QtxActionToolMgr::toolBar( const int tid ) const
{
QToolBar* tb = 0;
return tb;
}
+/*!
+ \return toolbar by it's name
+ \param tname - name of toolbar
+*/
QToolBar* QtxActionToolMgr::toolBar( const QString& tname ) const
{
return toolBar( find( tname ) );
}
+/*!
+ \return true if manager contains toolbar with such id
+ \param tId - identificator of toolbar
+*/
bool QtxActionToolMgr::hasToolBar( const int tid ) const
{
return myToolBars.contains( tid );
}
+/*!
+ \return true if manager contains toolbar with such name
+ \param tname - name of toolbar
+*/
bool QtxActionToolMgr::hasToolBar( const QString& tname ) const
{
return find( tname ) != -1;
}
+/*!
+ \return true if toolbar contains action
+ \param id - identificator of action
+ \param tId - identificator of toolbar
+*/
bool QtxActionToolMgr::containsAction( const int id, const int tid ) const
{
for ( ToolBarMap::ConstIterator it = myToolBars.begin(); it != myToolBars.end(); ++it )
return false;
}
+/*!
+ SLOT: called when toolbar is destroyed, removes just destroyed toolbar from map
+*/
void QtxActionToolMgr::onToolBarDestroyed()
{
myToolBars.remove( find( (QToolBar*)sender() ) );
}
+/*!
+ \return id of toolbar by it's name
+ \param tname - name of toolbar
+*/
int QtxActionToolMgr::find( const QString& tname ) const
{
int id = -1;
return id;
}
+/*!
+ \return id of toolbar
+ \param t - toolbar
+*/
int QtxActionToolMgr::find( QToolBar* t ) const
{
int id = -1;
return id;
}
+/*!
+ Updates toolbar
+ \param tId - toolbar id
+*/
void QtxActionToolMgr::updateToolBar( const int tId )
{
if ( !isUpdatesEnabled() )
simplifySeparators( tb );
}
+/*!
+ Updates all toolbars
+*/
void QtxActionToolMgr::internalUpdate()
{
for ( ToolBarMap::ConstIterator it1 = myToolBars.begin(); it1 != myToolBars.end(); ++it1 )
updateToolBar( it1.key() );
}
+/*!
+ Removes excess separators from toolbar
+*/
void QtxActionToolMgr::simplifySeparators( QToolBar* t )
{
if ( t )
Qtx::simplifySeparators( t );
}
+/*!
+ Shows action in all toolbars
+ \param actId - action id
+*/
void QtxActionToolMgr::show( const int actId )
{
setShown( actId, true );
}
+/*!
+ Hides action in all toolbars
+ \param actId - action id
+*/
void QtxActionToolMgr::hide( const int actId )
{
setShown( actId, false );
}
+/*!
+ Changes shown status of action in all toolbars
+ \param id - action id
+ \param on - new shown status
+*/
void QtxActionToolMgr::setShown( const int id, const bool on )
{
for ( ToolBarMap::Iterator it = myToolBars.begin(); it != myToolBars.end(); ++it )
setVisible( id, it.key(), on );
}
+/*!
+ \return true if action is shown in all toolbars
+ \param id - action id
+*/
bool QtxActionToolMgr::isShown( const int id ) const
{
QPtrList<ToolNode> nodes;
return vis;
}
+/*!
+ \return shown status of action in toolbar
+ \param id - action id
+ \param tId - toolbar id
+*/
bool QtxActionToolMgr::isVisible( const int id, const int tId ) const
{
if ( !myToolBars.contains( tId ) )
return vis;
}
+/*!
+ Changes action shown status in certain toolbar
+ \param id - action id
+ \param tId - toolbar id
+ \param on - new shown status
+*/
void QtxActionToolMgr::setVisible( const int id, const int tId, const bool on )
{
if ( !myToolBars.contains( tId ) )
updateToolBar( tId );
}
+/*!
+ Loads toolbar content from file
+ \param fname - file name
+ \param r - reader
+*/
bool QtxActionToolMgr::load( const QString& fname, QtxActionMgr::Reader& r )
{
ToolCreator cr( &r, this );
/*!
- Class: QtxActionToolMgr::ToolCreator
- Level: Public
+ Constructor
*/
QtxActionToolMgr::ToolCreator::ToolCreator( QtxActionMgr::Reader* r,
QtxActionToolMgr* mgr )
{
}
+/*!
+ Destructor
+*/
QtxActionToolMgr::ToolCreator::~ToolCreator()
{
}
+/*!
+ Appends new tool buttons
+ \param tag - tag of toolmenu
+ \param subMenu - it has submenu (not used here)
+ \param attr - list of attributes
+ \param pId - id of action corresponding to parent item
+*/
int QtxActionToolMgr::ToolCreator::append( const QString& tag, const bool subMenu,
const ItemAttributes& attr, const int tId )
{
#pragma warning( disable:4251 )
#endif
+/*!
+ \class QtxActionToolMgr
+ Allows to use set of action to automatically build set of toolbars.
+ With help of methods insert/append/remove it is possible to
+ describe toolbars and its internal structure.
+ This manager is able to attune toolbar by removing excess separators
+*/
class QTX_EXPORT QtxActionToolMgr : public QtxActionMgr
{
Q_OBJECT
+ /*!
+ \class ToolNode
+ Represents a toolbutton inside toolbar
+ For internal purposes only
+ */
class ToolNode
{
public:
QMainWindow* myMainWindow;
};
+/*!
+ \class QtxActionToolMgr::ToolCreator
+ Allows to create automatically toolbar by data read from file
+*/
class QtxActionToolMgr::ToolCreator : public QtxActionMgr::Creator
{
public:
#include <math.h>
-/*********************************************************************
-** Class: QtxColorScale
-** Descr: Color Scale widget.
-** Level: Public
-*********************************************************************/
-
+/*!
+ Constructor
+*/
QtxColorScale::QtxColorScale( QWidget* parent, const char* name, WFlags f )
: QFrame( parent, name, f | WResizeNoErase | WRepaintNoErase ),
myDock( 0 ),
setCaption( tr ( "Color scale" ) );
}
+/*!
+ Constructor
+*/
QtxColorScale::QtxColorScale( const int num, QWidget* parent, const char* name, WFlags f )
: QFrame( parent, name, f | WResizeNoErase | WRepaintNoErase ),
myDock( 0 ),
#if QT_VER == 3
+/*!
+ Constructor
+*/
QtxColorScale::QtxColorScale( Dock* dock, const char* name, WFlags f )
: QFrame( dock, name, f | WResizeNoErase | WRepaintNoErase ),
myMin( 0.0 ),
#endif
+/*!
+ Destructor
+*/
QtxColorScale::~QtxColorScale()
{
}
-//================================================================
-// Function : minimum
-// Purpose : Returns minimal limit of scale.
-//================================================================
-
+/*!
+ \returns minimal limit of scale.
+*/
double QtxColorScale::minimum() const
{
return myMin;
}
-//================================================================
-// Function : maximum
-// Purpose : Returns maximal limit of scale.
-//================================================================
-
+/*!
+ \return maximal limit of scale.
+*/
double QtxColorScale::maximum() const
{
return myMax;
}
-//================================================================
-// Function : range
-// Purpose : Returns range (minimal and maximal limits) of scale.
-//================================================================
-
+/*!
+ \return range (minimal and maximal limits) of scale.
+*/
void QtxColorScale::range( double& min, double& max ) const
{
min = myMin;
max = myMax;
}
-//================================================================
-// Function : title
-// Purpose : Returns the current title string.
-//================================================================
-
+/*!
+ \return the current title string.
+*/
QString QtxColorScale::title() const
{
return myTitle;
}
-//================================================================
-// Function : format
-// Purpose : Returns the current format of number presentation in
-// labels for Auto label mode (sprintf specification).
-//================================================================
-
+/*!
+ \returns the current format of number presentation in labels for Auto label mode (sprintf specification).
+*/
QString QtxColorScale::format() const
{
return myFormat;
}
-//================================================================
-// Function : dumpMode
-// Purpose : Returns dump mode.
-//================================================================
-
+/*!
+ \return dump mode.
+*/
int QtxColorScale::dumpMode() const
{
return myDumpMode;
}
-//================================================================
-// Function : labelMode
-// Purpose : Returns label mode.
-//================================================================
-
+/*!
+ \return label mode.
+*/
int QtxColorScale::labelMode() const
{
return myLabelMode;
}
-//================================================================
-// Function : colorMode
-// Purpose : Returns color mode.
-//================================================================
-
+/*!
+ \return color mode.
+*/
int QtxColorScale::colorMode() const
{
return myColorMode;
}
-//================================================================
-// Function : intervalsNumber
-// Purpose : Returns intervals number of color scale.
-//================================================================
-
+/*!
+ \return intervals number of color scale.
+*/
int QtxColorScale::intervalsNumber() const
{
return myInterval;
}
-//================================================================
-// Function : label
-// Purpose : Returns the user label of specified interval.
-//================================================================
-
+/*!
+ \return the user label of specified interval.
+*/
QString QtxColorScale::label( const int idx ) const
{
QString res;
return res;
}
-//================================================================
-// Function : color
-// Purpose : Returns the user color of specified interval.
-//================================================================
-
+/*!
+ \return the user color of specified interval.
+*/
QColor QtxColorScale::color( const int idx ) const
{
QColor res;
return res;
}
-//================================================================
-// Function : labels
-// Purpose : Returns the user labels.
-//================================================================
-
+/*!
+ \return the user labels.
+*/
void QtxColorScale::labels( QStringList& list ) const
{
list = myLabels;
}
-//================================================================
-// Function : colors
-// Purpose : Returns the user color.
-//================================================================
-
+/*!
+ \return the user color.
+*/
void QtxColorScale::colors( QValueList<QColor>& list ) const
{
list = myColors;
}
-//================================================================
-// Function : labelPosition
-// Purpose : Returns the label position.
-//================================================================
-
+/*!
+ \return the label position.
+*/
int QtxColorScale::labelPosition() const
{
return myLabelPos;
}
-//================================================================
-// Function : titlePosition
-// Purpose : Returns the title position.
-//================================================================
-
+/*!
+ \return the title position.
+*/
int QtxColorScale::titlePosition() const
{
return myTitlePos;
}
-//================================================================
-// Function : setMinimum
-// Purpose : Sets the minimum limit.
-//================================================================
-
+/*!
+ Sets the minimum limit.
+*/
void QtxColorScale::setMinimum( const double val )
{
setRange( val, maximum() );
}
-//================================================================
-// Function : setMaximum
-// Purpose : Sets the maximum limit.
-//================================================================
-
+/*!
+ Sets the maximum limit.
+*/
void QtxColorScale::setMaximum( const double val )
{
setRange( minimum(), val );
}
-//================================================================
-// Function : setRange
-// Purpose : Sets the minimum and maximum limits.
-//================================================================
-
+/*!
+ Sets the minimum and maximum limits.
+*/
void QtxColorScale::setRange( const double min, const double max )
{
if ( myMin == min && myMax == max )
updateScale();
}
-//================================================================
-// Function : setTitle
-// Purpose : Sets the title string.
-//================================================================
-
+/*!
+ Sets the title string.
+*/
void QtxColorScale::setTitle( const QString& str )
{
if ( myTitle == str )
updateScale();
}
-//================================================================
-// Function : setFormat
-// Purpose : Sets the format of number presentation in labels for
-// Auto label mode (sprintf specification).
-//================================================================
-
+/*!
+ Sets the format of number presentation in labels for
+ Auto label mode (sprintf specification).
+*/
void QtxColorScale::setFormat( const QString& format )
{
if ( myFormat == format )
updateScale();
}
-//================================================================
-// Function : setIntervalsNumber
-// Purpose : Sets the number of intervals.
-//================================================================
-
+/*!
+ Sets the number of intervals.
+*/
void QtxColorScale::setIntervalsNumber( const int num )
{
if ( myInterval == num || num < 1 )
updateScale();
}
-//================================================================
-// Function : setLabel
-// Purpose : Sets the user label for specified interval. If number
-// of interval is negative then user label will be added
-// as new at the end of list.
-//================================================================
-
+/*!
+ Sets the user label for specified interval. If number
+ of interval is negative then user label will be added
+ as new at the end of list.
+*/
void QtxColorScale::setLabel( const QString& txt, const int idx )
{
bool changed = false;
updateScale();
}
-//================================================================
-// Function : setColor
-// Purpose : Sets the user color for specified interval. If number
-// of interval is negative then user color will be added
-// as new at the end of list.
-//================================================================
-
+/*!
+ Sets the user color for specified interval. If number
+ of interval is negative then user color will be added
+ as new at the end of list.
+*/
void QtxColorScale::setColor( const QColor& clr, const int idx )
{
bool changed = false;
updateScale();
}
-//================================================================
-// Function : setLabels
-// Purpose : Replace the all user label with specified list.
-//================================================================
-
+/*!
+ Replace the all user label with specified list.
+*/
void QtxColorScale::setLabels( const QStringList& list )
{
if ( list.isEmpty() )
updateScale();
}
-//================================================================
-// Function : setColors
-// Purpose : Replace the all user colors with specified list.
-//================================================================
-
+/*!
+ Replace the all user colors with specified list.
+*/
void QtxColorScale::setColors( const QValueList<QColor>& list )
{
if ( list.isEmpty() )
updateScale();
}
-//================================================================
-// Function : setColorMode
-// Purpose : Sets the color mode (Auto or User).
-//================================================================
-
+/*!
+ Sets the color mode (Auto or User).
+*/
void QtxColorScale::setColorMode( const int mode )
{
if ( myColorMode == mode )
updateScale();
}
-//================================================================
-// Function : setDumpMode
-// Purpose : Sets the dump mode.
-//================================================================
-
+/*!
+ Sets the dump mode.
+*/
void QtxColorScale::setDumpMode( const int mode )
{
myDumpMode = mode;
}
-//================================================================
-// Function : setLabelMode
-// Purpose : Sets the label mode (Auto or User).
-//================================================================
-
+/*!
+ Sets the label mode (Auto or User).
+*/
void QtxColorScale::setLabelMode( const int mode )
{
if ( myLabelMode != mode )
}
}
-//================================================================
-// Function : setLabelPosition
-// Purpose : Sets the label position.
-//================================================================
-
+/*!
+ Sets the label position.
+*/
void QtxColorScale::setLabelPosition( const int pos )
{
if ( myLabelPos != pos && pos >= None && pos <= Center )
}
}
-//================================================================
-// Function : setTitlePosition
-// Purpose : Sets the title position.
-//================================================================
-
+/*!
+ Sets the title position.
+*/
void QtxColorScale::setTitlePosition( const int pos )
{
if ( myTitlePos != pos && pos >= None && pos <= Center )
}
}
-//================================================================
-// Function : setFlags
-// Purpose : Set the specified flags.
-//================================================================
-
+/*!
+ Set the specified flags.
+*/
void QtxColorScale::setFlags( const int flags )
{
int prev = myFlags;
updateScale();
}
-//================================================================
-// Function : testFlags
-// Purpose : Returns true if specified flags are setted.
-//================================================================
-
+/*!
+ \return true if specified flags are setted.
+*/
bool QtxColorScale::testFlags( const int flags ) const
{
return ( myFlags & flags ) == flags;
}
-//================================================================
-// Function : clearFlags
-// Purpose : Clear (reset) the specified flags.
-//================================================================
-
+/*!
+ Clear (reset) the specified flags.
+*/
void QtxColorScale::clearFlags( const int flags )
{
int prev = myFlags;
updateScale();
}
-//================================================================
-// Function : minimumSizeHint
-// Purpose :
-//================================================================
-
+/*!
+ \return minimum size hint
+*/
QSize QtxColorScale::minimumSizeHint() const
{
QSize sz = calculateSize( true, myFlags, titlePosition() != None, labelPosition() != None, true );
return sz + QSize( frameWidth(), frameWidth() );
}
-//================================================================
-// Function : sizeHint
-// Purpose :
-//================================================================
-
+/*!
+ \return size hint
+*/
QSize QtxColorScale::sizeHint() const
{
QSize sz = calculateSize( false, myFlags, titlePosition() != None, labelPosition() != None, true );
return sz + QSize( frameWidth(), frameWidth() );
}
-//================================================================
-// Function : calculateSize
-// Purpose : Dump color scale into pixmap with current size.
-//================================================================
-
+/*!
+ Dump color scale into pixmap with current size.
+*/
QSize QtxColorScale::calculateSize( const bool min, const int flags, const bool title,
const bool labels, const bool colors ) const
{
return QSize( W, H );
}
-//================================================================
-// Function : dump
-// Purpose : Dump color scale into pixmap with current size.
-//================================================================
-
+/*!
+ Dump color scale into pixmap with current size.
+*/
QPixmap QtxColorScale::dump() const
{
QPixmap aPix;
return aPix;
}
-//================================================================
-// Function : dump
-// Purpose : Dump color scale into pixmap with specified size.
-//================================================================
-
+/*!
+ Dump color scale into pixmap with specified size.
+*/
QPixmap QtxColorScale::dump( const int w, const int h ) const
{
#if QT_VER < 3
#endif
}
-//================================================================
-// Function : dump
-// Purpose : Dump color scale into pixmap with specified size
-// and background color.
-//================================================================
-
+/*!
+ Dump color scale into pixmap with specified size and background color.
+*/
QPixmap QtxColorScale::dump( const QColor& bg, const int w, const int h ) const
{
QPixmap aPix;
return aPix;
}
-//================================================================
-// Function : show
-// Purpose : Show the color scale. [Reimplemented]
-//================================================================
-
+/*!
+ Show the color scale. [Reimplemented]
+*/
void QtxColorScale::show()
{
#if QT_VER == 3
QFrame::show();
}
-//================================================================
-// Function : hide
-// Purpose : Hides the color scale. [Reimplemented]
-//================================================================
-
+/*!
+ Hides the color scale. [Reimplemented]
+*/
void QtxColorScale::hide()
{
#if QT_VER == 3
QFrame::hide();
}
-//================================================================
-// Function : drawContents
-// Purpose : Draw color scale contents. [Reimplemented]
-//================================================================
-
+/*!
+ Draw color scale contents. [Reimplemented]
+*/
void QtxColorScale::drawContents( QPainter* p )
{
if ( !isUpdatesEnabled() )
titlePosition() != None, labelPosition() != None, true );
}
-//================================================================
-// Function : drawScale
-// Purpose : Draw color scale contents.
-//================================================================
-
+/*!
+ Draw color scale contents.
+*/
void QtxColorScale::drawScale( QPainter* p, const bool transp, const int X, const int Y,
const int W, const int H, const bool title,
const bool label, const bool scale ) const
p->drawPixmap( X, Y, cache );
}
-//================================================================
-// Function : drawScale
-// Purpose : Draw color scale contents.
-//================================================================
-
+/*!
+ Draw color scale contents.
+*/
void QtxColorScale::drawScale( QPainter* p, const QColor& bg, const bool transp,
const int X, const int Y, const int W, const int H,
const bool drawTitle, const bool drawLabel, const bool drawColors ) const
}
}
-//================================================================
-// Function : getFormat
-// Purpose : Returns the format for number labels.
-//================================================================
-
+/*!
+ \return the format for number labels.
+*/
QString QtxColorScale::getFormat() const
{
QString aFormat = format();
return aFormat;
}
-//================================================================
-// Function : getNumber
-// Purpose : Returns the number for specified interval.
-//================================================================
-
+/*!
+ \return the number for specified interval.
+*/
double QtxColorScale::getNumber( const int idx ) const
{
double val = 0;
return val;
}
-//================================================================
-// Function : getLabel
-// Purpose : Returns the label for specified interval according
-// to the current label mode.
-//================================================================
-
+/*!
+ \return the label for specified interval according to the current label mode.
+*/
QString QtxColorScale::getLabel( const int idx ) const
{
QString res;
return res;
}
-//================================================================
-// Function : getColor
-// Purpose : Returns the color for specified interval according
-// to the current color mode.
-//================================================================
-
+/*!
+ \return the color for specified interval according to the current color mode.
+*/
QColor QtxColorScale::getColor( const int idx ) const
{
QColor res;
return res;
}
-//================================================================
-// Function : updateScale
-// Purpose : Update color scale if it required.
-//================================================================
-
+/*!
+ Update color scale if it required.
+*/
void QtxColorScale::updateScale()
{
update();
updateGeometry();
}
-//================================================================
-// Function : simpleRichText
-// Purpose : Return QSimpleRichText object for title. If title
-// not defined (empty string) then return null pointer.
-// Object should be deleted by caller function.
-//================================================================
-
+/*!
+ \return QSimpleRichText object for title. If title
+ not defined (empty string) then return null pointer.
+ Object should be deleted by caller function.
+*/
QSimpleRichText* QtxColorScale::simpleRichText( const int flags ) const
{
QSimpleRichText* srt = 0;
#if QT_VER == 3
-/*********************************************************************
-** Class: QtxColorScale::Dock
-** Descr: Dockable window contains the color scale.
-** Level: Public
-*********************************************************************/
-
-//================================================================
-// Function : Dock
-// Purpose : Constructor.
-//================================================================
+/*!
+ \class QtxColorScale::Dock
+ Dockable window contains the color scale.
+*/
+/*!
+ Constructor
+*/
QtxColorScale::Dock::Dock( Place p, QWidget* parent, const char* name, WFlags f )
: QDockWindow( p, parent, name, f ),
myBlockShow( false ),
setCaption( tr ( "Color scale" ) );
}
-//================================================================
-// Function : ~Dock
-// Purpose : Destructor.
-//================================================================
-
+/*!
+ Destructor.
+*/
QtxColorScale::Dock::~Dock()
{
}
-//================================================================
-// Function : colorScale
-// Purpose : Returns color scale widget.
-//================================================================
-
+/*!
+ \return color scale widget.
+*/
QtxColorScale* QtxColorScale::Dock::colorScale() const
{
return myScale;
}
-//================================================================
-// Function : activate
-// Purpose : Set the dockable window is visible for main window.
-//================================================================
-
+/*!
+ Set the dockable window is visible for main window.
+*/
void QtxColorScale::Dock::activate()
{
if ( myBlockShow )
mw->setAppropriate( this, true );
}
-//================================================================
-// Function : deactivate
-// Purpose : Set the dockable window is hidden for main window.
-//================================================================
-
+/*!
+ Set the dockable window is hidden for main window.
+*/
void QtxColorScale::Dock::deactivate()
{
if ( myBlockShow )
mw->setAppropriate( this, false );
}
-//================================================================
-// Function : isActive
-// Purpose : Returns true if the dockable window is visible.
-//================================================================
-
+/*!
+ \return true if the dockable window is visible.
+*/
bool QtxColorScale::Dock::isActive() const
{
QMainWindow* mw = 0;
return false;
}
-//================================================================
-// Function : show
-// Purpose : Reimplemented for internal reasons.
-//================================================================
-
+/*!
+ Redefined show
+*/
void QtxColorScale::Dock::show()
{
bool f = myBlockShow;
myBlockShow = f;
}
-//================================================================
-// Function : hide
-// Purpose : Reimplemented for internal reasons.
-//================================================================
-
+/*!
+ Redefined hide
+*/
void QtxColorScale::Dock::hide()
{
bool f = myBlockShow;
myBlockShow = f;
}
-//================================================================
-// Function : resize
-// Purpose : Make extent width as maximum value of widget width.
-//================================================================
-
+/*!
+ Make extent width as maximum value of widget width.
+*/
void QtxColorScale::Dock::resize( int w, int h )
{
QDockWindow::resize( w, h );
setFixedExtentHeight( QMAX( fixedExtent().height(), h ) );
}
-//================================================================
-// Function : setOrientation
-// Purpose :
-//================================================================
-
+/*!
+ Set orientation
+ \param o - new orientation
+*/
void QtxColorScale::Dock::setOrientation( Orientation o )
{
bool b = myBlockResize;
#pragma warning( disable:4251 )
#endif
+/*!
+ \class QtxColorScale
+ Color Scale widget.
+*/
class QTX_EXPORT QtxColorScale : public QFrame
{
Q_OBJECT
#include <qlineedit.h>
#include <qvaluelist.h>
+/*!
+ Constructor
+*/
QtxComboBox::QtxComboBox( QWidget* parent, const char* name )
: QComboBox( parent, name ),
myCleared( false )
connect( this, SIGNAL( activated( const QString& ) ), this, SLOT( onActivated( const QString& ) ) );
}
+/*!
+ Constructor
+*/
QtxComboBox::QtxComboBox( bool rw, QWidget* parent, const char* name )
: QComboBox( rw, parent, name ),
myCleared( false )
connect( this, SIGNAL( activated( const QString& ) ), this, SLOT( onActivated( const QString& ) ) );
}
+/*!
+ Destructor
+*/
QtxComboBox::~QtxComboBox()
{
}
+/*!
+ \return true if combobox is cleared
+*/
bool QtxComboBox::isCleared() const
{
return myCleared;
}
+/*!
+ Sets cleared status
+ \param isClear - new status
+*/
void QtxComboBox::setCleared( const bool isClear )
{
if ( myCleared == isClear )
update();
}
+/*!
+ Sets currently selected item
+ \param idx - index of item
+*/
void QtxComboBox::setCurrentItem( int idx )
{
if ( idx < 0 || idx >= count() )
QComboBox::setCurrentItem( idx );
}
+/*!
+ Sets current text
+ \param txt - new current text
+*/
void QtxComboBox::setCurrentText( const QString& txt )
{
myCleared = false;
#endif
}
+/*!
+ \return current selected id
+*/
int QtxComboBox::currentId() const
{
return id( currentItem() );
}
+/*!
+ Sets current selected id
+*/
void QtxComboBox::setCurrentId( int num )
{
setCurrentItem( index( num ) );
}
+/*!
+ Custom paint event handler
+*/
void QtxComboBox::paintEvent( QPaintEvent* e )
{
if ( !count() || !myCleared || editable() )
paintClear( e );
}
+/*!
+ SLOT: called if some item is activated
+ \param idx - index of activated item
+*/
void QtxComboBox::onActivated( int idx )
{
resetClear();
emit activatedId( myIndexId[idx] );
}
-void QtxComboBox::onActivated( const QString& )
+/*!
+ SLOT: called if some item is activated
+*/void QtxComboBox::onActivated( const QString& )
{
resetClear();
}
+/*!
+ Strips "cleared" state and updates
+*/
void QtxComboBox::resetClear()
{
if ( !myCleared )
update();
}
+/*!
+ Draws combobox when it is cleared or isn't editable
+*/
void QtxComboBox::paintClear( QPaintEvent* e )
{
int curIndex = currentItem();
setUpdatesEnabled( upd );
}
+/*!
+ \return id by index
+*/
int QtxComboBox::id( const int idx ) const
{
int id = -1;
return id;
}
+/*!
+ \return index by id
+*/
int QtxComboBox::index( const int id ) const
{
int idx = -1;
#include <float.h>
-/*
- Class: QtxDblSpinBox::Validator [internal]
- Descr: Validator for QtxDblSpinBox (getted from Trolltech Qt - SpinBoxValidator)
+/*!
+ \class QtxDblSpinBox::Validator [internal]
+ Validator for QtxDblSpinBox (getted from Trolltech Qt - SpinBoxValidator)
*/
-
class QtxDblSpinBox::Validator : public QDoubleValidator
{
public:
QtxDblSpinBox* spinBox;
};
+
+/*!
+ Checks string and \return QValidator::State
+*/
QValidator::State QtxDblSpinBox::Validator::validate( QString& str, int& pos ) const
{
QString pref = spinBox->prefix();
return state;
}
-/*
- Class: QtxDblSpinBox
- Descr: Spin box for real numbers.
+/*!
+ Constructor
*/
-
QtxDblSpinBox::QtxDblSpinBox( QWidget* parent, const char* name )
: QSpinBox( parent, name ),
myCleared( false ),
connect( editor(), SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) );
}
+/*!
+ Constructor
+*/
QtxDblSpinBox::QtxDblSpinBox( double min, double max, double step, QWidget* parent, const char* name )
: QSpinBox( parent, name ),
myMin( min ),
connect( editor(), SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) );
}
+/*!
+ Destructor
+*/
QtxDblSpinBox::~QtxDblSpinBox()
{
}
+/*!
+ \return min value of spin box
+*/
double QtxDblSpinBox::minValue() const
{
return myMin;
}
+/*!
+ \return max value of spin box
+*/
double QtxDblSpinBox::maxValue() const
{
return myMax;
}
+/*!
+ Changes min value of spin box
+ \param min - new min value
+*/
void QtxDblSpinBox::setMinValue( int min )
{
setMinValue( (double)min );
}
+/*!
+ Changes min value of spin box
+ \param min - new min value
+*/
void QtxDblSpinBox::setMinValue( double min )
{
if ( myMin != min )
}
}
+/*!
+ Changes max value of spin box
+ \param max - new max value
+*/
void QtxDblSpinBox::setMaxValue( int max )
{
setMaxValue( (double)max );
}
+/*!
+ Changes max value of spin box
+ \param max - new max value
+*/
void QtxDblSpinBox::setMaxValue( double max )
{
if ( myMax != max )
}
}
+/*!
+ Changes min and max value of spin box
+ \param min - new min value
+ \param max - new max value
+*/
void QtxDblSpinBox::setRange( int min, int max )
{
setRange( (double)min, (double)max );
}
+/*!
+ Changes min and max value of spin box
+ \param min - new min value
+ \param max - new max value
+*/
void QtxDblSpinBox::setRange( double min, double max )
{
if ( myMin != min || myMax != max )
}
}
+/*!
+ \return step of spin box
+*/
double QtxDblSpinBox::lineStep() const
{
return myStep;
}
+/*!
+ Changes step of spin box
+ \param step - new step
+*/
void QtxDblSpinBox::setLineStep( int step )
{
setLineStep( (double)step );
}
+/*!
+ Changes step of spin box
+ \param step - new step
+*/
void QtxDblSpinBox::setLineStep( double step )
{
myStep = step;
}
+/*!
+ \return value of spin box
+*/
double QtxDblSpinBox::value() const
{
QSpinBox::value();
return myValue;
}
+/*!
+ Changes value of spin box
+ \param val - new value of spin box
+*/
void QtxDblSpinBox::setValue( int val )
{
setValue( (double)val );
}
+/*!
+ Changes value of spin box
+ \param val - new value of spin box
+*/
void QtxDblSpinBox::setValue( double val )
{
myCleared = false;
valueChange();
}
+/*!
+ Adds step to value
+*/
void QtxDblSpinBox::stepUp()
{
interpretText();
setValue( myValue + myStep );
}
+/*!
+ Subtracks step from value
+*/
void QtxDblSpinBox::stepDown()
{
interpretText();
setValue( myValue - myStep );
}
+/*!
+ \return number of digit after comma
+*/
int QtxDblSpinBox::precision() const
{
return myPrecision;
}
+/*!
+ Changes number of digit after comma
+ \param prec - new digit number
+*/
void QtxDblSpinBox::setPrecision( const int prec )
{
int newPrec = QMAX( prec, 0 );
updateDisplay();
}
+/*!
+ \return true if spin box is cleared
+*/
bool QtxDblSpinBox::isCleared() const
{
return myCleared;
}
+/*!
+ Changes cleared status of spin box
+ \param on - new status
+*/
void QtxDblSpinBox::setCleared( const bool on )
{
if ( myCleared == on )
updateDisplay();
}
+/*!
+ Selects all content of spin box editor
+*/
void QtxDblSpinBox::selectAll()
{
#if QT_VER >= 3
#endif
}
+/*!
+ Custom event filter, updates text of spin box editor
+*/
bool QtxDblSpinBox::eventFilter( QObject* o, QEvent* e )
{
if ( !myCleared || o != editor() || !editor()->text().stripWhiteSpace().isEmpty() )
return QSpinBox::eventFilter( o, e );
}
+/*!
+ Updates text of editor
+*/
void QtxDblSpinBox::updateDisplay()
{
if ( myBlocked )
myBlocked = isBlock;
}
+/*!
+ Sets double value by text in editor
+*/
void QtxDblSpinBox::interpretText()
{
myCleared = false;
updateDisplay();
}
+/*!
+ Emits signal "valueChanged"
+*/
void QtxDblSpinBox::valueChange()
{
updateDisplay();
emit valueChanged( currentValueText() );
}
+/*!
+ Attune parameters on range changing
+*/
void QtxDblSpinBox::rangeChange()
{
double min = QMIN( myMin, myMax );
updateDisplay();
}
+/*!
+ \return text of editor
+*/
QString QtxDblSpinBox::currentValueText()
{
QString s;
return s;
}
+/*!
+ Converts number to string
+ \param v - number to be converted
+*/
QString QtxDblSpinBox::mapValueToText( double v )
{
QString s;
return removeTrailingZeroes( s );
}
+/*!
+ Converts value to string
+*/
QString QtxDblSpinBox::mapValueToText( int )
{
QString s;
return removeTrailingZeroes( s );
}
+/*!
+ Converts current text of editor to double
+*/
double QtxDblSpinBox::mapTextToDoubleValue( bool* ok )
{
QString s = text();
return newVal;
}
+/*!
+ \return value corrected in accordance with borders
+ \param val - value to be corrected
+*/
double QtxDblSpinBox::bound( double val )
{
double newVal = val;
return newVal;
}
+/*!
+ Custom handler for leave event
+*/
void QtxDblSpinBox::leaveEvent( QEvent* e )
{
if ( !myCleared )
QSpinBox::leaveEvent( e );
}
+/*!
+ Custom handler for wheel event
+*/
void QtxDblSpinBox::wheelEvent( QWheelEvent* e )
{
if ( !isEnabled() )
updateDisplay();
}
+/*!
+ SLOT: called if text is changed
+*/
void QtxDblSpinBox::onTextChanged( const QString& str )
{
if ( !myBlocked )
myCleared = false;
}
+/*!
+ \return string without excess zeros in start and in end
+*/
QString QtxDblSpinBox::removeTrailingZeroes( const QString& src ) const
{
QString delim( "." );
#include <qspinbox.h>
+/*!
+ \class QtxDblSpinBox
+ Spin box for real numbers.
+*/
class QTX_EXPORT QtxDblSpinBox : public QSpinBox
{
Q_OBJECT
#include "QtxDblValidator.h"
+/*!
+ Constructor
+ \param bot - minimal possible value
+ \param top - maximal possible value
+ \param dec - number of digits
+ \param o - parent object
+ \param name - name of validator
+*/
QtxDblValidator::QtxDblValidator( const double bot, const double top, const int dec,
QObject* o, const char* name )
: QDoubleValidator( bot, top, dec, o, name )
{
}
+/*!
+ Destructor
+*/
QtxDblValidator::~QtxDblValidator()
{
}
+/*!
+ Corrects string: if it represent double value less then bottom, it becomes equal to bottom,
+ if it is more then top, it becomes equal to top, if it isn't number is becomes '0'
+*/
void QtxDblValidator::fixup( QString& str ) const
{
bool ok = false;
Class: QtxDialog::Area
Level: Internal
*/
-
class QtxDialog::Area : public QFrame
{
public:
Orientation myOrientation;
};
+/*!
+ Contructor
+*/
QtxDialog::Area::Area( Orientation o, QtxDialog* dlg, QWidget* parent )
: QFrame( parent ),
myDlg( dlg ),
hide();
}
+/*!
+ Destructor
+*/
QtxDialog::Area::~Area()
{
}
+/*!
+ Inserts button to area
+ \param b - button
+*/
void QtxDialog::Area::insertButton( QButton* b )
{
if ( !b || myButtons.findRef( b ) != -1 )
updateBorder();
}
+/*!
+ Removes button from area
+ \param b - button
+*/
void QtxDialog::Area::removeButton( QButton* b )
{
if ( !b )
layoutButtons();
}
+/*!
+ \return true if area contains button
+ \param b - button
+*/
bool QtxDialog::Area::contains( QButton* b ) const
{
return myButtons.containsRef( b );
}
+/*!
+ \return policy of button layouting.
+*/
int QtxDialog::Area::policy() const
{
return myPolicy;
}
+/*!
+ Changes policy of button layouting.
+ \param p - new policy
+*/
void QtxDialog::Area::setPolicy( const int p )
{
if ( myPolicy == p )
layoutButtons();
}
+/*!
+ \return true if border enabled
+*/
bool QtxDialog::Area::isBorderEnabled() const
{
return myLine && myBorder;
}
+/*!
+ Enables/disable separator between main frame and button frame
+ \param on - new state
+*/
void QtxDialog::Area::setBorderEnabled( const bool on )
{
if ( !myLine || myBorder == on )
updateBorder();
}
+/*!
+ Sets label as separator between main frame and button frame
+ \param line - new separator
+*/
void QtxDialog::Area::setBorderWidget( QLabel* line )
{
if ( myLine == line )
updateBorder();
}
+/*!
+ \return const reference to list of buttons
+*/
const QPtrList<QButton>& QtxDialog::Area::buttons() const
{
return myButtons;
}
+/*!
+ Updates visibility of border
+*/
void QtxDialog::Area::updateBorder()
{
if ( !myLine )
myLine->setLineWidth( myBorder ? 1 : 0 );
}
+/*!
+ Installs buttons into layout
+*/
void QtxDialog::Area::layoutButtons()
{
int aPolicy = policy();
Qtx::setTabOrder( wids );
}
+
/*!
- Class: QtxDialog::Border
- Level: Internal
-*/
+ \class QtxDialog::Border
+ Special label used as separator between main frame and button frame
+*/
class QtxDialog::Border : public QLabel
{
public:
virtual QSize minimumSizeHint() const;
};
+/*!
+ Constructor
+*/
QtxDialog::Border::Border( QWidget* parent )
: QLabel( parent )
{
setAlignment( Qt::AlignCenter );
}
+/*!
+ Destructor
+*/
QtxDialog::Border::~Border()
{
}
+/*!
+ Set line width of separator
+ \param lw - new line width
+*/
void QtxDialog::Border::setLineWidth( int lw )
{
bool isOn = lineWidth() > 0;
updateGeometry();
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxDialog::Border::sizeHint() const
{
QSize sz( 5, 5 );
return sz;
}
+/*!
+ \return the recommended minimum size for the widget
+*/
QSize QtxDialog::Border::minimumSizeHint() const
{
return sizeHint();
}
/*!
- Class: QtxDialog
- Level: Public
+ Constructor
+ Construct a dialog with specified parent and name.
+ \param modal define modal status of dialog (default non modal dialog created).
+ \param allowResize - if it is true then dialog can be resize by user (default non resizable dialog created).
+ \param Button flags specified control buttons for dialog (default buttons is OK, Cancel and Help).
+ \param Widget flags used as in any widget.
*/
-
-/*!
- Name: QtxDialog [public]
- Desc: Construct a dialog with specified parent and name.
- Parameter 'modal' define modal status of dialog (default non modal
- dialog created). If parameter 'allowResize' is true then dialog
- can be resize by user (default non resizable dialog created).
- Button flags specified control buttons for dialog (default buttons
- is OK, Cancel and Help). Widget flags used as in any widget.
-*/
-
QtxDialog::QtxDialog( QWidget* parent, const char* name,
bool modal, bool allowResize, const int f, WFlags wf )
: QDialog( parent, name, modal,
return QtxAction::removeFrom( wid );
}
+/*!
+ Sets menu text of action
+ \param txt - new menu text
+*/
void QtxDockAction::setMenuText( const QString& txt )
{
if ( menuText() == txt )
delete objs;
}
+/*!
+ \return true if main window is parent of object
+ \param mw - main window
+ \param win - object
+*/
bool QtxDockAction::dockMainWindow( QMainWindow* mw, QObject* win ) const
{
if ( !mw || !win )
}
}
+/*!
+ Updates menu of action
+*/
void QtxDockAction::updateMenus()
{
for ( MenuMap::Iterator it = myMenu.begin(); it != myMenu.end(); ++it )
#include <qapplication.h>
/*!
- Class: QtxDockWindow::Watcher [Internal]
- Descr: Internal object with event filter.
+ \class QtxDockWindow::Watcher [Internal]
+ Internal object with event filter.
*/
-
class QtxDockWindow::Watcher : public QObject
{
public:
bool myVisible;
};
+/*!
+ Constructor
+*/
QtxDockWindow::Watcher::Watcher( QtxDockWindow* cont )
: QObject( cont ), myCont( cont ),
myState( true ),
installFilters();
}
+/*!
+ Custom event filter
+*/
bool QtxDockWindow::Watcher::eventFilter( QObject* o, QEvent* e )
{
if ( o == myCont &&
return false;
}
+/*!
+ Sets internal status to shown
+*/
void QtxDockWindow::Watcher::shown( QtxDockWindow* dw )
{
if ( dw != myCont )
myVisible = true;
}
+/*!
+ Sets internal status to hidden
+*/
void QtxDockWindow::Watcher::hided( QtxDockWindow* dw )
{
if ( dw != myCont )
myVisible = false;
}
+/*!
+ Shows corresponding dock window
+*/
void QtxDockWindow::Watcher::showContainer()
{
if ( !myCont )
myCont = cont;
}
+/*!
+ Hides corresponding dock window
+*/
void QtxDockWindow::Watcher::hideContainer()
{
if ( !myCont )
myCont = cont;
}
+/*!
+ Event filter of custom events
+*/
void QtxDockWindow::Watcher::customEvent( QCustomEvent* e )
{
installFilters();
updateVisibility();
}
+/*!
+ Installs this object as event filter to all widgets inside corresponding main window
+*/
void QtxDockWindow::Watcher::installFilters()
{
if ( !myCont )
}
}
+/*!
+ Updates visibility of all widgets inside corresponding main window
+*/
void QtxDockWindow::Watcher::updateVisibility()
{
if ( !myCont )
vis ? showContainer() : hideContainer();
}
+/*!
+ Updates icon of corresponding main window
+*/
void QtxDockWindow::Watcher::updateIcon()
{
if ( !myCont || !myCont->widget() )
myCont->setIcon( ico ? *ico : QPixmap() );
}
+/*!
+ Updates caption of corresponding main window
+*/
void QtxDockWindow::Watcher::updateCaption()
{
if ( myCont && myCont->widget() && !myCont->widget()->caption().isNull() )
}
/*!
- Class: QtxDockWindow [Public]
- Descr:
+ Constructor
*/
-
QtxDockWindow::QtxDockWindow( Place p, QWidget* parent, const char* name, WFlags f )
: QDockWindow( p, parent, name, f ),
myWatcher( 0 ),
{
}
+/*!
+ Constructor
+*/
QtxDockWindow::QtxDockWindow( const bool watch, QWidget* parent, const char* name, WFlags f )
: QDockWindow( InDock, parent, name, f ),
myWatcher( 0 ),
myWatcher = new Watcher( this );
}
+/*!
+ Constructor
+*/
QtxDockWindow::QtxDockWindow( QWidget* parent, const char* name, WFlags f )
: QDockWindow( InDock, parent, name, f ),
myWatcher( 0 ),
{
}
+/*!
+ Destructor
+*/
QtxDockWindow::~QtxDockWindow()
{
}
+/*!
+ Sets the dock window's main widget
+ \param wid - new main widget
+*/
void QtxDockWindow::setWidget( QWidget* wid )
{
if ( wid )
QDockWindow::setWidget( wid );
}
+/*!
+ \return true if the dock window is stretchable
+*/
bool QtxDockWindow::isStretchable() const
{
return myStretch;
}
+/*!
+ Sets the dock window "stretchable" state
+ \param on - new state
+*/
void QtxDockWindow::setStretchable( const bool on )
{
if ( myStretch == on )
}
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxDockWindow::sizeHint() const
{
QSize sz = QDockWindow::sizeHint();
return sz;
}
+/*!
+ \return the recommended minimum size for the widget
+*/
QSize QtxDockWindow::minimumSizeHint() const
{
QSize sz = QDockWindow::minimumSizeHint();
return sz;
}
+/*!
+ \return corresponding main window
+*/
QMainWindow* QtxDockWindow::mainWindow() const
{
QMainWindow* mw = 0;
return mw;
}
+/*!
+ Shows window
+*/
void QtxDockWindow::show()
{
if ( myWatcher )
QDockWindow::show();
}
+/*!
+ Hides window
+*/
void QtxDockWindow::hide()
{
if ( myWatcher )
#include <qapplication.h>
#include <qobjectlist.h>
+/*!
+ Constructor
+*/
QtxGroupBox::QtxGroupBox( QWidget* parent, const char* name )
: QGroupBox( parent, name ),
myContainer( 0 )
{
}
+/*!
+ Constructor
+*/
QtxGroupBox::QtxGroupBox( const QString& title, QWidget* parent, const char* name )
: QGroupBox( title, parent, name ),
myContainer( 0 )
initialize();
}
+/*!
+ Constructor
+*/
QtxGroupBox::QtxGroupBox( int strips, Orientation o, QWidget* parent, const char* name )
: QGroupBox( strips, o, parent, name ),
myContainer( 0 )
initialize();
}
+/*!
+ Constructor
+*/
QtxGroupBox::QtxGroupBox( int strips, Orientation o, const QString& title,
QWidget* parent, const char* name )
: QGroupBox( strips, o, title, parent, name ),
initialize();
}
+/*!
+ Destructor
+*/
QtxGroupBox::~QtxGroupBox()
{
delete myContainer;
}
+/*!
+ Creates horizontal box as container
+*/
void QtxGroupBox::initialize()
{
myContainer = new QHBox( this, 0, WStyle_Customize | WStyle_NoBorderEx | WStyle_Tool );
#if QT_VER < 3
+/*!
+ \return the width of the empty space between the items in the group and the frame of the group
+*/
int QtxGroupBox::insideMargin() const
{
int m = 0;
return m;
}
+/*!
+ \return the width of the empty space between each of the items in the group
+*/
int QtxGroupBox::insideSpacing() const
{
int s = 0;
return s;
}
+/*!
+ Sets the width of the empty space between the items in the group and the frame of the group
+*/
void QtxGroupBox::setInsideMargin( int m )
{
if ( layout() )
layout()->setMargin( m );
}
+/*!
+ Sets the width of the empty space between each of the items in the group
+*/
void QtxGroupBox::setInsideSpacing( int s )
{
if ( layout() )
#endif
+/*!
+ Inserts title widget
+ \param wid - new title widget
+*/
void QtxGroupBox::insertTitleWidget( QWidget* wid )
{
if ( !myContainer )
updateTitle();
}
+/*!
+ Removes title widget
+ \param wid - title widget
+*/
void QtxGroupBox::removeTitleWidget( QWidget* wid )
{
if ( !myContainer || wid->parentWidget() != myContainer )
updateTitle();
}
+/*!
+ Calculates margin
+*/
void QtxGroupBox::adjustInsideMargin()
{
QApplication::sendPostedEvents( myContainer, QEvent::ChildInserted );
setInsideMargin( myContainer->height() );
}
+/*!
+ Sets the alignment of the group box title
+*/
void QtxGroupBox::setAlignment( int align )
{
QGroupBox::setAlignment( align );
updateTitle();
}
+/*!
+ Sets title of groop box
+*/
void QtxGroupBox::setTitle( const QString& title )
{
QGroupBox::setTitle( title );
updateTitle();
}
+/*!
+ Changes the layout of the group box
+ \param strips - number of column/rows
+ \param o - orientation
+*/
void QtxGroupBox::setColumnLayout( int strips, Orientation o )
{
if ( myContainer )
updateTitle();
}
+/*!
+ Shows group box
+*/
void QtxGroupBox::show()
{
QGroupBox::show();
updateTitle();
}
+/*!
+ Updates group box
+*/
void QtxGroupBox::update()
{
QGroupBox::update();
updateTitle();
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxGroupBox::sizeHint() const
{
QSize sz = QGroupBox::sizeHint();
return QSize( QMAX( sz.width(), sw ), sz.height() );
}
+/*!
+ \return the recommended minimum size for the widget
+*/
QSize QtxGroupBox::minimumSizeHint() const
{
QSize sz = QGroupBox::minimumSizeHint();
return QSize( QMAX( sz.width(), sw ), sz.height() );
}
+/*!
+ Custom event filter
+*/
bool QtxGroupBox::eventFilter( QObject* obj, QEvent* e )
{
QEvent::Type type = e->type();
return QGroupBox::eventFilter( obj, e );
}
+/*!
+ Custom resize event filter
+*/
void QtxGroupBox::resizeEvent( QResizeEvent* e )
{
QGroupBox::resizeEvent( e );
updateTitle();
}
+/*!
+ Custom child event filter
+*/
void QtxGroupBox::childEvent( QChildEvent* e )
{
if ( e->type() == QEvent::ChildInserted && e->child() == myContainer )
QGroupBox::childEvent( e );
}
+/*!
+ Event filter of custom items
+*/
void QtxGroupBox::customEvent( QCustomEvent* )
{
updateTitle();
}
+/*!
+ On frame changed
+*/
void QtxGroupBox::frameChanged()
{
updateTitle();
}
+/*!
+ \return size of title
+*/
QSize QtxGroupBox::titleSize() const
{
QSize sz( 0, 0 );
return QSize( w, h );
}
+/*!
+ Updates title
+*/
void QtxGroupBox::updateTitle()
{
if ( !myContainer )
#include <qlineedit.h>
#include <qapplication.h>
+/*!
+ Constructor
+*/
QtxIntSpinBox::QtxIntSpinBox( QWidget* parent, const char* name )
: QSpinBox( parent, name ),
myCleared( false ),
connect( editor(), SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) );
}
+/*!
+ Constructor
+*/
QtxIntSpinBox::QtxIntSpinBox( int min, int max, int step, QWidget* parent, const char* name )
: QSpinBox( min, max, step, parent, name ),
myCleared( false ),
connect( editor(), SIGNAL( textChanged( const QString& ) ), this, SLOT( onTextChanged( const QString& ) ) );
}
+/*!
+ Destructor
+*/
QtxIntSpinBox::~QtxIntSpinBox()
{
}
+/*!
+ \return true if spin box is cleared
+*/
bool QtxIntSpinBox::isCleared() const
{
return myCleared;
}
+/*!
+ Changes cleared status of spin box
+ \param on - new status
+*/
void QtxIntSpinBox::setCleared( const bool on )
{
if ( myCleared == on )
updateDisplay();
}
+/*!
+ Changes value of spin box
+ \param val - new value of spin box
+*/
void QtxIntSpinBox::setValue( int value )
{
myCleared = false;
QSpinBox::setValue( value );
}
+/*!
+ Custom event filter
+*/
bool QtxIntSpinBox::eventFilter( QObject* o, QEvent* e )
{
if ( !myCleared || o != editor() || !editor()->text().stripWhiteSpace().isEmpty() )
return QSpinBox::eventFilter( o, e );
}
+/*!
+ Sets integer value by text in editor
+*/
void QtxIntSpinBox::interpretText()
{
myCleared = false;
QSpinBox::interpretText();
}
+/*!
+ Updates text of editor
+*/
void QtxIntSpinBox::updateDisplay()
{
if ( myBlocked )
myBlocked = block;
}
+/*!
+ Custom handler for leave event
+*/
void QtxIntSpinBox::leaveEvent( QEvent* e )
{
if ( !myCleared )
QSpinBox::leaveEvent( e );
}
+/*!
+ Custom handler for wheel event
+*/
void QtxIntSpinBox::wheelEvent( QWheelEvent* e )
{
if ( !isEnabled() )
updateDisplay();
}
+/*!
+ SLOT: called if text is changed
+*/
void QtxIntSpinBox::onTextChanged( const QString& )
{
if ( !myBlocked )
};
/*!
- Class: QtxListAction::ToolButton
- Level: Internal
+ \class QtxListAction::ToolButton
+ Custom tool button
*/
-
class QtxListAction::ToolButton : public QToolButton
{
public:
QtxListAction* myAction;
};
+/*!
+ Constructor
+*/
QtxListAction::ToolButton::ToolButton( QtxListAction* a, QWidget* parent, const char* name )
: QToolButton( parent, name ),
myAction( a )
setIconSet( QPixmap( list_arrow_icon ) );
}
+/*!
+ Destructor
+*/
QtxListAction::ToolButton::~ToolButton()
{
if ( myAction )
myAction->controlDeleted( this );
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxListAction::ToolButton::sizeHint() const
{
QSize sz = iconSet().pixmap().size();
}
/*!
- Class: QtxListAction
- Level: Public
+ Constructs an list action with given parent and name. If toggle is true the
+ action will be a toggle action, otherwise it will be a command action.
*/
-
-/*!
- Name: QtxListAction [public]
- Desc: Constructs an list action with given parent and name. If toggle is true the
- action will be a toggle action, otherwise it will be a command action.
-*/
-
QtxListAction::QtxListAction( QObject* parent, const char* name, bool toggle )
: QtxAction( parent, name, toggle ),
myFrame( 0 ),
}
/*!
- Name: QtxListAction [public]
- Desc: This constructor creates an action with the following properties: the
- description text, the icon or iconset icon, the menu text and keyboard
- accelerator. It is a child of given parent and named specified name.
- If toggle is true the action will be a toggle action, otherwise it will
- be a command action.
+ This constructor creates an action with the following properties: the
+ description text, the icon or iconset icon, the menu text and keyboard
+ accelerator. It is a child of given parent and named specified name.
+ If toggle is true the action will be a toggle action, otherwise it will
+ be a command action.
*/
QtxListAction::QtxListAction( const QString& text, const QIconSet& icon,
}
/*!
- Name: QtxListAction [public]
- Desc: This constructor creates an action with the following properties: the
- description text, the menu text and keyboard accelerator. It is a child
- of given parent and named specified name. If toggle is true the action
- will be a toggle action, otherwise it will be a command action.
+ This constructor creates an action with the following properties: the
+ description text, the menu text and keyboard accelerator. It is a child
+ of given parent and named specified name. If toggle is true the action
+ will be a toggle action, otherwise it will be a command action.
*/
QtxListAction::QtxListAction( const QString& text, const QString& menuText,
}
/*!
- Name: ~QtxListAction [virtual public]
- Desc: Destructor.
+ Destructor.
*/
QtxListAction::~QtxListAction()
myMode = mode;
}
+/*!
+ \return list of names
+*/
QStringList QtxListAction::names() const
{
QStringList lst;
myFrame->hide();
}
+/*!
+ SLOT: called when frame is hidden
+*/
void QtxListAction::onHided()
{
for ( ButtonsMap::Iterator bit = myButtons.begin(); bit != myButtons.end(); ++bit )
}
}
-/**********************************************************************
-** Class: QtxListFrame
-** Descr: Frame for the list of actions
-** Level: Internal
-***********************************************************************/
-
+/*!
+ \class QtxListFrame
+ Frame for the list of actions
+*/
class QtxListFrame::ScrollEvent : public QCustomEvent
{
public:
setFrameStyle( Panel | Raised );
}
+/*!
+ Destructor
+*/
QtxListFrame::~QtxListFrame()
{
if ( myAction )
setNames( myNames );
}
+/*!
+ Adds a names to the list. Truncates the name to fit to the frame width.
+ Use QtxListAction::setMaxLineChar( int ) to set the width in characters. [ public ]
+*/
+
void QtxListFrame::addNames( const QStringList& names )
{
for ( QStringList::ConstIterator it = names.begin(); it != names.end(); ++it )
}
}
+/*!
+ \return list of names
+*/
const QStringList QtxListFrame::names() const
{
return myNames;
myComment->setText( com );
}
+/*!
+ Sets owner
+ \param wo - new owner
+*/
void QtxListFrame::setOwner( QWidget* wo )
{
myOwner = wo;
return true;
}
+/*!
+ Custom event filter
+*/
bool QtxListFrame::event( QEvent* e )
{
if ( e->type() != (int)ScrollEvent::Scroll )
updateComment();
}
+/*!
+ return number of selected items
+*/
int QtxListFrame::selected() const
{
uint sel = 0;
friend class QtxListFrame;
};
-/*************************************
-** Class: QtxListFrame
-** Level: Internal
-*************************************/
-
+/*!
+ \class QtxListFrame
+*/
class QtxListFrame : public QFrame
{
Q_OBJECT
#include <qpixmap.h>
#include <qlineedit.h>
+/*!
+ Constructor
+*/
QtxListBox::QtxListBox( QWidget* parent, const char* name, WFlags f )
: QListBox( parent, name, f ),
myEditor( 0 ),
this, SLOT( onContentsMoving( int, int ) ) );
}
+/*!
+ Destructor
+*/
QtxListBox::~QtxListBox()
{
}
+/*!
+ \return true if editing is enabled
+*/
bool QtxListBox::isEditEnabled() const
{
return myEditState;
}
+/*!
+ Enables/disables editing
+ \param on - new state
+*/
void QtxListBox::setEditEnabled( bool on )
{
if ( isEditEnabled() == on )
endEdition( defaultEditAction() );
}
+/*!
+ \return default edit action
+ \sa setDefaultEditAction()
+*/
bool QtxListBox::defaultEditAction() const
{
return myEditDefault;
}
+/*!
+ Changes default edit action.
+ Pressing of ENTER button always accepts new value of edited item.
+ But other ways, such as focus out or edition of other item accepts
+ new value of edited item only if "default edit action" is true
+ \param def - new value
+*/
void QtxListBox::setDefaultEditAction( bool def )
{
myEditDefault = def;
}
+/*!
+ \return modification enabled state
+ \sa setModificationEnabled()
+*/
bool QtxListBox::isModificationEnabled() const
{
return myModifEnabled;
}
+/*!
+ Changes "modification enabled" state
+ If it is true, then pressing of CTRL + { Up, Down, Home, End } allows move items in list
+ \param on - new state
+*/
void QtxListBox::setModificationEnabled( bool on )
{
myModifEnabled = on;
}
+/*!
+ \return current edited item
+*/
QListBoxItem* QtxListBox::editedItem() const
{
return item( editedIndex() );
}
+/*!
+ \return current edited index
+*/
int QtxListBox::editedIndex() const
{
return myEditIndex;
}
+/*!
+ Starts edition of item
+ \param idx - index of item
+*/
void QtxListBox::startEdition( const int idx )
{
if ( idx < 0 || editedIndex() == idx || !isEditEnabled() )
ed->setFocus();
}
+/*!
+ Starts edition of item
+ \param item - item to be edited
+*/
void QtxListBox::startEdition( const QListBoxItem* item )
{
startEdition( index( item ) );
}
+/*!
+ Finishes edition of item
+ \param action - if it is true, then new values must be accepted
+*/
void QtxListBox::endEdition( const bool action )
{
int idx = editedIndex();
}
}
+/*!
+ Ensures that the item is visible.
+ \param idx - index of item
+*/
void QtxListBox::ensureItemVisible( const int idx )
{
if ( idx < 0 )
setTopItem( idx );
}
+/*!
+ Ensures that the item is visible.
+ \param item - item to be made visible
+*/
void QtxListBox::ensureItemVisible( const QListBoxItem* item )
{
ensureItemVisible( index( item ) );
}
+/*!
+ \return validator of item editor
+*/
const QValidator* QtxListBox::validator() const
{
const QValidator* v = 0;
return v;
}
+/*!
+ Removes validator of item editor
+*/
void QtxListBox::clearValidator()
{
if ( editor() )
editor()->clearValidator();
}
+/*!
+ Changes validator of item editor
+ \param v - new validator
+*/
void QtxListBox::setValidator( const QValidator* v )
{
if ( editor() )
editor()->setValidator( v );
}
+/*!
+ Moves item to top
+ \param idx - index of item
+*/
void QtxListBox::moveItemToTop( const int idx )
{
moveItem( idx, -idx );
}
+/*!
+ Moves item to bottom
+ \param idx - index of item
+*/
void QtxListBox::moveItemToBottom( const int idx )
{
moveItem( idx, count() - idx );
}
+/*!
+ Moves item
+ \param idx - index of item
+ \param step - changing of position
+*/
void QtxListBox::moveItem( const int idx, const int step )
{
QListBoxItem* i = item( idx );
emit itemMoved( idx, pos );
}
+/*!
+ Inserts empty item
+ \param i - position of item (if it is less than 0, then current position is used)
+*/
void QtxListBox::createItem( const int i )
{
if ( !isEditEnabled() )
startEdition( idx );
}
+/*!
+ Removes item
+ \param i - position of item (if it is less than 0, then current position is used)
+*/
void QtxListBox::deleteItem( const int i )
{
if ( !isEditEnabled() )
updateEditor();
}
+/*!
+ Scrolls the content so that the point is in the top-left corner.
+ \param x, y - point co-ordinates
+*/
void QtxListBox::setContentsPos( int x, int y )
{
QListBox::setContentsPos( x, y );
updateEditor();
}
+/*!
+ Custom event filter, performs finish of edition on focus out, escape/return/enter pressing
+*/
bool QtxListBox::eventFilter( QObject* o, QEvent* e )
{
if ( editor() == o )
return QListBox::eventFilter( o, e );
}
+/*!
+ Custom key press event handler
+ Allows to move items by CTRL + { Up, Down, Home, End }
+*/
void QtxListBox::keyPressEvent( QKeyEvent* e )
{
if ( e->key() == Key_Up && e->state() & ControlButton && isModificationEnabled() )
QListBox::keyPressEvent( e );
}
+/*!
+ Custom resize event handler
+*/
void QtxListBox::viewportResizeEvent( QResizeEvent* e )
{
QListBox::viewportResizeEvent( e );
updateEditor();
}
+/*!
+ Custom mouse double click event handler
+*/
void QtxListBox::mouseDoubleClickEvent( QMouseEvent* e )
{
if ( isEditEnabled() )
QListBox::mouseDoubleClickEvent( e );
}
+/*!
+ Updates editor on contents moving
+*/
void QtxListBox::onContentsMoving( int, int )
{
updateEditor();
}
+/*!
+ \return item editor
+*/
QLineEdit* QtxListBox::editor() const
{
if ( !myEditor )
return myEditor;
}
+/*!
+ Creates item editor
+*/
void QtxListBox::createEditor()
{
if ( myEditor )
addChild( myEditor );
}
+/*!
+ Updates item editor
+*/
void QtxListBox::updateEditor()
{
if ( !editedItem() || !editor() )
#include "QtxListOfOperations.h"
#include <stdarg.h>
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Constructor
+*/
QtxListOfOperations::QtxListOfOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxListOfOperations::~QtxListOfOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return fills list with brackets symbols
+ \param list - list to be filled
+ \param open - if it is true, it is necessary to fill with open brackets otherwise with close
+*/
void QtxListOfOperations::bracketsList( QStringList& list, bool open ) const
{
OperationSetsIterator anIt = mySets.begin(),
}
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Fills list with operation names
+*/
void QtxListOfOperations::opersList( QStringList& list ) const
{
OperationSetsIterator anIt = mySets.begin(),
}
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Create some value by it's string representation
+*/
bool QtxListOfOperations::createValue( const QString& str, QtxValue& val ) const
{
bool ok;
return ok;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of operation
+*/
int QtxListOfOperations::prior( const QString& op, bool isBin ) const
{
OperationSetsIterator anIt = mySets.begin(),
return prior>0 ? prior : 0;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return whether values with passed types are valid for arguments of operation
+ \param op - name of operation
+ \param t1 - type of first argument
+ \param t2 - type of second argument
+*/
QtxParser::Error QtxListOfOperations::isValid( const QString& op,
const QVariant::Type t1,
const QVariant::Type t2 ) const
return err;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxListOfOperations::calculate( const QString& op,
QtxValue& v1,
QtxValue& v2 ) const
return QtxParser::InvalidOperation;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Clears list of operations
+*/
void QtxListOfOperations::clear()
{
mySets.clear();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true if list contains operations
+ \param name - name of operation
+*/
bool QtxListOfOperations::has( const QString& name ) const
{
OperationSetsIterator anIt = mySets.begin(),
return false;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Appends operations to list
+ \param name - name of operations
+ \param oper - operations
+ \param prior - additional prior
+*/
void QtxListOfOperations::append( const QString& name, QtxOperations* oper,
int prior )
{
insert( name, oper, prior );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Prepends operations to list
+ \param name - name of operations
+ \param oper - operations
+ \param prior - additional prior
+*/
void QtxListOfOperations::prepend( const QString& name, QtxOperations* oper,
int prior )
{
insert( name, oper, prior, 0 );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Inserts operations to list
+ \param name - name of operations
+ \param oper - operations
+ \param prior - additional prior
+ \param pos - insert position
+*/
void QtxListOfOperations::insert( const QString& name, QtxOperations* oper,
int prior, int pos )
{
mySets.insert( mySets.at( pos ), op );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes operations from list
+ \param name - name of operations
+*/
void QtxListOfOperations::remove( const QString& name )
{
OperationSets::iterator anIt = mySets.begin(),
}
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return count of operations in list
+*/
int QtxListOfOperations::count() const
{
return mySets.count();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return operations by name
+ \name - name of operations
+*/
QtxOperations* QtxListOfOperations::operations( const QString& name ) const
{
OperationSetsIterator anIt = mySets.begin(),
#endif
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ Class: QtxListOfOperations
+
+ This class provides special variant of QtxOperations. It contains list of QtxOperations* with
+ fixed order. When it is necessary to calculate operation or get it's priority, this operation is
+ being found starting from first item. It makes possible to create unions of operations. Every QtxOperations*
+ has priority, which is added to priority of operation, so that it makes possible to increase priority of
+ whole group of operations
+*/
class QTX_EXPORT QtxListOfOperations : public QtxOperations
{
public:
#include "QtxComboBox.h"
#include "QtxDirListEditor.h"
-/*
- Class: QtxListResourceEdit
- Descr: GUI implementation of QtxResourceEdit - manager of resources
+/*!
+ Constructor
*/
-
QtxListResourceEdit::QtxListResourceEdit( QtxResourceMgr* mgr, QWidget* parent )
: QFrame( parent ),
QtxResourceEdit( mgr )
updateState();
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::~QtxListResourceEdit()
{
}
+/*!
+ Sets value to widget
+ \param id - id of widget
+ \param prop - name of resource
+ \param val - value of resource
+*/
void QtxListResourceEdit::setItemProperty( const int id, const QString& prop, const QVariant& val )
{
Item* i = item( id );
updateVisible();
}
+/*!
+ SLOT: called if main list selection changed, raises resource group widgets
+*/
void QtxListResourceEdit::onSelectionChanged()
{
QString title = myList->text( myList->index( myList->selectedItem() ) );
myStack->raiseWidget( i->id() );
}
+/*!
+ Custom activity after item addition
+ \param i - added item
+*/
void QtxListResourceEdit::itemAdded( QtxResourceEdit::Item* i )
{
if ( !i )
updateVisible();
}
+/*!
+ Creates and \return category
+ \param title - category title
+*/
QtxResourceEdit::Item* QtxListResourceEdit::createItem( const QString& title, const int )
{
Item* i = item( title, -1 );
return category;
}
+/*!
+ Emits signal about resource changing
+ \param map - map of changed resources
+*/
void QtxListResourceEdit::changedResources( const QMap<Item*, QString>& map )
{
QMap<int, QString> idMap;
emit resourcesChanged( idMap );
}
+/*!
+ Updates widgets with accordance with main list selection
+*/
void QtxListResourceEdit::updateState()
{
if ( myList->selectedItem() && myStack->visibleWidget() )
myList->setShown( myList->count() > 1 );
}
+/*!
+ Updates visibility state
+*/
void QtxListResourceEdit::updateVisible()
{
QPtrList<Item> items;
updateState();
}
-/*
- Class: QtxListResourceEdit::Category
- Descr: GUI implementation of preferences category.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::Category::Category( QtxListResourceEdit* edit, QWidget* parent )
: QFrame( parent ),
Item( edit )
updateState();
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::Category::~Category()
{
}
+/*!
+ \return true if it is empty
+*/
bool QtxListResourceEdit::Category::isEmpty() const
{
return Item::isEmpty() && myInfo->text().isEmpty();
}
+/*!
+ \return category type
+*/
int QtxListResourceEdit::Category::type() const
{
return -1;
}
+/*!
+ Default empty implementation of resources storing
+*/
void QtxListResourceEdit::Category::store()
{
}
+/*!
+ Default empty implementation of resources retrieving
+*/
void QtxListResourceEdit::Category::retrieve()
{
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::Category::property( const QString& prop ) const
{
QVariant var;
return var;
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::Category::setProperty( const QString& name, const QVariant& var )
{
QVariant prop = var;
updateState();
}
+/*!
+ Creates new tab
+ \param title - name of tab
+*/
QtxResourceEdit::Item* QtxListResourceEdit::Category::createItem( const QString& title, const int )
{
Item* i = item( title, id() );
return tab;
}
+/*!
+ Updates category
+*/
void QtxListResourceEdit::Category::updateState()
{
if ( myTabs->count() )
myInfo->hide();
}
-/*
- Class: QtxListResourceEdit::Tab
- Descr: GUI implementation of resources tab.
-*/
+/*!
+ Constructor
+*/
QtxListResourceEdit::Tab::Tab( QtxResourceEdit* edit, Item* pItem, QWidget* parent )
: QFrame( parent ),
Item( edit, pItem )
main->addStretch( 1 );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::Tab::~Tab()
{
}
+/*!
+ \return tab type
+*/
int QtxListResourceEdit::Tab::type() const
{
return -1;
}
+/*!
+ Default empty implementation of resources storing
+*/
void QtxListResourceEdit::Tab::store()
{
}
+/*!
+ Default empty implementation of resources retrieving
+*/
void QtxListResourceEdit::Tab::retrieve()
{
}
+/*!
+ Delayed initialization of a widget
+*/
void QtxListResourceEdit::Tab::polish()
{
QFrame::polish();
adjustLabels();
}
+/*!
+ Creates new group
+ \param title - name of group
+*/
QtxResourceEdit::Item* QtxListResourceEdit::Tab::createItem( const QString& title, const int )
{
Item* i = item( title, id() );
return group;
}
+/*!
+ Adjusts sizes of labels
+*/
void QtxListResourceEdit::Tab::adjustLabels()
{
QObjectList* labels = queryList( "QLabel" );
}
}
-/*
- Class: QtxListResourceEdit::Group
- Descr: GUI implementation of resources group.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::Group::Group( const QString& title, QtxResourceEdit* edit, Item* pItem, QWidget* parent )
: QGroupBox( 2, Qt::Horizontal, title, parent ),
Item( edit, pItem )
{
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::Group::~Group()
{
}
+/*!
+ \return group type
+*/
int QtxListResourceEdit::Group::type() const
{
return -1;
}
+/*!
+ Default empty implementation of resources storing
+*/
void QtxListResourceEdit::Group::store()
{
}
+/*!
+ Default empty implementation of resources retrieving
+*/
void QtxListResourceEdit::Group::retrieve()
{
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::Group::property( const QString& prop ) const
{
QVariant var;
return var;
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::Group::setProperty( const QString& name, const QVariant& var )
{
QVariant prop = var;
}
}
+/*!
+ Sets title of group
+ \param title - new title of group
+*/
void QtxListResourceEdit::Group::setTitle( const QString& title )
{
Item::setTitle( title );
QGroupBox::setTitle( title );
}
+/*!
+ Creates new item
+ \param title - title of new item
+ \type - type of new item
+*/
QtxResourceEdit::Item* QtxListResourceEdit::Group::createItem( const QString& title, const int type )
{
Item* item = 0;
return item;
}
-/*
- Class: QtxListResourceEdit::PrefItem
- Descr: Base class for preferences items.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::PrefItem::PrefItem( const int type, QtxResourceEdit* edit, Item* pi, QWidget* parent )
: QHBox( parent ),
Item( edit, pi ),
setSpacing( 5 );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::PrefItem::~PrefItem()
{
}
+/*!
+ \return preference item type
+*/
int QtxListResourceEdit::PrefItem::type() const
{
return myType;
}
+/*!
+ Doesn't create item, \return 0 by default
+*/
QtxResourceEdit::Item* QtxListResourceEdit::PrefItem::createItem( const QString&, const int )
{
return 0;
}
-/*
- Class: QtxListResourceEdit::Spacer
- Descr: GUI implementation of resources spacer.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::Spacer::Spacer( QtxResourceEdit* edit, Item* pItem, QWidget* parent )
: PrefItem( Space, edit, pItem, parent )
{
setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::Spacer::~Spacer()
{
}
+/*!
+ Default empty implementation of resources storing
+*/
void QtxListResourceEdit::Spacer::store()
{
}
+/*!
+ Default empty implementation of resources retrieving
+*/
void QtxListResourceEdit::Spacer::retrieve()
{
}
-/*
- Class: QtxListResourceEdit::SelectItem
- Descr: GUI implementation of resources list item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::SelectItem::SelectItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
: PrefItem( Selector, edit, pItem, parent )
myList->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::SelectItem::~SelectItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::SelectItem::store()
{
int idx = myList->currentItem();
setInteger( myIndex[idx] );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::SelectItem::retrieve()
{
int id = getInteger( -1 );
myList->setCurrentItem( idx );
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::SelectItem::property( const QString& name ) const
{
QVariant val;
return val;
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::SelectItem::setProperty( const QString& name, const QVariant& val )
{
if ( name == QString( "strings" ) )
setIndexes( val );
}
+/*!
+ Sets property "strings" - items for selection in combo box
+ \param var - must be string list: list of items
+*/
void QtxListResourceEdit::SelectItem::setStrings( const QVariant& var )
{
if ( var.type() != QVariant::StringList )
setStrings( var.toStringList() );
}
+/*!
+ Sets property "indexes" - corresponding indices of items in combo box
+ \param var - must be list of integer variants: list of indices
+*/
void QtxListResourceEdit::SelectItem::setIndexes( const QVariant& var )
{
if ( var.type() != QVariant::List )
setIndexes( lst );
}
+/*!
+ Sets property "strings" - items for selection in combo box
+ \param lst - list of items
+*/
void QtxListResourceEdit::SelectItem::setStrings( const QStringList& lst )
{
myList->clear();
myList->insertStringList( lst );
}
+/*!
+ Sets property "indexes" - corresponding indices of items in combo box
+ \param var - list of indices
+*/
void QtxListResourceEdit::SelectItem::setIndexes( const QValueList<int>& lst )
{
myIndex.clear();
myIndex.insert( idx, *it );
}
-/*
- Class: QtxListResourceEdit::StateItem
- Descr: GUI implementation of resources bool item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::StateItem::StateItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
: PrefItem( Bool, edit, pItem, parent )
myState->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::StateItem::~StateItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::StateItem::store()
{
setBoolean( myState->isChecked() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::StateItem::retrieve()
{
myState->setChecked( getBoolean() );
}
-/*
- Class: QtxListResourceEdit::StringItem
- Descr: GUI implementation of resources string item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::StringItem::StringItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
: PrefItem( String, edit, pItem, parent )
myString->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::StringItem::~StringItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::StringItem::store()
{
setString( myString->text() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::StringItem::retrieve()
{
myString->setText( getString() );
}
-/*
- Class: QtxListResourceEdit::IntegerEditItem
- Descr: GUI implementation of resources integer item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::IntegerEditItem::IntegerEditItem( const QString& title, QtxResourceEdit* edit, Item* pItem, QWidget* parent )
: PrefItem( Integer, edit, pItem, parent )
{
myInteger->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::IntegerEditItem::~IntegerEditItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::IntegerEditItem::store()
{
setString( myInteger->text() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::IntegerEditItem::retrieve()
{
myInteger->setText( getString() );
}
-/*
- Class: QtxListResourceEdit::IntegerSpinItem
- Descr: GUI implementation of resources integer item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::IntegerSpinItem::IntegerSpinItem( const QString& title, QtxResourceEdit* edit, Item* pItem, QWidget* parent )
: PrefItem( IntSpin, edit, pItem, parent )
{
myInteger->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::IntegerSpinItem::~IntegerSpinItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::IntegerSpinItem::store()
{
setInteger( myInteger->value() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::IntegerSpinItem::retrieve()
{
myInteger->setValue( getInteger() );
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::IntegerSpinItem::property( const QString& name ) const
{
QVariant var;
return var;
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::IntegerSpinItem::setProperty( const QString& name, const QVariant& var )
{
QVariant prop = var;
myInteger->setSuffix( prop.toString() );
}
-/*
- Class: QtxListResourceEdit::DoubleEditItem
- Descr: GUI implementation of resources string item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::DoubleEditItem::DoubleEditItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
: PrefItem( Double, edit, pItem, parent )
myDouble->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::DoubleEditItem::~DoubleEditItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::DoubleEditItem::store()
{
setString( myDouble->text() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::DoubleEditItem::retrieve()
{
myDouble->setText( getString() );
}
-/*
- Class: QtxListResourceEdit::DoubleSpinItem
- Descr: GUI implementation of resources double item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::DoubleSpinItem::DoubleSpinItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
: PrefItem( DblSpin, edit, pItem, parent )
myDouble->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::DoubleSpinItem::~DoubleSpinItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::DoubleSpinItem::store()
{
setDouble( myDouble->value() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::DoubleSpinItem::retrieve()
{
myDouble->setValue( getDouble() );
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::DoubleSpinItem::property( const QString& name ) const
{
QVariant var;
return var;
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::DoubleSpinItem::setProperty( const QString& name, const QVariant& var )
{
QVariant prop = var;
myDouble->setSuffix( prop.toString() );
}
-/*
- Class: QtxListResourceEdit::ColorItem
- Descr: GUI implementation of resources color item.
+/*!
+ Constructor
*/
-
QtxListResourceEdit::ColorItem::ColorItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
: PrefItem( Color, edit, pItem, parent )
{
+ /*!
+ \class QtxListResourceEdit::ColorItem::ColorSelector
+ \brief Label, showing color and allowing to pick color with help of standard color dialog
+ */
class ColorSelector : public QLabel
{
public:
myColor->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::ColorItem::~ColorItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::ColorItem::store()
{
setColor( myColor->paletteBackgroundColor() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::ColorItem::retrieve()
{
myColor->setPaletteBackgroundColor( getColor() );
}
-/*
- Class: QtxListResourceEdit::FontItem
- Descr: GUI implementation of resources font item.
+/*!
+ Constructor
*/
QtxListResourceEdit::FontItem::FontItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
setProperty( "widget_flags", ( int )All );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::FontItem::~FontItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::FontItem::store()
{
QFont f( family(), size() );
Item::setFont( f );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::FontItem::retrieve()
{
QFont f = getFont();
setParams( f.bold(), f.italic(), f.underline() );
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::FontItem::property( const QString& name ) const
{
if( name=="system" )
return QVariant();
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::FontItem::setProperty( const QString& name, const QVariant& value )
{
if( name=="system" )
myProperties[ name ] = value;
}
+/*!
+ Sets family of font
+ \param f - new family
+*/
void QtxListResourceEdit::FontItem::setFamily( const QString& f )
{
QString curtext;
onActivateFamily( idx );
}
+/*!
+ \return family of font
+*/
QString QtxListResourceEdit::FontItem::family() const
{
return myFamilies->currentText();
}
+/*!
+ Sets size of font
+ \param s - new size of font
+*/
void QtxListResourceEdit::FontItem::setSize( const int s )
{
int cursize = -1;
mySizes->setCurrentText( cursize>0 ? QString( "%1" ).arg( cursize ) : "" );
}
+/*!
+ \return size of font
+*/
int QtxListResourceEdit::FontItem::size() const
{
QString s = mySizes->currentText();
return ( ok ? pSize : 0 );
}
+/*!
+ Sets font parameters
+ \param bold - is font bold
+ \param italic - is font italic
+ \param underline - is font underlined
+*/
void QtxListResourceEdit::FontItem::setParams( const bool bold, const bool italic, const bool underline )
{
bool curbold = false, curitalic = false, curunderline = false;
myUnderline->setChecked( curunderline );
}
+/*!
+ \return font parameters
+ \param bold - is font bold
+ \param italic - is font italic
+ \param underline - is font underlined
+*/
void QtxListResourceEdit::FontItem::params( bool& bold, bool& italic, bool& underline )
{
bold = myBold->isChecked();
underline = myUnderline->isChecked();
}
+/*!
+ Updates internal selection of font properties
+*/
void QtxListResourceEdit::FontItem::internalUpdate()
{
- //update internal selection of font properties
setFamily( family() );
setSize( size() );
bool b1, b2, b3;
setParams( b1, b2, b3 );
}
+/*!
+ SLOT: called if family is activated, updates list of possible sizes
+*/
void QtxListResourceEdit::FontItem::onActivateFamily( int )
{
QVariant sizes = property( QString( "%1:sizes" ).arg( family() ) );
setSize( s );
}
+/*!
+ SLOT: called if it is necessary to show font preview
+*/
void QtxListResourceEdit::FontItem::onPreview()
{
QFont f( family(), size() );
-
-
-/*
- Class: QtxListResourceEdit::DirListItem
- Descr:
+/*!
+ Constructor
*/
QtxListResourceEdit::DirListItem::DirListItem( const QString& title, QtxResourceEdit* edit, Item* pItem, QWidget* parent )
: PrefItem( Font, edit, pItem, parent )
myDirListEditor = new QtxDirListEditor( this );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::DirListItem::~DirListItem()
{
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::DirListItem::store()
{
QStringList list;
setString( QString(list.join(";")) );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::DirListItem::retrieve()
{
myDirListEditor->setPathList(QStringList::split(";", getString()));
-/*
- Class: QtxListResourceEdit::FileItem
- Descr: GUI implementation of resources file item.
+/*!
+ Constructor
*/
QtxListResourceEdit::FileItem::FileItem( const QString& title, QtxResourceEdit* edit,
Item* pItem, QWidget* parent )
connect( myOpenFile, SIGNAL( clicked() ), this, SLOT( onOpenFile() ) );
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::FileItem::~FileItem()
{
if( myFileDlg )
delete myFileDlg;
}
+/*!
+ Stores value to resource manager
+*/
void QtxListResourceEdit::FileItem::store()
{
setString( myFile->text() );
}
+/*!
+ Retrieve value to resource manager
+*/
void QtxListResourceEdit::FileItem::retrieve()
{
myFile->setText( getString() );
}
+/*!
+ \return value of property
+ \param prop - property name
+*/
QVariant QtxListResourceEdit::FileItem::property( const QString& name ) const
{
if( name=="filter" )
return QVariant();
}
+/*!
+ Sets property value
+ \param name - name of property
+ \param var - value of property
+*/
void QtxListResourceEdit::FileItem::setProperty( const QString& name, const QVariant& value )
{
if( name=="filter" )
}
}
+/*!
+ SLOT: called if user click "Open File" button, shows dialog
+*/
void QtxListResourceEdit::FileItem::onOpenFile()
{
if( !myFileDlg )
}
}
+/*!
+ \return true if file satisfies permissions
+ \param f - file name
+*/
bool QtxListResourceEdit::FileItem::isFileCorrect( const QString& f ) const
{
bool res = false;
return res;
}
+/*!
+ SLOT: called if user has selected file in file dialog, checks file permissions and passes it's name to widget
+ \param f - file name
+*/
void QtxListResourceEdit::FileItem::onFileSelected( const QString& f )
{
if( myFileDlg && !isFileCorrect( f ) )
}
-
+/*!
+ Constructor
+*/
QtxListResourceEdit::FileItem::FileValidator::FileValidator( FileItem* item, QObject* parent )
: QValidator( parent ),
myItem( item )
{
}
+/*!
+ Destructor
+*/
QtxListResourceEdit::FileItem::FileValidator::~FileValidator()
{
}
+/*!
+ Check file permissions
+ \param f - file name
+*/
QValidator::State QtxListResourceEdit::FileItem::FileValidator::validate( QString& f, int& ) const
{
if( myItem && myItem->isFileCorrect( f ) )
class QtxDirListEditor;
-/*
- Class: QtxListResourceEdit
- Descr: GUI implementation of QtxResourceEdit - manager of resources
+/*!
+ \class QtxListResourceEdit
+ GUI implementation of QtxResourceEdit - manager of resources
*/
class QTX_EXPORT QtxListResourceEdit : public QFrame, public QtxResourceEdit
QWidgetStack* myStack;
};
-/*
- Class: QtxListResourceEdit::Category
- Descr: GUI implementation of 'Category' frame
+/*!
+ \class QtxListResourceEdit::Category
+ GUI implementation of 'Category' frame
*/
class QtxListResourceEdit::Category : public QFrame, public Item
QTabWidget* myTabs;
};
-/*
- Class: QtxListResourceEdit::Tab
- Descr: GUI implementation of resources tab.
+/*!
+ \class QtxListResourceEdit::Tab
+ GUI implementation of resources tab.
*/
class QtxListResourceEdit::Tab : public QFrame, public Item
QWidget* myMainFrame;
};
-/*
- Class: QtxListResourceEdit::Group
- Descr: GUI implementation of resources group.
+/*!
+ \class QtxListResourceEdit::Group
+ GUI implementation of resources group.
*/
class QtxListResourceEdit::Group : public QGroupBox, public Item
virtual Item* createItem( const QString&, const int );
};
-/*
- Class: QtxListResourceEdit::PrefItem
- Descr: Base class for preferences items.
+/*!
+ \class QtxListResourceEdit::PrefItem
+ Base class for preferences items.
*/
class QtxListResourceEdit::PrefItem : public QHBox, public Item
int myType;
};
-/*
- Class: QtxListResourceEdit::Spacer
- Descr: GUI implementation of resources spacer.
+/*!
+ \class QtxListResourceEdit::Spacer
+ GUI implementation of resources spacer.
*/
class QtxListResourceEdit::Spacer : public PrefItem
virtual void retrieve();
};
-/*
- Class: QtxListResourceEdit::SelectItem
- Descr: GUI implementation of resources selector item.
+/*!
+ \class QtxListResourceEdit::SelectItem
+ GUI implementation of resources selector item.
*/
class QtxListResourceEdit::SelectItem : public PrefItem
QMap<int, int> myIndex;
};
-/*
- Class: QtxListResourceEdit::StateItem
- Descr: GUI implementation of resources bool item.
+/*!
+ \class QtxListResourceEdit::StateItem
+ GUI implementation of resources bool item.
*/
-
class QtxListResourceEdit::StateItem : public PrefItem
{
public:
QCheckBox* myState;
};
-/*
- Class: QtxListResourceEdit::StringItem
- Descr: GUI implementation of resources string item.
+/*!
+ \class QtxListResourceEdit::StringItem
+ GUI implementation of resources string item.
*/
class QtxListResourceEdit::StringItem : public PrefItem
QLineEdit* myString;
};
-/*
- Class: QtxListResourceEdit::IntegerEditItem
- Descr: GUI implementation of resources integer item.
+/*!
+ \class QtxListResourceEdit::IntegerEditItem
+ GUI implementation of resources integer item.
*/
class QtxListResourceEdit::IntegerEditItem : public PrefItem
QLineEdit* myInteger;
};
-/*
- Class: QtxListResourceEdit::IntegerSpinItem
- Descr: GUI implementation of resources integer item.
+/*!
+ \class QtxListResourceEdit::IntegerSpinItem
+ GUI implementation of resources integer item.
*/
class QtxListResourceEdit::IntegerSpinItem : public PrefItem
QtxIntSpinBox* myInteger;
};
-/*
- Class: QtxListResourceEdit::DoubleEditItem
- Descr: GUI implementation of resources double item.
+/*!
+ \class QtxListResourceEdit::DoubleEditItem
+ GUI implementation of resources double item.
*/
class QtxListResourceEdit::DoubleEditItem : public PrefItem
QLineEdit* myDouble;
};
-/*
- Class: QtxListResourceEdit::DoubleSpinItem
- Descr: GUI implementation of resources double item.
+/*!
+ \class QtxListResourceEdit::DoubleSpinItem
+ GUI implementation of resources double item.
*/
class QtxListResourceEdit::DoubleSpinItem : public PrefItem
QtxDblSpinBox* myDouble;
};
-/*
- Class: QtxListResourceEdit::ColorItem
- Descr: GUI implementation of resources color item.
+/*!
+ \class QtxListResourceEdit::ColorItem
+ GUI implementation of resources color item.
*/
class QtxListResourceEdit::ColorItem : public PrefItem
QWidget* myColor;
};
-/*
- Class: QtxListResourceEdit::FontItem
- Descr: GUI implementation of resources font item.
-*/
-
class QtxComboBox;
class QToolButton;
+/*!
+ \class QtxListResourceEdit::FontItem
+ GUI implementation of resources font item.
+*/
class QtxListResourceEdit::FontItem : public PrefItem
{
Q_OBJECT
/*!
- * \brief GUI implementation of resources directory list item.
- *
- *
- */
+ \class QtxListResourceEdit
+ \brief GUI implementation of resources directory list item.
+*/
class QtxListResourceEdit::DirListItem : public PrefItem
{
Q_OBJECT
QtxDirListEditor* myDirListEditor; //!< The widget wich implements in GUI the list of directories
};
-/*
- Class: QtxListResourceEdit::FontItem
- Descr: GUI implementation of resources font item.
-*/
-
class QtxComboBox;
class QToolButton;
class QFileDialog;
+/*!
+ \class QtxListResourceEdit::FontItem
+ GUI implementation of resources font item.
+*/
+
class QtxListResourceEdit::FileItem : public PrefItem
{
Q_OBJECT
private:
+ /*!
+ \class QtxListResourceEdit::FileItem::FileValidator
+ custom file validator: checks files on some rights
+ */
+
class FileValidator : public QValidator
{
public:
"................",
"................" };
+/*!
+ Constructor
+*/
QtxListView::QtxListView( const int state, QWidget* parent, const char* name, WFlags f )
: QListView( parent, name, f ),
myButton( 0 ),
initialize();
}
+/*!
+ Constructor
+*/
QtxListView::QtxListView( QWidget* parent, const char* name, WFlags f )
: QListView( parent, name, f ),
myButton( 0 ),
initialize();
}
+/*!
+ Initialization
+*/
void QtxListView::initialize()
{
if ( myHeaderState == HeaderButton )
connect( header(), SIGNAL( sizeChange( int, int, int ) ), this, SLOT( onHeaderResized() ) );
}
+/*!
+ Destructor
+*/
QtxListView::~QtxListView()
{
}
+/*!
+ Add new column
+ \param label - column title
+ \param width - column width
+*/
int QtxListView::addColumn( const QString& label, int width )
{
int res = QListView::addColumn( label, width );
return res;
}
+/*!
+ Add new column
+ \param iconset - column icon
+ \param label - column title
+ \param width - column width
+*/
int QtxListView::addColumn( const QIconSet& iconset, const QString& label, int width )
{
int res = QListView::addColumn( iconset, label, width );
return res;
}
+/*!
+ Removes column
+ \param index - column index
+*/
void QtxListView::removeColumn( int index )
{
QListView::removeColumn( index );
onHeaderResized();
}
+/*!
+ \return true if column is situated in popup for show/hide columns
+*/
bool QtxListView::appropriate( const int index ) const
{
return index >= 0 && index < (int)myAppropriate.count() && myAppropriate[index];
}
+/*!
+ Sets appropriate state: whether column is situated in popup for show/hide columns
+ \param index - column index
+ \param on - new state
+*/
void QtxListView::setAppropriate( const int index, const bool on )
{
if ( index < 0 || index >= (int)myAppropriate.count() )
myAppropriate[index] = on ? 1 : 0;
}
+/*!
+ Resizes list view and header
+*/
void QtxListView::resize( int w, int h )
{
QListView::resize( w, h );
onHeaderResized();
}
+/*!
+ Shows list view
+*/
void QtxListView::show()
{
QListView::show();
onHeaderResized();
}
+/*!
+ Update on resize contents
+*/
void QtxListView::resizeContents( int w, int h )
{
/*
onHeaderResized();
}
+/*!
+ Shows column
+ \param ind - column index
+*/
void QtxListView::show( int ind )
{
setShown( ind, true );
}
+/*!
+ Hides column
+ \param ind - column index
+*/
void QtxListView::hide( int ind )
{
setShown( ind, false );
}
+/*!
+ \return true if column is shown
+ \param ind - column index
+*/
bool QtxListView::isShown( int ind ) const
{
if ( ind>=0 && ind<header()->count() )
return false;
}
+/*!
+ Shows/hides column
+ \param ind - column index
+ \param sh - new is shown state
+*/
void QtxListView::setShown( int ind, bool sh )
{
if( ind<0 || ind>=header()->count() || isShown( ind )==sh )
updateContents();
}
+/*!
+ Changes column width
+ \param c - column index
+ \param w - new width
+*/
void QtxListView::setColumnWidth( int c, int w )
{
if ( myColumns.contains( c ) )
QListView::setColumnWidth( c, !myColumns.contains( c ) ? w : 0 );
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxListView::sizeHint() const
{
QSize sz = QListView::sizeHint();
return sz;
}
+/*!
+ \return the recommended minimum size for the widget
+*/
QSize QtxListView::minimumSizeHint() const
{
QSize sz = QListView::minimumSizeHint();
return sz;
}
+/*!
+ SLOT: called if header is resized
+*/
void QtxListView::onHeaderResized()
{
if ( myHeaderState == HeaderAuto )
}
}
+/*!
+ Shows popup filled with column names to show/hide column
+ \param x, y - position of popup
+*/
void QtxListView::showPopup( const int x, const int y )
{
myPopup->clear();
myPopup->exec( mapToGlobal( QPoint( x, y ) ) );
}
+/*!
+ SLOT: shows popup on button ".." click
+*/
void QtxListView::onButtonClicked()
{
if ( myHeaderState != HeaderButton )
showPopup( x, y );
}
+/*!
+ SLOT: called on popup action is activated, toggles shown state of column
+ \param id - column index
+*/
void QtxListView::onShowHide( int id )
{
//if ( myHeaderState != HeaderButton )
setShown( id, !isShown( id ) );
}
+/*!
+ Receives all resize events sent to the viewport
+*/
void QtxListView::viewportResizeEvent( QResizeEvent* e )
{
QListView::viewportResizeEvent( e );
onHeaderResized();
}
+/*!
+ Custom event filter, shows popup on right button click
+*/
bool QtxListView::eventFilter( QObject* o, QEvent* e )
{
if( o==header() && e->type()==QEvent::MouseButtonPress )
#include <qmenubar.h>
#include <qapplication.h>
+/*!
+ Constructor
+*/
QtxLogoMgr::QtxLogoMgr( QMenuBar* mb )
: QObject( mb ),
myMenus( mb ),
{
}
+/*!
+ Destructor
+*/
QtxLogoMgr::~QtxLogoMgr()
{
}
generate();
}
+/*!
+ Inserts logo to menu bar
+*/
void QtxLogoMgr::generate()
{
if ( !menuBar() )
QApplication::postEvent( menuBar()->parentWidget(), new QEvent( QEvent::LayoutHint ) );
}
+/*!
+ \return index of found logo
+ \param id - logo id
+*/
int QtxLogoMgr::find( const QString& id ) const
{
int idx = -1;
QWidget* myWidget;
};
+/*!
+ Constructor
+*/
QtxMainWindow::Filter::Filter( QWidget* wid, QtxMainWindow* mw, QObject* parent )
: QObject( parent ),
myMain( mw ),
myMain->installEventFilter( this );
};
+/*!
+ Destructor
+*/
QtxMainWindow::Filter::~Filter()
{
}
+/*!
+ Custom event filter
+*/
bool QtxMainWindow::Filter::eventFilter( QObject* o, QEvent* e )
{
if ( myMain == o && e->type() == QEvent::ChildRemoved &&
Descr: Main window with support of dockable menubar/status bar
and geometry store/retrieve.
*/
-
QtxMainWindow::QtxMainWindow( QWidget* parent, const char* name, WFlags f )
: QMainWindow( parent, name, f ),
myMode( -1 ),
{
}
+/*!
+ Destructor
+*/
QtxMainWindow::~QtxMainWindow()
{
setDockableMenuBar( false );
setDockableStatusBar( false );
}
+/*!
+ \return true if menu bar exists
+*/
bool QtxMainWindow::isDockableMenuBar() const
{
return myMenuBar;
}
+/*!
+ Creates or deletes menu bar
+ \param on - if it is true, then to create, otherwise - to delete
+*/
void QtxMainWindow::setDockableMenuBar( const bool on )
{
if ( isDockableMenuBar() == on )
setUpLayout();
}
+/*!
+ \return true if status bar exists
+*/
bool QtxMainWindow::isDockableStatusBar() const
{
return myStatusBar;
}
+/*!
+ Creates or deletes status bar
+ \param on - if it is true, then to create, otherwise - to delete
+*/
void QtxMainWindow::setDockableStatusBar( const bool on )
{
if ( isDockableStatusBar() == on )
setUpLayout();
}
+/*!
+ Retrieve the geometry information from the specified resource manager section.
+ \param resMgr - instance of ersource manager
+ \param section - section name
+*/
void QtxMainWindow::loadGeometry( QtxResourceMgr* resMgr, const QString& section )
{
QString sec = section.stripWhiteSpace();
myMode = winState;
}
+/*!
+ Shows main window
+*/
void QtxMainWindow::show()
{
if ( myMode != -1 )
QMainWindow::show();
}
+/*!
+ Handler of custom events
+*/
void QtxMainWindow::customEvent( QCustomEvent* e )
{
QMainWindow::customEvent( e );
}
}
+/*!
+ \return relative co-ordinate by two points
+ \param type - type of result: WP_Center (center), WP_Left (left), WP_Right (right)
+ \param wh - left point
+ \param WH - right point
+*/
int QtxMainWindow::relativeCoordinate( const int type, const int WH, const int wh ) const
{
int res = 0;
return res;
}
+/*!
+ Store the geometry information into the specified resource manager section.
+ \param resMgr - instance of ersource manager
+ \param section - section name
+*/
void QtxMainWindow::saveGeometry( QtxResourceMgr* resMgr, const QString& section ) const
{
QString sec = section.stripWhiteSpace();
resMgr->setValue( sec, "state", winState );
}
+/*!
+ Custom event filter
+*/
bool QtxMainWindow::eventFilter( QObject* o, QEvent* e )
{
return QMainWindow::eventFilter( o, e );
}
+/*!
+ Controls whether or not the dw dock window's caption should appear
+ as a menu item on the dock window menu that lists the dock windows.
+ \param dw - window
+ \param a - if it is true, then it appears in menu
+*/
void QtxMainWindow::setAppropriate( QDockWindow* dw, bool a )
{
QMainWindow::setAppropriate( dw, myStatusBar != dw && myMenuBar != dw && a );
}
+/*!
+ Sets up layout
+*/
void QtxMainWindow::setUpLayout()
{
QMainWindow::setUpLayout();
layout()->setMenuBar( 0 );
}
+/*!
+ SLOT: called on object destroyed, clears internal fields in case of deletion of menu bar or status bar
+*/
void QtxMainWindow::onDestroyed( QObject* obj )
{
QObject* o = 0;
}
}
+/*!
+ \return flag of window state by it's name
+ \param str - name of flag
+*/
int QtxMainWindow::windowState( const QString& str ) const
{
static QMap<QString, int> winStateMap;
return res;
}
+/*!
+ \return flag of position by it's name
+ \param str - name of position
+*/
int QtxMainWindow::windowPosition( const QString& str ) const
{
static QMap<QString, int> winPosMap;
QtxMenuButton* myMenuButton;
};
+/*!
+ Sets the widget's minimum size
+ \param w - width
+ \param h - height
+*/
void QtxMenuButton::PopupMenu::setMinimumSize( int w, int h )
{
if ( myMenuButton->isAlignWidth() &&
}
+/*!
+ Constructor
+ \param pos - position
+ \param parent - parent widget
+ \param name - name
+*/
QtxMenuButton::QtxMenuButton( int pos, QWidget* parent, const char* name )
: QPushButton( parent, name ),
myPos( pos )
initialize();
}
+/*!
+ Constructor
+ \param text - button text
+ \param parent - parent widget
+ \param name - name
+*/
QtxMenuButton::QtxMenuButton( const QString& text, QWidget* parent, const char* name )
: QPushButton( parent, name ),
myPos( Bottom )
initialize();
}
+/*!
+ Constructor
+ \param pos - position
+ \param text - button text
+ \param parent - parent widget
+ \param name - name
+*/
QtxMenuButton::QtxMenuButton( int pos, const QString& text, QWidget* parent, const char* name )
: QPushButton( parent, name ),
myPos( pos )
initialize();
}
+/*!
+ Constructor
+ \param parent - parent widget
+ \param name - name
+*/
QtxMenuButton::QtxMenuButton( QWidget* parent, const char* name )
: QPushButton( parent, name ),
myPos( Bottom )
initialize();
}
+/*!
+ Destructor
+*/
QtxMenuButton::~QtxMenuButton()
{
}
+/*!
+ Initialization
+*/
void QtxMenuButton::initialize()
{
myArrow = true;
connect( this, SIGNAL( clicked() ), this, SLOT( onShowPopup() ) );
}
+/*!
+ \return position
+*/
int QtxMenuButton::position() const
{
return myPos;
}
+/*!
+ \return true if align is enabled
+*/
bool QtxMenuButton::isAlignWidth() const
{
return myAlign;
}
+/*!
+ \return true if arrow is shown
+*/
bool QtxMenuButton::isArrowEnabled() const
{
return myArrow;
}
+/*!
+ Changes position
+ \param pos - new position
+*/
void QtxMenuButton::setPosition( const int pos )
{
if ( myPos == pos )
onShowPopup();
}
+/*!
+ Changes align state
+ \param on - new align state
+*/
void QtxMenuButton::setAlignWidth( const bool on )
{
if ( myAlign == on )
updateGeometry();
}
+/*!
+ Enables/disable arrow
+ \param on - new enabled state
+*/
void QtxMenuButton::setArrowEnabled( const bool on )
{
if ( myArrow == on )
repaint();
}
+/*!
+ Clears popup
+*/
void QtxMenuButton::clear()
{
if ( myPopup )
updateGeometry();
}
+/*!
+ Removes item from popup
+ \param id - item id
+*/
void QtxMenuButton::removeItem( int id )
{
if ( myPopup )
- removeItem( id );
+ myPopup->removeItem( id );
updateGeometry();
}
+/*!
+ Inserts separator into popup
+ \param id - position
+*/
int QtxMenuButton::insertSeparator( int id )
{
int res = -1;
return res;
}
+/*!
+ Inserts item into popup
+ \param t - menu text
+ \param id - item id
+ \param index - position
+*/
int QtxMenuButton::insertItem( const QString& t, int id, int index )
{
int resId = -1;
return resId;
}
+/*!
+ Inserts item into popup
+ \param is - icons
+ \param t - menu text
+ \param id - item id
+ \param index - position
+*/
int QtxMenuButton::insertItem( const QIconSet& is, const QString& t, int id, int index )
{
int resId = -1;
return resId;
}
+/*!
+ SLOT: calls when button is clicked, shows popup
+*/
void QtxMenuButton::onShowPopup()
{
if ( !myPopup || !myPopup->count() )
myPopup->exec( QPoint( x, y ) );
}
+/*!
+ Custom event handler
+*/
bool QtxMenuButton::event( QEvent* e )
{
if ( e->type() == QEvent::MouseButtonPress ||
return QPushButton::event( e );
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxMenuButton::sizeHint() const
{
QSize sz = QPushButton::sizeHint();
return sz;
}
+/*!
+ \return the recommended minimum size for the widget
+*/
QSize QtxMenuButton::minimumSizeHint() const
{
QSize sz = QPushButton::minimumSizeHint();
return sz;
}
+/*!
+ Custom resize event handler
+*/
void QtxMenuButton::resizeEvent( QResizeEvent* re )
{
if ( re )
myPopup->setMinimumWidth( re ? re->size().width() : width() );
}
+/*!
+ \return corresponding popup
+*/
QPopupMenu* QtxMenuButton::popup() const
{
return myPopup;
}
+/*!
+ Draws label
+*/
void QtxMenuButton::drawButtonLabel( QPainter* p )
{
QPushButton::drawButtonLabel( p );
#include "QtxOperations.h"
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxOperations::QtxOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxOperations::~QtxOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates QtxValue by it's string representation
+*/
bool QtxOperations::createValue( const QString& str, QtxValue& v ) const
{
v = str;
#include "Qtx.h"
#include "QtxParser.h"
-//================================================================
-// Class :
-// Purpose :
-//================================================================
class QTX_EXPORT QtxOperations
{
public:
#include "QtxParser.h"
#include "QtxOperations.h"
-//================================================================
-// Function :
-// Purpose :
-//================================================================
-QtxParser::QtxParser( QtxOperations* operations,
- const QString& expr )
+/*!
+ Constructor
+*/
+QtxParser::QtxParser( QtxOperations* operations, const QString& expr )
: myOperations( operations )
{
if( myOperations )
setLastError( OperationsNull );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxParser::~QtxParser()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Search elements of list as substrings starting on 'offset'
+ \returns the least position of substrings inside string
+ \param list - list of substrings
+ \param str - string where search
+ \param offset - starting index for search
+ \param matchLen - the length of appropriate substring
+ \param listind - list index of appropriate substring
+*/
int QtxParser::search( const QStringList& list, const QString& str, int offset,
int& matchLen, int& listind )
{
return min;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return substring
+ \param str - string
+ \param pos - start position of substring
+ \param len - length of substring
+*/
QString QtxParser::note( const QString& str, int pos, int len )
{
return str.mid( pos, len ).stripWhiteSpace();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ First step of parsing: finding tokens, determining its types and creating of unsorted pseudo-postfix (with brackets)
+ \param expr - string expression
+ \param post - postfix to be created
+*/
bool QtxParser::prepare( const QString& expr, Postfix& post )
{
int pos = 0, len = expr.length();
return lastError()==OK;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Second step of parsing: determining types of operations
+ \param post - unsorted postfix
+*/
bool QtxParser::setOperationTypes( Postfix& post )
{
Postfix::iterator aStart = post.begin(),
return lastError()==OK;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return how many global brackets there is (for example '((2+3))' has 2 global brackets)
+ \param post - postfix to be checked
+ \param f - start index to search
+ \param l - last index to search
+*/
int QtxParser::globalBrackets( const QtxParser::Postfix& post, int f, int l )
{
int i,
return br+min_br_num;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Third step of parsing: sorting of postfix in order to convert it to real postfix
+ \param post - source postfix
+ \param res - destination postfix
+ \param anOpen - list of open brackets
+ \param aClose - list of close brackets
+ \param f - start index of postfix to sorting
+ \param l - last index of postfix to sorting
+*/
bool QtxParser::sort( const Postfix& post, Postfix& res,
const QStringList& anOpen,
const QStringList& aClose,
return lastError()==OK;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Build posfix by expression
+ \param expr - string expression
+*/
bool QtxParser::parse( const QString& expr )
{
myPost.clear();
sort( p, myPost, opens, closes );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculate operation
+ \param op - operation name
+ \param v1 - first argument (it is not valid for unary prefix operations and it is used to store result)
+ \param v2 - second argument (it is not valid for unary postfix operations)
+*/
bool QtxParser::calculate( const QString& op, QtxValue& v1, QtxValue& v2 )
{
Error err = myOperations->isValid( op, v1.type(), v2.type() );
return lastError()==OK;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates expression without postfix rebuilding
+ \return QtxValue as result (it is invalid if there were errors during calculation)
+*/
QtxValue QtxParser::calculate()
{
setLastError( OK );
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Change expression, rebuild postfix and calculate it
+ \return QtxValue as result (it is invalid if there were errors during calculation)
+*/
QtxValue QtxParser::calculate( const QString& expr )
{
setExpr( expr );
return calculate();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Change expression and rebuild postfix
+*/
bool QtxParser::setExpr( const QString& expr )
{
return parse( expr );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true, if parser contain parameter
+ \param name - name of parameter
+*/
bool QtxParser::has( const QString& name ) const
{
return myParameters.contains( name.stripWhiteSpace() );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Sets parameter value
+ \param name - name of parameter
+ \param value - value of parameter
+*/
void QtxParser::set( const QString& name, const QtxValue& value )
{
myParameters[ name.stripWhiteSpace() ] = value;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes parameter
+ \param name - name of parameter
+*/
bool QtxParser::remove( const QString& name )
{
QString sname = name.stripWhiteSpace();
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return value of parameter (result is invalid if there is no such parameter)
+ \param name - name of parameter
+*/
QtxValue QtxParser::value( const QString& name ) const
{
QString sname = name.stripWhiteSpace();
return QtxValue();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Searches first parameter with assigned invalid QtxValue
+ \return true if it is found
+ \param name - variable to return name of parameter
+*/
bool QtxParser::firstInvalid( QString& name ) const
{
QMap< QString, QtxValue >::const_iterator anIt = myParameters.begin(),
return false;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes all parameters with assigned invalid QtxValues
+*/
void QtxParser::removeInvalids()
{
QStringList toDelete;
myParameters.remove( *aLIt );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return last error occured during parsing
+*/
QtxParser::Error QtxParser::lastError() const
{
return myLastError;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Sets last error occured during parsing (for internal using only)
+*/
void QtxParser::setLastError( QtxParser::Error err )
{
myLastError = err;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return string dump of internal parser postfix
+*/
QString QtxParser::dump() const
{
return dump( myPost );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return string dump of postfix
+ \param post - postfix to be dumped
+*/
QString QtxParser::dump( const Postfix& post ) const
{
QString res;
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Fills list with names of parameters
+ \param list - list to be filled
+*/
void QtxParser::paramsList( QStringList& list )
{
PostfixIterator anIt = myPost.begin(),
}
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes all parameters
+*/
void QtxParser::clear()
{
myParameters.clear();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return string representation for list of QtxValues
+ \param list - list to be converted
+*/
QString QtxParser::toString( const QValueList< QtxValue >& list )
{
QValueList< QtxValue >::const_iterator anIt = list.begin(),
class QtxOperations;
+/*! \var QtxValue
+ \brief Alias for QVariant
+*/
typedef QVariant QtxValue;
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxParser
+
+ This class allows to calculate values of expressions using different set of operations.
+ It is provided some of standard set of operations (arithmetics, logic, strings, etc - in QtxStdOperations.h).
+ This parser allows to use parameters with help of methods has(), set(), remove(), value(). It uses
+ postfix representation of expressions and uses class QtxOperations in order to make certain operation
+ Every instance of parser contains only one postfix, so that if expression has been changed, then postfix
+ must be rebuilt. In order to increase performance of frequent calculation for many of expressions it is
+ recommended to use different instances of parser for expressions
+
+*/
class QTX_EXPORT QtxParser
{
public:
+ /*!
+ \enum Error
+ \brief Errors during parsing
+ */
typedef enum
{
- OK, OperandsNotMatch, InvalidResult, InvalidOperation,
- OperationsNull, InvalidToken, CloseExpected, ExcessClose,
- BracketsNotMatch, StackUnderflow, ExcessData
+ OK, /*! \var All right */
+ OperandsNotMatch, /*! \var Types of arguments are invalid for this operation */
+ InvalidResult, /*! \var Operation cannot find result (for example, division by zero) */
+ InvalidOperation, /*! \var Name of operation is unknown */
+ OperationsNull, /*! \var Internal operations pointer of parser is null */
+ InvalidToken, /*! \var It isn't operation, parameter of value */
+ CloseExpected, /*! \var Close bracket is expected */
+ ExcessClose, /*! \var The one of close bracket is excess */
+ BracketsNotMatch, /*! \var Last open and this close bracket are different, for example [) */
+ StackUnderflow, /*! \var There is no arguments in stack for operation */
+ ExcessData /*! \var The parsing is finished, but there is more then one value in stack */
} Error;
static QString toString( const QValueList< QtxValue >& );
protected:
- typedef enum { Value, Param, Open, Close, Pre, Post, Binary } PostfixItemType;
+ /*!
+ \enum PostfixItemType
+ \brief Types of postfix representation elements
+ */
+ typedef enum
+ {
+ Value, /*! \var Value (number, string, etc.)*/
+ Param, /*! \var Parameter */
+ Open, /*! \var Open bracket */
+ Close, /*! \var Close bracket */
+ Pre, /*! \var Unary prefix operation */
+ Post, /*! \var Unary postfix operation */
+ Binary /*! \var Binary operation */
+
+ } PostfixItemType;
+ /*! \var postfix representation element */
typedef struct
{
QtxValue myValue;
} PostfixItem;
+ /*! \var postfix representation */
typedef QValueList< PostfixItem > Postfix;
+
+ /*! \var postfix representation iterator */
typedef Postfix::const_iterator PostfixIterator;
protected:
static int globalBrackets( const Postfix&, int, int );
private:
+ /*! \var stack of QtxValues */
typedef QValueStack < QtxValue > QtxValueStack;
private:
" "
};
-//================================================================
-// Function : QtxPathDialog
-// Purpose : Constructor.
-//================================================================
-
+/*!
+ Constructor.
+*/
QtxPathDialog::QtxPathDialog( const bool import, QWidget* parent, const bool modal, const bool resize, const int buttons, WFlags f )
: QtxDialog( parent, 0, modal, resize, buttons, f ),
myDefault( -1 ),
setFocusProxy( le );
}
-//================================================================
-// Function : QtxPathDialog
-// Purpose : Constructor.
-//================================================================
-
+/*!
+ Constructor.
+*/
QtxPathDialog::QtxPathDialog( QWidget* parent, const bool modal, const bool resize, const int buttons, WFlags f )
: QtxDialog( parent, 0, modal, resize, buttons, f ),
myDefault( -1 ),
initialize();
}
-//================================================================
-// Function : ~QtxPathDialog
-// Purpose : Destructor.
-//================================================================
-
+/*!
+ Destructor.
+*/
QtxPathDialog::~QtxPathDialog()
{
}
-//================================================================
-// Function : fileName
-// Purpose :
-//================================================================
-
+/*!
+ \return file name
+*/
QString QtxPathDialog::fileName() const
{
return fileName( defaultEntry() );
}
-//================================================================
-// Function : setFileName
-// Purpose :
-//================================================================
-
+/*!
+ Sets file name
+ \param txt - new file name
+ \param autoExtension - auto extension determination by file
+*/
void QtxPathDialog::setFileName( const QString& txt, const bool autoExtension )
{
setFileName( defaultEntry(), txt, autoExtension );
}
-//================================================================
-// Function : filter
-// Purpose :
-//================================================================
-
+/*!
+ \return filter
+*/
QString QtxPathDialog::filter() const
{
return myFilter;
}
-//================================================================
-// Function : setFilter
-// Purpose :
-//================================================================
-
+/*!
+ Changes filter (filter is a list of masks, separated by ';;')
+ \param fltr - new filter
+*/
void QtxPathDialog::setFilter( const QString& fltr )
{
myFilter = fltr;
}
-//================================================================
-// Function : show
-// Purpose :
-//================================================================
-
+/*!
+ Shows path dialog
+*/
void QtxPathDialog::show()
{
if ( hasVisibleChildren( myEntriesFrame ) )
QtxDialog::show();
}
-//================================================================
-// Function : onBrowse
-// Purpose :
-//================================================================
-
+/*!
+ SLOT: called if user click button to show standard file dialog
+*/
void QtxPathDialog::onBrowse()
{
const QObject* obj = sender();
emit fileNameChanged( fName );
}
-//================================================================
-// Function : onReturnPressed
-// Purpose :
-//================================================================
-
+/*!
+ SLOT: called if user presses RETURN in line edit
+*/
void QtxPathDialog::onReturnPressed()
{
const QObject* obj = sender();
emit fileNameChanged( fileName() );
}
-//================================================================
-// Function : onTextChanged
-// Purpose :
-//================================================================
-
+/*!
+ SLOT: called if text in line edit is changed
+*/
void QtxPathDialog::onTextChanged( const QString& )
{
validate();
}
-//================================================================
-// Function : validate
-// Purpose :
-//================================================================
-
+/*!
+ Checks validity of text and according to it enables/disables OK, Yes buttons
+*/
void QtxPathDialog::validate()
{
setButtonEnabled( isValid(), OK | Yes );
}
-//================================================================
-// Function : isValid
-// Purpose :
-//================================================================
-
+/*!
+ \return true if selected file is valid
+*/
bool QtxPathDialog::isValid()
{
bool ok = true;
return ok;
}
-//================================================================
-// Function : acceptData
-// Purpose :
-//================================================================
-
+/*!
+ \return true entered data is accepted
+*/
bool QtxPathDialog::acceptData() const
{
bool ok = true;
return ok;
}
-//================================================================
-// Function : fileNameChanged
-// Purpose :
-//================================================================
-
+/*!
+ Some custom activity on file name changing (must be redefined, default implementation is empty
+*/
void QtxPathDialog::fileNameChanged( int, QString )
{
}
-//================================================================
-// Function : optionsFrame
-// Purpose :
-//================================================================
-
+/*!
+ \return frame with options
+*/
QFrame* QtxPathDialog::optionsFrame()
{
return myOptionsFrame;
}
-//================================================================
-// Function : getFileName
-// Purpose :
-//================================================================
-
+/*!
+ \return file name
+ \param id - id of file entry
+*/
QString QtxPathDialog::fileName( const int id ) const
{
QString res;
return res;
}
-//================================================================
-// Function : setFileName
-// Purpose :
-//================================================================
-
+/*!
+ Change file name of file entry
+ \param id - id of file entry
+ \param txt - new file name
+ \param autoExt - assign extension automatically
+*/
void QtxPathDialog::setFileName( const int id, const QString& txt, const bool autoExt )
{
int mode;
}
}
-//================================================================
-// Function : fileEntry
-// Purpose :
-//================================================================
-
+/*!
+ \return line edit of file entry
+ \param id - id of file entry
+*/
QLineEdit* QtxPathDialog::fileEntry( const int id ) const
{
QLineEdit* le = 0;
return le;
}
-//================================================================
-// Function : fileEntry
-// Purpose :
-//================================================================
-
+/*!
+ \return line edit and mode of file entry
+ \param id - id of file entry
+ \param theMode - for return mode of file entry
+*/
QLineEdit* QtxPathDialog::fileEntry( const int theId, int& theMode ) const
{
QLineEdit* le = 0;
return le;
}
-//================================================================
-// Function : createFileEntry
-// Purpose :
-//================================================================
-
+/*!
+ Creates file entry
+ \return id of just created file entry
+ \param lab - title of entry
+ \param mode - mode of entry
+ \param id - proposed id (if it is -1, then id will be chosen automatically)
+*/
int QtxPathDialog::createFileEntry( const QString& lab, const int mode, const int id )
{
int num = id;
return num;
}
-//================================================================
-// Function : defaultEntry
-// Purpose :
-//================================================================
-
+/*!
+ \return id of default entry
+*/
int QtxPathDialog::defaultEntry() const
{
return myDefault;
}
-//================================================================
-// Function : setDefaultEntry
-// Purpose :
-//================================================================
-
+/*!
+ Change default entry id
+ \param id - new default entry id
+*/
void QtxPathDialog::setDefaultEntry( const int id )
{
myDefault = id;
}
-//================================================================
-// Function : initialize
-// Purpose :
-//================================================================
-
+/*!
+ Initialize dialog layout
+*/
void QtxPathDialog::initialize()
{
setCaption( tr( "File dialog" ) );
myOptionsFrame = new QFrame( mainGroup );
}
-//================================================================
-// Function : prepareFilters
-// Purpose :
-//================================================================
-
+/*!
+ \return list of filters
+*/
QStringList QtxPathDialog::prepareFilters() const
{
QStringList res;
return res;
}
-//================================================================
-// Function : filterWildCards
-// Purpose :
-//================================================================
-
+/*!
+ \return list of filters with filtered wild cards
+*/
QStringList QtxPathDialog::filterWildCards( const QString& theFilter ) const
{
QStringList res;
return res;
}
-//================================================================
-// Function : autoExtension
-// Purpose :
-//================================================================
-
+/*!
+ \return file name with assigned extension
+ \param theFileName - source file name
+ \param theFilter - list of filters
+*/
QString QtxPathDialog::autoExtension( const QString& theFileName, const QString& theFilter ) const
{
QString fName = theFileName;
return fName;
}
-//================================================================
-// Function : hasVisibleChildren
-// Purpose :
-//================================================================
-
+/*!
+ \return true if widget has visible children
+ \param wid - widget
+*/
bool QtxPathDialog::hasVisibleChildren( QWidget* wid ) const
{
bool res = false;
int myAlign;
};
+/*!
+ Constructor
+*/
QtxPopupMenu::TitleMenuItem::TitleMenuItem( const QString& txt, const QIconSet& ico, const int align )
: QCustomMenuItem(),
myText( txt ),
{
}
+/*!
+ Destructor
+*/
QtxPopupMenu::TitleMenuItem::~TitleMenuItem()
{
}
+/*!
+ \return TRUE if this item wants to span the entire popup menu width
+*/
bool QtxPopupMenu::TitleMenuItem::fullSpan() const
{
return true;
}
+/*!
+ \return TRUE if this item is just a separator
+*/
bool QtxPopupMenu::TitleMenuItem::isSeparator() const
{
return false;
}
+/*!
+ Changes font of item
+ \param font - new font
+*/
void QtxPopupMenu::TitleMenuItem::setFont( const QFont& font )
{
myFont = font;
myFont.setBold( true );
}
+/*!
+ Draws item
+*/
void QtxPopupMenu::TitleMenuItem::paint( QPainter* p, const QColorGroup& cg,
bool act, bool enabled, int x, int y, int w, int h )
{
p->setFont( f );
}
+/*!
+ \return the recommended size for item
+*/
QSize QtxPopupMenu::TitleMenuItem::sizeHint()
{
QFontMetrics fM( myFont );
}
/*!
- Class: QtxPopupMenu [Public]
- Descr: Popup menu item with title.
+ Constructor
*/
-
QtxPopupMenu::QtxPopupMenu( QWidget* parent, const char* name )
: QPopupMenu( parent, name ),
myId( -1 ),
{
}
+/*!
+ Destructor
+*/
QtxPopupMenu::~QtxPopupMenu()
{
}
+/*!
+ \return popup menu title
+*/
QString QtxPopupMenu::titleText() const
{
return myText;
}
+/*!
+ \return popup menu icon
+*/
QIconSet QtxPopupMenu::titleIcon() const
{
return myIcon;
}
+/*!
+ \return popup menu title policy
+*/
int QtxPopupMenu::titlePolicy() const
{
return myPolicy;
}
+/*!
+ \return popup menu title alignment
+*/
int QtxPopupMenu::titleAlignment() const
{
return myAlign;
}
+/*!
+ Changes title text
+ \param txt - new text
+*/
void QtxPopupMenu::setTitleText( const QString& txt )
{
if ( myText == txt )
updateTitle();
}
+/*!
+ Changes title icon
+ \param icon - new icon
+*/
void QtxPopupMenu::setTitleIcon( const QIconSet& ico )
{
myIcon = ico;
updateTitle();
}
+/*!
+ Changes title policy
+ \param p - new policy
+*/
void QtxPopupMenu::setTitlePolicy( const int p )
{
if ( myPolicy == p )
updateTitle();
}
+/*!
+ Changes title alignment
+ \param a - new alignment
+*/
void QtxPopupMenu::setTitleAlignment( const int a )
{
if ( myAlign == a )
updateTitle();
}
+/*!
+ Shows menu
+*/
void QtxPopupMenu::show()
{
insertTitle();
QPopupMenu::show();
}
+/*!
+ Hides menu
+*/
void QtxPopupMenu::hide()
{
QPopupMenu::hide();
removeTitle();
}
+/*!
+ Creates title item
+ \param txt - item text
+ \param icon - item icon
+ \param align - item alignment
+*/
QtxPopupMenu::TitleMenuItem* QtxPopupMenu::createTitleItem( const QString& txt, const QIconSet& ico,
const int align ) const
{
return new TitleMenuItem( txt, ico, align );
}
+/*!
+ Inserts title item to popup menu
+*/
void QtxPopupMenu::insertTitle()
{
if ( myId != -1 || titlePolicy() == TitleOff ||
setItemEnabled( myId, false );
}
+/*!
+ Removes title item from popup menu
+*/
void QtxPopupMenu::removeTitle()
{
if ( myId == -1 )
myId = -1;
}
+/*!
+ Updates title item
+*/
void QtxPopupMenu::updateTitle()
{
if ( myId != -1 )
#include <qpopupmenu.h>
#include <qdatetime.h>
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+
+/*!
+ \return value of global parameter (depending on whole selection, but not dependending on one object of selection)
+ \param str - name of parameter
+
+ By default, it returns count of selected objects ("selcount") and list of parameters ("$<name>")
+*/
QtxValue QtxPopupMgr::Selection::globalParam( const QString& str ) const
{
if( str==selCountParam() )
return QtxValue();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return symbole to detect name of parameter list
+*/
QChar QtxPopupMgr::Selection::equality() const
{
return defEquality();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return name of parameter for count of selected objects
+*/
QString QtxPopupMgr::Selection::selCountParam() const
{
return defSelCountParam();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return default symbole to detect name of parameter list
+*/
QChar QtxPopupMgr::Selection::defEquality()
{
return '$';
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return default name of parameter for count of selected objects
+*/
QString QtxPopupMgr::Selection::defSelCountParam()
{
return "selcount";
+/*!
+ \class QtxCacheSelection
+ Special selection class, that caches parameter values.
+ Every parameter during popup building is calculated only one time,
+ although it may be included to many rules. After calculation
+ it is stored in internal map
+*/
-//================================================================
-// Class :
-// Purpose :
-//================================================================
class QtxCacheSelection : public QtxPopupMgr::Selection
{
public:
CacheMap myParamCache;
};
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Constructor
+ \param sel - base selection used for parameter calculation
+*/
QtxCacheSelection::QtxCacheSelection( QtxPopupMgr::Selection* sel )
: mySel( sel )
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxCacheSelection::~QtxCacheSelection()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return count of selected objects
+*/
int QtxCacheSelection::count() const
{
return mySel ? mySel->count() : 0;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates and caches parameters.
+ Already calculated parameters are returned without calculation
+ \return parameter value
+ \param i - index of selected object
+ \param name - name of parameter
+*/
QtxValue QtxCacheSelection::param( const int i, const QString& name ) const
{
QString param_name = name + "#####" + QString::number( i );
}
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates and caches global parameters.
+ Already calculated parameters are returned without calculation
+ \return parameter value
+ \param name - name of parameter
+*/
QtxValue QtxCacheSelection::globalParam( const QString& name ) const
{
if( myParamCache.contains( name ) )
-
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Constructor
+ \param mgr - popup manager
+*/
QtxPopupMgr::Operations::Operations( QtxPopupMgr* mgr )
: QtxStrings(),
myPopupMgr( mgr )
myParser = new QtxParser( mgr->myOperations );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+ Deletes internal parser
+*/
QtxPopupMgr::Operations::~Operations()
{
delete myParser;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of popup operation 'op'.
+ \param isBin indicate whether the operation is binary
+*/
int QtxPopupMgr::Operations::prior( const QString& op, bool isBin ) const
{
if( !isBin && ( op=="every" || op=="any" || op=="onlyone" ) )
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxPopupMgr::Operations::calculate
( const QString& op, QtxValue& v1, QtxValue& v2 ) const
{
return QtxStrings::calculate( op, v1, v2 );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Clears internal map of values
+*/
void QtxPopupMgr::Operations::clear()
{
myValues.clear();
-
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Constructor
+*/
QtxPopupMgr::QtxPopupMgr( QPopupMenu* popup, QObject* parent )
: QtxActionMenuMgr( popup, parent ),
myCurrentSelection( 0 )
createOperations();
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxPopupMgr::~QtxPopupMgr()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates popup operations instance
+*/
void QtxPopupMgr::createOperations()
{
myOperations = new QtxListOfOperations;
myOperations->append( "custom", new Operations( this ), 200 );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Additional version of registerAction
+ \param act - action to be registered
+ \param visible - rule for visibility state
+ \param toggle - rule for toggle on state
+ \param id - proposed id (if it is less than 0, then id will be generated automatically)
+*/
int QtxPopupMgr::registerAction( QAction* act,
const QString& visible,
const QString& toggle,
return _id;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes action from internal map
+ \param id - action id
+*/
void QtxPopupMgr::unRegisterAction( const int id )
{
QAction* act = action( id );
//QtxActionMenuMgr::unRegisterAction( id );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true if manager has rule for action
+ \param act - action
+ \param visibility - if it is true, then rule for "visibility" is checked, otherwise - for "toggle"
+*/
bool QtxPopupMgr::hasRule( QAction* act, bool visibility ) const
{
return map( visibility ).contains( act );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true if manager has rule for action
+ \param id - action id
+ \param visibility - if it is true, then rule for "visibility" is checked, otherwise - for "toggle"
+*/
bool QtxPopupMgr::hasRule( const int id, bool visibility ) const
{
return hasRule( action( id ), visibility );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Sets new rule for action
+ \param act - action
+ \param rule - string expression of rule
+ \param visibility - if it is true, then rule for "visibility" will be set, otherwise - for "toggle"
+*/
void QtxPopupMgr::setRule( QAction* act, const QString& rule, bool visibility )
{
if( !act || rule.isEmpty() )
}
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Sets new rule for action
+ \param id - action id
+ \param rule - string expression of rule
+ \param visibility - if it is true, then rule for "visibility" will be set, otherwise - for "toggle"
+*/
void QtxPopupMgr::setRule( const int id, const QString& rule, bool visibility )
{
setRule( action( id ), rule, visibility );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true if parser has finished work without errors
+ \param p - parser
+*/
bool result( QtxParser* p )
{
bool res = false;
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Fills parser parameters with help of Selection::globalParam() method
+ \param p - parser
+ \param specific - list will be filled with names of parameters depending on selection objects (not global)
+*/
void QtxPopupMgr::setParams( QtxParser* p, QStringList& specific ) const
{
if( !p || !myCurrentSelection )
}
}
+/*!
+ \return true if 'v1'<'v2'
+ This function can work with many types of values
+*/
bool operator<( const QtxValue& v1, const QtxValue& v2 )
{
QVariant::Type t1 = v1.type(), t2 = v2.type();
return t1<t2;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true if rule of action is satisfied on current selection
+ \param act - action
+ \param visibility - what rule is checked: for visibility(true) or for toggle(false)
+*/
bool QtxPopupMgr::isSatisfied( QAction* act, bool visibility ) const
{
QString menu = act->menuText();
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return true if item corresponding to action is visible
+ \param actId - action id
+ \param place - index of place
+*/
bool QtxPopupMgr::isVisible( const int actId, const int place ) const
{
bool res = QtxActionMenuMgr::isVisible( actId, place );
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Updates popup according to selection
+ \param p - popup menu
+ \param sel - selection
+*/
void QtxPopupMgr::updatePopup( QPopupMenu* p, Selection* sel )
{
QTime t1 = QTime::currentTime();
delete myCurrentSelection;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return reference to map of rules
+ \param visibility - type of map: visibility of toggle
+*/
QtxPopupMgr::RulesMap& QtxPopupMgr::map( bool visibility ) const
{
return ( RulesMap& )( visibility ? myVisibility : myToggle );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Loads actions description from file
+ \param fname - name of file
+ \param r - reader of file
+ \return true on success
+*/
bool QtxPopupMgr::load( const QString& fname, QtxActionMgr::Reader& r )
{
PopupCreator cr( &r, this );
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Constructor
+ \param r - menu reader
+ \param mgr - menu manager
+*/
QtxPopupMgr::PopupCreator::PopupCreator( QtxActionMgr::Reader* r,
QtxPopupMgr* mgr )
: QtxActionMgr::Creator( r ),
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
-QtxPopupMgr::PopupCreator::~PopupCreator()
+/*!
+ Destructor
+*/QtxPopupMgr::PopupCreator::~PopupCreator()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+
+/*!
+ Appends new menu items
+ \param tag - tag of item
+ \param subMenu - it has submenu
+ \param attr - list of attributes
+ \param pId - id of action corresponding to parent item
+*/
int QtxPopupMgr::PopupCreator::append( const QString& tag, const bool subMenu,
const ItemAttributes& attr, const int pId )
{
return res;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return visibility rule by attributes
+ Default implementation is empty
+*/
QString QtxPopupMgr::PopupCreator::visibleRule( const ItemAttributes& ) const
{
return QString::null;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return toggle rule by attributes
+ Default implementation is empty
+*/
QString QtxPopupMgr::PopupCreator::toggleRule( const ItemAttributes& ) const
{
return QString::null;
class QtxListOfOperations;
-//================================================================
-// Class :
-// Purpose :
-//================================================================
class QTX_EXPORT QtxPopupMgr : public QtxActionMenuMgr
{
Q_OBJECT
#include "QtxResourceMgr.h"
-/*
- Class: QtxResourceEdit
- Descr: Class for managing preferences items
-*/
+/*!
+ Constructor
+*/
QtxResourceEdit::QtxResourceEdit( QtxResourceMgr* mgr )
: myResMgr( mgr )
{
}
+/*!
+ Destructor
+*/
QtxResourceEdit::~QtxResourceEdit()
{
ItemMap items;
delete itr.data();
}
+/*!
+ \return assigned resource manager
+*/
QtxResourceMgr* QtxResourceEdit::resourceMgr() const
{
return myResMgr;
}
+/*!
+ Adds new item
+ \param label - label of widget to edit preference
+ \param pId - parent item id
+ \param type - type of item
+ \param section - section of resource assigned with item
+ \param param - name of resource assigned with item
+*/
int QtxResourceEdit::addItem( const QString& label, const int pId, const int type,
const QString& section, const QString& param )
{
return i->id();
}
+/*!
+ \return value of item property
+ \param id - item id
+ \propName - propertyName
+*/
QVariant QtxResourceEdit::itemProperty( const int id, const QString& propName ) const
{
QVariant propValue;
return propValue;
}
+/*!
+ Sets value of item property
+ \param id - item id
+ \propName - propertyName
+ \propValue - new value of property
+*/
void QtxResourceEdit::setItemProperty( const int id, const QString& propName, const QVariant& propValue )
{
Item* i = item( id );
i->setProperty( propName, propValue );
}
+/*!
+ \return resource assigned with item
+ \param id - item id
+ \param section - to return section of resource
+ \param param - to return name of resource
+*/
void QtxResourceEdit::resource( const int id, QString& sec, QString& param ) const
{
Item* i = item( id );
i->resource( sec, param );
}
+/*!
+ Stores all values to resource manager
+*/
void QtxResourceEdit::store()
{
QMap<Item*, QString> before;
changedResources( changed );
}
+/*!
+ Retrieve all values from resource manager
+*/
void QtxResourceEdit::retrieve()
{
for ( ItemMap::ConstIterator it = myItems.begin(); it != myItems.end(); ++it )
it.data()->retrieve();
}
+/*!
+ Stores all values to backup container
+*/
void QtxResourceEdit::toBackup()
{
myBackup.clear();
resourceValues( myBackup );
}
+/*!
+ Retrieve all values from backup container
+*/
void QtxResourceEdit::fromBackup()
{
QMap<Item*, QString> before;
changedResources( changed );
}
+/*!
+ Updates resource edit (default implementation is empty)
+*/
void QtxResourceEdit::update()
{
}
+/*!
+ \return item by it's id
+ \param id - item id
+*/
QtxResourceEdit::Item* QtxResourceEdit::item( const int id ) const
{
Item* i = 0;
return i;
}
+/*!
+ \return item by it's title (finds first item)
+ \param title - item title
+*/
QtxResourceEdit::Item* QtxResourceEdit::item( const QString& title ) const
{
Item* i = 0;
return i;
}
+/*!
+ \return item by it's title and parent id
+ \param title - item title
+ \param pId - parent id
+*/
QtxResourceEdit::Item* QtxResourceEdit::item( const QString& title, const int pId ) const
{
Item* i = 0;
return i;
}
+/*!
+ Creates item
+ \return new item
+ \param label - text of label for new item
+ \param type - type of new item
+ \param pId - parent id
+*/
QtxResourceEdit::Item* QtxResourceEdit::createItem( const QString& label, const int type, const int pId )
{
Item* i = 0;
return i;
}
+/*!
+ Removes item
+ \param item - item to be removed
+*/
void QtxResourceEdit::removeItem( Item* item )
{
if ( !item )
itemRemoved( item );
}
+/*!
+ \return children items of resource edit
+ \param lst - list of items to be filled with children
+*/
void QtxResourceEdit::childItems( QPtrList<Item>& lst ) const
{
lst.clear();
lst.append( it.current() );
}
+/*!
+ \return all resources values from widgets
+ \param map - map to be filled by resources values
+*/
void QtxResourceEdit::resourceValues( QMap<int, QString>& map ) const
{
QString sect, name;
}
}
+/*!
+ \return all resources values from widgets
+ \param map - map to be filled by resources values
+*/
void QtxResourceEdit::resourceValues( QMap<Item*, QString>& map ) const
{
QString sect, name;
}
}
+/*!
+ Sets to widgets all resources values from map
+ \param map - map with resources values
+*/
void QtxResourceEdit::setResourceValues( QMap<int, QString>& map ) const
{
for ( QMap<int, QString>::ConstIterator it = map.begin(); it != map.end(); ++it )
}
}
+/*!
+ Sets to widgets all resources values from map
+ \param map - map with resources values
+*/
void QtxResourceEdit::setResourceValues( QMap<Item*, QString>& map ) const
{
for ( QMap<Item*, QString>::ConstIterator it = map.begin(); it != map.end(); ++it )
it.key()->setResourceValue( it.data() );
}
-
+/*!
+ Compares two map of resources values and finds different ones
+ \param map1 - first map
+ \param map2 - second map
+ \param resMap - map to be filled with different values
+ \param fromFirst - if it is true, then resMap will be filled with values from first map, otherwise - from second
+*/
void QtxResourceEdit::differentValues( const QMap<int, QString>& map1, const QMap<int, QString>& map2,
QMap<int, QString>& resMap, const bool fromFirst ) const
{
}
}
+/*!
+ Compares two map of resources values and finds different ones
+ \param map1 - first map
+ \param map2 - second map
+ \param resMap - map to be filled with different values
+ \param fromFirst - if it is true, then resMap will be filled with values from first map, otherwise - from second
+*/
void QtxResourceEdit::differentValues( const QMap<Item*, QString>& map1, const QMap<Item*, QString>& map2,
QMap<Item*, QString>& resMap, const bool fromFirst ) const
{
}
}
+/*!
+ Makes some activity on resource changing (called from store() method)
+ \sa store()
+*/
void QtxResourceEdit::changedResources( const QMap<Item*, QString>& )
{
}
+/*!
+ Some activity on item addition (default implementation is empty)
+*/
void QtxResourceEdit::itemAdded( Item* )
{
}
+/*!
+ Some activity on item removing (default implementation is empty)
+*/
void QtxResourceEdit::itemRemoved( Item* )
{
}
-/*
- Class: QtxResourceEdit::Item
- Descr: Class for incapsulation of one preference item
+/*!
+ Constructor
*/
-
QtxResourceEdit::Item::Item( QtxResourceEdit* edit, Item* parent )
: myEdit( edit ),
myParent( 0 )
parent->insertChild( this );
}
+/*!
+ Destructor
+*/
QtxResourceEdit::Item::~Item()
{
if ( resourceEdit() )
resourceEdit()->removeItem( this );
}
+/*!
+ \return id of item
+*/
int QtxResourceEdit::Item::id() const
{
return myId;
}
+/*!
+ \return parent item
+*/
QtxResourceEdit::Item* QtxResourceEdit::Item::parentItem() const
{
return myParent;
}
+/*!
+ Appends child and (if necessary) removes item from old parent
+ \param item - item to be added
+*/
void QtxResourceEdit::Item::insertChild( Item* item )
{
if ( !item || myChildren.contains( item ) )
myChildren.append( item );
}
+/*!
+ Removes child
+ \param item - item to be removed
+*/
void QtxResourceEdit::Item::removeChild( Item* item )
{
if ( !item || !myChildren.contains( item ) )
item->myParent = 0;
}
+/*!
+ Fills list with children items
+ \param lst - list to be filled with
+*/
void QtxResourceEdit::Item::childItems( QPtrList<Item>& lst ) const
{
for ( ItemListIterator it( myChildren ); it.current(); ++it )
lst.append( it.current() );
}
+/*!
+ \return true if there is no children of this item
+*/
bool QtxResourceEdit::Item::isEmpty() const
{
return myChildren.isEmpty();
}
+/*!
+ \return title of item
+*/
QString QtxResourceEdit::Item::title() const
{
return myTitle;
}
+/*!
+ \return assigned resource placement
+ \param sec - to return section
+ \param param - to return param name
+*/
void QtxResourceEdit::Item::resource( QString& sec, QString& param ) const
{
sec = myResSection;
param = myResParameter;
}
+/*!
+ Sets item title
+ \param title - new item title
+*/
void QtxResourceEdit::Item::setTitle( const QString& title )
{
myTitle = title;
}
+/*!
+ Assigns new resource to item
+ \param sec - section
+ \param sec - param name
+*/
void QtxResourceEdit::Item::setResource( const QString& sec, const QString& param )
{
myResSection = sec;
myResParameter = param;
}
+/*!
+ Updates item (default implementation is empty)
+*/
void QtxResourceEdit::Item::update()
{
}
+/*!
+ \return property value
+*/
QVariant QtxResourceEdit::Item::property( const QString& ) const
{
return QVariant();
}
+/*!
+ Sets property value
+*/
void QtxResourceEdit::Item::setProperty( const QString&, const QVariant& )
{
}
+/*!
+ \return value of assigned resource
+*/
QString QtxResourceEdit::Item::resourceValue() const
{
return getString();
}
+/*!
+ Sets value of assigned resource
+ \param val - new value
+*/
void QtxResourceEdit::Item::setResourceValue( const QString& val )
{
setString( val );
}
+/*!
+ \return corresponding resource manager
+*/
QtxResourceMgr* QtxResourceEdit::Item::resourceMgr() const
{
QtxResourceMgr* resMgr = 0;
return resMgr;
}
+/*!
+ \return corresponding resource edit
+*/
QtxResourceEdit* QtxResourceEdit::Item::resourceEdit() const
{
return myEdit;
}
+/*!
+ \return integer value of resource corresponding to item
+ \param val - default value (it is returned if there is no such resource)
+*/
int QtxResourceEdit::Item::getInteger( const int val ) const
{
QtxResourceMgr* resMgr = resourceMgr();
return resMgr ? resMgr->integerValue( myResSection, myResParameter, val ) : val;
}
+/*!
+ \return double value of resource corresponding to item
+ \param val - default value (it is returned if there is no such resource)
+*/
double QtxResourceEdit::Item::getDouble( const double val ) const
{
QtxResourceMgr* resMgr = resourceMgr();
return resMgr ? resMgr->doubleValue( myResSection, myResParameter, val ) : val;
}
+/*!
+ \return boolean value of resource corresponding to item
+ \param val - default value (it is returned if there is no such resource)
+*/
bool QtxResourceEdit::Item::getBoolean( const bool val ) const
{
QtxResourceMgr* resMgr = resourceMgr();
return resMgr ? resMgr->booleanValue( myResSection, myResParameter, val ) : val;
}
+/*!
+ \return string value of resource corresponding to item
+ \param val - default value (it is returned if there is no such resource)
+*/
QString QtxResourceEdit::Item::getString( const QString& val ) const
{
QtxResourceMgr* resMgr = resourceMgr();
return resMgr ? resMgr->stringValue( myResSection, myResParameter, val ) : val;
}
+/*!
+ \return color value of resource corresponding to item
+ \param val - default value (it is returned if there is no such resource)
+*/
QColor QtxResourceEdit::Item::getColor( const QColor& val ) const
{
QtxResourceMgr* resMgr = resourceMgr();
return resMgr ? resMgr->colorValue( myResSection, myResParameter, val ) : val;
}
+/*!
+ \return font value of resource corresponding to item
+ \param val - default value (it is returned if there is no such resource)
+*/
QFont QtxResourceEdit::Item::getFont( const QFont& val ) const
{
QtxResourceMgr* resMgr = resourceMgr();
return resMgr ? resMgr->fontValue( myResSection, myResParameter, val ) : val;
}
+/*!
+ Sets value of resource
+ \param val - value
+*/
void QtxResourceEdit::Item::setInteger( const int val )
{
QtxResourceMgr* resMgr = resourceMgr();
resMgr->setValue( myResSection, myResParameter, val );
}
+/*!
+ Sets value of resource
+ \param val - value
+*/
void QtxResourceEdit::Item::setDouble( const double val )
{
QtxResourceMgr* resMgr = resourceMgr();
resMgr->setValue( myResSection, myResParameter, val );
}
+/*!
+ Sets value of resource
+ \param val - value
+*/
void QtxResourceEdit::Item::setBoolean( const bool val )
{
QtxResourceMgr* resMgr = resourceMgr();
resMgr->setValue( myResSection, myResParameter, val );
}
+/*!
+ Sets value of resource
+ \param val - value
+*/
void QtxResourceEdit::Item::setString( const QString& val )
{
QtxResourceMgr* resMgr = resourceMgr();
resMgr->setValue( myResSection, myResParameter, val );
}
+/*!
+ Sets value of resource
+ \param val - value
+*/
void QtxResourceEdit::Item::setColor( const QColor& val )
{
QtxResourceMgr* resMgr = resourceMgr();
resMgr->setValue( myResSection, myResParameter, val );
}
+/*!
+ Sets value of resource
+ \param val - value
+*/
void QtxResourceEdit::Item::setFont( const QFont& val )
{
QtxResourceMgr* resMgr = resourceMgr();
resMgr->setValue( myResSection, myResParameter, val );
}
+/*!
+ \return other item
+ \param id - other item id
+*/
QtxResourceEdit::Item* QtxResourceEdit::Item::item( const int id ) const
{
return resourceEdit() ? resourceEdit()->item( id ) : 0;
}
+/*!
+ \return other item
+ \param title - other item title
+*/
QtxResourceEdit::Item* QtxResourceEdit::Item::item( const QString& title ) const
{
return resourceEdit() ? resourceEdit()->item( title ) : 0;
}
+/*!
+ \return other item
+ \param title - other item title
+ \param id - parent item id
+*/
QtxResourceEdit::Item* QtxResourceEdit::Item::item( const QString& title, const int id ) const
{
return resourceEdit() ? resourceEdit()->item( title, id ) : 0;
}
+/*!
+ \return free item id
+*/
int QtxResourceEdit::Item::generateId()
{
static int _id = 0;
#include <qvariant.h>
#include <qfont.h>
+/*!
+ \class QtxResourceEdit
+ Class for managing preferences items
+*/
class QTX_EXPORT QtxResourceEdit
{
public:
friend class QtxResourceEdit::Item;
};
-/*
- Class: QtxResourceEditor::Item
- Descr: Class for incapsulation of one preference item
+/*!
+ \class QtxResourceEditor::Item
+ Class for incapsulation of one preference item
*/
class QTX_EXPORT QtxResourceEdit::Item
{
}
+/*!
+ Destructor
+*/
QtxResourceMgr::Resources::~Resources()
{
}
+/*!
+ Returns name of resource file
+ This file is used to load/save operations
+*/
QString QtxResourceMgr::Resources::file() const
{
return myFileName;
}
+/*!
+ Sets name of resource file
+ \param fn - name of file
+*/
void QtxResourceMgr::Resources::setFile( const QString& fn )
{
myFileName = fn;
}
+/*!
+ Returns string representation of parameter value
+ Returns QString::null if there is no such parameter
+
+ \param sect - name of section
+ \param name - name of parameter
+ \param subst - if it is true, then the substitution of variables
+ will be done with help of makeSubstitution method
+ \sa makeSubstitution()
+*/
QString QtxResourceMgr::Resources::value( const QString& sect, const QString& name, const bool subst ) const
{
QString val;
return val;
}
+/*!
+ Sets value by it's string representation
+
+ \param sect - name of section
+ \param name - name of parameter
+ \param val - string value
+*/
void QtxResourceMgr::Resources::setValue( const QString& sect, const QString& name, const QString& val )
{
Section& s = section( sect );
s.insert( name, val );
}
+/*!
+ \return true if section exists
+ \param sect - name of section
+*/
bool QtxResourceMgr::Resources::hasSection( const QString& sect ) const
{
return mySections.contains( sect );
}
+/*!
+ \return true if parameter exists in section
+ \param sect - name of section
+ \param name - name of parameter
+*/
bool QtxResourceMgr::Resources::hasValue( const QString& sect, const QString& name ) const
{
return hasSection( sect ) && section( sect ).contains( name );
}
+/*!
+ Removes section from resources
+ \param sect - name of section
+*/
void QtxResourceMgr::Resources::removeSection( const QString& sect )
{
mySections.remove( sect );
}
+/*!
+ Removes parameter from section
+ \param sect - name of section
+ \param name - name of parameter
+*/
void QtxResourceMgr::Resources::removeValue( const QString& sect, const QString& name )
{
if ( !hasSection( sect ) )
mySections.remove( sect );
}
+/*!
+ Removes all sections
+*/
void QtxResourceMgr::Resources::clear()
{
mySections.clear();
}
+/*!
+ \return list of section names
+*/
QStringList QtxResourceMgr::Resources::sections() const
{
return mySections.keys();
}
+/*!
+ \return list of parameter names from section
+ \param sec - name of section
+*/
QStringList QtxResourceMgr::Resources::parameters( const QString& sec ) const
{
if ( !hasSection( sec ) )
return section( sec ).keys();
}
+/*!
+ \return path of file from directory built by parameter
+ \return QString::null if built path doesn't exist
+ \param sec - name of section
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+*/
QString QtxResourceMgr::Resources::path( const QString& sec, const QString& prefix, const QString& name ) const
{
QString filePath = fileName( sec, prefix, name );
return filePath;
}
+/*!
+ \return corresponding resource manager
+*/
QtxResourceMgr* QtxResourceMgr::Resources::resMgr() const
{
return myMgr;
}
+/*!
+ \return instance of section by it's name. Section will be created if it doesn't exist
+*/
QtxResourceMgr::Section& QtxResourceMgr::Resources::section( const QString& sn )
{
if ( !mySections.contains( sn ) )
return mySections[sn];
}
+/*!
+ \return instance of section by it's name. Section will be created if it doesn't exist
+*/
const QtxResourceMgr::Section& QtxResourceMgr::Resources::section( const QString& sn ) const
{
return mySections[sn];
}
+/*!
+ \return full path of file
+ \param sect - name of section
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+*/
QString QtxResourceMgr::Resources::fileName( const QString& sect, const QString& prefix, const QString& name ) const
{
QString path;
return QString();
}
+/*!
+ \return QPixmap loaded from file
+ \param sect - name of section
+ \param prefix - name of parameter containing some path
+ \param name - name of picture file
+*/
QPixmap QtxResourceMgr::Resources::loadPixmap( const QString& sect, const QString& prefix, const QString& name ) const
{
QString fname = fileName( sect, prefix, name );
return p;
}
+/*!
+ \return just created and loaded translator
+ \param sect - name of section
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+*/
QTranslator* QtxResourceMgr::Resources::loadTranslator( const QString& sect, const QString& prefix, const QString& name ) const
{
QTranslator* trans = new QTranslator( 0 );
return trans;
}
+/*!
+ Finds in string variables by patterns: ${name} or $(name) or %name%
+ \return first found name or QString::null if there is no ones
+ \param str - string where the search is processed
+ \param start - integer value for returning start position of variable
+ \param len - integer value for returning length of variable
+*/
QString QtxResourceMgr::Resources::environmentVariable( const QString& str, int& start, int& len ) const
{
QString varName = QString::null;
return varName;
}
+/*!
+ Substitutes variables by its' values. If variable is from enviroment,
+ it will be replaced by environment value. If it isn't, method tries to
+ find it's value among resources
+ \return new variant of string 'str'
+ \param str - string to process substitution
+ \param sect - section, in which the variables will be finding
+ \param name - name of variable which must be ignored during substitution
+*/
QString QtxResourceMgr::Resources::makeSubstitution( const QString& str, const QString& sect, const QString& name ) const
{
QString res = str;
Class: QtxResourceMgr::IniFormat
Level: Internal
*/
-
class QtxResourceMgr::IniFormat : public Format
{
public:
virtual bool save( const QString&, const QMap<QString, Section>& );
};
+/*!
+ Default constructor
+*/
QtxResourceMgr::IniFormat::IniFormat()
: Format( "ini" )
{
}
+/*!
+ Destructor
+*/
QtxResourceMgr::IniFormat::~IniFormat()
{
}
+/*!
+ Loads resources from ini-file to map of sections
+ \param fname - name of resource file
+ \param secMap - map of sections
+*/
bool QtxResourceMgr::IniFormat::load( const QString& fname, QMap<QString, Section>& secMap )
{
QFile file( fname );
return res;
}
+/*!
+ Saves map of sections to resource ini-file
+ \param fname - name of resource file
+ \param secMap - map of sections
+*/
bool QtxResourceMgr::IniFormat::save( const QString& fname, const QMap<QString, Section>& secMap )
{
QFile file( fname );
QString valueAttribute() const;
};
+/*!
+ Default constructor
+*/
QtxResourceMgr::XmlFormat::XmlFormat()
: Format( "xml" )
{
}
+/*!
+ Destructor
+*/
QtxResourceMgr::XmlFormat::~XmlFormat()
{
}
+/*!
+ Loads resources from xml-file to map of sections
+ \param fname - name of resource file
+ \param secMap - map of sections
+*/
bool QtxResourceMgr::XmlFormat::load( const QString& fname, QMap<QString, Section>& secMap )
{
bool res = false;
return res;
}
+/*!
+ Saves map of sections to resource xml-file
+ \param fname - name of resource file
+ \param secMap - map of sections
+*/
bool QtxResourceMgr::XmlFormat::save( const QString& fname, const QMap<QString, Section>& secMap )
{
bool res = false;
return res;
}
+/*!
+ \return XML tag of document
+*/
QString QtxResourceMgr::XmlFormat::docTag() const
{
QString tag = option( "doc_tag" );
return tag;
}
+/*!
+ \return XML tag of section
+*/
QString QtxResourceMgr::XmlFormat::sectionTag() const
{
QString tag = option( "section_tag" );
return tag;
}
+/*!
+ \return XML tag of parameter
+*/
QString QtxResourceMgr::XmlFormat::parameterTag() const
{
QString tag = option( "parameter_tag" );
return tag;
}
+/*!
+ \return XML attribute of parameter name
+*/
QString QtxResourceMgr::XmlFormat::nameAttribute() const
{
QString str = option( "name_attribute" );
return str;
}
+/*!
+ \return XML attribute of parameter value
+*/
QString QtxResourceMgr::XmlFormat::valueAttribute() const
{
QString str = option( "value_attribute" );
it.current()->clear();
}
+/*!
+ Set state 'ignore user values'.
+ If it is true, then all resources loaded from user home directory is ignored
+*/
void QtxResourceMgr::setIgnoreUserValues( const bool val )
{
myIsIgnoreUserValues = val;
}
+/*!
+ \return state 'ignore user values'
+*/
bool QtxResourceMgr::ignoreUserValues() const
{
return myIsIgnoreUserValues;
return res;
}
+/*!
+ \return path of file from directory built by parameter
+ \return QString::null if built path doesn't exist
+ \param sec - name of section
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+*/
QString QtxResourceMgr::path( const QString& sect, const QString& prefix, const QString& name ) const
{
QString res;
return res;
}
+/*!
+ \return section corresponding to resources paths
+*/
QString QtxResourceMgr::resSection() const
{
QString res = option( "res_section_name" );
return res;
}
+/*!
+ \return section corresponding to language settings
+*/
QString QtxResourceMgr::langSection() const
{
QString res = option( "lang_section_name" );
return res;
}
+/*!
+ \return default image used when during loading the image file doesn't exist
+*/
QPixmap QtxResourceMgr::defaultPixmap() const
{
return myDefaultPix;
}
+/*!
+ Set image as default image used when during loading the image file doesn't exist
+ \param pix - image
+*/
void QtxResourceMgr::setDefaultPixmap( const QPixmap& pix )
{
myDefaultPix = pix;
}
+/*!
+ \return image loaded from file
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+*/
QPixmap QtxResourceMgr::loadPixmap( const QString& prefix, const QString& name ) const
{
return loadPixmap( prefix, name, true );
}
+/*!
+ \return image loaded from file
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+ \param useDef - indicates if it is possible to use default image returning by defaultPixmap() method.
+ If it is false, the empty pixmap will be used as default
+ \sa defaultPixmap()
+*/
QPixmap QtxResourceMgr::loadPixmap( const QString& prefix, const QString& name, const bool useDef ) const
{
return loadPixmap( prefix, name, useDef ? defaultPixmap() : QPixmap() );
}
+/*!
+ Finds in all sections an existing path corresponding to 'prefix' parameter
+ and load image with name 'name' from this folder
+
+ \return image loaded from file
+ \param prefix - name of parameter containing some path
+ \param name - name of file
+ \param defPix - default image used when file doesn't exist
+*/
QPixmap QtxResourceMgr::loadPixmap( const QString& prefix, const QString& name, const QPixmap& defPix ) const
{
initialize();
return pix;
}
+/*!
+ Loads translator for language
+ Name of translator file is constructed by list returning by option "translators" or,
+ if it is empty, by predefined pattern "%P_msg_%L.qm". It is recommended to used in translators
+ name the strings %A, %P, %L whose will be replaced by application name, prefix and language name correspondingly
+
+ \param pref - name of parameter containing path to translator's file.
+ If it is empty, the list of parameters from resource section ( resSection() )
+ is used.
+
+ \param l - name of language. If it is empty, then value of parameter "language"
+ from language section ( langSection() ) is used. If it is also empty, then
+ predefined name "en" is used
+
+ \sa resSection(), langSection()
+*/
void QtxResourceMgr::loadLanguage( const QString& pref, const QString& l )
{
initialize();
}
}
+/*!
+ Loads translators by path and list of files
+
+ \param prefix - value of this parameter must contain path
+ \param translators - list of translators' files
+*/
void QtxResourceMgr::loadTranslators( const QString& prefix, const QStringList& translators )
{
initialize();
}
}
+/*!
+ Loads translator by path and file name
+
+ \param prefix - value of this parameter must contain path
+ \param name - name of translator file
+*/
void QtxResourceMgr::loadTranslator( const QString& prefix, const QString& name )
{
initialize();
}
}
+/*!
+ Remove all translators corresponding to prefix
+
+ \param prefix - parameter containing path
+*/
void QtxResourceMgr::removeTranslators( const QString& prefix )
{
if ( !myTranslator.contains( prefix ) )
myTranslator.remove( prefix );
}
+/*!
+ Moves translators corresponding to prefix to the top of translator stack
+
+ \param prefix - parameter containing path
+*/
void QtxResourceMgr::raiseTranslators( const QString& prefix )
{
if ( !myTranslator.contains( prefix ) )
}
}
+/*!
+ Copies all resources to user resources, so that they will be saved in user home folder
+*/
void QtxResourceMgr::refresh()
{
QStringList sl = sections();
}
}
+/*!
+ \brief Sets the resource directories list except user home directory and clear resources
+*/
void QtxResourceMgr::setDirList( const QStringList& dl )
{
myDirList = dl;
myResources.clear();
}
+/*!
+ Sets resource value
+ \param sect - name of section
+ \param name - name of parameter
+ \param val - string representation of value
+*/
void QtxResourceMgr::setResource( const QString& sect, const QString& name, const QString& val )
{
initialize();
myResources.first()->setValue( sect, name, val );
}
+/*!
+ \return name of resource file, which is being found in user home directory
+ \param appName - name of application
+ \param for_load - flag indicating that file will be used for loading (true) or for saving(false)
+ It makes possible to use different resource files for loading and saving
+*/
QString QtxResourceMgr::userFileName( const QString& appName, const bool /*for_load*/ ) const
{
QString fileName;
return pathName;
}
+/*!
+ \return name of resource file, which is being found in all resource directories, except user home
+*/
QString QtxResourceMgr::globalFileName( const QString& appName ) const
{
return QString( "%1.%2" ).arg( appName ).arg( currentFormat() );
}
+/*!
+ Replaced substrings by pattern %A, %B, etc by values from map
+
+ \param src - string to be processed
+ \param substMap - map of values for replacing
+*/
QString QtxResourceMgr::substMacro( const QString& src, const QMap<QChar, QString>& substMap ) const
{
QString trg = src;
#include <math.h>
#include <stdlib.h>
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxStdOperations::QtxStdOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxStdOperations::~QtxStdOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Fills list of brackets treated as open (when 'open' is 'true') or close ('open' is 'false')
+*/
void QtxStdOperations::bracketsList( QStringList& list, bool open ) const
{
if( open )
list.append( ")" );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Fills list with operation names by copying of internal list of operations
+*/
void QtxStdOperations::opersList( QStringList& list ) const
{
- list += myOpers;
+ list += myOpers;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Add operation names from list to internal list of operations
+*/
void QtxStdOperations::addOperations( const QStringList& list )
{
QStringList::const_iterator anIt = list.begin(),
myOpers.append( *anIt );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Append operation names from 'list' to internal list of operations
+*/
void QtxStdOperations::addTypes( const ListOfTypes& list )
{
ListOfTypes::const_iterator anIt = list.begin(),
myTypes.append( *anIt );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return whether values with passed types are valid for arguments of operation
+ \param op - name of operation
+ \param t1 - type of first argument
+ \param t2 - type of second argument
+*/
QtxParser::Error QtxStdOperations::isValid( const QString& op,
const QVariant::Type t1,
const QVariant::Type t2 ) const
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxArithmetics::QtxArithmetics()
: QtxStdOperations()
{
addTypes( aTypes );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxArithmetics::~QtxArithmetics()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates numbers by it's string representation [redefined virtual]
+*/
bool QtxArithmetics::createValue( const QString& str, QtxValue& v ) const
{
bool ok = false;
return ok;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of arithmetic operation 'op'.
+ \param isBin indicate whether the operation is binary
+*/
int QtxArithmetics::prior( const QString& op, bool isBin ) const
{
if( isBin )
v1 = QVariant( v2, 0 );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxArithmetics::calculate( const QString& op,
QtxValue& v1, QtxValue& v2 ) const
{
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxLogic::QtxLogic()
: QtxStdOperations()
{
addTypes( aTypes );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxLogic::~QtxLogic()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates value 'true' or 'false' it's string representation [redefined virtual]
+*/
bool QtxLogic::createValue( const QString& str, QtxValue& v ) const
{
bool ok = true;
return ok;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of arithmetic operation 'op'.
+ \param isBin indicate whether the operation is binary
+*/
int QtxLogic::prior( const QString& op, bool isBin ) const
{
if( isBin )
return false;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxLogic::calculate( const QString& op,
QtxValue& v1, QtxValue& v2 ) const
{
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxFunctions::QtxFunctions()
: QtxStdOperations()
{
addTypes( aTypes );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxFunctions::~QtxFunctions()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates numbers by it's string representation [redefined virtual]
+*/
bool QtxFunctions::createValue( const QString& str, QtxValue& v ) const
{
bool ok = false;
return ok;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of arithmetic operation 'op'.
+ \param isBin indicate whether the operation is binary
+*/
int QtxFunctions::prior( const QString& op, bool isBin ) const
{
if( isBin )
return 0;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxFunctions::calculate( const QString& op,
QtxValue& v1, QtxValue& v2 ) const
{
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxStrings::QtxStrings()
: QtxStdOperations()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxStrings::~QtxStrings()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates string QtxValue by it's Qt string representation [redefined virtual]
+*/
bool QtxStrings::createValue( const QString& str, QtxValue& v ) const
{
QChar st = str[0],
return QtxStdOperations::createValue( str, v );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of arithmetic operation 'op'.
+ \param isBin indicate whether the operation is binary
+*/
int QtxStrings::prior( const QString& op, bool isBin ) const
{
if( isBin )
return 0;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxStrings::calculate( const QString& op,
QtxValue& v1, QtxValue& v2 ) const
{
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Default constructor
+*/
QtxSets::QtxSets()
{
QStringList aList;
addTypes( aTypes );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Destructor
+*/
QtxSets::~QtxSets()
{
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Fills list of brackets treated as open (when 'open' is 'true') or close ('open' is 'false')
+*/
void QtxSets::bracketsList( QStringList& list, bool open ) const
{
if( open )
QtxStdOperations::bracketsList( list, open );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Creates set of QtxValues by their string representation [redefined virtual]
+*/
bool QtxSets::createValue( const QString& str, QtxValue& val ) const
{
return QtxStdOperations::createValue( str, val );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return priority of arithmetic operation 'op'.
+ \param isBin indicate whether the operation is binary
+*/
int QtxSets::prior( const QString& op, bool isBin ) const
{
if( isBin )
return 0;
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ \return whether values with passed types are valid for arguments of operation
+ \param op - name of operation
+ \param t1 - type of first argument
+ \param t2 - type of second argument
+*/
QtxParser::Error QtxSets::isValid( const QString& op,
const QVariant::Type t1,
const QVariant::Type t2 ) const
return QtxStdOperations::isValid( op, t1, t2 );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Adds new value 'v' to set 'set' [static]
+*/
void QtxSets::add( ValueSet& set, const QtxValue& v )
{
if( v.isValid() && set.contains( v )==0 )
set.append( v );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Adds values from set 's2' to set 's1'
+*/
void QtxSets::add( ValueSet& s1, const ValueSet& s2 )
{
ValueSet::const_iterator anIt = s2.begin(),
add( s1, *anIt );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes value 'v' from set 'set'
+*/
void QtxSets::remove( ValueSet& set, const QtxValue& v )
{
set.remove( v );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Removes values of set 's2' from set 's1'
+*/
void QtxSets::remove( ValueSet& s1, const ValueSet& s2 )
{
ValueSet::const_iterator anIt = s2.begin(),
s1.remove( *anIt );
}
-//================================================================
-// Function :
-// Purpose :
-//================================================================
+/*!
+ Calculates result of operation
+ \return one of error states
+ \param op - name of operation
+ \param v1 - first operation argument (must be used also to store result)
+ \param v2 - second operation argument
+*/
QtxParser::Error QtxSets::calculate( const QString& op, QtxValue& v1, QtxValue& v2 ) const
{
QtxParser::Error err = QtxParser::OK;
#include "Qtx.h"
#include "QtxOperations.h"
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxStdOperations
+ Provides simplified interface for standard operations.
+ Conatins list of operation names, priority and possible types
+*/
class QTX_EXPORT QtxStdOperations : public QtxOperations
{
public:
ListOfTypes myTypes;
};
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxArithmetics
+ Provides set of arithmetic operations for parser
+*/
class QTX_EXPORT QtxArithmetics : public QtxStdOperations
{
public:
virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
};
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxLogic
+ Provides set of logic operations for parser
+*/
class QTX_EXPORT QtxLogic : public QtxStdOperations
{
public:
virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
};
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxFunctions
+ Provides set of more complex operations for parser (sqrt, sin, cos, etc)
+*/
class QTX_EXPORT QtxFunctions : public QtxStdOperations
{
public:
virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
};
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxStrings
+ Provides set of string operations for parser
+*/
class QTX_EXPORT QtxStrings : public QtxStdOperations
{
public:
virtual QtxParser::Error calculate( const QString&, QtxValue&, QtxValue& ) const;
};
-//================================================================
-// Class :
-// Purpose :
-//================================================================
+/*!
+ \class QtxSets
+ Provides set of operations with sets for parser
+*/
class QTX_EXPORT QtxSets : public QtxStdOperations
{
public:
#include <qlineedit.h>
+/*!
+ Constructor
+*/
QtxTable::QtxTable( QWidget* parent, const char* name )
: QTable( parent, name ),
myHeaderEditor( 0 ),
connect( horizontalScrollBar(), SIGNAL( valueChanged( int ) ), this, SLOT( onScrollBarMoved( int ) ) );
}
+/*!
+ Constructor
+*/
QtxTable::QtxTable( int numRows, int numCols, QWidget* parent, const char* name )
: QTable( numRows, numCols, parent, name ),
myHeaderEditor( 0 ),
connect( horizontalScrollBar(), SIGNAL( valueChanged( int ) ), this, SLOT( onScrollBarMoved( int ) ) );
}
+/*!
+ Destructor
+*/
QtxTable::~QtxTable()
{
}
+/*!
+ \return true if header is editable
+ \param o - header orientation
+*/
bool QtxTable::headerEditable( Orientation o ) const
{
return myHeaderEditable.contains( o ) ? myHeaderEditable[o] : false;
}
+/*!
+ Changes editable state of header
+ \param o - header orientation
+ \param on - new state
+*/
void QtxTable::setHeaderEditable( Orientation o, const bool on )
{
if ( headerEditable( o ) == on )
hdr->removeEventFilter( this );
}
+/*!
+ Starts edition of header
+ \param o - header orientation
+ \param sec - column/row
+*/
bool QtxTable::editHeader( Orientation o, const int sec )
{
return beginHeaderEdit( o, sec );
}
+/*!
+ Finishes edition of header
+ \param accept - whether new value must be accepted
+*/
void QtxTable::endEditHeader( const bool accept )
{
endHeaderEdit( accept );
}
+/*!
+ Finishes edition and hides table
+*/
void QtxTable::hide()
{
endHeaderEdit();
QTable::hide();
}
+/*!
+ Custom event filter
+ Starts edition of header by double click
+ Finishes edition by escape/return/enter pressing
+*/
bool QtxTable::eventFilter( QObject* o, QEvent* e )
{
if ( e->type() == QEvent::MouseButtonDblClick )
return QTable::eventFilter( o, e );
}
+/*!
+ SLOT: called on scroll
+*/
void QtxTable::onScrollBarMoved( int )
{
updateHeaderEditor();
}
+/*!
+ SLOT: called on header size changing
+*/
void QtxTable::onHeaderSizeChange( int, int, int )
{
if ( sender() == myEditedHeader )
updateHeaderEditor();
}
+/*!
+ Custom resize event handler
+*/
void QtxTable::resizeEvent( QResizeEvent* e )
{
QTable::resizeEvent( e );
updateHeaderEditor();
}
+/*!
+ Starts edition of header
+ \param o - header orientation
+ \param sec - column/row
+*/
bool QtxTable::beginHeaderEdit( Orientation o, const int section )
{
if ( !headerEditable( o ) || !header( o ) || !header( o )->isVisibleTo( this ) )
return true;
}
+/*!
+ Finishes edition of header
+ \param accept - whether new value must be accepted
+*/
void QtxTable::endHeaderEdit( const bool accept )
{
if ( !isHeaderEditing() )
}
}
+/*!
+ \return true if header is being edited
+*/
bool QtxTable::isHeaderEditing() const
{
return myHeaderEditor && myEditedHeader && myEditedSection != -1;
}
+/*!
+ Creates and \return header editor
+ \param hdr - header
+ \param sec - column/row
+ \param init - init editor with value
+*/
QWidget* QtxTable::createHeaderEditor( QHeader* hdr, const int sec, const bool init )
{
QLineEdit* ed = new QLineEdit( 0 );
return ed;
}
+/*!
+ Initialize editor with value
+ \param hdr - header
+ \param sec - column/row
+ \param editor - editor
+*/
void QtxTable::setHeaderContentFromEditor( QHeader* hdr, const int sec, QWidget* editor )
{
if ( !hdr || !editor )
hdr->setLabel( sec, ((QLineEdit*)editor)->text() );
}
+/*!
+ \return header
+ \param o - orientation
+*/
QHeader* QtxTable::header( Orientation o ) const
{
return o == Horizontal ? horizontalHeader() : verticalHeader();
}
+/*!
+ Starts edition of header
+ \param o - header orientation
+ \param p - point
+*/
void QtxTable::beginHeaderEdit( Orientation o, const QPoint& p )
{
QHeader* hdr = header( o );
beginHeaderEdit( o, sec );
}
+/*!
+ \return rectangle of header section
+ \param hdr - header
+ \param sec - column/row
+*/
QRect QtxTable::headerSectionRect( QHeader* hdr, const int sec ) const
{
QRect r( -1, -1, -1, -1 );
return r;
}
+/*!
+ Updates header editor
+*/
void QtxTable::updateHeaderEditor()
{
if ( !myHeaderEditor || !myEditedHeader || myEditedSection < 0 )
bool myVisible;
};
+/*!
+ Constructor
+*/
QtxToolBar::Watcher::Watcher( QtxToolBar* cont )
: QObject( cont ),
myCont( cont ),
installFilters();
}
+/*!
+ Custom event filter
+*/
bool QtxToolBar::Watcher::eventFilter( QObject* o, QEvent* e )
{
if ( o == myCont && e->type() == QEvent::ChildInserted )
return false;
}
+/*!
+ Sets internal visibility state to true
+*/
void QtxToolBar::Watcher::shown( QtxToolBar* tb )
{
if ( tb != myCont )
myVisible = true;
}
+/*!
+ Sets internal visibility state to false
+*/
void QtxToolBar::Watcher::hided( QtxToolBar* tb )
{
if ( tb != myCont )
myVisible = false;
}
+/*!
+ Shows corresponding QtxToolBar
+*/
void QtxToolBar::Watcher::showContainer()
{
if ( !myCont )
myCont = cont;
}
+/*!
+ Hides corresponding QtxToolBar
+*/
void QtxToolBar::Watcher::hideContainer()
{
if ( !myCont )
myCont = cont;
}
+/*!
+ Event handler of custom events
+*/
void QtxToolBar::Watcher::customEvent( QCustomEvent* e )
{
switch ( e->type() )
}
}
+/*!
+ Installs event filters
+*/
void QtxToolBar::Watcher::installFilters()
{
if ( !myCont )
}
}
+/*!
+ Update visibility state
+*/
void QtxToolBar::Watcher::updateVisibility()
{
if ( !myCont )
vis ? showContainer() : hideContainer();
}
+/*!
+ Updates icon
+*/
void QtxToolBar::Watcher::updateIcon()
{
if ( !myCont || !myCont->widget() )
myCont->setIcon( ico ? *ico : QPixmap() );
}
+/*!
+ Updates caption
+*/
void QtxToolBar::Watcher::updateCaption()
{
if ( myCont && myCont->widget() && !myCont->widget()->caption().isNull() )
}
/*!
- Class: QtxToolBar [Public]
- Descr:
+ Constructor
*/
-
QtxToolBar::QtxToolBar( const bool watch, const QString& label, QMainWindow* main,
QWidget* parent, bool newLine, const char* name, WFlags f )
: QToolBar( label, main, parent, newLine, name, f ),
myWatcher = new Watcher( this );
}
+/*!
+ Constructor
+*/
QtxToolBar::QtxToolBar( const QString& label, QMainWindow* main,
QWidget* parent, bool newLine, const char* name, WFlags f )
: QToolBar( label, main, parent, newLine, name, f ),
{
}
+/*!
+ Constructor
+*/
QtxToolBar::QtxToolBar( const bool watch, QMainWindow* main, const char* name )
: QToolBar( main, name ),
myWatcher( 0 ),
myWatcher = new Watcher( this );
}
+/*!
+ Constructor
+*/
QtxToolBar::QtxToolBar( QMainWindow* main, const char* name )
: QToolBar( main, name ),
myWatcher( 0 ),
{
}
+/*!
+ Destructor
+*/
QtxToolBar::~QtxToolBar()
{
}
+/*!
+ Change the toolbar's main widget
+ \param wid - new main widget
+*/
void QtxToolBar::setWidget( QWidget* wid )
{
if ( wid )
}
}
+/*!
+ \return true if toolbar is stretchable
+*/
bool QtxToolBar::isStretchable() const
{
return myStretch;
}
+/*!
+ Sets stretchable state of toolbar
+ \param on - new state
+*/
void QtxToolBar::setStretchable( const bool on )
{
if ( myStretch == on )
}
}
+/*!
+ \return the recommended size for the widget
+*/
QSize QtxToolBar::sizeHint() const
{
QSize sz = QToolBar::sizeHint();
return sz;
}
+/*!
+ \return the recommended minimum size for the widget
+*/
QSize QtxToolBar::minimumSizeHint() const
{
QSize sz = QToolBar::minimumSizeHint();
return sz;
}
+/*!
+ Shows toolbar
+*/
void QtxToolBar::show()
{
if ( myWatcher )
QToolBar::show();
}
+/*!
+ Hides toolbar
+*/
void QtxToolBar::hide()
{
if ( myWatcher )
#define TOOLTIP_SHOW_DELAY 0500
#define TOOLTIP_HIDE_DELAY 7000
+/*!
+ Constructor
+*/
QtxToolTip::QtxToolTip( QWidget* parent )
: QLabel( parent, "", WStyle_Customize | WStyle_NoBorder | WX11BypassWM | WStyle_Tool | WStyle_StaysOnTop | WType_TopLevel )
{
myShowDelayTime = 5000;
}
+/*!
+ Destructor
+*/
QtxToolTip::~QtxToolTip()
{
}
+/*!
+ Custom event filter
+*/
bool QtxToolTip::eventFilter( QObject* o, QEvent* e )
{
if ( ( e->type() == QEvent::Destroy ) || ( e->type() == QEvent::Close ) || ( e->type() == QEvent::Hide ) )
return false;
}
+/*!
+ Shows tool tip
+ \param aPos - position
+ \param text - tooltip text
+ \param aWidgetRegion - rectangle
+*/
void QtxToolTip::showTip( const QPoint& aPos, const QString& text, const QRect& aWidgetRegion )
{
QFontMetrics theFM = fontMetrics();
showTip( QRect( QPoint( aPos.x(), aPos.y() + 10 ), QSize( theWidth, theHeight ) ), text, aWidgetRegion );
}
+/*!
+ Shows tool tip
+ \param aRegion - tooltip region
+ \param text - tooltip text
+ \param aWidgetRegion - widget rectangle
+*/
void QtxToolTip::showTip( const QRect& aRegion, const QString& text, const QRect& aWidgetRegion )
{
setText( text );
show();
}
+/*!
+ Hides tooltip
+*/
void QtxToolTip::hideTip()
{
hide();
mySleepTimer->stop();
}
+/*!
+ It is called when there is a possibility that a tool tip should be shown and
+ must decide whether there is a tool tip for the point p in the widget that this QToolTip object relates to
+ \param pos - position
+*/
void QtxToolTip::maybeTip( const QPoint& pos )
{
QString text;
}
}
+/*!
+ SLOT: called when sleep time is out
+*/
void QtxToolTip::onSleepTimeOut()
{
mySleepTimer->stop();
hideTip();
}
+/*!
+ SLOT: called when wake time is out
+*/
void QtxToolTip::onWakeUpTimeOut()
{
myWakeUpTimer->stop();
maybeTip( pos );
}
+/*!
+ Custom mouse press event handler
+*/
void QtxToolTip::mousePressEvent( QMouseEvent* e )
{
hideTip();
QApplication::sendEvent( reciever, me );
}
+/*!
+ Custom mouse double click event handler
+*/
void QtxToolTip::mouseDoubleClickEvent( QMouseEvent* e )
{
hideTip();
QApplication::sendEvent( reciever, me );
}
+/*!
+ Sets wake delay time
+ \param theTime
+*/
void QtxToolTip::setWakeUpDelayTime( int theTime )
{
if( !(theTime < 0) )
myWakeUpDelayTime = theTime;
}
+/*!
+ Sets show delay time
+ \param theTime
+*/
void QtxToolTip::setShowDelayTime( int theTime )
{
if( !(theTime < 0) )
myShowDelayTime = theTime;
}
+/*!
+ \return timer measuring time of sleeping
+*/
QTimer* QtxToolTip::sleepTimer() const
{
return mySleepTimer;
}
+/*!
+ \return timer measuring time of waking up
+*/
QTimer* QtxToolTip::wakeUpTimer() const
{
return myWakeUpTimer;
#include <qworkspace.h>
#include <qwidgetlist.h>
+/*!
+ Constructor
+*/
QtxWorkspaceAction::QtxWorkspaceAction( QWorkspace* ws, QObject* parent, const char* name )
: QtxAction( tr( "Controls windows into workspace" ), tr( "Workspace management" ), 0, parent, name ),
myFlags( Standard ),
connect( myItem[VTile], SIGNAL( activated() ), this, SLOT( tileHorizontal() ) );
}
+/*!
+ Destructor
+*/
QtxWorkspaceAction::~QtxWorkspaceAction()
{
}
+/*!
+ \return corresponding workspace
+*/
QWorkspace* QtxWorkspaceAction::workspace() const
{
return myWorkspace;
}
+/*!
+ \return set of action flags
+*/
int QtxWorkspaceAction::items() const
{
return myFlags;
}
+/*!
+ Sets action flags
+ \param flags - new set of flags
+*/
void QtxWorkspaceAction::setItems( const int flags )
{
if ( !flags || flags == myFlags || !( flags & Operations ) )
myFlags = flags;
}
+/*!
+ \return true if action contains all flags
+ \param flags - new set of flags
+*/
bool QtxWorkspaceAction::hasItems( const int flags ) const
{
return ( myFlags & flags ) == flags;
}
+/*!
+ \return accelerator of item
+ \param id - item id
+*/
int QtxWorkspaceAction::accel( const int id ) const
{
int a = 0;
return a;
}
+/*!
+ \return icons of item
+ \param id - item id
+*/
QIconSet QtxWorkspaceAction::iconSet( const int id ) const
{
QIconSet ico;
return ico;
}
+/*!
+ \return menu text of item
+ \param id - item id
+*/
QString QtxWorkspaceAction::menuText( const int id ) const
{
QString txt;
return txt;
}
+/*!
+ \return status tip of item
+ \param id - item id
+*/
QString QtxWorkspaceAction::statusTip( const int id ) const
{
QString txt;
return txt;
}
+/*!
+ Changes accelerator of item
+ \param id - item id
+ \param a - new accelerator
+*/
void QtxWorkspaceAction::setAccel( const int id, const int a )
{
if ( myItem.contains( id ) )
myItem[id]->setAccel( a );
}
+/*!
+ Changes icons of item
+ \param id - item id
+ \param ico - new icons
+*/
void QtxWorkspaceAction::setIconSet( const int id, const QIconSet& ico )
{
if ( myItem.contains( id ) )
myItem[id]->setIconSet( ico );
}
+/*!
+ Changes menu text of item
+ \param id - item id
+ \param txt - new menu text
+*/
void QtxWorkspaceAction::setMenuText( const int id, const QString& txt )
{
if ( myItem.contains( id ) )
myItem[id]->setMenuText( txt );
}
+/*!
+ Changes status tip of item
+ \param id - item id
+ \param txt - new status tip
+*/
void QtxWorkspaceAction::setStatusTip( const int id, const QString& txt )
{
if ( myItem.contains( id ) )
myItem[id]->setStatusTip( txt );
}
+/*!
+ Adds action to widget
+ \param wid - widget
+*/
bool QtxWorkspaceAction::addTo( QWidget* wid )
{
return addTo( wid, -1 );
}
+/*!
+ Adds action to widget
+ \param wid - widget
+ \param idx - position
+*/
bool QtxWorkspaceAction::addTo( QWidget* wid, const int idx )
{
if ( !wid || !wid->inherits( "QPopupMenu" ) )
return true;
}
+/*!
+ Removes action from widget
+ \param wid - widget
+*/
bool QtxWorkspaceAction::removeFrom( QWidget* wid )
{
if ( !wid || !wid->inherits( "QPopupMenu" ) )
return true;
}
+/*!
+ Performs action
+ \param type - action type
+*/
void QtxWorkspaceAction::perform( const int type )
{
switch ( type )
}
}
+/*!
+ Performs tile action
+*/
void QtxWorkspaceAction::tile()
{
QWorkspace* ws = workspace();
ws->tile();
}
+/*!
+ Performs cascade action
+*/
void QtxWorkspaceAction::cascade()
{
QWorkspace* ws = workspace();
it.current()->resize( int( w * 0.8 ), int( h * 0.8 ) );
}
+/*!
+ Performs tile vertical action
+*/
void QtxWorkspaceAction::tileVertical()
{
QWorkspace* wrkSpace = workspace();
}
}
+/*!
+ Performs tile horizontal action
+*/
void QtxWorkspaceAction::tileHorizontal()
{
QWorkspace* wrkSpace = workspace();
}
}
+/*!
+ SLOT: called just before the popup menu is displayed, updates popup
+*/
void QtxWorkspaceAction::onAboutToShow()
{
const QObject* obj = sender();
updatePopup( (QPopupMenu*)obj );
}
+/*!
+ SLOT: called when popup menu is destroyed, removes it from menu
+*/
void QtxWorkspaceAction::onPopupDestroyed( QObject* obj )
{
myMenu.remove( (QPopupMenu*)obj );
}
+/*!
+ Updates popup
+ \param pm - popup menu
+*/
void QtxWorkspaceAction::checkPopup( QPopupMenu* pm )
{
if ( !myMenu.contains( pm ) )
}
}
+/*!
+ Clears and refills popup and updates state of actions
+ \param pm - popup menu
+*/
void QtxWorkspaceAction::updatePopup( QPopupMenu* pm )
{
if ( !myMenu.contains( pm ) )
myItem[VTile]->setEnabled( count );
}
+/*!
+ Clears popup
+ \param pm - popup menu
+*/
int QtxWorkspaceAction::clearPopup( QPopupMenu* pm )
{
if ( !myMenu.contains( pm ) )
return idx;
}
+/*!
+ Fills popup with items
+ \param pm - popup menu
+ \param idx - position
+*/
void QtxWorkspaceAction::fillPopup( QPopupMenu* pm, const int idx )
{
if ( !pm )
}
}
+/*!
+ SLOT: called when popup item corresponding to window is activated, activates window
+*/
void QtxWorkspaceAction::onItemActivated( int idx )
{
QWorkspace* ws = workspace();
#define DARK_COLOR_LIGHT 250
/*!
- Class: QtxWorkstack [Public]
- Descr:
+ Constructor
*/
-
QtxWorkstack::QtxWorkstack( QWidget* parent )
: QWidget( parent ),
myWin( 0 ),
base->addWidget( mySplit );
}
+/*!
+ Destructor
+*/
QtxWorkstack::~QtxWorkstack()
{
}
+/*!
+ \return list of all widgets in all areas
+*/
QWidgetList QtxWorkstack::windowList() const
{
QPtrList<QtxWorkstackArea> lst;
return widList;
}
+/*!
+ \return list of all widgets in active area
+*/
QWidgetList QtxWorkstack::splitWindowList() const
{
return myArea ? myArea->widgetList() : QWidgetList();
}
+/*!
+ \return active widget
+*/
QWidget* QtxWorkstack::activeWindow() const
{
return myWin;
}
+/*!
+ Splits widgets
+ \param o - orientation (Qt::Orientation)
+*/
void QtxWorkstack::split( const int o )
{
QtxWorkstackArea* area = myWorkArea;
}
/*!
-* \brief Split workarea of the given widget on two parts.
-* \param wid - widget, belonging to this workstack
-* \param o - orientation of splitting (Qt::Horizontal or Qt::Vertical)
-* \param type - type of splitting, see <VAR>SplitType</VAR> enumeration
+ \brief Split workarea of the given widget on two parts.
+ \param wid - widget, belonging to this workstack
+ \param o - orientation of splitting (Qt::Horizontal or Qt::Vertical)
+ \param type - type of splitting, see <VAR>SplitType</VAR> enumeration
*/
void QtxWorkstack::Split (QWidget* wid, const Qt::Orientation o, const SplitType type)
{
}
/*!
-* \brief Put given widget on top of its workarea
-* \param wid - widget, belonging to this workstack
+ \brief Put given widget on top of its workarea
+ \param wid - widget, belonging to this workstack
*/
/*
void QtxWorkstack::OnTop (QWidget* wid)
*/
/*!
-* \brief Move widget(s) from source workarea into target workarea
-* or just reorder widgets inside one workarea.
-* \param wid1 - widget from target workarea
-* \param wid2 - widget from source workarea
-* \param all - if this parameter is TRUE, all widgets from source workarea will
-* be moved into the target one, else only the \a wid2 will be moved
-*
-* Move \a wid2 in target workarea. Put it right after \a wid1.
-* If value of boolean argument is TRUE, all widgets from source workarea
-* will be moved together with \a wid2, source workarea will be deleted.
-* If \a wid1 and \a wid2 belongs to one workarea, simple reordering will take place.
+ \brief Move widget(s) from source workarea into target workarea
+ or just reorder widgets inside one workarea.
+ \param wid1 - widget from target workarea
+ \param wid2 - widget from source workarea
+ \param all - if this parameter is TRUE, all widgets from source workarea will
+ be moved into the target one, else only the \a wid2 will be moved
+
+ Move \a wid2 in target workarea. Put it right after \a wid1.
+ If value of boolean argument is TRUE, all widgets from source workarea
+ will be moved together with \a wid2, source workarea will be deleted.
+ If \a wid1 and \a wid2 belongs to one workarea, simple reordering will take place.
*/
void QtxWorkstack::Attract ( QWidget* wid1, QWidget* wid2, const bool all )
{
return 0;
}
+/*!
+ Redistributes space among widgets equally
+*/
void QtxWorkstack::distributeSpace( QSplitter* split ) const
{
if ( !split )
split->setSizes( szList );
}
+/*!
+ Splits widgets vertically
+*/
void QtxWorkstack::splitVertical()
{
split( Qt::Horizontal );
}
+/*!
+ Splits widgets horizontally
+*/
void QtxWorkstack::splitHorizontal()
{
split( Qt::Vertical );
}
+/*!
+ SLOT: called if action "Rename" is activated, changes caption of widget
+*/
void QtxWorkstack::onRename()
{
if ( !myWorkWin )
myWorkWin->setCaption( newName );
}
+/*!
+ Wraps area into new splitter
+ \return new splitter
+*/
QSplitter* QtxWorkstack::wrapSplitter( QtxWorkstackArea* area )
{
if ( !area )
return wrap;
}
+/*!
+ Reparenst and adds widget
+ \param wid - widget
+ \param pWid - parent widget
+ \param after - after widget
+*/
void QtxWorkstack::insertWidget( QWidget* wid, QWidget* pWid, QWidget* after )
{
if ( !wid || !pWid )
activeWindow()->close();
}
+/*!
+ SLOT: called on area is destroyed
+ Sets focus to neighbour area
+*/
void QtxWorkstack::onDestroyed( QObject* obj )
{
QtxWorkstackArea* area = (QtxWorkstackArea*)obj;
QApplication::postEvent( this, new QCustomEvent( QEvent::User ) );
}
+/*!
+ SLOT: called on window activating
+*/
void QtxWorkstack::onWindowActivated( QWidget* wid )
{
const QObject* obj = sender();
setActiveArea( (QtxWorkstackArea*)obj );
}
+/*!
+ SLOT: called on window deactivating
+*/
void QtxWorkstack::onDeactivated( QtxWorkstackArea* area )
{
if ( myArea != area )
QApplication::postEvent( this, new QCustomEvent( QEvent::User ) );
}
+/*!
+ Creates and shows popup menu for area
+ \param w - area
+ \param p - popup position
+*/
void QtxWorkstack::onContextMenuRequested( QWidget* w, QPoint p )
{
QtxWorkstackArea* anArea = dynamic_cast<QtxWorkstackArea*>( (QObject*)sender() );
myWorkArea = 0;
}
+/*!
+ Custom child event handler, inserts widget to active or current area
+*/
void QtxWorkstack::childEvent( QChildEvent* e )
{
if ( e->inserted() && e->child()->isWidgetType() )
QWidget::childEvent( e );
}
+/*!
+ Handler of custom events
+*/
void QtxWorkstack::customEvent( QCustomEvent* e )
{
updateState();
}
+/*!
+ \return splitter corresponding to area
+ \param area
+*/
QSplitter* QtxWorkstack::splitter( QtxWorkstackArea* area ) const
{
if ( !area )
return split;
}
+/*!
+ Fills list with children splitters
+ \param split - parent splitter
+ \param splitList - list to be filled with
+ \param rec - recursive search of children
+*/
void QtxWorkstack::splitters( QSplitter* split, QPtrList<QSplitter>& splitList, const bool rec ) const
{
if ( !split )
}
}
+/*!
+ Fills list with children areas
+ \param split - parent splitter
+ \param areaList - list to be filled with
+ \param rec - recursive search of children
+*/
void QtxWorkstack::areas( QSplitter* split, QPtrList<QtxWorkstackArea>& areaList, const bool rec ) const
{
if ( !split )
}
}
+/*!
+ \return active area
+*/
QtxWorkstackArea* QtxWorkstack::activeArea() const
{
return myArea;
}
+/*!
+ \return active area or current area or create new area of there is no one
+*/
QtxWorkstackArea* QtxWorkstack::targetArea()
{
QtxWorkstackArea* area = activeArea();
return area;
}
+/*!
+ \return current area (that has focus)
+*/
QtxWorkstackArea* QtxWorkstack::currentArea() const
{
QtxWorkstackArea* area = 0;
return area;
}
+/*!
+ Creates new area
+*/
QtxWorkstackArea* QtxWorkstack::createArea( QWidget* parent ) const
{
QtxWorkstackArea* area = new QtxWorkstackArea( parent );
return area;
}
+/*!
+ Sets area as active
+ \param area
+*/
void QtxWorkstack::setActiveArea( QtxWorkstackArea* area )
{
QWidget* oldCur = myWin;
emit windowActivated( myWin );
}
+/*!
+ \return neighbour area
+ \param area - area to search neighbour
+*/
QtxWorkstackArea* QtxWorkstack::neighbourArea( QtxWorkstackArea* area ) const
{
QPtrList<QtxWorkstackArea> lst;
return na;
}
+/*!
+ \return area covering point
+ \param p - point
+*/
QtxWorkstackArea* QtxWorkstack::areaAt( const QPoint& p ) const
{
QtxWorkstackArea* area = 0;
return area;
}
+/*!
+ Update
+*/
void QtxWorkstack::updateState()
{
updateState( mySplit );
}
+/*!
+ Update splitters
+*/
void QtxWorkstack::updateState( QSplitter* split )
{
QPtrList<QSplitter> recList;
split->hide();
}
+/*!
+ Gets splitter info for debug
+ \param split - splitter
+ \param info - string to be filled with info
+*/
void QtxWorkstack::splitterInfo( QSplitter* split, QString& info ) const
{
if ( !split )
}
-// cuts starting '(' symbol and ending '(' symbol
+//Cuts starting '(' symbol and ending '(' symbol
void cutBrackets( QString& parameters )
{
if ( !parameters.isEmpty() && parameters[0] == '(' && parameters[parameters.length()-1] == ')' )
parameters = parameters.mid( 1, parameters.length()-2 );
}
-// for strings like "(splitter orientation=0 children=2 sizes=332:478" returns values of
-// parameters. For example, getValue( example, "children" ) returns "2"
-// getValue( example, "sizes" ) returns "332:478"
+/*
+ for strings like "(splitter orientation=0 children=2 sizes=332:478" returns values of
+ parameters. For example, getValue( example, "children" ) returns "2"
+ getValue( example, "sizes" ) returns "332:478"
+*/
QString getValue( const QString& str, const QString& valName )
{
int i = str.find( valName );
return QString( "" );
}
-// checks format of splitter parameters string
+/*
+ checks format of splitter parameters string
+*/
bool checkFormat( const QString& parameters )
{
QString params( parameters );
return ok;
}
-// returns children of splitter in a list. Children are separated by '(' and ')' symbols
+/*
+ Returns children of splitter in a list. Children are separated by '(' and ')' symbols
+*/
QStringList getChildren( const QString& str )
{
QStringList lst;
return view;
}
-// installs a splitter described by given parameters string
+/*!
+ Installs a splitter described by given parameters string
+*/
void QtxWorkstack::setSplitter( QSplitter* splitter, const QString& parameters, QMap< QSplitter*, QValueList<int> >& sMap )
{
if ( !::checkFormat( parameters ) ) {
}
}
-// Restore workstack's configuration stored in 'parameters' string
+/*!
+ Restore workstack's configuration stored in 'parameters' string
+*/
QtxWorkstack& QtxWorkstack::operator<<( const QString& parameters )
{
// clear the main splitter - remove all child splitters and empty areas from it
return (*this);
}
-// Example of string produced by operator>> :
-// "(splitter orientation=0 sizes=186:624 (views active='OCCViewer_0_0' 'OCCViewer_0_0')
-// (views active='VTKViewer_0_0' 'VTKViewer_0_0'))"
+/*!
+ Example of string produced by operator>> :
+ "(splitter orientation=0 sizes=186:624 (views active='OCCViewer_0_0' 'OCCViewer_0_0')
+/ (views active='VTKViewer_0_0' 'VTKViewer_0_0'))"
QtxWorkstack& QtxWorkstack::operator>>( QString& outParameters )
{
splitterInfo( mySplit, outParameters );
/*!
- Class: QtxWorkstackArea [Internal]
- Descr:
+ Constructor
*/
-
QtxWorkstackArea::QtxWorkstackArea( QWidget* parent )
: QWidget( parent )
{
qApp->installEventFilter( this );
}
+/*!
+ Destructor
+*/
QtxWorkstackArea::~QtxWorkstackArea()
{
qApp->removeEventFilter( this );
}
+/*!
+ \return true if area is empty
+*/
bool QtxWorkstackArea::isEmpty() const
{
bool res = false;
return !res;
}
+/*!
+ Adds widget to area
+ \param wid - widget
+ \param idx - index
+*/
void QtxWorkstackArea::insertWidget( QWidget* wid, const int idx )
{
if ( !wid )
wid->setFocus();
}
+/*!
+ Creates and shows popup menu for area
+ \param p - popup position
+*/
void QtxWorkstackArea::onContextMenuRequested( QPoint p )
{
const QtxWorkstackTabBar* bar = ::qt_cast<const QtxWorkstackTabBar*>( sender() );
emit contextMenuRequested( wid, p );
}
+/*!
+ SLOT: called when widget added to area is destroyed, removes widget from area
+*/
void QtxWorkstackArea::onWidgetDestroyed()
{
if ( sender() )
removeWidget( (QWidget*)sender(), false );
}
+/*!
+ Removes widget from area
+ \param wid - widget
+ \param del - auto deleting
+*/
void QtxWorkstackArea::removeWidget( QWidget* wid, const bool del )
{
if ( !myList.contains( wid ) )
updateState();
}
+/*!
+ \return list of visible widgets
+*/
QWidgetList QtxWorkstackArea::widgetList() const
{
QWidgetList lst;
return lst;
}
+/*!
+ \return active widget
+*/
QWidget* QtxWorkstackArea::activeWidget() const
{
return widget( myBar->currentTab() );
}
+/*!
+ Sets widget as active
+ \param wid - widget
+*/
void QtxWorkstackArea::setActiveWidget( QWidget* wid )
{
myBar->setCurrentTab( widgetId( wid ) );
}
+/*!
+ \return true if area contains widget
+ \param wid - widget
+*/
bool QtxWorkstackArea::contains( QWidget* wid ) const
{
return myList.contains( wid );
}
+/*!
+ Shows area
+*/
void QtxWorkstackArea::show()
{
QMap<QWidget*, bool> map;
setBlocked( itr.current(), map.contains( itr.current() ) ? map[itr.current()] : false );
}
+/*!
+ Hides area
+*/
void QtxWorkstackArea::hide()
{
QMap<QWidget*, bool> map;
setBlocked( itr.current(), map.contains( itr.current() ) ? map[itr.current()] : false );
}
+/*!
+ \return true if area is active
+*/
bool QtxWorkstackArea::isActive() const
{
QtxWorkstack* ws = workstack();
return ws->activeArea() == this;
}
+/*!
+ Update active state of tab bar
+*/
void QtxWorkstackArea::updateActiveState()
{
myBar->setActive( isActive() );
}
+/*!
+ \return corresponding workstack
+*/
QtxWorkstack* QtxWorkstackArea::workstack() const
{
QtxWorkstack* ws = 0;
return ws;
}
+/*!
+ Custom event filter
+*/
bool QtxWorkstackArea::eventFilter( QObject* o, QEvent* e )
{
if ( o->isWidgetType() )
return false;
}
+/*!
+ \return rectangle of area in order to draw drop rectangle on area
+*/
QRect QtxWorkstackArea::floatRect() const
{
QRect r = myStack->geometry();
return QRect( mapToGlobal( r.topLeft() ), mapToGlobal( r.bottomRight() ) );
}
+/*!
+ \return rectangle of tab in order to draw drop rectangle on tab
+ \param idx - tab index
+*/
QRect QtxWorkstackArea::floatTab( const int idx ) const
{
return myBar->tabRect( idx );
}
+/*!
+ \return tab covering point
+ \param p - point
+*/
int QtxWorkstackArea::tabAt( const QPoint& p ) const
{
int idx = -1;
return idx;
}
+/*!
+ Event handler for custom events
+*/
void QtxWorkstackArea::customEvent( QCustomEvent* e )
{
switch ( e->type() )
}
}
+/*!
+ Custom focus in event handler
+*/
void QtxWorkstackArea::focusInEvent( QFocusEvent* e )
{
QWidget::focusInEvent( e );
emit activated( activeWidget() );
}
+/*!
+ Custom mouse press event handler
+*/
void QtxWorkstackArea::mousePressEvent( QMouseEvent* e )
{
QWidget::mousePressEvent( e );
emit activated( activeWidget() );
}
+/*!
+ SLOT: called if button close is pressed
+*/
void QtxWorkstackArea::onClose()
{
QWidget* wid = activeWidget();
wid->close();
}
+/*!
+ SLOT: called if tab page is selected
+*/
void QtxWorkstackArea::onSelected( int id )
{
updateCurrent();
emit activated( activeWidget() );
}
+/*!
+ SLOT: called if active tab page is dragged
+*/
void QtxWorkstackArea::onDragActiveTab()
{
QtxWorkstackChild* c = child( activeWidget() );
new QtxWorkstackDrag( workstack(), c );
}
+/*!
+ SLOT: called on child is destroyed, removes from area
+*/
void QtxWorkstackArea::onChildDestroyed( QObject* obj )
{
QtxWorkstackChild* child = (QtxWorkstackChild*)obj;
QApplication::postEvent( this, new QCustomEvent( (QEvent::Type)RemoveWidget, wid ) );
}
+/*!
+ SLOT: called on child is shown
+*/
void QtxWorkstackArea::onChildShown( QtxWorkstackChild* c )
{
setWidgetShown( c->widget(), true );
}
+/*!
+ SLOT: called on child is hidden
+*/
void QtxWorkstackArea::onChildHided( QtxWorkstackChild* c )
{
setWidgetShown( c->widget(), false );
}
+/*!
+ SLOT: called on child is activated
+*/
void QtxWorkstackArea::onChildActivated( QtxWorkstackChild* c )
{
setWidgetActive( c->widget() );
}
+/*!
+ SLOT: called on child caption is changed
+*/
void QtxWorkstackArea::onChildCaptionChanged( QtxWorkstackChild* c )
{
updateTab( c->widget() );
}
+/*!
+ Raises widget when active tab is changed
+*/
void QtxWorkstackArea::updateCurrent()
{
QMap<QWidget*, bool> map;
setBlocked( itr.current(), map.contains( itr.current() ) ? map[itr.current()] : false );
}
+/*!
+ Updates tab
+ \param wid - tab widget
+*/
void QtxWorkstackArea::updateTab( QWidget* wid )
{
QTab* tab = myBar->tab( widgetId( wid ) );
tab->setText( wid->caption() );
}
+/*!
+ \return widget
+ \param id - widget id
+*/
QWidget* QtxWorkstackArea::widget( const int id ) const
{
QWidget* wid = 0;
return wid;
}
+/*!
+ \return widget id
+ \param wid - widget
+*/
int QtxWorkstackArea::widgetId( QWidget* wid ) const
{
int id = -1;
return id;
}
+/*!
+ \return true if widget is visible
+ \param wid - widget
+*/
bool QtxWorkstackArea::widgetVisibility( QWidget* wid ) const
{
bool res = false;
return res;
}
+/*!
+ Sets widget as active
+ \param wid - widget
+*/
void QtxWorkstackArea::setWidgetActive( QWidget* wid )
{
int id = widgetId( wid );
myBar->setCurrentTab( id );
}
+/*!
+ Shows/hides widget
+ \param wid - widget
+ \param on - new shown state
+*/
void QtxWorkstackArea::setWidgetShown( QWidget* wid, const bool on )
{
if ( isBlocked( wid ) || !myInfo.contains( wid ) || myInfo[wid].vis == on )
updateState();
}
+/*!
+ Update
+*/
void QtxWorkstackArea::updateState()
{
bool updBar = myBar->isUpdatesEnabled();
}
}
+/*!
+ \return first unshared widget id
+*/
int QtxWorkstackArea::generateId() const
{
QMap<int, int> map;
return id;
}
+/*!
+ \return true if widget is blocked
+ \param wid - widget
+*/
bool QtxWorkstackArea::isBlocked( QWidget* wid ) const
{
return myBlock.contains( wid );
}
+/*!
+ Blocks widget
+ \param wid - widget
+ \param on - new blocked state
+*/
void QtxWorkstackArea::setBlocked( QWidget* wid, const bool on )
{
if ( on )
myBlock.remove( wid );
}
+/*!
+ \return child corresponding to widget
+ \param wid - widget
+*/
QtxWorkstackChild* QtxWorkstackArea::child( QWidget* wid ) const
{
QtxWorkstackChild* res = 0;
}
/*!
- Class: QtxWorkstackChild [Internal]
- Descr:
+ Constructor
*/
-
QtxWorkstackChild::QtxWorkstackChild( QWidget* wid, QWidget* parent )
: QHBox( parent ),
myWidget( wid )
connect( myWidget, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
}
+/*!
+ Destructor
+*/
QtxWorkstackChild::~QtxWorkstackChild()
{
qApp->removeEventFilter( this );
disconnect( widget(), SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) );
}
+/*!
+ \return corresponding widget
+*/
QWidget* QtxWorkstackChild::widget() const
{
return myWidget;
}
+/*!
+ Custom event filter
+*/
bool QtxWorkstackChild::eventFilter( QObject* o, QEvent* e )
{
if ( o->isWidgetType() )
return QHBox::eventFilter( o, e );
}
+/*!
+ SLOT: called on object is destroyed
+*/
void QtxWorkstackChild::onDestroyed( QObject* obj )
{
if ( obj != widget() )
deleteLater();
}
+/*!
+ Custom child event handler
+*/
void QtxWorkstackChild::childEvent( QChildEvent* e )
{
if ( e->type() == QEvent::ChildRemoved && e->child() == widget() )
}
/*!
- Class: QtxWorkstackTabBar [Internal]
- Descr:
+ Constructor
*/
-
QtxWorkstackTabBar::QtxWorkstackTabBar( QWidget* parent )
: QTabBar( parent ),
myId( -1 )
{
}
+/*!
+ Destructor
+*/
QtxWorkstackTabBar::~QtxWorkstackTabBar()
{
}
+/*!
+ Sets tab bar as active or inactive
+ \param on - new active state
+*/
void QtxWorkstackTabBar::setActive( const bool on )
{
QFont aFont = font();
update();
}
+/*!
+ \return tab rectangle
+ \param idx - tab index
+*/
QRect QtxWorkstackTabBar::tabRect( const int idx ) const
{
QRect r;
return r;
}
+/*!
+ Custom mouse move event handler
+*/
void QtxWorkstackTabBar::mouseMoveEvent( QMouseEvent* e )
{
if ( myId != -1 && !tab( myId )->rect().contains( e->pos() ) )
QTabBar::mouseMoveEvent( e );
}
+/*!
+ Custom mouse press event handler
+*/
void QtxWorkstackTabBar::mousePressEvent( QMouseEvent* e )
{
QTabBar::mousePressEvent( e );
myId = currentTab();
}
+/*!
+ Custom mouse release event handler
+*/
void QtxWorkstackTabBar::mouseReleaseEvent( QMouseEvent* e )
{
QTabBar::mouseReleaseEvent( e );
emit contextMenuRequested( e->globalPos() );
}
+/*!
+ Custom context menu event handler
+*/
void QtxWorkstackTabBar::contextMenuEvent( QContextMenuEvent* e )
{
if ( e->reason() != QContextMenuEvent::Mouse )
emit contextMenuRequested( e->globalPos() );
}
+/*!
+ Draws label of tab bar
+*/
void QtxWorkstackTabBar::paintLabel( QPainter* p, const QRect& br, QTab* t, bool has_focus ) const
{
if ( currentTab() != t->identifier() )
}
/*!
- Class: QtxWorkstackDrag [Internal]
- Descr:
+ Constructor
*/
-
QtxWorkstackDrag::QtxWorkstackDrag( QtxWorkstack* ws, QtxWorkstackChild* child )
: QObject( 0 ),
myWS( ws ),
qApp->installEventFilter( this );
}
+/*!
+ Destructor
+*/
QtxWorkstackDrag::~QtxWorkstackDrag()
{
qApp->removeEventFilter( this );
endDrawRect();
}
+/*!
+ Custom event filter
+*/
bool QtxWorkstackDrag::eventFilter( QObject*, QEvent* e )
{
switch ( e->type() )
return true;
}
+/*!
+ Updates internal field with widget-target for dropping
+ \param p - current point of dragging
+*/
void QtxWorkstackDrag::updateTarget( const QPoint& p )
{
int tab = -1;
setTarget( area, tab );
}
+/*!
+ \return target area for dropping by point
+ \param p - current point of dragging
+ \param tab - index of tab to dropping
+*/
QtxWorkstackArea* QtxWorkstackDrag::detectTarget( const QPoint& p, int& tab ) const
{
if ( p.isNull() )
return area;
}
+/*!
+ Changes target area for dropping
+ \param area - new target area
+ \param tab - tab index
+*/
void QtxWorkstackDrag::setTarget( QtxWorkstackArea* area, const int tab )
{
if ( !area || ( myArea == area && tab == myTab ) )
drawRect();
}
+/*!
+ Called on widget drop, inserts dropped widget to area
+*/
void QtxWorkstackDrag::dropWidget()
{
if ( myArea )
myArea->insertWidget( myChild->widget(), myTab );
}
+/*!
+ Draws float rect
+*/
void QtxWorkstackDrag::drawRect()
{
if ( !myPainter || !myArea )
myPainter->drawRect( tr );
}
+/*!
+ Deletes internal painter
+*/
void QtxWorkstackDrag::endDrawRect()
{
delete myPainter;
myPainter = 0;
}
+/*!
+ Initialize internal painter
+*/
void QtxWorkstackDrag::startDrawRect()
{
if ( myPainter )
#include <qpopupmenu.h>
#include <qwidgetlist.h>
+/*!
+ Constructor
+*/
QtxWorkstackAction::QtxWorkstackAction( QtxWorkstack* ws, QObject* parent, const char* name )
: QtxAction( tr( "Controls windows into workstack" ), tr( "Workstack management" ), 0, parent, name ),
myFlags( Standard ),
connect( myItem[HSplit], SIGNAL( activated() ), ws, SLOT( splitHorizontal() ) );
}
+/*!
+ Destructor
+*/
QtxWorkstackAction::~QtxWorkstackAction()
{
}
+/*!
+ \return corresponding workstack
+*/
QtxWorkstack* QtxWorkstackAction::workstack() const
{
return myWorkstack;
}
+/*!
+ \return set of action flags
+*/
int QtxWorkstackAction::items() const
{
return myFlags;
}
+/*!
+ Sets action flags
+ \param flags - new set of flags
+*/
void QtxWorkstackAction::setItems( const int flags )
{
if ( !flags || flags == myFlags || !( flags & Split ) )
myFlags = flags;
}
+/*!
+ \return true if action contains all flags
+ \param flags - new set of flags
+*/
bool QtxWorkstackAction::hasItems( const int flags ) const
{
return ( myFlags & flags ) == flags;
}
+/*!
+ \return accelerator of item
+ \param id - item id
+*/
int QtxWorkstackAction::accel( const int id ) const
{
int a = 0;
return a;
}
+/*!
+ \return icons of item
+ \param id - item id
+*/
QIconSet QtxWorkstackAction::iconSet( const int id ) const
{
QIconSet ico;
return ico;
}
+/*!
+ \return menu text of item
+ \param id - item id
+*/
QString QtxWorkstackAction::menuText( const int id ) const
{
QString txt;
return txt;
}
+/*!
+ \return status tip of item
+ \param id - item id
+*/
QString QtxWorkstackAction::statusTip( const int id ) const
{
QString txt;
return txt;
}
+/*!
+ Changes accelerator of item
+ \param id - item id
+ \param a - new accelerator
+*/
void QtxWorkstackAction::setAccel( const int id, const int a )
{
if ( myItem.contains( id ) )
myItem[id]->setAccel( a );
}
+/*!
+ Changes icons of item
+ \param id - item id
+ \param ico - new icons
+*/
void QtxWorkstackAction::setIconSet( const int id, const QIconSet& ico )
{
if ( myItem.contains( id ) )
myItem[id]->setIconSet( ico );
}
+/*!
+ Changes menu text of item
+ \param id - item id
+ \param txt - new menu text
+*/
void QtxWorkstackAction::setMenuText( const int id, const QString& txt )
{
if ( myItem.contains( id ) )
myItem[id]->setMenuText( txt );
}
+/*!
+ Changes status tip of item
+ \param id - item id
+ \param txt - new status tip
+*/
void QtxWorkstackAction::setStatusTip( const int id, const QString& txt )
{
if ( myItem.contains( id ) )
myItem[id]->setStatusTip( txt );
}
+/*!
+ Adds action to widget
+ \param wid - widget
+*/
bool QtxWorkstackAction::addTo( QWidget* wid )
{
return addTo( wid, -1 );
}
+/*!
+ Adds action to widget
+ \param wid - widget
+ \param idx - position
+*/
bool QtxWorkstackAction::addTo( QWidget* wid, const int idx )
{
if ( !wid || !wid->inherits( "QPopupMenu" ) )
return true;
}
+/*!
+ Removes action from widget
+ \param wid - widget
+*/
bool QtxWorkstackAction::removeFrom( QWidget* wid )
{
if ( !wid || !wid->inherits( "QPopupMenu" ) )
return true;
}
+/*!
+ Performs action
+ \param type - action type
+*/
void QtxWorkstackAction::perform( const int type )
{
switch ( type )
}
}
+/*!
+ SLOT: called just before the popup menu is displayed, updates popup
+*/
void QtxWorkstackAction::onAboutToShow()
{
const QObject* obj = sender();
updatePopup( (QPopupMenu*)obj );
}
+/*!
+ SLOT: called when popup menu is destroyed, removes it from menu
+*/
void QtxWorkstackAction::onPopupDestroyed( QObject* obj )
{
myMenu.remove( (QPopupMenu*)obj );
}
+/*!
+ Updates popup
+ \param pm - popup menu
+*/
void QtxWorkstackAction::checkPopup( QPopupMenu* pm )
{
if ( !myMenu.contains( pm ) )
}
}
+/*!
+ Clears and refills popup and updates state of actions
+ \param pm - popup menu
+*/
void QtxWorkstackAction::updatePopup( QPopupMenu* pm )
{
if ( !myMenu.contains( pm ) )
myItem[HSplit]->setEnabled( count > 1 );
}
+/*!
+ Clears popup
+ \param pm - popup menu
+*/
int QtxWorkstackAction::clearPopup( QPopupMenu* pm )
{
if ( !myMenu.contains( pm ) )
return idx;
}
+/*!
+ Fills popup with items
+ \param pm - popup menu
+ \param idx - position
+*/
void QtxWorkstackAction::fillPopup( QPopupMenu* pm, const int idx )
{
if ( !pm )
}
}
+/*!
+ SLOT: called when popup item corresponding to window is activated, activates window
+*/
void QtxWorkstackAction::onItemActivated( int idx )
{
QtxWorkstack* ws = workstack();
using namespace std;
+/*!
+ Constructor
+*/
HelpWindow::HelpWindow(QWidget* parent, const char* name )
: QMainWindow( parent, name, WType_TopLevel | WDestructiveClose )
{
#define SPACING_SIZE 6
#define MIN_SPIN_WIDTH 100
+/*!
+ Constructor
+*/
IntervalWindow::IntervalWindow ( QWidget* parent )
: QDialog( parent, "IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
{
END_OF("IntervalWindow constructor")
}
+
+/*!
+ Destructor
+*/
IntervalWindow::~IntervalWindow() {}
-/*
+
+/*!
Sets start interval size
*/
void IntervalWindow::setValue(const int size)
mySpinBox->setValue(size);
}
-/*
+/*!
Gets interval size
*/
int IntervalWindow::getValue()
return mySpinBox->value();
}
-/*
+/*!
gets a pointer to myButtonOk
*/
QPushButton* IntervalWindow::Ok()
return myButtonOk;
}
-/*
+/*!
gets a pointer to myButtonCancel
*/
QPushButton* IntervalWindow::Cancel()
END_OF("slotSelectRefresh");
}
+/*!
+ SLOT: called when button OK is clicked in interval window
+*/
void RegWidget::slotIntervalOk()
{
BEGIN_OF("slotIntervalOk");
-//======================================================================================================
-// File: ResourceExporter.cxx
-// Created: 27/06/05
-// Author: Vadim SANDLER
-// Copyright (C) CEA 2005
-//
-// This tool provides command-line interface allowing to modify user preferences.
-// The tool can be used by the compilation procedures in order to set default preferences for the module.
-//
-// Usage:
-// ResourceExporter <parameters-list>
-// Parameters have the following format:
-// '<section>:<name>=<new_value>' - to set <new_value> for the user
-// preference <name> from the <section> section;
-// '<section>:<name>+=<value>[|<separator>]' - the <value> is appended to the current value
-// of the preference <name> from the <section> section;
-// separator is used to concatenate old and new values,
-// by default comma (',') symbol is used
-// '-<section>:<name>' - to remove user preference <name> from the <section>
-// section. Note that only use preference file is
-// influenced, you may need to use '<section>:<name>=""'
-// option
-// The number of parameters is limeted only by maximum possible length of the command line.
-//======================================================================================================
+/*!
+ File: ResourceExporter.cxx
+ Created: 27/06/05
+ Author: Vadim SANDLER
+ Copyright (C) CEA 2005
+
+ This tool provides command-line interface allowing to modify user preferences.
+ The tool can be used by the compilation procedures in order to set default preferences for the module.
+
+ Usage:
+ ResourceExporter <parameters-list>
+ Parameters have the following format:
+ '<section>:<name>=<new_value>' - to set <new_value> for the user
+ preference <name> from the <section> section;
+ '<section>:<name>+=<value>[|<separator>]' - the <value> is appended to the current value
+ of the preference <name> from the <section> section;
+ separator is used to concatenate old and new values,
+ by default comma (',') symbol is used
+ '-<section>:<name>' - to remove user preference <name> from the <section>
+ section. Note that only use preference file is
+ influenced, you may need to use '<section>:<name>=""'
+ option
+ The number of parameters is limeted only by maximum possible length of the command line.
+*/
#include "SUIT_ResourceMgr.h"
#include <qfile.h>
#include <qapplication.h>
#include <iostream>
-//============================================================
-// salomeVersion(): get the SALOME version number
-//============================================================
+/*!
+ \return the SALOME version number
+*/
static QString salomeVersion()
{
QString path( ::getenv( "GUI_ROOT_DIR" ) );
return ver;
}
-//============================================================
-// help(): print the help information
-//============================================================
+/*!
+ print the help information
+*/
static void help()
{
std::cout << "" << std::endl;
std::cout << "" << std::endl;
}
-//============================================================
-// main(): application main() function
-//============================================================
+/*!
+ application main() function
+*/
int main( int argc, char** argv )
{
QApplication app( argc, argv );
//
// See http://www.salome-platform.org/
//
-//=============================================================================
-// File : SALOME_PYQT_Module.cxx
-// Created : 25/04/05
-// Author : Vadim SANDLER
-// Project : SALOME
-// Copyright : 2003-2005 CEA/DEN, EDF R&D
-// $Header : $
-//=============================================================================
#include "SALOME_PYQT_Module.h"
using namespace std;
-///////////////////////////////////////////////////////////////////////////////
-// Default name of the module, replaced at the moment of module creation
+/*!
+ \var __DEFAULT_NAME__ - Default name of the module, replaced at the moment of module creation
+*/
const char* __DEFAULT_NAME__ = "SALOME_PYQT_Module";
-///////////////////////////////////////////////////////////////////////////////
-// Default menu group number
+/*!
+ \var __DEFAULT_GROUP__ - Default menu group number
+*/
const int __DEFAULT_GROUP__ = 40;
-///////////////////////////////////////////////////////////////////////////////
// If __CALL_OLD_METHODS__ macro is not defined the invoking of obsolete Python
// module's methods like setSetting(), definePopup(), etc. is blocked.
// This macro is defined by default (in Makefile)
const bool IsCallOldMethods = false;
#endif
-///////////////////////////////////////////////////////////////////////////////
// NB: Python requests.
// General rule for Python requests created by SALOME_PYQT_Module:
// all requests should be executed SYNCHRONOUSLY within the main GUI thread.
// However, it is obligatory that ANY Python call is wrapped with a request object,
// so that ALL Python API calls are serialized with PyInterp_Dispatcher.
-///////////////////////////////////////////////////////////////////////////////
-//=============================================================================
-// The class for parsing of the XML resource files.
-// Used for backward compatibility with existing Python modules.
-//=============================================================================
+/*!
+ \class SALOME_PYQT_XmlHandler
+ The class for parsing of the XML resource files.
+ Used for backward compatibility with existing Python modules.
+*/
class SALOME_PYQT_XmlHandler
{
public:
bool myMenuCreated;
};
-//=============================================================================
// SALOME_PYQT_Module class implementation (implements CAM_Module API for
// all Python-based SALOME module
-//=============================================================================
// While the SalomePyQtGUI library is not imported in Python it's initialization function
// should be called manually (and only once) in order to initialize global sip data
* Also these methods are used to register created from outside menus
* in order to enable dynamic menus handling.
*/
+
+
+/*! Create tool bar with name \a name, if it was't created before.
+ * \retval -1 - if tool manager was't be created.
+ */
int SALOME_PYQT_Module::createTool( const QString& name )
{
return SalomeApp_Module::createTool( name );
}
+/*! Create tool.
+ * Insert QAction with id \a id from action map(myActionMap) to tool manager.
+ *\param id - integer
+ *\param tBar - integer
+ *\param idx - integer
+ *\retval integer id of new action in tool manager.
+ *\retval Return -1 if something wrong.
+ */
int SALOME_PYQT_Module::createTool( const int id, const int tBar, const int idx )
{
return SalomeApp_Module::createTool( id, tBar, idx );
}
+/*! Create tool.
+ * Insert QAction with id \a id from action map(myActionMap) to tool manager.
+ *\param id - integer
+ *\param tBar - QString&
+ *\param idx - integer
+ *\retval integer id of new action in tool manager.
+ *\retval Return -1 if something wrong.
+ */
int SALOME_PYQT_Module::createTool( const int id, const QString& tBar, const int idx )
{
return SalomeApp_Module::createTool( id, tBar, idx );
}
+/*! Create tool. Register action \a a with id \a id.
+ * Insert QAction to tool manager.
+ *\param a - QAction
+ *\param tBar - integer
+ *\param id - integer
+ *\param idx - integer
+ *\retval integer id of new action in tool manager.
+ *\retval Return -1 if something wrong.
+ */
int SALOME_PYQT_Module::createTool( QAction* a, const int tBar, const int id, const int idx )
{
return SalomeApp_Module::createTool( a, tBar, id, idx );
}
+/*! Create tool. Register action \a a with id \a id.
+ * Insert QAction to tool manager.
+ *\param a - QAction
+ *\param tBar - QString&
+ *\param id - integer
+ *\param idx - integer
+ *\retval integer id of new action in tool manager.
+ *\retval Return -1 if something wrong.
+ */
int SALOME_PYQT_Module::createTool( QAction* a, const QString& tBar, const int id, const int idx )
{
return SalomeApp_Module::createTool( a, tBar, id, idx );
}
+
int SALOME_PYQT_Module::createMenu( const QString& subMenu, const int menu, const int id, const int group, const int idx, const bool constantMenu )
{
bool exists = hasMenu( subMenu, menu );
registerMenu( regId, menu, constantMenu );
return regId;
}
+
int SALOME_PYQT_Module::createMenu( const QString& subMenu, const QString& menu, const int id, const int group, const int idx, const bool constantMenu )
{
QStringList menus = QStringList::split( "|", menu, false );
pid = createMenu( subMenu, pid, id, group, idx, constantMenu );
return pid;
}
+
int SALOME_PYQT_Module::createMenu( const int id, const int menu, const int group, const int idx, const bool constantMenu )
{
int regId = SalomeApp_Module::createMenu( id, menu, group, idx );
registerMenu( regId, menu, constantMenu );
return regId;
}
+
int SALOME_PYQT_Module::createMenu( const int id, const QString& menu, const int group, const int idx, const bool constantMenu )
{
QStringList menus = QStringList::split( "|", menu, false );
pid = createMenu( id, pid, group, idx, constantMenu );
return pid;
}
+
int SALOME_PYQT_Module::createMenu( QAction* a, const int menu, const int id, const int group, const int idx, const bool constantMenu )
{
int regId = SalomeApp_Module::createMenu( a, menu, id, group, idx );
registerMenu( regId, menu, constantMenu );
return regId;
}
+
int SALOME_PYQT_Module::createMenu( QAction* a, const QString& menu, const int id, const int group, const int idx, const bool constantMenu )
{
QStringList menus = QStringList::split( "|", menu, false );
pid = createMenu( a, pid, id, group, idx, constantMenu );
return pid;
}
+
QAction* SALOME_PYQT_Module::createSeparator()
{
return SalomeApp_Module::separator();
}
+
QAction* SALOME_PYQT_Module::action( const int id ) const
{
return SalomeApp_Module::action( id );
}
+
int SALOME_PYQT_Module::actionId( const QAction* a ) const
{
return SalomeApp_Module::actionId( a );
}
+
QAction* SALOME_PYQT_Module::createAction( const int id, const QString& text, const QString& icon,
const QString& menu, const QString& tip, const int key,
const bool toggle )
return false;
}
-//=============================================================================
// SALOME_PYQT_XmlHandler class implementation
-//=============================================================================
// gets an tag name for the dom element [ static ]
// returns an empty string if the element does not have tag name
//
// See http://www.salome-platform.org/
//
-//=============================================================================
-// File : SALOME_PYQT_Module.h
-// Created : 25/04/05
-// Author : Vadim SANDLER
-// Project : SALOME
-// Copyright : 2003-2005 CEA/DEN, EDF R&D
-// $Header : $
-//=============================================================================
#ifndef SALOME_PYQT_MODULE_H
#define SALOME_PYQT_MODULE_H
//
// See http://www.salome-platform.org/
//
-//=============================================================================
-// File : SALOME_PYQT_PyInterp.h
-// Created : 25/04/05
-// Author : Christian CAREMOLI, Paul RASCLE, EDF
-// Project : SALOME
-// Copyright : 2003-2005 CEA/DEN, EDF R&D
-// $Header : $
-//=============================================================================
#ifndef SALOME_PYQT_PYINTERP_H
#define SALOME_PYQT_PYINTERP_H
//
// See http://www.salome-platform.org/
//
-//=============================================================================
-// File : SalomePyQt.cxx
-// Created : 25/04/05
-// Author : Vadim SANDLER
-// Project : SALOME
-// Copyright : 2003-2005 CEA/DEN, EDF R&D
-// $Header : $
-//=============================================================================
#include "SALOME_PYQT_Module.h" // this include must be first!!!
#include "SalomePyQt.h"
using namespace std;
-//====================================================================================
-// static functions
-//====================================================================================
/*!
- getApplication()
- Returns active application object [ static ]
+ \return active application object [ static ]
*/
static SalomeApp_Application* getApplication() {
if ( SUIT_Session::session() )
}
/*!
- getActiveStudy()
- Gets active study or 0 if there is no study opened [ static ]
+ \return active study or 0 if there is no study opened [ static ]
*/
static SalomeApp_Study* getActiveStudy()
{
return 0;
}
-//====================================================================================
-// SALOME_Selection class.
-//====================================================================================
static QMap<SalomeApp_Application*, SALOME_Selection*> SelMap;
/*!
- SALOME_Selection::GetSelection
Creates or finds the selection object (one per study).
*/
SALOME_Selection* SALOME_Selection::GetSelection( SalomeApp_Application* app )
}
/*!
- SALOME_Selection::SALOME_Selection
Selection constructor.
*/
SALOME_Selection::SALOME_Selection( QObject* p ) : QObject( p ), mySelMgr( 0 )
}
}
/*!
- SALOME_Selection::~SALOME_Selection
Selection destructor. Removes selection object from the map.
*/
SALOME_Selection::~SALOME_Selection()
}
/*!
- SALOME_Selection::onSelMgrDestroyed
Watches for the selection manager destroying when study is closed.
*/
void SALOME_Selection::onSelMgrDestroyed()
}
/*!
- SALOME_Selection::Clear
Clears the selection.
*/
void SALOME_Selection::Clear()
}
/*!
- SALOME_Selection::ClearIObjects
Clears the selection.
*/
void SALOME_Selection::ClearIObjects()
}
/*!
- SALOME_Selection::ClearFilters
Removes all selection filters.
*/
void SALOME_Selection::ClearFilters()
ProcessVoidEvent( new TEvent( mySelMgr ) );
}
-//====================================================================================
-// SalomePyQt class
-//====================================================================================
-
/*!
- SalomePyQt::getDesktop
- Gets desktop. Returns 0 in error.
+ \return desktop (0 if error)
*/
class TGetDesktopEvent: public SALOME_Event {
public:
myResult = (QWidget*)( getApplication()->desktop() );
}
};
+
+/*!
+ \return desktop
+*/
QWidget* SalomePyQt::getDesktop()
{
return ProcessEvent( new TGetDesktopEvent() );
}
/*!
- SalomePyQt::getMainFrame
- Gets workspace widget. Returns 0 in error.
+ \return workspace widget (0 if error)
*/
class TGetMainFrameEvent: public SALOME_Event {
public:
}
}
};
+
+/*!
+ \return workspace widget (0 if error)
+*/
QWidget* SalomePyQt::getMainFrame()
{
return ProcessEvent( new TGetMainFrameEvent() );
}
}
};
+
+/*!
+ \return main menu
+ \retval 0 in error.
+*/
QMenuBar* SalomePyQt::getMainMenuBar()
{
return ProcessEvent( new TGetMainMenuBarEvent() );
}
}
};
+
+/*!
+ \return popup menu
+ \param menu - menu name
+*/
QPopupMenu* SalomePyQt::getPopupMenu( const MenuName menu )
{
return ProcessEvent( new TGetPopupMenuEvent( menu ) );
}
}
};
+
+/*!
+ SalomePyQt::getStudyId
+ Returns active study's ID or 0 if there is no active study.
+*/
int SalomePyQt::getStudyId()
{
return ProcessEvent( new TGetStudyIdEvent() );
myResult = SALOME_Selection::GetSelection( getApplication() );
}
};
+
+/*!
+ Creates a Selection object (to provide a compatibility with previous SALOME GUI).
+ \return just created selection object
+*/
SALOME_Selection* SalomePyQt::getSelection()
{
return ProcessEvent( new TGetSelectionEvent() );
}
}
};
+
+/*!
+ Puts an information message to the desktop's status bar
+ (with optional delay parameter given in seconds)
+ \param msg - message text
+ \param sec - delay in seconds
+*/
void SalomePyQt::putInfo( const QString& msg, const int sec )
{
ProcessVoidEvent( new TPutInfoEvent( msg, sec ) );
}
}
};
+
+/*!
+ \return an active component name or empty string if there is no active component
+*/
const QString SalomePyQt::getActiveComponent()
{
return ProcessEvent( new TGetActiveComponentEvent() );
}
}
};
+
+/*!
+ \return a setting value (as string)
+ This function is obsolete. Use stringSetting(), integerSetting(),
+ boolSetting(), stringSetting() or colorSetting() instead.
+*/
QString SalomePyQt::getSetting( const QString& name )
{
return ProcessEvent( new TGetSettingEvent( name ) );
}
}
};
+
+/*!
+ \return an integer setting from the application preferences
+*/
int SalomePyQt::integerSetting( const QString& section, const QString& name, const int def )
{
return ProcessEvent( new TGetIntSettingEvent( section, name, def ) );
}
}
};
+
+/*!
+ \return an double setting from the application preferences
+*/
double SalomePyQt::doubleSetting( const QString& section, const QString& name, const int def )
{
return ProcessEvent( new TGetDblSettingEvent( section, name, def ) );
}
}
};
+
+/*!
+ \return an boolean setting from the application preferences
+*/
bool SalomePyQt::boolSetting( const QString& section, const QString& name, const bool def )
{
return ProcessEvent( new TGetBoolSettingEvent( section, name, def ) );
}
}
};
+
+/*!
+ \return an string setting from the application preferences
+*/
QString SalomePyQt::stringSetting( const QString& section, const QString& name, const QString& def )
{
return ProcessEvent( new TGetStrSettingEvent( section, name, def ) );
}
}
};
+
+/*!
+ \return a color setting from the application preferences
+*/
QColor SalomePyQt::colorSetting ( const QString& section, const QString& name, const QColor& def )
{
return ProcessEvent( new TGetColorSettingEvent( section, name, def ) );
}
}
};
+
+/*!
+ Displays 'Open/Save file' dialog box and returns a user's choice (file name)
+*/
QString SalomePyQt::getFileName( QWidget* parent,
const QString& initial,
const QStringList& filters,
}
}
};
+
+/*!
+ Displays 'Open files' dialog box and returns a user's choice (a list of file names)
+*/
QStringList SalomePyQt::getOpenFileNames( QWidget* parent,
const QString& initial,
const QStringList& filters,
}
}
};
+
+/*!
+ Displays 'Get Directory' dialog box and returns a user's choice (a directory name)
+*/
QString SalomePyQt::getExistingDirectory( QWidget* parent,
const QString& initial,
const QString& caption )
}
}
};
+
+/*!
+ Dumps the contents of the currently active view to the image file
+ in the given format (JPEG, PNG, BMP are supported)
+*/
bool SalomePyQt::dumpView( const QString& filename )
{
return ProcessEvent( new TDumpViewEvent( filename ) );
myResult = SALOME_PYQT_Module::defaultMenuGroup();
}
};
+
+/*!
+ \return default menu group
+*/
int SalomePyQt::defaultMenuGroup()
{
return ProcessEvent( new TDefMenuGroupEvent() );
}
}
};
-// create new toolbar or get existing by name
+
+/*!
+ create new toolbar or get existing by name
+*/
int SalomePyQt::createTool( const QString& tBar )
{
return ProcessEvent( new TCreateToolEvent( CrTool( tBar ) ) );
}
-// add action with id and index to the existing tollbar
+/*! add action with id and index to the existing tollbar
+*/
int SalomePyQt::createTool( const int id, const int tBar, const int idx )
{
return ProcessEvent( new TCreateToolEvent( CrTool( id, tBar, idx ) ) );
}
-// add action with id and index to the existing tollbar
+/*! add action with id and index to the existing tollbar
+*/
int SalomePyQt::createTool( const int id, const QString& tBar, const int idx )
{
return ProcessEvent( new TCreateToolEvent( CrTool( id, tBar, idx ) ) );
}
-// add action with id and index to the existing tollbar
+/*! add action with id and index to the existing tollbar
+*/
int SalomePyQt::createTool( QtxAction* a, const int tBar, const int id, const int idx )
{
return ProcessEvent( new TCreateToolEvent( CrTool( a, tBar, id, idx ) ) );
}
-// add action with id and index to the existing tollbar
+/*! add action with id and index to the existing tollbar
+*/
int SalomePyQt::createTool( QtxAction* a, const QString& tBar, const int id, const int idx )
{
return ProcessEvent( new TCreateToolEvent( CrTool( a, tBar, id, idx ) ) );
//
// See http://www.salome-platform.org/
//
-//=============================================================================
-// File : SalomePyQt.h
-// Created : 25/04/05
-// Author : Vadim SANDLER
-// Project : SALOME
-// Copyright : 2003-2005 CEA/DEN, EDF R&D
-// $Header : $
-//=============================================================================
#ifndef SALOME_PYQT_H
#define SALOME_PYQT_H
/*!
Display presentation
+ \param prs - presentation
*/
void SOCC_Viewer::Display( const SALOME_OCCPrs* prs )
{
/*!
Erase presentation
+ \param prs - presentation
+ \param forced - removes object from context
*/
void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool forced )
{
/*!
Erase all presentations
+ \param forced - removes all objects from context
*/
void SOCC_Viewer::EraseAll( const bool forced )
{
/*!
Create presentation corresponding to the entry
+ \param entry - entry
*/
SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry )
{
return QFileDialog::getExistingDirectory( initial, parent, 0, caption, true );
}
+/*!
+ Changes desktop
+ \param desk - new desktop
+*/
void STD_Application::setDesktop( SUIT_Desktop* desk )
{
SUIT_Desktop* prev = desktop();
{
}
+/*!
+ Custom activity after study is created
+ Updates desktop and actions
+*/
void STD_Application::studyCreated( SUIT_Study* )
{
updateDesktopTitle();
updateCommandsStatus();
}
+/*!
+ Custom activity after study is opened
+ Updates desktop and actions
+*/
void STD_Application::studyOpened( SUIT_Study* )
{
updateDesktopTitle();
updateCommandsStatus();
}
+/*!
+ Custom activity after study is opened
+ Updates desktop and actions
+*/
void STD_Application::studySaved( SUIT_Study* )
{
updateDesktopTitle();
connect( m_pb4, SIGNAL( clicked() ), this, SLOT( reject() ) );
}
-//================================================================================
/*!
* \brief reaction on clicked(pressed) button
*/
-//================================================================================
-
void STD_CloseDlg::onButtonClicked()
{
QPushButton* btn = ( QPushButton* )sender();
#include <qnamespace.h>
-/*!\class SUIT_Accel
- * Class handles keyboard accelerator bindings.
- */
SUIT_Accel* SUIT_Accel::myself = 0;
/*! Constructor [private].*/
#include <qstring.h>
#include <qmap.h>
+/*!
+ \class SUIT_Accel
+ Manager of keyboard accelerator bindings
+*/
class SUIT_EXPORT SUIT_Accel: public QObject
{
Q_OBJECT
#endif
/*!
- Class provide support data object.
+ \class SUIT_DataObject
+ Data Object represents uniform data tree structure recommended to use in SUIT-based applications
+ Many of standard classes (DataModel,ObjectBrowser) deal with SUIT_DataObjects
*/
class SUIT_EXPORT SUIT_DataObject
{
friend class SUIT_DataObjectIterator;
};
+/*!
+ \class SUIT_DataObject::Signal
+ Auxiliary class providing functionality to use signals of data object state change
+ SUIT_DataObject cannot have signals, because it isn't QObject, but
+ methods connect/disconnect of SUIT_DataObject with help of this it is possible
+ to emulate Qt signal processing
+*/
class SUIT_DataObject::Signal : public QObject
{
Q_OBJECT
#include "SUIT_DataObject.h"
/*!
- Class provide data object iterator.
+ \class SUIT_DataObjectIterator
+ Provides functionality of SUIT tree detour
+ It is possible to use "to-depth" or "to-breadth" detour and
+ to control level detour (from left or from right)
*/
class SUIT_EXPORT SUIT_DataObjectIterator
{
int myDetourType, myCurrentLevel;
};
+/*!
+ \class SUIT_DataObjectIterator
+ Provides functionality of SUIT tree detour between certain levels
+ Only "to-breadth" detour is used
+*/
class SUIT_DataObjectLevelIterator : public SUIT_DataObjectIterator
{
public:
#pragma warning( disable:4275 )
#endif
+/*!
+ \class SUIT_DataOwner
+ Represents abstract selected objects.
+ Used for selection synchronizing between windows(e.g. ObjectBrowser) and viewers
+*/
+
class SUIT_EXPORT SUIT_DataOwner : public RefCount
{
public:
class QtxActionMenuMgr;
class QtxActionToolMgr;
+/*!
+ \class SUIT_Desktop
+ Provides standard desktop: main window with
+ main menu manager, toolbars manager and logo.
+*/
class SUIT_EXPORT SUIT_Desktop : public QtxMainWindow
{
Q_OBJECT
#include <qwidget.h>
#include "SUIT.h"
+/*!
+ \class SUIT_FileValidator
+ Provides functionality to check file
+*/
class SUIT_EXPORT SUIT_FileValidator
{
public:
class SUIT_SelectionMgr;
class SUIT_DataOwnerPtrList;
+/*!
+ \class SUIT_Selector
+ Base class for all selectors used in SUIT-based applications.
+ Provides functionality to get/set selection from/into some widget
+ (ObjectBrowser, viewers, etc)
+ Used by selection manager for selection synhronizing
+*/
class SUIT_EXPORT SUIT_Selector : public QObject
{
Q_OBJECT
#include <qfont.h>
#include <qstring.h>
+/*!
+ \class SUIT_Tools
+ Prodives set of auxiliary static methods
+*/
class SUIT_EXPORT SUIT_Tools : public Qtx
{
public:
#include <qptrlist.h>
#include <qvaluelist.h>
+/*!
+ \struct DiffItem
+ \brief Struct representing difference between items
+*/
template <class SrcItem, class TrgItem>
struct DiffItem
{
- SrcItem mySrc; //if it is null, then this item is to deleted
- TrgItem myTrg; //if it is null, then this item is to added
- //if both fields aren't null, then this item is to update
+ SrcItem mySrc;
+ /*!
+ \var mySrc
+ if it is null, then this item is to deleted
+ */
+ TrgItem myTrg;
+ /*!
+ \var myTrg
+ if it is null, then this item is to added
+ if both fields aren't null, then this item is to update
+ */
};
+/*!
+ \brief synchronizes two trees
+*/
template <class SrcItem, class TrgItem, class TreeData>
TrgItem synchronize( const SrcItem&, const TrgItem&, const TreeData& );
+/*!
+ \brief compares children
+*/
template <class SrcItem, class TrgItem, class TreeData>
void diffSiblings( const SrcItem&, const TrgItem&,
QValueList < DiffItem < SrcItem,TrgItem > >&,
const TreeData& );
+/*!
+ \brief create item with children (subtree)
+*/
template <class SrcItem, class TrgItem, class TreeData>
TrgItem createSubTree( const SrcItem&, const TrgItem&, const TrgItem&, const bool, const TreeData& );
+/*!
+ \brief find equal element in list
+*/
template <class SrcItem, class TrgItem, class TreeData>
const typename QValueList<TrgItem>::const_iterator findEqual( const QValueList<TrgItem>& l,
const typename QValueList<TrgItem>::const_iterator& first,
-
-//int gSync = 0;
+/*!
+ Synchronizes two trees by comparing corresponding items
+ \param r1 - start item from first tree
+ \param r2 - start item from second tree
+ \param td - auxiliary class providing following methods:
+ <ul>
+ <li> bool isEqual( const SrcItem&, const TrgItem& ) const - returns true if items are equal
+ <li> SrcItem nullSrc() const - returns null SrcItem
+ <li> TrgItem nullTrg() const - returns null TrgItem
+ <li> TrgItem createItem(
+ <ol>
+ <li> const SrcItem& src, - corresponding SrcItem
+ <li> const TrgItem& parent, - parent TrgItem
+ <li> const TrgItem& after, - TrgItem after that new item must be added
+ <li> const bool prepend - whether new item must be added as first
+ </ol>
+ ) const - creates new TrgItem
+ <li> void updateItem( const TrgItem& ) const - updates TrgItem without recreation
+ <li> void deleteItemWithChildren( const TrgItem& ) const - deletes TrgItem with all children
+ <li> void children( const SrcItem&, QValueList<SrcItem>& ) const - fills list with children
+ <li> void children( const TrgItem&, QValueList<TrgItem>& ) const - fills list with children
+ <li> SrcItem parent( const SrcItem& ) const - return parent SrcItem
+ <li> TrgItem parent( const TrgItem& ) const - return parent SrcItem
+ </ul>
+*/
template <class SrcItem, class TrgItem, class TreeData>
TrgItem synchronize( const SrcItem& r1, const TrgItem& r2, const TreeData& td )
{
}
}
+/*!
+ Finds equal element in list
+ \return iterator
+ \param l - list to search
+ \param first - start iterator
+ \param it - item to be found
+ \param td - tree data object (provides auxiliary methods)
+*/
template <class SrcItem, class TrgItem, class TreeData>
const typename QValueList<TrgItem>::const_iterator findEqual( const QValueList<TrgItem>& l,
const typename QValueList<TrgItem>::const_iterator& first,
return last;
}
+/*!
+ Compares children of objects src and trg
+ \param src - SrcItem to be checked
+ \param trg - TrgItem to be checked
+ \param d - map of difference to be filled
+ \param td - tree data object (provides auxiliary methods)
+*/
template <class SrcItem, class TrgItem, class TreeData>
void diffSiblings( const SrcItem& src, const TrgItem& trg,
QValueList < DiffItem < SrcItem,TrgItem > >& d,
}
}
+/*!
+ Creates sub-tree
+ \return root of just created sub-tree
+ \param src - corresponding SrcItem
+ \param parent - parent of new TrgItem
+ \param after - TrgItem, after that new item must be added
+ \param asFirst - true if TrgItem must be added as first
+ \param td - tree data object (provides auxiliary methods)
+*/
template <class SrcItem, class TrgItem, class TreeData>
TrgItem createSubTree( const SrcItem& src, const TrgItem& parent,
const TrgItem& after, const bool asFirst,
using namespace std;
+/*!
+ Creates view
+*/
SUIT_ViewWindow* SUPERVGraph::createView(SUIT_Desktop* parent)
{
return new SUPERVGraph_ViewFrame( parent/*, "vtkView"*/ );
extern "C"
{
+ /*!
+ Creates view
+ */
SUIT_ViewWindow* createView(SUIT_Desktop* parent)
{
return SUPERVGraph::createView(parent);
using namespace std;
+/*!
+ Constructor
+*/
SUPERVGraph_View::SUPERVGraph_View( QWidget* theParent ): QWidget( theParent )
{
init(theParent);
}
+/*!
+ Constructor
+*/
SUPERVGraph_View::SUPERVGraph_View( SUPERVGraph_View* theParent ): QWidget( theParent )
{
init(theParent);
}
+/*!
+ Builds popup for SUPERVGraph viewer
+*/
void SUPERVGraph_View::contextMenuPopup( QPopupMenu* )
{
// to be implemented
}
+/*!
+ Initialization
+*/
void SUPERVGraph_View::init( QWidget* theParent )
{
if ( theParent->inherits( "QMainWindow" ) ) {
createToolBar();
}
+/*!
+ Creates actions of SUPERVGraph view window
+*/
void SUPERVGraph_ViewFrame::createActions()
{
if (!myActionsMap.isEmpty()) return;
myActionsMap[ ResetId ] = aAction;
}
-//================================================================
-// Function : createToolBar
-// Purpose :
-//================================================================
+/*!
+ Creates toolbar of SUPERVGraph view window
+*/
void SUPERVGraph_ViewFrame::createToolBar()
{
myActionsMap[PanId]->addTo(myToolBar);
myActionsMap[ResetId]->addTo(myToolBar);
}
+/*!
+ Destructor
+*/
SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame() {}
/*!
}
+/*!
+ Sets new view widget
+ \param theView - new view widget
+*/
void SUPERVGraph_ViewFrame::setViewWidget( SUPERVGraph_View* theView )
{
myView = theView;
return QMainWindow::backgroundColor();
}
+/*!
+*/
void SUPERVGraph_ViewFrame::onAdjustTrihedron()
{
// MESSAGE ( "SUPERVGraph_ViewFrame::onAdjustTrihedron" )
}
+/*!
+ Changes name of object
+ \param obj - object to be renamed
+ \param name - new name
+*/
void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject,
QString newName )
{
// MESSAGE ( "SUPERVGraph_ViewFrame::rename" )
}
+/*!
+ Unhilights all object in viewer
+ \param updateviewer - update current viewer
+*/
void SUPERVGraph_ViewFrame::unHighlightAll()
{
// MESSAGE ( "SUPERVGraph_ViewFrame::unHighlightAll" )
}
+/*!
+ Hilights/unhilights object in viewer
+ \param obj - object to be updated
+ \param hilight - if it is true, object will be hilighted, otherwise it will be unhilighted
+ \param update - update current viewer
+*/
void SUPERVGraph_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject,
bool highlight, bool immediatly )
{
// MESSAGE ( "SUPERVGraph_ViewFrame::highlight" )
}
+/*!
+ \return true if object is in viewer or in collector
+ \param obj - object to be checked
+ \param onlyInViewer - search object only in viewer (so object must be displayed)
+*/
bool SUPERVGraph_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject )
{
// MESSAGE ( "SUPERVGraph_ViewFrame::isInViewer" )
return false;
}
+/*!
+ \return true if object is displayed in viewer
+ \param obj - object to be checked
+*/
bool SUPERVGraph_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject )
{
// MESSAGE ( "SUPERVGraph_ViewFrame::isVisible" )
return false;
}
+/*!
+ Custom resize event handler
+*/
void SUPERVGraph_ViewFrame::resizeEvent( QResizeEvent* theEvent )
{
QMainWindow::resizeEvent( theEvent );
int SUPERVGraph_ViewManager::myMaxId = 0;
+/*!
+ Constructor
+*/
SUPERVGraph_ViewManager::SUPERVGraph_ViewManager( SUIT_Study* theStudy,
SUIT_Desktop* theDesktop,
SUIT_ViewModel* theViewModel )
myId = ++myMaxId;
}
+/*!
+ Destructor
+*/
SUPERVGraph_ViewManager::~SUPERVGraph_ViewManager()
{
}
+/*!
+ Sets view name
+ \param theView - view to assign name
+*/
void SUPERVGraph_ViewManager::setViewName(SUIT_ViewWindow* theView)
{
int aPos = myViews.find(theView);
theView->setCaption( QString( "SUPERVISION scene:%1 - viewer:%2" ).arg( myId ).arg(aPos+1));
}
+/*!
+ Fills popup menu with custom actions
+ \param popup - popup menu to be filled with
+*/
void SUPERVGraph_ViewManager::contextMenuPopup( QPopupMenu* thePopup)
{
SUIT_ViewManager::contextMenuPopup( thePopup );
#include "SUIT_Desktop.h"
#include "SUIT_ViewWindow.h"
+/*!
+ Constructor
+*/
SUPERVGraph_Viewer::SUPERVGraph_Viewer()
:SUIT_ViewModel()
{
}
+/*!
+ Destructor
+*/
SUPERVGraph_Viewer::~SUPERVGraph_Viewer()
{
}
+/*!
+ Creates new view window
+ \param theDesktop - main window of application
+*/
SUIT_ViewWindow* SUPERVGraph_Viewer::createView(SUIT_Desktop* theDesktop)
{
SUPERVGraph_ViewFrame* aRes = new SUPERVGraph_ViewFrame( theDesktop );
int SALOME_POINT_SIZE = 5;
int SALOME_LINE_WIDTH = 3;
-//----------------------------------------------------------------------------
namespace
{
int
}
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SALOME_Actor);
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SALOME_Actor
::SALOME_Actor():
myRenderer(NULL),
myOutlineActor->SetVisibility( false );
}
-
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SALOME_Actor
::~SALOME_Actor()
{}
-//----------------------------------------------------------------------------
+/*!
+ \return true if the SALOME_Actor has a reference to SALOME_InteractiveObject
+*/
Standard_Boolean
SALOME_Actor
::hasIO()
return !myIO.IsNull();
}
+/*!
+ \return correspoinding reference to SALOME_InteractiveObject
+*/
const Handle(SALOME_InteractiveObject)&
SALOME_Actor
::getIO()
return myIO;
}
+/*!
+ Sets reference to SALOME_InteractiveObject
+ \param theIO - new SALOME_InteractiveObject
+*/
void
SALOME_Actor
::setIO(const Handle(SALOME_InteractiveObject)& theIO)
myIO = theIO;
}
+/*!
+ Sets name the SALOME_Actor
+ \param theName - new name
+*/
void
SALOME_Actor
::setName(const char* theName)
}
-//----------------------------------------------------------------------------
+/*!
+ Publishes the actor in all its internal devices
+*/
void
SALOME_Actor
::AddToRender(vtkRenderer* theRenderer)
theRenderer->AddActor( myOutlineActor.GetPointer() );
}
+/*!
+ Removes the actor from all its internal devices
+*/
void
SALOME_Actor
::RemoveFromRender(vtkRenderer* theRenderer)
theRenderer->RemoveActor( myOutlineActor.GetPointer() );
}
+/*!
+ \return reference on renderer where it is published
+*/
vtkRenderer*
SALOME_Actor
::GetRenderer()
return myRenderer;
}
-
-//----------------------------------------------------------------------------
+/*!
+ Sets interactor in order to use vtkInteractorObserver devices
+ \param theInteractor - new interactor
+*/
void
SALOME_Actor
::SetInteractor(vtkRenderWindowInteractor* theInteractor)
myInteractor = theInteractor;
}
+/*!
+ Put a request to redraw the view
+*/
void
SALOME_Actor
::Update()
myInteractor->CreateTimer(VTKI_TIMER_UPDATE);
}
-
-//----------------------------------------------------------------------------
+/*!
+ Apply view transformation
+ \param theTransform - transformation
+*/
void
SALOME_Actor
::SetTransform(VTKViewer_Transform* theTransform)
myOutlineActor->SetTransform(theTransform);
}
-
+/*!
+ Apply additional position
+*/
void
SALOME_Actor
::SetPosition(vtkFloatingPointType _arg1,
myOutlineActor->SetPosition(_arg1,_arg2,_arg3);
}
-
+/*!
+ Apply additional position
+*/
void
SALOME_Actor
::SetPosition(vtkFloatingPointType _arg[3])
SetPosition(_arg[0],_arg[1],_arg[2]);
}
-
-//----------------------------------------------------------------
+/*!
+ Shows/hides actor
+ \param theVisibility - new visibility state
+*/
void
SALOME_Actor
::SetVisibility( int theVisibility )
}
}
-
-//----------------------------------------------------------------
+/*!
+ Set selector in order to the actor at any time can restore current selection
+ \param theSelector - new selector
+*/
void
SALOME_Actor
::SetSelector(SVTK_Selector* theSelector)
mySelector = theSelector;
}
+/*!
+ To map current selection to VTK representation
+*/
void
SALOME_Actor
::Highlight(bool theIsHighlight)
highlight(theIsHighlight);
}
+/*!
+ Updates visibility of the highlight devices
+*/
void
SALOME_Actor
::highlight(bool theIsHighlight)
}
-//----------------------------------------------------------------
+/*!
+ To process prehighlight (called from SVTK_InteractorStyle)
+*/
bool
SALOME_Actor
::PreHighlight(vtkInteractorStyle *theInteractorStyle,
return anIsChanged;
}
-
-//----------------------------------------------------------------
+/*!
+ To process highlight (called from SVTK_InteractorStyle)
+*/
bool
SALOME_Actor
::Highlight(vtkInteractorStyle *theInteractorStyle,
return true;
}
-//----------------------------------------------------------------------------
+/*!
+ To set up a picker for nodal selection (initialized by SVTK_Renderer::AddActor)
+ \param thePointPicker - new picker
+*/
void
SALOME_Actor
::SetPointPicker(vtkPointPicker* thePointPicker)
myPointPicker = thePointPicker;
}
+/*!
+ To set up a picker for cell selection (initialized by SVTK_Renderer::AddActor)
+ \param theCellPicker - new picker
+*/
void
SALOME_Actor
::SetCellPicker(vtkCellPicker* theCellPicker)
myCellPicker = theCellPicker;
}
+/*!
+ To set up a picker for point rectangle selection (initialized by SVTK_Renderer::AddActor)
+ \param theRectPicker - new picker
+*/
void
SALOME_Actor
::SetPointRectPicker(SVTK_RectPicker* theRectPicker)
myPointRectPicker = theRectPicker;
}
+/*!
+ To set up a picker for cell rectangle selection (initialized by SVTK_Renderer::AddActor)
+ \param theRectPicker - new picker
+*/
void
SALOME_Actor
::SetCellRectPicker(SVTK_RectPicker* theRectPicker)
myCellRectPicker = theRectPicker;
}
-//----------------------------------------------------------------------------
+/*!
+ To set up a prehighlight property (initialized by SVTK_Renderer::AddActor)
+*/
void
SALOME_Actor
::SetPreHighlightProperty(vtkProperty* theProperty)
myPreHighlightActor->SetProperty(theProperty);
}
+/*!
+ To set up a highlight property (initialized by SVTK_Renderer::AddActor)
+*/
void
SALOME_Actor
::SetHighlightProperty(vtkProperty* theProperty)
aPoints->Delete();
}
-//=======================================================================
-
vtkStandardNewMacro(SVTK_Actor);
+/*!
+ Constructor
+*/
SVTK_Actor
::SVTK_Actor():
myUnstructuredGrid(vtkUnstructuredGrid::New())
myUnstructuredGrid->Allocate();
}
-//----------------------------------------------------------------------------
void
SVTK_Actor
::Initialize()
SetInput(GetSource());
}
-
-//----------------------------------------------------------------------------
void
SVTK_Actor
::SetSource(vtkUnstructuredGrid* theUnstructuredGrid)
return myUnstructuredGrid.GetPointer();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SVTK_Actor
::~SVTK_Actor()
{
}
-
-//----------------------------------------------------------------------------
const TColStd_IndexedMapOfInteger&
SVTK_Actor
::GetMapIndex() const
return myMapIndex;
}
-
-//----------------------------------------------------------------------------
void
SVTK_Actor
::MapCells(SALOME_Actor* theMapActor,
myMapIndex = theMapIndex;
}
-
-//----------------------------------------------------------------------------
void
SVTK_Actor
::MapPoints(SALOME_Actor* theMapActor,
myMapIndex = theMapIndex;
}
-
-//----------------------------------------------------------------------------
void
SVTK_Actor
::MapEdge(SALOME_Actor* theMapActor,
myMapIndex = theMapIndex;
}
-
-//----------------------------------------------------------------------------
vtkCxxRevisionMacro(SVTK_CubeAxesActor2D, "$Revision$");
vtkStandardNewMacro(SVTK_CubeAxesActor2D);
-//----------------------------------------------------------------------------
// Instantiate this object.
SVTK_CubeAxesActor2D::SVTK_CubeAxesActor2D()
{
}
-//----------------------------------------------------------------------------
SVTK_CubeAxesActor2D::~SVTK_CubeAxesActor2D()
{
this->wireActorXY->Delete();
this->rgridMapperXZ->Delete();
}
-//----------------------------------------------------------------------------
// Static variable describes connections in cube.
static int Conn[8][3] = {{1,2,4}, {0,3,5}, {3,0,6}, {2,1,7},
{5,6,0}, {4,7,1}, {7,4,2}, {6,5,3}};
-//----------------------------------------------------------------------------
// Project the bounding box and compute edges on the border of the bounding
// cube. Determine which parts of the edges are visible via intersection
// with the boundary of the viewport (minus borders).
ChangeValues(zCoords,xCoords,zRange,xRange,false);
}
-//----------------------------------------------------------------------------
// Project the bounding box and compute edges on the border of the bounding
// cube. Determine which parts of the edges are visible via intersection
// with the boundary of the viewport (minus borders).
return renderedSomething;
}
-//----------------------------------------------------------------------------
// Release any graphics resources that are being consumed by this actor.
// The parameter window could be used to determine which graphic
// resources to release.
* Description : Tab of dialog
*/
-//=======================================================================
-// name : SVTK_AxisWidget::AxisWg
-// Purpose : Constructor
-//=======================================================================
+/*!
+ Constructor
+*/
SVTK_AxisWidget::SVTK_AxisWidget (QWidget* theParent)
: QFrame(theParent)
{
connect(myIsTicksVisible, SIGNAL(stateChanged(int)), SLOT(onTicksChecked()));
}
+/*!
+ Destructor
+*/
SVTK_AxisWidget::~SVTK_AxisWidget()
{
}
onTicksChecked();
}
-//=======================================================================
-// name : SVTK_AxisWidget::onNameChecked
-// Purpose :
-//=======================================================================
void SVTK_AxisWidget::setEnabled(QGroupBox* theGrp, const bool theState)
{
QObjectList aChildren(*theGrp->children());
((QHBox*)anObj)->setEnabled(theState);
}
-//=======================================================================
-// Labels : SVTK_AxisWidget::onLabelsChecked
-// Purpose :
-//=======================================================================
void SVTK_AxisWidget::onLabelsChecked()
{
setEnabled(myLabelsGrp, myIsLabelsVisible->isChecked());
}
-//=======================================================================
-// Labels : SVTK_AxisWidget::onTicksChecked
-// Purpose :
-//=======================================================================
void SVTK_AxisWidget::onTicksChecked()
{
setEnabled(myTicksGrp, myIsTicksVisible->isChecked());
}
-//=======================================================================
-// name : SVTK_AxisWidget::onNameChecked
-// Purpose :
-//=======================================================================
void SVTK_AxisWidget::onNameChecked()
{
setEnabled(myNameGrp, myIsNameVisible->isChecked());
}
-//=======================================================================
-// name : SVTK_AxisWidget::UseName
-// Purpose :
-//=======================================================================
void SVTK_AxisWidget::UseName(const bool toUse)
{
myIsNameVisible->setChecked(toUse);
}
-//=======================================================================
-// name : SVTK_AxisWidget::SetName
-// Purpose :
-//================================================== =====================
void SVTK_AxisWidget::SetName(const QString& theName)
{
myAxisName->setText(theName);
}
-//=======================================================================
-// name : SVTK_AxisWidget::SetNameFont
-// Purpose :
-//=======================================================================
void SVTK_AxisWidget::SetNameFont(const QColor& theColor,
const int theFont,
const bool theIsBold,
myNameFont->SetData(theColor, theFont, theIsBold, theIsItalic, theIsShadow);
}
-//=======================================================================
-// name : SVTK_AxisWidget::SetNameFont
-// Purpose :
-//=======================================================================
bool SVTK_AxisWidget::ReadData(vtkAxisActor2D* theActor)
{
if (theActor == 0)
return true;
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::Apply
-// Purpose :
-//=======================================================================
bool SVTK_AxisWidget::Apply(vtkAxisActor2D* theActor)
{
if (theActor == 0)
Description : Dialog for specifynig cube axes properties
*/
-//=======================================================================
-// name : SVTK_CubeAxesDlg::SVTK_CubeAxesDlg
-// Purpose : Constructor
-//=======================================================================
+/*!
+ Constructor
+*/
SVTK_CubeAxesDlg::SVTK_CubeAxesDlg(QtxAction* theAction,
SVTK_MainWindow* theParent,
const char* theName):
connect(theParent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide()));
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::createMainFrame
-// Purpose : Create frame containing dialog's input fields
-//=======================================================================
+/*!
+ Create frame containing dialog's input fields
+*/
QWidget* SVTK_CubeAxesDlg::createMainFrame(QWidget* theParent)
{
QFrame* aFrame = new QFrame(theParent);
return aFrame;
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::createButtonFrame
-// Purpose : Create frame containing buttons
-//=======================================================================
+/*!
+ Create frame containing buttons
+*/
QWidget* SVTK_CubeAxesDlg::createButtonFrame(QWidget* theParent)
{
QFrame* aFrame = new QFrame(theParent);
return aFrame;
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::~SVTK_CubeAxesDlg
-// Purpose : Destructor
-//=======================================================================
+/*!
+ Destructor
+*/
SVTK_CubeAxesDlg::~SVTK_CubeAxesDlg()
{
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::Update
-// Purpose : Update dialog fields, connect signals and slots, show dialog
-//=======================================================================
+/*!
+ Update dialog fields, connect signals and slots, show dialog
+*/
void SVTK_CubeAxesDlg::Update()
{
myActor = myMainWindow->GetCubeAxes();
myIsVisible->setChecked(myActor->GetVisibility() ? true : false);
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::isValid
-// Purpose : Verify validity of entry data
-//=======================================================================
+/*!
+ Verify validity of entry data
+*/
bool SVTK_CubeAxesDlg::isValid() const
{
return true;
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::onApply
-// Purpose : Verify validity of entry data
-//=======================================================================
+/*!
+ Verify validity of entry data
+*/
bool SVTK_CubeAxesDlg::onApply()
{
bool isOk = true;
return isOk;
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::onOk
-// Purpose : SLOT called when "Ok" button pressed.
-//=======================================================================
+/*!
+ SLOT called when "Ok" button pressed.
+*/
void SVTK_CubeAxesDlg::onOk()
{
if (onApply())
onClose();
}
-//=======================================================================
-// name : SVTK_CubeAxesDlg::onClose
-// Purpose : SLOT called when "Close" button pressed. Close dialog
-//=======================================================================
+/*!
+ SLOT: called when "Close" button pressed. Close dialog
+*/
void SVTK_CubeAxesDlg::onClose()
{
reject();
using namespace std;
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SVTK_DeviceActor);
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_DeviceActor
::SVTK_DeviceActor()
{
myPassFilter.push_back(VTKViewer_PassThroughFilter::New());
}
-
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SVTK_DeviceActor
::~SVTK_DeviceActor()
{
myPassFilter[i]->Delete();
}
-
-//----------------------------------------------------------------------------
+/*!
+ To insert some additional filters and then sets the given vtkMapper
+*/
void
SVTK_DeviceActor
::SetMapper(vtkMapper* theMapper)
InitPipeLine(theMapper);
}
+/*!
+ To initialize internal pipeline
+*/
void
SVTK_DeviceActor
::InitPipeLine(vtkMapper* theMapper)
Superclass::SetMapper(theMapper);
}
-//----------------------------------------------------------------------------
+/*!
+ Allows to get initial vtkDataSet
+*/
vtkDataSet*
SVTK_DeviceActor
::GetInput()
return myPassFilter.front()->GetOutput();
}
+/*!
+ Allows to set initial vtkDataSet
+*/
void
SVTK_DeviceActor
::SetInput(vtkDataSet* theDataSet)
InitPipeLine(myMapper);
}
-//----------------------------------------------------------------------------
+/*!
+ To provide VTK to Object and backward mapping
+*/
void
SVTK_DeviceActor::
SetStoreMapping(bool theStoreMapping)
-//----------------------------------------------------------------------------
unsigned long int
SVTK_DeviceActor
::GetMTime()
return mTime;
}
-
-//----------------------------------------------------------------------------
+/*!
+ Apply a view transformation
+ \param theTransform - transformation
+*/
void
SVTK_DeviceActor
::SetTransform(VTKViewer_Transform* theTransform)
}
-//----------------------------------------------------------------------------
bool
SVTK_DeviceActor
::IsShrunkable()
-//----------------------------------------------------------------------------
void
SVTK_DeviceActor
::SetRepresentation(SVTK::Representation::Type theMode)
}
-//----------------------------------------------------------------------------
int
SVTK_DeviceActor
::GetNodeObjId(int theVtkID)
}
-//----------------------------------------------------------------------------
void
SVTK_DeviceActor
::Render(vtkRenderer *ren, vtkMapper* m)
class vtkShrinkFilter;
class vtkDataSetMapper;
-//----------------------------------------------------------------------------
namespace SVTK
{
namespace Representation
}
-//----------------------------------------------------------------------------
class SVTK_EXPORT SVTK_DeviceActor: public vtkLODActor
{
public:
* Description : Dialog for specifynig font
*/
-//=======================================================================
-// name : SVTK_FontWidget
-// Purpose : Constructor
-//=======================================================================
+/*!
+ Constructor
+*/
SVTK_FontWidget::SVTK_FontWidget( QWidget* theParent )
: QHBox( theParent )
{
connect( myColorBtn, SIGNAL( clicked() ), SLOT( onColor() ) );
}
-//=======================================================================
-// name : ~SVTK_FontWidget
-// Purpose : Destructor
-//=======================================================================
+/*!
+ Destructor
+*/
SVTK_FontWidget::~SVTK_FontWidget()
{
}
-//=======================================================================
-// name : SetColor
-// Purpose :
-//=======================================================================
void SVTK_FontWidget::SetColor( const QColor& theColor )
{
myColorBtn->setPaletteBackgroundColor( theColor );
}
-//=======================================================================
-// name : GetColor
-// Purpose :
-//=======================================================================
QColor SVTK_FontWidget::GetColor() const
{
return myColorBtn->paletteBackgroundColor();
}
-//=======================================================================
-// name : onColor
-// Purpose :
-//=======================================================================
void SVTK_FontWidget::onColor()
{
QColor aColor = QColorDialog::getColor( GetColor(), this );
SetColor( aColor );
}
-//=======================================================================
-// name : SetData
-// Purpose :
-//=======================================================================
void SVTK_FontWidget::SetData( const QColor& theColor,
const int theFamily,
const bool theBold,
myShadow->setChecked( theShadow );
}
-//=======================================================================
-// name : GetData
-// Purpose :
-//=======================================================================
void SVTK_FontWidget::GetData( QColor& theColor,
int& theFamily,
bool& theBold,
using namespace std;
-//----------------------------------------------------------------------------
vtkStandardNewMacro(QVTK_GenericRenderWindowInteractor);
+/*!
+ Constructor
+*/
QVTK_GenericRenderWindowInteractor
::QVTK_GenericRenderWindowInteractor()
{
connect(myTimer, SIGNAL(timeout()), this, SLOT(OnTimeOut())) ;
}
+/*!
+ Destructor
+*/
QVTK_GenericRenderWindowInteractor
::~QVTK_GenericRenderWindowInteractor()
{
delete myTimer;
}
-
-//----------------------------------------------------------------------------
+/*!
+ The slot connects to QTimer::timeout signal to invoke vtkCommand::TimerEvent
+*/
void
QVTK_GenericRenderWindowInteractor
::OnTimeOut()
}
}
+/*!
+ Starts the QTimer instance on defined microseconds
+*/
int
QVTK_GenericRenderWindowInteractor
::CreateTimer(int vtkNotUsed(timertype))
return 1;
}
+/*!
+ Stops the QTimer instance
+*/
int
QVTK_GenericRenderWindowInteractor
::DestroyTimer(void)
}
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SVTK_GenericRenderWindowInteractor);
+/*!
+ Constructor
+*/
SVTK_GenericRenderWindowInteractor
::SVTK_GenericRenderWindowInteractor():
myRenderWidget(NULL)
{
}
+/*!
+ Destructor
+*/
SVTK_GenericRenderWindowInteractor
::~SVTK_GenericRenderWindowInteractor()
{
}
+/*!
+ To get access to SVTK_Selector
+*/
SVTK_Selector*
SVTK_GenericRenderWindowInteractor
::GetSelector()
return mySelector.GetPointer();
}
+/*!
+ To initialize mySelector field
+ \param theSelector - new selector
+*/
void
SVTK_GenericRenderWindowInteractor
::SetSelector(SVTK_Selector* theSelector)
mySelector = theSelector;
}
+/*!
+ To get access to QWidget, where vtkRenderWindow maps to.
+*/
QWidget*
SVTK_GenericRenderWindowInteractor
::GetRenderWidget()
return myRenderWidget;
}
+/*!
+ To initialize myRenderWidget field.
+*/
void
SVTK_GenericRenderWindowInteractor
::SetRenderWidget(QWidget* theRenderWidget)
class SVTK_Renderer;
-//============================================================================
-//! Introduction of the class is intended to implement Qt based #CreateTimer and #DestroyTimer functionality.
/*!
+ \class QVTK_GenericRenderWindowInteractor
+ Introduction of the class is intended to implement Qt based #CreateTimer and #DestroyTimer functionality.
The class intendes to implement platform indepenedant subclass of vtkRenderWindowInteractor.
This is done by usage of Qt library.
\note
};
-//============================================================================
-//! This class introduce SALOME specific to the base one
/*!
+ \class SVTK_GenericRenderWindowInteractor
+ This class introduce SALOME specific to the base one
In this class new members is added (#mySelector and #myRenderWidget).
They are used for initialization of #SVTK_InteractorStyle by redefinition of
#SVTK_InteractorStyle::SetInteractor method
}
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SVTK_InteractorStyle);
-//----------------------------------------------------------------------------
+
+/*!
+ Constructor
+*/
SVTK_InteractorStyle
::SVTK_InteractorStyle():
mySelectionEvent(new SVTK_SelectionEvent()),
myControllerOnKeyDown->Delete();
}
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SVTK_InteractorStyle
::~SVTK_InteractorStyle()
{
}
-//----------------------------------------------------------------------------
+/*!
+ \return widget for rendering
+*/
QWidget*
SVTK_InteractorStyle
::GetRenderWidget()
return myInteractor->GetRenderWidget();
}
+/*!
+ \return selector
+*/
SVTK_Selector*
SVTK_InteractorStyle
::GetSelector()
return myInteractor->GetSelector();
}
-//----------------------------------------------------------------------------
+/*!
+ Generate special SVTK_SelectionEvent
+*/
SVTK_SelectionEvent*
SVTK_InteractorStyle
::GetSelectionEvent()
return mySelectionEvent.get();
}
-//----------------------------------------------------------------------------
+/*!
+ Generate special SVTK_SelectionEvent with flipped Y coordinate
+*/
SVTK_SelectionEvent*
SVTK_InteractorStyle
::GetSelectionEventFlipY()
return mySelectionEvent.get();
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::RotateXY(int dx, int dy)
this->Render();
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::PanXY(int x, int y, int oldX, int oldY)
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::DollyXY(int dx, int dy)
this->Render();
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::SpinXY(int x, int y, int oldX, int oldY)
}
-//----------------------------------------------------------------------------
+/*!
+ To reset reset view
+*/
void
SVTK_InteractorStyle
::OnConfigure()
this->GetCurrentRenderer()->InvokeEvent(vtkCommand::ConfigureEvent,NULL);
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle mouse move event
+*/
void
SVTK_InteractorStyle
::OnMouseMove()
x, y );
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle left mouse button down event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnLeftButtonDown()
x, y );
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle left mouse button up event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnLeftButtonUp()
x, y );
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle middle mouse button down event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnMiddleButtonDown()
x, y );
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle middle mouse button up event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnMiddleButtonUp()
x, y );
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle right mouse button down event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnRightButtonDown()
x, y );
}
-//----------------------------------------------------------------------------
+/*!
+ To handle right mouse button up event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnRightButtonUp()
x, y );
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle mouse move event
+*/
void
SVTK_InteractorStyle
::OnMouseMove(int vtkNotUsed(ctrl),
onCursorMove(QPoint(x, y));
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle left mouse button down event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnLeftButtonDown(int ctrl, int shift,
return;
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle left mouse button up event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnLeftButtonUp(int vtkNotUsed(ctrl),
}
}
-
-//----------------------------------------------------------------------------
+/*!
+ To handle middle mouse button down event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnMiddleButtonDown(int ctrl,
}
-//----------------------------------------------------------------------------
+/*!
+ To handle middle mouse button up event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnMiddleButtonUp(int vtkNotUsed(ctrl),
}
-//----------------------------------------------------------------------------
+/*!
+ To handle right mouse button down event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnRightButtonDown(int ctrl,
}
}
-//----------------------------------------------------------------------------
+/*!
+ To handle right mouse button up event (reimplemented from vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::OnRightButtonUp(int vtkNotUsed(ctrl),
}
}
-//----------------------------------------------------------------------------
/* XPM */
const char* imageZoomCursor[] = {
"32 32 3 1",
"................................"};
-//----------------------------------------------------------------------------
-// loads cursors for viewer operations - zoom, pan, etc...
+/*!
+ loads cursors for viewer operations - zoom, pan, etc...
+*/
void
SVTK_InteractorStyle
::loadCursors()
}
-//----------------------------------------------------------------------------
-// starts Zoom operation (e.g. through menu command)
+/*!
+ Starts Zoom operation (e.g. through menu command)
+*/
void
SVTK_InteractorStyle
::startZoom()
}
-//----------------------------------------------------------------------------
-// starts Pan operation (e.g. through menu command)
+/*!
+ Starts Pan operation (e.g. through menu command)
+*/
void
SVTK_InteractorStyle
::startPan()
ForcedState = VTK_INTERACTOR_STYLE_CAMERA_PAN;
}
-//----------------------------------------------------------------------------
-// starts Rotate operation (e.g. through menu command)
+/*!
+ Starts Rotate operation (e.g. through menu command)
+*/
void
SVTK_InteractorStyle
::startRotate()
}
-//----------------------------------------------------------------------------
-// starts Spin operation (e.g. through menu command)
+/*!
+ Starts Spin operation (e.g. through menu command)
+*/
void
SVTK_InteractorStyle
::startSpin()
-//----------------------------------------------------------------------------
-// starts Fit Area operation (e.g. through menu command)
+/*!
+ Starts Fit Area operation (e.g. through menu command)
+*/
void
SVTK_InteractorStyle
::startFitArea()
}
-//----------------------------------------------------------------------------
-// starts Global Panning operation (e.g. through menu command)
+/*!
+ Starts Global Panning operation (e.g. through menu command)
+*/
void
SVTK_InteractorStyle
::startGlobalPan()
}
-//----------------------------------------------------------------------------
-// fits viewer contents to rect
+/*!
+ Fits viewer contents to rect
+*/
void
SVTK_InteractorStyle
::fitRect(const int left,
}
-//----------------------------------------------------------------------------
-// starts viewer operation (!internal usage!)
+/*!
+ Starts viewer operation (!internal usage!)
+*/
void
SVTK_InteractorStyle
::startOperation(int operation)
}
-//----------------------------------------------------------------------------
-// sets proper cursor for window when viewer operation is activated
+/*!
+ Sets proper cursor for window when viewer operation is activated
+*/
void
SVTK_InteractorStyle
::setCursor(const int operation)
}
-//----------------------------------------------------------------------------
-// called when viewer operation started (!put necessary initialization here!)
+/*!
+ Called when viewer operation started (!put necessary initialization here!)
+*/
void
SVTK_InteractorStyle
::onStartOperation()
}
-//----------------------------------------------------------------------------
-// called when viewer operation finished (!put necessary post-processing here!)
+/*!
+ Called when viewer operation finished (!put necessary post-processing here!)
+*/
void
SVTK_InteractorStyle
::onFinishOperation()
}
-// called during viewer operation when user moves mouse (!put necessary processing here!)
-//----------------------------------------------------------------------------
+/*!
+ Called during viewer operation when user moves mouse (!put necessary processing here!)
+*/
void
SVTK_InteractorStyle
::onOperation(QPoint mousePos)
}
}
-// called when user moves mouse inside viewer window and there is no active viewer operation
-// (!put necessary processing here!)
-//----------------------------------------------------------------------------
+/*!
+ Called when user moves mouse inside viewer window and there is no active viewer operation
+ (!put necessary processing here!)
+*/
void
SVTK_InteractorStyle
::onCursorMove(QPoint mousePos)
this->Render();
}
-// called on finsh GlobalPan operation
-//----------------------------------------------------------------------------
+/*!
+ Called on finsh GlobalPan operation
+*/
void
SVTK_InteractorStyle
::Place(const int theX, const int theY)
-// Translates view from Point to Point
-//----------------------------------------------------------------------------
+/*!
+ Translates view from Point to Point
+*/
void
SVTK_InteractorStyle
::TranslateView(int toX, int toY, int fromX, int fromY)
motionVector[2] + viewPoint[2]);
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::IncrementalPan( const int incrX, const int incrY )
this->PanXY( incrX, incrY, 0, 0 );
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::IncrementalZoom( const int incr )
this->DollyXY( incr, incr );
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::IncrementalRotate( const int incrX, const int incrY )
this->RotateXY( incrX, -incrY );
}
-//----------------------------------------------------------------------------
+/*!
+ Redefined in order to add an observer (callback) for custorm event (space mouse event)
+*/
void
SVTK_InteractorStyle
::SetInteractor( vtkRenderWindowInteractor* theInteractor )
}
}
-
-//----------------------------------------------------------------------------
+/*!
+ To implement cached rendering
+*/
void
SVTK_InteractorStyle
::OnTimer()
this->Interactor->Render();
}
-//----------------------------------------------------------------------------
+/*!
+ To invoke #vtkRenderWindowInteractor::CreateTimer
+*/
void
SVTK_InteractorStyle
::Render()
this->Interactor->CreateTimer(VTKI_TIMER_FIRST);
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::onSpaceMouseMove( double* data )
IncrementalRotate( (int)data[3], 0 ); // 5. tilt the control forward/backward = rotate around X axis (Z axis of local coordinate system of space mouse)
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::onSpaceMouseButton( int button )
DominantCombinedSwitch();
}
-//----------------------------------------------------------------------------
void
SVTK_InteractorStyle
::DominantCombinedSwitch()
printf( "\n--DominantCombinedSwitch() NOT IMPLEMENTED--\n" );
}
-//----------------------------------------------------------------------------
+/*!
+ Main process event method (reimplemented from #vtkInteractorStyle)
+*/
void
SVTK_InteractorStyle
::ProcessEvents( vtkObject* object,
Superclass::ProcessEvents( object, event, clientData, callData );
}
-//----------------------------------------------------------------------------
+
+/*!
+ To handle keyboard event (reimplemented from #vtkInteractorStyle)
+*/
void SVTK_InteractorStyle::OnChar()
{
}
-//----------------------------------------------------------------------------
+
+/*!
+ Redefined vtkInteractorStyle::OnKeyDown
+*/
void SVTK_InteractorStyle::OnKeyDown()
{
bool bInvokeSuperclass=myControllerOnKeyDown->OnKeyDown(this);
Superclass::OnKeyDown();
}
}
-//----------------------------------------------------------------------------
+
+/*!
+ Provide instructions for Picking
+*/
void SVTK_InteractorStyle::ActionPicking()
{
int x, y;
onFinishOperation();
startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
}
-//----------------------------------------------------------------------------
+
+/*!
+ To set current increment controller
+*/
void SVTK_InteractorStyle::SetControllerOnKeyDown(SVTK_ControllerOnKeyDown* theController)
{
myControllerOnKeyDown=theController;
}
-//----------------------------------------------------------------------------
+
+/*!
+ To get current OnKeyDown controller
+*/
SVTK_ControllerOnKeyDown* SVTK_InteractorStyle::ControllerOnKeyDown()
{
return myControllerOnKeyDown.GetPointer();
}
-//----------------------------------------------------------------------------
+
+/*!
+ To get current increment controller
+*/
void SVTK_InteractorStyle::SetControllerIncrement(SVTK_ControllerIncrement* theController)
{
myControllerIncrement=theController;
}
-//----------------------------------------------------------------------------
+
+/*!
+ To get current increment controller
+*/
SVTK_ControllerIncrement* SVTK_InteractorStyle::ControllerIncrement()
{
return myControllerIncrement.GetPointer();
}
vtkStandardNewMacro(SVTK_ControllerIncrement);
-//----------------------------------------------------------------------------
SVTK_ControllerIncrement::SVTK_ControllerIncrement()
{
myIncrement=10;
}
-//----------------------------------------------------------------------------
SVTK_ControllerIncrement::~SVTK_ControllerIncrement()
{
}
-//----------------------------------------------------------------------------
void SVTK_ControllerIncrement::SetStartValue(const int theValue)
{
myIncrement=theValue;
}
-//----------------------------------------------------------------------------
int SVTK_ControllerIncrement::Current()const
{
return myIncrement;
}
-//----------------------------------------------------------------------------
int SVTK_ControllerIncrement::Increase()
{
++myIncrement;
return myIncrement;
}
-//----------------------------------------------------------------------------
int SVTK_ControllerIncrement::Decrease()
{
if (myIncrement>1){
}
vtkStandardNewMacro(SVTK_ControllerOnKeyDown);
-//----------------------------------------------------------------------------
+
+/*!
+ Constructor
+*/
SVTK_ControllerOnKeyDown::SVTK_ControllerOnKeyDown()
{
}
-//----------------------------------------------------------------------------
+
+/*!
+ Destructor
+*/
SVTK_ControllerOnKeyDown::~SVTK_ControllerOnKeyDown()
{
}
-//----------------------------------------------------------------------------
+
bool SVTK_ControllerOnKeyDown::OnKeyDown(vtkInteractorStyle* theIS)
{
return true;
#include <vtkObject.h>
//
-//-------------------------------------------
//! Control the value of increment in SALOME way.
/*!
This class controls of value of increment,
void operator=(const SVTK_ControllerIncrement&); //Not implemented
};
//
-//-------------------------------------------
//! Control the behaviour of KeyDown event in SALOME way.
/*!
This class controls the behaviour of KeyDown event
SVTK_ControllerOnKeyDown(const SVTK_ControllerOnKeyDown&);//Not implemented
void operator=(const SVTK_ControllerOnKeyDown&); //Not implemented
};
-//-------------------------------------------
class vtkCell;
class vtkPicker;
SVTK_SelectionEvent*
GetSelectionEventFlipY();
- //! Redefined in order to add an observer (callback) for custorm event (space mouse event)
+ //! Redefined in order to add an observer (callback) for custom event (space mouse event)
virtual
void
SetInteractor( vtkRenderWindowInteractor* );
#include <qimage.h>
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_MainWindow
::SVTK_MainWindow(QWidget* theParent,
const char* theName,
createToolBar();
}
+/*!
+ To initialize the class
+*/
void
SVTK_MainWindow
::Initialize(SVTK_RenderWindowInteractor* theInteractor)
myCubeAxesDlg = new SVTK_CubeAxesDlg(myActionsMap[GraduatedAxes],this,"SVTK_CubeAxesDlg");
}
-
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SVTK_MainWindow
::~SVTK_MainWindow()
{
}
-
-//----------------------------------------------------------------------------
+/*!
+ \return used SVTK_RenderWindowInteractor
+*/
SVTK_RenderWindowInteractor*
SVTK_MainWindow
::GetInteractor()
return myInteractor;
}
+/*!
+ \return used #vtkRenderWindowInteractor (obsolete)
+*/
vtkRenderWindowInteractor*
SVTK_MainWindow
::getInteractor()
return GetInteractor()->GetDevice();
}
+/*!
+ \return used vtkRenderWindow (obsolete)
+*/
vtkRenderWindow*
SVTK_MainWindow
::getRenderWindow()
return GetInteractor()->getRenderWindow();
}
-//----------------------------------------------------------------------------
+/*!
+ To repaint the view
+ \param theUpdateTrihedron - adjust trihedron
+*/
void
SVTK_MainWindow
::Repaint(bool theUpdateTrihedron)
GetInteractor()->update();
}
-//----------------------------------------------------------------------------
+/*!
+ To invoke a VTK event on SVTK_RenderWindowInteractor instance
+*/
void
SVTK_MainWindow
::InvokeEvent(unsigned long theEvent, void* theCallData)
GetInteractor()->InvokeEvent(theEvent,theCallData);
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::GetInteractorStyle
+*/
vtkInteractorStyle*
SVTK_MainWindow
::GetInteractorStyle()
return GetInteractor()->GetInteractorStyle();
}
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::PushInteractorStyle
+*/
void
SVTK_MainWindow
::PushInteractorStyle(vtkInteractorStyle* theStyle)
GetInteractor()->PushInteractorStyle(theStyle);
}
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::PopInteractorStyle
+*/
void
SVTK_MainWindow
::PopInteractorStyle()
GetInteractor()->PopInteractorStyle();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::GetSelector
+*/
SVTK_Selector*
SVTK_MainWindow
::GetSelector()
return GetInteractor()->GetSelector();
}
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::SelectionMode
+*/
Selection_Mode
SVTK_MainWindow
::SelectionMode()
return GetSelector()->SelectionMode();
}
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::SetSelectionMode
+*/
void
SVTK_MainWindow
::SetSelectionMode(Selection_Mode theMode)
GetSelector()->SetSelectionMode(theMode);
}
-
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::GetRenderer
+*/
SVTK_Renderer*
SVTK_MainWindow
::GetRenderer()
return GetInteractor()->GetRenderer();
}
+/*!
+ Redirect the request to SVTK_RenderWindowInteractor::getRenderer
+*/
vtkRenderer*
SVTK_MainWindow
::getRenderer()
return GetInteractor()->getRenderer();
}
-//----------------------------------------------------------------------------
+/*!
+ Sets background color of the view
+ \param theColor - new background color
+*/
void
SVTK_MainWindow
::SetBackgroundColor(const QColor& theColor)
theColor.blue()/255.0);
}
+/*!
+ \return background color of the view
+*/
QColor
SVTK_MainWindow
::BackgroundColor()
int(aBackgroundColor[2]*255));
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::GetScale
+*/
void
SVTK_MainWindow
::GetScale( double theScale[3] )
GetRenderer()->GetScale( theScale );
}
+/*!
+ Redirect the request to SVTK_Renderer::SetScale
+*/
void
SVTK_MainWindow
::SetScale( double theScale[3] )
Repaint();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::AddActor
+*/
void
SVTK_MainWindow
::AddActor(VTKViewer_Actor* theActor,
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::RemoveActor
+*/
void
SVTK_MainWindow
::RemoveActor(VTKViewer_Actor* theActor,
Repaint();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::GetTrihedronSize
+*/
int
SVTK_MainWindow
::GetTrihedronSize()
return GetRenderer()->GetTrihedronSize();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::SetTrihedronSize
+*/
void
SVTK_MainWindow
::SetTrihedronSize( const int theSize, const bool theRelative )
}
-//----------------------------------------------------------------------------
/*! If parameter theIsForcedUpdate is true, recalculate parameters for
* trihedron and cube axes, even if trihedron and cube axes is invisible.
*/
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::IsTrihedronDisplayed
+*/
bool
SVTK_MainWindow
::IsTrihedronDisplayed()
return GetRenderer()->IsTrihedronDisplayed();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::IsCubeAxesDisplayed
+*/
bool
SVTK_MainWindow
::IsCubeAxesDisplayed()
return GetRenderer()->IsCubeAxesDisplayed();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::GetTrihedron
+*/
VTKViewer_Trihedron*
SVTK_MainWindow
::GetTrihedron()
return GetRenderer()->GetTrihedron();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to SVTK_Renderer::GetCubeAxes
+*/
SVTK_CubeAxesActor2D*
SVTK_MainWindow
::GetCubeAxes()
return GetRenderer()->GetCubeAxes();
}
-
-//----------------------------------------------------------------------------
+/*!
+ \return toolbar of svtk main window
+*/
QToolBar*
SVTK_MainWindow
::getToolBar()
return myToolBar;
}
-//----------------------------------------------------------------------------
void
SVTK_MainWindow
::SetEventDispatcher(vtkObject* theDispatcher)
myEventDispatcher = theDispatcher;
}
-//----------------------------------------------------------------------------
#if defined(WIN32) && !defined(_DEBUG)
#pragma optimize( "", off )
#endif
+/*!
+ Creates all actions of svtk main window
+*/
void
SVTK_MainWindow
::createActions(SUIT_ResourceMgr* theResourceMgr)
#pragma optimize( "", on )
#endif
-//----------------------------------------------------------------------------
+/*!
+ Creates toolbar of svtk main window
+*/
void
SVTK_MainWindow
::createToolBar()
myActionsMap[GraduatedAxes]->addTo(myToolBar);
}
-//----------------------------------------------------------------------------
+/*!
+ Custom show event handler
+*/
void
SVTK_MainWindow
::showEvent( QShowEvent * theEvent )
emit Show( theEvent );
}
+/*!
+ Custom hide event handler
+*/
void
SVTK_MainWindow
::hideEvent( QHideEvent * theEvent )
emit Hide( theEvent );
}
-
-//----------------------------------------------------------------------------
+/*!
+ Starts zoom transformation
+*/
void
SVTK_MainWindow
::activateZoom()
myEventDispatcher->InvokeEvent(SVTK::StartZoom,0);
}
-//----------------------------------------------------------------------------
+/*!
+ Starts panning transformation
+*/
void
SVTK_MainWindow
::activatePanning()
myEventDispatcher->InvokeEvent(SVTK::StartPan,0);
}
-//----------------------------------------------------------------------------
+/*!
+ Starts rotation transformation
+*/
void
SVTK_MainWindow
::activateRotation()
myEventDispatcher->InvokeEvent(SVTK::StartRotate,0);
}
-//----------------------------------------------------------------------------
+/*!
+ Starts global panning transformation
+*/
void
SVTK_MainWindow
::activateGlobalPanning()
myEventDispatcher->InvokeEvent(SVTK::StartGlobalPan,0);
}
-//----------------------------------------------------------------------------
+/*!
+ Starts window fit transformation
+*/
void
SVTK_MainWindow
::activateWindowFit()
myEventDispatcher->InvokeEvent(SVTK::StartFitArea,0);
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "front view"
+*/
void
SVTK_MainWindow
::onFrontView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "back view"
+*/
void
SVTK_MainWindow
::onBackView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "top view"
+*/
void
SVTK_MainWindow
::onTopView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "bottom view"
+*/
void
SVTK_MainWindow
::onBottomView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "left view"
+*/
void
SVTK_MainWindow
::onLeftView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "right view"
+*/
void
SVTK_MainWindow
::onRightView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "reset view": sets default orientation of viewport camera
+*/
void
SVTK_MainWindow
::onResetView()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "fit all"
+*/
void
SVTK_MainWindow
::onFitAll()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Shows trihedron
+*/
void
SVTK_MainWindow
::onViewTrihedron()
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Shows cube axes
+*/
void
SVTK_MainWindow
::onViewCubeAxes()
Repaint();
}
-//----------------------------------------------------------------------------
void
SVTK_MainWindow
::onUpdateRate(bool theIsActivate)
myCubeAxesDlg->hide();
}
-//----------------------------------------------------------------------------
void
SVTK_MainWindow
::onAdjustTrihedron()
GetRenderer()->OnAdjustTrihedron();
}
-//----------------------------------------------------------------------------
void
SVTK_MainWindow
::onAdjustCubeAxes()
GetRenderer()->OnAdjustCubeAxes();
}
-//----------------------------------------------------------------------------
+/*!
+ \return QImage, containing all scene rendering in window
+*/
QImage
SVTK_MainWindow
::dumpView()
class SVTK_Selector;
-//----------------------------------------------------------------------------
//! The class is a container for #SVTK_RenderWindowInteractor.
/*!
The class contains #SVTK_RenderWindowInteractor instance and
#include "SVTK_Prs.h"
using namespace std;
-//==========================================================
/*!
- * SVTK_Prs::SVTK_Prs
- * Default constructor
- */
-//==========================================================
+ Default constructor
+*/
SVTK_Prs::SVTK_Prs() : myObjects( 0 )
{
}
-//==========================================================
/*!
- * SVTK_Prs::SVTK_Prs
- * tandard constructora
- */
-//==========================================================
+ Standard constructor
+*/
SVTK_Prs::SVTK_Prs( const vtkActor* obj )
{
AddObject( obj );
}
-//==========================================================
/*!
- * SVTK_Prs::~SVTK_Prs
- * Destructor
- */
-//==========================================================
+ Destructor
+*/
SVTK_Prs:: ~SVTK_Prs()
{
if ( myObjects ) myObjects->Delete();
}
-//==========================================================
/*!
- * SVTK_Prs::GetObjects
- * Get actors list
- */
-//==========================================================
+ \return actors list
+*/
vtkActorCollection* SVTK_Prs::GetObjects() const
{
return myObjects;
}
-//==========================================================
/*!
- * SVTK_Prs::AddObject
- * Add actor
- */
-//==========================================================
+ Add actor
+*/
void SVTK_Prs::AddObject( const vtkActor* obj )
{
if ( !myObjects)
myObjects->AddItem( (vtkActor*)obj );
}
-//==========================================================
/*!
- * SVTK_Prs::IsNull
- * Return 0 if list of the actors is empty
- * [ Reimplemented from SALOME_Prs ]
- */
-//==========================================================
+ \return 0 if list of the actors is empty [ Reimplemented from SALOME_Prs ]
+*/
bool SVTK_Prs::IsNull() const
{
return !myObjects || myObjects->GetNumberOfItems() <= 0;
#include <vtkCamera.h>
#include <vtkCell.h>
-//----------------------------------------------------------------------------
namespace
{
//----------------------------------------------------------------------------
}
}
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SVTK_RectPicker);
-//----------------------------------------------------------------------------
SVTK_RectPicker
::SVTK_RectPicker()
{
return 0;
}
-//----------------------------------------------------------------------------
int
SVTK_RectPicker
::Pick(vtkFloatingPointType theSelection[3],
theRenderer);
}
-//----------------------------------------------------------------------------
int
SVTK_RectPicker
::Pick(vtkFloatingPointType theSelectionX,
}
-//----------------------------------------------------------------------------
const SVTK_RectPicker::TVectorIdsMap&
SVTK_RectPicker
::GetPointIdsMap() const
static bool FOCUS_UNDER_MOUSE = false;
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
QVTK_RenderWindowInteractor
::QVTK_RenderWindowInteractor(QWidget* theParent,
const char* theName):
myRenderWindow->SetWindowId((void*)winId());
}
-
+/*!
+ To initialize by vtkGenericRenderWindowInteractor instance
+*/
void
QVTK_RenderWindowInteractor
::Initialize(vtkGenericRenderWindowInteractor* theDevice)
theDevice->SetRenderWindow(getRenderWindow());
}
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
QVTK_RenderWindowInteractor
::~QVTK_RenderWindowInteractor()
{
}
-//----------------------------------------------------------------------------
vtkGenericRenderWindowInteractor*
QVTK_RenderWindowInteractor
::GetDevice()
return myDevice.GetPointer();
}
-//----------------------------------------------------------------------------
vtkRenderWindow*
QVTK_RenderWindowInteractor
::getRenderWindow()
return myRenderWindow.GetPointer();
}
-//----------------------------------------------------------------------------
+/*!
+ Just to simplify usage of its device (vtkGenericRenderWindowInteractor)
+*/
void
QVTK_RenderWindowInteractor
::InvokeEvent(unsigned long theEvent, void* theCallData)
GetDevice()->InvokeEvent(theEvent,theCallData);
}
-//----------------------------------------------------------------------------
+/*!
+ Need for initial contents display on Win32
+*/
void
QVTK_RenderWindowInteractor
::show()
update(); // needed for initial contents display on Win32
}
-//----------------------------------------------------------------------------
+/*!
+ To implement final initialization, just before the widget is displayed
+*/
void
QVTK_RenderWindowInteractor
::polish()
}
}
-//----------------------------------------------------------------------------
+/*!
+ To adjust widget and vtkRenderWindow size
+*/
void
QVTK_RenderWindowInteractor
::resize(int w, int h)
GetDevice()->UpdateSize(w,h);
}
-//----------------------------------------------------------------------------
void
QVTK_RenderWindowInteractor
::paintEvent( QPaintEvent* theEvent )
}
-//----------------------------------------------------------------------------
void
QVTK_RenderWindowInteractor
::resizeEvent( QResizeEvent* theEvent )
}
-//----------------------------------------------------------------------------
void
QVTK_RenderWindowInteractor
::contextMenuEvent( QContextMenuEvent* event )
{}
-//----------------------------------------------------------------------------
void
QVTK_RenderWindowInteractor
::mouseMoveEvent( QMouseEvent* event )
}
-//----------------------------------------------------------------------------
void
QVTK_RenderWindowInteractor
::mousePressEvent( QMouseEvent* event )
}
-//----------------------------------------------------------------------------
void
QVTK_RenderWindowInteractor
::mouseReleaseEvent( QMouseEvent *event )
}
-//----------------------------------------------------------------------------
void
QVTK_RenderWindowInteractor
::mouseDoubleClickEvent( QMouseEvent* event )
{}
-//----------------------------------------------------------------------------
void
QVTK_RenderWindowInteractor
::wheelEvent( QWheelEvent* event )
}
-//----------------------------------------------------------------------------
void
QVTK_RenderWindowInteractor
::keyPressEvent( QKeyEvent* event )
GetDevice()->CharEvent();
}
-//----------------------------------------------------------------------------
void
QVTK_RenderWindowInteractor
::keyReleaseEvent( QKeyEvent * event )
}
-//----------------------------------------------------------------------------
void
QVTK_RenderWindowInteractor
::enterEvent( QEvent* event )
GetDevice()->EnterEvent();
}
-//----------------------------------------------------------------------------
void
QVTK_RenderWindowInteractor
::leaveEvent( QEvent * )
GetDevice()->LeaveEvent();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Reimplemented from QWidget in order to set window - receiver
+ of space mouse events.
+*/
void
QVTK_RenderWindowInteractor
::focusInEvent( QFocusEvent* event )
}
}
-//----------------------------------------------------------------------------
+/*!
+ Reimplemented from QWidget in order to set window - receiver
+ of space mouse events.
+*/
void
QVTK_RenderWindowInteractor
::focusOutEvent ( QFocusEvent* event )
}
-//----------------------------------------------------------------------------
+/*!
+ To handle native X11 events (from such devices as SpaceMouse)
+*/
bool
QVTK_RenderWindowInteractor
::x11Event( XEvent *xEvent )
return QWidget::x11Event( xEvent );
}
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_RenderWindowInteractor
::SVTK_RenderWindowInteractor(QWidget* theParent,
const char* theName):
myEventCallbackCommand->SetCallback(SVTK_RenderWindowInteractor::ProcessEvents);
}
+/*!
+ To initialize properly the class
+*/
void
SVTK_RenderWindowInteractor
::Initialize(vtkGenericRenderWindowInteractor* theDevice,
SetSelector(theSelector);
}
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SVTK_RenderWindowInteractor
::~SVTK_RenderWindowInteractor()
{
GetDevice()->SetRenderWindow(NULL);
}
-//----------------------------------------------------------------------------
+/*!
+ To get corresponding SVTK_Renderer instance
+*/
SVTK_Renderer*
SVTK_RenderWindowInteractor
::GetRenderer()
return myRenderer.GetPointer();
}
+/*!
+ To get corresponding SVTK_Renderer device (just to simplify collobaration with SVTK_Renderer)
+*/
vtkRenderer*
SVTK_RenderWindowInteractor
::getRenderer()
}
-//----------------------------------------------------------------------------
void
SVTK_RenderWindowInteractor
::InitInteractorStyle(vtkInteractorStyle* theStyle)
GetDevice()->SetInteractorStyle(theStyle);
}
-
-//----------------------------------------------------------------------------
+/*!
+ To change current interactor style by pushing the new one into the container
+*/
void
SVTK_RenderWindowInteractor
::PushInteractorStyle(vtkInteractorStyle* theStyle)
InitInteractorStyle(theStyle);
}
-
-//----------------------------------------------------------------------------
+/*!
+ To restore previous interactor style
+*/
void
SVTK_RenderWindowInteractor
::PopInteractorStyle()
InitInteractorStyle(GetInteractorStyle());
}
-
-//----------------------------------------------------------------------------
+/*!
+ To get current interactor style
+*/
vtkInteractorStyle*
SVTK_RenderWindowInteractor
::GetInteractorStyle()
}
-//----------------------------------------------------------------------------
+/*!
+ To get current selector
+*/
SVTK_Selector*
SVTK_RenderWindowInteractor
::GetSelector()
myPriority);
}
-
-//----------------------------------------------------------------------------
+/*!
+ Main process VTK event method
+*/
void
SVTK_RenderWindowInteractor
::ProcessEvents(vtkObject* vtkNotUsed(theObject),
}
}
-
-//----------------------------------------------------------------
+/*!
+ To change selection mode (just to simplify collobaration with SVTK_Selector)
+*/
void
SVTK_RenderWindowInteractor
::SetSelectionMode(Selection_Mode theMode)
mySelector->SetSelectionMode(theMode);
}
-
-//----------------------------------------------------------------
+/*!
+ To get current selection mode (just to simplify collobaration with SVTK_Selector)
+*/
Selection_Mode
SVTK_RenderWindowInteractor
::SelectionMode() const
}
-//----------------------------------------------------------------
void
SVTK_RenderWindowInteractor
::onEmitSelectionChanged()
}
-//----------------------------------------------------------------------------
void
SVTK_RenderWindowInteractor
::mouseMoveEvent( QMouseEvent* event )
}
-//----------------------------------------------------------------------------
void
SVTK_RenderWindowInteractor
::mousePressEvent( QMouseEvent* event )
}
-//----------------------------------------------------------------------------
void
SVTK_RenderWindowInteractor
::mouseReleaseEvent( QMouseEvent *event )
}
-//----------------------------------------------------------------------------
void
SVTK_RenderWindowInteractor
::mouseDoubleClickEvent( QMouseEvent* event )
}
-//----------------------------------------------------------------------------
void
SVTK_RenderWindowInteractor
::wheelEvent( QWheelEvent* event )
}
-//----------------------------------------------------------------------------
void
SVTK_RenderWindowInteractor
::keyPressEvent( QKeyEvent* event )
emit KeyPressed( event );
}
-//----------------------------------------------------------------------------
void
SVTK_RenderWindowInteractor
::keyReleaseEvent( QKeyEvent * event )
emit KeyReleased( event );
}
-//----------------------------------------------------------------------------
void
SVTK_RenderWindowInteractor
::contextMenuEvent( QContextMenuEvent* event )
class SVTK_Selector;
class SVTK_Renderer;
-//============================================================================
-//! Implemements Qt based vtkRenderWindowInteractor.
/*!
+ \class QVTK_RenderWindowInteractor
+ Implements Qt based vtkRenderWindowInteractor.
The class inherits #QWidget class in order to be possible process Qt events.
It invokes corresponding VTK events through usage of its device - a #vtkGenericRenderWindowInteractor.
Also, it creates, initialize and holds vtkRenderWindow instance.
};
-//============================================================================
//! Extends QVTK_RenderWindowInteractor functionality.
/*!
+ \class SVTK_RenderWindowInteractor
Implements such features as
support of selection,
run-time interactor style management,
#undef max
-//----------------------------------------------------------------------------
vtkStandardNewMacro(SVTK_Renderer);
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_Renderer
::SVTK_Renderer():
myDevice(vtkRenderer::New()),
myPriority);
}
+/*!
+ Destructor
+*/
SVTK_Renderer
::~SVTK_Renderer()
{
}
+/*!
+ Main process event method
+*/
void
SVTK_Renderer
::ProcessEvents(vtkObject* vtkNotUsed(theObject),
}
}
-//----------------------------------------------------------------------------
+/*!
+ \return renderer's device
+*/
vtkRenderer*
SVTK_Renderer
::GetDevice()
return myDevice.GetPointer();
}
+/*!
+ Initialize renderer
+*/
void
SVTK_Renderer
::Initialize(vtkRenderWindowInteractor* theInteractor,
mySelector = theSelector;
}
-//----------------------------------------------------------------------------
+/*!
+ Publishes pointed actor into the renderer
+*/
void
SVTK_Renderer
::AddActor(VTKViewer_Actor* theActor)
}
}
+/*!
+ Removes pointed actor from the renderer
+*/
void
SVTK_Renderer
::RemoveActor(VTKViewer_Actor* theActor)
}
}
+/*!
+ Get special container that keeps scaling of the scene
+*/
VTKViewer_Transform*
SVTK_Renderer
::GetTransform()
return myTransform.GetPointer();
}
+/*!
+ Allows to get a scale that is applied on the whole scene
+*/
void
SVTK_Renderer
::GetScale( double theScale[3] )
myTransform->GetMatrixScale( theScale );
}
+/*!
+ Allows to apply a scale on the whole scene
+*/
void
SVTK_Renderer
::SetScale( double theScale[3] )
AdjustActors();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Applies color and size (PointSize and LineWidth) of primitives in selection mode
+*/
void
SVTK_Renderer
::SetSelectionProp(const double& theRed,
myHighlightProperty->SetPointSize( theWidth );
}
-//----------------------------------------------------------------------------
+/*!
+ Applies color and size (PointSize and LineWidth) of primitives in preselection mode
+*/
void
SVTK_Renderer
::SetPreselectionProp(const double& theRed,
myPreHighlightProperty->SetPointSize( theWidth );
}
-//----------------------------------------------------------------------------
+/*!
+ Setup requested tolerance for the picking
+*/
void
SVTK_Renderer
::SetSelectionTolerance(const double& theTolNodes,
}
-//----------------------------------------------------------------------------
/*! If parameter theIsForcedUpdate is true, recalculate parameters for
* trihedron and cube axes, even if trihedron and cube axes is invisible.
*/
return myIsTrihedronRelative;
}
-//----------------------------------------------------------------------------
VTKViewer_Trihedron*
SVTK_Renderer
::GetTrihedron()
}
-//----------------------------------------------------------------------------
SVTK_CubeAxesActor2D*
SVTK_Renderer
::GetCubeAxes()
}
-//----------------------------------------------------------------------------
void
SVTK_Renderer
::OnResetView()
}
-//----------------------------------------------------------------------------
void
SVTK_Renderer
::OnFitAll()
}
-//----------------------------------------------------------------------------
void
SVTK_Renderer
::OnResetClippingRange()
}
-//----------------------------------------------------------------------------
void
SVTK_Renderer
::OnFrontView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
void
SVTK_Renderer
::OnBackView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
void
SVTK_Renderer
::OnTopView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
void
SVTK_Renderer
::OnBottomView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
void
SVTK_Renderer
::OnLeftView()
this->OnFitAll();
}
-//----------------------------------------------------------------------------
void
SVTK_Renderer
::OnRightView()
class SVTK_Selector;
-//! The class is a container for #vtkRenderer instance.
-/*!
+/*!
+ \class SVTK_Renderer
+ The class is a container for #vtkRenderer instance.
Main goal of the class is to apply common behaviour to all #SALOME_Actor, like
selection and preselection colors.
Also, the class is responsible for management of internal actors like trihedron an so on.
*/
-//============================================================================
class SVTK_EXPORT SVTK_Renderer : public vtkObject
{
public:
SVTK_Selector* theSelector);
//----------------------------------------------------------------------------
- //! This method publishes pointed actor into the renderer
+ //! Publishes pointed actor into the renderer
virtual
void
AddActor(VTKViewer_Actor* theActor);
- //! This method removes pointed actor from the renderer
+ //! Removes pointed actor from the renderer
virtual
void
RemoveActor(VTKViewer_Actor* theActor);
VTKViewer_Transform*
GetTransform();
- //! This method allow to apply a scale on the whole scene
+ //! Allows to apply a scale on the whole scene
virtual
void
SetScale( double theScale[3] );
- //! This method allow to get a scale that is applied on the whole scene
+ //! Allows to get a scale that is applied on the whole scene
void
GetScale( double theScale[3] );
const double& theBlue = 1,
const int& theWidth = 5);
- //! Setup requested tollerance for the picking
+ //! Setup requested tolerance for the picking
void
SetSelectionTolerance(const double& theTolNodes = 0.025,
const double& theTolCell = 0.001);
return new SVTK_SelectorDef();
}
-//----------------------------------------------------------------------------
SVTK_SelectorDef
::SVTK_SelectorDef()
{
{
}
-//----------------------------------------------------------------------------
void
SVTK_SelectorDef
::StartPickCallback()
this->InvokeEvent(vtkCommand::StartPickEvent,NULL);
}
-//----------------------------------------------------------------------------
void
SVTK_SelectorDef
::EndPickCallback()
this->InvokeEvent(vtkCommand::EndPickEvent,NULL);
}
-//----------------------------------------------------------------------------
void
SVTK_SelectorDef
::SetSelectionMode(Selection_Mode theMode)
myMapIOSubIndex.clear();
}
-//----------------------------------------------------------------------------
bool
SVTK_SelectorDef
::IsSelected(const Handle(SALOME_InteractiveObject)& theIO) const
return NULL;
}
-//----------------------------------------------------------------------------
bool
SVTK_SelectorDef
::AddIObject(const Handle(SALOME_InteractiveObject)& theIO)
return !anIsIOBound || !anIsActorBound;
}
-//----------------------------------------------------------------------------
bool
SVTK_SelectorDef
::RemoveIObject(const Handle(SALOME_InteractiveObject)& theIO)
return RemoveIObject(anIO) || anIsActorBound;
}
-//----------------------------------------------------------------------------
const SALOME_ListIO&
SVTK_SelectorDef
::StoredIObjects() const
myMapIOSubIndex.clear();
}
-//----------------------------------------------------------------------------
void
SVTK_SelectorDef
::SetFilter(const Handle(VTKViewer_Filter)& theFilter)
myFilters.insert(TFilters::value_type(theFilter->GetId(),theFilter));
}
-//----------------------------------------------------------------------------
bool
SVTK_SelectorDef
::IsFilterPresent(const TFilterID theId) const
return myFilters.find(theId) != myFilters.end();
}
-//----------------------------------------------------------------------------
void
SVTK_SelectorDef
::RemoveFilter(const TFilterID theId)
myFilters.erase(theId);
}
-//----------------------------------------------------------------------------
bool
SVTK_SelectorDef
::IsValid(SALOME_Actor* theActor,
return true;
}
-//----------------------------------------------------------------------------
Handle(VTKViewer_Filter)
SVTK_SelectorDef
::GetFilter(const TFilterID theId) const
#include "SVTK_SpaceMouse.h"
-//---------------------------------------------
SVTK_SpaceMouse* SVTK_SpaceMouse::myInstance = 0;
-//---------------------------------------------
+/*!
+ \return shared instance of object (creates if there is no one)
+*/
SVTK_SpaceMouse* SVTK_SpaceMouse::getInstance()
{
if ( !myInstance )
return myInstance;
}
-//---------------------------------------------
+/*!
+ Constructor
+*/
SVTK_SpaceMouse::SVTK_SpaceMouse()
{
win = InputFocus;
spaceMouseOn = 0;
}
-//---------------------------------------------
+/*!
+ Initialization
+*/
int SVTK_SpaceMouse::initialize( Display *display, Window window )
{
XMotionEvent = XInternAtom( display, "MotionEvent", 1 );
return spaceMouseOn;
}
-//---------------------------------------------
static int errorCallback( Display *display, XErrorEvent *Error )
{
char msg[ 128 ];
return 0;
}
-//---------------------------------------------
+/*!
+ Initialize by window
+*/
int SVTK_SpaceMouse::setWindow( Display *display, Window window )
{
XTextProperty winName;
return result;
}
-//---------------------------------------------
+/*!
+ Close
+*/
int SVTK_SpaceMouse::close(Display *display)
{
initialize( display, (Window)InputFocus );
return 1;
}
-//---------------------------------------------
+/*!
+ Custom event handler
+*/
int SVTK_SpaceMouse::translateEvent( Display* display, XEvent* xEvent, MoveEvent* spaceMouseEvent,
double scale, double rScale )
{
#include <vtkActorCollection.h>
#include <vtkRenderer.h>
-//****************************************************************
vtkStandardNewMacro(SVTK_Trihedron);
-//****************************************************************
+/*!
+ Constructor
+*/
SVTK_Trihedron
::SVTK_Trihedron()
{
}
-//****************************************************************
+/*!
+ \return count of visible actors
+ \param theRenderer - renderer to be checked
+*/
int
SVTK_Trihedron
::GetVisibleActorCount(vtkRenderer* theRenderer)
myPriority);
}
-/*
- * Destroys the object and frees any allocated resources
+/*!
+ Destroys the object and frees any allocated resources
*/
SVTK_UpdateRateDlg
::~SVTK_UpdateRateDlg()
// no need to delete child widgets, Qt does it all for us
}
+/*!
+ Processes events
+*/
void
SVTK_UpdateRateDlg
::ProcessEvents(vtkObject* vtkNotUsed(theObject),
}
}
+/*!
+ Update
+*/
void
SVTK_UpdateRateDlg
::Update()
myRWInteractor->getRenderWindow()->Render();
}
+/*!
+ SLOT on OK clicked
+*/
void
SVTK_UpdateRateDlg
::onClickOk()
onClickClose();
}
+/*!
+ SLOT on Apply clicked
+*/
void
SVTK_UpdateRateDlg
::onClickApply()
Update();
}
+/*!
+ SLOT on Close clicked
+*/
void
SVTK_UpdateRateDlg
::onClickClose()
#include <vtkActorCollection.h>
#include <vtkRenderer.h>
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_SignalHandler
::SVTK_SignalHandler(SVTK_MainWindow* theMainWindow):
QObject(theMainWindow),
this,SIGNAL(selectionChanged()));
}
+/*!
+ Destructor
+*/
SVTK_SignalHandler
::~SVTK_SignalHandler()
{
}
+/*!
+ \return corresponding svtk main window
+*/
SVTK_MainWindow*
SVTK_SignalHandler
::GetMainWindow()
}
-//----------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_MainWindow::Repaint (just for flexibility)
+*/
void
SVTK_SignalHandler
::Repaint(bool theUpdateTrihedron)
myMainWindow->Repaint(theUpdateTrihedron);
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_MainWindow::GetRenderer (just for flexibility)
+*/
SVTK_Renderer*
SVTK_SignalHandler
::GetRenderer()
return myMainWindow->GetRenderer();
}
+/*!
+ Redirect the request to #SVTK_MainWindow::getRenderer (just for flexibility)
+*/
vtkRenderer*
SVTK_SignalHandler
::getRenderer()
return myMainWindow->getRenderer();
}
-//----------------------------------------------------------------
namespace SVTK
{
struct THighlightAction
};
}
+/*!
+ SLOT: called on selection change
+*/
void
SVTK_SignalHandler
::onSelectionChanged()
myMainWindow->Repaint(false);
}
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_View
::SVTK_View(SVTK_MainWindow* theMainWindow) :
SVTK_SignalHandler(theMainWindow)
{
}
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
SVTK_View
::~SVTK_View()
{
}
-//----------------------------------------------------------------
+/*!
+ Unhilights all objects in viewer
+*/
void
SVTK_View
::unHighlightAll()
Repaint();
}
-//----------------------------------------------------------------
+/*!
+ Hilights/unhilights object in viewer
+ \param theIO - object to be updated
+ \param theIsHighlight - if it is true, object will be hilighted, otherwise it will be unhilighted
+ \param theIsUpdate - update current viewer
+*/
void
SVTK_View
::highlight( const Handle(SALOME_InteractiveObject)& theIO,
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::SetPreselectionProp
+*/
void
SVTK_View
::SetSelectionProp(const double& theRed,
GetRenderer()->SetSelectionProp(theRed,theGreen,theBlue,theWidth);
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::SetPreselectionProp
+*/
void
SVTK_View
::SetPreselectionProp(const double& theRed,
GetRenderer()->SetPreselectionProp(theRed,theGreen,theBlue,theWidth);
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::SetPreselectionProp
+*/
void
SVTK_View
::SetSelectionTolerance(const double& theTolNodes,
GetRenderer()->SetSelectionTolerance(theTolNodes,theTolCell);
}
-//----------------------------------------------------------------------------
+/*!
+ \return true if object is in viewer or in collector
+ \param theIO - object to be checked
+*/
bool
SVTK_View
::isInViewer(const Handle(SALOME_InteractiveObject)& theIObject)
return anActor != NULL;
}
-//----------------------------------------------------------------------------
+/*!
+ \return true if object is displayed in viewer
+ \param theIO - object to be checked
+*/
bool
SVTK_View
::isVisible(const Handle(SALOME_InteractiveObject)& theIObject)
return anActor != NULL && anActor->GetVisibility();
}
-//----------------------------------------------------------------------------
+/*!
+ Changes name of object
+ \param theIObject - object to be renamed
+ \param theName - new name
+*/
void
SVTK_View
::rename(const Handle(SALOME_InteractiveObject)& theIObject,
(&SALOME_Actor::setName,theName.latin1()));
}
-//----------------------------------------------------------------------------
+/*!
+ \return current display mode (obsolete)
+*/
int
SVTK_View
::GetDisplayMode()
return myDisplayMode;
}
+/*!
+ Set current display mode
+ \param theMode - new display mode
+*/
void
SVTK_View
::SetDisplayMode(int theMode)
myDisplayMode = theMode;
}
+/*!
+ Set current display mode
+ \param theIObject - object
+ \param theMode - new display mode
+*/
void
SVTK_View
::SetDisplayMode(const Handle(SALOME_InteractiveObject)& theIObject,
(&SALOME_Actor::setDisplayMode,theMode));
}
-//----------------------------------------------------------------------------
+/*!
+ Change all actors to wireframe
+*/
void
SVTK_View
::ChangeRepresentationToWireframe()
ChangeRepresentationToWireframe(getRenderer()->GetActors());
}
+/*!
+ Change all actors to shading
+*/
void
SVTK_View
::ChangeRepresentationToSurface()
ChangeRepresentationToSurface(getRenderer()->GetActors());
}
-
+/*!
+ Change to wireframe a list of vtkactor
+ theCollection - list of vtkactor
+*/
void
SVTK_View
::ChangeRepresentationToWireframe(vtkActorCollection* theCollection)
Repaint();
}
+/*!
+ Change to shading a list of vtkactor
+ theCollection - list of vtkactor
+*/
void
SVTK_View
::ChangeRepresentationToSurface(vtkActorCollection* theCollection)
Repaint();
}
-//----------------------------------------------------------------------------
namespace SVTK
{
struct TErase
};
}
+/*!
+ To erase all existing VTK presentations
+*/
void
SVTK_View
::EraseAll()
Repaint();
}
+/*!
+ To display all existing VTK presentations
+*/
void
SVTK_View
::DisplayAll()
Repaint();
}
-
+/*!
+ To erase VTK presentation
+ \param theActor - actor
+ \param theIsUpdate - updates current viewer
+*/
void
SVTK_View
::Erase(SALOME_Actor* theActor,
}
+/*!
+ To erase VTK presentation
+ \param theIObject - object
+ \param theIsUpdate - updates current viewer
+*/
void
SVTK_View
::Erase(const Handle(SALOME_InteractiveObject)& theIObject,
Repaint();
}
-//----------------------------------------------------------------------------
+/*!
+ To display the VTK presentation
+*/
void
SVTK_View
::Display(SALOME_Actor* theActor,
Repaint();
}
+/*!
+ To display the VTK presentation
+*/
void
SVTK_View
::Display(const Handle(SALOME_InteractiveObject)& theIObject,
Repaint();
}
+/*!
+ To display VTK presentation with defined #SALOME_InteractiveObject and erase all others
+*/
void
SVTK_View
::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIObject)
}
-//----------------------------------------------------------------------------
namespace SVTK
{
struct TRemoveAction
};
}
+/*!
+ To remove the VTK presentation
+*/
void
SVTK_View
::Remove(const Handle(SALOME_InteractiveObject)& theIObject,
Repaint();
}
+/*!
+ To remove the VTK presentation
+*/
void
SVTK_View
::Remove(SALOME_Actor* theActor,
Repaint();
}
+/*!
+ To remove all VTK presentations
+*/
void
SVTK_View
::RemoveAll(bool theIsUpdate)
}
}
-//----------------------------------------------------------------------------
+/*!
+ \return current transparency
+ \param theIObject - object
+*/
float
SVTK_View
::GetTransparency(const Handle(SALOME_InteractiveObject)& theIObject)
}
+/*!
+ Sets current transparency
+ \param theIObject - object
+ \param theTrans - new transparency
+*/
void
SVTK_View
::SetTransparency(const Handle(SALOME_InteractiveObject)& theIObject,
(&SALOME_Actor::SetOpacity,anOpacity));
}
-//----------------------------------------------------------------------------
+/*!
+ Change color
+ \param theIObject - object
+ \param theColor - new color
+*/
void
SVTK_View
::SetColor(const Handle(SALOME_InteractiveObject)& theIObject,
}
+/*!
+ \return object color
+ \param theIObject - object
+*/
QColor
SVTK_View
::GetColor(const Handle(SALOME_InteractiveObject)& theIObject)
class SALOME_Actor;
-//----------------------------------------------------------------------------
//! Main purpose of the class is to provide a way to customize #SVTK_MainWindow.
/*!
This class is initialized by #SVTK_MainWindow and just pass Qt signals from
};
-//----------------------------------------------------------------------------
//! This class is introduced just for compatibility with old code.
/*!
This class contains frequantly used functionality in old code.
int SVTK_ViewManager::_SVTKViewMgr_Id = 0;
-//***************************************************************
+/*!
+ Constructor
+*/
SVTK_ViewManager::SVTK_ViewManager( SUIT_Study* study,
SUIT_Desktop* theDesktop )
: SUIT_ViewManager( study, theDesktop )
setViewModel( new SVTK_Viewer() );
}
-//***************************************************************
+/*!
+ Destructor
+*/
SVTK_ViewManager::~SVTK_ViewManager()
{
}
-//***************************************************************
+/*!
+ \return corresponding main window
+*/
SUIT_Desktop* SVTK_ViewManager::getDesktop()
{
return myDesktop;
}
-//***************************************************************
+/*!
+ Sets default name of view
+*/
void SVTK_ViewManager::setViewName(SUIT_ViewWindow* theView)
{
int aPos = myViews.find(theView);
// return aMgr->GetStudyByID( id );
//}
-//==========================================================
+/*!
+ Constructor
+*/
SVTK_Viewer::SVTK_Viewer()
{
myTrihedronSize = 105;
myTrihedronRelative = true;
}
-//==========================================================
+/*!
+ Destructor
+*/
SVTK_Viewer::~SVTK_Viewer()
{
}
+/*!
+ \return background color
+*/
QColor
SVTK_Viewer
::backgroundColor() const
return myBgColor;
}
+/*!
+ Changes background color
+ \param theColor - new background color
+*/
void
SVTK_Viewer
::setBackgroundColor( const QColor& theColor )
myBgColor = theColor;
}
-//==========================================================
+/*!Create new instance of view window on desktop \a theDesktop.
+ *\retval SUIT_ViewWindow* - created view window pointer.
+ */
SUIT_ViewWindow*
SVTK_Viewer::
createView( SUIT_Desktop* theDesktop )
return aViewWindow;
}
+/*!
+ \return trihedron size
+*/
int SVTK_Viewer::trihedronSize() const
{
return myTrihedronSize;
}
+/*!
+ \return true if thihedron changes size in accordance with bounding box
+*/
bool SVTK_Viewer::trihedronRelative() const
{
return myTrihedronRelative;
}
+/*!
+ Sets trihedron size and relativeness( whether thihedron changes size in accordance with bounding box)
+ \param theSize - new size
+ \param theRelative - new relativeness
+*/
void SVTK_Viewer::setTrihedronSize( const int theSize, const bool theRelative )
{
myTrihedronSize = theSize;
}
}
-//==========================================================
+/*!
+ Sets new view manager
+ \param theViewManager - new view manager
+*/
void SVTK_Viewer::setViewManager(SUIT_ViewManager* theViewManager)
{
SUIT_ViewModel::setViewManager(theViewManager);
this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
}
-//==========================================================
+/*!
+ Builds popup for vtk viewer
+*/
void
SVTK_Viewer
::contextMenuPopup( QPopupMenu* thePopup )
}
}
-//==========================================================
+/*!
+ SLOT: called on mouse button press, empty implementation
+*/
void
SVTK_Viewer
::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event)
{}
-//==========================================================
+/*!
+ SLOT: called on mouse move, empty implementation
+*/
void
SVTK_Viewer
::onMouseMove(SUIT_ViewWindow* vw, QMouseEvent* event)
{}
-//==========================================================
+/*!
+ SLOT: called on mouse button release, empty implementation
+*/
void
SVTK_Viewer
::onMouseRelease(SUIT_ViewWindow* vw, QMouseEvent* event)
{}
-//==========================================================
+/*!
+ Enables/disables selection
+ \param isEnabled - new state
+*/
void
SVTK_Viewer
::enableSelection(bool isEnabled)
//!! To be done for view windows
}
-//==========================================================
+/*!
+ Enables/disables selection of many object
+ \param isEnabled - new state
+*/
void
SVTK_Viewer
::enableMultiselection(bool isEnable)
//!! To be done for view windows
}
+/*!
+ SLOT: called on dump view operation is activated, stores scene to raster file
+*/
void
SVTK_Viewer
::onDumpView()
aView->onDumpView();
}
-//==========================================================
+/*!
+ SLOT: called if background color is to be changed changed, passes new color to view port
+*/
void
SVTK_Viewer
::onChangeBgColor()
}
}
-//==========================================================
+/*!
+ SLOT: called when popup item "Show toolbar" is activated, shows toolbar of active view window
+*/
void
SVTK_Viewer
::onShowToolbar()
}
}
-//==========================================================
+/*!
+ Display presentation
+ \param prs - presentation
+*/
void
SVTK_Viewer
::Display( const SALOME_VTKPrs* prs )
}
}
-//==========================================================
+/*!
+ Erase presentation
+ \param prs - presentation
+ \param forced - removes object from view
+*/
void
SVTK_Viewer
::Erase( const SALOME_VTKPrs* prs, const bool forced )
}
}
}
-
-//==========================================================
+
+/*!
+ Erase all presentations
+ \param forced - removes all objects from view
+*/
void
SVTK_Viewer
::EraseAll( const bool forced )
Repaint();
}
-//==========================================================
+/*!
+ Create presentation corresponding to the entry
+ \param entry - entry
+*/
SALOME_Prs*
SVTK_Viewer
::CreatePrs( const char* entry )
return prs;
}
-//==========================================================
+/*!
+ Auxiliary method called before displaying of objects
+*/
void
SVTK_Viewer
::BeforeDisplay( SALOME_Displayer* d )
d->BeforeDisplay( this, SALOME_VTKViewType() );
}
-//==========================================================
+/*!
+ Auxiliary method called after displaying of objects
+*/
void
SVTK_Viewer::AfterDisplay( SALOME_Displayer* d )
{
d->AfterDisplay( this, SALOME_VTKViewType() );
}
-//==========================================================
+/*!
+ \return true if object is displayed in viewer
+ \param obj - object to be checked
+*/
bool
SVTK_Viewer
::isVisible( const Handle(SALOME_InteractiveObject)& io )
return true;
}
-//==========================================================
+/*!
+ Updates current viewer
+*/
void
SVTK_Viewer
::Repaint()
#include "VTKViewer_Algorithm.h"
#include "SVTK_Functor.h"
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
SVTK_ViewWindow
::SVTK_ViewWindow(SUIT_Desktop* theDesktop):
SUIT_ViewWindow(theDesktop),
myView(NULL)
{}
+/*!
+ To initialize #SVTK_ViewWindow instance
+*/
void
SVTK_ViewWindow
::Initialize(SVTK_ViewModelBase* theModel)
}
}
+/*!
+ To initialize #SVTK_ViewWindow instance
+*/
void
SVTK_ViewWindow
::Initialize(SVTK_View* theView,
theModel,SLOT(onSelectionChanged()));
}
+/*!
+ Destructor
+*/
SVTK_ViewWindow
::~SVTK_ViewWindow()
{}
-//----------------------------------------------------------------------------
+/*!
+ \return corresponding view
+*/
SVTK_View*
SVTK_ViewWindow
::getView()
return myView;
}
+/*!
+ \return corresponding vtk main window
+*/
SVTK_MainWindow*
SVTK_ViewWindow
::getMainWindow()
return myMainWindow;
}
+/*!
+ \return corresponding vtk render window
+*/
vtkRenderWindow*
SVTK_ViewWindow
::getRenderWindow()
return getMainWindow()->getRenderWindow();
}
+/*!
+ \return corresponding vtk render window interactor
+*/
vtkRenderWindowInteractor*
SVTK_ViewWindow
::getInteractor()
return getMainWindow()->getInteractor();
}
+/*!
+ \return corresponding vtk renderer
+*/
vtkRenderer*
SVTK_ViewWindow
::getRenderer()
return myMainWindow->getRenderer();
}
+/*!
+ \return corresponding vtk selector
+*/
SVTK_Selector*
SVTK_ViewWindow
::GetSelector()
return myMainWindow->GetSelector();
}
-
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "front view"
+*/
void
SVTK_ViewWindow
::onFrontView()
myMainWindow->onFrontView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "back view"
+*/
void
SVTK_ViewWindow
::onBackView()
myMainWindow->onBackView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "top view"
+*/
void
SVTK_ViewWindow
::onTopView()
myMainWindow->onTopView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "bottom view"
+*/
void
SVTK_ViewWindow
::onBottomView()
myMainWindow->onBottomView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "left view"
+*/
void
SVTK_ViewWindow
::onLeftView()
myMainWindow->onLeftView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "right view"
+*/
void
SVTK_ViewWindow
::onRightView()
myMainWindow->onRightView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "reset view": sets default orientation of viewport camera
+*/
void
SVTK_ViewWindow
::onResetView()
myMainWindow->onResetView();
}
-//----------------------------------------------------------------------------
+/*!
+ Processes transformation "fit all"
+*/
void
SVTK_ViewWindow
::onFitAll()
myMainWindow->onFitAll();
}
-//----------------------------------------------------------------
+/*!
+ SLOT: called if selection is changed
+*/
void
SVTK_ViewWindow
::onSelectionChanged()
myView->onSelectionChanged();
}
-//----------------------------------------------------------------
+/*!
+ Change selection mode
+ \param theMode - new selection mode
+*/
void
SVTK_ViewWindow
::SetSelectionMode(Selection_Mode theMode)
myMainWindow->SetSelectionMode( theMode );
}
-//----------------------------------------------------------------
+/*!
+ \return selection mode
+*/
Selection_Mode
SVTK_ViewWindow
::SelectionMode() const
return myMainWindow->SelectionMode();
}
-//----------------------------------------------------------------
+/*!
+ Unhilights all objects in viewer
+*/
void
SVTK_ViewWindow
::unHighlightAll()
myView->unHighlightAll();
}
-//----------------------------------------------------------------
+/*!
+ Hilights/unhilights object in viewer
+ \param theIO - object to be updated
+ \param theIsHighlight - if it is true, object will be hilighted, otherwise it will be unhilighted
+ \param theIsUpdate - update current viewer
+*/
void
SVTK_ViewWindow
::highlight(const Handle(SALOME_InteractiveObject)& theIO,
myView->highlight( theIO, theIsHighlight, theIsUpdate );
}
-//----------------------------------------------------------------
+/*!
+ \return true if object is in viewer or in collector
+ \param theIO - object to be checked
+*/
bool
SVTK_ViewWindow
::isInViewer( const Handle(SALOME_InteractiveObject)& theIO )
return myView->isInViewer( theIO );
}
-//----------------------------------------------------------------
+/*!
+ \return true if object is displayed in viewer
+ \param theIO - object to be checked
+*/
bool
SVTK_ViewWindow
::isVisible( const Handle(SALOME_InteractiveObject)& theIO )
return myView->isVisible( theIO );
}
-//----------------------------------------------------------------
+/*!
+ Display object
+ \param theIO - object
+ \param theImmediatly - update viewer
+*/
void
SVTK_ViewWindow
::Display(const Handle(SALOME_InteractiveObject)& theIO,
myView->Display(theIO,theImmediatly);
}
+/*!
+ Erase object
+ \param theIO - object
+ \param theImmediatly - update viewer
+*/
void
SVTK_ViewWindow
::Erase(const Handle(SALOME_InteractiveObject)& theIO,
myView->Erase(theIO,theImmediatly);
}
+/*!
+ Display only passed object
+ \param theIO - object
+*/
void
SVTK_ViewWindow
::DisplayOnly(const Handle(SALOME_InteractiveObject)& theIO)
myView->DisplayOnly(theIO);
}
+/*!
+ Display all objects in view
+*/
void
SVTK_ViewWindow
::DisplayAll()
myView->DisplayAll();
}
+/*!
+ Erase all objects in view
+*/
void
SVTK_ViewWindow
::EraseAll()
myView->EraseAll();
}
-//----------------------------------------------------------------------------
+/*!
+ Sets background color
+ \param color - new background color
+*/
void
SVTK_ViewWindow
::setBackgroundColor( const QColor& color )
myMainWindow->SetBackgroundColor( color );
}
-//----------------------------------------------------------------------------
+/*!
+ \return background color of viewer
+*/
QColor
SVTK_ViewWindow
::backgroundColor() const
return myMainWindow->BackgroundColor();
}
-//----------------------------------------------------------------------------
+/*!
+ Updates current viewer
+*/
void
SVTK_ViewWindow
::Repaint(bool theUpdateTrihedron)
myMainWindow->Repaint( theUpdateTrihedron );
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::GetScale
+*/
void
SVTK_ViewWindow
::GetScale( double theScale[3] )
myMainWindow->GetScale( theScale );
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::SetScale
+*/
void
SVTK_ViewWindow
::SetScale( double theScale[3] )
myMainWindow->SetScale( theScale );
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::IsTrihedronDisplayed
+*/
bool
SVTK_ViewWindow
::isTrihedronDisplayed()
return myMainWindow->IsTrihedronDisplayed();
}
+/*!
+ Redirect the request to #SVTK_Renderer::IsCubeAxesDisplayed
+*/
bool
SVTK_ViewWindow
::isCubeAxesDisplayed()
return myMainWindow->IsCubeAxesDisplayed();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::OnViewTrihedron
+*/
void
SVTK_ViewWindow
::onViewTrihedron()
myMainWindow->onViewTrihedron();
}
+/*!
+ Redirect the request to #SVTK_Renderer::OnViewCubeAxes
+*/
void
SVTK_ViewWindow
::onViewCubeAxes()
myMainWindow->onViewCubeAxes();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::GetTrihedron
+*/
VTKViewer_Trihedron*
SVTK_ViewWindow::
GetTrihedron()
return myMainWindow->GetTrihedron();
}
+/*!
+ Redirect the request to #SVTK_Renderer::GetCubeAxes
+*/
SVTK_CubeAxesActor2D*
SVTK_ViewWindow
::GetCubeAxes()
return myMainWindow->GetCubeAxes();
}
+/*!
+ \return trihedron size
+*/
int
SVTK_ViewWindow
::GetTrihedronSize() const
return myMainWindow->GetTrihedronSize();
}
+/*!
+ Sets trihedron size
+ \param theSize - new trihedron size
+ \param theRelative - trihedron relativeness
+*/
void
SVTK_ViewWindow
::SetTrihedronSize(const int theSize, const bool theRelative)
myMainWindow->AdjustActors();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::OnAdjustTrihedron
+*/
void
SVTK_ViewWindow
::onAdjustTrihedron()
myMainWindow->onAdjustTrihedron();
}
+/*!
+ Redirect the request to #SVTK_Renderer::OnAdjustCubeAxes
+*/
void
SVTK_ViewWindow
::onAdjustCubeAxes()
myMainWindow->onAdjustCubeAxes();
}
-//=======================================================================
+/*!
+ Emits key pressed
+*/
void
SVTK_ViewWindow
::onKeyPressed(QKeyEvent* event)
emit keyPressed( this, event );
}
-//=======================================================================
+/*!
+ Emits key released
+*/
void
SVTK_ViewWindow
::onKeyReleased(QKeyEvent* event)
emit keyReleased( this, event );
}
-//=======================================================================
+/*!
+ Emits mouse pressed
+*/
void
SVTK_ViewWindow
::onMousePressed(QMouseEvent* event)
emit mousePressed(this, event);
}
-//=======================================================================
+/*!
+ Emits mouse released
+*/
void
SVTK_ViewWindow
::onMouseReleased(QMouseEvent* event)
emit mouseReleased( this, event );
}
-//=======================================================================
+/*!
+ Emits mouse moving
+*/
void
SVTK_ViewWindow
::onMouseMoving(QMouseEvent* event)
emit mouseMoving( this, event );
}
-//=======================================================================
+/*!
+ Emits mouse double clicked
+*/
void
SVTK_ViewWindow
::onMouseDoubleClicked( QMouseEvent* event )
emit mouseDoubleClicked( this, event );
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::AddActor
+*/
void
SVTK_ViewWindow
::AddActor( VTKViewer_Actor* theActor,
myMainWindow->AddActor( theActor, theUpdate );
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::RemoveActor
+*/
void
SVTK_ViewWindow
::RemoveActor( VTKViewer_Actor* theActor,
myMainWindow->RemoveActor( theActor, theUpdate );
}
-//----------------------------------------------------------------------------
+/*!
+ \return QImage, containing all scene rendering in window
+*/
QImage
SVTK_ViewWindow
::dumpView()
return myMainWindow->dumpView();
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::SetSelectionProp
+*/
void
SVTK_ViewWindow
::SetSelectionProp(const double& theRed,
myView->SetSelectionProp(theRed,theGreen,theBlue,theWidth);
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::SetSelectionProp
+*/
void
SVTK_ViewWindow
::SetPreselectionProp(const double& theRed,
myView->SetPreselectionProp(theRed,theGreen,theBlue,theWidth);
}
-//----------------------------------------------------------------------------
+/*!
+ Redirect the request to #SVTK_Renderer::SetSelectionTolerance
+*/
void
SVTK_ViewWindow
::SetSelectionTolerance(const double& theTolNodes,
myView->SetSelectionTolerance(theTolNodes,theTolItems);
}
-//----------------------------------------------------------------------------
int convertAction( const int accelAction )
{
switch ( accelAction ) {
return accelAction;
}
-//----------------------------------------------------------------------------
+/*!
+ Performs action
+ \param accelAction - action
+*/
void
SVTK_ViewWindow
::action( const int accelAction )
return retStr;
}
-/* The method restores visual parameters of this view or postpones it untill the view is shown
- */
+/*!
+ The method restores visual parameters of this view or postpones it untill the view is shown
+*/
void
SVTK_ViewWindow
::setVisualParameters( const QString& parameters )
}
}
-/* The method restores visual parameters of this view from a formated string
- */
+/*!
+ The method restores visual parameters of this view from a formated string
+*/
void
SVTK_ViewWindow
::doSetVisualParameters( const QString& parameters )
}
-//================================================================
-// Function : eventFilter
-/*! Purpose : delayed setVisualParameters
+/*!
+ Delayed setVisualParameters
*/
-//================================================================
bool SVTK_ViewWindow::eventFilter( QObject* theWatched, QEvent* theEvent )
{
if ( theEvent->type() == QEvent::Show && theWatched->inherits( "SVTK_RenderWindowInteractor" ) ) {
return new SalomeApp_Application();
}
-/*
- Class : SalomeApp_Application
- Description : Application containing SalomeApp module or LightApp module
-*/
-
/*!Constructor.*/
SalomeApp_Application::SalomeApp_Application()
: LightApp_Application()
QApplication::restoreOverrideCursor();
}
-//=======================================================================
-// name : createNewStudy
-/*! Purpose : Create new study*/
-//=======================================================================
+/*!
+ Creates new study
+*/
SUIT_Study* SalomeApp_Application::createNewStudy()
{
SalomeApp_Study* aStudy = new SalomeApp_Study( this );
return aStudy;
}
-//=======================================================================
-// name : updateCommandsStatus
-/*! Purpose : Enable/Disable menu items and toolbar buttons. Rebuild menu*/
-//=======================================================================
+/*!
+ Enable/Disable menu items and toolbar buttons. Rebuild menu
+*/
void SalomeApp_Application::updateCommandsStatus()
{
LightApp_Application::updateCommandsStatus();
onSelectionChanged();
}
-/*
- Class : DumpStudyFileDlg
- Description : Private class used in Dump Study operation. Consists 2 check boxes:
- "Publish in study" and "Save GUI parameters"
+/*!
+ \class DumpStudyFileDlg
+ Private class used in Dump Study operation. Consists 2 check boxes:
+ "Publish in study" and "Save GUI parameters"
*/
class DumpStudyFileDlg : public SUIT_FileDlg
{
}
}
+/*!
+ Creates new view manager
+ \param type - type of view manager
+*/
SUIT_ViewManager* SalomeApp_Application::newViewManager(const QString& type)
{
return createViewManager(type);
#endif
/*!
- Description : Application containing SalomeApp module or LightApp module
+ \class SalomeApp_Application
+ \brief Application containing SalomeApp module or LightApp module
*/
class SALOMEAPP_EXPORT SalomeApp_Application : public LightApp_Application
#include <SALOMEconfig.h>
#include CORBA_SERVER_HEADER(SALOME_Exception)
-//=======================================================================
-// name : SalomeApp_DataModelSync
-/*!Purpose : Auxiliary class for synchronizing tree of kernel objects and SUIT_DataObjects */
-//=======================================================================
-
typedef _PTR(SObject) kerPtr;
typedef SUIT_DataObject* suitPtr;
+/*!
+ \class SalomeApp_DataModelSync
+ Auxiliary class for synchronizing tree of kernel objects and SUIT_DataObjects
+*/
class SalomeApp_DataModelSync
{
public:
SUIT_DataObject* myRoot;
};
-
+/*!
+ Constructor
+*/
SalomeApp_DataModelSync::SalomeApp_DataModelSync( _PTR( Study ) aStudy, SUIT_DataObject* aRoot )
: myStudy( aStudy ),
myRoot( aRoot )
{
}
+/*!
+ \return true if kernel object is correct (has non empty name or is reference)
+*/
bool SalomeApp_DataModelSync::isCorrect( const kerPtr& so ) const
{
kerPtr refObj;
return res;
}
+/*!
+ Creates SUIT object by KERNEL object
+ \param so - corresponding KERNEL object
+ \param parent - parent for SUIT object
+ \param after - previous sibling for SUIT object
+ \param prepend - SUIT object must be added to start of children list
+*/
suitPtr SalomeApp_DataModelSync::createItem( const kerPtr& so,
const suitPtr& parent,
const suitPtr& after,
return nitem;
}
+/*!
+ Deletes object with all children
+ \param p - SUIT object
+*/
void SalomeApp_DataModelSync::deleteItemWithChildren( const suitPtr& p ) const
{
if( !p )
delete p;
}
+/*!
+ \return true if objects correspond each other at all
+ \param p - kernel object
+ \param q - suit object
+*/
bool SalomeApp_DataModelSync::isEqual( const kerPtr& p, const suitPtr& q ) const
{
LightApp_ModuleObject* lobj = dynamic_cast<LightApp_ModuleObject*>( q );
return res;
}
+/*!
+ \return null kernel object
+*/
kerPtr SalomeApp_DataModelSync::nullSrc() const
{
return kerPtr();
}
+/*!
+ \return null suit object
+*/
suitPtr SalomeApp_DataModelSync::nullTrg() const
{
return suitPtr( 0 );
}
+/*!
+ Fills list with children of kernel object
+ \param obj - kernel object
+ \param ch - list to be filled
+*/
void SalomeApp_DataModelSync::children( const kerPtr& obj, QValueList<kerPtr>& ch ) const
{
ch.clear();
ch.append( it->Value() );
}
+/*!
+ Fills list with children of SUIT object
+ \param p - SUIT object
+ \param ch - list to be filled
+*/
void SalomeApp_DataModelSync::children( const suitPtr& p, QValueList<suitPtr>& ch ) const
{
DataObjectList l;
}
}
+/*!
+ \return parent of SUIT object
+ \param p - SUIT object
+*/
suitPtr SalomeApp_DataModelSync::parent( const suitPtr& p ) const
{
return p ? p->parent(): 0;
}
+/*!
+ Updates SUIT object
+ \param p - SUIT object
+*/
void SalomeApp_DataModelSync::updateItem( const suitPtr& ) const
{
}
+/*!
+ Auxiliary function, shows SUIT tree
+*/
void showTree( SUIT_DataObject* root )
{
qDebug( root ? "<tree>" : "<empty tree>" );
}
}
-//=======================================================================
-// name : SalomeApp_DataModel::SalomeApp_DataModel
-/*!Purpose : Constructor*/
-//=======================================================================
+/*!
+ Constructor
+*/
SalomeApp_DataModel::SalomeApp_DataModel( CAM_Module* theModule )
: LightApp_DataModel( theModule )
{
}
-//=======================================================================
-// name : SalomeApp_DataModel::~SalomeApp_DataModel
-/*! Purpose : Destructor*/
-//=======================================================================
+/*!
+ Destructor
+*/
SalomeApp_DataModel::~SalomeApp_DataModel()
{
}
-//================================================================
-// Function : open
-/*! Purpose : Open data model*/
-//================================================================
+/*!
+ Opens data model
+*/
bool SalomeApp_DataModel::open( const QString& name, CAM_Study* study, QStringList )
{
SalomeApp_Study* aDoc = dynamic_cast<SalomeApp_Study*>( study );
return true;
}
-//================================================================
-// Function : create
-/*! Purpose : Create data model*/
-//================================================================
+/*!
+ Creates data model
+*/
bool SalomeApp_DataModel::create( CAM_Study* theStudy )
{
update(NULL, (LightApp_Study*)theStudy);
return true;
}
-//================================================================
-// Function : update
-/*! Purpose : Update application.*/
-//================================================================
+/*!
+ Updates application.
+*/
void SalomeApp_DataModel::update( LightApp_DataObject*, LightApp_Study* study )
{
SalomeApp_Study* aSStudy = dynamic_cast<SalomeApp_Study*>(study);
updateTree( sobj, aSStudy );
}
-//================================================================
-// Function : synchronize
-/*! Purpose : synchronizes kernel tree and suit data tree starting from component 'sobj' */
-//================================================================
+/*!
+ Synchronizes kernel tree and suit data tree starting from component 'sobj'
+*/
SUIT_DataObject* SalomeApp_DataModel::synchronize( const _PTR( SComponent )& sobj, SalomeApp_Study* study )
{
if( !study || !study->root() || !sobj )
return 0;
}
-//================================================================
-// Function : updateTree
-/*! Purpose : updates tree.*/
-//================================================================
+/*!
+ Updates tree.
+*/
void SalomeApp_DataModel::updateTree( const _PTR( SComponent )& comp, SalomeApp_Study* study )
{
SalomeApp_ModuleObject* aNewRoot = dynamic_cast<SalomeApp_ModuleObject*>( synchronize( comp, study ) );
}
}
-//================================================================
-// Function : getModule
-/*! Purpose : gets module*/
-//================================================================
-
+/*!
+ \return module
+*/
SalomeApp_Module* SalomeApp_DataModel::getModule() const
{
return dynamic_cast<SalomeApp_Module*>( module() );
}
-//================================================================
-// Function : getStudy
-/*! Purpose : gets study */
-//================================================================
+/*!
+ \return study
+*/
SalomeApp_Study* SalomeApp_DataModel::getStudy() const
{
if(!root()) return 0;
return aStudy;
}
-//================================================================
-// Function : getRootEntry
-/*! Purpose : returns study entry corresponding to this data model*/
-//================================================================
+/*!
+ \return study entry corresponding to this data model
+*/
QString SalomeApp_DataModel::getRootEntry( SalomeApp_Study* study ) const
{
QString anEntry;
#include <SALOMEDSClient_AttributeTableOfReal.hxx>
#include <SALOMEDSClient_AttributeTableOfInteger.hxx>
-/*
- Class: SalomeApp_DataObject
- Level: Public
-*/
/*!Constructor. Initialize by \a parent*/
SalomeApp_DataObject::SalomeApp_DataObject( SUIT_DataObject* parent )
: LightApp_DataObject( parent ),
return val;
}
-/*
- Class: SalomeApp_ModuleObject
- Level: Public
-*/
+
+
+
/*!Constructor.Initialize by \a parent.*/
SalomeApp_ModuleObject::SalomeApp_ModuleObject( SUIT_DataObject* parent )
return SalomeApp_DataObject::name();
}
-/*
- Class: SalomeApp_SavePointObject
- Level: Public
-*/
+
+
/*!Constructor.Initialize by \a parent.*/
SalomeApp_SavePointObject::SalomeApp_SavePointObject( SUIT_DataObject* _parent, const int id, SalomeApp_Study* study )
return myStudy->getNameOfSavePoint( myId );
}
+/*!Gets icon picture of object.*/
QPixmap SalomeApp_SavePointObject::icon() const
{
return QPixmap();
}
+/*!Gets tooltip.*/
QString SalomeApp_SavePointObject::toolTip() const
{
return QObject::tr( "SAVE_POINT_OBJECT_TOOLTIP" ).arg( name() );
#include <qstring.h>
+/*!
+ Default constructor
+*/
SalomeApp_Displayer::SalomeApp_Displayer()
{
}
+/*!
+ Destructor
+*/
SalomeApp_Displayer::~SalomeApp_Displayer()
{
}
+/*!
+ Displays object in view
+ \param entry - object entry
+ \param updateViewer - is it necessary to update viewer
+ \param theViewFrame - view
+*/
void SalomeApp_Displayer::Display( const QString& entry, const bool updateViewer, SALOME_View* theViewFrame )
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
}
}
+/*!
+ Redisplays object in view
+ \param entry - object entry
+ \param updateViewer - is it necessary to update viewer
+*/
void SalomeApp_Displayer::Redisplay( const QString& entry, const bool updateViewer )
{
// Remove the object permanently (<forced> == true)
}
}
+/*!
+ Erases object in view
+ \param entry - object entry
+ \param forced - deletes object from viewer (otherwise it will be erased, but cached)
+ \param updateViewer - is it necessary to update viewer
+ \param theViewFrame - view
+*/
void SalomeApp_Displayer::Erase( const QString& entry, const bool forced,
const bool updateViewer, SALOME_View* theViewFrame )
{
}
}
+/*!
+ Erases all objects in view
+ \param forced - deletes objects from viewer
+ \param updateViewer - is it necessary to update viewer
+ \param theViewFrame - view
+*/
void SalomeApp_Displayer::EraseAll( const bool forced, const bool updateViewer, SALOME_View* theViewFrame ) const
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
}
}
+/*!
+ \return true if object is displayed in viewer
+ \param entry - object entry
+ \param theViewFrame - view
+*/
bool SalomeApp_Displayer::IsDisplayed( const QString& entry, SALOME_View* theViewFrame ) const
{
SALOME_View* vf = theViewFrame ? theViewFrame : GetActiveView();
return false;
}
+/*!
+ Updates active view
+*/
void SalomeApp_Displayer::UpdateViewer() const
{
SALOME_View* vf = GetActiveView();
vf->Repaint();
}
+/*!
+ \return presentation of object, built with help of CreatePrs method
+ \param entry - object entry
+ \param theViewFrame - view
+ \sa CreatePrs()
+*/
SALOME_Prs* SalomeApp_Displayer::buildPresentation( const QString& entry, SALOME_View* theViewFrame )
{
SALOME_Prs* prs = 0;
return prs;
}
+/*!
+ \return active view
+*/
SALOME_View* SalomeApp_Displayer::GetActiveView()
{
SUIT_Session* session = SUIT_Session::session();
qApp->removeEventFilter( this );
}
+/*!
+ Custom event filter
+*/
bool SalomeApp_EventFilter::eventFilter( QObject* o, QEvent* e )
{
if ( e->type() == SALOME_EVENT )
using namespace std;
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_ListView class implementation
-//////////////////////////////////////////////////////////////////////
-
-//================================================================
-// Function : computeEditGeometry
-/*! Purpose : static function - used for resizing editing widget*/
-//================================================================
+/*!
+ Used for resizing editing widget
+*/
void computeEditGeometry(SalomeApp_ListViewItem* theItem,
SalomeApp_EntityEdit* theWidget)
{
theWidget->setGeometry(aX, aY, aW, aH);
}
-//================================================================
-// Function : SalomeApp_ListView::SalomeApp_ListView
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListView::SalomeApp_ListView( QWidget* parent )
: QtxListView( parent )
{
this, SLOT(onHeaderSizeChange(int, int, int)));
}
-//================================================================
-// Function : SalomeApp_ListView::~SalomeApp_ListView
-/*! Purpose : destructor*/
-//================================================================
+/*!
+ Destructor
+*/
SalomeApp_ListView::~SalomeApp_ListView()
{
if (myEdit) {
myEditedItem = 0;
}
-//================================================================
-// Function : SalomeApp_ListView::updateViewer
-/*! Purpose : updates all data viewer*/
-//================================================================
+/*!
+ Updates all data viewer
+*/
void SalomeApp_ListView::updateViewer()
{
// temporary disconnecting selection changed SIGNAL
emit selectionChanged();
}
-//================================================================
-// Function : SalomeApp_ListView::updateSelected
-/*! Purpose : updates currently selected item(s)*/
-//================================================================
+/*!
+ Updates currently selected item(s)
+*/
void SalomeApp_ListView::updateSelected()
{
// temporary disconnecting selection changed SIGNAL
emit selectionChanged();
}
-//================================================================
-// Function : SalomeApp_ListView::popupClientType
-/*! Purpose : returns popup client type*/
-//================================================================
+/*!
+ Returns popup client type
+*/
QString SalomeApp_ListView::popupClientType() const
{
return "SalomeApp_ListView";
}
-//================================================================
-// Function : SalomeApp_ListView::contextMenuPopup
-/*! Purpose : fills popup menu with items*/
-//================================================================
+/*!
+ Fills popup menu with items
+*/
void SalomeApp_ListView::contextMenuPopup( QPopupMenu* aPopup )
{
if (aPopup) {
}
}
-//================================================================
-// Function : SalomeApp_ListView::clear
-/*! Purpose : clears view*/
-//================================================================
+/*!
+ Clears view
+*/
void SalomeApp_ListView::clear()
{
if (myEdit) {
QListView::clear();
}
-//================================================================
-// Function : SalomeApp_ListView::isMouseEnabled
-/*! Purpose : returms true if mouse events are enabled*/
-//================================================================
+/*!
+ \return true if mouse events are enabled
+*/
bool SalomeApp_ListView::isMouseEnabled()
{
return myMouseEnabled;
}
-//================================================================
-// Function : SalomeApp_ListView::enableMouse
-// Purpose : enabled/disables mouse events (excluding MouseMove)
-//================================================================
+/*!
+ Enables/disables mouse events (excluding MouseMove)
+*/
void SalomeApp_ListView::enableMouse(bool enable)
{
myMouseEnabled = enable;
}
-//================================================================
-// Function : SalomeApp_ListView::eventFilter
-/*! Purpose : event filter*/
-//================================================================
+/*!
+ Event filter
+*/
bool SalomeApp_ListView::eventFilter(QObject* object, QEvent* event)
{
if (object == viewport() &&
return QListView::eventFilter(object, event);
}
-//================================================================
-// Function : SalomeApp_ListView::enableEditing
-/*! Purpose : setting editing of items availbale/not available*/
-//================================================================
+/*!
+ Setting editing of items availbale/not available
+*/
void SalomeApp_ListView::enableEditing(bool theFlag)
{
myEditingEnabled = theFlag;
}
}
-//================================================================
-// Function : SalomeApp_ListView::isEnableEditing
-/*! Purpose : says if editing is enabled*/
-//================================================================
+/*!
+ Says if editing is enabled
+*/
bool SalomeApp_ListView::isEnableEditing()
{
return myEditingEnabled;
}
-//================================================================
-// Function : SalomeApp_ListView::accept
-/*! Purpose : calls finishEditing(true)...*/
-//================================================================
+/*!
+ Calls finishEditing(true)...
+*/
void SalomeApp_ListView::accept()
{
finishEditing(true);
}
-//================================================================
-// Function : QAD_ListView::onSelectionChanged
-/*! Purpose : slot, called when selection changed in List Viewer*/
-//================================================================
+/*!
+ Slot, called when selection changed in List Viewer
+*/
void SalomeApp_ListView::onSelectionChanged()
{
if (myEdit) {
}
}
-//================================================================
-// Function : SalomeApp_ListView::resizeEvent
-/*! Purpose : called when Data Viewer is resized*/
-//================================================================
+/*!
+ Called when Data Viewer is resized
+*/
void SalomeApp_ListView::resizeEvent( QResizeEvent * e)
{
QListView::resizeEvent(e);
updateContents();
}
-//================================================================
-// Function : SalomeApp_ListView::onHeaderSizeChange
-/*! Purpose : slot, called when columns sizes are changed*/
-//================================================================
+/*!
+ Slot, called when columns sizes are changed
+*/
void SalomeApp_ListView::onHeaderSizeChange(int, int, int)
{
int aW = columnWidth(columns()-1);
setColumnWidth(columns()-1, width() - frameWidth() * 2 - aX - 1);
}
-//================================================================
-// Function : SalomeApp_ListView::viewportPaintEvent
-/*! Purpose : handler for paint event*/
-//================================================================
+/*!
+ Handler for paint event
+*/
void SalomeApp_ListView::viewportPaintEvent(QPaintEvent* e)
{
QListView::viewportPaintEvent(e);
}
}
-//================================================================
-// Function : SalomeApp_ListView::onEditOk
-/*! Purpose : called when user finishes in editing of item*/
-//================================================================
+/*!
+ Called when user finishes in editing of item
+*/
void SalomeApp_ListView::onEditOk()
{
finishEditing(true);
}
-//================================================================
-// Function : SalomeApp_ListView::onEditCancel
-/*! Purpose : called when user cancels item editing*/
-//================================================================
+/*!
+ Called when user cancels item editing
+*/
void SalomeApp_ListView::onEditCancel()
{
finishEditing(false);
}
-//================================================================
-// Function : SalomeApp_ListView::finishEditing
-/*! Purpose : finishes editing of entity*/
-//================================================================
+/*!
+ Finishes editing of entity
+*/
UpdateType SalomeApp_ListView::finishEditing(bool ok)
{
UpdateType aNeedsUpdate = utCancel;
return aNeedsUpdate;
}
-//================================================================
-// Function : SalomeApp_ListView::tip
-/*! Purpose : gets current tooltip for list view
- * \retval valid rect in success
- */
-//================================================================
+/*!
+ \return current tooltip for list view
+ \retval valid rect in success
+*/
QRect SalomeApp_ListView::tip(QPoint aPos,
QString& aText,
QRect& dspRect,
return result;
}
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_ListViewItem Class Implementation
-//////////////////////////////////////////////////////////////////////
-
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent) :
QListViewItem( parent )
{
init();
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
SalomeApp_ListViewItem* after) :
QListViewItem( parent, after )
init();
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
const QString& theName,
const bool theEditable) :
setEditable(theEditable);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
const QString& theName,
const QString& theValue,
setEditable(theEditable);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
const QString& theName,
const bool theEditable) :
setEditable(theEditable);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
SalomeApp_ListViewItem* after,
const QString& theName,
setEditable(theEditable);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
SalomeApp_ListViewItem* after,
const QString& theName,
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
const QString& theName,
const QString& theValue,
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListViewItem* parent,
SalomeApp_ListViewItem* after,
const QString& theName,
setEditable(theEditable);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::SalomeApp_ListViewItem
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ListViewItem::SalomeApp_ListViewItem(SalomeApp_ListView* parent,
SalomeApp_ListViewItem* after,
const QString& theName,
setEditable(theEditable);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::~SalomeApp_ListViewItem
-/*! Purpose : destructor*/
-//================================================================
+/*!
+ Destructor
+*/
SalomeApp_ListViewItem::~SalomeApp_ListViewItem()
{
}
-//================================================================
-// Function : SalomeApp_ListViewItem::init
-/*! Purpose : initialization*/
-//================================================================
+/*!
+ Initialization
+*/
void SalomeApp_ListViewItem::init()
{
myEditable = false;
myUserType = -1;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getName
-/*! Purpose : as default returns text in the first column*/
-//================================================================
+/*!
+ \return text in the first column
+*/
QString SalomeApp_ListViewItem::getName() const
{
return ( listView()->columns() > 0 ) ? text(0) : QString("");
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setName
-/*! Purpose : as default sets text in the first column*/
-//================================================================
+/*!
+ Sets text in the first column
+*/
UpdateType SalomeApp_ListViewItem::setName(const QString& theName)
{
UpdateType aNeedsUpdate = utCancel;
return aNeedsUpdate;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getValue
-/*! Purpose : as default returns text in the second column*/
-//================================================================
+/*!
+ \return text in the second column
+*/
QString SalomeApp_ListViewItem::getValue() const
{
return ( listView()->columns() > 1 ) ? text(1) : QString("");
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setValue
-/*! Purpose : as default sets text in the second column*/
-//================================================================
+/*!
+ Sets text in the second column
+*/
UpdateType SalomeApp_ListViewItem::setValue(const QString& theValue)
{
UpdateType aNeedsUpdate = utCancel;
return aNeedsUpdate;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::fullName
-/*! Purpose : returns full path to the entity from the root*/
-//================================================================
+/*!
+ \return full path to the entity from the root
+*/
QString SalomeApp_ListViewItem::fullName()
{
QString aFullName = getName();
return aFullName;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::openAllLevels
-/*! Purpose : expands all entities beginning from this level*/
-//================================================================
+/*!
+ expands all entities beginning from this level
+*/
void SalomeApp_ListViewItem::openAllLevels()
{
setOpen(true);
}
}
-//================================================================
-// Function : SalomeApp_ListViewItem::updateAllLevels
-/*! Purpose : update all entites beginning from this level*/
-//================================================================
+/*!
+ update all entites beginning from this level
+*/
void SalomeApp_ListViewItem::updateAllLevels()
{
SalomeApp_ListViewItem* aChild = (SalomeApp_ListViewItem*)firstChild();
}
}
-//================================================================
-// Function : SalomeApp_EditBox::isEditable
-/*! Purpose : return true if entity is editable*/
-//================================================================
+/*!
+ \return true if entity is editable
+*/
bool SalomeApp_ListViewItem::isEditable() const
{
return myEditable;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setEditable
-/*! Purpose : sets editable flag fo the entity*/
-//================================================================
+/*!
+ Sets editable flag fo the entity
+*/
void SalomeApp_ListViewItem::setEditable(bool theEditable)
{
myEditable = theEditable;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::isAccepted
-/*! Purpose : returns true if entitiy is accepted after editing*/
-//================================================================
+/*!
+ \return true if entitiy is accepted after editing
+*/
bool SalomeApp_ListViewItem::isAccepted() const
{
return myAccepted;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setAccepted
-/*! Purpose : set entitiy accepted or not after editing*/
-//================================================================
+/*!
+ Sets entitiy accepted or not after editing
+*/
void SalomeApp_ListViewItem::setAccepted(bool theAccepted)
{
myAccepted = theAccepted;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getEditingType
-/*! Purpose :
- * \retval type of edit control (default is edit box)
- * \li 0 - edit box
- * \li 1 - combo box
- * \li 2 - editable combo box
- */
-//================================================================
+/*!
+ \retval type of edit control (default is edit box)
+ \li 0 - edit box
+ \li 1 - combo box
+ \li 2 - editable combo box
+*/
int SalomeApp_ListViewItem::getEditingType()
{
return myEditingType;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setEditingType
-/*! Purpose :
- * \retval type of edit control (negative value means none)
- * \li 0 - edit box
- * \li 1 - combo box
- * \li 2 - editable combo box
- */
-//================================================================
+/*!
+ \retval type of edit control (negative value means none)
+ \li 0 - edit box
+ \li 1 - combo box
+ \li 2 - editable combo box
+*/
void SalomeApp_ListViewItem::setEditingType(const int type)
{
myEditingType = type;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getEditedColumn
-// Purpose :
/*! \retval edited column, default is last column
- * negative value means there are no editable columns
- */
-//================================================================
+ negative value means there are no editable columns
+*/
int SalomeApp_ListViewItem::getEditedColumn()
{
return listView()->columns()-1;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getValueType
-// Purpose :
-/*!\retval type of edited value (string, int, double)
- * default is string
- */
-//================================================================
+/*!
+ \retval type of edited value (string, int, double)
+ default is string
+*/
int SalomeApp_ListViewItem::getValueType()
{
return myValueType;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setValueType
-/*! Purpose : sets type of edited value*/
-//================================================================
+/*!
+ Sets type of edited value
+*/
void SalomeApp_ListViewItem::setValueType(const int valueType)
{
myValueType = valueType;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getUserType
-/*! Purpose : sets type of edited value*/
-//================================================================
+/*!
+ Sets type of edited value
+*/
int SalomeApp_ListViewItem::getUserType()
{
return myUserType;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::setUserType
-/*! Purpose : sets type of edited value*/
-//================================================================
+/*!
+ Sets type of edited value
+*/
void SalomeApp_ListViewItem::setUserType(const int userType)
{
myUserType = userType;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getButtons
-/*! Purpose : returns buttons for editing widget (Apply (V), Cancel (X))
- * default is both buttons
- */
-//================================================================
+/*!
+ \return buttons for editing widget (Apply (V), Cancel (X))
+ default is both buttons
+*/
int SalomeApp_ListViewItem::getButtons()
{
return myButtons;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::getButtons
-/*! Purpose : sets buttons for editing widget (Apply (V), Cancel (X))*/
-//================================================================
+/*!
+ Sets buttons for editing widget (Apply (V), Cancel (X))
+*/
void SalomeApp_ListViewItem::setButtons(const int buttons)
{
myButtons = buttons;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::startEditing
-/*! Purpose : creates control for editing and fills it with values*/
-//================================================================
+/*!
+ Creates control for editing and fills it with values
+*/
SalomeApp_EntityEdit* SalomeApp_ListViewItem::startEditing()
{
SalomeApp_EntityEdit* aWidget = 0;
return aWidget;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::fillWidgetWithValues
-/*! Purpose : fills widget with initial values (list or single value)*/
-//================================================================
+/*!
+ Fills widget with initial values (list or single value)
+*/
void SalomeApp_ListViewItem::fillWidgetWithValues(SalomeApp_EntityEdit* theWidget)
{
int anEditColumn = getEditedColumn();
theWidget->insertItem(text(anEditColumn), true);
}
-//================================================================
-// Function : SalomeApp_ListViewItem::finishEditing
-/*! Purpose : finishes editing of entity*/
-//================================================================
+/*!
+ Finishes editing of entity
+*/
UpdateType SalomeApp_ListViewItem::finishEditing(SalomeApp_EntityEdit* theWidget)
{
UpdateType aNeedsUpdate = utCancel;
return aNeedsUpdate;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::tipRect
-/*! Purpose : calculates rectangle which should contain item's tip*/
-//================================================================
+/*!
+ Calculates rectangle which should contain item's tip
+*/
QRect SalomeApp_ListViewItem::tipRect()
{
QRect aRect = QRect(-1, -1, -1, -1);
return aRect;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::tipText
-/*! Purpose : returns text for tooltip*/
-//================================================================
+/*!
+ \return text for tooltip
+*/
QString SalomeApp_ListViewItem::tipText()
{
QString aText = getName();
return aText;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::textRect
-/*! Purpose : calculates rect of item text in viewport coordinates*/
-//================================================================
+/*!
+ Calculates rect of item text in viewport coordinates
+*/
QRect SalomeApp_ListViewItem::textRect(const int column) const
{
QRect aItemRect = listView()->itemRect( this );
return theResult;
}
-//================================================================
-// Function : SalomeApp_ListViewItem::itemRect
-/*! Purpose : calculates rect of item data in viewport coordinates*/
-//================================================================
+/*!
+ Calculates rect of item data in viewport coordinates
+*/
QRect SalomeApp_ListViewItem::itemRect(const int column) const
{
QRect aItemRect = listView()->itemRect( this );
return theResult;
}
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_EditBox class implementation
-//////////////////////////////////////////////////////////////////////
-
-//================================================================
-// Function : SalomeApp_EditBox::SalomeApp_EditBox
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_EditBox::SalomeApp_EditBox(QWidget* parent) :
QLineEdit(parent)
{
}
-//================================================================
-// Function : SalomeApp_EditBox::keyPressEvent
-/*! Purpose : event filter for key pressing*/
-//================================================================
+/*!
+ Event filter for key pressing
+*/
void SalomeApp_EditBox::keyPressEvent( QKeyEvent *e )
{
if ( e->key() == Key_Escape )
e->accept();
}
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_ComboBox class implementation
-//////////////////////////////////////////////////////////////////////
-//================================================================
-// Function : SalomeApp_ComboBox::SalomeApp_ComboBox
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_ComboBox::SalomeApp_ComboBox(bool rw, QWidget* parent, const char* name) :
QComboBox(rw, parent, name)
{
}
-//================================================================
-// Function : SalomeApp_ComboBox::findItem
-/*! Purpose : searches item in list and returns its index*/
-//================================================================
+/*!
+ Searches item in list and returns its index
+*/
int SalomeApp_ComboBox::findItem(const QString& theText)
{
for (int i = 0; i < count(); i++)
return -1;
}
-//================================================================
-// Function : SalomeApp_ComboBox::insertItem
-/*! Purpose : adds item in combo box*/
-//================================================================
+/*!
+ Adds item in combo box
+*/
void SalomeApp_ComboBox::insertItem(const QString& theValue,
int theIndex)
{
QComboBox::insertItem(theValue, theIndex);
}
-//================================================================
-// Function : SalomeApp_ComboBox::insertList
-/*! Purpose : adds list of items in combo box*/
-//================================================================
+/*!
+ Adds list of items in combo box
+*/
void SalomeApp_ComboBox::insertList(const QStringList& theList)
{
for (unsigned i = 0; i < theList.count(); i++)
insertItem(theList[i]);
}
-//================================================================
-// Function : SalomeApp_ComboBox::insertItem
-/*! Purpose : adds item in combo box*/
-//================================================================
+/*!
+ Adds item in combo box
+*/
void SalomeApp_ComboBox::insertItem(const int theValue)
{
int aNum;
insertItem(QString::number(theValue));
}
-//================================================================
-// Function : SalomeApp_ComboBox::insertList
-/*! Purpose : adds list of items in combo box*/
-//================================================================
+/*!
+ Adds list of items in combo box
+*/
void SalomeApp_ComboBox::insertList(const TColStd_ListOfInteger& theList)
{
for (TColStd_ListIteratorOfListOfInteger aIter(theList); aIter.More(); aIter.Next())
insertItem(aIter.Value());
}
-//================================================================
-// Function : SalomeApp_ComboBox::insertItem
-/*! Purpose : adds item in combo box*/
-//================================================================
+/*!
+ Adds item in combo box
+*/
void SalomeApp_ComboBox::insertItem(const double theValue)
{
double aNum;
insertItem(QString::number(theValue));
}
-//================================================================
-// Function : SalomeApp_ComboBox::insertList
-/*! Purpose : adds list of items in combo box*/
-//================================================================
+/*!
+ Adds list of items in combo box
+*/
void SalomeApp_ComboBox::insertList(const TColStd_ListOfReal& theList)
{
for (TColStd_ListIteratorOfListOfReal aIter(theList); aIter.More(); aIter.Next())
insertItem(aIter.Value());
}
-//////////////////////////////////////////////////////////////////////
-// SalomeApp_EntityEdit class implementation
-//////////////////////////////////////////////////////////////////////
-
#include <qlayout.h>
#define MIN_COMBO_WIDTH 1
#define MIN_EDIT_WIDTH 1
-//================================================================
-// Function : SalomeApp_EntityEdit::SalomeApp_EntityEdit
-/*! Purpose : constructor*/
-//================================================================
+/*!
+ Constructor
+*/
SalomeApp_EntityEdit::SalomeApp_EntityEdit(QWidget* parent,
int controlType,
int valueType,
}
}
-//================================================================
-// Function : SalomeApp_EntityEdit::~SalomeApp_EntityEdit
-/*! Purpose : destructor*/
-//================================================================
+/*!
+ Destructor
+*/
SalomeApp_EntityEdit::~SalomeApp_EntityEdit()
{
}
-//================================================================
-// Function : SalomeApp_EntityEdit::clear
-/*! Purpose : clears edit/combo box*/
-//================================================================
+/*!
+ Clears edit/combo box
+*/
void SalomeApp_EntityEdit::clear()
{
if (myEdit)
myCombo->clear();
}
-//================================================================
-// Function : SalomeApp_EntityEdit::getText
-/*! Purpose : returns current text in edit box or combo box*/
-//================================================================
+/*!
+ \return current text in edit box or combo box
+*/
QString SalomeApp_EntityEdit::getText()
{
if (myEdit)
return "";
}
-//================================================================
-// Function : SalomeApp_EntityEdit::setText
-/*! Purpose : sets text*/
-//================================================================
+/*!
+ Sets text
+*/
void SalomeApp_EntityEdit::setText(const QString& theText)
{
myString = theText;
}
}
-//================================================================
-// Function : SalomeApp_EntityEdit::insertItem
-/*! Purpose : adds item in combo box,
- * sets it current if theSetCurrent is true
- */
-//================================================================
+/*!
+ Adds item in combo box, sets it current if theSetCurrent is true
+*/
void SalomeApp_EntityEdit::insertItem(const QString& theValue,
bool theSetCurrent,
int theOrder)
setText(theValue);
}
-//================================================================
-// Function : SalomeApp_EntityEdit::insertList
-/*! Purpose : adds items in combo box,
- * sets item theCurrent as current
- */
-//================================================================
+/*!
+ Adds items in combo box, sets item theCurrent as current
+*/
void SalomeApp_EntityEdit::insertList(const QStringList& theList,
const int theCurrent)
{
setText(theList[theCurrent]);
}
-//================================================================
-// Function : SalomeApp_EntityEdit::insertItem
-/*! Purpose : adds item in combo box,
- * sets it current if theSetCurrent is true
- */
-//================================================================
+/*!
+ Adds item in combo box, sets it current if theSetCurrent is true
+*/
void SalomeApp_EntityEdit::insertItem(const int theValue,
bool theSetCurrent)
{
setText(QString::number(theValue));
}
-//================================================================
-// Function : SalomeApp_EntityEdit::insertList
-/*! Purpose : adds items in combo box,
- * sets item theCurrent as current
- */
-//================================================================
+/*!
+ Adds items in combo box, sets item theCurrent as current
+*/
void SalomeApp_EntityEdit::insertList(const TColStd_ListOfInteger& theList,
const int theCurrent)
{
}
}
-//================================================================
-// Function : SalomeApp_EntityEdit::insertItem
-// Purpose : adds item in combo box,
-// sets it current if theSetCurrent is true
-//================================================================
+/*!
+ Adds item in combo box, sets it current if theSetCurrent is true
+*/
void SalomeApp_EntityEdit::insertItem(const double theValue,
bool theSetCurrent)
{
setText(QString::number(theValue));
}
-//================================================================
-// Function : SalomeApp_EntityEdit::insertList
-/*! Purpose : adds items in combo box,
- * sets item theCurrent as current
- */
-//================================================================
+/*!
+ Adds items in combo box, sets item theCurrent as current
+*/
void SalomeApp_EntityEdit::insertList(const TColStd_ListOfReal& theList,
const int theCurrent)
{
}
}
-//================================================================
-// Function : SalomeApp_EntityEdit::getControl
-/*! Purpose : gets actual widget*/
-//================================================================
+/*!
+ \return actual widget
+*/
QWidget* SalomeApp_EntityEdit::getControl()
{
if (myEdit)
return 0;
}
-//================================================================
-// Function : SalomeApp_EntityEdit::setFocus
-/*! Purpose : redirect focus to corresponding widget*/
-//================================================================
+/*!
+ redirect focus to corresponding widget
+*/
void SalomeApp_EntityEdit::setFocus()
{
if (myEdit) {
}
}
-//================================================================
-// Function : SalomeApp_EntityEdit::setValidator
-/*! Purpose : sets validator for the control*/
-//================================================================
+/*!
+ Sets validator for the control
+*/
void SalomeApp_EntityEdit::setValidator(const QValidator* theValidator)
{
if (myEdit)
myCombo->setValidator(theValidator);
}
-//================================================================
-// Function : SalomeApp_EntityEdit::keyPressEvent
-/*! Purpose : event filter for KeyPress event*/
-//================================================================
+/*!
+ Event filter for KeyPress event
+*/
void SalomeApp_EntityEdit::keyPressEvent( QKeyEvent * e)
{
if ( (e->key() == Key_Enter ||
onCancel();
}
-//================================================================
-// Function : SalomeApp_EntityEdit::onComboActivated
-/*! Purpose : called when item activated in combo box*/
-//================================================================
+/*!
+ Called when item activated in combo box
+*/
void SalomeApp_EntityEdit::onComboActivated(const QString& theText)
{
onTextChanged(theText);
}
-//================================================================
-// Function : SalomeApp_EntityEdit::onTextChanged
-/*! Purpose : slot, called when text changed in line edit*/
-//================================================================
+/*!
+ Slot, called when text changed in line edit
+*/
void SalomeApp_EntityEdit::onTextChanged(const QString& theText)
{
if (myApplyBtn)
myCancelBtn->setEnabled(!(theText == myString));
}
-//================================================================
-// Function : SalomeApp_EntityEdit::onCancel
-/*! Purpose : slot, called when user presses Cancel button*/
-//================================================================
+/*!
+ Slot, called when user presses Cancel button
+*/
void SalomeApp_EntityEdit::onCancel()
{
setText(myString);
emit escapePressed();
}
-//================================================================
-// Function : SalomeApp_EntityEdit::onApply
-/*! Purpose : slot, called when user presses Apply button*/
-//================================================================
+/*!
+ Slot, called when user presses Apply button
+*/
void SalomeApp_EntityEdit::onApply()
{
myString = getText();
emit returnPressed();
}
-//================================================================
-// Function : SalomeApp_EntityEdit::showButtons
-/*! Purpose : shows/hides buttons*/
-//================================================================
+/*!
+ Shows/hides buttons
+*/
void SalomeApp_EntityEdit::showButtons(bool show)
{
if (myApplyBtn)
show ? myCancelBtn->show() : myCancelBtn->hide();
}
-//================================================================
-// Function : SalomeApp_EntityEdit::setDuplicatesEnabled
-/*! Purpose : enables/disables data duplication (for combo box)*/
-//================================================================
+/*!
+ Enables/disables data duplication (for combo box)
+*/
void SalomeApp_EntityEdit::setDuplicatesEnabled(bool enabled)
{
if (myCombo)
class SalomeApp_ListViewItem;
class SalomeApp_EntityEdit;
-//================================================================
-// Class : SalomeApp_ListView
-// Description : parent class for Data Viewer and Properties Viewer
-//================================================================
+/*!
+ \class SalomeApp_ListView
+ parent class for Data Viewer and Properties Viewer
+*/
class SalomeApp_ListView : public QtxListView , public SUIT_PopupClient {
Q_OBJECT
return LightApp_Module::createSelection();
}
+/*!
+ Converts objects-containers to list of objects, those are contained
+ Other objects must be added without conversion
+ \param source - source list of objects
+ \param dest - list of converted objects
+*/
void SalomeApp_Module::extractContainers( const SALOME_ListIO& source, SALOME_ListIO& dest ) const
{
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
return true;
}
+/*!
+ Do nothing
+ The initialization has been done in main
+ */
void SalomeApp_PyInterp::init_python()
{
- /*
- * Do nothing
- * The initialization has been done in main
- */
MESSAGE("PyInterp_base::init_python");
ASSERT(KERNEL_PYTHON::_gtstate); // initialisation in main
SCRUTE(KERNEL_PYTHON::_gtstate);
emit created( this );
}
-//=======================================================================
-// name : openDocument
-/*! Purpose : Open document*/
-//=======================================================================
+/*!
+ Opens document
+ \param theFileName - name of file
+*/
bool SalomeApp_Study::openDocument( const QString& theFileName )
{
MESSAGE( "openDocument" );
return res;
}
-//=======================================================================
-// name : loadDocument
-/*! Purpose : Connects GUI study to SALOMEDS one already loaded into StudyManager*/
-//=======================================================================
+/*!
+ Connects GUI study to SALOMEDS one already loaded into StudyManager
+ \param theStudyName - name of study
+*/
bool SalomeApp_Study::loadDocument( const QString& theStudyName )
{
MESSAGE( "loadDocument" );
return res;
}
-//=======================================================================
-// name : saveDocumentAs
-/*! Purpose : Save document*/
-//=======================================================================
+/*!
+ Saves document
+ \param theFileName - name of file
+*/
bool SalomeApp_Study::saveDocumentAs( const QString& theFileName )
{
bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
return res;
}
-//=======================================================================
-// name : saveDocument
-/*! Purpose : Save document*/
-//=======================================================================
+/*!
+ Saves previously opened document
+*/
bool SalomeApp_Study::saveDocument()
{
bool store = application()->resourceMgr()->booleanValue( "Study", "store_visual_state", true );
return res;
}
-//================================================================
-// Function : closeDocument
-/*! Purpose : Close document*/
-//================================================================
+/*!
+ Closes document
+*/
void SalomeApp_Study::closeDocument(bool permanently)
{
LightApp_Study::closeDocument(permanently);
}
}
-//================================================================
-// Function : isModified
-// Purpose :
-//================================================================
+/*!
+ \return true, if study is modified in comparison with last open/save
+*/
bool SalomeApp_Study::isModified() const
{
bool isAnyChanged = studyDS() && studyDS()->IsModified();
return isAnyChanged;
}
-//================================================================
-// Function : isSaved
-/*! Purpose : Check: data model is saved?*/
-//================================================================
+/*!
+ \return if data model is saved
+*/
bool SalomeApp_Study::isSaved() const
{
bool isAllSaved = studyDS() && studyDS()->GetPersistentReference().size();
return isAllSaved;
}
-//=======================================================================
-// name : saveModuleData
-/*! Purpose : save list file for module 'theModuleName' */
-//=======================================================================
+/*!
+ Saves data of module
+ \param theModuleName - name of module
+ \param theListOfFiles - list of files to be saved
+*/
void SalomeApp_Study::saveModuleData( QString theModuleName, QStringList theListOfFiles )
{
int aNb = theListOfFiles.count();
SetListOfFiles(theModuleName, aListOfFiles);
}
-//=======================================================================
-// name : openModuleData
-/*! Purpose : gets list of file for module 'theModuleNam' */
-//=======================================================================
+/*!
+ Loads data of module
+ \param theModuleName - name of module
+ \param theListOfFiles - list of files to be loaded
+*/
void SalomeApp_Study::openModuleData( QString theModuleName, QStringList& theListOfFiles )
{
std::vector<std::string> aListOfFiles = GetListOfFiles( theModuleName );
theListOfFiles.append(aListOfFiles[i+1].c_str());
}
-//=======================================================================
-// name : saveStudyData
-/*! Purpose : save data from study */
-//=======================================================================
+/*!
+ Saves data from study
+*/
bool SalomeApp_Study::saveStudyData( const QString& theFileName )
{
ModelList list; dataModels( list );
return true;
}
-//=======================================================================
-// name : openStudyData
-/*! Purpose : open data for study */
-//=======================================================================
+/*!
+ Loads data for study
+*/
bool SalomeApp_Study::openStudyData( const QString& theFileName )
{
return true;
}
/*!
- Create SComponent for module, using default engine (CORBAless)
+ Create SComponent for module, using default engine (CORBAless)
*/
void SalomeApp_Study::addComponent(const CAM_DataModel* dm)
{
return newName;
}
-//================================================================
-// Function : GetListOfFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
+/*!
+ \return list of files used by module: to be used by CORBAless modules
+ \param theModuleName - name of module
+*/
std::vector<std::string> SalomeApp_Study::GetListOfFiles( const char* theModuleName ) const
{
SalomeApp_Engine_i* aDefaultEngine = SalomeApp_Engine_i::GetInstance();
return aListOfFiles;
}
-//================================================================
-// Function : SetListOfFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
+/*!
+ Sets list of files used by module: to be used by CORBAless modules
+ \param theModuleName - name of module
+ \param theListOfFiles - list of files
+*/
void SalomeApp_Study::SetListOfFiles ( const char* theModuleName,
const std::vector<std::string> theListOfFiles )
{
aDefaultEngine->SetListOfFiles(theListOfFiles, id(), theModuleName);
}
-//================================================================
-// Function : GetTmpDir
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
+/*!
+ \return temporary directory for saving files of modules
+*/
std::string SalomeApp_Study::GetTmpDir ( const char* theURL, const bool isMultiFile )
{
std::string anURLDir = SALOMEDS_Tool::GetDirFromPath(theURL);
return aTmpDir;
}
-//================================================================
-// Function : RemoveTemporaryFiles
-/*! Purpose : to be used by CORBAless modules*/
-//================================================================
+/*!
+ Removes temporary files
+*/
void SalomeApp_Study::RemoveTemporaryFiles ( const char* theModuleName, const bool isMultiFile ) const
{
if (isMultiFile)
}
}
-// END: methods to be used by CORBAless modules
-
+/*!
+ Deletes all references to object
+ \param obj - object
+*/
void SalomeApp_Study::deleteReferencesTo( _PTR( SObject ) obj )
{
_PTR(StudyBuilder) sb = studyDS()->NewBuilder();
}
}
-//================================================================
-// Function : referencedToEntry
-/*! Purpose : Return referenced entry from entry*/
-//================================================================
+/*!
+ \return real entry by entry of reference
+ \param entry - entry of reference object
+*/
QString SalomeApp_Study::referencedToEntry( const QString& entry ) const
{
_PTR(SObject) obj = studyDS()->FindObjectID( entry.latin1() );
return LightApp_Study::referencedToEntry( entry );
}
-//================================================================
-// Function : componentDataType
-/*! Purpose : Return component data type from entry*/
-//================================================================
+/*!
+ \return component data type for entry
+*/
QString SalomeApp_Study::componentDataType( const QString& entry ) const
{
_PTR(SObject) obj( studyDS()->FindObjectID( entry.latin1() ) );
return obj->GetFatherComponent()->ComponentDataType().c_str();
}
-//================================================================
-// Function : componentDataType
-/*! Purpose : Return component data type from entry*/
-//================================================================
+/*!
+ \return true if entry corresponds to component
+*/
bool SalomeApp_Study::isComponent( const QString& entry ) const
{
_PTR(SObject) obj( studyDS()->FindObjectID( entry.latin1() ) );
return obj && QString( obj->GetID().c_str() ) == obj->GetFatherComponent()->GetID().c_str();
}
-//================================================================
-// Function : children
-/*! Purpose : Return entries of children of object*/
-//================================================================
+/*!
+ \return entries of object children
+*/
void SalomeApp_Study::children( const QString& entry, QStringList& child_entries ) const
{
_PTR(SObject) SO = studyDS()->FindObjectID( entry.latin1() );
}
}
+/*!
+ Fills list with components names
+ \param comp - list to be filled
+*/
void SalomeApp_Study::components( QStringList& comps ) const
{
for( _PTR(SComponentIterator) it ( studyDS()->NewComponentIterator() ); it->More(); it->Next() )
}
}
-//================================================================
-// Function : getSavePoints
-/*! Purpose : returns a list of saved points' IDs
+/*!
+ \return a list of saved points' IDs
*/
-//================================================================
std::vector<int> SalomeApp_Study::getSavePoints()
{
std::vector<int> v;
return v;
}
-//================================================================
-// Function :removeSavePoint
-/*! Purpose : remove a given save point
+/*!
+ Removes a given save point
*/
-//================================================================
void SalomeApp_Study::removeSavePoint(int savePoint)
{
if(savePoint <= 0) return;
builder->RemoveObjectWithChildren(so);
}
-//================================================================
-// Function : getNameOfSavePoint
-/*! Purpose : returns a name of save point
+/*!
+ \return a name of save point
*/
-//================================================================
QString SalomeApp_Study::getNameOfSavePoint(int savePoint)
{
_PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint);
return ip->getProperty("AP_SAVEPOINT_NAME");
}
-//================================================================
-// Function : setNameOfSavePoint
-/*! Purpose : sets a name of save point
+/*!
+ Sets a name of save point
*/
-//================================================================
void SalomeApp_Study::setNameOfSavePoint(int savePoint, const QString& nameOfSavePoint)
{
_PTR(AttributeParameter) AP = studyDS()->GetCommonParameters(getVisualComponentName(), savePoint);
ip->setProperty("AP_SAVEPOINT_NAME", nameOfSavePoint.latin1());
}
-//================================================================
-// Function : getVisualComponentName
-/*! Purpose : returns a name of the component where visual
- * parameters are stored
+/*!
+ \return a name of the component where visual parameters are stored
*/
-//================================================================
std::string SalomeApp_Study::getVisualComponentName()
{
return "Interface Applicative";
}
-//================================================================
-// Function : updateModelRoot
-/*! Purpose : slot called on change of a root of a data model. redefined from CAM_Study*/
-//================================================================
+/*!
+ Slot: called on change of a root of a data model. Redefined from CAM_Study
+*/
void SalomeApp_Study::updateModelRoot( const CAM_DataModel* dm )
{
LightApp_Study::updateModelRoot( dm );
{
}
-//================================================================
-// Function : nameViewWindows
-/*! Purpose : set names of all view windows in given list. This is used
-// in order to apply the same naming algorithm when saving and restoring
-// view windows. Names of view windows must be the same before saving
-// workstack (splitters) information, and before its restoring!
-// Naming rule: ViewerType_IndexOfViewerOfThisType_IndexOfViewInThisViewer
-// VTKViewer_0_0
-// OCCViewer_0_0 OCCViewer_0_1 OCCViewer_0_2
-// VTKViewer_1_0
+/*!
+ Sets names of all view windows in given list. This is used
+ in order to apply the same naming algorithm when saving and restoring
+ view windows. Names of view windows must be the same before saving
+ workstack (splitters) information, and before its restoring!
+ Naming rule: ViewerType_IndexOfViewerOfThisType_IndexOfViewInThisViewer
+ VTKViewer_0_0
+ OCCViewer_0_0 OCCViewer_0_1 OCCViewer_0_2
+ VTKViewer_1_0
*/
-//================================================================
void nameViewWindows( const ViewManagerList& lst )
{
QDict<int> viewersCounter; // map viewerType - to - index_of_this_viewer_type
}
}
-//================================================================
-// Function : storeState
-/*! Purpose : store the visual parameters of the viewers
+/*!
+ Stores the visual parameters of the viewers
*/
-//================================================================
int SalomeApp_VisualState::storeState()
{
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
return savePoint;
}
-//================================================================
-// Function : restoreState
-/*! Purpose : restore the visual parameters of the viewers
+/*!
+ Restores the visual parameters of the viewers
*/
-//================================================================
void SalomeApp_VisualState::restoreState(int savePoint)
{
SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( myApp->activeStudy() );
#define MARGIN_SIZE 5
#define SPACING_SIZE 3
+/*!
+ Constructor
+*/
InquireServersGUI::InquireServersGUI()
: QVBox(0, "SFA splash", Qt::WDestructiveClose | Qt::WStyle_Customize | Qt::WStyle_NoBorder | WType_TopLevel | WStyle_StaysOnTop | WX11BypassWM )
{
}
}
+/*!
+ Destructor
+*/
InquireServersGUI::~InquireServersGUI()
{
delete myThread;
*_argv = qApp->argv();
}
-//=================================================================================
-// function : ClickOnCancel()
-// purpose : cancel loading of SALOME
-//=================================================================================
+/*!
+ Cancel loading of SALOME
+*/
void InquireServersGUI::ClickOnCancel()
{
myThread->stop(); //it's necessary to stop asking servers
return myThread->getExitStatus();
}
+/*!
+ Constructor
+*/
InquireServersQThread::InquireServersQThread( InquireServersGUI* r )
: receiver(r), myExitStatus(0)
{
myExitStatus = 1;
}
+/*!
+ Destructor
+*/
InquireServersQThread::~InquireServersQThread()
{
}
#define SALOME_WNT_EXPORT
#endif
-/**********************************************************
-** Class: InquireEvent
-** Descr: Contains QCustomEvents for posting to InquireServersQThread
-** Level: Private
-***********************************************************/
+/*!
+ \class InquireEvent
+ Contains QCustomEvents for posting to InquireServersQThread
+*/
class SALOME_WNT_EXPORT InquireEvent : public QCustomEvent
{
public:
SalomeApp_Engine_i* SalomeApp_Engine_i::myInstance = NULL;
+/*!
+ Constructor
+*/
SalomeApp_Engine_i::SalomeApp_Engine_i()
{
myInstance = this;
}
+/*!
+ Destructor
+*/
SalomeApp_Engine_i::~SalomeApp_Engine_i()
{
}
#include "Utils_SALOME_Exception.hxx"
#include "utilities.h"
using namespace std;
-//=============================================================================
/*!
- * default constructor not for use
+ default constructor not for use
*/
-//=============================================================================
-
Session_ServerLauncher::Session_ServerLauncher()
{
ASSERT(0); // must not be called
}
-//=============================================================================
/*!
- * constructor
- */
-//=============================================================================
-
+ constructor
+*/
Session_ServerLauncher::Session_ServerLauncher(int argc,
char ** argv,
CORBA::ORB_ptr orb,
start();
}
-//=============================================================================
/*!
- * destructor
- */
-//=============================================================================
-
+ destructor
+*/
Session_ServerLauncher::~Session_ServerLauncher()
{
}
-//=============================================================================
/*!
- * Check args and activate servers
- */
-//=============================================================================
-
+ Check args and activate servers
+*/
void Session_ServerLauncher::run()
{
// wait until main thread is ready
_orb->run(); // this thread waits, during omniORB process events
}
-//=============================================================================
/*!
- * controls and dispatchs arguments given with command
- */
-//=============================================================================
-
+ controls and dispatchs arguments given with command
+*/
void Session_ServerLauncher::CheckArgs()
{
int argState = 0;
throw SALOME_Exception(LOCALIZED("Error in command arguments, missing parenthesis ')'"));
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerLauncher::ActivateAll()
{
list<ServArg>::iterator itServ;
aServerThread->Init();
}
-//=============================================================================
/*!
- * Destruction des classes serveur dans l'ordre inverse de creation
- */
-//=============================================================================
-
+ Destruction des classes serveur dans l'ordre inverse de creation
+*/
void Session_ServerLauncher::KillAll()
{
MESSAGE("Session_ServerLauncher::KillAll()");
"SalomeAppEngine",
"ContainerManager"};
-//=============================================================================
/*!
- * default constructor not for use
- */
-//=============================================================================
-
+ default constructor not for use
+*/
Session_ServerThread::Session_ServerThread()
{
ASSERT(0); // must not be called
}
-//=============================================================================
/*!
- * constructor
- */
-//=============================================================================
-
+ constructor
+*/
Session_ServerThread::Session_ServerThread(int argc,
char ** argv,
CORBA::ORB_ptr orb,
// multi thread coherence problems
}
-//=============================================================================
/*!
- * destructor
- */
-//=============================================================================
-
+ destructor
+*/
Session_ServerThread::~Session_ServerThread()
{
//MESSAGE("~Session_ServerThread "<< _argv[0]);
}
-//=============================================================================
/*!
- * run the thread : activate one servant, the servant type is given by
- * argument _argv[0]
- */
-//=============================================================================
-
+ run the thread : activate one servant, the servant type is given by
+ argument _argv[0]
+*/
void Session_ServerThread::Init()
{
MESSAGE("Session_ServerThread::Init "<< _argv[0]);
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateModuleCatalog(int argc,
char ** argv)
{
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateSALOMEDS(int argc,
char ** argv)
{
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateRegistry(int argc,
char ** argv)
{
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateContainerManager(int argc,
char ** argv)
{
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateContainer(int argc,
char ** argv)
{
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateEngine(int /*argc*/, char ** /*argv*/)
{
try
}
}
-//=============================================================================
-/*!
- *
- */
-//=============================================================================
-
void Session_ServerThread::ActivateSession(int argc,
char ** argv)
{
MESSAGE("Session_ServerThread::ActivateSession() not implemented!");
}
+/*!
+ constructor
+*/
Session_SessionThread::Session_SessionThread(int argc,
char** argv,
CORBA::ORB_ptr orb,
{
}
+/*!
+ destructor
+*/
Session_SessionThread::~Session_SessionThread()
{
}
using namespace std;
-//=============================================================================
-/*! SALOME_Session_i
- * constructor
- */
-//=============================================================================
-
+/*!
+ constructor
+*/
SALOME_Session_i::SALOME_Session_i(int argc,
char ** argv,
CORBA::ORB_ptr orb,
//MESSAGE("constructor end");
}
-//=============================================================================
-/*! GetVisuComponent
- * returns Visu component
- */
-//=============================================================================
-
+/*!
+ returns Visu component
+*/
Engines::Component_ptr SALOME_Session_i::GetComponent(const char* theLibraryName)
{
typedef Engines::Component_ptr TGetImpl(CORBA::ORB_ptr,
return Engines::Component::_nil();
}
-//=============================================================================
-/*! ~SALOME_Session_i
- * destructor
- */
-//=============================================================================
-
+/*!
+ destructor
+*/
SALOME_Session_i::~SALOME_Session_i()
{
//MESSAGE("destructor end");
}
-//=============================================================================
-/*! NSregister
- * tries to find the Corba Naming Service and to register the session,
- * gives naming service interface to _IAPPThread
- */
-//=============================================================================
-
+/*!
+ tries to find the Corba Naming Service and to register the session,
+ gives naming service interface to _IAPPThread
+*/
void SALOME_Session_i::NSregister()
{
SALOME::Session_ptr pSession = SALOME::Session::_narrow(_this());
//MESSAGE("Session registered in Naming Service");
}
-//=============================================================================
-/*! GetInterface
- * Launches the GUI if there is none.
- * The Corba method is oneway (corba client does'nt wait for GUI completion)
- */
-//=============================================================================
-
+/*!
+ Launches the GUI if there is none.
+ The Corba method is oneway (corba client does'nt wait for GUI completion)
+*/
void SALOME_Session_i::GetInterface()
{
_GUIMutex->lock();
}
}
-//=============================================================================
-/*! StopSession
- * Kills the session if there are no active studies nore GUI
- */
-//=============================================================================
+/*!
+ Kills the session if there are no active studies nore GUI
+*/
class CloseEvent : public SALOME_Event
{
public:
}
};
+/*!
+ Processes event to close session
+*/
void SALOME_Session_i::StopSession()
{
ProcessVoidEvent( new CloseEvent() );
}
-//=============================================================================
-/*! StatSession
- * Send a SALOME::StatSession structure (see idl) to the client
- * (number of running studies and presence of GUI)
- */
-//=============================================================================
-
+/*!
+ Send a SALOME::StatSession structure (see idl) to the client
+ (number of running studies and presence of GUI)
+*/
class QtLock
{
public:
#include "ToolsGUI.h"
-//=======================================================================
-// name : GetVisibility
-// Purpose : Verify whether object is visible or not
-//=======================================================================
+/*!
+ \return true if object is visible
+*/
bool ToolsGUI::GetVisibility( _PTR(Study) theStudy,
_PTR(SObject) theObj,
void* theId )
return false;
}
-//=======================================================================
-// name : SetVisibility
-// Purpose : Set flag visibility of object
-//=======================================================================
+/*!
+ Set flag visibility of object
+ \param theStudy - study
+ \param theEntry - entry
+ \param theValue - flag visibility
+ \param theId - id
+*/
bool ToolsGUI::SetVisibility( _PTR(Study) theStudy,
const char* theEntry,
const bool theValue,
return false;
}
-
-
-
-
-
#define MARGIN_SIZE 11
#define MIN_EDIT_SIZE 250
-//=================================================================================
-// class : ToolsGUI_CatalogGeneratorDlg()
-// purpose : Constructor
-//=================================================================================
+/*!
+ Constructor
+*/
ToolsGUI_CatalogGeneratorDlg::ToolsGUI_CatalogGeneratorDlg( QWidget* parent, const char* name )
: QDialog( parent, name, TRUE, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
{
updateButtonState();
}
-//=================================================================================
-// function : ~ToolsGUI_CatalogGeneratorDlg()
-// purpose : destructor
-//=================================================================================
+/*!
+ destructor
+*/
ToolsGUI_CatalogGeneratorDlg::~ToolsGUI_CatalogGeneratorDlg()
{
}
-//=================================================================================
-// function : getIdlFile()
-// purpose : gets IDL file name entered
-//=================================================================================
+/*!
+ \return IDL file name entered
+*/
QString ToolsGUI_CatalogGeneratorDlg::getIdlFile()
{
return myIdlEdit->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getXmlFile()
-// purpose : gets XML file name entered
-//=================================================================================
+/*!
+ \return XML file name entered
+*/
QString ToolsGUI_CatalogGeneratorDlg::getXmlFile()
{
return myXmlEdit->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getPngFile()
-// purpose : gets PNG file name entered
-//=================================================================================
+/*!
+ \return PNG file name entered
+*/
QString ToolsGUI_CatalogGeneratorDlg::getPngFile()
{
return myPngEdit->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getAuthor()
-// purpose : gets author
-//=================================================================================
+/*!
+ \return author
+*/
QString ToolsGUI_CatalogGeneratorDlg::getAuthor()
{
return myAuthorEdit->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getVersion()
-// purpose : gets version number
-//=================================================================================
+/*!
+ \return version number
+*/
QString ToolsGUI_CatalogGeneratorDlg::getVersion()
{
return myVersionEdit->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getCompName()
-// purpose : gets name of the component
-//=================================================================================
+/*!
+ \return name of the component
+*/
QString ToolsGUI_CatalogGeneratorDlg::getCompName()
{
return myCompName->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getCompUserName()
-// purpose : gets username of the component
-//=================================================================================
+/*!
+ \return username of the component
+*/
QString ToolsGUI_CatalogGeneratorDlg::getCompUserName()
{
return myCompUserName->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getCompType()
-// purpose : gets type of the component
-//=================================================================================
+/*!
+ \return type of the component
+*/
QString ToolsGUI_CatalogGeneratorDlg::getCompMultiStd()
{
return myCompMultiStd->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getComptype()
-// purpose : gets type of the component
-//=================================================================================
+
+/*!
+ \return type of the component
+*/
QString ToolsGUI_CatalogGeneratorDlg::getCompType()
{
return myCompType->text().stripWhiteSpace();
}
-//=================================================================================
-// function : getIdlPath()
-// purpose : gets IDL path of modules
-//=================================================================================
+/*!
+ \return IDL path of modules
+*/
QString ToolsGUI_CatalogGeneratorDlg::getIdlPath()
{
cout << "QAD_Desktop::getCatalogue() is not implemented!!";
*/
}
-//=================================================================================
-// function : onBrowseBtnClicked()
-// purpose : <...> (Browse) buttons slot
-//=================================================================================
+/*!
+ SLOT: called on Browse button click
+*/
void ToolsGUI_CatalogGeneratorDlg::onBrowseBtnClicked()
{
QPushButton* send = (QPushButton*)sender();
updateButtonState();
}
-//=================================================================================
-// function : updateButtonState()
-// purpose : Updates <OK> button's state
-//=================================================================================
+/*!
+ Updates <OK> button's state
+*/
void ToolsGUI_CatalogGeneratorDlg::updateButtonState()
{
myApplyBtn->setEnabled( !myIdlEdit->text().stripWhiteSpace().isEmpty() &&
!myXmlEdit->text().stripWhiteSpace().isEmpty() );
}
-//=================================================================================
-// function : onApply()
-// purpose : <Apply> button slot, performs IDL->XML conversion
-//=================================================================================
+/*!
+ <Apply> button slot, performs IDL->XML conversion
+*/
void ToolsGUI_CatalogGeneratorDlg::onApply()
{
QString IDLpath = getIdlPath();
class QLineEdit;
class QPushButton;
-//=================================================================================
-// class : ToolsGUI_CatalogGeneratorDlg
-// purpose :
-//=================================================================================
class Standard_EXPORT ToolsGUI_CatalogGeneratorDlg : public QDialog
{
Q_OBJECT
using namespace std;
+/*!
+ Constructor
+*/
ToolsGUI_HelpWindow::ToolsGUI_HelpWindow(QWidget* parent, const char* name )
: QMainWindow( parent, name, WType_TopLevel | WDestructiveClose )
{
#define SPACING_SIZE 6
#define MIN_SPIN_WIDTH 100
+/*!
+ Constructor
+*/
ToolsGUI_IntervalWindow::ToolsGUI_IntervalWindow ( QWidget* parent )
- : QDialog( parent, "ToolsGUI_IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+: QDialog( parent, "ToolsGUI_IntervalWindow" , true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
{
BEGIN_OF("ToolsGUI_IntervalWindow constructor")
setCaption( tr( "Refresh Interval" ) );
END_OF("ToolsGUI_IntervalWindow constructor")
}
+
+/*!
+ Destructor
+*/
ToolsGUI_IntervalWindow::~ToolsGUI_IntervalWindow() {}
-/*
+
+/*!
Sets start interval size
*/
void ToolsGUI_IntervalWindow::setValue(const int size)
mySpinBox->setValue(size);
}
-/*
- Gets interval size
+/*!
+ \return interval size
*/
int ToolsGUI_IntervalWindow::getValue()
{
return mySpinBox->value();
}
-/*
- gets a pointer to myButtonOk
+/*!
+ \return a pointer to myButtonOk
*/
QPushButton* ToolsGUI_IntervalWindow::Ok()
{
return myButtonOk;
}
-/*
- gets a pointer to myButtonCancel
+/*!
+ \return a pointer to myButtonCancel
*/
QPushButton* ToolsGUI_IntervalWindow::Cancel()
{
END_OF("slotSelectRefresh");
}
+/*!
+ SLOT: called when IntervalWindow's OK button is clicked
+*/
void ToolsGUI_RegWidget::slotIntervalOk()
{
BEGIN_OF("slotIntervalOk");
int VTKViewer_LINE_WIDTH = 3;
-//----------------------------------------------------------------------------
vtkStandardNewMacro(VTKViewer_Actor);
-
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
VTKViewer_Actor
::VTKViewer_Actor():
myIsHighlighted(false),
myPassFilter.push_back(VTKViewer_PassThroughFilter::New());
}
-
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
VTKViewer_Actor
::~VTKViewer_Actor()
{
myProperty->Delete();
}
-
-//----------------------------------------------------------------------------
+/*!
+ \return name
+*/
const char*
VTKViewer_Actor
::getName()
return myName.c_str();
}
+/*!
+ Sets name
+ \param theName - new name
+*/
void
VTKViewer_Actor
::setName(const char* theName)
myName = theName;
}
-
-//----------------------------------------------------------------------------
+/*!
+ To publish the actor an all its internal devices
+*/
void
VTKViewer_Actor
::AddToRender(vtkRenderer* theRenderer)
theRenderer->AddActor(this);
}
+/*!
+ To remove the actor an all its internal devices
+*/
void
VTKViewer_Actor
::RemoveFromRender(vtkRenderer* theRenderer)
theRenderer->RemoveActor(this);
}
+/*!
+ Used to obtain all dependent actors
+*/
void
VTKViewer_Actor
::GetChildActors(vtkActorCollection*)
{}
-
-//----------------------------------------------------------------------------
+/*!
+ Apply view transformation
+ \param theTransform - view transformation
+*/
void
VTKViewer_Actor
::SetTransform(VTKViewer_Transform* theTransform)
}
+/*!
+ To insert some additional filters and then sets the given #vtkMapper
+*/
void
VTKViewer_Actor
::SetMapper(vtkMapper* theMapper)
InitPipeLine(theMapper);
}
+/*!
+ Initialization
+*/
void
VTKViewer_Actor
::InitPipeLine(vtkMapper* theMapper)
Superclass::SetMapper(theMapper);
}
-
-//----------------------------------------------------------------------------
+/*!
+ Renders actor
+*/
void
VTKViewer_Actor
::Render(vtkRenderer *ren, vtkMapper* m)
}
}
-
+/*!
+ Set ResolveCoincidentTopology flag
+ \param theIsResolve - new flag value
+*/
void
VTKViewer_Actor
::SetResolveCoincidentTopology(bool theIsResolve)
myIsResolveCoincidentTopology = theIsResolve;
}
+/*!
+ Set polygon offset parameters
+ \param factor, units - Opengl polygon offset parameters
+*/
void
VTKViewer_Actor
::SetPolygonOffsetParameters(vtkFloatingPointType factor,
myPolygonOffsetUnits = units;
}
+/*!
+ Get polygon offset parameters
+ \param factor, units - Opengl polygon offset parameters
+*/
void
VTKViewer_Actor
::GetPolygonOffsetParameters(vtkFloatingPointType& factor,
units = myPolygonOffsetUnits;
}
-
-//----------------------------------------------------------------------------
+/*!
+ \return shrink factor
+*/
vtkFloatingPointType
VTKViewer_Actor
::GetShrinkFactor()
return 1.0;
}
+/*!
+ \return true if the actor is shrunkable
+*/
bool
VTKViewer_Actor
::IsShrunkable()
return false;
}
+/*!
+ \return true if the actor is shrunk
+*/
bool
VTKViewer_Actor
::IsShrunk()
return false;
}
+/*!
+ Insert shrink filter into pipeline
+*/
void
VTKViewer_Actor
::SetShrink()
{}
+/*!
+ Remove shrink filter from pipeline
+*/
void
VTKViewer_Actor
::UnShrink()
{}
-
-//----------------------------------------------------------------------------
+/*!
+ Allows to get initial #vtkDataSet
+*/
vtkDataSet*
VTKViewer_Actor
::GetInput()
return myPassFilter.front()->GetOutput();
}
-
+/*!
+ To calculatate last modified time
+*/
unsigned long int
VTKViewer_Actor
::GetMTime()
return mTime;
}
-
-//----------------------------------------------------------------------------
+/*!
+ Set representation (VTK_SURFACE, VTK_POINTS, VTK_WIREFRAME and so on)
+ param theMode - new mode
+*/
void
VTKViewer_Actor
::SetRepresentation(int theMode)
myRepresentation = theMode;
}
+/*!
+ \return current representation mode
+*/
int
VTKViewer_Actor
::GetRepresentation()
return myRepresentation;
}
-
-//----------------------------------------------------------------------------
+/*!
+ Maps VTK index of a node to corresponding object index
+*/
int
VTKViewer_Actor
::GetNodeObjId(int theVtkID)
return theVtkID;
}
+/*!
+ Get coordinates of a node for given object index
+*/
vtkFloatingPointType*
VTKViewer_Actor
::GetNodeCoord(int theObjID)
return GetInput()->GetPoint(theObjID);
}
+/*!
+ Get corresponding #vtkCell for given object index
+*/
vtkCell*
VTKViewer_Actor
::GetElemCell(int theObjID)
return GetInput()->GetCell(theObjID);
}
+/*!
+ Maps VTK index of a cell to corresponding object index
+*/
int
VTKViewer_Actor
::GetElemObjId(int theVtkID)
}
-//=================================================================================
-// function : GetObjDimension
-// purpose : Return object dimension.
-// Virtual method shoulb be redifined by derived classes
-//=================================================================================
+/*!
+ \return object dimension. Virtual method should be redifined by derived classes
+*/
int
VTKViewer_Actor
::GetObjDimension( const int theObjId )
return 0;
}
-
+/*!
+ Infinitive means actor without size (point for example),
+ which is not taken into account in calculation of boundaries of the scene
+*/
void
VTKViewer_Actor
::SetInfinitive(bool theIsInfinite)
myIsInfinite = theIsInfinite;
}
-
+/*!
+ \return infinive flag
+*/
bool
VTKViewer_Actor
::IsInfinitive()
return false;
}
-
+/*!
+ \return current bounding box
+*/
vtkFloatingPointType*
VTKViewer_Actor
::GetBounds()
}
+/*!
+ \return current bounding box
+*/
void
VTKViewer_Actor
::GetBounds(vtkFloatingPointType theBounds[6])
}
-//----------------------------------------------------------------------------
bool
VTKViewer_Actor
::IsSetCamera() const
::SetCamera( vtkCamera* )
{}
-//----------------------------------------------------------------------------
+
void
VTKViewer_Actor
::SetOpacity(vtkFloatingPointType theOpacity)
}
+/*!
+ Change color
+*/
void
VTKViewer_Actor
::SetColor(vtkFloatingPointType r,
GetProperty()->SetColor(r,g,b);
}
+/*!
+ Change color
+*/
void
VTKViewer_Actor
::SetColor(const vtkFloatingPointType theRGB[3])
SetColor(theRGB[0],theRGB[1],theRGB[2]);
}
+/*!
+ Get color
+*/
void
VTKViewer_Actor
::GetColor(vtkFloatingPointType& r,
}
-//----------------------------------------------------------------------------
+/*!
+ \return display mode
+*/
int
VTKViewer_Actor
::getDisplayMode()
return myDisplayMode;
}
+/*!
+ Change display mode
+*/
void
VTKViewer_Actor
::setDisplayMode(int theMode)
}
-//----------------------------------------------------------------------------
+/*!
+ \return true if the descendant of the VTKViewer_Actor will implement its own highlight or not
+*/
bool
VTKViewer_Actor
::hasHighlight()
return false;
}
+/*!
+ \return true if the VTKViewer_Actor is already highlighted
+*/
bool
VTKViewer_Actor
::isHighlighted()
return myIsHighlighted;
}
+/*!
+ Set preselection mode
+*/
void
VTKViewer_Actor
::SetPreSelected(bool thePreselect)
myIsPreselected = thePreselect;
}
-
-//----------------------------------------------------------------
+/*!
+ Just to update visibility of the highlight devices
+*/
void
VTKViewer_Actor
::highlight(bool theIsHighlight)
}
-//==================================================================
-// function: DoMapping
-// purpose :
-//==================================================================
void
VTKViewer_AppendFilter
::DoMapping()
}
}
-//---------------------------------------------------------------
namespace
{
inline
}
-//---------------------------------------------------------------
vtkIdType
VTKViewer_AppendFilter
::GetCellOutputID(vtkIdType theInputID,
}
-//---------------------------------------------------------------
namespace
{
void
}
-//---------------------------------------------------------------
void
VTKViewer_AppendFilter
::GetCellInputID(vtkIdType theOutputID,
}
-//---------------------------------------------------------------
void
VTKViewer_AppendFilter
::MakeOutput()
#include <vtkPlane.h>
#include <vtkMath.h>
-//----------------------------------------------------------------------------
namespace
{
typedef std::vector<vtkIdType> TConnectivities;
typedef std::vector<TPolygon> TPolygons;
}
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
VTKViewer_Triangulator
::VTKViewer_Triangulator():
myInput(NULL),
{}
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
VTKViewer_Triangulator
::~VTKViewer_Triangulator()
{
}
-//----------------------------------------------------------------------------
+
bool
VTKViewer_Triangulator
::Execute(vtkUnstructuredGrid *theInput,
return true;
}
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
VTKViewer_OrderedTriangulator
::VTKViewer_OrderedTriangulator():
myCell(vtkGenericCell::New())
{}
-
-//----------------------------------------------------------------------------
+/*!
+ Destructor
+*/
VTKViewer_OrderedTriangulator
::~VTKViewer_OrderedTriangulator()
{
myCell->Delete();
}
-//----------------------------------------------------------------------------
vtkPoints*
VTKViewer_OrderedTriangulator
::InitPoints()
return thePntId;
}
-//----------------------------------------------------------------------------
+/*!
+ Constructor
+*/
VTKViewer_DelaunayTriangulator
::VTKViewer_DelaunayTriangulator():
myUnstructuredGrid(vtkUnstructuredGrid::New()),
}
-//----------------------------------------------------------------------------
+
+/*!
+ Destructor
+*/
VTKViewer_DelaunayTriangulator
::~VTKViewer_DelaunayTriangulator()
{
}
-//----------------------------------------------------------------------------
vtkPoints*
VTKViewer_DelaunayTriangulator
::InitPoints()
class vtkIdList;
class vtkCell;
-//----------------------------------------------------------------------------
class VTKVIEWER_EXPORT VTKViewer_Triangulator
{
public:
};
-//----------------------------------------------------------------------------
class VTKVIEWER_EXPORT VTKViewer_OrderedTriangulator : public VTKViewer_Triangulator
{
public:
};
-//----------------------------------------------------------------------------
class VTKVIEWER_EXPORT VTKViewer_DelaunayTriangulator : public VTKViewer_Triangulator
{
public:
//#define USE_ROBUST_TRIANGULATION
-//----------------------------------------------------------------------------
vtkCxxRevisionMacro(VTKViewer_GeometryFilter, "$Revision$");
vtkStandardNewMacro(VTKViewer_GeometryFilter);
{}
-//----------------------------------------------------------------------------
void
VTKViewer_GeometryFilter
::Execute()
}
-//----------------------------------------------------------------------------
void
VTKViewer_GeometryFilter
::UnstructuredGridExecute()
}
-//----------------------------------------------------------------------------
void
VTKViewer_GeometryFilter
::SetInside(int theShowInside)
}
-//----------------------------------------------------------------------------
void
VTKViewer_GeometryFilter
::SetWireframeMode(int theIsWireframeMode)
}
-//----------------------------------------------------------------------------
void
VTKViewer_GeometryFilter
::SetStoreMapping(int theStoreMapping)
}
-//----------------------------------------------------------------------------
vtkIdType VTKViewer_GeometryFilter::GetElemObjId(int theVtkID){
if(myVTK2ObjIds.empty() || theVtkID > myVTK2ObjIds.size()) return -1;
#if defined __GNUC_2__
return anEdgeId;
}
*/
-//----------------------------------------------------------------------------
+
vtkStandardNewMacro(VTKViewer_InteractorStyle);
-//----------------------------------------------------------------------------
+
/*!Constructor.*/
VTKViewer_InteractorStyle::VTKViewer_InteractorStyle()
{
OnSelectionModeChanged();
}
-//----------------------------------------------------------------------------
+
/*!Destructor.*/
VTKViewer_InteractorStyle::~VTKViewer_InteractorStyle()
{
m_ViewWnd->RemoveActor(myPreSelectionActor);
}
-//----------------------------------------------------------------------------
+
/*!Set preselection properties.
*\param theRed - red color.
*\param theGreen - green color.
myPreSelectionActor->GetProperty()->SetPointSize(theWidth);
}
-//----------------------------------------------------------------------------
+
/*!Set render window interactor
*\param theInteractor - interactor.
*/
Superclass::SetInteractor(theInteractor);
}
-//----------------------------------------------------------------------------
+
/*!Set view window.
*\param theViewWnd - SALOME VTKViewer_ViewWindow
*/
myPreSelectionActor->Delete();
}
-//----------------------------------------------------------------------------
+
/*!Set GUI window.
*\param theWindow - QWidget window.
*/
myGUIWindow = theWindow;
}
-//----------------------------------------------------------------------------
-/*!Set triedron.
+
+/*!Set trihedron.
*\param theTrihedron - SALOME VTKViewer_Trihedron
*/
void VTKViewer_InteractorStyle::setTriedron(VTKViewer_Trihedron* theTrihedron){
m_Trihedron = theTrihedron;
}
-//----------------------------------------------------------------------------
/*!Rotate camera.
*\param dx -
*\param dy -
myGUIWindow->update();
}
-//----------------------------------------------------------------------------
void VTKViewer_InteractorStyle::PanXY(int x, int y, int oldX, int oldY)
{
TranslateView(x, y, oldX, oldY);
}
-//----------------------------------------------------------------------------
/*! Move the position of the camera along the direction of projection. (dx,dy)*/
void VTKViewer_InteractorStyle::DollyXY(int dx, int dy)
{
myGUIWindow->update();
}
-//----------------------------------------------------------------------------
-/*!*/
void VTKViewer_InteractorStyle::SpinXY(int x, int y, int oldX, int oldY)
{
vtkCamera *cam;
}
-//----------------------------------------------------------------------------
/*!On mouse move event.
*\param ctrl - CTRL (not used)
*\param shift - SHIFT (on/off - integer 0/1)
}
-//----------------------------------------------------------------------------
/*!On Left button down event.
*\param ctrl - CTRL (on/off - integer 0/1)
*\param shift - SHIFT (on/off - integer 0/1)
}
-//----------------------------------------------------------------------------
/*!On left button up event.
*\param ctrl - CTRL (not used)
*\param shift - SHIFT (on/off - integer 0/1)
}
-//----------------------------------------------------------------------------
/*!On left button up event.
*\param ctrl - CTRL (on/off - integer 0/1)
*\param shift - SHIFT (on/off - integer 0/1)
}
-//----------------------------------------------------------------------------
/*!On middle button up event.
*\param ctrl - CTRL (not used)
*\param shift - SHIFT (on/off - integer 0/1)
}
-//----------------------------------------------------------------------------
/*!On right button down event.
*\param ctrl - CTRL (on/off - integer 0/1)
*\param shift - SHIFT (on/off - integer 0/1)
}
}
-//----------------------------------------------------------------------------
/*!On right button up event.
*\param ctrl - CTRL (not used)
*\param shift - SHIFT (on/off - integer 0/1)
}
}
-//----------------------------------------------------------------------------
-/** @name XPM - x pixmaps. */
+/*! @name XPM - x pixmaps. */
//@{
/*!Image Zoom cursor*/
const char* imageZoomCursor[] = {
"................................"};
//@}
-//----------------------------------------------------------------------------
/*! Loads cursors for viewer operations - zoom, pan, etc...*/
void VTKViewer_InteractorStyle::loadCursors()
{
}
-//----------------------------------------------------------------------------
/*! event filter - controls mouse and keyboard events during viewer operations*/
bool VTKViewer_InteractorStyle::eventFilter(QObject* object, QEvent* event)
{
}
-//----------------------------------------------------------------------------
/*! starts Zoom operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startZoom()
{
}
-//----------------------------------------------------------------------------
/*! starts Pan operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startPan()
{
qApp->installEventFilter(this);
}
-//----------------------------------------------------------------------------
/*! starts Rotate operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startRotate()
{
}
-//----------------------------------------------------------------------------
/*! starts Spin operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startSpin()
{
-//----------------------------------------------------------------------------
/*! starts Fit Area operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startFitArea()
{
}
-//----------------------------------------------------------------------------
/*!View fit all.*/
void VTKViewer_InteractorStyle::ViewFitAll() {
int aTriedronWasVisible = false;
}
-//----------------------------------------------------------------------------
/*! starts Global Panning operation (e.g. through menu command)*/
void VTKViewer_InteractorStyle::startGlobalPan()
{
}
-//----------------------------------------------------------------------------
/*!\retval TRUE if needs redrawing*/
bool VTKViewer_InteractorStyle::needsRedrawing()
{
}
-//----------------------------------------------------------------------------
/*! fits viewer contents to rectangle
*\param left - left side
*\param top - top side
}
-//----------------------------------------------------------------------------
/*! starts viewer operation (!internal usage!)*/
void VTKViewer_InteractorStyle::startOperation(int operation)
{
}
-//----------------------------------------------------------------------------
/*! sets proper cursor for window when viewer operation is activated*/
void VTKViewer_InteractorStyle::setCursor(const int operation)
{
}
-//----------------------------------------------------------------------------
/*! called when viewer operation started (!put necessary initialization here!)*/
void VTKViewer_InteractorStyle::onStartOperation()
{
}
-//----------------------------------------------------------------------------
/*! called when viewer operation finished (!put necessary post-processing here!)*/
void VTKViewer_InteractorStyle::onFinishOperation()
{
using namespace std;
-//----------------------------------------------------------------------------
+
vtkStandardNewMacro(VTKViewer_RectPicker);
-//----------------------------------------------------------------------------
+
/*!Constructor. Do nothing*/
VTKViewer_RectPicker::VTKViewer_RectPicker()
{
}
-//----------------------------------------------------------------------------
+
/*!Perform pick operation with selection rectangle provided. Normally the
* first two values for the selection top-left and right-bottom points are
* x-y pixel coordinate, and the third value is =0.
return result;
}
-//----------------------------------------------------------------------------
+
/*! Bounding box intersection with hexahedron. Origin[4][4] starts the ray from corner points,
* dir[4][3] is the vector components of the ray in the x-y-z directions.
* (Notes: the intersection ray dir[4][3] is NOT normalized.)
return inside;
}
-//----------------------------------------------------------------------------
/*! Position of point relative to hexahedron. p1[4][4] is the corner points of top face,
* p2[4][4] is the corner points of bottom face.
* \retval The method returns a non-zero value, if the point is inside.
return inside;
}
-//----------------------------------------------------------------------------
float VTKViewer_RectPicker::IntersectWithHex(float p1[4][4], float p2[4][4], float tol,
vtkAssemblyPath *path, vtkProp3D *prop3D,
vtkAbstractMapper3D *mapper)
myPointPicker->Delete();
}
+/*!
+ Print interactor to stream
+ \param os - stream
+ \param indent
+*/
void VTKViewer_RenderWindowInteractor::PrintSelf(ostream& os, vtkIndent indent)
{
vtkRenderWindowInteractor::PrintSelf(os, indent) ;
vtkRenderWindowInteractor::SetInteractorStyle(theInteractor);
}
-
-/*
-void VTKViewer_RenderWindowInteractor::SetSelectionMode(Selection_Mode theMode)
-{
- myCellActor->SetVisibility(false);
- myEdgeActor->SetVisibility(false);
- myPointActor->SetVisibility(false);
-
- switch(theMode){
- case ActorSelection:
- this->SetPicker(myBasicPicker);
- break;
- case NodeSelection:
- this->SetPicker(myPointPicker);
- break;
- case CellSelection:
- case EdgeSelection:
- case FaceSelection:
- case VolumeSelection:
- case EdgeOfCellSelection:
- this->SetPicker(myCellPicker);
- break;
- }
-
- myInteractorStyle->OnSelectionModeChanged();
-}
-*/
-
/*!Sets selection properties.
*\param theRed - red component of color
*\param theGreen - green component of color
return 1 ;
}
-/**@see CreateTimer(int )
- *\retval 1
+/*!
+ \sa CreateTimer(int )
+ \retval 1
*/
int VTKViewer_RenderWindowInteractor::DestroyTimer(void)
{
emit RenderWindowModified();
}
+/*!
+ default key press event (empty implementation)
+*/
void VTKViewer_RenderWindowInteractor::KeyPressed(QKeyEvent *event)
{
/// NOT_IMPLEMENTED
Bounds[1] = Bounds[3] = Bounds[5] = -VTK_LARGE_FLOAT;
}
+/*!
+ \return bounding box
+*/
vtkFloatingPointType*
VTKViewer_UnScaledActor
::GetBounds()
vtkFollower::Render(theRenderer);
}
+/*!
+ Constructor
+*/
VTKViewer_Axis::VTKViewer_Axis()
{
/*! \li Initialize the Line pipe-line representation*/
myVisibility = VTKViewer_Trihedron::eOn;
}
+/*!
+ Destructor
+*/
VTKViewer_Axis::~VTKViewer_Axis()
{
/*! \li Destroy of the Label pipe-line representation */
myLineSource->Delete();
}
+/*! Add to renderer
+ * \param theRenderer - vtkRenderer pointer
+ */
void VTKViewer_Axis::AddToRender(vtkRenderer* theRenderer){
/*! \li Order of the calls are important*/
theRenderer->AddActor(myLineActor);
theRenderer->AddActor(myArrowActor);
}
+/*! Remove actor of acis from \a theRenderer which are in myPresent.
+ * \param theRenderer - vtkRenderer pointer
+ */
void VTKViewer_Axis::RemoveFromRender(vtkRenderer* theRenderer){
/*! \li Order of the calls are important*/
theRenderer->RemoveActor(myLineActor);
theRenderer->RemoveActor(myArrowActor);
}
+/*! Sets visibility for all Axis to \a theVis*/
void VTKViewer_Axis::SetVisibility(VTKViewer_Trihedron::TVisibility theVis)
{
switch(theVis){
myVisibility = theVis;
}
-//****************************************************************
+/*! Set camera for myLabelActor
+ */
void VTKViewer_Axis::SetCamera(vtkCamera* theCamera){
myLabelActor->SetCamera(theCamera);
}
+/*! Sets \a theProperty for actors: myLineActor,myLabelActor,myArrowActor
+ */
void VTKViewer_Axis::SetProperty(vtkProperty* theProperty){
myLabelActor->SetProperty(theProperty);
myArrowActor->SetProperty(theProperty);
myLineActor->SetProperty(theProperty);
}
+/*! Set size of VTKViewer_Axis
+ */
void VTKViewer_Axis::SetSize(vtkFloatingPointType theSize)
{
vtkFloatingPointType aPosition[3] = {myDir[0]*theSize, myDir[1]*theSize, myDir[2]*theSize};
vtkStandardNewMacro(VTKViewer_Trihedron);
+/*!
+ Constructor
+*/
VTKViewer_Trihedron::VTKViewer_Trihedron()
{
myPresent = vtkActorCollection::New();
SetSize(aSize);
}
+/*!
+ Destructor
+*/
VTKViewer_Trihedron::~VTKViewer_Trihedron()
{
myPresent->RemoveAllItems();
myAxis[i]->Delete();
}
+/*! Set size of axes
+ */
void VTKViewer_Trihedron::SetSize(vtkFloatingPointType theSize)
{
mySize = theSize;
myAxis[i]->SetSize(theSize);
}
+/*! Set visibility of axes
+ */
void VTKViewer_Trihedron::SetVisibility(TVisibility theVis)
{
for(int i = 0; i < 3; i++)
myAxis[i]->SetVisibility(theVis);
}
+/*!
+ \return visibility of first axis
+*/
VTKViewer_Trihedron::TVisibility VTKViewer_Trihedron::GetVisibility()
{
return myAxis[0]->GetVisibility();
}
+/*! Add to render all Axis
+ * \param theRenderer - vtkRenderer pointer
+ */
void VTKViewer_Trihedron::AddToRender(vtkRenderer* theRenderer)
{
vtkCamera* aCamera = theRenderer->GetActiveCamera();
}
}
+/*! Remove all actors from \a theRenderer which are in myPresent.
+ * \param theRenderer - vtkRenderer pointer
+ */
void VTKViewer_Trihedron::RemoveFromRender(vtkRenderer* theRenderer)
{
myPresent->InitTraversal();
myAxis[i]->RemoveFromRender(theRenderer);
}
+/*! Return count of visible actors.
+ * \param theRenderer - vtkRenderer pointer
+ */
int VTKViewer_Trihedron::GetVisibleActorCount(vtkRenderer* theRenderer)
{
//TVisibility aVis = GetVisibility();
VTKViewer_UnScaledActor* ArrowActor;
};
-//****************************************************************
/*!This class provide support trihedron object in vtk viewer.*/
class VTKVIEWER_EXPORT VTKVIEWER_EXPORT VTKViewer_Trihedron : public vtkObject
{
vtkFloatingPointType mySize;
};
-//****************************************************************
/*!The base class for concreate Axis.
* Its only duty is to give correct initialization and destruction
* of its pipe-lines
newPolys->Delete();
}
+/*!
+ Print text to stream
+ \param os - stream
+ \param indent
+*/
void VTKViewer_VectorText::PrintSelf(ostream& os, vtkIndent indent)
{
this->Superclass::PrintSelf(os,indent);
return retStr;
}
-/* The method restors visual parameters of this view from a formated string
+/*! The method restors visual parameters of this view from a formated string
*/
void VTKViewer_ViewWindow::setVisualParameters( const QString& parameters )
{