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

📄 basic.h

📁 Wxpython Implemented on Windows CE, Source code
💻 H
📖 第 1 页 / 共 3 页
字号:

  // Rotate about the given axis by the given amount in radians.
  virtual void Rotate(double x, double y, double theta);
  virtual double GetRotation() const { return m_rotation; }
  virtual void SetRotation(double rotation) { m_rotation = rotation; }

  void ClearAttachments();

  // Recentres all the text regions for this object
  void Recentre(wxDC& dc);

  // Clears points from a list of wxRealPoints
  void ClearPointList(wxList& list);

  // Return pen or brush of the right colour for the background
  wxPen GetBackgroundPen();
  wxBrush GetBackgroundBrush();


 protected:
  wxShapeEvtHandler*    m_eventHandler;
  bool                  m_formatted;
  double                m_xpos, m_ypos;
  const wxPen*          m_pen;
  const wxBrush*        m_brush;
  wxFont*               m_font;
  wxColour              m_textColour;
  wxString              m_textColourName;
  wxShapeCanvas*        m_canvas;
  wxList                m_lines;
  wxList                m_text;
  wxList                m_controlPoints;
  wxList                m_regions;
  wxList                m_attachmentPoints;
  bool                  m_visible;
  bool                  m_disableLabel;
  long                  m_id;
  bool                  m_selected;
  bool                  m_highlighted;      // Different from selected: user-defined highlighting,
                                            // e.g. thick border.
  double                m_rotation;
  int                   m_sensitivity;
  bool                  m_draggable;
  int                   m_attachmentMode;   // 0 for no attachments, 1 if using normal attachments,
                                            // 2 for branching attachments
  bool                  m_spaceAttachments; // true if lines at one side should be spaced
  bool                  m_fixedWidth;
  bool                  m_fixedHeight;
  bool                  m_centreResize;    // Default is to resize keeping the centre constant (true)
  bool                  m_drawHandles;     // Don't draw handles if false, usually true
  wxList                m_children;      // In case it's composite
  wxShape*              m_parent;      // In case it's a child
  int                   m_formatMode;
  int                   m_shadowMode;
  const wxBrush*        m_shadowBrush;
  int                   m_shadowOffsetX;
  int                   m_shadowOffsetY;
  int                   m_textMarginX;    // Gap between text and border
  int                   m_textMarginY;
  wxString              m_regionName;
  bool                  m_maintainAspectRatio;
  int                   m_branchNeckLength;
  int                   m_branchStemLength;
  int                   m_branchSpacing;
  long                  m_branchStyle;
};

class WXDLLIMPEXP_OGL wxPolygonShape: public wxShape
{
 DECLARE_DYNAMIC_CLASS(wxPolygonShape)
 public:
  wxPolygonShape();
  ~wxPolygonShape();

  // Takes a list of wxRealPoints; each point is an OFFSET from the centre.
  // Deletes user's points in destructor.
  virtual void Create(wxList *points);
  virtual void ClearPoints();

  void GetBoundingBoxMin(double *w, double *h);
  void CalculateBoundingBox();
  bool GetPerimeterPoint(double x1, double y1,
                                 double x2, double y2,
                                 double *x3, double *y3);
  bool HitTest(double x, double y, int *attachment, double *distance);
  void SetSize(double x, double y, bool recursive = true);
  void OnDraw(wxDC& dc);
  void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);

  // Control points ('handles') redirect control to the actual shape, to make it easier
  // to override sizing behaviour.
  virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
  virtual void OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
  virtual void OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);

  // A polygon should have a control point at each vertex,
  // with the option of moving the control points individually
  // to change the shape.
  void MakeControlPoints();
  void ResetControlPoints();

  // If we've changed the shape, must make the original
  // points match the working points
  void UpdateOriginalPoints();

  // Add a control point after the given point
  virtual void AddPolygonPoint(int pos = 0);

  // Delete a control point
  virtual void DeletePolygonPoint(int pos = 0);

  // Recalculates the centre of the polygon
  virtual void CalculatePolygonCentre();

#if wxUSE_PROLOGIO
  void WriteAttributes(wxExpr *clause);
  void ReadAttributes(wxExpr *clause);
