cgal/Tutorial/tutorial/Polyhedron/Qt/Subdivision/tool/toolview.h

90 lines
2.8 KiB
C++

/***************************************************************************
begin : jan 02
copyright : (C) 2002 by Pierre Alliez
email : pierre.alliez@sophia.inria.fr
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef TOOLVIEW_H
#define TOOLVIEW_H
// include files for Qt
#include <qwidget.h>
#include <qworkspace.h>
#include <qgl.h>
#include "glview.h"
class ToolDoc;
/**
* This class provides an incomplete base for your application view.
*
* @author Source Framework Automatically Generated by KDevelop, (c) The KDevelop Team.
* @version KDevelop version 1.1 code generation
*/
class ToolView : public QGLView
{
Q_OBJECT
friend ToolDoc;
public:
/** Constructor for the view
* @param pDoc your document instance that the view represents. Create a document before calling the constructor
* or connect an already existing document to a new MDI child widget.*/
ToolView(ToolDoc* pDoc,
const QGLFormat& format,
QWidget* parent,
const char *name,
int wflags);
/** Destructor for the main view */
~ToolView();
/** returns a pointer to the document connected to the view*/
ToolDoc *getDocument() const;
/** gets called to redraw the document contents if it has been modified */
void update(ToolView* pSender);
/** contains the implementation for printing functionality and gets called by ToolApp::slotFilePrint() */
void print(QPrinter *pPrinter);
protected:
virtual void closeEvent(QCloseEvent*);
virtual void focusInEvent(QFocusEvent*);
// mouse events
virtual void mousePressEvent( QMouseEvent * );
virtual void mouseReleaseEvent( QMouseEvent * );
virtual void mouseMoveEvent( QMouseEvent * );
void HandleMouseButton(int x, int y);
ToolDoc *doc;
private:
bool mousePressed;
bool m_LeftButtonDown;
bool m_RightButtonDown;
// optimize
bool m_Move;
void move(bool m) { m_Move = m; }
public:
void drawScene(bool superimposededges = false,
bool superimposedvertices = false, bool first = true);
signals:
void invalidate_view(ToolView*);
};
#endif