⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 _oglshapes.i

📁 Wxpython Implemented on Windows CE, Source code
💻 I
📖 第 1 页 / 共 2 页
字号:
/////////////////////////////////////////////////////////////////////////////
// Name:        oglshapes.i
// Purpose:     SWIG definitions for the wxWindows Object Graphics Library
//
// Author:      Robin Dunn
//
// Created:     3-Sept-1999
// RCS-ID:      $Id: _oglshapes.i,v 1.9 2004/12/23 20:44:04 RD Exp $
// Copyright:   (c) 1998 by Total Control Software
// Licence:     wxWindows license
/////////////////////////////////////////////////////////////////////////////


// not a %module


//---------------------------------------------------------------------------

enum {
    oglMETAFLAGS_OUTLINE,
    oglMETAFLAGS_ATTACHMENTS
};

//---------------------------------------------------------------------------

%typemap(in) (int points, wxPoint* points_array ) {
    $2 = wxPoint_LIST_helper($input, &$1);
    if ($2 == NULL) SWIG_fail;
}
%typemap(freearg) (int points, wxPoint* points_array ) {
    if ($2) delete [] $2;
}

//---------------------------------------------------------------------------

class wxPseudoMetaFile : public wxObject {
public:
  wxPseudoMetaFile();
  ~wxPseudoMetaFile();

    void Draw(wxDC& dc, double xoffset, double yoffset);
#ifdef wxUSE_PROLOGIO
    void WriteAttributes(wxExpr *clause, int whichAngle);
    void ReadAttributes(wxExpr *clause, int whichAngle);
#endif
    void Clear();
    void Copy(wxPseudoMetaFile& copy);
    void Scale(double sx, double sy);
    void ScaleTo(double w, double h);
    void Translate(double x, double y);
    void Rotate(double x, double y, double theta);
    bool LoadFromMetaFile(const wxString& filename, double *width, double *height);
    void GetBounds(double *minX, double *minY, double *maxX, double *maxY);
    void CalculateSize(wxPyDrawnShape* shape);

    // ****  fix these...  is it even possible?  these are lists of various GDI opperations (not the objects...)
    // wxList& GetOutlineColours();
    // wxList& GetFillColours();
    // wxList& GetOps();

    void SetRotateable(bool rot);
    bool GetRotateable();
    void SetSize(double w, double h);
    void SetFillBrush(wxBrush* brush);
    wxBrush* GetFillBrush();
    void SetOutlinePen(wxPen* pen);
    wxPen* GetOutlinePen();
    void SetOutlineOp(int op);
    int GetOutlineOp();


    bool IsValid();
    void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
    void DrawRectangle(const wxRect& rect);
    void DrawRoundedRectangle(const wxRect& rect, double radius);
    void DrawArc(const wxPoint& centrePt, const wxPoint& startPt, const wxPoint& endPt);
    void DrawEllipticArc(const wxRect& rect, double startAngle, double endAngle);
    void DrawEllipse(const wxRect& rect);
    void DrawPoint(const wxPoint& pt);
    void DrawText(const wxString& text, const wxPoint& pt);
    void DrawLines(int points, wxPoint* points_array);
    void DrawPolygon(int points, wxPoint* points_array, int flags = 0);
    void DrawSpline(int points, wxPoint* points_array);
    void SetClippingRect(const wxRect& rect);
    void DestroyClippingRect();
    void SetPen(wxPen* pen, bool isOutline = FALSE);
    void SetBrush(wxBrush* brush, bool isFill = FALSE);
    void SetFont(wxFont* font);
    void SetTextColour(const wxColour& colour);
    void SetBackgroundColour(const wxColour& colour);
    void SetBackgroundMode(int mode);
};


//---------------------------------------------------------------------------