#endif

  int GetNumberOfAttachments() const;
  bool GetAttachmentPosition(int attachment, double *x, double *y,
                                     int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
  bool AttachmentIsValid(int attachment) const;
  // Does the copying for this object
  void Copy(wxShape& copy);

  inline wxList *GetPoints() { return m_points; }
  inline wxList *GetOriginalPoints() { return m_originalPoints; }

  // Rotate about the given axis by the given amount in radians
  virtual void Rotate(double x, double y, double theta);

  double GetOriginalWidth() const { return m_originalWidth; }
  double GetOriginalHeight() const { return m_originalHeight; }

  void SetOriginalWidth(double w) { m_originalWidth = w; }
  void SetOriginalHeight(double h) { m_originalHeight = h; }

 private:
  wxList*       m_points;
  wxList*       m_originalPoints;
  double        m_boundWidth;
  double        m_boundHeight;
  double        m_originalWidth;
  double        m_originalHeight;
};

class WXDLLIMPEXP_OGL wxRectangleShape: public wxShape
{
 DECLARE_DYNAMIC_CLASS(wxRectangleShape)
 public:
  wxRectangleShape(double w = 0.0, double h = 0.0);
  void GetBoundingBoxMin(double *w, double *h);
  bool GetPerimeterPoint(double x1, double y1,
                                 double x2, double y2,
                                 double *x3, double *y3);
  void OnDraw(wxDC& dc);
  void SetSize(double x, double y, bool recursive = true);
  void SetCornerRadius(double rad); // If > 0, rounded corners
  double GetCornerRadius() const { return m_cornerRadius; }

#if wxUSE_PROLOGIO
  void WriteAttributes(wxExpr *clause);
  void ReadAttributes(wxExpr *clause);
#endif

  int GetNumberOfAttachments() const;
  bool GetAttachmentPosition(int attachment, double *x, double *y,
                                     int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
  // Does the copying for this object
  void Copy(wxShape& copy);

  inline double GetWidth() const { return m_width; }
  inline double GetHeight() const { return m_height; }
  inline void SetWidth(double w) { m_width = w; }
  inline void SetHeight(double h) { m_height = h; }

protected:
  double m_width;
  double m_height;
  double m_cornerRadius;
};

class WXDLLIMPEXP_OGL wxTextShape: public wxRectangleShape
{
 DECLARE_DYNAMIC_CLASS(wxTextShape)
 public:
  wxTextShape(double width = 0.0, double height = 0.0);

  void OnDraw(wxDC& dc);

#if wxUSE_PROLOGIO
    void WriteAttributes(wxExpr *clause);
#endif

  // Does the copying for this object
  void Copy(wxShape& copy);
};

class WXDLLIMPEXP_OGL wxEllipseShape: public wxShape
{
 DECLARE_DYNAMIC_CLASS(wxEllipseShape)
 public:
  wxEllipseShape(double w = 0.0, double h = 0.0);

  void GetBoundingBoxMin(double *w, double *h);
  bool GetPerimeterPoint(double x1, double y1,
                                 double x2, double y2,
                                 double *x3, double *y3);

  void OnDraw(wxDC& dc);
  void SetSize(double x, double y, bool recursive = true);

#if wxUSE_PROLOGIO
  void WriteAttributes(wxExpr *clause);
  void ReadAttributes(wxExpr *clause);
#endif

  int GetNumberOfAttachments() const;
  bool GetAttachmentPosition(int attachment, double *x, double *y,
                                     int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);

  // Does the copying for this object
  void Copy(wxShape& copy);

  inline double GetWidth() const { return m_width; }
  inline double GetHeight() const { return m_height; }

  inline void SetWidth(double w) { m_width = w; }
  inline void SetHeight(double h) { m_height = h; }

protected:
  double m_width;
  double m_height;
};

class WXDLLIMPEXP_OGL wxCircleShape: public wxEllipseShape
{
 DECLARE_DYNAMIC_CLASS(wxCircleShape)
 public:
  wxCircleShape(double w = 0.0);

  bool GetPerimeterPoint(double x1, double y1,
                                 double x2, double y2,
                                 double *x3, double *y3);
  // Does the copying for this object
  void Copy(wxShape& copy);
};

#endif
 // _OGL_BASIC_H_

⌨️ 快捷键说明

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