#include <ivffltk/deprecated/IvfFltkWidget.h>
Inheritance diagram for CIvfFltkWidget:
Public Member Functions | |
CIvfFltkWidget (int X, int Y, int W, int H, const char *L=0) | |
virtual | ~CIvfFltkWidget () |
IvfClassInfo ("CIvfFltkWidget", CIvfBase) | |
CIvfCamera * | getCamera () |
void | addToScene (CIvfShape *shape) |
void | deleteSelected () |
void | deleteSelectedKeep () |
void | manipulateSelected (int mode) |
int | getManipulatorMode () |
void | createLine () |
void | centerSelected () |
void | deleteAll () |
void | resetView () |
void | clearSelection () |
void | selectAll () |
void | setEditMode (int mode) |
int | getEditMode () |
void | setWorkspace (double size) |
double | getWorkspace () |
CIvfWorkspace * | getScene () |
bool | getUseOverlay () |
void | setUseOverlay (bool flag) |
void | setSelectEnable (bool flag) |
void | setEditEnabled (bool flag) |
void | setSnapToGrid (bool flag) |
bool | getSnapToGrid () |
int | getCurrentMouseButton () |
int | getCurrentModifier () |
CIvfComposite * | getSelectedShapes () |
bool | isInitialized () |
Protected Member Functions | |
void | draw () |
int | handle (int event) |
virtual void | doMouseUp (int x, int y) |
virtual void | doMouseDown (int x, int y) |
virtual void | doPassiveMotion (int x, int y) |
virtual void | doMotion (int x, int y) |
virtual void | doMouse (int x, int y) |
virtual void | onInit () |
virtual void | onDestroy () |
virtual void | onCreateNode (double x, double y, double z, CIvfNode *&newNode) |
virtual void | onCreateLine (CIvfNode *node1, CIvfNode *node2, CIvfShape *&newLine) |
virtual void | onSelect (CIvfComposite *selectedShapes) |
virtual void | onDeSelect () |
virtual void | onCoordinate (double x, double y, double z) |
virtual void | onDeleteShape (CIvfShape *shape, bool &doit) |
virtual void | onInitContext () |
virtual void | onOverlay () |
virtual void | onHighlightShape (CIvfShape *shape) |
virtual void | onMove (CIvfComposite *selectedShapes, double &dx, double &dy, double &dz, bool &doit) |
virtual void | onSelectFilter (CIvfShape *shape, bool &select) |
virtual void | onHighlightFilter (CIvfShape *, bool &highlight) |
virtual void | onMotion (int x, int y) |
virtual void | onPassiveMotion (int x, int y) |
virtual void | onMouse (int x, int y) |
virtual void | onMouseDown (int x, int y) |
virtual void | onMouseUp (int x, int y) |
Widget for interfacing the Ivf++ library with a FLTK Application. The class should be used to derive custom widgets. These widgets should implement/override the onXXX methods in the class to enable it to create shapes. NOTE: To derive more general widgets use the CIvfFltkBase instead.
Definition at line 123 of file IvfFltkWidget.h.
|
CIvfFltkWidget constructor Initializes the widget position and size and an optional title
|
|
CIvfFltkWidget destructor |
|
Add a shape to the scene. If addReference() is not called on the shape before adding it to the scene, the shape is owned by the widget and will be destroyed when not needed. |
|
Centers camera on selected shape. |
|
Creates a line between two selected nodes This method calls the virtual method onCreateLine(...) to enable derived classes to instanciate new classes. |
|
Deletes all shapes in scene. Shapes are deleted if not referenced. |
|
Deletes selected shapes Shapes are deleted if not referenced. |
|
Implements the FL_Gl_Window draw method This method is called when the widget is to be drawn. |
|
Returns camera used by widget |
|
Return current mouse button |
|
Returns current edit mode |
|
Returns manipulation mode |
|
Return the scene object used by the widget |
|
Return snap to grid state |
|
Return overlay use |
|
Returns workspace size |
|
Implements the FL_Gl_Window handle method This method is called in response to GUI events. |
|
Manipulate selected shape Attaches a manipulator to the currently selected shape. The current edit mode is changed to IVF_MANIPULATE. Manipulation mode can be set to two different modes:
|
|
onCoordinate event This method is called when the cursor is updated.
|
|
onCreateLine event This method is called if a line is to created. The following code shows how a onCreateLine method can be implemented. void CIvfMyWidget::onCreateLine(CIvfNode* node1, CIvfNode* node2, CIvfShape* &newLine) { CIvfSolidLine* line = new CIvfSolidLine(); line->setNodes(node1, node2); line->setRadius(m_lineRadius); line->setSides(m_lineSides); line->setMaterial(m_lineMaterial); newLine = (CIvfShape*) line; }
|
|
onCreateNode event This method is called if a node is to be created. The following code sample shows how a onCreateNode method can be implemented. void CIvfMyWidget::onCreateNode(double x, double y, double z, CIvfNode* &newNode) { newNode = new CIvfNode(); newNode->setPosition(x, y, z); newNode->setNodeSize(m_nodeSize); newNode->setNodeType(m_nodeType); newNode->setMaterial(m_nodeMaterial); }
|
|
onDeleteShape event Is called when an object is to be deleted. The doit variable determines if the object can be deleted. If doit is true the object will be deleted. |
|
onDeSelect event This method is called when objects have be deselected. |
|
onDestroy event This method is called when the widget is destroyed. |
|
onHighlightShape event This event is called when an object has been highlighted in a select operation. |
|
onInit event onInit is called the first time an OpenGL context is activated. All OpenGL dependent intialization code should be placed here, including Ivf++ code. |
|
onInitContext event This event is called when an OpenGL context is initialized. OpenGL state initialization code should be placed here. |
|
onMove event This event is called in response to a move operation. The dx, dy, dz values contains the requested move distance. These can be modified to control the move behavior. The doit flag must be set to true if the move operation should be performed or not. |
|
onOverlay event This event is called when an overlay is to be drawn. For this method to be called, the UseOverlay property must be set using the setUseOverlay method. The view port is configured for 2D drawing when this method is called. |
|
onSelect event This method is called when a selection has occured.
|
|
Resets view to initial settings |
|
Enables/disables edit |
|
Set widget edit mode. Sets the edit mode of the widget. Determines how mouse actions and keyboard actions should be handled.
|
|
Enables/disables selection |
|
Enables/disables grid snap |
|
Enables the use of a overlay layer (see onOverlay) |
|
Set size of workspace The workspace size describes the size of the grid and relative node sizes and line radius. Also sets an initial snap distance of the grid. Workspace is centered around the origin (0,0) The visual grid spans (-size/2,-size/2)-(size/2,size/2) |