%{
// Using this macro can sometimes provoke an Internal Compiler Error in MSVC
// 6, so instead I'l just expand it out by hand...
//    WXSHAPE_IMP_CALLBACKS(wxPyRectangleShape, wxRectangleShape);

    IMP_PYCALLBACK__                (wxPyRectangleShape, wxRectangleShape,  OnDelete);
    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnDraw);
    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnDrawContents);
    IMP_PYCALLBACK__DCBOOL          (wxPyRectangleShape, wxRectangleShape,  OnDrawBranches);
    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnMoveLinks);
    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnErase);
    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnEraseContents);
    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnHighlight);
    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnLeftClick);
    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnLeftDoubleClick);
    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnRightClick);
    IMP_PYCALLBACK__2DBL            (wxPyRectangleShape, wxRectangleShape,  OnSize);
    IMP_PYCALLBACK_BOOL_DC4DBLBOOL  (wxPyRectangleShape, wxRectangleShape,  OnMovePre);
    IMP_PYCALLBACK__DC4DBLBOOL      (wxPyRectangleShape, wxRectangleShape,  OnMovePost);
    IMP_PYCALLBACK__BOOL2DBL2INT    (wxPyRectangleShape, wxRectangleShape,  OnDragLeft);
    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnBeginDragLeft);
    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnEndDragLeft);
    IMP_PYCALLBACK__BOOL2DBL2INT    (wxPyRectangleShape, wxRectangleShape,  OnDragRight);
    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnBeginDragRight);
    IMP_PYCALLBACK__2DBL2INT        (wxPyRectangleShape, wxRectangleShape,  OnEndDragRight);
    IMP_PYCALLBACK__DC4DBL          (wxPyRectangleShape, wxRectangleShape,  OnDrawOutline);
    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnDrawControlPoints);
    IMP_PYCALLBACK__DC              (wxPyRectangleShape, wxRectangleShape,  OnEraseControlPoints);
    IMP_PYCALLBACK__DCBOOL          (wxPyRectangleShape, wxRectangleShape,  OnMoveLink);
    IMP_PYCALLBACK__WXCPBOOL2DBL2INT(wxPyRectangleShape, wxRectangleShape,  OnSizingDragLeft);
    IMP_PYCALLBACK__WXCP2DBL2INT    (wxPyRectangleShape, wxRectangleShape,  OnSizingBeginDragLeft);
    IMP_PYCALLBACK__WXCP2DBL2INT    (wxPyRectangleShape, wxRectangleShape,  OnSizingEndDragLeft);
    IMP_PYCALLBACK__2DBL            (wxPyRectangleShape, wxRectangleShape,  OnBeginSize);
    IMP_PYCALLBACK__2DBL            (wxPyRectangleShape, wxRectangleShape,  OnEndSize)
        
%}

class wxPyRectangleShape : public wxPyShape {
public:
    %pythonAppend wxPyRectangleShape "self._setOORandCallbackInfo(PyRectangleShape)"
    
    wxPyRectangleShape(double width = 0.0, double height = 0.0);
    void _setCallbackInfo(PyObject* self, PyObject* _class);

    void SetCornerRadius(double radius);
    double GetCornerRadius();
    
    void base_OnDelete();
    void base_OnDraw(wxDC& dc);
    void base_OnDrawContents(wxDC& dc);
    void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
    void base_OnMoveLinks(wxDC& dc);
    void base_OnErase(wxDC& dc);
    void base_OnEraseContents(wxDC& dc);
    void base_OnHighlight(wxDC& dc);
    void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
    void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
    void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
    void base_OnSize(double x, double y);
    bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
    void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
    void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
    void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
    void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
    void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
    void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
    void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
    void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
    void base_OnDrawControlPoints(wxDC& dc);
    void base_OnEraseControlPoints(wxDC& dc);
    void base_OnMoveLink(wxDC& dc, bool moveControlPoints = true);
    void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
    void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
    void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
    void base_OnBeginSize(double w, double h);
    void base_OnEndSize(double w, double h);
//    void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
};

//---------------------------------------------------------------------------

%{
    WXSHAPE_IMP_CALLBACKS(wxPyControlPoint, wxControlPoint);
%}

