]> git.saurik.com Git - wxWidgets.git/blobdiff - include/wx/richtext/richtextbuffer.h
CW8.3+ has ssize_t (patch 1492413)
[wxWidgets.git] / include / wx / richtext / richtextbuffer.h
index a91ea90363024cc8452826aea7451a2ccbd19a0a..23c9e298e35f6d4302e731319674ce1c0f3a2da1 100644 (file)
@@ -101,6 +101,7 @@ class WXDLLIMPEXP_RICHTEXT wxTextAttrEx;
 class WXDLLIMPEXP_RICHTEXT wxRichTextListStyleDefinition;
 class WXDLLIMPEXP_RICHTEXT wxRichTextEvent;
 class WXDLLIMPEXP_RICHTEXT wxRichTextRenderer;
+class WXDLLIMPEXP_RICHTEXT wxRichTextBuffer;
 
 /*!
  * Flags determining the available space, passed to Layout
@@ -115,6 +116,15 @@ class WXDLLIMPEXP_RICHTEXT wxRichTextRenderer;
 // the rect passed to Layout.
 #define wxRICHTEXT_LAYOUT_SPECIFIED_RECT 0x10
 
+/*!
+ * Flags to pass to Draw
+ */
+
+// Ignore paragraph cache optimization, e.g. for printing purposes
+// where one line may be drawn higher (on the next page) compared
+// with the previous line
+#define wxRICHTEXT_DRAW_IGNORE_CACHE    0x01
+
 /*!
  * Flags returned from hit-testing
  */
@@ -714,6 +724,9 @@ public:
     void SetDescent(int descent) { m_descent = descent; }
     int GetDescent() const { return m_descent; }
 
+    /// Gets the containing buffer
+    wxRichTextBuffer* GetBuffer() const;
+
 // Operations
 
     /// Clone the object
@@ -727,8 +740,9 @@ public:
     void Reference() { m_refCount ++; }
     void Dereference();
 
-    /// Convert units in tends of a millimetre to device units
-    static int ConvertTenthsMMToPixels(wxDC& dc, int units);
+    /// Convert units in tenths of a millimetre to device units
+    int ConvertTenthsMMToPixels(wxDC& dc, int units);
+    static int ConvertTenthsMMToPixels(int ppi, int units);
 
 protected:
     wxSize                  m_size;
@@ -1574,11 +1588,8 @@ public:
     /// Initialisation
     void Init();
 
-    /// Clears the buffer and resets the command processor
-    virtual void Clear();
-
-    /// The same as Clear, and adds an empty paragraph.
-    virtual void Reset();
+    /// Clears the buffer, adds an empty paragraph, and clears the command processor.
+    virtual void ResetAndClearCommands();
 
     /// Load a file
     virtual bool LoadFile(const wxString& filename, int type = wxRICHTEXT_TYPE_ANY);
@@ -1861,6 +1872,11 @@ public:
     /// Factor to multiply by character height to get a reasonable bullet size
     static float GetBulletProportion() { return sm_bulletProportion; }
     static void SetBulletProportion(float prop) { sm_bulletProportion = prop; }
+
+    /// Scale factor for calculating dimensions
+    double GetScale() const { return m_scale; }
+    void SetScale(double scale) { m_scale = scale; }
+
 protected:
 
     /// Command processor
@@ -1904,6 +1920,9 @@ protected:
 
     /// Factor to multiply by character height to get a reasonable bullet size
     static float            sm_bulletProportion;
+
+    /// Scaling factor in use: needed to calculate correct dimensions when printing
+    double                  m_scale;
 };
 
 /*!
@@ -2041,7 +2060,7 @@ class WXDLLIMPEXP_RICHTEXT wxRichTextFileHandler: public wxObject
     DECLARE_CLASS(wxRichTextFileHandler)
 public:
     wxRichTextFileHandler(const wxString& name = wxEmptyString, const wxString& ext = wxEmptyString, int type = 0)
-        : m_name(name), m_extension(ext), m_type(type), m_visible(true), m_flags(0)
+        : m_name(name), m_extension(ext), m_type(type), m_flags(0), m_visible(true)
         { }
 
 #if wxUSE_STREAMS