1999-09-10 02:25:47 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: oglhelpers.h
|
|
|
|
// Purpose: Some Helper functions to help in data conversions in OGL
|
|
|
|
//
|
|
|
|
// Author: Robin Dunn
|
|
|
|
//
|
|
|
|
// Created: 9-Sept-1999
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 1998 by Total Control Software
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __wxp_ogl_helpers__
|
|
|
|
#define __wxp_ogl_helpers__
|
|
|
|
|
|
|
|
|
2000-03-10 22:20:42 -05:00
|
|
|
#include <wx/ogl/ogl.h>
|
|
|
|
#include <wx/ogl/basicp.h>
|
|
|
|
#include <wx/ogl/constrnt.h>
|
|
|
|
#include <wx/ogl/bmpshape.h>
|
|
|
|
#include <wx/ogl/drawn.h>
|
|
|
|
|
1999-09-10 02:25:47 -04:00
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Define a macro that will be used in the class definintions below
|
|
|
|
|
|
|
|
#define WXSHAPE_DEC_CALLBACKS() \
|
|
|
|
DEC_PYCALLBACK__ (OnDelete); \
|
|
|
|
DEC_PYCALLBACK__DC (OnDraw); \
|
|
|
|
DEC_PYCALLBACK__DC (OnDrawContents); \
|
|
|
|
DEC_PYCALLBACK__DCBOOL (OnDrawBranches); \
|
|
|
|
DEC_PYCALLBACK__DC (OnMoveLinks); \
|
|
|
|
DEC_PYCALLBACK__DC (OnErase); \
|
|
|
|
DEC_PYCALLBACK__DC (OnEraseContents); \
|
|
|
|
DEC_PYCALLBACK__DC (OnHighlight); \
|
|
|
|
DEC_PYCALLBACK__2DBL2INT (OnLeftClick); \
|
|
|
|
DEC_PYCALLBACK__2DBL2INT (OnLeftDoubleClick); \
|
|
|
|
DEC_PYCALLBACK__2DBL2INT (OnRightClick); \
|
|
|
|
DEC_PYCALLBACK__2DBL (OnSize); \
|
|
|
|
DEC_PYCALLBACK_BOOL_DC4DBLBOOL (OnMovePre); \
|
|
|
|
DEC_PYCALLBACK__DC4DBLBOOL (OnMovePost); \
|
|
|
|
DEC_PYCALLBACK__BOOL2DBL2INT (OnDragLeft); \
|
|
|
|
DEC_PYCALLBACK__2DBL2INT (OnBeginDragLeft); \
|
|
|
|
DEC_PYCALLBACK__2DBL2INT (OnEndDragLeft); \
|
|
|
|
DEC_PYCALLBACK__BOOL2DBL2INT (OnDragRight); \
|
|
|
|
DEC_PYCALLBACK__2DBL2INT (OnBeginDragRight); \
|
|
|
|
DEC_PYCALLBACK__2DBL2INT (OnEndDragRight); \
|
|
|
|
DEC_PYCALLBACK__DC4DBL (OnDrawOutline); \
|
|
|
|
DEC_PYCALLBACK__DC (OnDrawControlPoints); \
|
|
|
|
DEC_PYCALLBACK__DC (OnEraseControlPoints); \
|
|
|
|
DEC_PYCALLBACK__DCBOOL (OnMoveLink); \
|
|
|
|
DEC_PYCALLBACK__WXCPBOOL2DBL2INT(OnSizingDragLeft); \
|
|
|
|
DEC_PYCALLBACK__WXCP2DBL2INT (OnSizingBeginDragLeft);\
|
|
|
|
DEC_PYCALLBACK__WXCP2DBL2INT (OnSizingEndDragLeft); \
|
|
|
|
DEC_PYCALLBACK__2DBL (OnBeginSize); \
|
|
|
|
DEC_PYCALLBACK__2DBL (OnEndSize); \
|
2003-07-02 19:13:10 -04:00
|
|
|
PYPRIVATE
|
1999-09-10 02:25:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
#define WXSHAPE_IMP_CALLBACKS(CLASS, PARENT) \
|
|
|
|
IMP_PYCALLBACK__ (CLASS, PARENT, OnDelete); \
|
|
|
|
IMP_PYCALLBACK__DC (CLASS, PARENT, OnDraw); \
|
|
|
|
IMP_PYCALLBACK__DC (CLASS, PARENT, OnDrawContents); \
|
|
|
|
IMP_PYCALLBACK__DCBOOL (CLASS, PARENT, OnDrawBranches); \
|
|
|
|
IMP_PYCALLBACK__DC (CLASS, PARENT, OnMoveLinks); \
|
|
|
|
IMP_PYCALLBACK__DC (CLASS, PARENT, OnErase); \
|
|
|
|
IMP_PYCALLBACK__DC (CLASS, PARENT, OnEraseContents); \
|
|
|
|
IMP_PYCALLBACK__DC (CLASS, PARENT, OnHighlight); \
|
|
|
|
IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnLeftClick); \
|
|
|
|
IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnLeftDoubleClick); \
|
|
|
|
IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnRightClick); \
|
|
|
|
IMP_PYCALLBACK__2DBL (CLASS, PARENT, OnSize); \
|
|
|
|
IMP_PYCALLBACK_BOOL_DC4DBLBOOL (CLASS, PARENT, OnMovePre); \
|
|
|
|
IMP_PYCALLBACK__DC4DBLBOOL (CLASS, PARENT, OnMovePost); \
|
|
|
|
IMP_PYCALLBACK__BOOL2DBL2INT (CLASS, PARENT, OnDragLeft); \
|
|
|
|
IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnBeginDragLeft); \
|
|
|
|
IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnEndDragLeft); \
|
|
|
|
IMP_PYCALLBACK__BOOL2DBL2INT (CLASS, PARENT, OnDragRight); \
|
|
|
|
IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnBeginDragRight); \
|
|
|
|
IMP_PYCALLBACK__2DBL2INT (CLASS, PARENT, OnEndDragRight); \
|
|
|
|
IMP_PYCALLBACK__DC4DBL (CLASS, PARENT, OnDrawOutline); \
|
|
|
|
IMP_PYCALLBACK__DC (CLASS, PARENT, OnDrawControlPoints); \
|
|
|
|
IMP_PYCALLBACK__DC (CLASS, PARENT, OnEraseControlPoints); \
|
|
|
|
IMP_PYCALLBACK__DCBOOL (CLASS, PARENT, OnMoveLink); \
|
|
|
|
IMP_PYCALLBACK__WXCPBOOL2DBL2INT(CLASS, PARENT, OnSizingDragLeft); \
|
|
|
|
IMP_PYCALLBACK__WXCP2DBL2INT (CLASS, PARENT, OnSizingBeginDragLeft);\
|
|
|
|
IMP_PYCALLBACK__WXCP2DBL2INT (CLASS, PARENT, OnSizingEndDragLeft); \
|
|
|
|
IMP_PYCALLBACK__2DBL (CLASS, PARENT, OnBeginSize); \
|
2003-07-02 19:13:10 -04:00
|
|
|
IMP_PYCALLBACK__2DBL (CLASS, PARENT, OnEndSize)
|
1999-09-10 02:25:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
// This one may be difficult...
|
|
|
|
//PYCALLBACK__??????? (PARENT, OnChangeAttachment);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
2001-11-26 21:56:59 -05:00
|
|
|
// These are prototypes of some helper functions found in ogl.i
|
1999-09-10 02:25:47 -04:00
|
|
|
|
2003-11-12 16:34:20 -05:00
|
|
|
wxList* wxPy_wxListHelper(PyObject* pyList, const wxChar* className);
|
1999-09-10 02:25:47 -04:00
|
|
|
wxList* wxPy_wxRealPoint_ListHelper(PyObject* pyList);
|
2001-11-26 21:56:59 -05:00
|
|
|
PyObject* wxPyMake_wxShapeEvtHandler(wxShapeEvtHandler* source);
|
2003-11-12 16:34:20 -05:00
|
|
|
PyObject* wxPy_ConvertShapeList(wxListBase* list);
|
1999-09-10 02:25:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
// Classes that derive from the shapes and such, but which know how to turn
|
|
|
|
// virtual callbacks into Python callbacks.
|
|
|
|
|
|
|
|
class wxPyShapeCanvas : public wxShapeCanvas {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyShapeCanvas);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyShapeCanvas(wxWindow* parent = NULL, wxWindowID id = -1,
|
2000-12-22 01:51:21 -05:00
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
2002-07-06 00:14:52 -04:00
|
|
|
long style = wxBORDER,
|
|
|
|
const wxString& name = wxT("shapeCanvas"))
|
|
|
|
: wxShapeCanvas(parent, id, pos, size, style, name) {}
|
1999-09-10 02:25:47 -04:00
|
|
|
|
|
|
|
DEC_PYCALLBACK__2DBLINT(OnBeginDragLeft);
|
|
|
|
DEC_PYCALLBACK__2DBLINT(OnBeginDragRight);
|
|
|
|
DEC_PYCALLBACK__2DBLINT(OnEndDragLeft);
|
|
|
|
DEC_PYCALLBACK__2DBLINT(OnEndDragRight);
|
|
|
|
DEC_PYCALLBACK__BOOL2DBLINT(OnDragLeft);
|
|
|
|
DEC_PYCALLBACK__BOOL2DBLINT(OnDragRight);
|
|
|
|
DEC_PYCALLBACK__2DBLINT(OnLeftClick);
|
|
|
|
DEC_PYCALLBACK__2DBLINT(OnRightClick);
|
|
|
|
|
|
|
|
PYPRIVATE;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class wxPyShapeEvtHandler : public wxShapeEvtHandler {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyShapeEvtHandler);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyShapeEvtHandler(wxShapeEvtHandler *prev = NULL, wxShape *shape = NULL)
|
|
|
|
: wxShapeEvtHandler(prev, shape) {}
|
|
|
|
|
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class wxPyShape : public wxShape {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_ABSTRACT_CLASS(wxPyShape);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyShape(wxPyShapeCanvas *can = NULL)
|
|
|
|
: wxShape(can) {}
|
|
|
|
|
2003-11-12 16:34:20 -05:00
|
|
|
virtual void GetBoundingBoxMin(double *width, double *height)
|
|
|
|
{
|
|
|
|
if (width) *width = 0.0;
|
|
|
|
if (height) *height = 0.0;
|
|
|
|
}
|
|
|
|
|
1999-09-10 02:25:47 -04:00
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class wxPyRectangleShape : public wxRectangleShape {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyRectangleShape);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyRectangleShape(double width = 0.0, double height = 0.0)
|
|
|
|
: wxRectangleShape(width, height) {}
|
|
|
|
|
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
};
|
|
|
|
|
1999-09-30 02:58:38 -04:00
|
|
|
class wxPyControlPoint : public wxControlPoint {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyControlPoint);
|
1999-09-30 02:58:38 -04:00
|
|
|
public:
|
|
|
|
wxPyControlPoint(wxPyShapeCanvas *the_canvas = NULL,
|
|
|
|
wxPyShape *object = NULL,
|
|
|
|
double size = 0.0, double the_xoffset = 0.0,
|
|
|
|
double the_yoffset = 0.0, int the_type = 0)
|
|
|
|
: wxControlPoint(the_canvas, object, size,
|
|
|
|
the_xoffset, the_yoffset, the_type) {}
|
|
|
|
|
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
};
|
|
|
|
|
1999-09-10 02:25:47 -04:00
|
|
|
|
|
|
|
|
|
|
|
class wxPyBitmapShape : public wxBitmapShape {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyBitmapShape);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyBitmapShape() : wxBitmapShape() {}
|
|
|
|
|
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class wxPyDrawnShape : public wxDrawnShape {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyDrawnShape);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyDrawnShape() : wxDrawnShape() {}
|
|
|
|
|
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class wxPyCompositeShape : public wxCompositeShape {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyCompositeShape);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyCompositeShape() : wxCompositeShape() {}
|
|
|
|
|
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class wxPyDividedShape : public wxDividedShape {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyDividedShape);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyDividedShape(double width = 0.0, double height = 0.0)
|
|
|
|
: wxDividedShape(width, height) {}
|
|
|
|
|
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class wxPyDivisionShape : public wxDivisionShape {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyDivisionShape);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyDivisionShape() : wxDivisionShape() {}
|
|
|
|
|
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class wxPyEllipseShape : public wxEllipseShape {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyEllipseShape);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyEllipseShape(double width = 0.0, double height = 0.0)
|
|
|
|
: wxEllipseShape(width, height) {}
|
|
|
|
|
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class wxPyCircleShape : public wxCircleShape {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyCircleShape);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyCircleShape(double width = 0.0)
|
|
|
|
: wxCircleShape(width) {}
|
|
|
|
|
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class wxPyLineShape : public wxLineShape {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyLineShape);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyLineShape() : wxLineShape() {}
|
|
|
|
|
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class wxPyPolygonShape : public wxPolygonShape {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyPolygonShape);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyPolygonShape() : wxPolygonShape() {}
|
|
|
|
|
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class wxPyTextShape : public wxTextShape {
|
2001-05-17 18:47:09 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxPyTextShape);
|
1999-09-10 02:25:47 -04:00
|
|
|
public:
|
|
|
|
wxPyTextShape(double width = 0.0, double height = 0.0)
|
|
|
|
: wxTextShape(width, height) {}
|
|
|
|
|
|
|
|
WXSHAPE_DEC_CALLBACKS();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
//---------------------------------------------------------------------------
|
|
|
|
#endif
|
|
|
|
|
2001-05-17 18:47:09 -04:00
|
|
|
|