class wxPyControlPoint : public wxPyRectangleShape {
public:
    %pythonAppend wxPyControlPoint "self._setOORandCallbackInfo(PyControlPoint)"
    
    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);

    void _setCallbackInfo(PyObject* self, PyObject* _class);

    void SetCornerRadius(double radius);

    void base_OnDelete();
    void base_OnDraw(wxDC& dc);
    void base_OnDrawContents(wxDC& dc);
    void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
    void base_OnMoveLinks(wxDC& dc);
    void base_OnErase(wxDC& dc);
    void base_OnEraseContents(wxDC& dc);
    void base_OnHighlight(wxDC& dc);
    void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
    void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
    void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
    void base_OnSize(double x, double y);
    bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
    void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
    void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
    void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
    void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
    void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
    void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
    void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
    void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
    void base_OnDrawControlPoints(wxDC& dc);
    void base_OnEraseControlPoints(wxDC& dc);
    void base_OnMoveLink(wxDC& dc, bool moveControlPoints = true);
    void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
    void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
    void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
    void base_OnBeginSize(double w, double h);
    void base_OnEndSize(double w, double h);
//    void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
};

//---------------------------------------------------------------------------
%{
    WXSHAPE_IMP_CALLBACKS(wxPyBitmapShape, wxBitmapShape);
%}


class wxPyBitmapShape : public wxPyRectangleShape {
public:
    %pythonAppend wxPyBitmapShape "self._setOORandCallbackInfo(PyBitmapShape)"
    
    wxPyBitmapShape();

    void _setCallbackInfo(PyObject* self, PyObject* _class);

    wxBitmap& GetBitmap();
    wxString GetFilename();
    void SetBitmap(const wxBitmap& bitmap);
    void SetFilename(const wxString& filename);

    void base_OnDelete();
    void base_OnDraw(wxDC& dc);
    void base_OnDrawContents(wxDC& dc);
    void base_OnDrawBranches(wxDC& dc, bool erase = FALSE);
    void base_OnMoveLinks(wxDC& dc);
    void base_OnErase(wxDC& dc);
    void base_OnEraseContents(wxDC& dc);
    void base_OnHighlight(wxDC& dc);
    void base_OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
    void base_OnLeftDoubleClick(double x, double y, int keys = 0, int attachment = 0);
    void base_OnRightClick(double x, double y, int keys = 0, int attachment = 0);
    void base_OnSize(double x, double y);
    bool base_OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
    void base_OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = true);
    void base_OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
    void base_OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
    void base_OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
    void base_OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
    void base_OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
    void base_OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
    void base_OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
    void base_OnDrawControlPoints(wxDC& dc);
    void base_OnEraseControlPoints(wxDC& dc);
    void base_OnMoveLink(wxDC& dc, bool moveControlPoints = true);
    void base_OnSizingDragLeft(wxPyControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
    void base_OnSizingBeginDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
    void base_OnSizingEndDragLeft(wxPyControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
    void base_OnBeginSize(double w, double h);
    void base_OnEndSize(double w, double h);
//    void base_OnChangeAttachment(int attachment, wxPyLineShape* line, wxList& ordering);
};

//---------------------------------------------------------------------------
%{
    WXSHAPE_IMP_CALLBACKS(wxPyDrawnShape, wxDrawnShape);
%}

class wxPyDrawnShape : public wxPyRectangleShape {
public:
    %pythonAppend wxPyDrawnShape "self._setOORandCallbackInfo(PyDrawnShape)"
    
    wxPyDrawnShape();

    void _setCallbackInfo(PyObject* self, PyObject* _class);

    void CalculateSize();
    void DestroyClippingRect();
    void DrawArc(const wxPoint& centrePoint, const wxPoint& startPoint,
                 const wxPoint& endPoint);
    void DrawAtAngle(int angle);
    void DrawEllipticArc(const wxRect& rect, double startAngle, double endAngle);
    void DrawLine(const wxPoint& point1, const wxPoint& point2);
    void DrawLines(int points, wxPoint* points_array);
    void DrawPoint(const wxPoint& point);
    
    void DrawPolygon(int points, wxPoint* points_array, int flags = 0);
    
    void DrawRectangle(const wxRect& rect);
    void DrawRoundedRectangle(const wxRect& rect, double radius);
    void DrawSpline(int points, wxPoint* points_array);
    void DrawText(const wxString& text, const wxPoint& point);
    int GetAngle();

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -