sip 6.8.0+: AttributeError: 'WrappedClass' object has no attribute 'original_typedef'

Scott Talbert swt at techie.net
Sat Dec 9 16:18:03 GMT 2023


On Sat, 9 Dec 2023, Phil Thompson wrote:

> On 09/12/2023 14:53, Scott Talbert wrote:
>> On Sat, 9 Dec 2023, Phil Thompson wrote:
>> 
>>> On 09/12/2023 02:36, Scott Talbert wrote:
>>>> On Fri, 8 Dec 2023, Phil Thompson wrote:
>>>> 
>>>> Next issue:
>>>> 
>>>> [786/940] Compiling sip/cap/sip_richtextwxTextAttrBorders.cpp
>>>> ../../../../sip/cpp/sip_richtextwxRichTextProperties.cpp: In function
>>>> ‘PyObject* meth_wxRichTextProperties_SetProperty(PyObject*, PyObject*,
>>>> PyObject*)’:
>>>> ../../../../sip/cpp/sip_richtextwxRichTextProperties.cpp:738:21:
>>>> error: invalid ‘const_cast’ from type ‘int’ to type ‘wchar_t*’
>>>>   738 |             sipFree(const_cast<wchar_t *>(1));
>>>>       |                     ^~~~~~~~~~~~~~~~~~~~~~~~
>>>> 
>>>> Waf: Leaving directory
>>>> `/home/talbert/wxPython/doxygen/Phoenix.sip680/build/waf/3.12/gtk3'
>>>> Build failed
>>>>  -> task in '_richtext' failed with exit status 1 (run with -v to
>>>> display more information)
>>>> 
>>>> The file is attached.  It looks like with sip 6.7, the inner argument
>>>> was 'value' not '1'.  Let me know if you need further details.
>>> 
>>> Now fixed in the repo.
>>> 
>>> See also...
>>> 
>>> https://www.riverbankcomputing.com/pipermail/pyqt/2023-October/045557.html
>>> 
>>> ...so you could identify all potential issues in one sweep rather than 
>>> finding them one at a time.
>> 
>> Thanks Phil.  Sorry for forgetting about that note.  I've attached a
>> diff of wxPython's cpp files (sip 6.7.12 vs 6.8.0+) after your latest
>> fixes. Of the differences, the only things that look concerning to me
>> are the changes in sip_advcmodule.cpp and sip_richtextcmodule.cpp.
>> 
>> Let me know if you need more details on those.
>
> Can you send me the .sip files that mention TimePickerCtrlNameStr and 
> RichTextLineBreakChar?
>
> The other (benign) issue is the duplicated #includes of some header files. 
> Can you send me the .sip file for ScrolledWindowBase?

Attached.

Thanks,
Scott
-------------- next part --------------
//---------------------------------------------------------------------------
// This file is generated by wxPython's SIP generator.  Do not edit by hand.
//
// Copyright: (c) 2020 by Total Control Software
// License:   wxWindows License
//
// This file will be included by _core.sip
//
//---------------------------------------------------------------------------

%ModuleHeaderCode
typedef wxScrolled<wxPanel> _ScrolledWindowBase;
%End


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

enum wxScrollbarVisibility
{
    wxSHOW_SB_NEVER,
    wxSHOW_SB_DEFAULT,
    wxSHOW_SB_ALWAYS
};

template<T>
class wxScrolled : T
{
    %Docstring
        Scrolled()
        Scrolled(parent, id=-1, pos=DefaultPosition, size=DefaultSize, style=HSCROLL|VSCROLL, name="scrolledWindow")
        
        The wxScrolled class manages scrolling for its client area,
        transforming the coordinates according to the scrollbar positions, and
        setting the scroll positions, thumb sizes and ranges according to the
        area in view.
    %End
    %TypeHeaderCode
        #include <wx/scrolwin.h>
    %End

public:
    wxScrolled();
    %PreMethodCode
        if (!wxPyCheckForApp()) return NULL;
    %End

    wxScrolled(
        wxWindow * parent   /TransferThis/,
        wxWindowID id = -1,
        const wxPoint & pos = wxDefaultPosition,
        const wxSize & size = wxDefaultSize,
        long style = wxHSCROLL|wxVSCROLL,
        const wxString & name = "scrolledWindow"
    );
    %PreMethodCode
        if (!wxPyCheckForApp()) return NULL;
    %End

    void CalcScrolledPosition(
        int x,
        int y,
        int * xx   /Out/,
        int * yy   /Out/
    ) const;
    %Docstring
        CalcScrolledPosition(x, y) -> (xx, yy)
        CalcScrolledPosition(pt) -> Point
        
        Translates the logical coordinates to the device ones.
    %End

    wxPoint CalcScrolledPosition(
        const wxPoint & pt
    ) const;

    void CalcUnscrolledPosition(
        int x,
        int y,
        int * xx   /Out/,
        int * yy   /Out/
    ) const;
    %Docstring
        CalcUnscrolledPosition(x, y) -> (xx, yy)
        CalcUnscrolledPosition(pt) -> Point
        
        Translates the device coordinates to the logical ones.
    %End

    wxPoint CalcUnscrolledPosition(
        const wxPoint & pt
    ) const;

    bool Create(
        wxWindow * parent   /TransferThis/,
        wxWindowID id = -1,
        const wxPoint & pos = wxDefaultPosition,
        const wxSize & size = wxDefaultSize,
        long style = wxHSCROLL|wxVSCROLL,
        const wxString & name = "scrolledWindow"
    );
    %Docstring
        Create(parent, id=-1, pos=DefaultPosition, size=DefaultSize, style=HSCROLL|VSCROLL, name="scrolledWindow") -> bool
        
        Creates the window for two-step construction.
    %End

    void DisableKeyboardScrolling();
    %Docstring
        DisableKeyboardScrolling()
        
        Disable use of keyboard keys for scrolling.
    %End

    void DoPrepareDC(
        wxDC & dc
    );
    %Docstring
        DoPrepareDC(dc)
        
        Call this function to prepare the device context for drawing a
        scrolled image.
    %End

    void EnableScrolling(
        bool xScrolling,
        bool yScrolling
    );
    %Docstring
        EnableScrolling(xScrolling, yScrolling)
        
        Enable or disable use of wxWindow::ScrollWindow() for scrolling.
    %End

    void ShowScrollbars(
        wxScrollbarVisibility horz,
        wxScrollbarVisibility vert
    );
    %Docstring
        ShowScrollbars(horz, vert)
        
        Set the scrollbar visibility.
    %End

    void GetScrollPixelsPerUnit(
        int * xUnit   /Out/,
        int * yUnit   /Out/
    ) const;
    %Docstring
        GetScrollPixelsPerUnit() -> (xUnit, yUnit)
        
        Get the number of pixels per scroll unit (line), in each direction, as
        set by SetScrollbars().
    %End

    void GetViewStart(
        int * x   /Out/,
        int * y   /Out/
    ) const;
    %Docstring
        GetViewStart() -> (x, y)
        
        Get the position at which the visible portion of the window starts.
    %End

    bool IsRetained() const;
    %Docstring
        IsRetained() -> bool
        
        Motif only: true if the window has a backing bitmap.
    %End

    virtual
    void OnDraw(
        wxDC & dc
    );
    %Docstring
        OnDraw(dc)
        
        Called by the default paint event handler to allow the application to
        define painting behaviour without having to worry about calling
        DoPrepareDC().
    %End

    void PrepareDC(
        wxDC & dc
    );
    %Docstring
        PrepareDC(dc)
        
        This function is for backwards compatibility only and simply calls
        DoPrepareDC() now.
    %End

    void Scroll(
        int x,
        int y
    );
    %Docstring
        Scroll(x, y)
        Scroll(pt)
        
        Scrolls a window so the view start is at the given point.
    %End

    void Scroll(
        const wxPoint & pt
    );

    void SetScrollRate(
        int xstep,
        int ystep
    );
    %Docstring
        SetScrollRate(xstep, ystep)
        
        Set the horizontal and vertical scrolling increment only.
    %End

    void SetScrollbars(
        int pixelsPerUnitX,
        int pixelsPerUnitY,
        int noUnitsX,
        int noUnitsY,
        int xPos = 0,
        int yPos = 0,
        bool noRefresh = false
    );
    %Docstring
        SetScrollbars(pixelsPerUnitX, pixelsPerUnitY, noUnitsX, noUnitsY, xPos=0, yPos=0, noRefresh=False)
        
        Sets up vertical and/or horizontal scrollbars.
    %End

    void SetTargetWindow(
        wxWindow * window
    );
    %Docstring
        SetTargetWindow(window)
        
        Call this function to tell wxScrolled to perform the actual scrolling
        on a different window (and not on itself).
    %End

    wxWindow * GetTargetWindow() const;
    %Docstring
        GetTargetWindow() -> Window
    %End

    void SetTargetRect(
        const wxRect & rect
    );
    %Docstring
        SetTargetRect(rect)
    %End

    wxRect GetTargetRect() const;
    %Docstring
        GetTargetRect() -> Rect
    %End

    int GetScrollPageSize(
        int orient
    ) const;
    %Docstring
        GetScrollPageSize(orient) -> int
    %End

    void SetScrollPageSize(
        int orient,
        int pageSize
    );
    %Docstring
        SetScrollPageSize(orient, pageSize)
    %End

    int GetScrollLines(
        int orient
    ) const;
    %Docstring
        GetScrollLines(orient) -> int
    %End

    void SetScale(
        double xs,
        double ys
    );
    %Docstring
        SetScale(xs, ys)
    %End

    double GetScaleX() const;
    %Docstring
        GetScaleX() -> double
    %End

    double GetScaleY() const;
    %Docstring
        GetScaleY() -> double
    %End

    void AdjustScrollbars();
    %Docstring
        AdjustScrollbars()
    %End

    bool IsAutoScrolling() const;
    %Docstring
        IsAutoScrolling() -> bool
        
        Are we generating the autoscroll events?
    %End

    void StopAutoScrolling();
    %Docstring
        StopAutoScrolling()
        
        Stop generating the scroll events when mouse is held outside the
        window.
    %End

    virtual
    bool SendAutoScrollEvents(
        wxScrollWinEvent & event
    ) const;
    %Docstring
        SendAutoScrollEvents(event) -> bool
        
        This method can be overridden in a derived class to forbid sending the
        auto scroll events - note that unlike StopAutoScrolling() it doesn't
        stop the timer, so it will be called repeatedly and will typically
        return different values depending on the current mouse position.
    %End

    private:
        wxScrolled(const wxScrolled&);


    private:
        wxScrolled& operator=(const wxScrolled&);


    public:
    virtual wxPoint GetClientAreaOrigin() const;
    virtual bool Validate();
    virtual bool TransferDataToWindow();
    virtual bool TransferDataFromWindow();
    virtual void InitDialog();
    virtual bool AcceptsFocus() const;
    virtual bool AcceptsFocusRecursively() const;
    virtual bool AcceptsFocusFromKeyboard() const;
    virtual void AddChild( wxWindowBase *child );
    virtual void RemoveChild( wxWindowBase *child );
    virtual void InheritAttributes();
    virtual bool ShouldInheritColours() const;
    virtual void OnInternalIdle();
    virtual wxWindow *GetMainWindowOfCompositeControl();
    virtual bool InformFirstDirection(int direction, int size, int availableOtherDir);
    virtual void SetCanFocus(bool canFocus);
    virtual bool Destroy();
    virtual void SetValidator( const wxValidator &validator );
    virtual wxValidator* GetValidator();
    virtual void EnableVisibleFocus(bool enabled);


    protected:
    virtual bool ProcessEvent(wxEvent & event);
    virtual void DoEnable(bool enable);
    virtual void DoGetPosition(int *x, int *y) const;
    virtual void DoGetSize(int *width, int *height) const;
    virtual void DoGetClientSize(int *width, int *height) const;
    virtual wxSize DoGetBestSize() const;
    virtual wxSize DoGetBestClientSize() const;
    virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
    virtual void DoSetClientSize(int width, int height);
    virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH );
    virtual void DoMoveWindow(int x, int y, int width, int height);
    virtual void DoSetWindowVariant( wxWindowVariant variant);
    virtual wxBorder GetDefaultBorder() const;
    virtual wxBorder GetDefaultBorderForControl() const;
    virtual void DoFreeze();
    virtual void DoThaw();
    virtual bool HasTransparentBackground();
    virtual bool TryBefore(wxEvent& event);
    virtual bool TryAfter(wxEvent& event);


    public:


    static
    wxVisualAttributes GetClassDefaultAttributes(
        wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL
    );
    %Docstring
        GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
    %End
    %PreMethodCode
        if (!wxPyCheckForApp()) return NULL;
    %End

    public:


    %Property(name=ScaleX, get=GetScaleX)
    %Property(name=ScaleY, get=GetScaleY)
    %Property(name=TargetRect, get=GetTargetRect, set=SetTargetRect)
    %Property(name=TargetWindow, get=GetTargetWindow, set=SetTargetWindow)

protected:
    virtual
    bool ShouldScrollToChildOnFocus(
        wxWindow * child
    );
    %Docstring
        ShouldScrollToChildOnFocus(child) -> bool
        
        This method can be overridden in a derived class to prevent scrolling
        the child window into view automatically when it gets focus.
    %End

    virtual
    wxSize GetSizeAvailableForScrollTarget(
        const wxSize & size
    );
    %Docstring
        GetSizeAvailableForScrollTarget(size) -> Size
        
        Function which must be overridden to implement the size available for
        the scroll target for the given size of the main window.
    %End

};  // end of class wxScrolled


typedef wxScrolled<wxWindow > wxScrolledCanvas;

typedef wxScrolled<wxPanel> _ScrolledWindowBase   /NoTypeName/;

class wxScrolledWindow : _ScrolledWindowBase
{
    %Docstring
        ScrolledWindow()
        ScrolledWindow(parent, id=ID_ANY, pos=DefaultPosition, size=DefaultSize, style=ScrolledWindowStyle, name=PanelNameStr)
        
        Scrolled window derived from wxPanel.
    %End
public:
    wxScrolledWindow();
    %PreMethodCode
        if (!wxPyCheckForApp()) return NULL;
    %End

    wxScrolledWindow(
        wxWindow* parent   /TransferThis/,
        wxWindowID id = wxID_ANY,
        const wxPoint& pos = wxDefaultPosition,
        const wxSize& size = wxDefaultSize,
        long style = wxScrolledWindowStyle,
        const wxString& name = wxPanelNameStr
    );
    %PreMethodCode
        if (!wxPyCheckForApp()) return NULL;
    %End

    void SetFocusIgnoringChildren();
    %Docstring
        SetFocusIgnoringChildren()
        
        In contrast to SetFocus() this will set the focus to the panel even if
        there are child windows in the panel. This is only rarely needed.
    %End

    public:
    virtual wxPoint GetClientAreaOrigin() const;
    virtual bool Validate();
    virtual bool TransferDataToWindow();
    virtual bool TransferDataFromWindow();
    virtual void InitDialog();
    virtual bool AcceptsFocus() const;
    virtual bool AcceptsFocusRecursively() const;
    virtual bool AcceptsFocusFromKeyboard() const;
    virtual void AddChild( wxWindowBase *child );
    virtual void RemoveChild( wxWindowBase *child );
    virtual void InheritAttributes();
    virtual bool ShouldInheritColours() const;
    virtual void OnInternalIdle();
    virtual wxWindow *GetMainWindowOfCompositeControl();
    virtual bool InformFirstDirection(int direction, int size, int availableOtherDir);
    virtual void SetCanFocus(bool canFocus);
    virtual bool Destroy();
    virtual void SetValidator( const wxValidator &validator );
    virtual wxValidator* GetValidator();
    virtual void EnableVisibleFocus(bool enabled);


    protected:
    virtual bool ProcessEvent(wxEvent & event);
    virtual void DoEnable(bool enable);
    virtual void DoGetPosition(int *x, int *y) const;
    virtual void DoGetSize(int *width, int *height) const;
    virtual void DoGetClientSize(int *width, int *height) const;
    virtual wxSize DoGetBestSize() const;
    virtual wxSize DoGetBestClientSize() const;
    virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
    virtual void DoSetClientSize(int width, int height);
    virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH );
    virtual void DoMoveWindow(int x, int y, int width, int height);
    virtual void DoSetWindowVariant( wxWindowVariant variant);
    virtual wxBorder GetDefaultBorder() const;
    virtual wxBorder GetDefaultBorderForControl() const;
    virtual void DoFreeze();
    virtual void DoThaw();
    virtual bool HasTransparentBackground();
    virtual bool TryBefore(wxEvent& event);
    virtual bool TryAfter(wxEvent& event);


    public:


    static
    wxVisualAttributes GetClassDefaultAttributes(
        wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL
    );
    %Docstring
        GetClassDefaultAttributes(variant=WINDOW_VARIANT_NORMAL) -> VisualAttributes
    %End
    %PreMethodCode
        if (!wxPyCheckForApp()) return NULL;
    %End

};  // end of class wxScrolledWindow


%Extract(id=pycode_core)
PyScrolledWindow = wx.deprecated(ScrolledWindow, 'Use ScrolledWindow instead.')

%End


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

-------------- next part --------------
//---------------------------------------------------------------------------
// This file is generated by wxPython's SIP generator.  Do not edit by hand.
//
// Copyright: (c) 2020 by Total Control Software
// License:   wxWindows License
//
// This file will be included by _adv.sip
//
//---------------------------------------------------------------------------

%ModuleHeaderCode
#include <wx/timectrl.h>
%End


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

enum 
{
    wxTP_DEFAULT
};

const wchar_t* wxTimePickerCtrlNameStr;

class wxTimePickerCtrl : wxControl
{
    %Docstring
        TimePickerCtrl()
        TimePickerCtrl(parent, id=wx.ID_ANY, dt=wx.DefaultDateTime, pos=wx.DefaultPosition, size=wx.DefaultSize, style=TP_DEFAULT, validator=wx.DefaultValidator, name=TimePickerCtrlNameStr)
        
        This control allows the user to enter time.
    %End
    %TypeHeaderCode
        #include <wx/timectrl.h>
    %End

public:
    wxTimePickerCtrl();
    %PreMethodCode
        if (!wxPyCheckForApp()) return NULL;
    %End

    wxTimePickerCtrl(
        wxWindow * parent   /TransferThis/,
        wxWindowID id = wxID_ANY,
        const wxDateTime & dt = wxDefaultDateTime,
        const wxPoint & pos = wxDefaultPosition,
        const wxSize & size = wxDefaultSize,
        long style = wxTP_DEFAULT,
        const wxValidator & validator = wxDefaultValidator,
        const wxString & name = wxTimePickerCtrlNameStr
    );
    %PreMethodCode
        if (!wxPyCheckForApp()) return NULL;
    %End

    bool Create(
        wxWindow * parent   /TransferThis/,
        wxWindowID id = wxID_ANY,
        const wxDateTime & dt = wxDefaultDateTime,
        const wxPoint & pos = wxDefaultPosition,
        const wxSize & size = wxDefaultSize,
        long style = wxTP_DEFAULT,
        const wxValidator & validator = wxDefaultValidator,
        const wxString & name = wxTimePickerCtrlNameStr
    );
    %Docstring
        Create(parent, id=wx.ID_ANY, dt=wx.DefaultDateTime, pos=wx.DefaultPosition, size=wx.DefaultSize, style=TP_DEFAULT, validator=wx.DefaultValidator, name=TimePickerCtrlNameStr) -> bool
        
        Create the control window.
    %End

    void GetTime(
        int * hour   /Out/,
        int * min   /Out/,
        int * sec   /Out/
    ) const;
    %Docstring
        GetTime() -> (hour, min, sec)
        
        Returns the currently entered time as hours, minutes and seconds.
    %End

    wxDateTime GetValue() const;
    %Docstring
        GetValue() -> wx.DateTime
        
        Returns the currently entered time.
    %End

    bool SetTime(
        int hour,
        int min,
        int sec
    );
    %Docstring
        SetTime(hour, min, sec) -> bool
        
        Changes the current time of the control.
    %End

    void SetValue(
        const wxDateTime & dt
    );
    %Docstring
        SetValue(dt)
        
        Changes the current value of the control.
    %End

    public:
    virtual wxPoint GetClientAreaOrigin() const;
    virtual bool Validate();
    virtual bool TransferDataToWindow();
    virtual bool TransferDataFromWindow();
    virtual void InitDialog();
    virtual bool AcceptsFocus() const;
    virtual bool AcceptsFocusRecursively() const;
    virtual bool AcceptsFocusFromKeyboard() const;
    virtual void AddChild( wxWindowBase *child );
    virtual void RemoveChild( wxWindowBase *child );
    virtual void InheritAttributes();
    virtual bool ShouldInheritColours() const;
    virtual void OnInternalIdle();
    virtual wxWindow *GetMainWindowOfCompositeControl();
    virtual bool InformFirstDirection(int direction, int size, int availableOtherDir);
    virtual void SetCanFocus(bool canFocus);
    virtual bool Destroy();
    virtual void SetValidator( const wxValidator &validator );
    virtual wxValidator* GetValidator();
    virtual void EnableVisibleFocus(bool enabled);


    protected:
    virtual bool ProcessEvent(wxEvent & event);
    virtual void DoEnable(bool enable);
    virtual void DoGetPosition(int *x, int *y) const;
    virtual void DoGetSize(int *width, int *height) const;
    virtual void DoGetClientSize(int *width, int *height) const;
    virtual wxSize DoGetBestSize() const;
    virtual wxSize DoGetBestClientSize() const;
    virtual void DoSetSize(int x, int y, int width, int height, int sizeFlags);
    virtual void DoSetClientSize(int width, int height);
    virtual void DoSetSizeHints( int minW, int minH, int maxW, int maxH, int incW, int incH );
    virtual void DoMoveWindow(int x, int y, int width, int height);
    virtual void DoSetWindowVariant( wxWindowVariant variant);
    virtual wxBorder GetDefaultBorder() const;
    virtual wxBorder GetDefaultBorderForControl() const;
    virtual void DoFreeze();
    virtual void DoThaw();
    virtual bool HasTransparentBackground();
    virtual bool TryBefore(wxEvent& event);
    virtual bool TryAfter(wxEvent& event);


    public:


    static
    wxVisualAttributes GetClassDefaultAttributes(
        wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL
    );
    %Docstring
        GetClassDefaultAttributes(variant=wx.WINDOW_VARIANT_NORMAL) -> wx.VisualAttributes
    %End
    %PreMethodCode
        if (!wxPyCheckForApp()) return NULL;
    %End

    public:


    %Property(name=Value, get=GetValue, set=SetValue)
};  // end of class wxTimePickerCtrl



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

-------------- next part --------------
//---------------------------------------------------------------------------
// This file is generated by wxPython's SIP generator.  Do not edit by hand.
//
// Copyright: (c) 2020 by Total Control Software
// License:   wxWindows License
//
// This file will be included by _richtext.sip
//
//---------------------------------------------------------------------------

%ModuleHeaderCode
#include <wx/richtext/richtextbuffer.h>
%End


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

        // forward declarations
        class wxRichTextFloatCollector;


const int wxRICHTEXT_FIXED_WIDTH;
const int wxRICHTEXT_FIXED_HEIGHT;
const int wxRICHTEXT_VARIABLE_WIDTH;
const int wxRICHTEXT_VARIABLE_HEIGHT;
const int wxRICHTEXT_LAYOUT_SPECIFIED_RECT;
const int wxRICHTEXT_DRAW_IGNORE_CACHE;
const int wxRICHTEXT_DRAW_SELECTED;
const int wxRICHTEXT_DRAW_PRINT;
const int wxRICHTEXT_DRAW_GUIDELINES;
const int wxRICHTEXT_FORMATTED;
const int wxRICHTEXT_UNFORMATTED;
const int wxRICHTEXT_CACHE_SIZE;
const int wxRICHTEXT_HEIGHT_ONLY;
const int wxRICHTEXT_SETSTYLE_NONE;
const int wxRICHTEXT_SETSTYLE_WITH_UNDO;
const int wxRICHTEXT_SETSTYLE_OPTIMIZE;
const int wxRICHTEXT_SETSTYLE_PARAGRAPHS_ONLY;
const int wxRICHTEXT_SETSTYLE_CHARACTERS_ONLY;
const int wxRICHTEXT_SETSTYLE_RENUMBER;
const int wxRICHTEXT_SETSTYLE_SPECIFY_LEVEL;
const int wxRICHTEXT_SETSTYLE_RESET;
const int wxRICHTEXT_SETSTYLE_REMOVE;
const int wxRICHTEXT_SETPROPERTIES_NONE;
const int wxRICHTEXT_SETPROPERTIES_WITH_UNDO;
const int wxRICHTEXT_SETPROPERTIES_PARAGRAPHS_ONLY;
const int wxRICHTEXT_SETPROPERTIES_CHARACTERS_ONLY;
const int wxRICHTEXT_SETPROPERTIES_RESET;
const int wxRICHTEXT_SETPROPERTIES_REMOVE;
const int wxRICHTEXT_INSERT_NONE;
const int wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE;
const int wxRICHTEXT_INSERT_INTERACTIVE;
const int wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE;
const float wxSCRIPT_MUL_FACTOR;
const int wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET;
const int wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY;
const int wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES;
const int wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64;
const int wxRICHTEXT_HANDLER_NO_HEADER_FOOTER;
const int wxRICHTEXT_HANDLER_CONVERT_FACENAMES;
const int wxRICHTEXT_HANDLER_USE_CSS;
enum wxRichTextFileType
{
    wxRICHTEXT_TYPE_ANY,
    wxRICHTEXT_TYPE_TEXT,
    wxRICHTEXT_TYPE_XML,
    wxRICHTEXT_TYPE_HTML,
    wxRICHTEXT_TYPE_RTF,
    wxRICHTEXT_TYPE_PDF
};

enum wxRichTextHitTestFlags
{
    wxRICHTEXT_HITTEST_NONE,
    wxRICHTEXT_HITTEST_BEFORE,
    wxRICHTEXT_HITTEST_AFTER,
    wxRICHTEXT_HITTEST_ON,
    wxRICHTEXT_HITTEST_OUTSIDE,
    wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS,
    wxRICHTEXT_HITTEST_NO_FLOATING_OBJECTS,
    wxRICHTEXT_HITTEST_HONOUR_ATOMIC
};

enum wxTextBoxAttrFlags
{
    wxTEXT_BOX_ATTR_FLOAT,
    wxTEXT_BOX_ATTR_CLEAR,
    wxTEXT_BOX_ATTR_COLLAPSE_BORDERS,
    wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT,
    wxTEXT_BOX_ATTR_BOX_STYLE_NAME,
    wxTEXT_BOX_ATTR_WHITESPACE,
    wxTEXT_BOX_ATTR_CORNER_RADIUS
};

enum wxTextAttrValueFlags
{
    wxTEXT_ATTR_VALUE_VALID,
    wxTEXT_ATTR_VALUE_VALID_MASK
};

enum wxTextAttrUnits
{
    wxTEXT_ATTR_UNITS_TENTHS_MM,
    wxTEXT_ATTR_UNITS_PIXELS,
    wxTEXT_ATTR_UNITS_PERCENTAGE,
    wxTEXT_ATTR_UNITS_POINTS,
    wxTEXT_ATTR_UNITS_HUNDREDTHS_POINT,
    wxTEXT_ATTR_UNITS_MASK
};

enum wxTextBoxAttrPosition
{
    wxTEXT_BOX_ATTR_POSITION_STATIC,
    wxTEXT_BOX_ATTR_POSITION_RELATIVE,
    wxTEXT_BOX_ATTR_POSITION_ABSOLUTE,
    wxTEXT_BOX_ATTR_POSITION_FIXED,
    wxTEXT_BOX_ATTR_POSITION_MASK
};

enum wxTextAttrBorderStyle
{
    wxTEXT_BOX_ATTR_BORDER_NONE,
    wxTEXT_BOX_ATTR_BORDER_SOLID,
    wxTEXT_BOX_ATTR_BORDER_DOTTED,
    wxTEXT_BOX_ATTR_BORDER_DASHED,
    wxTEXT_BOX_ATTR_BORDER_DOUBLE,
    wxTEXT_BOX_ATTR_BORDER_GROOVE,
    wxTEXT_BOX_ATTR_BORDER_RIDGE,
    wxTEXT_BOX_ATTR_BORDER_INSET,
    wxTEXT_BOX_ATTR_BORDER_OUTSET
};

enum wxTextAttrBorderFlags
{
    wxTEXT_BOX_ATTR_BORDER_STYLE,
    wxTEXT_BOX_ATTR_BORDER_COLOUR
};

enum wxTextAttrBorderWidth
{
    wxTEXT_BOX_ATTR_BORDER_THIN,
    wxTEXT_BOX_ATTR_BORDER_MEDIUM,
    wxTEXT_BOX_ATTR_BORDER_THICK
};

enum wxTextBoxAttrFloatStyle
{
    wxTEXT_BOX_ATTR_FLOAT_NONE,
    wxTEXT_BOX_ATTR_FLOAT_LEFT,
    wxTEXT_BOX_ATTR_FLOAT_RIGHT
};

enum wxTextBoxAttrClearStyle
{
    wxTEXT_BOX_ATTR_CLEAR_NONE,
    wxTEXT_BOX_ATTR_CLEAR_LEFT,
    wxTEXT_BOX_ATTR_CLEAR_RIGHT,
    wxTEXT_BOX_ATTR_CLEAR_BOTH
};

enum wxTextBoxAttrCollapseMode
{
    wxTEXT_BOX_ATTR_COLLAPSE_NONE,
    wxTEXT_BOX_ATTR_COLLAPSE_FULL
};

enum wxTextBoxAttrVerticalAlignment
{
    wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_NONE,
    wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_TOP,
    wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_CENTRE,
    wxTEXT_BOX_ATTR_VERTICAL_ALIGNMENT_BOTTOM
};

enum wxTextBoxAttrWhitespaceMode
{
    wxTEXT_BOX_ATTR_WHITESPACE_NONE,
    wxTEXT_BOX_ATTR_WHITESPACE_NORMAL,
    wxTEXT_BOX_ATTR_WHITESPACE_NO_WRAP,
    wxTEXT_BOX_ATTR_WHITESPACE_PREFORMATTED,
    wxTEXT_BOX_ATTR_WHITESPACE_PREFORMATTED_LINE,
    wxTEXT_BOX_ATTR_WHITESPACE_PREFORMATTED_WRAP
};

enum wxRichTextCommandId
{
    wxRICHTEXT_INSERT,
    wxRICHTEXT_DELETE,
    wxRICHTEXT_CHANGE_ATTRIBUTES,
    wxRICHTEXT_CHANGE_STYLE,
    wxRICHTEXT_CHANGE_OBJECT
};

typedef unsigned short wxTextAttrDimensionFlags;

const wxChar wxRichTextLineBreakChar;

class wxTextAttrDimension
{
    %Docstring
        TextAttrDimension()
        TextAttrDimension(value, units=TEXT_ATTR_UNITS_TENTHS_MM)
        
        A class representing a rich text dimension, including units and
        position.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxTextAttrDimension();

    wxTextAttrDimension(
        int value,
        wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM
    );

    int m_value;

    wxTextAttrDimensionFlags m_flags;

    void Reset();
    %Docstring
        Reset()
        
        Resets the dimension value and flags.
    %End

    bool EqPartial(
        const wxTextAttrDimension & dim,
        bool weakTest = true
    ) const;
    %Docstring
        EqPartial(dim, weakTest=True) -> bool
        
        Partial equality test.
    %End

    bool Apply(
        const wxTextAttrDimension & dim,
        const wxTextAttrDimension * compareWith = NULL
    );
    %Docstring
        Apply(dim, compareWith=None) -> bool
        
        Apply the dimension, but not those identical to compareWith if
        present.
    %End

    void CollectCommonAttributes(
        const wxTextAttrDimension & attr,
        wxTextAttrDimension & clashingAttr,
        wxTextAttrDimension & absentAttr
    );
    %Docstring
        CollectCommonAttributes(attr, clashingAttr, absentAttr)
        
        Collects the attributes that are common to a range of content,
        building up a note of which attributes are absent in some objects and
        which clash in some objects.
    %End

    bool operator==(
        const wxTextAttrDimension & dim
    ) const;

    int GetValue() const;
    %Docstring
        GetValue() -> int
        
        Returns the integer value of the dimension.
    %End

    float GetValueMM() const;
    %Docstring
        GetValueMM() -> float
        
        Returns the floating-pointing value of the dimension in mm.
    %End

    void SetValueMM(
        float value
    );
    %Docstring
        SetValueMM(value)
        
        Sets the value of the dimension in mm.
    %End

    void SetValue(
        int value
    );
    %Docstring
        SetValue(value)
        SetValue(value, flags)
        SetValue(dim)
        
        Sets the integer value of the dimension.
    %End

    void SetValue(
        int value,
        wxTextAttrDimensionFlags flags
    );

    void SetValue(
        const wxTextAttrDimension & dim
    );

    wxTextAttrUnits GetUnits() const;
    %Docstring
        GetUnits() -> TextAttrUnits
        
        Gets the units of the dimension.
    %End

    void SetUnits(
        wxTextAttrUnits units
    );
    %Docstring
        SetUnits(units)
        
        Sets the units of the dimension.
    %End

    wxTextBoxAttrPosition GetPosition() const;
    %Docstring
        GetPosition() -> TextBoxAttrPosition
        
        Gets the position flags.
    %End

    void SetPosition(
        wxTextBoxAttrPosition pos
    );
    %Docstring
        SetPosition(pos)
        
        Sets the position flags.
    %End

    bool IsValid() const;
    %Docstring
        IsValid() -> bool
        
        Returns true if the dimension is valid.
    %End

    void SetValid(
        bool b
    );
    %Docstring
        SetValid(b)
        
        Sets the valid flag.
    %End

    wxTextAttrDimensionFlags GetFlags() const;
    %Docstring
        GetFlags() -> TextAttrDimensionFlags
        
        Gets the dimension flags.
    %End

    void SetFlags(
        wxTextAttrDimensionFlags flags
    );
    %Docstring
        SetFlags(flags)
        
        Sets the dimension flags.
    %End

    int __nonzero__();
    %Docstring
        __nonzero__() -> int
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxTextAttrDimension___nonzero__(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    int _wxTextAttrDimension___nonzero__(wxTextAttrDimension* self)
    {
        return self->IsValid();
    }
    %End

    int __bool__();
    %Docstring
        __bool__() -> int
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxTextAttrDimension___bool__(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    int _wxTextAttrDimension___bool__(wxTextAttrDimension* self)
    {
        return self->IsValid();
    }
    %End

    public:


    %Property(name=Flags, get=GetFlags, set=SetFlags)
    %Property(name=Position, get=GetPosition, set=SetPosition)
    %Property(name=Units, get=GetUnits, set=SetUnits)
    %Property(name=Value, get=GetValue, set=SetValue)
    %Property(name=ValueMM, get=GetValueMM, set=SetValueMM)
};  // end of class wxTextAttrDimension


class wxTextAttrDimensions
{
    %Docstring
        TextAttrDimensions()
        
        A class for left, right, top and bottom dimensions.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxTextAttrDimensions();

    wxTextAttrDimension m_left;

    wxTextAttrDimension m_top;

    wxTextAttrDimension m_right;

    wxTextAttrDimension m_bottom;

    void Reset();
    %Docstring
        Reset()
        
        Resets the value and flags for all dimensions.
    %End

    bool operator==(
        const wxTextAttrDimensions & dims
    ) const;

    bool EqPartial(
        const wxTextAttrDimensions & dims,
        bool weakTest = true
    ) const;
    %Docstring
        EqPartial(dims, weakTest=True) -> bool
        
        Partial equality test.
    %End

    bool Apply(
        const wxTextAttrDimensions & dims,
        const wxTextAttrDimensions * compareWith = NULL
    );
    %Docstring
        Apply(dims, compareWith=None) -> bool
        
        Apply to 'this', but not if the same as compareWith.
    %End

    void CollectCommonAttributes(
        const wxTextAttrDimensions & attr,
        wxTextAttrDimensions & clashingAttr,
        wxTextAttrDimensions & absentAttr
    );
    %Docstring
        CollectCommonAttributes(attr, clashingAttr, absentAttr)
        
        Collects the attributes that are common to a range of content,
        building up a note of which attributes are absent in some objects and
        which clash in some objects.
    %End

    bool RemoveStyle(
        const wxTextAttrDimensions & attr
    );
    %Docstring
        RemoveStyle(attr) -> bool
        
        Remove specified attributes from this object.
    %End

    wxTextAttrDimension & GetLeft();
    %Docstring
        GetLeft() -> TextAttrDimension
    %End

    wxTextAttrDimension & GetRight();
    %Docstring
        GetRight() -> TextAttrDimension
    %End

    wxTextAttrDimension & GetTop();
    %Docstring
        GetTop() -> TextAttrDimension
    %End

    wxTextAttrDimension & GetBottom();
    %Docstring
        GetBottom() -> TextAttrDimension
    %End

    bool IsValid() const;
    %Docstring
        IsValid() -> bool
        
        Are all dimensions valid?
    %End

    int __nonzero__();
    %Docstring
        __nonzero__() -> int
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxTextAttrDimensions___nonzero__(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    int _wxTextAttrDimensions___nonzero__(wxTextAttrDimensions* self)
    {
        return self->IsValid();
    }
    %End

    int __bool__();
    %Docstring
        __bool__() -> int
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxTextAttrDimensions___bool__(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    int _wxTextAttrDimensions___bool__(wxTextAttrDimensions* self)
    {
        return self->IsValid();
    }
    %End

    public:


    %Property(name=Bottom, get=GetBottom)
    %Property(name=Left, get=GetLeft)
    %Property(name=Right, get=GetRight)
    %Property(name=Top, get=GetTop)
};  // end of class wxTextAttrDimensions


class wxTextAttrSize
{
    %Docstring
        TextAttrSize()
        
        A class for representing width and height.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxTextAttrSize();

    wxTextAttrDimension m_width;

    wxTextAttrDimension m_height;

    void Reset();
    %Docstring
        Reset()
        
        Resets the width and height dimensions.
    %End

    bool operator==(
        const wxTextAttrSize & size
    ) const;

    bool EqPartial(
        const wxTextAttrSize & size,
        bool weakTest = true
    ) const;
    %Docstring
        EqPartial(size, weakTest=True) -> bool
        
        Partial equality test.
    %End

    bool Apply(
        const wxTextAttrSize & dims,
        const wxTextAttrSize * compareWith = NULL
    );
    %Docstring
        Apply(dims, compareWith=None) -> bool
        
        Apply to this object, but not if the same as compareWith.
    %End

    void CollectCommonAttributes(
        const wxTextAttrSize & attr,
        wxTextAttrSize & clashingAttr,
        wxTextAttrSize & absentAttr
    );
    %Docstring
        CollectCommonAttributes(attr, clashingAttr, absentAttr)
        
        Collects the attributes that are common to a range of content,
        building up a note of which attributes are absent in some objects and
        which clash in some objects.
    %End

    bool RemoveStyle(
        const wxTextAttrSize & attr
    );
    %Docstring
        RemoveStyle(attr) -> bool
        
        Removes the specified attributes from this object.
    %End

    wxTextAttrDimension & GetWidth();
    %Docstring
        GetWidth() -> TextAttrDimension
        
        Returns the width.
    %End

    void SetWidth(
        int value,
        wxTextAttrDimensionFlags flags
    );
    %Docstring
        SetWidth(value, flags)
        SetWidth(dim)
        
        Sets the width.
    %End

    void SetWidth(
        const wxTextAttrDimension & dim
    );

    wxTextAttrDimension & GetHeight();
    %Docstring
        GetHeight() -> TextAttrDimension
        
        Gets the height.
    %End

    void SetHeight(
        int value,
        wxTextAttrDimensionFlags flags
    );
    %Docstring
        SetHeight(value, flags)
        SetHeight(dim)
        
        Sets the height.
    %End

    void SetHeight(
        const wxTextAttrDimension & dim
    );

    bool IsValid() const;
    %Docstring
        IsValid() -> bool
        
        Is the size valid?
    %End

    int __nonzero__();
    %Docstring
        __nonzero__() -> int
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxTextAttrSize___nonzero__(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    int _wxTextAttrSize___nonzero__(wxTextAttrSize* self)
    {
        return self->IsValid();
    }
    %End

    int __bool__();
    %Docstring
        __bool__() -> int
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxTextAttrSize___bool__(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    int _wxTextAttrSize___bool__(wxTextAttrSize* self)
    {
        return self->IsValid();
    }
    %End

    public:


    %Property(name=Height, get=GetHeight, set=SetHeight)
    %Property(name=Width, get=GetWidth, set=SetWidth)
};  // end of class wxTextAttrSize


class wxTextAttrDimensionConverter
{
    %Docstring
        TextAttrDimensionConverter(dc, scale=1.0, parentSize=wx.DefaultSize)
        TextAttrDimensionConverter(ppi, scale=1.0, parentSize=wx.DefaultSize)
        
        A class to make it easier to convert dimensions.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxTextAttrDimensionConverter(
        wxDC & dc,
        double scale = 1.0,
        const wxSize & parentSize = wxDefaultSize
    );

    wxTextAttrDimensionConverter(
        int ppi,
        double scale = 1.0,
        const wxSize & parentSize = wxDefaultSize
    );

    int m_ppi;

    double m_scale;

    wxSize m_parentSize;

    int GetPixels(
        const wxTextAttrDimension & dim,
        int direction = wxHORIZONTAL
    ) const;
    %Docstring
        GetPixels(dim, direction=wx.HORIZONTAL) -> int
        
        Gets the pixel size for the given dimension.
    %End

    int GetTenthsMM(
        const wxTextAttrDimension & dim
    ) const;
    %Docstring
        GetTenthsMM(dim) -> int
        
        Gets the mm size for the given dimension.
    %End

    int ConvertTenthsMMToPixels(
        int units
    ) const;
    %Docstring
        ConvertTenthsMMToPixels(units) -> int
        
        Converts tenths of a mm to pixels.
    %End

    int ConvertPixelsToTenthsMM(
        int pixels
    ) const;
    %Docstring
        ConvertPixelsToTenthsMM(pixels) -> int
        
        Converts pixels to tenths of a mm.
    %End

};  // end of class wxTextAttrDimensionConverter


class wxTextAttrBorder
{
    %Docstring
        TextAttrBorder()
        
        A class representing a rich text object border.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxTextAttrBorder();

    int m_borderStyle;

    unsigned long m_borderColour;

    wxTextAttrDimension m_borderWidth;

    int m_flags;

    bool operator==(
        const wxTextAttrBorder & border
    ) const;

    void Reset();
    %Docstring
        Reset()
        
        Resets the border style, colour, width and flags.
    %End

    bool EqPartial(
        const wxTextAttrBorder & border,
        bool weakTest = true
    ) const;
    %Docstring
        EqPartial(border, weakTest=True) -> bool
        
        Partial equality test.
    %End

    bool Apply(
        const wxTextAttrBorder & border,
        const wxTextAttrBorder * compareWith = NULL
    );
    %Docstring
        Apply(border, compareWith=None) -> bool
        
        Applies the border to this object, but not if the same as compareWith.
    %End

    bool RemoveStyle(
        const wxTextAttrBorder & attr
    );
    %Docstring
        RemoveStyle(attr) -> bool
        
        Removes the specified attributes from this object.
    %End

    void CollectCommonAttributes(
        const wxTextAttrBorder & attr,
        wxTextAttrBorder & clashingAttr,
        wxTextAttrBorder & absentAttr
    );
    %Docstring
        CollectCommonAttributes(attr, clashingAttr, absentAttr)
        
        Collects the attributes that are common to a range of content,
        building up a note of which attributes are absent in some objects and
        which clash in some objects.
    %End

    void SetStyle(
        int style
    );
    %Docstring
        SetStyle(style)
        
        Sets the border style.
    %End

    int GetStyle() const;
    %Docstring
        GetStyle() -> int
        
        Gets the border style.
    %End

    void SetColour(
        unsigned long colour
    );
    %Docstring
        SetColour(colour)
        SetColour(colour)
        
        Sets the border colour.
    %End

    void SetColour(
        const wxColour & colour
    );

    unsigned long GetColourLong() const;
    %Docstring
        GetColourLong() -> unsignedlong
        
        Gets the colour as a long.
    %End

    wxColour GetColour() const;
    %Docstring
        GetColour() -> wx.Colour
        
        Gets the colour.
    %End

    wxTextAttrDimension & GetWidth();
    %Docstring
        GetWidth() -> TextAttrDimension
        
        Gets the border width.
    %End

    void SetWidth(
        const wxTextAttrDimension & width
    );
    %Docstring
        SetWidth(width)
        SetWidth(value, units=TEXT_ATTR_UNITS_TENTHS_MM)
        
        Sets the border width.
    %End

    void SetWidth(
        int value,
        wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM
    );

    bool HasStyle() const;
    %Docstring
        HasStyle() -> bool
        
        True if the border has a valid style.
    %End

    bool HasColour() const;
    %Docstring
        HasColour() -> bool
        
        True if the border has a valid colour.
    %End

    bool HasWidth() const;
    %Docstring
        HasWidth() -> bool
        
        True if the border has a valid width.
    %End

    bool IsValid() const;
    %Docstring
        IsValid() -> bool
        
        True if the border is valid.
    %End

    bool IsDefault() const;
    %Docstring
        IsDefault() -> bool
        
        True if the border has no attributes set.
    %End

    void MakeValid();
    %Docstring
        MakeValid()
        
        Set the valid flag for this border.
    %End

    int GetFlags() const;
    %Docstring
        GetFlags() -> int
        
        Returns the border flags.
    %End

    void SetFlags(
        int flags
    );
    %Docstring
        SetFlags(flags)
        
        Sets the border flags.
    %End

    void AddFlag(
        int flag
    );
    %Docstring
        AddFlag(flag)
        
        Adds a border flag.
    %End

    void RemoveFlag(
        int flag
    );
    %Docstring
        RemoveFlag(flag)
        
        Removes a border flag.
    %End

    int __nonzero__();
    %Docstring
        __nonzero__() -> int
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxTextAttrBorder___nonzero__(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    int _wxTextAttrBorder___nonzero__(wxTextAttrBorder* self)
    {
        return self->IsValid();
    }
    %End

    int __bool__();
    %Docstring
        __bool__() -> int
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxTextAttrBorder___bool__(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    int _wxTextAttrBorder___bool__(wxTextAttrBorder* self)
    {
        return self->IsValid();
    }
    %End

    public:


    %Property(name=Colour, get=GetColour, set=SetColour)
    %Property(name=ColourLong, get=GetColourLong)
    %Property(name=Flags, get=GetFlags, set=SetFlags)
    %Property(name=Style, get=GetStyle, set=SetStyle)
    %Property(name=Width, get=GetWidth, set=SetWidth)
};  // end of class wxTextAttrBorder


class wxTextAttrBorders
{
    %Docstring
        TextAttrBorders()
        
        A class representing a rich text object's borders.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxTextAttrBorders();

    wxTextAttrBorder m_left;

    wxTextAttrBorder m_right;

    wxTextAttrBorder m_top;

    wxTextAttrBorder m_bottom;

    bool operator==(
        const wxTextAttrBorders & borders
    ) const;

    void SetStyle(
        int style
    );
    %Docstring
        SetStyle(style)
        
        Sets the style of all borders.
    %End

    void SetColour(
        unsigned long colour
    );
    %Docstring
        SetColour(colour)
        SetColour(colour)
        
        Sets colour of all borders.
    %End

    void SetColour(
        const wxColour & colour
    );

    void SetWidth(
        const wxTextAttrDimension & width
    );
    %Docstring
        SetWidth(width)
        SetWidth(value, units=TEXT_ATTR_UNITS_TENTHS_MM)
        
        Sets the width of all borders.
    %End

    void SetWidth(
        int value,
        wxTextAttrUnits units = wxTEXT_ATTR_UNITS_TENTHS_MM
    );

    void Reset();
    %Docstring
        Reset()
        
        Resets all borders.
    %End

    bool EqPartial(
        const wxTextAttrBorders & borders,
        bool weakTest = true
    ) const;
    %Docstring
        EqPartial(borders, weakTest=True) -> bool
        
        Partial equality test.
    %End

    bool Apply(
        const wxTextAttrBorders & borders,
        const wxTextAttrBorders * compareWith = NULL
    );
    %Docstring
        Apply(borders, compareWith=None) -> bool
        
        Applies border to this object, but not if the same as compareWith.
    %End

    bool RemoveStyle(
        const wxTextAttrBorders & attr
    );
    %Docstring
        RemoveStyle(attr) -> bool
        
        Removes the specified attributes from this object.
    %End

    void CollectCommonAttributes(
        const wxTextAttrBorders & attr,
        wxTextAttrBorders & clashingAttr,
        wxTextAttrBorders & absentAttr
    );
    %Docstring
        CollectCommonAttributes(attr, clashingAttr, absentAttr)
        
        Collects the attributes that are common to a range of content,
        building up a note of which attributes are absent in some objects and
        which clash in some objects.
    %End

    bool IsValid() const;
    %Docstring
        IsValid() -> bool
        
        Returns true if at least one border is valid.
    %End

    wxTextAttrBorder & GetLeft();
    %Docstring
        GetLeft() -> TextAttrBorder
    %End

    wxTextAttrBorder & GetRight();
    %Docstring
        GetRight() -> TextAttrBorder
    %End

    wxTextAttrBorder & GetTop();
    %Docstring
        GetTop() -> TextAttrBorder
    %End

    wxTextAttrBorder & GetBottom();
    %Docstring
        GetBottom() -> TextAttrBorder
    %End

    int __nonzero__();
    %Docstring
        __nonzero__() -> int
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxTextAttrBorders___nonzero__(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    int _wxTextAttrBorders___nonzero__(wxTextAttrBorders* self)
    {
        return self->IsValid();
    }
    %End

    int __bool__();
    %Docstring
        __bool__() -> int
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxTextAttrBorders___bool__(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    int _wxTextAttrBorders___bool__(wxTextAttrBorders* self)
    {
        return self->IsValid();
    }
    %End

    public:


    %Property(name=Bottom, get=GetBottom)
    %Property(name=Left, get=GetLeft)
    %Property(name=Right, get=GetRight)
    %Property(name=Top, get=GetTop)
};  // end of class wxTextAttrBorders


class wxTextAttrShadow
{
    %Docstring
        TextAttrShadow()
        
        A class representing a shadow.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxTextAttrShadow();

    int m_flags;

    unsigned long m_shadowColour;

    wxTextAttrDimension m_offsetX;

    wxTextAttrDimension m_offsetY;

    wxTextAttrDimension m_spread;

    wxTextAttrDimension m_blurDistance;

    wxTextAttrDimension m_opacity;

    bool operator==(
        const wxTextAttrShadow & shadow
    ) const;

    void Reset();
    %Docstring
        Reset()
        
        Resets the shadow.
    %End

    bool EqPartial(
        const wxTextAttrShadow & shadow,
        bool weakTest = true
    ) const;
    %Docstring
        EqPartial(shadow, weakTest=True) -> bool
        
        Partial equality test.
    %End

    bool Apply(
        const wxTextAttrShadow & shadow,
        const wxTextAttrShadow * compareWith = NULL
    );
    %Docstring
        Apply(shadow, compareWith=None) -> bool
        
        Applies the border to this object, but not if the same as compareWith.
    %End

    bool RemoveStyle(
        const wxTextAttrShadow & attr
    );
    %Docstring
        RemoveStyle(attr) -> bool
        
        Removes the specified attributes from this object.
    %End

    void CollectCommonAttributes(
        const wxTextAttrShadow & attr,
        wxTextAttrShadow & clashingAttr,
        wxTextAttrShadow & absentAttr
    );
    %Docstring
        CollectCommonAttributes(attr, clashingAttr, absentAttr)
        
        Collects the attributes that are common to a range of content,
        building up a note of which attributes are absent in some objects and
        which clash in some objects.
    %End

    void SetColour(
        unsigned long colour
    );
    %Docstring
        SetColour(colour)
        SetColour(colour)
        
        Sets the shadow colour.
    %End

    void SetColour(
        const wxColour & colour
    );

    unsigned long GetColourLong() const;
    %Docstring
        GetColourLong() -> unsignedlong
        
        Gets the colour as a long.
    %End

    wxColour GetColour() const;
    %Docstring
        GetColour() -> wx.Colour
        
        Gets the colour.
    %End

    bool HasColour() const;
    %Docstring
        HasColour() -> bool
        
        True if the shadow has a valid colour.
    %End

    wxTextAttrDimension & GetOffsetX();
    %Docstring
        GetOffsetX() -> TextAttrDimension
        
        Gets the shadow horizontal offset.
    %End

    void SetOffsetX(
        const wxTextAttrDimension & offset
    );
    %Docstring
        SetOffsetX(offset)
        
        Sets the shadow horizontal offset.
    %End

    wxTextAttrDimension & GetOffsetY();
    %Docstring
        GetOffsetY() -> TextAttrDimension
        
        Gets the shadow vertical offset.
    %End

    void SetOffsetY(
        const wxTextAttrDimension & offset
    );
    %Docstring
        SetOffsetY(offset)
        
        Sets the shadow vertical offset.
    %End

    wxTextAttrDimension & GetSpread();
    %Docstring
        GetSpread() -> TextAttrDimension
        
        Gets the shadow spread size.
    %End

    void SetSpread(
        const wxTextAttrDimension & spread
    );
    %Docstring
        SetSpread(spread)
        
        Sets the shadow spread size.
    %End

    wxTextAttrDimension & GetBlurDistance();
    %Docstring
        GetBlurDistance() -> TextAttrDimension
        
        Gets the shadow blur distance.
    %End

    void SetBlurDistance(
        const wxTextAttrDimension & blur
    );
    %Docstring
        SetBlurDistance(blur)
        
        Sets the shadow blur distance.
    %End

    wxTextAttrDimension & GetOpacity();
    %Docstring
        GetOpacity() -> TextAttrDimension
        
        Gets the shadow opacity.
    %End

    bool IsValid() const;
    %Docstring
        IsValid() -> bool
        
        Returns true if the dimension is valid.
    %End

    void SetValid(
        bool b
    );
    %Docstring
        SetValid(b)
        
        Sets the valid flag.
    %End

    int GetFlags() const;
    %Docstring
        GetFlags() -> int
        
        Returns the border flags.
    %End

    void SetFlags(
        int flags
    );
    %Docstring
        SetFlags(flags)
        
        Sets the border flags.
    %End

    void AddFlag(
        int flag
    );
    %Docstring
        AddFlag(flag)
        
        Adds a border flag.
    %End

    void RemoveFlag(
        int flag
    );
    %Docstring
        RemoveFlag(flag)
        
        Removes a border flag.
    %End

    void SetOpacity(
        const wxTextAttrDimension & opacity
    );
    %Docstring
        SetOpacity(opacity)
        
        Sets the shadow opacity.
    %End

    bool IsDefault() const;
    %Docstring
        IsDefault() -> bool
        
        True if the shadow has no attributes set.
    %End

    public:


    %Property(name=BlurDistance, get=GetBlurDistance, set=SetBlurDistance)
    %Property(name=Colour, get=GetColour, set=SetColour)
    %Property(name=ColourLong, get=GetColourLong)
    %Property(name=Flags, get=GetFlags, set=SetFlags)
    %Property(name=OffsetX, get=GetOffsetX, set=SetOffsetX)
    %Property(name=OffsetY, get=GetOffsetY, set=SetOffsetY)
    %Property(name=Opacity, get=GetOpacity, set=SetOpacity)
    %Property(name=Spread, get=GetSpread, set=SetSpread)
};  // end of class wxTextAttrShadow


class wxTextBoxAttr
{
    %Docstring
        TextBoxAttr()
        TextBoxAttr(attr)
        
        A class representing the box attributes of a rich text object.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxTextBoxAttr();

    wxTextBoxAttr(
        const wxTextBoxAttr & attr
    );

    int m_flags;

    wxTextAttrDimensions m_margins;

    wxTextAttrDimensions m_padding;

    wxTextAttrDimensions m_position;

    wxTextAttrSize m_size;

    wxTextAttrSize m_minSize;

    wxTextAttrSize m_maxSize;

    wxTextAttrBorders m_border;

    wxTextAttrBorders m_outline;

    wxTextBoxAttrFloatStyle m_floatMode;

    wxTextBoxAttrClearStyle m_clearMode;

    wxTextBoxAttrCollapseMode m_collapseMode;

    wxTextBoxAttrVerticalAlignment m_verticalAlignment;

    wxTextBoxAttrWhitespaceMode m_whitespaceMode;

    wxTextAttrDimension m_cornerRadius;

    wxString m_boxStyleName;

    wxTextAttrShadow m_shadow;

    void Init();
    %Docstring
        Init()
        
        Initialises this object.
    %End

    void Reset();
    %Docstring
        Reset()
        
        Resets this object.
    %End

    bool operator==(
        const wxTextBoxAttr & attr
    ) const;

    bool EqPartial(
        const wxTextBoxAttr & attr,
        bool weakTest = true
    ) const;
    %Docstring
        EqPartial(attr, weakTest=True) -> bool
        
        Partial equality test, ignoring unset attributes.
    %End

    bool Apply(
        const wxTextBoxAttr & style,
        const wxTextBoxAttr * compareWith = NULL
    );
    %Docstring
        Apply(style, compareWith=None) -> bool
        
        Merges the given attributes.
    %End

    void CollectCommonAttributes(
        const wxTextBoxAttr & attr,
        wxTextBoxAttr & clashingAttr,
        wxTextBoxAttr & absentAttr
    );
    %Docstring
        CollectCommonAttributes(attr, clashingAttr, absentAttr)
        
        Collects the attributes that are common to a range of content,
        building up a note of which attributes are absent in some objects and
        which clash in some objects.
    %End

    bool RemoveStyle(
        const wxTextBoxAttr & attr
    );
    %Docstring
        RemoveStyle(attr) -> bool
        
        Removes the specified attributes from this object.
    %End

    void SetFlags(
        int flags
    );
    %Docstring
        SetFlags(flags)
        
        Sets the flags.
    %End

    int GetFlags() const;
    %Docstring
        GetFlags() -> int
        
        Returns the flags.
    %End

    bool HasFlag(
        wxTextBoxAttrFlags flag
    ) const;
    %Docstring
        HasFlag(flag) -> bool
        
        Is this flag present?
    %End

    void RemoveFlag(
        wxTextBoxAttrFlags flag
    );
    %Docstring
        RemoveFlag(flag)
        
        Removes this flag.
    %End

    void AddFlag(
        wxTextBoxAttrFlags flag
    );
    %Docstring
        AddFlag(flag)
        
        Adds this flag.
    %End

    bool IsDefault() const;
    %Docstring
        IsDefault() -> bool
        
        Returns true if no attributes are set.
    %End

    wxTextBoxAttrFloatStyle GetFloatMode() const;
    %Docstring
        GetFloatMode() -> TextBoxAttrFloatStyle
        
        Returns the float mode.
    %End

    void SetFloatMode(
        wxTextBoxAttrFloatStyle mode
    );
    %Docstring
        SetFloatMode(mode)
        
        Sets the float mode.
    %End

    bool HasFloatMode() const;
    %Docstring
        HasFloatMode() -> bool
        
        Returns true if float mode is active.
    %End

    bool IsFloating() const;
    %Docstring
        IsFloating() -> bool
        
        Returns true if this object is floating.
    %End

    wxTextBoxAttrClearStyle GetClearMode() const;
    %Docstring
        GetClearMode() -> TextBoxAttrClearStyle
        
        Returns the clear mode - whether to wrap text after object.
    %End

    void SetClearMode(
        wxTextBoxAttrClearStyle mode
    );
    %Docstring
        SetClearMode(mode)
        
        Set the clear mode.
    %End

    bool HasClearMode() const;
    %Docstring
        HasClearMode() -> bool
        
        Returns true if we have a clear flag.
    %End

    wxTextBoxAttrCollapseMode GetCollapseBorders() const;
    %Docstring
        GetCollapseBorders() -> TextBoxAttrCollapseMode
        
        Returns the collapse mode - whether to collapse borders.
    %End

    void SetCollapseBorders(
        wxTextBoxAttrCollapseMode collapse
    );
    %Docstring
        SetCollapseBorders(collapse)
        
        Sets the collapse mode - whether to collapse borders.
    %End

    bool HasCollapseBorders() const;
    %Docstring
        HasCollapseBorders() -> bool
        
        Returns true if the collapse borders flag is present.
    %End

    wxTextBoxAttrWhitespaceMode GetWhitespaceMode() const;
    %Docstring
        GetWhitespaceMode() -> TextBoxAttrWhitespaceMode
        
        Returns the whitespace mode.
    %End

    void SetWhitespaceMode(
        wxTextBoxAttrWhitespaceMode whitespace
    );
    %Docstring
        SetWhitespaceMode(whitespace)
        
        Sets the whitespace mode.
    %End

    bool HasWhitespaceMode() const;
    %Docstring
        HasWhitespaceMode() -> bool
        
        Returns true if the whitespace flag is present.
    %End

    bool HasCornerRadius() const;
    %Docstring
        HasCornerRadius() -> bool
        
        Returns true if the corner radius flag is present.
    %End

    wxTextAttrDimension & GetCornerRadius();
    %Docstring
        GetCornerRadius() -> TextAttrDimension
    %End

    void SetCornerRadius(
        const wxTextAttrDimension & dim
    );
    %Docstring
        SetCornerRadius(dim)
        
        Sets the corner radius value.
    %End

    wxTextBoxAttrVerticalAlignment GetVerticalAlignment() const;
    %Docstring
        GetVerticalAlignment() -> TextBoxAttrVerticalAlignment
        
        Returns the vertical alignment.
    %End

    void SetVerticalAlignment(
        wxTextBoxAttrVerticalAlignment verticalAlignment
    );
    %Docstring
        SetVerticalAlignment(verticalAlignment)
        
        Sets the vertical alignment.
    %End

    bool HasVerticalAlignment() const;
    %Docstring
        HasVerticalAlignment() -> bool
        
        Returns true if a vertical alignment flag is present.
    %End

    wxTextAttrDimensions & GetMargins();
    %Docstring
        GetMargins() -> TextAttrDimensions
        
        Returns the margin values.
    %End

    wxTextAttrDimension & GetLeftMargin();
    %Docstring
        GetLeftMargin() -> TextAttrDimension
        
        Returns the left margin.
    %End

    wxTextAttrDimension & GetRightMargin();
    %Docstring
        GetRightMargin() -> TextAttrDimension
        
        Returns the right margin.
    %End

    wxTextAttrDimension & GetTopMargin();
    %Docstring
        GetTopMargin() -> TextAttrDimension
        
        Returns the top margin.
    %End

    wxTextAttrDimension & GetBottomMargin();
    %Docstring
        GetBottomMargin() -> TextAttrDimension
        
        Returns the bottom margin.
    %End

    wxTextAttrDimensions & GetPosition();
    %Docstring
        GetPosition() -> TextAttrDimensions
        
        Returns the position.
    %End

    wxTextAttrDimension & GetLeft();
    %Docstring
        GetLeft() -> TextAttrDimension
        
        Returns the left position.
    %End

    wxTextAttrDimension & GetRight();
    %Docstring
        GetRight() -> TextAttrDimension
        
        Returns the right position.
    %End

    wxTextAttrDimension & GetTop();
    %Docstring
        GetTop() -> TextAttrDimension
        
        Returns the top position.
    %End

    wxTextAttrDimension & GetBottom();
    %Docstring
        GetBottom() -> TextAttrDimension
        
        Returns the bottom position.
    %End

    wxTextAttrDimensions & GetPadding();
    %Docstring
        GetPadding() -> TextAttrDimensions
        
        Returns the padding values.
    %End

    wxTextAttrDimension & GetLeftPadding();
    %Docstring
        GetLeftPadding() -> TextAttrDimension
        
        Returns the left padding value.
    %End

    wxTextAttrDimension & GetRightPadding();
    %Docstring
        GetRightPadding() -> TextAttrDimension
        
        Returns the right padding value.
    %End

    wxTextAttrDimension & GetTopPadding();
    %Docstring
        GetTopPadding() -> TextAttrDimension
        
        Returns the top padding value.
    %End

    wxTextAttrDimension & GetBottomPadding();
    %Docstring
        GetBottomPadding() -> TextAttrDimension
        
        Returns the bottom padding value.
    %End

    wxTextAttrBorders & GetBorder();
    %Docstring
        GetBorder() -> TextAttrBorders
        
        Returns the borders.
    %End

    wxTextAttrBorder & GetLeftBorder();
    %Docstring
        GetLeftBorder() -> TextAttrBorder
        
        Returns the left border.
    %End

    wxTextAttrBorder & GetTopBorder();
    %Docstring
        GetTopBorder() -> TextAttrBorder
        
        Returns the top border.
    %End

    wxTextAttrBorder & GetRightBorder();
    %Docstring
        GetRightBorder() -> TextAttrBorder
        
        Returns the right border.
    %End

    wxTextAttrBorder & GetBottomBorder();
    %Docstring
        GetBottomBorder() -> TextAttrBorder
        
        Returns the bottom border.
    %End

    wxTextAttrBorders & GetOutline();
    %Docstring
        GetOutline() -> TextAttrBorders
        
        Returns the outline.
    %End

    wxTextAttrBorder & GetLeftOutline();
    %Docstring
        GetLeftOutline() -> TextAttrBorder
        
        Returns the left outline.
    %End

    wxTextAttrBorder & GetTopOutline();
    %Docstring
        GetTopOutline() -> TextAttrBorder
        
        Returns the top outline.
    %End

    wxTextAttrBorder & GetRightOutline();
    %Docstring
        GetRightOutline() -> TextAttrBorder
        
        Returns the right outline.
    %End

    wxTextAttrBorder & GetBottomOutline();
    %Docstring
        GetBottomOutline() -> TextAttrBorder
        
        Returns the bottom outline.
    %End

    wxTextAttrSize & GetSize();
    %Docstring
        GetSize() -> TextAttrSize
        
        Returns the object size.
    %End

    wxTextAttrSize & GetMinSize();
    %Docstring
        GetMinSize() -> TextAttrSize
        
        Returns the object minimum size.
    %End

    wxTextAttrSize & GetMaxSize();
    %Docstring
        GetMaxSize() -> TextAttrSize
        
        Returns the object maximum size.
    %End

    void SetSize(
        const wxTextAttrSize & sz
    );
    %Docstring
        SetSize(sz)
        
        Sets the object size.
    %End

    void SetMinSize(
        const wxTextAttrSize & sz
    );
    %Docstring
        SetMinSize(sz)
        
        Sets the object minimum size.
    %End

    void SetMaxSize(
        const wxTextAttrSize & sz
    );
    %Docstring
        SetMaxSize(sz)
        
        Sets the object maximum size.
    %End

    wxTextAttrDimension & GetWidth();
    %Docstring
        GetWidth() -> TextAttrDimension
        
        Returns the object width.
    %End

    wxTextAttrDimension & GetHeight();
    %Docstring
        GetHeight() -> TextAttrDimension
        
        Returns the object height.
    %End

    const wxString & GetBoxStyleName() const;
    %Docstring
        GetBoxStyleName() -> String
        
        Returns the box style name.
    %End

    void SetBoxStyleName(
        const wxString & name
    );
    %Docstring
        SetBoxStyleName(name)
        
        Sets the box style name.
    %End

    bool HasBoxStyleName() const;
    %Docstring
        HasBoxStyleName() -> bool
        
        Returns true if the box style name is present.
    %End

    wxTextAttrShadow & GetShadow();
    %Docstring
        GetShadow() -> TextAttrShadow
        
        Returns the box shadow attributes.
    %End

    public:


    %Property(name=Border, get=GetBorder)
    %Property(name=Bottom, get=GetBottom)
    %Property(name=BottomBorder, get=GetBottomBorder)
    %Property(name=BottomMargin, get=GetBottomMargin)
    %Property(name=BottomOutline, get=GetBottomOutline)
    %Property(name=BottomPadding, get=GetBottomPadding)
    %Property(name=BoxStyleName, get=GetBoxStyleName, set=SetBoxStyleName)
    %Property(name=ClearMode, get=GetClearMode, set=SetClearMode)
    %Property(name=CollapseBorders, get=GetCollapseBorders, set=SetCollapseBorders)
    %Property(name=CornerRadius, get=GetCornerRadius, set=SetCornerRadius)
    %Property(name=Flags, get=GetFlags, set=SetFlags)
    %Property(name=FloatMode, get=GetFloatMode, set=SetFloatMode)
    %Property(name=Height, get=GetHeight)
    %Property(name=Left, get=GetLeft)
    %Property(name=LeftBorder, get=GetLeftBorder)
    %Property(name=LeftMargin, get=GetLeftMargin)
    %Property(name=LeftOutline, get=GetLeftOutline)
    %Property(name=LeftPadding, get=GetLeftPadding)
    %Property(name=Margins, get=GetMargins)
    %Property(name=MaxSize, get=GetMaxSize, set=SetMaxSize)
    %Property(name=MinSize, get=GetMinSize, set=SetMinSize)
    %Property(name=Outline, get=GetOutline)
    %Property(name=Padding, get=GetPadding)
    %Property(name=Position, get=GetPosition)
    %Property(name=Right, get=GetRight)
    %Property(name=RightBorder, get=GetRightBorder)
    %Property(name=RightMargin, get=GetRightMargin)
    %Property(name=RightOutline, get=GetRightOutline)
    %Property(name=RightPadding, get=GetRightPadding)
    %Property(name=Shadow, get=GetShadow)
    %Property(name=Size, get=GetSize, set=SetSize)
    %Property(name=Top, get=GetTop)
    %Property(name=TopBorder, get=GetTopBorder)
    %Property(name=TopMargin, get=GetTopMargin)
    %Property(name=TopOutline, get=GetTopOutline)
    %Property(name=TopPadding, get=GetTopPadding)
    %Property(name=VerticalAlignment, get=GetVerticalAlignment, set=SetVerticalAlignment)
    %Property(name=WhitespaceMode, get=GetWhitespaceMode, set=SetWhitespaceMode)
    %Property(name=Width, get=GetWidth)
};  // end of class wxTextBoxAttr


class wxRichTextAttr : wxTextAttr
{
    %Docstring
        RichTextAttr(attr)
        RichTextAttr(attr)
        RichTextAttr()
        
        A class representing enhanced attributes for rich text objects.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextAttr(
        const wxTextAttr & attr
    );

    wxRichTextAttr(
        const wxRichTextAttr & attr
    );

    wxRichTextAttr();

    wxTextBoxAttr m_textBoxAttr;

    void Copy(
        const wxRichTextAttr & attr
    );
    %Docstring
        Copy(attr)
        
        Copy function.
    %End

    bool operator==(
        const wxRichTextAttr & attr
    ) const;

    bool EqPartial(
        const wxRichTextAttr & attr,
        bool weakTest = true
    ) const;
    %Docstring
        EqPartial(attr, weakTest=True) -> bool
        
        Partial equality test.
    %End

    bool Apply(
        const wxRichTextAttr & style,
        const wxRichTextAttr * compareWith = NULL
    );
    %Docstring
        Apply(style, compareWith=None) -> bool
        
        Merges the given attributes.
    %End

    void CollectCommonAttributes(
        const wxRichTextAttr & attr,
        wxRichTextAttr & clashingAttr,
        wxRichTextAttr & absentAttr
    );
    %Docstring
        CollectCommonAttributes(attr, clashingAttr, absentAttr)
        
        Collects the attributes that are common to a range of content,
        building up a note of which attributes are absent in some objects and
        which clash in some objects.
    %End

    bool RemoveStyle(
        const wxRichTextAttr & attr
    );
    %Docstring
        RemoveStyle(attr) -> bool
        
        Removes the specified attributes from this object.
    %End

    wxTextBoxAttr & GetTextBoxAttr();
    %Docstring
        GetTextBoxAttr() -> TextBoxAttr
        
        Returns the text box attributes.
    %End

    void SetTextBoxAttr(
        const wxTextBoxAttr & attr
    );
    %Docstring
        SetTextBoxAttr(attr)
        
        Set the text box attributes.
    %End

    bool IsDefault() const;
    %Docstring
        IsDefault() -> bool
        
        Returns true if no attributes are set.
    %End

    public:


    %Property(name=TextBoxAttr, get=GetTextBoxAttr, set=SetTextBoxAttr)
};  // end of class wxRichTextAttr


class wxRichTextProperties : wxObject
{
    %Docstring
        RichTextProperties()
        RichTextProperties(props)
        
        A simple property class using wxVariants.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextProperties();

    wxRichTextProperties(
        const wxRichTextProperties & props
    );

    bool operator==(
        const wxRichTextProperties & props
    ) const;

    void Copy(
        const wxRichTextProperties & props
    );
    %Docstring
        Copy(props)
        
        Copies from props.
    %End

    void Clear();
    %Docstring
        Clear()
        
        Clears the properties.
    %End

    wxRichTextVariantArray & GetProperties();
    %Docstring
        GetProperties() -> RichTextVariantArray
        
        Returns the array of variants implementing the properties.
    %End

    void SetProperties(
        const wxRichTextVariantArray & props
    );
    %Docstring
        SetProperties(props)
        
        Sets the array of variants.
    %End

    wxArrayString GetPropertyNames() const;
    %Docstring
        GetPropertyNames() -> ArrayString
        
        Returns all the property names.
    %End

    size_t GetCount() const;
    %Docstring
        GetCount() -> size_t
        
        Returns a count of the properties.
    %End

    bool HasProperty(
        const wxString & name
    ) const;
    %Docstring
        HasProperty(name) -> bool
        
        Returns true if the given property is found.
    %End

    int Find(
        const wxString & name
    ) const;
    %Docstring
        Find(name) -> int
        
        Finds the given property.
    %End

    bool Remove(
        const wxString & name
    );
    %Docstring
        Remove(name) -> bool
        
        Removes the given property.
    %End

    const wxVariant & GetProperty(
        const wxString & name
    ) const;
    %Docstring
        GetProperty(name) -> Variant
        
        Gets the property variant by name.
    %End

    wxVariant * FindOrCreateProperty(
        const wxString & name
    );
    %Docstring
        FindOrCreateProperty(name) -> Variant
        
        Finds or creates a property with the given name, returning a pointer
        to the variant.
    %End

    wxString GetPropertyString(
        const wxString & name
    ) const;
    %Docstring
        GetPropertyString(name) -> String
        
        Gets the value of the named property as a string.
    %End

    long GetPropertyLong(
        const wxString & name
    ) const;
    %Docstring
        GetPropertyLong(name) -> long
        
        Gets the value of the named property as a long integer.
    %End

    bool GetPropertyBool(
        const wxString & name
    ) const;
    %Docstring
        GetPropertyBool(name) -> bool
        
        Gets the value of the named property as a boolean.
    %End

    double GetPropertyDouble(
        const wxString & name
    ) const;
    %Docstring
        GetPropertyDouble(name) -> double
        
        Gets the value of the named property as a double.
    %End

    void SetProperty(
        const wxVariant & variant
    );
    %Docstring
        SetProperty(variant)
        SetProperty(name, variant)
        SetProperty(name, value)
        SetProperty(name, value)
        SetProperty(name, value)
        SetProperty(name, value)
        
        Sets the property by passing a variant which contains a name and
        value.
    %End

    void SetProperty(
        const wxString & name,
        const wxVariant & variant
    );

    void SetProperty(
        const wxString & name,
        const wxString & value
    );

    void SetProperty(
        const wxString & name,
        const wxChar * value
    );

    void SetProperty(
        const wxString & name,
        long value
    );

    void SetProperty(
        const wxString & name,
        double value
    );

    void RemoveProperties(
        const wxRichTextProperties & properties
    );
    %Docstring
        RemoveProperties(properties)
        
        Removes the given properties from these properties.
    %End

    void MergeProperties(
        const wxRichTextProperties & properties
    );
    %Docstring
        MergeProperties(properties)
        
        Merges the given properties with these properties.
    %End

    public:


    %Property(name=Count, get=GetCount)
    %Property(name=Properties, get=GetProperties, set=SetProperties)
    %Property(name=PropertyNames, get=GetPropertyNames)
};  // end of class wxRichTextProperties


class wxRichTextFontTable : wxObject
{
    %Docstring
        RichTextFontTable()
        RichTextFontTable(table)
        
        Manages quick access to a pool of fonts for rendering rich text.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextFontTable();

    wxRichTextFontTable(
        const wxRichTextFontTable & table
    );

    virtual
    ~wxRichTextFontTable();

    bool IsOk() const;
    %Docstring
        IsOk() -> bool
        
        Returns true if the font table is valid.
    %End

    wxFont FindFont(
        const wxRichTextAttr & fontSpec
    );
    %Docstring
        FindFont(fontSpec) -> wx.Font
        
        Finds a font for the given attribute object.
    %End

    void Clear();
    %Docstring
        Clear()
        
        Clears the font table.
    %End

    bool operator==(
        const wxRichTextFontTable & table
    ) const;

    bool operator!=(
        const wxRichTextFontTable & table
    ) const;

    void SetFontScale(
        double fontScale
    );
    %Docstring
        SetFontScale(fontScale)
        
        Set the font scale factor.
    %End

    public:


};  // end of class wxRichTextFontTable


class wxRichTextRange
{
    %Docstring
        RichTextRange()
        RichTextRange(start, end)
        RichTextRange(range)
        
        This stores beginning and end positions for a range of data.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextRange();

    wxRichTextRange(
        long start,
        long end
    );

    wxRichTextRange(
        const wxRichTextRange & range
    );

    ~wxRichTextRange();

    bool operator==(
        const wxRichTextRange & range
    ) const;

    bool operator!=(
        const wxRichTextRange & range
    ) const;

    wxRichTextRange operator-(
        const wxRichTextRange & range
    ) const;

    wxRichTextRange operator+(
        const wxRichTextRange & range
    ) const;

    void SetRange(
        long start,
        long end
    );
    %Docstring
        SetRange(start, end)
        
        Sets the range start and end positions.
    %End

    void SetStart(
        long start
    );
    %Docstring
        SetStart(start)
        
        Sets the start position.
    %End

    long GetStart() const;
    %Docstring
        GetStart() -> long
        
        Returns the start position.
    %End

    void SetEnd(
        long end
    );
    %Docstring
        SetEnd(end)
        
        Sets the end position.
    %End

    long GetEnd() const;
    %Docstring
        GetEnd() -> long
        
        Gets the end position.
    %End

    bool IsOutside(
        const wxRichTextRange & range
    ) const;
    %Docstring
        IsOutside(range) -> bool
        
        Returns true if this range is completely outside range.
    %End

    bool IsWithin(
        const wxRichTextRange & range
    ) const;
    %Docstring
        IsWithin(range) -> bool
        
        Returns true if this range is completely within range.
    %End

    bool Contains(
        long pos
    ) const;
    %Docstring
        Contains(pos) -> bool
        
        Returns true if pos was within the range.
    %End

    bool LimitTo(
        const wxRichTextRange & range
    );
    %Docstring
        LimitTo(range) -> bool
        
        Limit this range to be within range.
    %End

    long GetLength() const;
    %Docstring
        GetLength() -> long
        
        Gets the length of the range.
    %End

    void Swap();
    %Docstring
        Swap()
        
        Swaps the start and end.
    %End

    wxRichTextRange ToInternal() const;
    %Docstring
        ToInternal() -> RichTextRange
        
        Converts the API-standard range, whose end is one past the last
        character in the range, to the internal form, which uses the first and
        last character positions of the range.
    %End

    wxRichTextRange FromInternal() const;
    %Docstring
        FromInternal() -> RichTextRange
        
        Converts the internal range, which uses the first and last character
        positions of the range, to the API-standard range, whose end is one
        past the last character in the range.
    %End

    public:


    %Property(name=End, get=GetEnd, set=SetEnd)
    %Property(name=Length, get=GetLength)
    %Property(name=Start, get=GetStart, set=SetStart)
    PyObject* Get();
    %Docstring
        Get() -> (start, end)
        
        Return the start and end properties as a tuple.
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxRichTextRange_Get(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    PyObject* _wxRichTextRange_Get(wxRichTextRange* self)
    {
        wxPyThreadBlocker blocker;
        return sipBuildResult(0, "(ii)", self->GetStart(), self->GetEnd());
    }
    %End

    %ConvertToTypeCode
        // is it just a typecheck?
        if (!sipIsErr) {
            // is it already an instance of wxRichTextRange?
            if (sipCanConvertToType(sipPy, sipType_wxRichTextRange, SIP_NO_CONVERTORS))
                return 1;
        
            if (wxPyNumberSequenceCheck(sipPy, 2)) {
                return 1;
            }
            return 0;
        }
        
         // otherwise do the conversion
         if (sipCanConvertToType(sipPy, sipType_wxRichTextRange, SIP_NO_CONVERTORS)) {
             // Just fetch the existing instance
             *sipCppPtr = reinterpret_cast<wxRichTextRange*>(sipConvertToType(
                     sipPy, sipType_wxRichTextRange, sipTransferObj, SIP_NO_CONVERTORS, 0, sipIsErr));
             return 0;  // not a new instance
         }
        
         // or create a new instance
         PyObject* o1 = PySequence_ITEM(sipPy, 0);
         PyObject* o2 = PySequence_ITEM(sipPy, 1);
         *sipCppPtr = new wxRichTextRange(wxPyInt_AsLong(o1), wxPyInt_AsLong(o2));
         Py_DECREF(o1);
         Py_DECREF(o2);
         return SIP_TEMPORARY;
    %End
};  // end of class wxRichTextRange


%Extract(id=pycode_richtext)
def _RichTextRange_GetIM(self):
    """
    Returns an immutable representation of the ``wx.RichTextRange`` object, based on ``namedtuple``.
    
    This new object is hashable and can be used as a dictionary key,
    be added to sets, etc.  It can be converted back into a real ``wx.RichTextRange``
    with a simple statement like this: ``obj = wx.RichTextRange(imObj)``.
    """
    return _im_RichTextRange(*self.Get())
RichTextRange.GetIM = _RichTextRange_GetIM
del _RichTextRange_GetIM
%End

%Extract(id=pycode_richtext)
def _RichTextRange___str__(self):
    return str(self.Get())
RichTextRange.__str__ = _RichTextRange___str__
del _RichTextRange___str__
%End

%Extract(id=pycode_richtext)
def _RichTextRange___repr__(self):
    return "RichTextRange"+str(self.Get())
RichTextRange.__repr__ = _RichTextRange___repr__
del _RichTextRange___repr__
%End

%Extract(id=pycode_richtext)
def _RichTextRange___len__(self):
    return len(self.Get())
RichTextRange.__len__ = _RichTextRange___len__
del _RichTextRange___len__
%End

%Extract(id=pycode_richtext)
def _RichTextRange___nonzero__(self):
    return self.Get() != (0,0)
RichTextRange.__nonzero__ = _RichTextRange___nonzero__
del _RichTextRange___nonzero__
%End

%Extract(id=pycode_richtext)
def _RichTextRange___bool__(self):
    return self.Get() != (0,0)
RichTextRange.__bool__ = _RichTextRange___bool__
del _RichTextRange___bool__
%End

%Extract(id=pycode_richtext)
def _RichTextRange___reduce__(self):
    return (RichTextRange, self.Get())
RichTextRange.__reduce__ = _RichTextRange___reduce__
del _RichTextRange___reduce__
%End

%Extract(id=pycode_richtext)
def _RichTextRange___getitem__(self, idx):
    return self.Get()[idx]
RichTextRange.__getitem__ = _RichTextRange___getitem__
del _RichTextRange___getitem__
%End

%Extract(id=pycode_richtext)
def _RichTextRange___setitem__(self, idx, val):
    if idx == 0: self.Start = val
    elif idx == 1: self.End = val
    else: raise IndexError
RichTextRange.__setitem__ = _RichTextRange___setitem__
del _RichTextRange___setitem__
%End

%Extract(id=pycode_richtext)
RichTextRange.__safe_for_unpickling__ = True

%End

%Extract(id=pycode_richtext)
RICHTEXT_ALL = RichTextRange(-2, -2)
RICHTEXT_NONE = RichTextRange(-1, -1)
RICHTEXT_NO_SELECTION = RichTextRange(-2, -2)

%End

class wxRichTextSelection
{
    %Docstring
        RichTextSelection(sel)
        RichTextSelection(range, container)
        RichTextSelection()
        
        Stores selection information.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextSelection(
        const wxRichTextSelection & sel
    );

    wxRichTextSelection(
        const wxRichTextRange & range,
        wxRichTextParagraphLayoutBox * container
    );

    wxRichTextSelection();

    wxRichTextRangeArray m_ranges;

    wxRichTextParagraphLayoutBox * m_container;

    void Reset();
    %Docstring
        Reset()
        
        Resets the selection.
    %End

    void Set(
        const wxRichTextRange & range,
        wxRichTextParagraphLayoutBox * container
    );
    %Docstring
        Set(range, container)
        Set(ranges, container)
        
        Sets the selection.
    %End

    void Set(
        const wxRichTextRangeArray & ranges,
        wxRichTextParagraphLayoutBox * container
    );

    void Add(
        const wxRichTextRange & range
    );
    %Docstring
        Add(range)
        
        Adds a range to the selection.
    %End

    void Copy(
        const wxRichTextSelection & sel
    );
    %Docstring
        Copy(sel)
        
        Copies from sel.
    %End

    bool operator==(
        const wxRichTextSelection & sel
    ) const;

    wxRichTextRangeArray & GetRanges();
    %Docstring
        GetRanges() -> RichTextRangeArray
        
        Returns the selection ranges.
    %End

    void SetRanges(
        const wxRichTextRangeArray & ranges
    );
    %Docstring
        SetRanges(ranges)
        
        Sets the selection ranges.
    %End

    size_t GetCount() const;
    %Docstring
        GetCount() -> size_t
        
        Returns the number of ranges in the selection.
    %End

    wxRichTextRange GetRange(
        size_t i
    ) const;
    %Docstring
        GetRange(i) -> RichTextRange
        GetRange() -> RichTextRange
        
        Returns the range at the given index.
    %End

    wxRichTextRange GetRange() const;

    void SetRange(
        const wxRichTextRange & range
    );
    %Docstring
        SetRange(range)
        
        Sets a single range.
    %End

    wxRichTextParagraphLayoutBox * GetContainer() const;
    %Docstring
        GetContainer() -> RichTextParagraphLayoutBox
        
        Returns the container for which the selection is valid.
    %End

    void SetContainer(
        wxRichTextParagraphLayoutBox * container
    );
    %Docstring
        SetContainer(container)
        
        Sets the container for which the selection is valid.
    %End

    bool IsValid() const;
    %Docstring
        IsValid() -> bool
        
        Returns true if the selection is valid.
    %End

    wxRichTextRangeArray GetSelectionForObject(
        wxRichTextObject * obj
    ) const;
    %Docstring
        GetSelectionForObject(obj) -> RichTextRangeArray
        
        Returns the selection appropriate to the specified object, if any;
        returns an empty array if none at the level of the object's container.
    %End

    bool WithinSelection(
        long pos,
        wxRichTextObject * obj
    ) const;
    %Docstring
        WithinSelection(pos, obj) -> bool
        WithinSelection(pos) -> bool
        WithinSelection(pos, ranges) -> bool
        WithinSelection(range, ranges) -> bool
        
        Returns true if the given position is within the selection.
    %End

    bool WithinSelection(
        long pos
    ) const;

    static
    bool WithinSelection(
        long pos,
        const wxRichTextRangeArray & ranges
    );

    static
    bool WithinSelection(
        const wxRichTextRange & range,
        const wxRichTextRangeArray & ranges
    );

    int __nonzero__();
    %Docstring
        __nonzero__() -> int
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxRichTextSelection___nonzero__(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    int _wxRichTextSelection___nonzero__(wxRichTextSelection* self)
    {
        return self->IsValid();
    }
    %End

    int __bool__();
    %Docstring
        __bool__() -> int
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxRichTextSelection___bool__(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    int _wxRichTextSelection___bool__(wxRichTextSelection* self)
    {
        return self->IsValid();
    }
    %End

    public:


    %Property(name=Container, get=GetContainer, set=SetContainer)
    %Property(name=Count, get=GetCount)
    %Property(name=Range, get=GetRange, set=SetRange)
    %Property(name=Ranges, get=GetRanges, set=SetRanges)
};  // end of class wxRichTextSelection


class wxRichTextDrawingContext : wxObject
{
    %Docstring
        RichTextDrawingContext(buffer)
        
        A class for passing information to drawing and measuring functions.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextDrawingContext(
        wxRichTextBuffer * buffer
    );

    wxRichTextBuffer * m_buffer;

    bool m_enableVirtualAttributes;

    bool m_enableImages;

    bool m_enableDelayedImageLoading;

    bool m_layingOut;

    void Init();
    %Docstring
        Init()
    %End

    bool HasVirtualAttributes(
        wxRichTextObject * obj
    ) const;
    %Docstring
        HasVirtualAttributes(obj) -> bool
        
        Does this object have virtual attributes? Virtual attributes can be
        provided for visual cues without affecting the actual styling.
    %End

    wxRichTextAttr GetVirtualAttributes(
        wxRichTextObject * obj
    ) const;
    %Docstring
        GetVirtualAttributes(obj) -> RichTextAttr
        
        Returns the virtual attributes for this object.
    %End

    bool ApplyVirtualAttributes(
        wxRichTextAttr & attr,
        wxRichTextObject * obj
    ) const;
    %Docstring
        ApplyVirtualAttributes(attr, obj) -> bool
        
        Applies any virtual attributes relevant to this object.
    %End

    int GetVirtualSubobjectAttributesCount(
        wxRichTextObject * obj
    ) const;
    %Docstring
        GetVirtualSubobjectAttributesCount(obj) -> int
        
        Gets the count for mixed virtual attributes for individual positions
        within the object.
    %End

    int GetVirtualSubobjectAttributes(
        wxRichTextObject * obj,
        wxArrayInt & positions,
        wxRichTextAttrArray & attributes
    ) const;
    %Docstring
        GetVirtualSubobjectAttributes(obj, positions, attributes) -> int
        
        Gets the mixed virtual attributes for individual positions within the
        object.
    %End

    bool HasVirtualText(
        const wxRichTextPlainText * obj
    ) const;
    %Docstring
        HasVirtualText(obj) -> bool
        
        Do we have virtual text for this object? Virtual text allows an
        application to replace characters in an object for editing and display
        purposes, for example for highlighting special characters.
    %End

    bool GetVirtualText(
        const wxRichTextPlainText * obj,
        wxString & text
    ) const;
    %Docstring
        GetVirtualText(obj, text) -> bool
        
        Gets the virtual text for this object.
    %End

    void EnableVirtualAttributes(
        bool b
    );
    %Docstring
        EnableVirtualAttributes(b)
        
        Enables virtual attribute processing.
    %End

    bool GetVirtualAttributesEnabled() const;
    %Docstring
        GetVirtualAttributesEnabled() -> bool
        
        Returns true if virtual attribute processing is enabled.
    %End

    void EnableImages(
        bool b
    );
    %Docstring
        EnableImages(b)
        
        Enable or disable images.
    %End

    bool GetImagesEnabled() const;
    %Docstring
        GetImagesEnabled() -> bool
        
        Returns true if images are enabled.
    %End

    void SetLayingOut(
        bool b
    );
    %Docstring
        SetLayingOut(b)
        
        Set laying out flag.
    %End

    bool GetLayingOut() const;
    %Docstring
        GetLayingOut() -> bool
        
        Returns true if laying out.
    %End

    void EnableDelayedImageLoading(
        bool b
    );
    %Docstring
        EnableDelayedImageLoading(b)
        
        Enable or disable delayed image loading.
    %End

    bool GetDelayedImageLoading() const;
    %Docstring
        GetDelayedImageLoading() -> bool
        
        Returns true if delayed image loading is enabled.
    %End

    public:


    %Property(name=DelayedImageLoading, get=GetDelayedImageLoading)
    %Property(name=ImagesEnabled, get=GetImagesEnabled)
    %Property(name=LayingOut, get=GetLayingOut, set=SetLayingOut)
    %Property(name=VirtualAttributesEnabled, get=GetVirtualAttributesEnabled)
};  // end of class wxRichTextDrawingContext


class wxRichTextObject : wxObject
{
    %Docstring
        RichTextObject(parent=None)
        
        This is the base for drawable rich text objects.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextObject(
        wxRichTextObject * parent = NULL
    );

    virtual
    ~wxRichTextObject();

    virtual
    bool Draw(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRichTextRange & range,
        const wxRichTextSelection & selection,
        const wxRect & rect,
        int descent,
        int style
    ) = 0;
    %Docstring
        Draw(dc, context, range, selection, rect, descent, style) -> bool
        
        Draw the item, within the given range.
    %End

    virtual
    bool Layout(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRect & rect,
        const wxRect & parentRect,
        int style
    ) = 0;
    %Docstring
        Layout(dc, context, rect, parentRect, style) -> bool
        
        Lay the item out at the specified position with the given size
        constraint.
    %End

    virtual
    int HitTest(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxPoint & pt,
        long & textPosition   /Out/,
        wxRichTextObject ** obj   /Out/,
        wxRichTextObject ** contextObj   /Out/,
        int flags = 0
    );
    %Docstring
        HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj)
        
        Hit-testing: returns a flag indicating hit test details, plus
        information about position.
    %End

    virtual
    bool FindPosition(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        long index,
        wxPoint & pt   /Out/,
        int * height   /Out/,
        bool forceLineStart
    );
    %Docstring
        FindPosition(dc, context, index, forceLineStart) -> (bool, pt, height)
        
        Finds the absolute position and row height for the given character
        position.
    %End

    virtual
    wxSize GetBestSize() const;
    %Docstring
        GetBestSize() -> wx.Size
        
        Returns the best size, i.e. the ideal starting size for this object
        irrespective of available space.
    %End

    virtual
    bool GetRangeSize(
        const wxRichTextRange & range,
        wxSize & size,
        int & descent,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        int flags,
        const wxPoint & position = wxPoint(0, 0),
        const wxSize & parentSize = wxDefaultSize,
        wxArrayInt * partialExtents = NULL
    ) const = 0;
    %Docstring
        GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool
        
        Returns the object size for the given range.
    %End

    virtual
    wxRichTextObject * DoSplit(
        long pos
    );
    %Docstring
        DoSplit(pos) -> RichTextObject
        
        Do a split from pos, returning an object containing the second part,
        and setting the first part in 'this'.
    %End

    virtual
    void CalculateRange(
        long start,
        long & end   /Out/
    );
    %Docstring
        CalculateRange(start) -> end
        
        Calculates the range of the object.
    %End

    virtual
    bool DeleteRange(
        const wxRichTextRange & range
    );
    %Docstring
        DeleteRange(range) -> bool
        
        Deletes the given range.
    %End

    virtual
    bool IsEmpty() const;
    %Docstring
        IsEmpty() -> bool
        
        Returns true if the object is empty.
    %End

    virtual
    bool IsFloatable() const;
    %Docstring
        IsFloatable() -> bool
        
        Returns true if this class of object is floatable.
    %End

    virtual
    bool IsFloating() const;
    %Docstring
        IsFloating() -> bool
        
        Returns true if this object is currently floating.
    %End

    virtual
    int GetFloatDirection() const;
    %Docstring
        GetFloatDirection() -> int
        
        Returns the floating direction.
    %End

    virtual
    wxString GetTextForRange(
        const wxRichTextRange & range
    ) const;
    %Docstring
        GetTextForRange(range) -> String
        
        Returns any text in this object for the given range.
    %End

    virtual
    bool CanMerge(
        wxRichTextObject * object,
        wxRichTextDrawingContext & context
    ) const;
    %Docstring
        CanMerge(object, context) -> bool
        
        Returns true if this object can merge itself with the given one.
    %End

    virtual
    bool Merge(
        wxRichTextObject * object,
        wxRichTextDrawingContext & context
    );
    %Docstring
        Merge(object, context) -> bool
        
        Returns true if this object merged itself with the given one.
    %End

    virtual
    bool CanSplit(
        wxRichTextDrawingContext & context
    ) const;
    %Docstring
        CanSplit(context) -> bool
        
        Returns true if this object can potentially be split, by virtue of
        having different virtual attributes for individual sub-objects.
    %End

    virtual
    wxRichTextObject * Split(
        wxRichTextDrawingContext & context
    );
    %Docstring
        Split(context) -> RichTextObject
        
        Returns the final object in the split objects if this object was split
        due to differences between sub-object virtual attributes.
    %End

    virtual
    bool CanEditProperties() const;
    %Docstring
        CanEditProperties() -> bool
        
        Returns true if we can edit the object's properties via a GUI.
    %End

    virtual
    bool EditProperties(
        wxWindow * parent,
        wxRichTextBuffer * buffer
    );
    %Docstring
        EditProperties(parent, buffer) -> bool
        
        Edits the object's properties via a GUI.
    %End

    virtual
    wxString GetPropertiesMenuLabel() const;
    %Docstring
        GetPropertiesMenuLabel() -> String
        
        Returns the label to be used for the properties context menu item.
    %End

    virtual
    bool AcceptsFocus() const;
    %Docstring
        AcceptsFocus() -> bool
        
        Returns true if objects of this class can accept the focus, i.e. a
        call to SetFocusObject is possible.
    %End

    virtual
    bool ImportFromXML(
        wxRichTextBuffer * buffer,
        wxXmlNode * node,
        wxRichTextXMLHandler * handler,
        bool * recurse
    );
    %Docstring
        ImportFromXML(buffer, node, handler, recurse) -> bool
        
        Imports this object from XML.
    %End

    virtual
    bool UsesParagraphAttributes() const;
    %Docstring
        UsesParagraphAttributes() -> bool
        
        Returns true if this object takes note of paragraph attributes (text
        and image objects don't).
    %End

    virtual
    wxString GetXMLNodeName() const;
    %Docstring
        GetXMLNodeName() -> String
        
        Returns the XML node name of this object.
    %End

    virtual
    void Invalidate(
        const wxRichTextRange & invalidRange = wxRICHTEXT_ALL
    );
    %Docstring
        Invalidate(invalidRange=RICHTEXT_ALL)
        
        Invalidates the object at the given range.
    %End

    virtual
    bool HandlesChildSelections() const;
    %Docstring
        HandlesChildSelections() -> bool
        
        Returns true if this object can handle the selections of its children,
        fOr example a table.
    %End

    virtual
    wxRichTextSelection GetSelection(
        long start,
        long end
    ) const;
    %Docstring
        GetSelection(start, end) -> RichTextSelection
        
        Returns a selection object specifying the selections between start and
        end character positions.
    %End

    virtual
    wxSize GetCachedSize() const;
    %Docstring
        GetCachedSize() -> wx.Size
        
        Gets the cached object size as calculated by Layout.
    %End

    virtual
    void SetCachedSize(
        const wxSize & sz
    );
    %Docstring
        SetCachedSize(sz)
        
        Sets the cached object size as calculated by Layout.
    %End

    virtual
    wxSize GetMaxSize() const;
    %Docstring
        GetMaxSize() -> wx.Size
        
        Gets the maximum object size as calculated by Layout.
    %End

    virtual
    void SetMaxSize(
        const wxSize & sz
    );
    %Docstring
        SetMaxSize(sz)
        
        Sets the maximum object size as calculated by Layout.
    %End

    virtual
    wxSize GetMinSize() const;
    %Docstring
        GetMinSize() -> wx.Size
        
        Gets the minimum object size as calculated by Layout.
    %End

    virtual
    void SetMinSize(
        const wxSize & sz
    );
    %Docstring
        SetMinSize(sz)
        
        Sets the minimum object size as calculated by Layout.
    %End

    virtual
    wxTextAttrSize GetNaturalSize() const;
    %Docstring
        GetNaturalSize() -> TextAttrSize
        
        Gets the 'natural' size for an object.
    %End

    virtual
    wxPoint GetPosition() const;
    %Docstring
        GetPosition() -> wx.Point
        
        Returns the object position in pixels.
    %End

    virtual
    void SetPosition(
        const wxPoint & pos
    );
    %Docstring
        SetPosition(pos)
        
        Sets the object position in pixels.
    %End

    virtual
    wxPoint GetAbsolutePosition() const;
    %Docstring
        GetAbsolutePosition() -> wx.Point
        
        Returns the absolute object position, by traversing up the
        child/parent hierarchy.
    %End

    virtual
    wxRect GetRect() const;
    %Docstring
        GetRect() -> wx.Rect
        
        Returns the rectangle enclosing the object.
    %End

    void SetRange(
        const wxRichTextRange & range
    );
    %Docstring
        SetRange(range)
        
        Sets the object's range within its container.
    %End

    wxRichTextRange & GetRange();
    %Docstring
        GetRange() -> RichTextRange
        
        Returns the object's range.
    %End

    void SetOwnRange(
        const wxRichTextRange & range
    );
    %Docstring
        SetOwnRange(range)
        
        Set the object's own range, for a top-level object with its own
        position space.
    %End

    wxRichTextRange & GetOwnRange();
    %Docstring
        GetOwnRange() -> RichTextRange
        
        Returns the object's own range (valid if top-level).
    %End

    wxRichTextRange GetOwnRangeIfTopLevel() const;
    %Docstring
        GetOwnRangeIfTopLevel() -> RichTextRange
        
        Returns the object's own range only if a top-level object.
    %End

    virtual
    bool IsComposite() const;
    %Docstring
        IsComposite() -> bool
        
        Returns true if this object is composite.
    %End

    virtual
    bool IsAtomic() const;
    %Docstring
        IsAtomic() -> bool
        
        Returns true if no user editing can be done inside the object.
    %End

    virtual
    wxRichTextObject * GetParent() const;
    %Docstring
        GetParent() -> RichTextObject
        
        Returns a pointer to the parent object.
    %End

    virtual
    void SetParent(
        wxRichTextObject * parent
    );
    %Docstring
        SetParent(parent)
        
        Sets the pointer to the parent object.
    %End

    virtual
    wxRichTextParagraphLayoutBox * GetContainer() const;
    %Docstring
        GetContainer() -> RichTextParagraphLayoutBox
        
        Returns the top-level container of this object.
    %End

    virtual
    wxRichTextParagraphLayoutBox * GetParentContainer() const;
    %Docstring
        GetParentContainer() -> RichTextParagraphLayoutBox
        
        Returns the top-level container of this object.
    %End

    virtual
    void SetMargins(
        int margin
    );
    %Docstring
        SetMargins(margin)
        SetMargins(leftMargin, rightMargin, topMargin, bottomMargin)
        
        Set the margin around the object, in pixels.
    %End

    virtual
    void SetMargins(
        int leftMargin,
        int rightMargin,
        int topMargin,
        int bottomMargin
    );

    virtual
    int GetLeftMargin() const;
    %Docstring
        GetLeftMargin() -> int
        
        Returns the left margin of the object, in pixels.
    %End

    virtual
    int GetRightMargin() const;
    %Docstring
        GetRightMargin() -> int
        
        Returns the right margin of the object, in pixels.
    %End

    virtual
    int GetTopMargin() const;
    %Docstring
        GetTopMargin() -> int
        
        Returns the top margin of the object, in pixels.
    %End

    virtual
    int GetBottomMargin() const;
    %Docstring
        GetBottomMargin() -> int
        
        Returns the bottom margin of the object, in pixels.
    %End

    virtual
    wxRect GetAvailableContentArea(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRect & outerRect
    ) const;
    %Docstring
        GetAvailableContentArea(dc, context, outerRect) -> wx.Rect
        
        Calculates the available content space in the given rectangle, given
        the margins, border and padding specified in the object's attributes.
    %End

    virtual
    bool LayoutToBestSize(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        wxRichTextBuffer * buffer,
        const wxRichTextAttr & parentAttr,
        const wxRichTextAttr & attr,
        const wxRect & availableParentSpace,
        const wxRect & availableContainerSpace,
        int style
    );
    %Docstring
        LayoutToBestSize(dc, context, buffer, parentAttr, attr, availableParentSpace, availableContainerSpace, style) -> bool
        
        Lays out the object first with a given amount of space, and then if no
        width was specified in attr, lays out the object again using the
        minimum size.
    %End

    virtual
    bool AdjustAttributes(
        wxRichTextAttr & attr,
        wxRichTextDrawingContext & context
    );
    %Docstring
        AdjustAttributes(attr, context) -> bool
        
        Adjusts the attributes for virtual attribute provision, collapsed
        borders, etc.
    %End

    void SetAttributes(
        const wxRichTextAttr & attr
    );
    %Docstring
        SetAttributes(attr)
        
        Sets the object's attributes.
    %End

    wxRichTextAttr & GetAttributes();
    %Docstring
        GetAttributes() -> RichTextAttr
        
        Returns the object's attributes.
    %End

    wxRichTextProperties & GetProperties();
    %Docstring
        GetProperties() -> RichTextProperties
        
        Returns the object's properties.
    %End

    void SetProperties(
        const wxRichTextProperties & props
    );
    %Docstring
        SetProperties(props)
        
        Sets the object's properties.
    %End

    void SetDescent(
        int descent
    );
    %Docstring
        SetDescent(descent)
        
        Sets the stored descent value.
    %End

    int GetDescent() const;
    %Docstring
        GetDescent() -> int
        
        Returns the stored descent value.
    %End

    wxRichTextBuffer * GetBuffer() const;
    %Docstring
        GetBuffer() -> RichTextBuffer
        
        Returns the containing buffer.
    %End

    void SetName(
        const wxString & name
    );
    %Docstring
        SetName(name)
        
        Sets the identifying name for this object as a property using the
        "name" key.
    %End

    wxString GetName() const;
    %Docstring
        GetName() -> String
        
        Returns the identifying name for this object from the properties,
        using the "name" key.
    %End

    virtual
    bool IsTopLevel() const;
    %Docstring
        IsTopLevel() -> bool
        
        Returns true if this object is top-level, i.e. contains its own
        paragraphs, such as a text box.
    %End

    bool IsShown() const;
    %Docstring
        IsShown() -> bool
        
        Returns true if the object will be shown, false otherwise.
    %End

    virtual
    void Show(
        bool show
    );
    %Docstring
        Show(show)
        
        Call to show or hide this object.
    %End

    virtual
    wxRichTextObject * Clone() const   /Factory/;
    %Docstring
        Clone() -> RichTextObject
        
        Clones the object.
    %End

    void Copy(
        const wxRichTextObject & obj
    );
    %Docstring
        Copy(obj)
        
        Copies the object.
    %End

    void Reference();
    %Docstring
        Reference()
        
        Reference-counting allows us to use the same object in multiple lists
        (not yet used).
    %End

    void Dereference();
    %Docstring
        Dereference()
        
        Reference-counting allows us to use the same object in multiple lists
        (not yet used).
    %End

    virtual
    void Move(
        const wxPoint & pt
    );
    %Docstring
        Move(pt)
        
        Moves the object recursively, by adding the offset from old to new.
    %End

    int ConvertTenthsMMToPixels(
        wxDC & dc,
        int units
    ) const;
    %Docstring
        ConvertTenthsMMToPixels(dc, units) -> int
        ConvertTenthsMMToPixels(ppi, units, scale=1.0) -> int
        
        Converts units in tenths of a millimetre to device units.
    %End

    static
    int ConvertTenthsMMToPixels(
        int ppi,
        int units,
        double scale = 1.0
    );

    int ConvertPixelsToTenthsMM(
        wxDC & dc,
        int pixels
    ) const;
    %Docstring
        ConvertPixelsToTenthsMM(dc, pixels) -> int
        ConvertPixelsToTenthsMM(ppi, pixels, scale=1.0) -> int
        
        Convert units in pixels to tenths of a millimetre.
    %End

    static
    int ConvertPixelsToTenthsMM(
        int ppi,
        int pixels,
        double scale = 1.0
    );

    static
    bool DrawBoxAttributes(
        wxDC & dc,
        wxRichTextBuffer * buffer,
        const wxRichTextAttr & attr,
        const wxRect & boxRect,
        int flags = 0,
        wxRichTextObject * obj = NULL
    );
    %Docstring
        DrawBoxAttributes(dc, buffer, attr, boxRect, flags=0, obj=None) -> bool
        
        Draws the borders and background for the given rectangle and
        attributes.
    %End

    static
    bool DrawBorder(
        wxDC & dc,
        wxRichTextBuffer * buffer,
        const wxRichTextAttr & attr,
        const wxTextAttrBorders & borders,
        const wxRect & rect,
        int flags = 0
    );
    %Docstring
        DrawBorder(dc, buffer, attr, borders, rect, flags=0) -> bool
        
        Draws a border.
    %End

    static
    bool GetBoxRects(
        wxDC & dc,
        wxRichTextBuffer * buffer,
        const wxRichTextAttr & attr,
        wxRect & marginRect   /Out/,
        wxRect & borderRect   /Out/,
        wxRect & contentRect   /Out/,
        wxRect & paddingRect   /Out/,
        wxRect & outlineRect   /Out/
    );
    %Docstring
        GetBoxRects(dc, buffer, attr) -> (bool, marginRect, borderRect, contentRect, paddingRect, outlineRect)
        
        Returns the various rectangles of the box model in pixels.
    %End

    static
    bool GetTotalMargin(
        wxDC & dc,
        wxRichTextBuffer * buffer,
        const wxRichTextAttr & attr,
        int & leftMargin   /Out/,
        int & rightMargin   /Out/,
        int & topMargin   /Out/,
        int & bottomMargin   /Out/
    );
    %Docstring
        GetTotalMargin(dc, buffer, attr) -> (bool, leftMargin, rightMargin, topMargin, bottomMargin)
        
        Returns the total margin for the object in pixels, taking into account
        margin, padding and border size.
    %End

    static
    wxRect AdjustAvailableSpace(
        wxDC & dc,
        wxRichTextBuffer * buffer,
        const wxRichTextAttr & parentAttr,
        const wxRichTextAttr & childAttr,
        const wxRect & availableParentSpace,
        const wxRect & availableContainerSpace
    );
    %Docstring
        AdjustAvailableSpace(dc, buffer, parentAttr, childAttr, availableParentSpace, availableContainerSpace) -> wx.Rect
        
        Returns the rectangle which the child has available to it given
        restrictions specified in the child attribute, e.g.
    %End

    public:


    %Property(name=AbsolutePosition, get=GetAbsolutePosition)
    %Property(name=Attributes, get=GetAttributes, set=SetAttributes)
    %Property(name=BestSize, get=GetBestSize)
    %Property(name=BottomMargin, get=GetBottomMargin)
    %Property(name=Buffer, get=GetBuffer)
    %Property(name=CachedSize, get=GetCachedSize, set=SetCachedSize)
    %Property(name=Container, get=GetContainer)
    %Property(name=Descent, get=GetDescent, set=SetDescent)
    %Property(name=FloatDirection, get=GetFloatDirection)
    %Property(name=LeftMargin, get=GetLeftMargin)
    %Property(name=MaxSize, get=GetMaxSize, set=SetMaxSize)
    %Property(name=MinSize, get=GetMinSize, set=SetMinSize)
    %Property(name=Name, get=GetName, set=SetName)
    %Property(name=NaturalSize, get=GetNaturalSize)
    %Property(name=OwnRange, get=GetOwnRange, set=SetOwnRange)
    %Property(name=OwnRangeIfTopLevel, get=GetOwnRangeIfTopLevel)
    %Property(name=Parent, get=GetParent, set=SetParent)
    %Property(name=ParentContainer, get=GetParentContainer)
    %Property(name=Position, get=GetPosition, set=SetPosition)
    %Property(name=Properties, get=GetProperties, set=SetProperties)
    %Property(name=PropertiesMenuLabel, get=GetPropertiesMenuLabel)
    %Property(name=Range, get=GetRange, set=SetRange)
    %Property(name=Rect, get=GetRect)
    %Property(name=RightMargin, get=GetRightMargin)
    %Property(name=TopMargin, get=GetTopMargin)
    %Property(name=XMLNodeName, get=GetXMLNodeName)
};  // end of class wxRichTextObject


class wxRichTextCompositeObject : wxRichTextObject
{
    %Docstring
        RichTextCompositeObject(parent=None)
        
        Objects of this class can contain other objects.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextCompositeObject(
        wxRichTextObject * parent = NULL
    );

    virtual
    ~wxRichTextCompositeObject();

    virtual
    int HitTest(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxPoint & pt,
        long & textPosition   /Out/,
        wxRichTextObject ** obj   /Out/,
        wxRichTextObject ** contextObj   /Out/,
        int flags = 0
    );
    %Docstring
        HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj)
        
        Hit-testing: returns a flag indicating hit test details, plus
        information about position.
    %End

    virtual
    bool FindPosition(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        long index,
        wxPoint & pt   /Out/,
        int * height   /Out/,
        bool forceLineStart
    );
    %Docstring
        FindPosition(dc, context, index, forceLineStart) -> (bool, pt, height)
        
        Finds the absolute position and row height for the given character
        position.
    %End

    virtual
    void CalculateRange(
        long start,
        long & end   /Out/
    );
    %Docstring
        CalculateRange(start) -> end
        
        Calculates the range of the object.
    %End

    virtual
    bool DeleteRange(
        const wxRichTextRange & range
    );
    %Docstring
        DeleteRange(range) -> bool
        
        Deletes the given range.
    %End

    virtual
    wxString GetTextForRange(
        const wxRichTextRange & range
    ) const;
    %Docstring
        GetTextForRange(range) -> String
        
        Returns any text in this object for the given range.
    %End

    virtual
    bool GetRangeSize(
        const wxRichTextRange & range,
        wxSize & size,
        int & descent,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        int flags,
        const wxPoint & position = wxPoint(0, 0),
        const wxSize & parentSize = wxDefaultSize,
        wxArrayInt * partialExtents = NULL
    ) const;
    %Docstring
        GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool
        
        Returns the object size for the given range.
    %End

    virtual
    void Invalidate(
        const wxRichTextRange & invalidRange = wxRICHTEXT_ALL
    );
    %Docstring
        Invalidate(invalidRange=RICHTEXT_ALL)
        
        Invalidates the object at the given range.
    %End

    wxRichTextObjectList & GetChildren();
    %Docstring
        GetChildren() -> RichTextObjectList
        
        Returns the children.
    %End

    size_t GetChildCount() const;
    %Docstring
        GetChildCount() -> size_t
        
        Returns the number of children.
    %End

    wxRichTextObject * GetChild(
        size_t n
    ) const;
    %Docstring
        GetChild(n) -> RichTextObject
        
        Returns the nth child.
    %End

    virtual
    bool IsComposite() const;
    %Docstring
        IsComposite() -> bool
        
        Returns true if this object is composite.
    %End

    virtual
    bool IsAtomic() const;
    %Docstring
        IsAtomic() -> bool
        
        Returns true if no user editing can be done inside the object.
    %End

    virtual
    bool IsEmpty() const;
    %Docstring
        IsEmpty() -> bool
        
        Returns true if the buffer is empty.
    %End

    virtual
    wxRichTextObject * GetChildAtPosition(
        long pos
    ) const;
    %Docstring
        GetChildAtPosition(pos) -> RichTextObject
        
        Returns the child object at the given character position.
    %End

    void Copy(
        const wxRichTextCompositeObject & obj
    );
    %Docstring
        Copy(obj)
    %End

    size_t AppendChild(
        wxRichTextObject * child
    );
    %Docstring
        AppendChild(child) -> size_t
        
        Appends a child, returning the position.
    %End

    bool InsertChild(
        wxRichTextObject * child,
        wxRichTextObject * inFrontOf
    );
    %Docstring
        InsertChild(child, inFrontOf) -> bool
        
        Inserts the child in front of the given object, or at the beginning.
    %End

    bool RemoveChild(
        wxRichTextObject * child,
        bool deleteChild = false
    );
    %Docstring
        RemoveChild(child, deleteChild=False) -> bool
        
        Removes and optionally deletes the specified child.
    %End

    bool DeleteChildren();
    %Docstring
        DeleteChildren() -> bool
        
        Deletes all the children.
    %End

    bool Defragment(
        wxRichTextDrawingContext & context,
        const wxRichTextRange & range = wxRICHTEXT_ALL
    );
    %Docstring
        Defragment(context, range=RICHTEXT_ALL) -> bool
        
        Recursively merges all pieces that can be merged.
    %End

    virtual
    void Move(
        const wxPoint & pt
    );
    %Docstring
        Move(pt)
        
        Moves the object recursively, by adding the offset from old to new.
    %End

                virtual wxRichTextObject* Clone() const /Factory/;


    public:


    %Property(name=ChildCount, get=GetChildCount)
    %Property(name=Children, get=GetChildren)
};  // end of class wxRichTextCompositeObject


class wxRichTextParagraphLayoutBox : wxRichTextCompositeObject
{
    %Docstring
        RichTextParagraphLayoutBox(parent=None)
        RichTextParagraphLayoutBox(obj)
        
        This class knows how to lay out paragraphs.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextParagraphLayoutBox(
        wxRichTextObject * parent = NULL
    );

    wxRichTextParagraphLayoutBox(
        const wxRichTextParagraphLayoutBox & obj
    );

    ~wxRichTextParagraphLayoutBox();

    virtual
    bool SetListStyle(
        const wxRichTextRange & range,
        wxRichTextListStyleDefinition * styleDef,
        int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
        int startFrom = 1,
        int specifiedLevel = -1
    );
    %Docstring
        SetListStyle(range, styleDef, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1) -> bool
        SetListStyle(range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1) -> bool
        
        Sets the list attributes for the given range, passing flags to
        determine how the attributes are set.
    %End

    virtual
    bool SetListStyle(
        const wxRichTextRange & range,
        const wxString & defName,
        int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
        int startFrom = 1,
        int specifiedLevel = -1
    );

    virtual
    bool NumberList(
        const wxRichTextRange & range,
        wxRichTextListStyleDefinition * def = NULL,
        int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
        int startFrom = 1,
        int specifiedLevel = -1
    );
    %Docstring
        NumberList(range, def=None, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1) -> bool
        NumberList(range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1) -> bool
        
        Numbers the paragraphs in the given range.
    %End

    virtual
    bool NumberList(
        const wxRichTextRange & range,
        const wxString & defName,
        int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
        int startFrom = 1,
        int specifiedLevel = -1
    );

    virtual
    bool PromoteList(
        int promoteBy,
        const wxRichTextRange & range,
        wxRichTextListStyleDefinition * def = NULL,
        int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
        int specifiedLevel = -1
    );
    %Docstring
        PromoteList(promoteBy, range, def=None, flags=RICHTEXT_SETSTYLE_WITH_UNDO, specifiedLevel=-1) -> bool
        PromoteList(promoteBy, range, defName, flags=RICHTEXT_SETSTYLE_WITH_UNDO, specifiedLevel=-1) -> bool
        
        Promotes the list items within the given range.
    %End

    virtual
    bool PromoteList(
        int promoteBy,
        const wxRichTextRange & range,
        const wxString & defName,
        int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
        int specifiedLevel = -1
    );

    virtual
    int HitTest(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxPoint & pt,
        long & textPosition   /Out/,
        wxRichTextObject ** obj   /Out/,
        wxRichTextObject ** contextObj   /Out/,
        int flags = 0
    );
    %Docstring
        HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj)
        
        Hit-testing: returns a flag indicating hit test details, plus
        information about position.
    %End

    virtual
    bool Draw(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRichTextRange & range,
        const wxRichTextSelection & selection,
        const wxRect & rect,
        int descent,
        int style
    );
    %Docstring
        Draw(dc, context, range, selection, rect, descent, style) -> bool
        
        Draw the item, within the given range.
    %End

    virtual
    bool Layout(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRect & rect,
        const wxRect & parentRect,
        int style
    );
    %Docstring
        Layout(dc, context, rect, parentRect, style) -> bool
        
        Lay the item out at the specified position with the given size
        constraint.
    %End

    virtual
    bool GetRangeSize(
        const wxRichTextRange & range,
        wxSize & size,
        int & descent,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        int flags,
        const wxPoint & position = wxPoint(0, 0),
        const wxSize & parentSize = wxDefaultSize,
        wxArrayInt * partialExtents = NULL
    ) const;
    %Docstring
        GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool
        
        Returns the object size for the given range.
    %End

    virtual
    bool DeleteRange(
        const wxRichTextRange & range
    );
    %Docstring
        DeleteRange(range) -> bool
        
        Deletes the given range.
    %End

    virtual
    wxString GetTextForRange(
        const wxRichTextRange & range
    ) const;
    %Docstring
        GetTextForRange(range) -> String
        
        Returns any text in this object for the given range.
    %End

    virtual
    bool ImportFromXML(
        wxRichTextBuffer * buffer,
        wxXmlNode * node,
        wxRichTextXMLHandler * handler,
        bool * recurse
    );
    %Docstring
        ImportFromXML(buffer, node, handler, recurse) -> bool
        
        Imports this object from XML.
    %End

    virtual
    wxString GetXMLNodeName() const;
    %Docstring
        GetXMLNodeName() -> String
        
        Returns the XML node name of this object.
    %End

    virtual
    bool AcceptsFocus() const;
    %Docstring
        AcceptsFocus() -> bool
        
        Returns true if objects of this class can accept the focus, i.e. a
        call to SetFocusObject is possible.
    %End

    void SetRichTextCtrl(
        wxRichTextCtrl * ctrl
    );
    %Docstring
        SetRichTextCtrl(ctrl)
        
        Associates a control with the buffer, for operations that for example
        require refreshing the window.
    %End

    wxRichTextCtrl * GetRichTextCtrl() const;
    %Docstring
        GetRichTextCtrl() -> RichTextCtrl
        
        Returns the associated control.
    %End

    void SetPartialParagraph(
        bool partialPara
    );
    %Docstring
        SetPartialParagraph(partialPara)
        
        Sets a flag indicating whether the last paragraph is partial or
        complete.
    %End

    bool GetPartialParagraph() const;
    %Docstring
        GetPartialParagraph() -> bool
        
        Returns a flag indicating whether the last paragraph is partial or
        complete.
    %End

    virtual
    wxRichTextStyleSheet * GetStyleSheet() const;
    %Docstring
        GetStyleSheet() -> RichTextStyleSheet
        
        Returns the style sheet associated with the overall buffer.
    %End

    virtual
    bool IsTopLevel() const;
    %Docstring
        IsTopLevel() -> bool
        
        Returns true if this object is top-level, i.e. contains its own
        paragraphs, such as a text box.
    %End

    bool InsertParagraphsWithUndo(
        wxRichTextBuffer * buffer,
        long pos,
        const wxRichTextParagraphLayoutBox & paragraphs,
        wxRichTextCtrl * ctrl,
        int flags = 0
    );
    %Docstring
        InsertParagraphsWithUndo(buffer, pos, paragraphs, ctrl, flags=0) -> bool
        
        Submits a command to insert paragraphs.
    %End

    bool InsertTextWithUndo(
        wxRichTextBuffer * buffer,
        long pos,
        const wxString & text,
        wxRichTextCtrl * ctrl,
        int flags = 0
    );
    %Docstring
        InsertTextWithUndo(buffer, pos, text, ctrl, flags=0) -> bool
        
        Submits a command to insert the given text.
    %End

    bool InsertNewlineWithUndo(
        wxRichTextBuffer * buffer,
        long pos,
        wxRichTextCtrl * ctrl,
        int flags = 0
    );
    %Docstring
        InsertNewlineWithUndo(buffer, pos, ctrl, flags=0) -> bool
        
        Submits a command to insert the given text.
    %End

    bool InsertImageWithUndo(
        wxRichTextBuffer * buffer,
        long pos,
        const wxRichTextImageBlock & imageBlock,
        wxRichTextCtrl * ctrl,
        int flags,
        const wxRichTextAttr & textAttr
    );
    %Docstring
        InsertImageWithUndo(buffer, pos, imageBlock, ctrl, flags, textAttr) -> bool
        
        Submits a command to insert the given image.
    %End

    wxRichTextField * InsertFieldWithUndo(
        wxRichTextBuffer * buffer,
        long pos,
        const wxString & fieldType,
        const wxRichTextProperties & properties,
        wxRichTextCtrl * ctrl,
        int flags,
        const wxRichTextAttr & textAttr
    );
    %Docstring
        InsertFieldWithUndo(buffer, pos, fieldType, properties, ctrl, flags, textAttr) -> RichTextField
        
        Submits a command to insert the given field.
    %End

    wxRichTextAttr GetStyleForNewParagraph(
        wxRichTextBuffer * buffer,
        long pos,
        bool caretPosition = false,
        bool lookUpNewParaStyle = false
    ) const;
    %Docstring
        GetStyleForNewParagraph(buffer, pos, caretPosition=False, lookUpNewParaStyle=False) -> RichTextAttr
        
        Returns the style that is appropriate for a new paragraph at this
        position.
    %End

    wxRichTextObject * InsertObjectWithUndo(
        wxRichTextBuffer * buffer,
        long pos,
        wxRichTextObject * object,
        wxRichTextCtrl * ctrl,
        int flags = 0
    );
    %Docstring
        InsertObjectWithUndo(buffer, pos, object, ctrl, flags=0) -> RichTextObject
        
        Inserts an object.
    %End

    bool DeleteRangeWithUndo(
        const wxRichTextRange & range,
        wxRichTextCtrl * ctrl,
        wxRichTextBuffer * buffer
    );
    %Docstring
        DeleteRangeWithUndo(range, ctrl, buffer) -> bool
        
        Submits a command to delete this range.
    %End

    void DrawFloats(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRichTextRange & range,
        const wxRichTextSelection & selection,
        const wxRect & rect,
        int descent,
        int style
    );
    %Docstring
        DrawFloats(dc, context, range, selection, rect, descent, style)
        
        Draws the floating objects in this buffer.
    %End

    void MoveAnchoredObjectToParagraph(
        wxRichTextParagraph * from_,
        wxRichTextParagraph * to_,
        wxRichTextObject * obj
    );
    %Docstring
        MoveAnchoredObjectToParagraph(from_, to_, obj)
        
        Moves an anchored object to another paragraph.
    %End

    void Init();
    %Docstring
        Init()
        
        Initializes the object.
    %End

    virtual
    void Clear();
    %Docstring
        Clear()
        
        Clears all the children.
    %End

    virtual
    void Reset();
    %Docstring
        Reset()
        
        Clears and initializes with one blank paragraph.
    %End

    virtual
    wxRichTextRange AddParagraph(
        const wxString & text,
        wxRichTextAttr * paraStyle = NULL
    );
    %Docstring
        AddParagraph(text, paraStyle=None) -> RichTextRange
        
        Convenience function to add a paragraph of text.
    %End

    virtual
    wxRichTextRange AddImage(
        const wxImage & image,
        wxRichTextAttr * paraStyle = NULL
    );
    %Docstring
        AddImage(image, paraStyle=None) -> RichTextRange
        
        Convenience function to add an image.
    %End

    virtual
    wxRichTextRange AddParagraphs(
        const wxString & text,
        wxRichTextAttr * paraStyle = NULL
    );
    %Docstring
        AddParagraphs(text, paraStyle=None) -> RichTextRange
        
        Adds multiple paragraphs, based on newlines.
    %End

    virtual
    wxRichTextLine * GetLineAtPosition(
        long pos,
        bool caretPosition = false
    ) const;
    %Docstring
        GetLineAtPosition(pos, caretPosition=False) -> RichTextLine
        
        Returns the line at the given position.
    %End

    virtual
    wxRichTextLine * GetLineAtYPosition(
        int y
    ) const;
    %Docstring
        GetLineAtYPosition(y) -> RichTextLine
        
        Returns the line at the given y pixel position, or the last line.
    %End

    virtual
    wxRichTextParagraph * GetParagraphAtPosition(
        long pos,
        bool caretPosition = false
    ) const;
    %Docstring
        GetParagraphAtPosition(pos, caretPosition=False) -> RichTextParagraph
        
        Returns the paragraph at the given character or caret position.
    %End

    virtual
    wxSize GetLineSizeAtPosition(
        long pos,
        bool caretPosition = false
    ) const;
    %Docstring
        GetLineSizeAtPosition(pos, caretPosition=False) -> wx.Size
        
        Returns the line size at the given position.
    %End

    virtual
    long GetVisibleLineNumber(
        long pos,
        bool caretPosition = false,
        bool startOfLine = false
    ) const;
    %Docstring
        GetVisibleLineNumber(pos, caretPosition=False, startOfLine=False) -> long
        
        Given a position, returns the number of the visible line (potentially
        many to a paragraph), starting from zero at the start of the buffer.
    %End

    virtual
    wxRichTextLine * GetLineForVisibleLineNumber(
        long lineNumber
    ) const;
    %Docstring
        GetLineForVisibleLineNumber(lineNumber) -> RichTextLine
        
        Given a line number, returns the corresponding wxRichTextLine object.
    %End

    virtual
    wxRichTextObject * GetLeafObjectAtPosition(
        long position
    ) const;
    %Docstring
        GetLeafObjectAtPosition(position) -> RichTextObject
        
        Returns the leaf object in a paragraph at this position.
    %End

    virtual
    wxRichTextParagraph * GetParagraphAtLine(
        long paragraphNumber
    ) const;
    %Docstring
        GetParagraphAtLine(paragraphNumber) -> RichTextParagraph
        
        Returns the paragraph by number.
    %End

    virtual
    wxRichTextParagraph * GetParagraphForLine(
        wxRichTextLine * line
    ) const;
    %Docstring
        GetParagraphForLine(line) -> RichTextParagraph
        
        Returns the paragraph for a given line.
    %End

    virtual
    int GetParagraphLength(
        long paragraphNumber
    ) const;
    %Docstring
        GetParagraphLength(paragraphNumber) -> int
        
        Returns the length of the paragraph.
    %End

    virtual
    int GetParagraphCount() const;
    %Docstring
        GetParagraphCount() -> int
        
        Returns the number of paragraphs.
    %End

    virtual
    int GetLineCount() const;
    %Docstring
        GetLineCount() -> int
        
        Returns the number of visible lines.
    %End

    virtual
    wxString GetParagraphText(
        long paragraphNumber
    ) const;
    %Docstring
        GetParagraphText(paragraphNumber) -> String
        
        Returns the text of the paragraph.
    %End

    virtual
    long XYToPosition(
        long x,
        long y
    ) const;
    %Docstring
        XYToPosition(x, y) -> long
        
        Converts zero-based line column and paragraph number to a position.
    %End

    virtual
    bool PositionToXY(
        long pos,
        long * x,
        long * y
    ) const;
    %Docstring
        PositionToXY(pos, x, y) -> bool
        
        Converts a zero-based position to line column and paragraph number.
    %End

    virtual
    bool SetStyle(
        const wxRichTextRange & range,
        const wxRichTextAttr & style,
        int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO
    );
    %Docstring
        SetStyle(range, style, flags=RICHTEXT_SETSTYLE_WITH_UNDO) -> bool
        SetStyle(obj, textAttr, flags=RICHTEXT_SETSTYLE_WITH_UNDO)
        
        Sets the attributes for the given range.
    %End

    virtual
    void SetStyle(
        wxRichTextObject * obj,
        const wxRichTextAttr & textAttr,
        int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO
    );

    virtual
    bool GetStyle(
        long position,
        wxRichTextAttr & style
    );
    %Docstring
        GetStyle(position, style) -> bool
        
        Returns the combined text attributes for this position.
    %End

    virtual
    bool GetUncombinedStyle(
        long position,
        wxRichTextAttr & style
    );
    %Docstring
        GetUncombinedStyle(position, style) -> bool
        
        Returns the content (uncombined) attributes for this position.
    %End

    virtual
    bool DoGetStyle(
        long position,
        wxRichTextAttr & style,
        bool combineStyles = true
    );
    %Docstring
        DoGetStyle(position, style, combineStyles=True) -> bool
        
        Implementation helper for GetStyle.
    %End

    virtual
    bool GetStyleForRange(
        const wxRichTextRange & range,
        wxRichTextAttr & style
    );
    %Docstring
        GetStyleForRange(range, style) -> bool
        
        This function gets a style representing the common, combined
        attributes in the given range.
    %End

    bool CollectStyle(
        wxRichTextAttr & currentStyle,
        const wxRichTextAttr & style,
        wxRichTextAttr & clashingAttr,
        wxRichTextAttr & absentAttr
    );
    %Docstring
        CollectStyle(currentStyle, style, clashingAttr, absentAttr) -> bool
        
        Combines style with currentStyle for the purpose of summarising the
        attributes of a range of content.
    %End

    virtual
    bool ClearListStyle(
        const wxRichTextRange & range,
        int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO
    );
    %Docstring
        ClearListStyle(range, flags=RICHTEXT_SETSTYLE_WITH_UNDO) -> bool
        
        Clears the list style from the given range, clearing list-related
        attributes and applying any named paragraph style associated with each
        paragraph.
    %End

    virtual
    bool DoNumberList(
        const wxRichTextRange & range,
        const wxRichTextRange & promotionRange,
        int promoteBy,
        wxRichTextListStyleDefinition * styleDef,
        int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO,
        int startFrom = 1,
        int specifiedLevel = -1
    );
    %Docstring
        DoNumberList(range, promotionRange, promoteBy, styleDef, flags=RICHTEXT_SETSTYLE_WITH_UNDO, startFrom=1, specifiedLevel=-1) -> bool
        
        Helper for NumberList and PromoteList, that does renumbering and
        promotion simultaneously def can be NULL/empty to indicate that the
        existing list style should be used.
    %End

    virtual
    bool FindNextParagraphNumber(
        wxRichTextParagraph * previousParagraph,
        wxRichTextAttr & attr
    ) const;
    %Docstring
        FindNextParagraphNumber(previousParagraph, attr) -> bool
        
        Fills in the attributes for numbering a paragraph after
        previousParagraph.
    %End

    virtual
    bool SetProperties(
        const wxRichTextRange & range,
        const wxRichTextProperties & properties,
        int flags = wxRICHTEXT_SETPROPERTIES_WITH_UNDO
    );
    %Docstring
        SetProperties(range, properties, flags=RICHTEXT_SETPROPERTIES_WITH_UNDO) -> bool
        
        Sets the properties for the given range, passing flags to determine
        how the attributes are set.
    %End

    virtual
    bool SetObjectPropertiesWithUndo(
        wxRichTextObject & obj,
        const wxRichTextProperties & properties,
        wxRichTextObject * objToSet = NULL
    );
    %Docstring
        SetObjectPropertiesWithUndo(obj, properties, objToSet=None) -> bool
        
        Sets with undo the properties for the given object.
    %End

    virtual
    bool HasCharacterAttributes(
        const wxRichTextRange & range,
        const wxRichTextAttr & style
    ) const;
    %Docstring
        HasCharacterAttributes(range, style) -> bool
        
        Test if this whole range has character attributes of the specified
        kind.
    %End

    virtual
    bool HasParagraphAttributes(
        const wxRichTextRange & range,
        const wxRichTextAttr & style
    ) const;
    %Docstring
        HasParagraphAttributes(range, style) -> bool
        
        Test if this whole range has paragraph attributes of the specified
        kind.
    %End

    virtual
    wxRichTextObject * Clone() const   /Factory/;
    %Docstring
        Clone() -> RichTextObject
        
        Clones the object.
    %End

    virtual
    void PrepareContent(
        wxRichTextParagraphLayoutBox & container
    );
    %Docstring
        PrepareContent(container)
        
        Prepares the content just before insertion (or after buffer reset).
    %End

    virtual
    bool InsertFragment(
        long position,
        wxRichTextParagraphLayoutBox & fragment
    );
    %Docstring
        InsertFragment(position, fragment) -> bool
        
        Insert fragment into this box at the given position.
    %End

    virtual
    bool CopyFragment(
        const wxRichTextRange & range,
        wxRichTextParagraphLayoutBox & fragment
    );
    %Docstring
        CopyFragment(range, fragment) -> bool
        
        Make a copy of the fragment corresponding to the given range, putting
        it in fragment.
    %End

    virtual
    bool ApplyStyleSheet(
        wxRichTextStyleSheet * styleSheet
    );
    %Docstring
        ApplyStyleSheet(styleSheet) -> bool
        
        Apply the style sheet to the buffer, for example if the styles have
        changed.
    %End

    void Copy(
        const wxRichTextParagraphLayoutBox & obj
    );
    %Docstring
        Copy(obj)
    %End

    virtual
    void UpdateRanges();
    %Docstring
        UpdateRanges()
        
        Calculate ranges.
    %End

    virtual
    wxString GetText() const;
    %Docstring
        GetText() -> String
        
        Get all the text.
    %End

    virtual
    bool SetDefaultStyle(
        const wxRichTextAttr & style
    );
    %Docstring
        SetDefaultStyle(style) -> bool
        
        Sets the default style, affecting the style currently being applied
        (for example, setting the default style to bold will cause
        subsequently inserted text to be bold).
    %End

    virtual
    const wxRichTextAttr & GetDefaultStyle() const;
    %Docstring
        GetDefaultStyle() -> RichTextAttr
        
        Returns the current default style, affecting the style currently being
        applied (for example, setting the default style to bold will cause
        subsequently inserted text to be bold).
    %End

    virtual
    void SetBasicStyle(
        const wxRichTextAttr & style
    );
    %Docstring
        SetBasicStyle(style)
        
        Sets the basic (overall) style.
    %End

    virtual
    const wxRichTextAttr & GetBasicStyle() const;
    %Docstring
        GetBasicStyle() -> RichTextAttr
        
        Returns the basic (overall) style.
    %End

    virtual
    void Invalidate(
        const wxRichTextRange & invalidRange = wxRICHTEXT_ALL
    );
    %Docstring
        Invalidate(invalidRange=RICHTEXT_ALL)
        
        Invalidates the buffer.
    %End

    virtual
    void DoInvalidate(
        const wxRichTextRange & invalidRange
    );
    %Docstring
        DoInvalidate(invalidRange)
        
        Do the (in)validation for this object only.
    %End

    virtual
    void InvalidateHierarchy(
        const wxRichTextRange & invalidRange = wxRICHTEXT_ALL
    );
    %Docstring
        InvalidateHierarchy(invalidRange=RICHTEXT_ALL)
        
        Do the (in)validation both up and down the hierarchy.
    %End

    virtual
    bool UpdateFloatingObjects(
        const wxRect & availableRect,
        wxRichTextObject * untilObj = NULL
    );
    %Docstring
        UpdateFloatingObjects(availableRect, untilObj=None) -> bool
        
        Gather information about floating objects.
    %End

    wxRichTextRange GetInvalidRange(
        bool wholeParagraphs = false
    ) const;
    %Docstring
        GetInvalidRange(wholeParagraphs=False) -> RichTextRange
        
        Get invalid range, rounding to entire paragraphs if argument is true.
    %End

    bool IsDirty() const;
    %Docstring
        IsDirty() -> bool
        
        Returns true if this object needs layout.
    %End

    wxRichTextFloatCollector * GetFloatCollector();
    %Docstring
        GetFloatCollector() -> RichTextFloatCollector
        
        Returns the wxRichTextFloatCollector of this object.
    %End

    int GetFloatingObjectCount() const;
    %Docstring
        GetFloatingObjectCount() -> int
        
        Returns the number of floating objects at this level.
    %End

    bool GetFloatingObjects(
        wxRichTextObjectList & objects
    ) const;
    %Docstring
        GetFloatingObjects(objects) -> bool
        
        Returns a list of floating objects.
    %End

    public:


    %Property(name=BasicStyle, get=GetBasicStyle, set=SetBasicStyle)
    %Property(name=DefaultStyle, get=GetDefaultStyle, set=SetDefaultStyle)
    %Property(name=FloatCollector, get=GetFloatCollector)
    %Property(name=FloatingObjectCount, get=GetFloatingObjectCount)
    %Property(name=InvalidRange, get=GetInvalidRange)
    %Property(name=LineCount, get=GetLineCount)
    %Property(name=ParagraphCount, get=GetParagraphCount)
    %Property(name=PartialParagraph, get=GetPartialParagraph, set=SetPartialParagraph)
    %Property(name=RichTextCtrl, get=GetRichTextCtrl, set=SetRichTextCtrl)
    %Property(name=StyleSheet, get=GetStyleSheet)
    %Property(name=Text, get=GetText)
    %Property(name=XMLNodeName, get=GetXMLNodeName)
};  // end of class wxRichTextParagraphLayoutBox


class wxRichTextBox : wxRichTextParagraphLayoutBox
{
    %Docstring
        RichTextBox(parent=None)
        RichTextBox(obj)
        
        This class implements a floating or inline text box, containing
        paragraphs.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextBox(
        wxRichTextObject * parent = NULL
    );

    wxRichTextBox(
        const wxRichTextBox & obj
    );

    virtual
    bool Draw(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRichTextRange & range,
        const wxRichTextSelection & selection,
        const wxRect & rect,
        int descent,
        int style
    );
    %Docstring
        Draw(dc, context, range, selection, rect, descent, style) -> bool
        
        Draw the item, within the given range.
    %End

    virtual
    wxString GetXMLNodeName() const;
    %Docstring
        GetXMLNodeName() -> String
        
        Returns the XML node name of this object.
    %End

    virtual
    bool CanEditProperties() const;
    %Docstring
        CanEditProperties() -> bool
        
        Returns true if we can edit the object's properties via a GUI.
    %End

    virtual
    bool EditProperties(
        wxWindow * parent,
        wxRichTextBuffer * buffer
    );
    %Docstring
        EditProperties(parent, buffer) -> bool
        
        Edits the object's properties via a GUI.
    %End

    virtual
    wxString GetPropertiesMenuLabel() const;
    %Docstring
        GetPropertiesMenuLabel() -> String
        
        Returns the label to be used for the properties context menu item.
    %End

    virtual
    wxRichTextObject * Clone() const   /Factory/;
    %Docstring
        Clone() -> RichTextObject
        
        Clones the object.
    %End

    void Copy(
        const wxRichTextBox & obj
    );
    %Docstring
        Copy(obj)
    %End

                    virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context,
                                        const wxRect& rect, const wxRect& parentRect,
                                        int style);


                    virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size,
                                  int& descent,
                                  wxDC& dc, wxRichTextDrawingContext& context, int flags,
                                  const wxPoint& position = wxPoint(0,0),
                                  const wxSize& parentSize = wxDefaultSize,
                                  wxArrayInt* partialExtents = NULL) const;


    public:


    %Property(name=PropertiesMenuLabel, get=GetPropertiesMenuLabel)
    %Property(name=XMLNodeName, get=GetXMLNodeName)
};  // end of class wxRichTextBox


class wxRichTextField : wxRichTextParagraphLayoutBox
{
    %Docstring
        RichTextField(fieldType=wx.EmptyString, parent=None)
        RichTextField(obj)
        
        This class implements the general concept of a field, an object that
        represents additional functionality such as a footnote, a bookmark, a
        page number, a table of contents, and so on.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextField(
        const wxString & fieldType = wxEmptyString,
        wxRichTextObject * parent = NULL
    );

    wxRichTextField(
        const wxRichTextField & obj
    );

    virtual
    bool Draw(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRichTextRange & range,
        const wxRichTextSelection & selection,
        const wxRect & rect,
        int descent,
        int style
    );
    %Docstring
        Draw(dc, context, range, selection, rect, descent, style) -> bool
        
        Draw the item, within the given range.
    %End

    virtual
    bool Layout(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRect & rect,
        const wxRect & parentRect,
        int style
    );
    %Docstring
        Layout(dc, context, rect, parentRect, style) -> bool
        
        Lay the item out at the specified position with the given size
        constraint.
    %End

    virtual
    bool GetRangeSize(
        const wxRichTextRange & range,
        wxSize & size,
        int & descent,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        int flags,
        const wxPoint & position = wxPoint(0, 0),
        const wxSize & parentSize = wxDefaultSize,
        wxArrayInt * partialExtents = NULL
    ) const;
    %Docstring
        GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool
        
        Returns the object size for the given range.
    %End

    virtual
    wxString GetXMLNodeName() const;
    %Docstring
        GetXMLNodeName() -> String
        
        Returns the XML node name of this object.
    %End

    virtual
    bool CanEditProperties() const;
    %Docstring
        CanEditProperties() -> bool
        
        Returns true if we can edit the object's properties via a GUI.
    %End

    virtual
    bool EditProperties(
        wxWindow * parent,
        wxRichTextBuffer * buffer
    );
    %Docstring
        EditProperties(parent, buffer) -> bool
        
        Edits the object's properties via a GUI.
    %End

    virtual
    wxString GetPropertiesMenuLabel() const;
    %Docstring
        GetPropertiesMenuLabel() -> String
        
        Returns the label to be used for the properties context menu item.
    %End

    virtual
    bool AcceptsFocus() const;
    %Docstring
        AcceptsFocus() -> bool
        
        Returns true if objects of this class can accept the focus, i.e. a
        call to SetFocusObject is possible.
    %End

    virtual
    void CalculateRange(
        long start,
        long & end   /Out/
    );
    %Docstring
        CalculateRange(start) -> end
        
        Calculates the range of the object.
    %End

    virtual
    bool IsAtomic() const;
    %Docstring
        IsAtomic() -> bool
        
        If a field has children, we don't want the user to be able to edit it.
    %End

    virtual
    bool IsEmpty() const;
    %Docstring
        IsEmpty() -> bool
        
        Returns true if the buffer is empty.
    %End

    virtual
    bool IsTopLevel() const;
    %Docstring
        IsTopLevel() -> bool
        
        Returns true if this object is top-level, i.e. contains its own
        paragraphs, such as a text box.
    %End

    void SetFieldType(
        const wxString & fieldType
    );
    %Docstring
        SetFieldType(fieldType)
    %End

    wxString GetFieldType() const;
    %Docstring
        GetFieldType() -> String
    %End

    virtual
    bool UpdateField(
        wxRichTextBuffer * buffer
    );
    %Docstring
        UpdateField(buffer) -> bool
        
        Update the field; delegated to the associated field type.
    %End

    virtual
    wxRichTextObject * Clone() const   /Factory/;
    %Docstring
        Clone() -> RichTextObject
        
        Clones the object.
    %End

    void Copy(
        const wxRichTextField & obj
    );
    %Docstring
        Copy(obj)
    %End

    public:


    %Property(name=FieldType, get=GetFieldType, set=SetFieldType)
    %Property(name=PropertiesMenuLabel, get=GetPropertiesMenuLabel)
    %Property(name=XMLNodeName, get=GetXMLNodeName)
};  // end of class wxRichTextField


class wxRichTextFieldType : wxObject
{
    %Docstring
        RichTextFieldType(name=wx.EmptyString)
        RichTextFieldType(fieldType)
        
        The base class for custom field types.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextFieldType(
        const wxString & name = wxEmptyString
    );

    wxRichTextFieldType(
        const wxRichTextFieldType & fieldType
    );

    void Copy(
        const wxRichTextFieldType & fieldType
    );
    %Docstring
        Copy(fieldType)
    %End

    virtual
    bool Draw(
        wxRichTextField * obj,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRichTextRange & range,
        const wxRichTextSelection & selection,
        const wxRect & rect,
        int descent,
        int style
    ) = 0;
    %Docstring
        Draw(obj, dc, context, range, selection, rect, descent, style) -> bool
        
        Draw the item, within the given range.
    %End

    virtual
    bool Layout(
        wxRichTextField * obj,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRect & rect,
        const wxRect & parentRect,
        int style
    ) = 0;
    %Docstring
        Layout(obj, dc, context, rect, parentRect, style) -> bool
        
        Lay the item out at the specified position with the given size
        constraint.
    %End

    virtual
    bool GetRangeSize(
        wxRichTextField * obj,
        const wxRichTextRange & range,
        wxSize & size,
        int & descent,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        int flags,
        const wxPoint & position = wxPoint(0, 0),
        const wxSize & parentSize = wxDefaultSize,
        wxArrayInt * partialExtents = NULL
    ) const = 0;
    %Docstring
        GetRangeSize(obj, range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool
        
        Returns the object size for the given range.
    %End

    virtual
    bool CanEditProperties(
        wxRichTextField * obj
    ) const;
    %Docstring
        CanEditProperties(obj) -> bool
        
        Returns true if we can edit the object's properties via a GUI.
    %End

    virtual
    bool EditProperties(
        wxRichTextField * obj,
        wxWindow * parent,
        wxRichTextBuffer * buffer
    );
    %Docstring
        EditProperties(obj, parent, buffer) -> bool
        
        Edits the object's properties via a GUI.
    %End

    virtual
    wxString GetPropertiesMenuLabel(
        wxRichTextField * obj
    ) const;
    %Docstring
        GetPropertiesMenuLabel(obj) -> String
        
        Returns the label to be used for the properties context menu item.
    %End

    virtual
    bool UpdateField(
        wxRichTextBuffer * buffer,
        wxRichTextField * obj
    );
    %Docstring
        UpdateField(buffer, obj) -> bool
        
        Update the field.
    %End

    virtual
    bool IsTopLevel(
        wxRichTextField * obj
    ) const;
    %Docstring
        IsTopLevel(obj) -> bool
        
        Returns true if this object is top-level, i.e. contains its own
        paragraphs, such as a text box.
    %End

    void SetName(
        const wxString & name
    );
    %Docstring
        SetName(name)
        
        Sets the field type name.
    %End

    wxString GetName() const;
    %Docstring
        GetName() -> String
        
        Returns the field type name.
    %End

    public:


    %Property(name=Name, get=GetName, set=SetName)
};  // end of class wxRichTextFieldType


class wxRichTextFieldTypeStandard : wxRichTextFieldType
{
    %Docstring
        RichTextFieldTypeStandard(name, label, displayStyle=RICHTEXT_FIELD_STYLE_RECTANGLE)
        RichTextFieldTypeStandard(name, bitmap, displayStyle=RICHTEXT_FIELD_STYLE_NO_BORDER)
        RichTextFieldTypeStandard()
        RichTextFieldTypeStandard(field)
        
        A field type that can handle fields with text or bitmap labels, with a
        small range of styles for implementing rectangular fields and fields
        that can be used for start and end tags.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    enum 
    {
        wxRICHTEXT_FIELD_STYLE_COMPOSITE,
        wxRICHTEXT_FIELD_STYLE_RECTANGLE,
        wxRICHTEXT_FIELD_STYLE_NO_BORDER,
        wxRICHTEXT_FIELD_STYLE_START_TAG,
        wxRICHTEXT_FIELD_STYLE_END_TAG    
    };

    wxRichTextFieldTypeStandard(
        const wxString & name,
        const wxString & label,
        int displayStyle = wxRICHTEXT_FIELD_STYLE_RECTANGLE
    );

    wxRichTextFieldTypeStandard(
        const wxString & name,
        const wxBitmap & bitmap,
        int displayStyle = wxRICHTEXT_FIELD_STYLE_NO_BORDER
    );

    wxRichTextFieldTypeStandard();

    wxRichTextFieldTypeStandard(
        const wxRichTextFieldTypeStandard & field
    );

    void Init();
    %Docstring
        Init()
        
        Initialises the object.
    %End

    void Copy(
        const wxRichTextFieldTypeStandard & field
    );
    %Docstring
        Copy(field)
        
        Copies the object.
    %End

    virtual
    bool Draw(
        wxRichTextField * obj,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRichTextRange & range,
        const wxRichTextSelection & selection,
        const wxRect & rect,
        int descent,
        int style
    );
    %Docstring
        Draw(obj, dc, context, range, selection, rect, descent, style) -> bool
        
        Draw the item, within the given range.
    %End

    virtual
    bool Layout(
        wxRichTextField * obj,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRect & rect,
        const wxRect & parentRect,
        int style
    );
    %Docstring
        Layout(obj, dc, context, rect, parentRect, style) -> bool
        
        Lay the item out at the specified position with the given size
        constraint.
    %End

    virtual
    bool GetRangeSize(
        wxRichTextField * obj,
        const wxRichTextRange & range,
        wxSize & size,
        int & descent,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        int flags,
        const wxPoint & position = wxPoint(0, 0),
        const wxSize & parentSize = wxDefaultSize,
        wxArrayInt * partialExtents = NULL
    ) const;
    %Docstring
        GetRangeSize(obj, range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool
        
        Returns the object size for the given range.
    %End

    wxSize GetSize(
        wxRichTextField * obj,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        int style
    ) const;
    %Docstring
        GetSize(obj, dc, context, style) -> wx.Size
        
        Get the size of the field, given the label, font size, and so on.
    %End

    virtual
    bool IsTopLevel(
        wxRichTextField * obj
    ) const;
    %Docstring
        IsTopLevel(obj) -> bool
        
        Returns true if the display type is wxRICHTEXT_FIELD_STYLE_COMPOSITE,
        false otherwise.
    %End

    void SetLabel(
        const wxString & label
    );
    %Docstring
        SetLabel(label)
        
        Sets the text label for fields of this type.
    %End

    const wxString & GetLabel() const;
    %Docstring
        GetLabel() -> String
        
        Returns the text label for fields of this type.
    %End

    void SetBitmap(
        const wxBitmap & bitmap
    );
    %Docstring
        SetBitmap(bitmap)
        
        Sets the bitmap label for fields of this type.
    %End

    const wxBitmap & GetBitmap() const;
    %Docstring
        GetBitmap() -> wx.Bitmap
        
        Gets the bitmap label for fields of this type.
    %End

    int GetDisplayStyle() const;
    %Docstring
        GetDisplayStyle() -> int
        
        Gets the display style for fields of this type.
    %End

    void SetDisplayStyle(
        int displayStyle
    );
    %Docstring
        SetDisplayStyle(displayStyle)
        
        Sets the display style for fields of this type.
    %End

    const wxFont & GetFont() const;
    %Docstring
        GetFont() -> wx.Font
        
        Gets the font used for drawing the text label.
    %End

    void SetFont(
        const wxFont & font
    );
    %Docstring
        SetFont(font)
        
        Sets the font used for drawing the text label.
    %End

    const wxColour & GetTextColour() const;
    %Docstring
        GetTextColour() -> wx.Colour
        
        Gets the colour used for drawing the text label.
    %End

    void SetTextColour(
        const wxColour & colour
    );
    %Docstring
        SetTextColour(colour)
        
        Sets the colour used for drawing the text label.
    %End

    const wxColour & GetBorderColour() const;
    %Docstring
        GetBorderColour() -> wx.Colour
        
        Gets the colour used for drawing the field border.
    %End

    void SetBorderColour(
        const wxColour & colour
    );
    %Docstring
        SetBorderColour(colour)
        
        Sets the colour used for drawing the field border.
    %End

    const wxColour & GetBackgroundColour() const;
    %Docstring
        GetBackgroundColour() -> wx.Colour
        
        Gets the colour used for drawing the field background.
    %End

    void SetBackgroundColour(
        const wxColour & colour
    );
    %Docstring
        SetBackgroundColour(colour)
        
        Sets the colour used for drawing the field background.
    %End

    void SetVerticalPadding(
        int padding
    );
    %Docstring
        SetVerticalPadding(padding)
        
        Sets the vertical padding (the distance between the border and the
        text).
    %End

    int GetVerticalPadding() const;
    %Docstring
        GetVerticalPadding() -> int
        
        Gets the vertical padding (the distance between the border and the
        text).
    %End

    void SetHorizontalPadding(
        int padding
    );
    %Docstring
        SetHorizontalPadding(padding)
        
        Sets the horizontal padding (the distance between the border and the
        text).
    %End

    int GetHorizontalPadding() const;
    %Docstring
        GetHorizontalPadding() -> int
        
        Sets the horizontal padding (the distance between the border and the
        text).
    %End

    void SetHorizontalMargin(
        int margin
    );
    %Docstring
        SetHorizontalMargin(margin)
        
        Sets the horizontal margin surrounding the field object.
    %End

    int GetHorizontalMargin() const;
    %Docstring
        GetHorizontalMargin() -> int
        
        Gets the horizontal margin surrounding the field object.
    %End

    void SetVerticalMargin(
        int margin
    );
    %Docstring
        SetVerticalMargin(margin)
        
        Sets the vertical margin surrounding the field object.
    %End

    int GetVerticalMargin() const;
    %Docstring
        GetVerticalMargin() -> int
        
        Gets the vertical margin surrounding the field object.
    %End

    public:


    %Property(name=BackgroundColour, get=GetBackgroundColour, set=SetBackgroundColour)
    %Property(name=Bitmap, get=GetBitmap, set=SetBitmap)
    %Property(name=BorderColour, get=GetBorderColour, set=SetBorderColour)
    %Property(name=DisplayStyle, get=GetDisplayStyle, set=SetDisplayStyle)
    %Property(name=Font, get=GetFont, set=SetFont)
    %Property(name=HorizontalMargin, get=GetHorizontalMargin, set=SetHorizontalMargin)
    %Property(name=HorizontalPadding, get=GetHorizontalPadding, set=SetHorizontalPadding)
    %Property(name=Label, get=GetLabel, set=SetLabel)
    %Property(name=TextColour, get=GetTextColour, set=SetTextColour)
    %Property(name=VerticalMargin, get=GetVerticalMargin, set=SetVerticalMargin)
    %Property(name=VerticalPadding, get=GetVerticalPadding, set=SetVerticalPadding)
};  // end of class wxRichTextFieldTypeStandard


class wxRichTextLine
{
    %Docstring
        RichTextLine(parent)
        RichTextLine(obj)
        
        This object represents a line in a paragraph, and stores offsets from
        the start of the paragraph representing the start and end positions of
        the line.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextLine(
        wxRichTextParagraph * parent
    );

    wxRichTextLine(
        const wxRichTextLine & obj
    );

    virtual
    ~wxRichTextLine();

    void SetRange(
        const wxRichTextRange & range
    );
    %Docstring
        SetRange(range)
        SetRange(from_, to_)
        
        Sets the range associated with this line.
    %End

    void SetRange(
        long from_,
        long to_
    );

    wxRichTextParagraph * GetParent();
    %Docstring
        GetParent() -> RichTextParagraph
        
        Returns the parent paragraph.
    %End

    wxRichTextRange & GetRange();
    %Docstring
        GetRange() -> RichTextRange
        
        Returns the range.
    %End

    wxRichTextRange GetAbsoluteRange() const;
    %Docstring
        GetAbsoluteRange() -> RichTextRange
        
        Returns the absolute range.
    %End

    virtual
    wxSize GetSize() const;
    %Docstring
        GetSize() -> wx.Size
        
        Returns the line size as calculated by Layout.
    %End

    virtual
    void SetSize(
        const wxSize & sz
    );
    %Docstring
        SetSize(sz)
        
        Sets the line size as calculated by Layout.
    %End

    virtual
    wxPoint GetPosition() const;
    %Docstring
        GetPosition() -> wx.Point
        
        Returns the object position relative to the parent.
    %End

    virtual
    void SetPosition(
        const wxPoint & pos
    );
    %Docstring
        SetPosition(pos)
        
        Sets the object position relative to the parent.
    %End

    virtual
    wxPoint GetAbsolutePosition() const;
    %Docstring
        GetAbsolutePosition() -> wx.Point
        
        Returns the absolute object position.
    %End

    virtual
    wxRect GetRect() const;
    %Docstring
        GetRect() -> wx.Rect
        
        Returns the rectangle enclosing the line.
    %End

    void SetDescent(
        int descent
    );
    %Docstring
        SetDescent(descent)
        
        Sets the stored descent.
    %End

    int GetDescent() const;
    %Docstring
        GetDescent() -> int
        
        Returns the stored descent.
    %End

    void Init(
        wxRichTextParagraph * parent
    );
    %Docstring
        Init(parent)
        
        Initialises the object.
    %End

    void Copy(
        const wxRichTextLine & obj
    );
    %Docstring
        Copy(obj)
        
        Copies from obj.
    %End

    virtual
    wxRichTextLine * Clone() const   /Factory/;
    %Docstring
        Clone() -> RichTextLine
    %End

    public:


    %Property(name=AbsolutePosition, get=GetAbsolutePosition)
    %Property(name=AbsoluteRange, get=GetAbsoluteRange)
    %Property(name=Descent, get=GetDescent, set=SetDescent)
    %Property(name=Parent, get=GetParent)
    %Property(name=Position, get=GetPosition, set=SetPosition)
    %Property(name=Range, get=GetRange, set=SetRange)
    %Property(name=Rect, get=GetRect)
    %Property(name=Size, get=GetSize, set=SetSize)
};  // end of class wxRichTextLine


class wxRichTextParagraph : wxRichTextCompositeObject
{
    %Docstring
        RichTextParagraph(parent=None, style=None)
        RichTextParagraph(text, parent=None, paraStyle=None, charStyle=None)
        RichTextParagraph(obj)
        
        This object represents a single paragraph containing various objects
        such as text content, images, and further paragraph layout objects.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextParagraph(
        wxRichTextObject * parent = NULL,
        wxRichTextAttr * style = NULL
    );

    wxRichTextParagraph(
        const wxString & text,
        wxRichTextObject * parent = NULL,
        wxRichTextAttr * paraStyle = NULL,
        wxRichTextAttr * charStyle = NULL
    );

    wxRichTextParagraph(
        const wxRichTextParagraph & obj
    );

    virtual
    ~wxRichTextParagraph();

    void Init();
    %Docstring
        Init()
    %End

    virtual
    bool Draw(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRichTextRange & range,
        const wxRichTextSelection & selection,
        const wxRect & rect,
        int descent,
        int style
    );
    %Docstring
        Draw(dc, context, range, selection, rect, descent, style) -> bool
        
        Draw the item, within the given range.
    %End

    virtual
    bool Layout(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRect & rect,
        const wxRect & parentRect,
        int style
    );
    %Docstring
        Layout(dc, context, rect, parentRect, style) -> bool
        
        Lay the item out at the specified position with the given size
        constraint.
    %End

    virtual
    bool GetRangeSize(
        const wxRichTextRange & range,
        wxSize & size,
        int & descent,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        int flags,
        const wxPoint & position = wxPoint(0, 0),
        const wxSize & parentSize = wxDefaultSize,
        wxArrayInt * partialExtents = NULL
    ) const;
    %Docstring
        GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool
        
        Returns the object size for the given range.
    %End

    virtual
    bool FindPosition(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        long index,
        wxPoint & pt   /Out/,
        int * height   /Out/,
        bool forceLineStart
    );
    %Docstring
        FindPosition(dc, context, index, forceLineStart) -> (bool, pt, height)
        
        Finds the absolute position and row height for the given character
        position.
    %End

    virtual
    int HitTest(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxPoint & pt,
        long & textPosition   /Out/,
        wxRichTextObject ** obj   /Out/,
        wxRichTextObject ** contextObj   /Out/,
        int flags = 0
    );
    %Docstring
        HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj)
        
        Hit-testing: returns a flag indicating hit test details, plus
        information about position.
    %End

    virtual
    void CalculateRange(
        long start,
        long & end   /Out/
    );
    %Docstring
        CalculateRange(start) -> end
        
        Calculates the range of the object.
    %End

    virtual
    wxString GetXMLNodeName() const;
    %Docstring
        GetXMLNodeName() -> String
        
        Returns the XML node name of this object.
    %End

    PyObject* GetLines() const;
    %Docstring
        GetLines() -> PyObject
        
        Returns the cached lines.
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxRichTextParagraph_GetLines(sipCpp);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    PyObject* _wxRichTextParagraph_GetLines(const wxRichTextParagraph* self)
    {
        wxPyThreadBlocker blocker;
        PyObject* result = PyList_New(0);
        const wxRichTextLineVector& vector = self->GetLines();
        for (size_t idx=0; idx < vector.size(); idx++) {{
            PyObject* obj;
            wxRichTextLine* item = new wxRichTextLine(*vector.at(idx));
            obj = wxPyConstructObject((void*)item, "wxRichTextLine", true);
            PyList_Append(result, obj);
            Py_DECREF(obj);
        }}
        return result;
    }
    %End

    void Copy(
        const wxRichTextParagraph & obj
    );
    %Docstring
        Copy(obj)
        
        Copies the object.
    %End

    virtual
    wxRichTextObject * Clone() const   /Factory/;
    %Docstring
        Clone() -> RichTextObject
        
        Clones the object.
    %End

    void ClearLines();
    %Docstring
        ClearLines()
        
        Clears the cached lines.
    %End

    virtual
    void ApplyParagraphStyle(
        wxRichTextLine * line,
        const wxRichTextAttr & attr,
        const wxRect & rect,
        wxDC & dc
    );
    %Docstring
        ApplyParagraphStyle(line, attr, rect, dc)
        
        Applies paragraph styles such as centering to the wrapped lines.
    %End

    virtual
    bool InsertText(
        long pos,
        const wxString & text
    );
    %Docstring
        InsertText(pos, text) -> bool
        
        Inserts text at the given position.
    %End

    virtual
    wxRichTextObject * SplitAt(
        long pos,
        wxRichTextObject ** previousObject = NULL
    );
    %Docstring
        SplitAt(pos, previousObject=None) -> RichTextObject
        
        Splits an object at this position if necessary, and returns the
        previous object, or NULL if inserting at the beginning.
    %End

    virtual
    void MoveToList(
        wxRichTextObject * obj,
        wxRichTextObjectList_& list
    );
    %Docstring
        MoveToList(obj, list)
        
        Moves content to a list from this point.
    %End

    virtual
    void MoveFromList(
        wxRichTextObjectList_& list
    );
    %Docstring
        MoveFromList(list)
        
        Adds content back from a list.
    %End

    bool GetContiguousPlainText(
        wxString & text,
        const wxRichTextRange & range,
        bool fromStart = true
    );
    %Docstring
        GetContiguousPlainText(text, range, fromStart=True) -> bool
        
        Returns the plain text searching from the start or end of the range.
    %End

    bool FindWrapPosition(
        const wxRichTextRange & range,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        int availableSpace,
        long & wrapPosition,
        wxArrayInt * partialExtents
    );
    %Docstring
        FindWrapPosition(range, dc, context, availableSpace, wrapPosition, partialExtents) -> bool
        
        Finds a suitable wrap position.
    %End

    wxRichTextObject * FindObjectAtPosition(
        long position
    );
    %Docstring
        FindObjectAtPosition(position) -> RichTextObject
        
        Finds the object at the given position.
    %End

    wxString GetBulletText();
    %Docstring
        GetBulletText() -> String
        
        Returns the bullet text for this paragraph.
    %End

    wxRichTextLine * AllocateLine(
        int pos
    );
    %Docstring
        AllocateLine(pos) -> RichTextLine
        
        Allocates or reuses a line object.
    %End

    bool ClearUnusedLines(
        int lineCount
    );
    %Docstring
        ClearUnusedLines(lineCount) -> bool
        
        Clears remaining unused line objects, if any.
    %End

    wxRichTextAttr GetCombinedAttributes(
        const wxRichTextAttr & contentStyle,
        bool includingBoxAttr = false
    ) const;
    %Docstring
        GetCombinedAttributes(contentStyle, includingBoxAttr=False) -> RichTextAttr
        GetCombinedAttributes(includingBoxAttr=False) -> RichTextAttr
        
        Returns combined attributes of the base style, paragraph style and
        character style.
    %End

    wxRichTextAttr GetCombinedAttributes(
        bool includingBoxAttr = false
    ) const;

    long GetFirstLineBreakPosition(
        long pos
    );
    %Docstring
        GetFirstLineBreakPosition(pos) -> long
        
        Returns the first position from pos that has a line break character.
    %End

    void LayoutFloat(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRect & rect,
        const wxRect & parentRect,
        int style,
        wxRichTextFloatCollector * floatCollector
    );
    %Docstring
        LayoutFloat(dc, context, rect, parentRect, style, floatCollector)
        
        Lays out the floating objects.
    %End

    int GetImpactedByFloatingObjects() const;
    %Docstring
        GetImpactedByFloatingObjects() -> int
        
        Whether the paragraph is impacted by floating objects from above.
    %End

    void SetImpactedByFloatingObjects(
        int i
    );
    %Docstring
        SetImpactedByFloatingObjects(i)
        
        Sets whether the paragraph is impacted by floating objects from above.
    %End

    static
    void InitDefaultTabs();
    %Docstring
        InitDefaultTabs()
        
        Creates a default tabstop array.
    %End

    static
    void ClearDefaultTabs();
    %Docstring
        ClearDefaultTabs()
        
        Clears the default tabstop array.
    %End

    static
    const wxArrayInt & GetDefaultTabs();
    %Docstring
        GetDefaultTabs() -> ArrayInt
        
        Returns the default tabstop array.
    %End

    public:


    %Property(name=BulletText, get=GetBulletText)
    %Property(name=CombinedAttributes, get=GetCombinedAttributes)
    %Property(name=ImpactedByFloatingObjects, get=GetImpactedByFloatingObjects, set=SetImpactedByFloatingObjects)
    %Property(name=Lines, get=GetLines)
    %Property(name=XMLNodeName, get=GetXMLNodeName)
};  // end of class wxRichTextParagraph


class wxRichTextPlainText : wxRichTextObject
{
    %Docstring
        RichTextPlainText(text=wx.EmptyString, parent=None, style=None)
        RichTextPlainText(obj)
        
        This object represents a single piece of text.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextPlainText(
        const wxString & text = wxEmptyString,
        wxRichTextObject * parent = NULL,
        wxRichTextAttr * style = NULL
    );

    wxRichTextPlainText(
        const wxRichTextPlainText & obj
    );

    virtual
    bool Draw(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRichTextRange & range,
        const wxRichTextSelection & selection,
        const wxRect & rect,
        int descent,
        int style
    );
    %Docstring
        Draw(dc, context, range, selection, rect, descent, style) -> bool
        
        Draw the item, within the given range.
    %End

    virtual
    bool Layout(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRect & rect,
        const wxRect & parentRect,
        int style
    );
    %Docstring
        Layout(dc, context, rect, parentRect, style) -> bool
        
        Lay the item out at the specified position with the given size
        constraint.
    %End

    virtual
    bool GetRangeSize(
        const wxRichTextRange & range,
        wxSize & size,
        int & descent,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        int flags,
        const wxPoint & position = wxPoint(0, 0),
        const wxSize & parentSize = wxDefaultSize,
        wxArrayInt * partialExtents = NULL
    ) const;
    %Docstring
        GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool
        
        Returns the object size for the given range.
    %End

    virtual
    wxString GetTextForRange(
        const wxRichTextRange & range
    ) const;
    %Docstring
        GetTextForRange(range) -> String
        
        Returns any text in this object for the given range.
    %End

    virtual
    wxRichTextObject * DoSplit(
        long pos
    );
    %Docstring
        DoSplit(pos) -> RichTextObject
        
        Do a split from pos, returning an object containing the second part,
        and setting the first part in 'this'.
    %End

    virtual
    void CalculateRange(
        long start,
        long & end   /Out/
    );
    %Docstring
        CalculateRange(start) -> end
        
        Calculates the range of the object.
    %End

    virtual
    bool DeleteRange(
        const wxRichTextRange & range
    );
    %Docstring
        DeleteRange(range) -> bool
        
        Deletes the given range.
    %End

    virtual
    bool IsEmpty() const;
    %Docstring
        IsEmpty() -> bool
        
        Returns true if the object is empty.
    %End

    virtual
    bool CanMerge(
        wxRichTextObject * object,
        wxRichTextDrawingContext & context
    ) const;
    %Docstring
        CanMerge(object, context) -> bool
        
        Returns true if this object can merge itself with the given one.
    %End

    virtual
    bool Merge(
        wxRichTextObject * object,
        wxRichTextDrawingContext & context
    );
    %Docstring
        Merge(object, context) -> bool
        
        Returns true if this object merged itself with the given one.
    %End

    virtual
    bool CanSplit(
        wxRichTextDrawingContext & context
    ) const;
    %Docstring
        CanSplit(context) -> bool
        
        Returns true if this object can potentially be split, by virtue of
        having different virtual attributes for individual sub-objects.
    %End

    virtual
    wxRichTextObject * Split(
        wxRichTextDrawingContext & context
    );
    %Docstring
        Split(context) -> RichTextObject
        
        Returns the final object in the split objects if this object was split
        due to differences between sub-object virtual attributes.
    %End

    long GetFirstLineBreakPosition(
        long pos
    );
    %Docstring
        GetFirstLineBreakPosition(pos) -> long
        
        Get the first position from pos that has a line break character.
    %End

    virtual
    bool UsesParagraphAttributes() const;
    %Docstring
        UsesParagraphAttributes() -> bool
        
        Does this object take note of paragraph attributes? Text and image
        objects don't.
    %End

    virtual
    bool ImportFromXML(
        wxRichTextBuffer * buffer,
        wxXmlNode * node,
        wxRichTextXMLHandler * handler,
        bool * recurse
    );
    %Docstring
        ImportFromXML(buffer, node, handler, recurse) -> bool
        
        Imports this object from XML.
    %End

    virtual
    wxString GetXMLNodeName() const;
    %Docstring
        GetXMLNodeName() -> String
        
        Returns the XML node name of this object.
    %End

    const wxString & GetText() const;
    %Docstring
        GetText() -> String
        
        Returns the text.
    %End

    void SetText(
        const wxString & text
    );
    %Docstring
        SetText(text)
        
        Sets the text.
    %End

    void Copy(
        const wxRichTextPlainText & obj
    );
    %Docstring
        Copy(obj)
    %End

    virtual
    wxRichTextObject * Clone() const   /Factory/;
    %Docstring
        Clone() -> RichTextObject
        
        Clones the object.
    %End

    public:


    %Property(name=Text, get=GetText, set=SetText)
    %Property(name=XMLNodeName, get=GetXMLNodeName)
};  // end of class wxRichTextPlainText


class wxRichTextImageBlock : wxObject
{
    %Docstring
        RichTextImageBlock()
        RichTextImageBlock(block)
        
        This class stores information about an image, in binary in-memory
        form.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextImageBlock();

    wxRichTextImageBlock(
        const wxRichTextImageBlock & block
    );

    virtual
    ~wxRichTextImageBlock();

    void Init();
    %Docstring
        Init()
        
        Initialises the block.
    %End

    void Clear();
    %Docstring
        Clear()
        
        Clears the block.
    %End

    virtual
    bool MakeImageBlock(
        const wxString & filename,
        wxBitmapType imageType,
        wxImage & image,
        bool convertToJPEG = true
    );
    %Docstring
        MakeImageBlock(filename, imageType, image, convertToJPEG=True) -> bool
        MakeImageBlock(image, imageType, quality=80) -> bool
        
        Load the original image into a memory block.
    %End

    virtual
    bool MakeImageBlock(
        wxImage & image,
        wxBitmapType imageType,
        int quality = 80
    );

    virtual
    bool MakeImageBlockDefaultQuality(
        const wxImage & image,
        wxBitmapType imageType
    );
    %Docstring
        MakeImageBlockDefaultQuality(image, imageType) -> bool
        
        Uses a const wxImage for efficiency, but can't set quality (only
        relevant for JPEG)
    %End

    virtual
    bool DoMakeImageBlock(
        const wxImage & image,
        wxBitmapType imageType
    );
    %Docstring
        DoMakeImageBlock(image, imageType) -> bool
        
        Makes the image block.
    %End

    bool Write(
        const wxString & filename
    );
    %Docstring
        Write(filename) -> bool
        
        Writes the block to a file.
    %End

    bool WriteHex(
        wxOutputStream & stream
    );
    %Docstring
        WriteHex(stream) -> bool
        
        Writes the data in hex to a stream.
    %End

    bool ReadHex(
        wxInputStream & stream,
        int length,
        wxBitmapType imageType
    );
    %Docstring
        ReadHex(stream, length, imageType) -> bool
        
        Reads the data in hex from a stream.
    %End

    void Copy(
        const wxRichTextImageBlock & block
    );
    %Docstring
        Copy(block)
        
        Copy from block.
    %End

    bool Load(
        wxImage & image
    );
    %Docstring
        Load(image) -> bool
    %End

    unsigned char * GetData() const;
    %Docstring
        GetData() -> unsignedchar
        
        Returns the raw data.
    %End

    size_t GetDataSize() const;
    %Docstring
        GetDataSize() -> size_t
        
        Returns the data size in bytes.
    %End

    wxBitmapType GetImageType() const;
    %Docstring
        GetImageType() -> BitmapType
        
        Returns the image type.
    %End

    void SetData(
        unsigned char * image
    );
    %Docstring
        SetData(image)
    %End

    void SetDataSize(
        size_t size
    );
    %Docstring
        SetDataSize(size)
        
        Sets the data size.
    %End

    void SetImageType(
        wxBitmapType imageType
    );
    %Docstring
        SetImageType(imageType)
        
        Sets the image type.
    %End

    bool IsOk() const;
    %Docstring
        IsOk() -> bool
        
        Returns true if the data is non-NULL.
    %End

    bool Ok() const;
    %Docstring
        Ok() -> bool
    %End

    wxString GetExtension() const;
    %Docstring
        GetExtension() -> String
        
        Gets the extension for the block's type.
    %End

    static
    unsigned char * ReadBlock(
        wxInputStream & stream,
        size_t size
    );
    %Docstring
        ReadBlock(stream, size) -> unsignedchar
        ReadBlock(filename, size) -> unsignedchar
        
        Implementation.
    %End

    static
    unsigned char * ReadBlock(
        const wxString & filename,
        size_t size
    );

    static
    bool WriteBlock(
        wxOutputStream & stream,
        unsigned char * block,
        size_t size
    );
    %Docstring
        WriteBlock(stream, block, size) -> bool
        WriteBlock(filename, block, size) -> bool
        
        Writes a memory block to stream.
    %End

    static
    bool WriteBlock(
        const wxString & filename,
        unsigned char * block,
        size_t size
    );

    public:


    %Property(name=Data, get=GetData, set=SetData)
    %Property(name=DataSize, get=GetDataSize, set=SetDataSize)
    %Property(name=Extension, get=GetExtension)
    %Property(name=ImageType, get=GetImageType, set=SetImageType)
};  // end of class wxRichTextImageBlock


class wxRichTextImage : wxRichTextObject
{
    %Docstring
        RichTextImage(parent=None)
        RichTextImage(image, parent=None, charStyle=None)
        RichTextImage(imageBlock, parent=None, charStyle=None)
        RichTextImage(obj)
        
        This class implements a graphic object.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextImage(
        wxRichTextObject * parent = NULL
    );

    wxRichTextImage(
        const wxImage & image,
        wxRichTextObject * parent = NULL,
        wxRichTextAttr * charStyle = NULL
    );

    wxRichTextImage(
        const wxRichTextImageBlock & imageBlock,
        wxRichTextObject * parent = NULL,
        wxRichTextAttr * charStyle = NULL
    );

    wxRichTextImage(
        const wxRichTextImage & obj
    );

    virtual
    bool Draw(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRichTextRange & range,
        const wxRichTextSelection & selection,
        const wxRect & rect,
        int descent,
        int style
    );
    %Docstring
        Draw(dc, context, range, selection, rect, descent, style) -> bool
        
        Draw the item, within the given range.
    %End

    virtual
    bool Layout(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRect & rect,
        const wxRect & parentRect,
        int style
    );
    %Docstring
        Layout(dc, context, rect, parentRect, style) -> bool
        
        Lay the item out at the specified position with the given size
        constraint.
    %End

    virtual
    bool GetRangeSize(
        const wxRichTextRange & range,
        wxSize & size,
        int & descent,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        int flags,
        const wxPoint & position = wxPoint(0, 0),
        const wxSize & parentSize = wxDefaultSize,
        wxArrayInt * partialExtents = NULL
    ) const;
    %Docstring
        GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool
        
        Returns the object size for the given range.
    %End

    virtual
    wxTextAttrSize GetNaturalSize() const;
    %Docstring
        GetNaturalSize() -> TextAttrSize
        
        Returns the 'natural' size for this object - the image size.
    %End

    virtual
    bool IsEmpty() const;
    %Docstring
        IsEmpty() -> bool
        
        Returns true if the object is empty.
    %End

    virtual
    bool CanEditProperties() const;
    %Docstring
        CanEditProperties() -> bool
        
        Returns true if we can edit the object's properties via a GUI.
    %End

    virtual
    bool EditProperties(
        wxWindow * parent,
        wxRichTextBuffer * buffer
    );
    %Docstring
        EditProperties(parent, buffer) -> bool
        
        Edits the object's properties via a GUI.
    %End

    virtual
    wxString GetPropertiesMenuLabel() const;
    %Docstring
        GetPropertiesMenuLabel() -> String
        
        Returns the label to be used for the properties context menu item.
    %End

    virtual
    bool UsesParagraphAttributes() const;
    %Docstring
        UsesParagraphAttributes() -> bool
        
        Returns true if this object takes note of paragraph attributes (text
        and image objects don't).
    %End

    virtual
    bool ImportFromXML(
        wxRichTextBuffer * buffer,
        wxXmlNode * node,
        wxRichTextXMLHandler * handler,
        bool * recurse
    );
    %Docstring
        ImportFromXML(buffer, node, handler, recurse) -> bool
        
        Imports this object from XML.
    %End

    virtual
    bool IsFloatable() const;
    %Docstring
        IsFloatable() -> bool
        
        Returns true if this class of object is floatable.
    %End

    virtual
    wxString GetXMLNodeName() const;
    %Docstring
        GetXMLNodeName() -> String
        
        Returns the XML node name of this object.
    %End

    const wxBitmap & GetImageCache() const;
    %Docstring
        GetImageCache() -> wx.Bitmap
        
        Returns the image cache (a scaled bitmap).
    %End

    void SetImageCache(
        const wxBitmap & bitmap
    );
    %Docstring
        SetImageCache(bitmap)
        
        Sets the image cache.
    %End

    void ResetImageCache();
    %Docstring
        ResetImageCache()
        
        Resets the image cache.
    %End

    wxRichTextImageBlock & GetImageBlock();
    %Docstring
        GetImageBlock() -> RichTextImageBlock
        
        Returns the image block containing the raw data.
    %End

    wxSize GetOriginalImageSize() const;
    %Docstring
        GetOriginalImageSize() -> wx.Size
        
        Gets the original image size.
    %End

    void SetOriginalImageSize(
        const wxSize & sz
    );
    %Docstring
        SetOriginalImageSize(sz)
        
        Sets the original image size.
    %End

    void Copy(
        const wxRichTextImage & obj
    );
    %Docstring
        Copy(obj)
        
        Copies the image object.
    %End

    virtual
    wxRichTextObject * Clone() const   /Factory/;
    %Docstring
        Clone() -> RichTextObject
        
        Clones the image object.
    %End

    virtual
    bool LoadImageCache(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        wxSize & retImageSize,
        bool resetCache = false,
        const wxSize & parentSize = wxDefaultSize
    );
    %Docstring
        LoadImageCache(dc, context, retImageSize, resetCache=False, parentSize=wx.DefaultSize) -> bool
        
        Creates a cached image at the required size.
    %End

    virtual
    bool LoadAndScaleImageCache(
        wxImage & image,
        const wxSize & sz,
        wxRichTextDrawingContext & context,
        bool & changed   /In, Out/
    );
    %Docstring
        LoadAndScaleImageCache(image, sz, context, changed) -> (bool, changed)
        
        Do the loading and scaling.
    %End

    int GetImageState() const;
    %Docstring
        GetImageState() -> int
        
        Gets the image state.
    %End

    void SetImageState(
        int state
    );
    %Docstring
        SetImageState(state)
        
        Sets the image state.
    %End

    public:


    %Property(name=ImageBlock, get=GetImageBlock)
    %Property(name=ImageCache, get=GetImageCache, set=SetImageCache)
    %Property(name=ImageState, get=GetImageState, set=SetImageState)
    %Property(name=NaturalSize, get=GetNaturalSize)
    %Property(name=OriginalImageSize, get=GetOriginalImageSize, set=SetOriginalImageSize)
    %Property(name=PropertiesMenuLabel, get=GetPropertiesMenuLabel)
    %Property(name=XMLNodeName, get=GetXMLNodeName)
};  // end of class wxRichTextImage


class wxRichTextBuffer : wxRichTextParagraphLayoutBox
{
    %Docstring
        RichTextBuffer()
        RichTextBuffer(obj)
        
        This is a kind of paragraph layout box, used to represent the whole
        buffer.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextBuffer();

    wxRichTextBuffer(
        const wxRichTextBuffer & obj
    );

    virtual
    ~wxRichTextBuffer();

    virtual
    bool LoadFile(
        const wxString & filename,
        wxRichTextFileType type = wxRICHTEXT_TYPE_ANY
    );
    %Docstring
        LoadFile(filename, type=RICHTEXT_TYPE_ANY) -> bool
        LoadFile(stream, type=RICHTEXT_TYPE_ANY) -> bool
        
        Loads content from a stream or file.
    %End

    virtual
    bool LoadFile(
        wxInputStream & stream,
        wxRichTextFileType type = wxRICHTEXT_TYPE_ANY
    );

    virtual
    bool SaveFile(
        const wxString & filename,
        wxRichTextFileType type = wxRICHTEXT_TYPE_ANY
    );
    %Docstring
        SaveFile(filename, type=RICHTEXT_TYPE_ANY) -> bool
        SaveFile(stream, type=RICHTEXT_TYPE_ANY) -> bool
        
        Saves content to a stream or file.
    %End

    virtual
    bool SaveFile(
        wxOutputStream & stream,
        wxRichTextFileType type = wxRICHTEXT_TYPE_ANY
    );

    wxCommandProcessor * GetCommandProcessor() const;
    %Docstring
        GetCommandProcessor() -> wx.CommandProcessor
        
        Returns the command processor.
    %End

    void SetStyleSheet(
        wxRichTextStyleSheet * styleSheet
    );
    %Docstring
        SetStyleSheet(styleSheet)
        
        Sets style sheet, if any.
    %End

    virtual
    wxRichTextStyleSheet * GetStyleSheet() const;
    %Docstring
        GetStyleSheet() -> RichTextStyleSheet
        
        Returns the style sheet.
    %End

    bool SetStyleSheetAndNotify(
        wxRichTextStyleSheet * sheet
    );
    %Docstring
        SetStyleSheetAndNotify(sheet) -> bool
        
        Sets the style sheet and sends a notification of the change.
    %End

    bool PushStyleSheet(
        wxRichTextStyleSheet * styleSheet
    );
    %Docstring
        PushStyleSheet(styleSheet) -> bool
        
        Pushes the style sheet to the top of the style sheet stack.
    %End

    wxRichTextStyleSheet * PopStyleSheet();
    %Docstring
        PopStyleSheet() -> RichTextStyleSheet
        
        Pops the style sheet from the top of the style sheet stack.
    %End

    wxRichTextFontTable & GetFontTable();
    %Docstring
        GetFontTable() -> RichTextFontTable
        
        Returns the table storing fonts, for quick access and font reuse.
    %End

    void SetFontTable(
        const wxRichTextFontTable & table
    );
    %Docstring
        SetFontTable(table)
        
        Sets table storing fonts, for quick access and font reuse.
    %End

    void SetFontScale(
        double fontScale
    );
    %Docstring
        SetFontScale(fontScale)
        
        Sets the scale factor for displaying fonts, for example for more
        comfortable editing.
    %End

    double GetFontScale() const;
    %Docstring
        GetFontScale() -> double
        
        Returns the scale factor for displaying fonts, for example for more
        comfortable editing.
    %End

    void SetDimensionScale(
        double dimScale
    );
    %Docstring
        SetDimensionScale(dimScale)
        
        Sets the scale factor for displaying certain dimensions such as
        indentation and inter-paragraph spacing.
    %End

    double GetDimensionScale() const;
    %Docstring
        GetDimensionScale() -> double
        
        Returns the scale factor for displaying certain dimensions such as
        indentation and inter-paragraph spacing.
    %End

    void Init();
    %Docstring
        Init()
        
        Initialisation.
    %End

    virtual
    void ResetAndClearCommands();
    %Docstring
        ResetAndClearCommands()
        
        Clears the buffer, adds an empty paragraph, and clears the command
        processor.
    %End

    void SetHandlerFlags(
        int flags
    );
    %Docstring
        SetHandlerFlags(flags)
        
        Sets the handler flags, controlling loading and saving.
    %End

    int GetHandlerFlags() const;
    %Docstring
        GetHandlerFlags() -> int
        
        Gets the handler flags, controlling loading and saving.
    %End

    virtual
    wxRichTextRange AddParagraph(
        const wxString & text,
        wxRichTextAttr * paraStyle = NULL
    );
    %Docstring
        AddParagraph(text, paraStyle=None) -> RichTextRange
        
        Convenience function to add a paragraph of text.
    %End

    virtual
    bool BeginBatchUndo(
        const wxString & cmdName
    );
    %Docstring
        BeginBatchUndo(cmdName) -> bool
        
        Begin collapsing undo/redo commands.
    %End

    virtual
    bool EndBatchUndo();
    %Docstring
        EndBatchUndo() -> bool
        
        End collapsing undo/redo commands.
    %End

    virtual
    bool BatchingUndo() const;
    %Docstring
        BatchingUndo() -> bool
        
        Returns true if we are collapsing commands.
    %End

    virtual
    bool SubmitAction(
        wxRichTextAction * action
    );
    %Docstring
        SubmitAction(action) -> bool
        
        Submit the action immediately, or delay according to whether
        collapsing is on.
    %End

    virtual
    wxRichTextCommand * GetBatchedCommand() const;
    %Docstring
        GetBatchedCommand() -> RichTextCommand
        
        Returns the collapsed command.
    %End

    virtual
    bool BeginSuppressUndo();
    %Docstring
        BeginSuppressUndo() -> bool
        
        Begin suppressing undo/redo commands.
    %End

    virtual
    bool EndSuppressUndo();
    %Docstring
        EndSuppressUndo() -> bool
        
        End suppressing undo/redo commands.
    %End

    virtual
    bool SuppressingUndo() const;
    %Docstring
        SuppressingUndo() -> bool
        
        Are we suppressing undo??
    %End

    virtual
    bool CopyToClipboard(
        const wxRichTextRange & range
    );
    %Docstring
        CopyToClipboard(range) -> bool
        
        Copy the range to the clipboard.
    %End

    virtual
    bool PasteFromClipboard(
        long position
    );
    %Docstring
        PasteFromClipboard(position) -> bool
        
        Paste the clipboard content to the buffer.
    %End

    virtual
    bool CanPasteFromClipboard() const;
    %Docstring
        CanPasteFromClipboard() -> bool
        
        Returns true if we can paste from the clipboard.
    %End

    virtual
    bool BeginStyle(
        const wxRichTextAttr & style
    );
    %Docstring
        BeginStyle(style) -> bool
        
        Begin using a style.
    %End

    virtual
    bool EndStyle();
    %Docstring
        EndStyle() -> bool
        
        End the style.
    %End

    virtual
    bool EndAllStyles();
    %Docstring
        EndAllStyles() -> bool
        
        End all styles.
    %End

    virtual
    void ClearStyleStack();
    %Docstring
        ClearStyleStack()
        
        Clears the style stack.
    %End

    virtual
    size_t GetStyleStackSize() const;
    %Docstring
        GetStyleStackSize() -> size_t
        
        Returns the size of the style stack, for example to check correct
        nesting.
    %End

    bool BeginBold();
    %Docstring
        BeginBold() -> bool
        
        Begins using bold.
    %End

    bool EndBold();
    %Docstring
        EndBold() -> bool
        
        Ends using bold.
    %End

    bool BeginItalic();
    %Docstring
        BeginItalic() -> bool
        
        Begins using italic.
    %End

    bool EndItalic();
    %Docstring
        EndItalic() -> bool
        
        Ends using italic.
    %End

    bool BeginUnderline();
    %Docstring
        BeginUnderline() -> bool
        
        Begins using underline.
    %End

    bool EndUnderline();
    %Docstring
        EndUnderline() -> bool
        
        Ends using underline.
    %End

    bool BeginFontSize(
        int pointSize
    );
    %Docstring
        BeginFontSize(pointSize) -> bool
        
        Begins using point size.
    %End

    bool EndFontSize();
    %Docstring
        EndFontSize() -> bool
        
        Ends using point size.
    %End

    bool BeginFont(
        const wxFont & font
    );
    %Docstring
        BeginFont(font) -> bool
        
        Begins using this font.
    %End

    bool EndFont();
    %Docstring
        EndFont() -> bool
        
        Ends using a font.
    %End

    bool BeginTextColour(
        const wxColour & colour
    );
    %Docstring
        BeginTextColour(colour) -> bool
        
        Begins using this colour.
    %End

    bool EndTextColour();
    %Docstring
        EndTextColour() -> bool
        
        Ends using a colour.
    %End

    bool BeginAlignment(
        wxTextAttrAlignment alignment
    );
    %Docstring
        BeginAlignment(alignment) -> bool
        
        Begins using alignment.
    %End

    bool EndAlignment();
    %Docstring
        EndAlignment() -> bool
        
        Ends alignment.
    %End

    bool BeginLeftIndent(
        int leftIndent,
        int leftSubIndent = 0
    );
    %Docstring
        BeginLeftIndent(leftIndent, leftSubIndent=0) -> bool
        
        Begins using leftIndent for the left indent, and optionally
        leftSubIndent for the sub-indent.
    %End

    bool EndLeftIndent();
    %Docstring
        EndLeftIndent() -> bool
        
        Ends left indent.
    %End

    bool BeginRightIndent(
        int rightIndent
    );
    %Docstring
        BeginRightIndent(rightIndent) -> bool
        
        Begins a right indent, specified in tenths of a millimetre.
    %End

    bool EndRightIndent();
    %Docstring
        EndRightIndent() -> bool
        
        Ends right indent.
    %End

    bool BeginParagraphSpacing(
        int before,
        int after
    );
    %Docstring
        BeginParagraphSpacing(before, after) -> bool
        
        Begins paragraph spacing; pass the before-paragraph and after-
        paragraph spacing in tenths of a millimetre.
    %End

    bool EndParagraphSpacing();
    %Docstring
        EndParagraphSpacing() -> bool
        
        Ends paragraph spacing.
    %End

    bool BeginLineSpacing(
        int lineSpacing
    );
    %Docstring
        BeginLineSpacing(lineSpacing) -> bool
        
        Begins line spacing using the specified value.
    %End

    bool EndLineSpacing();
    %Docstring
        EndLineSpacing() -> bool
        
        Ends line spacing.
    %End

    bool BeginNumberedBullet(
        int bulletNumber,
        int leftIndent,
        int leftSubIndent,
        int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_ARABIC|wxTEXT_ATTR_BULLET_STYLE_PERIOD
    );
    %Docstring
        BeginNumberedBullet(bulletNumber, leftIndent, leftSubIndent, bulletStyle=wx.TEXT_ATTR_BULLET_STYLE_ARABIC|wx.TEXT_ATTR_BULLET_STYLE_PERIOD) -> bool
        
        Begins numbered bullet.
    %End

    bool EndNumberedBullet();
    %Docstring
        EndNumberedBullet() -> bool
        
        Ends numbered bullet.
    %End

    bool BeginSymbolBullet(
        const wxString & symbol,
        int leftIndent,
        int leftSubIndent,
        int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_SYMBOL
    );
    %Docstring
        BeginSymbolBullet(symbol, leftIndent, leftSubIndent, bulletStyle=wx.TEXT_ATTR_BULLET_STYLE_SYMBOL) -> bool
        
        Begins applying a symbol bullet, using a character from the current
        font.
    %End

    bool EndSymbolBullet();
    %Docstring
        EndSymbolBullet() -> bool
        
        Ends symbol bullet.
    %End

    bool BeginStandardBullet(
        const wxString & bulletName,
        int leftIndent,
        int leftSubIndent,
        int bulletStyle = wxTEXT_ATTR_BULLET_STYLE_STANDARD
    );
    %Docstring
        BeginStandardBullet(bulletName, leftIndent, leftSubIndent, bulletStyle=wx.TEXT_ATTR_BULLET_STYLE_STANDARD) -> bool
        
        Begins applying a standard bullet, using one of the standard bullet
        names (currently standard/circle or standard/square.
    %End

    bool EndStandardBullet();
    %Docstring
        EndStandardBullet() -> bool
        
        Ends standard bullet.
    %End

    bool BeginCharacterStyle(
        const wxString & characterStyle
    );
    %Docstring
        BeginCharacterStyle(characterStyle) -> bool
        
        Begins named character style.
    %End

    bool EndCharacterStyle();
    %Docstring
        EndCharacterStyle() -> bool
        
        Ends named character style.
    %End

    bool BeginParagraphStyle(
        const wxString & paragraphStyle
    );
    %Docstring
        BeginParagraphStyle(paragraphStyle) -> bool
        
        Begins named paragraph style.
    %End

    bool EndParagraphStyle();
    %Docstring
        EndParagraphStyle() -> bool
        
        Ends named character style.
    %End

    bool BeginListStyle(
        const wxString & listStyle,
        int level = 1,
        int number = 1
    );
    %Docstring
        BeginListStyle(listStyle, level=1, number=1) -> bool
        
        Begins named list style.
    %End

    bool EndListStyle();
    %Docstring
        EndListStyle() -> bool
        
        Ends named character style.
    %End

    bool BeginURL(
        const wxString & url,
        const wxString & characterStyle = wxEmptyString
    );
    %Docstring
        BeginURL(url, characterStyle=wx.EmptyString) -> bool
        
        Begins applying wxTEXT_ATTR_URL to the content.
    %End

    bool EndURL();
    %Docstring
        EndURL() -> bool
        
        Ends URL.
    %End

    bool AddEventHandler(
        wxEvtHandler * handler
    );
    %Docstring
        AddEventHandler(handler) -> bool
        
        Adds an event handler.
    %End

    bool RemoveEventHandler(
        wxEvtHandler * handler,
        bool deleteHandler = false
    );
    %Docstring
        RemoveEventHandler(handler, deleteHandler=False) -> bool
        
        Removes an event handler from the buffer's list of handlers, deleting
        the object if deleteHandler is true.
    %End

    void ClearEventHandlers();
    %Docstring
        ClearEventHandlers()
        
        Clear event handlers.
    %End

    bool SendEvent(
        wxEvent & event,
        bool sendToAll = true
    );
    %Docstring
        SendEvent(event, sendToAll=True) -> bool
        
        Send event to event handlers.
    %End

    virtual
    int HitTest(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxPoint & pt,
        long & textPosition   /Out/,
        wxRichTextObject ** obj   /Out/,
        wxRichTextObject ** contextObj   /Out/,
        int flags = 0
    );
    %Docstring
        HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj)
        
        Hit-testing: returns a flag indicating hit test details, plus
        information about position.
    %End

    void Copy(
        const wxRichTextBuffer & obj
    );
    %Docstring
        Copy(obj)
        
        Copies the buffer.
    %End

    virtual
    wxRichTextObject * Clone() const   /Factory/;
    %Docstring
        Clone() -> RichTextObject
        
        Clones the buffer.
    %End

    bool InsertParagraphsWithUndo(
        long pos,
        const wxRichTextParagraphLayoutBox & paragraphs,
        wxRichTextCtrl * ctrl,
        int flags = 0
    );
    %Docstring
        InsertParagraphsWithUndo(pos, paragraphs, ctrl, flags=0) -> bool
        
        Submits a command to insert paragraphs.
    %End

    bool InsertTextWithUndo(
        long pos,
        const wxString & text,
        wxRichTextCtrl * ctrl,
        int flags = 0
    );
    %Docstring
        InsertTextWithUndo(pos, text, ctrl, flags=0) -> bool
        
        Submits a command to insert the given text.
    %End

    bool InsertNewlineWithUndo(
        long pos,
        wxRichTextCtrl * ctrl,
        int flags = 0
    );
    %Docstring
        InsertNewlineWithUndo(pos, ctrl, flags=0) -> bool
        
        Submits a command to insert a newline.
    %End

    bool InsertImageWithUndo(
        long pos,
        const wxRichTextImageBlock & imageBlock,
        wxRichTextCtrl * ctrl,
        int flags = 0,
        const wxRichTextAttr & textAttr = wxRichTextAttr()
    );
    %Docstring
        InsertImageWithUndo(pos, imageBlock, ctrl, flags=0, textAttr=RichTextAttr()) -> bool
        
        Submits a command to insert the given image.
    %End

    wxRichTextObject * InsertObjectWithUndo(
        long pos,
        wxRichTextObject * object,
        wxRichTextCtrl * ctrl,
        int flags
    );
    %Docstring
        InsertObjectWithUndo(pos, object, ctrl, flags) -> RichTextObject
        
        Submits a command to insert an object.
    %End

    bool DeleteRangeWithUndo(
        const wxRichTextRange & range,
        wxRichTextCtrl * ctrl
    );
    %Docstring
        DeleteRangeWithUndo(range, ctrl) -> bool
        
        Submits a command to delete this range.
    %End

    void Modify(
        bool modify = true
    );
    %Docstring
        Modify(modify=True)
        
        Mark modified.
    %End

    bool IsModified() const;
    %Docstring
        IsModified() -> bool
        
        Returns true if the buffer was modified.
    %End

    double GetScale() const;
    %Docstring
        GetScale() -> double
        
        Returns the scale factor for calculating dimensions.
    %End

    void SetScale(
        double scale
    );
    %Docstring
        SetScale(scale)
        
        Sets the scale factor for calculating dimensions.
    %End

    static
    wxRichTextFileHandlerList& GetHandlers()   /NoCopy/;
    %Docstring
        GetHandlers() -> RichTextFileHandlerList
        
        Returns the file handlers.
    %End

    static
    void AddHandler(
        wxRichTextFileHandler * handler   /Transfer/
    );
    %Docstring
        AddHandler(handler)
        
        Adds a file handler to the end.
    %End

    static
    void InsertHandler(
        wxRichTextFileHandler * handler   /Transfer/
    );
    %Docstring
        InsertHandler(handler)
        
        Inserts a file handler at the front.
    %End

    static
    bool RemoveHandler(
        const wxString & name
    );
    %Docstring
        RemoveHandler(name) -> bool
        
        Removes a file handler.
    %End

    static
    wxRichTextFileHandler * FindHandler(
        wxRichTextFileType imageType
    )   /PyName=FindHandlerByType/;
    %Docstring
        FindHandlerByType(imageType) -> RichTextFileHandler
        
        Finds a handler by type.
    %End

    static
    wxRichTextFileHandler * FindHandler(
        const wxString & extension,
        wxRichTextFileType imageType
    )   /PyName=FindHandlerByExtension/;
    %Docstring
        FindHandlerByExtension(extension, imageType) -> RichTextFileHandler
        
        Finds a file handler by extension and type.
    %End

    static
    wxRichTextFileHandler * FindHandler(
        const wxString & name
    )   /PyName=FindHandlerByName/;
    %Docstring
        FindHandlerByName(name) -> RichTextFileHandler
        
        Finds a file handler by name.
    %End

    static
    wxRichTextFileHandler * FindHandlerFilenameOrType(
        const wxString & filename,
        wxRichTextFileType imageType
    )   /PyName=FindHandlerByFilename/;
    %Docstring
        FindHandlerByFilename(filename, imageType) -> RichTextFileHandler
        
        Finds a handler by filename or, if supplied, type.
    %End

    static PyObject* GetExtWildcard(bool combine=false,  bool save=false);
    %Docstring
        GetExtWildcard(combine=False, save=False) -> PyObject
        
        Gets a wildcard string for the file dialog based on all the currently
        loaded richtext file handlers, and a list that can be used to map
        those filter types to the file handler type.
    %End
    %MethodCode
        PyErr_Clear();
        Py_BEGIN_ALLOW_THREADS
        sipRes = _wxRichTextBuffer_GetExtWildcard(combine, save);
        Py_END_ALLOW_THREADS
        if (PyErr_Occurred()) sipIsErr = 1;
    %End
    %TypeCode
    PyObject* _wxRichTextBuffer_GetExtWildcard(bool combine, bool save)
    {
        wxString wildcards;
        wxArrayInt types;
        wildcards = wxRichTextBuffer::GetExtWildcard(combine, save, &types);
        
        wxPyThreadBlocker blocker;
        PyObject* list = PyList_New(0);
        for (size_t i=0; i < types.GetCount(); i++) {
            PyObject* number = wxPyInt_FromLong(types[i]);
            PyList_Append(list, number);
            Py_DECREF(number);
        }
        PyObject* tup = PyTuple_New(2);
        PyTuple_SET_ITEM(tup, 0, wx2PyString(wildcards));
        PyTuple_SET_ITEM(tup, 1, list);
        return tup;
    }
    %End

    static
    void CleanUpHandlers();
    %Docstring
        CleanUpHandlers()
        
        Clean up file handlers.
    %End

    static
    void InitStandardHandlers();
    %Docstring
        InitStandardHandlers()
        
        Initialise the standard file handlers.
    %End

    static
    wxRichTextDrawingHandlerList& GetDrawingHandlers()   /NoCopy/;
    %Docstring
        GetDrawingHandlers() -> RichTextDrawingHandlerList
        
        Returns the drawing handlers.
    %End

    static
    void AddDrawingHandler(
        wxRichTextDrawingHandler * handler   /Transfer/
    );
    %Docstring
        AddDrawingHandler(handler)
        
        Adds a drawing handler to the end.
    %End

    static
    void InsertDrawingHandler(
        wxRichTextDrawingHandler * handler   /Transfer/
    );
    %Docstring
        InsertDrawingHandler(handler)
        
        Inserts a drawing handler at the front.
    %End

    static
    bool RemoveDrawingHandler(
        const wxString & name
    );
    %Docstring
        RemoveDrawingHandler(name) -> bool
        
        Removes a drawing handler.
    %End

    static
    wxRichTextDrawingHandler * FindDrawingHandler(
        const wxString & name
    );
    %Docstring
        FindDrawingHandler(name) -> RichTextDrawingHandler
        
        Finds a drawing handler by name.
    %End

    static
    void CleanUpDrawingHandlers();
    %Docstring
        CleanUpDrawingHandlers()
        
        Clean up drawing handlers.
    %End

    static
    void AddFieldType(
        wxRichTextFieldType * fieldType   /Transfer/
    );
    %Docstring
        AddFieldType(fieldType)
        
        Adds a field type.
    %End

    static
    bool RemoveFieldType(
        const wxString & name
    );
    %Docstring
        RemoveFieldType(name) -> bool
        
        Removes a field type by name.
    %End

    static
    wxRichTextFieldType * FindFieldType(
        const wxString & name
    );
    %Docstring
        FindFieldType(name) -> RichTextFieldType
        
        Finds a field type by name.
    %End

    static
    void CleanUpFieldTypes();
    %Docstring
        CleanUpFieldTypes()
        
        Cleans up field types.
    %End

    static
    wxRichTextRenderer * GetRenderer();
    %Docstring
        GetRenderer() -> RichTextRenderer
        
        Returns the renderer object.
    %End

    static
    void SetRenderer(
        wxRichTextRenderer * renderer
    );
    %Docstring
        SetRenderer(renderer)
        
        Sets renderer as the object to be used to render certain aspects of
        the content, such as bullets.
    %End

    static
    int GetBulletRightMargin();
    %Docstring
        GetBulletRightMargin() -> int
        
        Returns the minimum margin between bullet and paragraph in 10ths of a
        mm.
    %End

    static
    void SetBulletRightMargin(
        int margin
    );
    %Docstring
        SetBulletRightMargin(margin)
        
        Sets the minimum margin between bullet and paragraph in 10ths of a mm.
    %End

    static
    float GetBulletProportion();
    %Docstring
        GetBulletProportion() -> float
        
        Returns the factor to multiply by character height to get a reasonable
        bullet size.
    %End

    static
    void SetBulletProportion(
        float prop
    );
    %Docstring
        SetBulletProportion(prop)
        
        Sets the factor to multiply by character height to get a reasonable
        bullet size.
    %End

    static
    bool GetFloatingLayoutMode();
    %Docstring
        GetFloatingLayoutMode() -> bool
        
        Returns the floating layout mode.
    %End

    static
    void SetFloatingLayoutMode(
        bool mode
    );
    %Docstring
        SetFloatingLayoutMode(mode)
        
        Sets the floating layout mode.
    %End

                    virtual bool Draw(wxDC& dc, wxRichTextDrawingContext& context,
                                      const wxRichTextRange& range,
                                      const wxRichTextSelection& selection,
                                      const wxRect& rect, int descent, int style);


                    virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context,
                                        const wxRect& rect, const wxRect& parentRect,
                                        int style);


                    virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size,
                                  int& descent,
                                  wxDC& dc, wxRichTextDrawingContext& context, int flags,
                                  const wxPoint& position = wxPoint(0,0),
                                  const wxSize& parentSize = wxDefaultSize,
                                  wxArrayInt* partialExtents = NULL) const;


    public:


    %Property(name=BatchedCommand, get=GetBatchedCommand)
    %Property(name=CommandProcessor, get=GetCommandProcessor)
    %Property(name=DimensionScale, get=GetDimensionScale, set=SetDimensionScale)
    %Property(name=FontScale, get=GetFontScale, set=SetFontScale)
    %Property(name=FontTable, get=GetFontTable, set=SetFontTable)
    %Property(name=HandlerFlags, get=GetHandlerFlags, set=SetHandlerFlags)
    %Property(name=Scale, get=GetScale, set=SetScale)
    %Property(name=StyleSheet, get=GetStyleSheet, set=SetStyleSheet)
    %Property(name=StyleStackSize, get=GetStyleStackSize)
};  // end of class wxRichTextBuffer


class wxRichTextCell : wxRichTextBox
{
    %Docstring
        RichTextCell(parent=None)
        RichTextCell(obj)
        
        wxRichTextCell is the cell in a table, in which the user can type.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextCell(
        wxRichTextObject * parent = NULL
    );

    wxRichTextCell(
        const wxRichTextCell & obj
    );

    virtual
    bool Draw(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRichTextRange & range,
        const wxRichTextSelection & selection,
        const wxRect & rect,
        int descent,
        int style
    );
    %Docstring
        Draw(dc, context, range, selection, rect, descent, style) -> bool
        
        Draw the item, within the given range.
    %End

    virtual
    int HitTest(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxPoint & pt,
        long & textPosition   /Out/,
        wxRichTextObject ** obj   /Out/,
        wxRichTextObject ** contextObj   /Out/,
        int flags = 0
    );
    %Docstring
        HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj)
        
        Hit-testing: returns a flag indicating hit test details, plus
        information about position.
    %End

    virtual
    wxString GetXMLNodeName() const;
    %Docstring
        GetXMLNodeName() -> String
        
        Returns the XML node name of this object.
    %End

    virtual
    bool CanEditProperties() const;
    %Docstring
        CanEditProperties() -> bool
        
        Returns true if we can edit the object's properties via a GUI.
    %End

    virtual
    bool EditProperties(
        wxWindow * parent,
        wxRichTextBuffer * buffer
    );
    %Docstring
        EditProperties(parent, buffer) -> bool
        
        Edits the object's properties via a GUI.
    %End

    virtual
    wxString GetPropertiesMenuLabel() const;
    %Docstring
        GetPropertiesMenuLabel() -> String
        
        Returns the label to be used for the properties context menu item.
    %End

    int GetColSpan() const;
    %Docstring
        GetColSpan() -> int
        
        Returns the number of columns spanned by the cell.
    %End

    void SetColSpan(
        long span
    );
    %Docstring
        SetColSpan(span)
        
        Set the number of columns spanned by the cell.
    %End

    int GetRowSpan() const;
    %Docstring
        GetRowSpan() -> int
        
        Returns the number of rows spanned by the cell.
    %End

    void SetRowSpan(
        long span
    );
    %Docstring
        SetRowSpan(span)
        
        Set the number of rows spanned by the cell.
    %End

    virtual
    wxRichTextObject * Clone() const   /Factory/;
    %Docstring
        Clone() -> RichTextObject
        
        Clones the object.
    %End

    void Copy(
        const wxRichTextCell & obj
    );
    %Docstring
        Copy(obj)
    %End

                    virtual bool Layout(wxDC& dc, wxRichTextDrawingContext& context,
                                        const wxRect& rect, const wxRect& parentRect,
                                        int style);


                    virtual bool GetRangeSize(const wxRichTextRange& range, wxSize& size,
                                  int& descent,
                                  wxDC& dc, wxRichTextDrawingContext& context, int flags,
                                  const wxPoint& position = wxPoint(0,0),
                                  const wxSize& parentSize = wxDefaultSize,
                                  wxArrayInt* partialExtents = NULL) const;


    public:


    %Property(name=ColSpan, get=GetColSpan, set=SetColSpan)
    %Property(name=PropertiesMenuLabel, get=GetPropertiesMenuLabel)
    %Property(name=RowSpan, get=GetRowSpan, set=SetRowSpan)
    %Property(name=XMLNodeName, get=GetXMLNodeName)
};  // end of class wxRichTextCell


class wxRichTextTable : wxRichTextBox
{
    %Docstring
        RichTextTable(parent=None)
        RichTextTable(obj)
        
        wxRichTextTable represents a table with arbitrary columns and rows.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextTable(
        wxRichTextObject * parent = NULL
    );

    wxRichTextTable(
        const wxRichTextTable & obj
    );

    virtual
    bool Draw(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRichTextRange & range,
        const wxRichTextSelection & selection,
        const wxRect & rect,
        int descent,
        int style
    );
    %Docstring
        Draw(dc, context, range, selection, rect, descent, style) -> bool
        
        Draw the item, within the given range.
    %End

    virtual
    int HitTest(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxPoint & pt,
        long & textPosition   /Out/,
        wxRichTextObject ** obj   /Out/,
        wxRichTextObject ** contextObj   /Out/,
        int flags = 0
    );
    %Docstring
        HitTest(dc, context, pt, flags=0) -> (int, textPosition, obj, contextObj)
        
        Hit-testing: returns a flag indicating hit test details, plus
        information about position.
    %End

    virtual
    wxString GetXMLNodeName() const;
    %Docstring
        GetXMLNodeName() -> String
        
        Returns the XML node name of this object.
    %End

    virtual
    bool Layout(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        const wxRect & rect,
        const wxRect & parentRect,
        int style
    );
    %Docstring
        Layout(dc, context, rect, parentRect, style) -> bool
        
        Lay the item out at the specified position with the given size
        constraint.
    %End

    virtual
    bool GetRangeSize(
        const wxRichTextRange & range,
        wxSize & size,
        int & descent,
        wxDC & dc,
        wxRichTextDrawingContext & context,
        int flags,
        const wxPoint & position = wxPoint(0, 0),
        const wxSize & parentSize = wxDefaultSize,
        wxArrayInt * partialExtents = NULL
    ) const;
    %Docstring
        GetRangeSize(range, size, descent, dc, context, flags, position=wx.Point(0,0), parentSize=wx.DefaultSize, partialExtents=None) -> bool
        
        Returns the object size for the given range.
    %End

    virtual
    bool DeleteRange(
        const wxRichTextRange & range
    );
    %Docstring
        DeleteRange(range) -> bool
        
        Deletes the given range.
    %End

    virtual
    wxString GetTextForRange(
        const wxRichTextRange & range
    ) const;
    %Docstring
        GetTextForRange(range) -> String
        
        Returns any text in this object for the given range.
    %End

    virtual
    bool ImportFromXML(
        wxRichTextBuffer * buffer,
        wxXmlNode * node,
        wxRichTextXMLHandler * handler,
        bool * recurse
    );
    %Docstring
        ImportFromXML(buffer, node, handler, recurse) -> bool
        
        Imports this object from XML.
    %End

    virtual
    bool FindPosition(
        wxDC & dc,
        wxRichTextDrawingContext & context,
        long index,
        wxPoint & pt   /Out/,
        int * height   /Out/,
        bool forceLineStart
    );
    %Docstring
        FindPosition(dc, context, index, forceLineStart) -> (bool, pt, height)
        
        Finds the absolute position and row height for the given character
        position.
    %End

    virtual
    void CalculateRange(
        long start,
        long & end   /Out/
    );
    %Docstring
        CalculateRange(start) -> end
        
        Calculates the range of the object.
    %End

    virtual
    bool HandlesChildSelections() const;
    %Docstring
        HandlesChildSelections() -> bool
        
        Returns true if this object can handle the selections of its children,
        fOr example a table.
    %End

    virtual
    wxRichTextSelection GetSelection(
        long start,
        long end
    ) const;
    %Docstring
        GetSelection(start, end) -> RichTextSelection
        
        Returns a selection object specifying the selections between start and
        end character positions.
    %End

    virtual
    bool CanEditProperties() const;
    %Docstring
        CanEditProperties() -> bool
        
        Returns true if we can edit the object's properties via a GUI.
    %End

    virtual
    bool EditProperties(
        wxWindow * parent,
        wxRichTextBuffer * buffer
    );
    %Docstring
        EditProperties(parent, buffer) -> bool
        
        Edits the object's properties via a GUI.
    %End

    virtual
    wxString GetPropertiesMenuLabel() const;
    %Docstring
        GetPropertiesMenuLabel() -> String
        
        Returns the label to be used for the properties context menu item.
    %End

    virtual
    bool AcceptsFocus() const;
    %Docstring
        AcceptsFocus() -> bool
        
        Returns true if objects of this class can accept the focus, i.e. a
        call to SetFocusObject is possible.
    %End

    wxRichTextObjectPtrArrayArray & GetCells();
    %Docstring
        GetCells() -> RichTextObjectPtrArrayArray
        
        Returns the cells array.
    %End

    int GetRowCount() const;
    %Docstring
        GetRowCount() -> int
        
        Returns the row count.
    %End

    int GetColumnCount() const;
    %Docstring
        GetColumnCount() -> int
        
        Returns the column count.
    %End

    virtual
    wxRichTextCell * GetCell(
        int row,
        int col
    ) const;
    %Docstring
        GetCell(row, col) -> RichTextCell
        GetCell(pos) -> RichTextCell
        
        Returns the cell at the given row/column position.
    %End

    virtual
    wxRichTextCell * GetCell(
        long pos
    ) const;

    virtual
    bool GetCellRowColumnPosition(
        long pos,
        int & row,
        int & col
    ) const;
    %Docstring
        GetCellRowColumnPosition(pos, row, col) -> bool
        
        Returns the row/column for a given character position.
    %End

    virtual
    wxPosition GetFocusedCell() const;
    %Docstring
        GetFocusedCell() -> wx.Position
        
        Returns the coordinates of the cell with keyboard focus, or (-1,-1) if
        none.
    %End

    virtual
    void ClearTable();
    %Docstring
        ClearTable()
        
        Clears the table.
    %End

    virtual
    bool CreateTable(
        int rows,
        int cols
    );
    %Docstring
        CreateTable(rows, cols) -> bool
        
        Creates a table of the given dimensions.
    %End

    virtual
    bool SetCellStyle(
        const wxRichTextSelection & selection,
        const wxRichTextAttr & style,
        int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO
    );
    %Docstring
        SetCellStyle(selection, style, flags=RICHTEXT_SETSTYLE_WITH_UNDO) -> bool
        
        Sets the attributes for the cells specified by the selection.
    %End

    virtual
    bool DeleteRows(
        int startRow,
        int noRows = 1
    );
    %Docstring
        DeleteRows(startRow, noRows=1) -> bool
        
        Deletes rows from the given row position.
    %End

    virtual
    bool DeleteColumns(
        int startCol,
        int noCols = 1
    );
    %Docstring
        DeleteColumns(startCol, noCols=1) -> bool
        
        Deletes columns from the given column position.
    %End

    virtual
    bool AddRows(
        int startRow,
        int noRows = 1,
        const wxRichTextAttr & attr = wxRichTextAttr()
    );
    %Docstring
        AddRows(startRow, noRows=1, attr=RichTextAttr()) -> bool
        
        Adds rows from the given row position.
    %End

    virtual
    bool AddColumns(
        int startCol,
        int noCols = 1,
        const wxRichTextAttr & attr = wxRichTextAttr()
    );
    %Docstring
        AddColumns(startCol, noCols=1, attr=RichTextAttr()) -> bool
        
        Adds columns from the given column position.
    %End

    virtual
    wxRichTextObject * Clone() const   /Factory/;
    %Docstring
        Clone() -> RichTextObject
        
        Clones the object.
    %End

    void Copy(
        const wxRichTextTable & obj
    );
    %Docstring
        Copy(obj)
    %End

    public:


    %Property(name=Cells, get=GetCells)
    %Property(name=ColumnCount, get=GetColumnCount)
    %Property(name=FocusedCell, get=GetFocusedCell)
    %Property(name=PropertiesMenuLabel, get=GetPropertiesMenuLabel)
    %Property(name=RowCount, get=GetRowCount)
    %Property(name=XMLNodeName, get=GetXMLNodeName)
};  // end of class wxRichTextTable


class wxRichTextObjectAddress
{
    %Docstring
        RichTextObjectAddress(topLevelContainer, obj)
        RichTextObjectAddress()
        RichTextObjectAddress(address)
        
        A class for specifying an object anywhere in an object hierarchy,
        without using a pointer, necessary since wxRTC commands may delete and
        recreate sub-objects so physical object addresses change.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextObjectAddress(
        wxRichTextParagraphLayoutBox * topLevelContainer,
        wxRichTextObject * obj
    );

    wxRichTextObjectAddress();

    wxRichTextObjectAddress(
        const wxRichTextObjectAddress & address
    );

    void Init();
    %Docstring
        Init()
    %End

    void Copy(
        const wxRichTextObjectAddress & address
    );
    %Docstring
        Copy(address)
        
        Copies the address.
    %End

    wxRichTextObject * GetObject(
        wxRichTextParagraphLayoutBox * topLevelContainer
    ) const;
    %Docstring
        GetObject(topLevelContainer) -> RichTextObject
        
        Returns the object specified by the address, given a top level
        container.
    %End

    bool Create(
        wxRichTextParagraphLayoutBox * topLevelContainer,
        wxRichTextObject * obj
    );
    %Docstring
        Create(topLevelContainer, obj) -> bool
        
        Creates the address given a container and an object.
    %End

    wxArrayInt & GetAddress();
    %Docstring
        GetAddress() -> ArrayInt
        
        Returns the array of integers representing the object address.
    %End

    void SetAddress(
        const wxArrayInt & address
    );
    %Docstring
        SetAddress(address)
        
        Sets the address from an array of integers.
    %End

    public:


    %Property(name=Address, get=GetAddress, set=SetAddress)
};  // end of class wxRichTextObjectAddress


class wxRichTextCommand : wxCommand
{
    %Docstring
        RichTextCommand(name, id, buffer, container, ctrl, ignoreFirstTime=False)
        RichTextCommand(name)
        
        Implements a command on the undo/redo stack.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextCommand(
        const wxString & name,
        wxRichTextCommandId id,
        wxRichTextBuffer * buffer,
        wxRichTextParagraphLayoutBox * container,
        wxRichTextCtrl * ctrl,
        bool ignoreFirstTime = false
    );

    wxRichTextCommand(
        const wxString & name
    );

    virtual
    ~wxRichTextCommand();

    virtual
    bool Do();
    %Docstring
        Do() -> bool
        
        Performs the command.
    %End

    virtual
    bool Undo();
    %Docstring
        Undo() -> bool
        
        Undoes the command.
    %End

    void AddAction(
        wxRichTextAction * action   /Transfer/
    );
    %Docstring
        AddAction(action)
        
        Adds an action to the action list.
    %End

    void ClearActions();
    %Docstring
        ClearActions()
        
        Clears the action list.
    %End

    wxRichTextActionList& GetActions()   /NoCopy/;
    %Docstring
        GetActions() -> RichTextActionList
        
        Returns the action list.
    %End

    public:


    %Property(name=Actions, get=GetActions)
};  // end of class wxRichTextCommand


class wxRichTextAction : wxObject
{
    %Docstring
        RichTextAction(cmd, name, id, buffer, container, ctrl, ignoreFirstTime=False)
        
        Implements a part of a command.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextAction(
        wxRichTextCommand * cmd,
        const wxString & name,
        wxRichTextCommandId id,
        wxRichTextBuffer * buffer,
        wxRichTextParagraphLayoutBox * container,
        wxRichTextCtrl * ctrl,
        bool ignoreFirstTime = false
    );

    virtual
    ~wxRichTextAction();

    bool Do();
    %Docstring
        Do() -> bool
        
        Performs the action.
    %End

    bool Undo();
    %Docstring
        Undo() -> bool
        
        Undoes the action.
    %End

    void UpdateAppearance(
        long caretPosition,
        bool sendUpdateEvent = false,
        const wxRect & oldFloatRect = wxRect(),
        wxArrayInt * optimizationLineCharPositions = NULL,
        wxArrayInt * optimizationLineYPositions = NULL,
        bool isDoCmd = true
    );
    %Docstring
        UpdateAppearance(caretPosition, sendUpdateEvent=False, oldFloatRect=wx.Rect(), optimizationLineCharPositions=None, optimizationLineYPositions=None, isDoCmd=True)
        
        Updates the control appearance, optimizing if possible given
        information from the call to Layout.
    %End

    void ApplyParagraphs(
        const wxRichTextParagraphLayoutBox & fragment
    );
    %Docstring
        ApplyParagraphs(fragment)
        
        Replaces the buffer paragraphs with the given fragment.
    %End

    wxRichTextParagraphLayoutBox & GetNewParagraphs();
    %Docstring
        GetNewParagraphs() -> RichTextParagraphLayoutBox
        
        Returns the new fragments.
    %End

    wxRichTextParagraphLayoutBox & GetOldParagraphs();
    %Docstring
        GetOldParagraphs() -> RichTextParagraphLayoutBox
        
        Returns the old fragments.
    %End

    wxRichTextAttr & GetAttributes();
    %Docstring
        GetAttributes() -> RichTextAttr
        
        Returns the attributes, for single-object commands.
    %End

    wxRichTextObject * GetObject() const;
    %Docstring
        GetObject() -> RichTextObject
        
        Returns the object to replace the one at the position defined by the
        container address and the action's range start position.
    %End

    void StoreObject(
        wxRichTextObject * obj
    );
    %Docstring
        StoreObject(obj)
        
        Stores the object to replace the one at the position defined by the
        container address without making an address for it.
    %End

    void SetObject(
        wxRichTextObject * obj
    );
    %Docstring
        SetObject(obj)
        
        Sets the object to replace the one at the position defined by the
        container address and the action's range start position.
    %End

    void MakeObject(
        wxRichTextObject * obj
    );
    %Docstring
        MakeObject(obj)
        
        Makes an address from the given object.
    %End

    void SetOldAndNewObjects(
        wxRichTextObject * oldObj,
        wxRichTextObject * newObj
    );
    %Docstring
        SetOldAndNewObjects(oldObj, newObj)
        
        Sets the existing and new objects, for use with
        wxRICHTEXT_CHANGE_OBJECT.
    %End

    void CalculateRefreshOptimizations(
        wxArrayInt & optimizationLineCharPositions,
        wxArrayInt & optimizationLineYPositions,
        wxRect & oldFloatRect
    );
    %Docstring
        CalculateRefreshOptimizations(optimizationLineCharPositions, optimizationLineYPositions, oldFloatRect)
        
        Calculate arrays for refresh optimization.
    %End

    void SetPosition(
        long pos
    );
    %Docstring
        SetPosition(pos)
        
        Sets the position used for e.g.
    %End

    long GetPosition() const;
    %Docstring
        GetPosition() -> long
        
        Returns the position used for e.g.
    %End

    void SetRange(
        const wxRichTextRange & range
    );
    %Docstring
        SetRange(range)
        
        Sets the range for e.g.
    %End

    const wxRichTextRange & GetRange() const;
    %Docstring
        GetRange() -> RichTextRange
        
        Returns the range for e.g.
    %End

    wxRichTextObjectAddress & GetContainerAddress();
    %Docstring
        GetContainerAddress() -> RichTextObjectAddress
        
        Returns the address (nested position) of the container within the
        buffer being manipulated.
    %End

    void SetContainerAddress(
        const wxRichTextObjectAddress & address
    );
    %Docstring
        SetContainerAddress(address)
        SetContainerAddress(container, obj)
        
        Sets the address (nested position) of the container within the buffer
        being manipulated.
    %End

    void SetContainerAddress(
        wxRichTextParagraphLayoutBox * container,
        wxRichTextObject * obj
    );

    wxRichTextParagraphLayoutBox * GetContainer() const;
    %Docstring
        GetContainer() -> RichTextParagraphLayoutBox
        
        Returns the container that this action refers to, using the container
        address and top-level buffer.
    %End

    const wxString & GetName() const;
    %Docstring
        GetName() -> String
        
        Returns the action name.
    %End

    void SetIgnoreFirstTime(
        bool b
    );
    %Docstring
        SetIgnoreFirstTime(b)
        
        Instructs the first Do() command should be skipped as it's already
        been applied.
    %End

    bool GetIgnoreFirstTime() const;
    %Docstring
        GetIgnoreFirstTime() -> bool
        
        Returns true if the first Do() command should be skipped as it's
        already been applied.
    %End

    public:


    %Property(name=Attributes, get=GetAttributes)
    %Property(name=Container, get=GetContainer)
    %Property(name=ContainerAddress, get=GetContainerAddress, set=SetContainerAddress)
    %Property(name=IgnoreFirstTime, get=GetIgnoreFirstTime, set=SetIgnoreFirstTime)
    %Property(name=Name, get=GetName)
    %Property(name=NewParagraphs, get=GetNewParagraphs)
    %Property(name=Object, get=GetObject, set=SetObject)
    %Property(name=OldParagraphs, get=GetOldParagraphs)
    %Property(name=Position, get=GetPosition, set=SetPosition)
    %Property(name=Range, get=GetRange, set=SetRange)
};  // end of class wxRichTextAction


class wxRichTextFileHandler : wxObject
{
    %Docstring
        RichTextFileHandler(name=wx.EmptyString, ext=wx.EmptyString, type=0)
        
        The base class for file handlers.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextFileHandler(
        const wxString & name = wxEmptyString,
        const wxString & ext = wxEmptyString,
        int type = 0
    );

    bool LoadFile(
        wxRichTextBuffer * buffer,
        wxInputStream & stream
    );
    %Docstring
        LoadFile(buffer, stream) -> bool
        LoadFile(buffer, filename) -> bool
        
        Loads the buffer from a stream.
    %End

    virtual
    bool LoadFile(
        wxRichTextBuffer * buffer,
        const wxString & filename
    );

    bool SaveFile(
        wxRichTextBuffer * buffer,
        wxOutputStream & stream
    );
    %Docstring
        SaveFile(buffer, stream) -> bool
        SaveFile(buffer, filename) -> bool
        
        Saves the buffer to a stream.
    %End

    virtual
    bool SaveFile(
        wxRichTextBuffer * buffer,
        const wxString & filename
    );

    virtual
    bool CanHandle(
        const wxString & filename
    ) const;
    %Docstring
        CanHandle(filename) -> bool
        
        Returns true if we handle this filename (if using files).
    %End

    virtual
    bool CanSave() const;
    %Docstring
        CanSave() -> bool
        
        Returns true if we can save using this handler.
    %End

    virtual
    bool CanLoad() const;
    %Docstring
        CanLoad() -> bool
        
        Returns true if we can load using this handler.
    %End

    virtual
    bool IsVisible() const;
    %Docstring
        IsVisible() -> bool
        
        Returns true if this handler should be visible to the user.
    %End

    virtual
    void SetVisible(
        bool visible
    );
    %Docstring
        SetVisible(visible)
        
        Sets whether the handler should be visible to the user (via the
        application's load and save dialogs).
    %End

    void SetName(
        const wxString & name
    );
    %Docstring
        SetName(name)
        
        Sets the name of the handler.
    %End

    wxString GetName() const;
    %Docstring
        GetName() -> String
        
        Returns the name of the handler.
    %End

    void SetExtension(
        const wxString & ext
    );
    %Docstring
        SetExtension(ext)
        
        Sets the default extension to recognise.
    %End

    wxString GetExtension() const;
    %Docstring
        GetExtension() -> String
        
        Returns the default extension to recognise.
    %End

    void SetType(
        int type
    );
    %Docstring
        SetType(type)
        
        Sets the handler type.
    %End

    int GetType() const;
    %Docstring
        GetType() -> int
        
        Returns the handler type.
    %End

    void SetFlags(
        int flags
    );
    %Docstring
        SetFlags(flags)
        
        Sets flags that change the behaviour of loading or saving.
    %End

    int GetFlags() const;
    %Docstring
        GetFlags() -> int
        
        Returns flags controlling how loading and saving is done.
    %End

    void SetEncoding(
        const wxString & encoding
    );
    %Docstring
        SetEncoding(encoding)
        
        Sets the encoding to use when saving a file.
    %End

    const wxString & GetEncoding() const;
    %Docstring
        GetEncoding() -> String
        
        Returns the encoding to use when saving a file.
    %End

    public:


    %Property(name=Encoding, get=GetEncoding, set=SetEncoding)
    %Property(name=Extension, get=GetExtension, set=SetExtension)
    %Property(name=Flags, get=GetFlags, set=SetFlags)
    %Property(name=Name, get=GetName, set=SetName)
    %Property(name=Type, get=GetType, set=SetType)

protected:
    virtual
    bool DoLoadFile(
        wxRichTextBuffer * buffer,
        wxInputStream & stream
    ) = 0;
    %Docstring
        DoLoadFile(buffer, stream) -> bool
        
        Override to load content from stream into buffer.
    %End

    virtual
    bool DoSaveFile(
        wxRichTextBuffer * buffer,
        wxOutputStream & stream
    ) = 0;
    %Docstring
        DoSaveFile(buffer, stream) -> bool
        
        Override to save content to stream from buffer.
    %End

};  // end of class wxRichTextFileHandler


class wxRichTextPlainTextHandler : wxRichTextFileHandler
{
    %Docstring
        RichTextPlainTextHandler(name="Text", ext="txt", type=RICHTEXT_TYPE_TEXT)
        
        Implements saving a buffer to plain text.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextPlainTextHandler(
        const wxString & name = "Text",
        const wxString & ext = "txt",
        wxRichTextFileType type = wxRICHTEXT_TYPE_TEXT
    );

    virtual
    bool CanSave() const;
    %Docstring
        CanSave() -> bool
        
        Returns true if we can save using this handler.
    %End

    virtual
    bool CanLoad() const;
    %Docstring
        CanLoad() -> bool
        
        Returns true if we can load using this handler.
    %End


protected:
    virtual
    bool DoLoadFile(
        wxRichTextBuffer * buffer,
        wxInputStream & stream
    );
    %Docstring
        DoLoadFile(buffer, stream) -> bool
        
        Override to load content from stream into buffer.
    %End

    virtual
    bool DoSaveFile(
        wxRichTextBuffer * buffer,
        wxOutputStream & stream
    );
    %Docstring
        DoSaveFile(buffer, stream) -> bool
        
        Override to save content to stream from buffer.
    %End

};  // end of class wxRichTextPlainTextHandler


class wxRichTextDrawingHandler : wxObject
{
    %Docstring
        RichTextDrawingHandler(name=wx.EmptyString)
        
        The base class for custom drawing handlers.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextDrawingHandler(
        const wxString & name = wxEmptyString
    );

    virtual
    bool HasVirtualAttributes(
        wxRichTextObject * obj
    ) const = 0;
    %Docstring
        HasVirtualAttributes(obj) -> bool
        
        Returns true if this object has virtual attributes that we can
        provide.
    %End

    virtual
    bool GetVirtualAttributes(
        wxRichTextAttr & attr,
        wxRichTextObject * obj
    ) const = 0;
    %Docstring
        GetVirtualAttributes(attr, obj) -> bool
        
        Provides virtual attributes that we can provide.
    %End

    virtual
    int GetVirtualSubobjectAttributesCount(
        wxRichTextObject * obj
    ) const = 0;
    %Docstring
        GetVirtualSubobjectAttributesCount(obj) -> int
        
        Gets the count for mixed virtual attributes for individual positions
        within the object.
    %End

    virtual
    int GetVirtualSubobjectAttributes(
        wxRichTextObject * obj,
        wxArrayInt & positions,
        wxRichTextAttrArray & attributes
    ) const = 0;
    %Docstring
        GetVirtualSubobjectAttributes(obj, positions, attributes) -> int
        
        Gets the mixed virtual attributes for individual positions within the
        object.
    %End

    virtual
    bool HasVirtualText(
        const wxRichTextPlainText * obj
    ) const = 0;
    %Docstring
        HasVirtualText(obj) -> bool
        
        Do we have virtual text for this object? Virtual text allows an
        application to replace characters in an object for editing and display
        purposes, for example for highlighting special characters.
    %End

    virtual
    bool GetVirtualText(
        const wxRichTextPlainText * obj,
        wxString & text
    ) const = 0;
    %Docstring
        GetVirtualText(obj, text) -> bool
        
        Gets the virtual text for this object.
    %End

    void SetName(
        const wxString & name
    );
    %Docstring
        SetName(name)
        
        Sets the name of the handler.
    %End

    wxString GetName() const;
    %Docstring
        GetName() -> String
        
        Returns the name of the handler.
    %End

    public:


    %Property(name=Name, get=GetName, set=SetName)
};  // end of class wxRichTextDrawingHandler


class wxRichTextBufferDataObject : wxDataObjectSimple
{
    %Docstring
        RichTextBufferDataObject(richTextBuffer=None)
        
        Implements a rich text data object for clipboard transfer.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextBufferDataObject(
        wxRichTextBuffer * richTextBuffer = NULL
    );

    virtual
    ~wxRichTextBufferDataObject();

    wxRichTextBuffer * GetRichTextBuffer();
    %Docstring
        GetRichTextBuffer() -> RichTextBuffer
        
        After a call to this function, the buffer is owned by the caller and
        it is responsible for deleting it.
    %End

    virtual
    wxDataFormat GetPreferredFormat(
        Direction dir
    ) const;
    %Docstring
        GetPreferredFormat(dir) -> wx.DataFormat
        
        Returns the preferred format for either rendering the data (if dir is
        Get, its default value) or for setting it.
    %End

    virtual
    size_t GetDataSize() const;
    %Docstring
        GetDataSize() -> size_t
        GetDataSize(format) -> size_t
        
        Gets the size of our data.
    %End

    virtual
    size_t GetDataSize(
        const wxDataFormat & format
    ) const;

    virtual
    bool GetDataHere(
        void * buf
    ) const;
    %Docstring
        GetDataHere(buf) -> bool
        GetDataHere(format, buf) -> bool
        
        Copy the data to the buffer, return true on success.
    %End

    virtual
    bool GetDataHere(
        const wxDataFormat & format,
        void * buf
    ) const;

    virtual
    bool SetData(
        size_t len,
        const void * buf
    );
    %Docstring
        SetData(len, buf) -> bool
        SetData(format, len, buf) -> bool
        
        Copy the data from the buffer, return true on success.
    %End

    virtual
    bool SetData(
        const wxDataFormat & format,
        size_t len,
        const void * buf
    );

    static
    const wxChar * GetRichTextBufferFormatId();
    %Docstring
        GetRichTextBufferFormatId() -> Char
        
        Returns the id for the new data format.
    %End

    public:


    %Property(name=DataSize, get=GetDataSize)
    %Property(name=RichTextBuffer, get=GetRichTextBuffer)
};  // end of class wxRichTextBufferDataObject


class wxRichTextRenderer : wxObject
{
    %Docstring
        RichTextRenderer()
        
        This class isolates some common drawing functionality.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextRenderer();

    virtual
    ~wxRichTextRenderer();

    virtual
    bool DrawStandardBullet(
        wxRichTextParagraph * paragraph,
        wxDC & dc,
        const wxRichTextAttr & attr,
        const wxRect & rect
    ) = 0;
    %Docstring
        DrawStandardBullet(paragraph, dc, attr, rect) -> bool
        
        Draws a standard bullet, as specified by the value of GetBulletName.
    %End

    virtual
    bool DrawTextBullet(
        wxRichTextParagraph * paragraph,
        wxDC & dc,
        const wxRichTextAttr & attr,
        const wxRect & rect,
        const wxString & text
    ) = 0;
    %Docstring
        DrawTextBullet(paragraph, dc, attr, rect, text) -> bool
        
        Draws a bullet that can be described by text, such as numbered or
        symbol bullets.
    %End

    virtual
    bool DrawBitmapBullet(
        wxRichTextParagraph * paragraph,
        wxDC & dc,
        const wxRichTextAttr & attr,
        const wxRect & rect
    ) = 0;
    %Docstring
        DrawBitmapBullet(paragraph, dc, attr, rect) -> bool
        
        Draws a bitmap bullet, where the bullet bitmap is specified by the
        value of GetBulletName.
    %End

    virtual
    bool EnumerateStandardBulletNames(
        wxArrayString & bulletNames
    ) = 0;
    %Docstring
        EnumerateStandardBulletNames(bulletNames) -> bool
        
        Enumerate the standard bullet names currently supported.
    %End

    virtual
    bool MeasureBullet(
        wxRichTextParagraph * paragraph,
        wxDC & dc,
        const wxRichTextAttr & attr,
        wxSize & sz
    ) = 0;
    %Docstring
        MeasureBullet(paragraph, dc, attr, sz) -> bool
        
        Measure the bullet.
    %End

};  // end of class wxRichTextRenderer


class wxRichTextStdRenderer : wxRichTextRenderer
{
    %Docstring
        RichTextStdRenderer()
        
        The standard renderer for drawing bullets.
    %End
    %TypeHeaderCode
        #include <wx/richtext/richtextbuffer.h>
    %End

public:
    wxRichTextStdRenderer();

    virtual
    bool DrawStandardBullet(
        wxRichTextParagraph * paragraph,
        wxDC & dc,
        const wxRichTextAttr & attr,
        const wxRect & rect
    );
    %Docstring
        DrawStandardBullet(paragraph, dc, attr, rect) -> bool
        
        Draws a standard bullet, as specified by the value of GetBulletName.
    %End

    virtual
    bool DrawTextBullet(
        wxRichTextParagraph * paragraph,
        wxDC & dc,
        const wxRichTextAttr & attr,
        const wxRect & rect,
        const wxString & text
    );
    %Docstring
        DrawTextBullet(paragraph, dc, attr, rect, text) -> bool
        
        Draws a bullet that can be described by text, such as numbered or
        symbol bullets.
    %End

    virtual
    bool DrawBitmapBullet(
        wxRichTextParagraph * paragraph,
        wxDC & dc,
        const wxRichTextAttr & attr,
        const wxRect & rect
    );
    %Docstring
        DrawBitmapBullet(paragraph, dc, attr, rect) -> bool
        
        Draws a bitmap bullet, where the bullet bitmap is specified by the
        value of GetBulletName.
    %End

    virtual
    bool EnumerateStandardBulletNames(
        wxArrayString & bulletNames
    );
    %Docstring
        EnumerateStandardBulletNames(bulletNames) -> bool
        
        Enumerate the standard bullet names currently supported.
    %End

    virtual
    bool MeasureBullet(
        wxRichTextParagraph * paragraph,
        wxDC & dc,
        const wxRichTextAttr & attr,
        wxSize & sz
    );
    %Docstring
        MeasureBullet(paragraph, dc, attr, sz) -> bool
        
        Measure the bullet.
    %End

};  // end of class wxRichTextStdRenderer


bool wxRichTextHasStyle(
    int flags,
    int style
);
%Docstring
    RichTextHasStyle(flags, style) -> bool
%End

bool wxTextAttrEq(
    const wxRichTextAttr & attr1,
    const wxRichTextAttr & attr2
);
%Docstring
    TextAttrEq(attr1, attr2) -> bool
    
    Compare two attribute objects.
%End

bool wxRichTextApplyStyle(
    wxRichTextAttr & destStyle,
    const wxRichTextAttr & style,
    wxRichTextAttr * compareWith = NULL
);
%Docstring
    RichTextApplyStyle(destStyle, style, compareWith=None) -> bool
    
    Apply one style to another.
%End

bool wxRichTextRemoveStyle(
    wxRichTextAttr & destStyle,
    const wxRichTextAttr & style
);
%Docstring
    RichTextRemoveStyle(destStyle, style) -> bool
%End

bool wxRichTextCombineBitlists(
    int & valueA,
    int valueB,
    int & flagsA,
    int flagsB
);
%Docstring
    RichTextCombineBitlists(valueA, valueB, flagsA, flagsB) -> bool
    
    Combine two bitlists.
%End

bool wxRichTextBitlistsEqPartial(
    int valueA,
    int valueB,
    int flags
);
%Docstring
    RichTextBitlistsEqPartial(valueA, valueB, flags) -> bool
    
    Compare two bitlists.
%End

bool wxRichTextSplitParaCharStyles(
    const wxRichTextAttr & style,
    wxRichTextAttr & parStyle,
    wxRichTextAttr & charStyle
);
%Docstring
    RichTextSplitParaCharStyles(style, parStyle, charStyle) -> bool
    
    Split into paragraph and character styles.
%End

bool wxRichTextTabsEq(
    const wxArrayInt & tabs1,
    const wxArrayInt & tabs2
);
%Docstring
    RichTextTabsEq(tabs1, tabs2) -> bool
    
    Compare tabs.
%End

wxString wxRichTextDecimalToRoman(
    long n
);
%Docstring
    RichTextDecimalToRoman(n) -> String
    
    Convert a decimal to Roman numerals.
%End

void wxTextAttrCollectCommonAttributes(
    wxTextAttr & currentStyle,
    const wxTextAttr & attr,
    wxTextAttr & clashingAttr,
    wxTextAttr & absentAttr
);
%Docstring
    TextAttrCollectCommonAttributes(currentStyle, attr, clashingAttr, absentAttr)
%End

void wxRichTextModuleInit();
%Docstring
    RichTextModuleInit()
%End

typedef wxVector< wxRichTextLine * > wxRichTextLineVector;

class wxRichTextRangeArray
{
public:
    SIP_SSIZE_T __len__();
    %MethodCode
        sipRes = sipCpp->GetCount();
    %End

            wxRichTextRange& __getitem__(long index);
        %MethodCode
            if (0 > index)
                index += sipCpp->GetCount();

            if ((index < sipCpp->GetCount()) && (0 <= index)) {
                sipRes = &sipCpp->Item(index);
            }
            else {
                wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
                sipError = sipErrorFail;
            }
        %End
        

    int __contains__(wxRichTextRange& obj);
    %MethodCode
        int idx = sipCpp->Index(*obj, false);
        sipRes = idx != wxNOT_FOUND;
    %End

    void append(wxRichTextRange& obj);
    %MethodCode
        sipCpp->Add(*obj);
    %End

    // TODO:  add support for index(value, [start, [stop]])
    int index(wxRichTextRange& obj);
    %MethodCode
        int idx = sipCpp->Index(*obj, false);
        if (idx == wxNOT_FOUND) {
            sipError = sipErrorFail;
            wxPyErr_SetString(PyExc_ValueError,
                              "sequence.index(x): x not in sequence");
            }
        sipRes = idx;
    %End
};

%Extract(id=pycode_richtext)
def _RichTextRangeArray___repr__(self):
    return "RichTextRangeArray: " + repr(list(self))
RichTextRangeArray.__repr__ = _RichTextRangeArray___repr__
del _RichTextRangeArray___repr__
%End


class wxRichTextAttrArray
{
public:
    SIP_SSIZE_T __len__();
    %MethodCode
        sipRes = sipCpp->GetCount();
    %End

            wxRichTextAttr& __getitem__(long index);
        %MethodCode
            if (0 > index)
                index += sipCpp->GetCount();

            if ((index < sipCpp->GetCount()) && (0 <= index)) {
                sipRes = &sipCpp->Item(index);
            }
            else {
                wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
                sipError = sipErrorFail;
            }
        %End
        

    int __contains__(wxRichTextAttr& obj);
    %MethodCode
        int idx = sipCpp->Index(*obj, false);
        sipRes = idx != wxNOT_FOUND;
    %End

    void append(wxRichTextAttr& obj);
    %MethodCode
        sipCpp->Add(*obj);
    %End

    // TODO:  add support for index(value, [start, [stop]])
    int index(wxRichTextAttr& obj);
    %MethodCode
        int idx = sipCpp->Index(*obj, false);
        if (idx == wxNOT_FOUND) {
            sipError = sipErrorFail;
            wxPyErr_SetString(PyExc_ValueError,
                              "sequence.index(x): x not in sequence");
            }
        sipRes = idx;
    %End
};

%Extract(id=pycode_richtext)
def _RichTextAttrArray___repr__(self):
    return "RichTextAttrArray: " + repr(list(self))
RichTextAttrArray.__repr__ = _RichTextAttrArray___repr__
del _RichTextAttrArray___repr__
%End


class wxRichTextVariantArray
{
public:
    SIP_SSIZE_T __len__();
    %MethodCode
        sipRes = sipCpp->GetCount();
    %End

            wxVariant& __getitem__(long index);
        %MethodCode
            if (0 > index)
                index += sipCpp->GetCount();

            if ((index < sipCpp->GetCount()) && (0 <= index)) {
                sipRes = &sipCpp->Item(index);
            }
            else {
                wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
                sipError = sipErrorFail;
            }
        %End
        

    int __contains__(wxVariant& obj);
    %MethodCode
        int idx = sipCpp->Index(*obj, false);
        sipRes = idx != wxNOT_FOUND;
    %End

    void append(wxVariant& obj);
    %MethodCode
        sipCpp->Add(*obj);
    %End

    // TODO:  add support for index(value, [start, [stop]])
    int index(wxVariant& obj);
    %MethodCode
        int idx = sipCpp->Index(*obj, false);
        if (idx == wxNOT_FOUND) {
            sipError = sipErrorFail;
            wxPyErr_SetString(PyExc_ValueError,
                              "sequence.index(x): x not in sequence");
            }
        sipRes = idx;
    %End
};

%Extract(id=pycode_richtext)
def _RichTextVariantArray___repr__(self):
    return "RichTextVariantArray: " + repr(list(self))
RichTextVariantArray.__repr__ = _RichTextVariantArray___repr__
del _RichTextVariantArray___repr__
%End


class wxRichTextObjectList_iterator /Abstract/
{
    // the C++ implementation of this class
    %TypeHeaderCode
        
        
        class wxRichTextObjectList_iterator {
        public:
            wxRichTextObjectList_iterator(wxRichTextObjectList::compatibility_iterator start)
                : m_node(start) {}

            wxRichTextObject* __next__() {
                wxRichTextObject* obj = NULL;
                if (m_node) {
                    obj = (wxRichTextObject*) m_node->GetData();
                    m_node = m_node->GetNext();
                }
                else {
                    PyErr_SetString(PyExc_StopIteration, "");
                }
                return (wxRichTextObject*)obj;
            }
        private:
            wxRichTextObjectList::compatibility_iterator m_node;
        };
    %End
public:
    wxRichTextObject* __next__();
    %MethodCode
        sipRes = sipCpp->__next__();
        if (PyErr_Occurred())
            return NULL;
    %End
};

class wxRichTextObjectList
{
    %TypeHeaderCode
        
        
    %End
public:
    SIP_SSIZE_T __len__();
    %MethodCode
        sipRes = sipCpp->size();
    %End

    wxRichTextObject* __getitem__(long index);
    %MethodCode
        if (0 > index)
            index += sipCpp->size();

        if (index < sipCpp->size() && (0 <= index)) {
            wxRichTextObjectList::compatibility_iterator node = sipCpp->Item(index);
            if (node)
                sipRes = (wxRichTextObject*)node->GetData();
        }
        else {
            wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
            sipError = sipErrorFail;
        }
    %End

    int __contains__(const wxRichTextObject* obj);
    %MethodCode
        wxRichTextObjectList::compatibility_iterator node;
        node = sipCpp->Find((wxRichTextObject*)obj);
        sipRes = node != NULL;
    %End

    wxRichTextObjectList_iterator* __iter__() /Factory/;
    %MethodCode
        sipRes =  new wxRichTextObjectList_iterator(sipCpp->GetFirst());
    %End

    // TODO:  add support for index(value, [start, [stop]])
    int index(wxRichTextObject* obj);
    %MethodCode
        int idx = sipCpp->IndexOf((wxRichTextObject*)obj);
        if (idx == wxNOT_FOUND) {
            sipError = sipErrorFail;
            wxPyErr_SetString(PyExc_ValueError,
                              "sequence.index(x): x not in sequence");
        }
        sipRes = idx;
    %End

    
};

%Extract(id=pycode_richtext)
def _RichTextObjectList___repr__(self):
    return "RichTextObjectList: " + repr(list(self))
RichTextObjectList.__repr__ = _RichTextObjectList___repr__
del _RichTextObjectList___repr__
%End


class wxRichTextObjectPtrArray
{
public:
    SIP_SSIZE_T __len__();
    %MethodCode
        sipRes = sipCpp->GetCount();
    %End

    wxRichTextObject* __getitem__(long index);
    %MethodCode
        if (0 > index)
            index += sipCpp->GetCount();

        if ((index < sipCpp->GetCount()) && (0 <= index)) {
            sipRes = sipCpp->Item(index);
        }
        else {
            wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
            sipError = sipErrorFail;
        }
    %End

    int __contains__(wxRichTextObject* obj);
    %MethodCode
        int idx = sipCpp->Index(obj, false);
        sipRes = idx != wxNOT_FOUND;
    %End

    void append(wxRichTextObject* obj);
    %MethodCode
        sipCpp->Add(obj);
    %End

    // TODO:  add support for index(value, [start, [stop]])
    int index(wxRichTextObject* obj);
    %MethodCode
        int idx = sipCpp->Index(obj, false);
        if (idx == wxNOT_FOUND) {
            sipError = sipErrorFail;
            wxPyErr_SetString(PyExc_ValueError,
                              "sequence.index(x): x not in sequence");
            }
        sipRes = idx;
    %End
};

%Extract(id=pycode_richtext)
def _RichTextObjectPtrArray___repr__(self):
    return "RichTextObjectPtrArray: " + repr(list(self))
RichTextObjectPtrArray.__repr__ = _RichTextObjectPtrArray___repr__
del _RichTextObjectPtrArray___repr__
%End


class wxRichTextObjectPtrArrayArray
{
public:
    SIP_SSIZE_T __len__();
    %MethodCode
        sipRes = sipCpp->GetCount();
    %End

            wxRichTextObjectPtrArray& __getitem__(long index);
        %MethodCode
            if (0 > index)
                index += sipCpp->GetCount();

            if ((index < sipCpp->GetCount()) && (0 <= index)) {
                sipRes = &sipCpp->Item(index);
            }
            else {
                wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
                sipError = sipErrorFail;
            }
        %End
        

    int __contains__(wxRichTextObjectPtrArray& obj);
    %MethodCode
        int idx = sipCpp->Index(*obj, false);
        sipRes = idx != wxNOT_FOUND;
    %End

    void append(wxRichTextObjectPtrArray& obj);
    %MethodCode
        sipCpp->Add(*obj);
    %End

    // TODO:  add support for index(value, [start, [stop]])
    int index(wxRichTextObjectPtrArray& obj);
    %MethodCode
        int idx = sipCpp->Index(*obj, false);
        if (idx == wxNOT_FOUND) {
            sipError = sipErrorFail;
            wxPyErr_SetString(PyExc_ValueError,
                              "sequence.index(x): x not in sequence");
            }
        sipRes = idx;
    %End
};

%Extract(id=pycode_richtext)
def _RichTextObjectPtrArrayArray___repr__(self):
    return "RichTextObjectPtrArrayArray: " + repr(list(self))
RichTextObjectPtrArrayArray.__repr__ = _RichTextObjectPtrArrayArray___repr__
del _RichTextObjectPtrArrayArray___repr__
%End


%Extract(id=pycode_richtext)
from collections import namedtuple
_im_RichTextRange = namedtuple('_im_RichTextRange', ['Start', 'End'])
del namedtuple

%End

class wxRichTextObjectList__iterator /Abstract/
{
    // the C++ implementation of this class
    %TypeHeaderCode
        
        typedef wxList wxRichTextObjectList_;
        class wxRichTextObjectList__iterator {
        public:
            wxRichTextObjectList__iterator(wxRichTextObjectList_::compatibility_iterator start)
                : m_node(start) {}

            wxRichTextObject* __next__() {
                wxRichTextObject* obj = NULL;
                if (m_node) {
                    obj = (wxRichTextObject*) m_node->GetData();
                    m_node = m_node->GetNext();
                }
                else {
                    PyErr_SetString(PyExc_StopIteration, "");
                }
                return (wxRichTextObject*)obj;
            }
        private:
            wxRichTextObjectList_::compatibility_iterator m_node;
        };
    %End
public:
    wxRichTextObject* __next__();
    %MethodCode
        sipRes = sipCpp->__next__();
        if (PyErr_Occurred())
            return NULL;
    %End
};

class wxRichTextObjectList_
{
    %TypeHeaderCode
        
        typedef wxList wxRichTextObjectList_;
    %End
public:
    SIP_SSIZE_T __len__();
    %MethodCode
        sipRes = sipCpp->size();
    %End

    wxRichTextObject* __getitem__(long index);
    %MethodCode
        if (0 > index)
            index += sipCpp->size();

        if (index < sipCpp->size() && (0 <= index)) {
            wxRichTextObjectList_::compatibility_iterator node = sipCpp->Item(index);
            if (node)
                sipRes = (wxRichTextObject*)node->GetData();
        }
        else {
            wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
            sipError = sipErrorFail;
        }
    %End

    int __contains__(const wxRichTextObject* obj);
    %MethodCode
        wxRichTextObjectList_::compatibility_iterator node;
        node = sipCpp->Find((wxRichTextObject*)obj);
        sipRes = node != NULL;
    %End

    wxRichTextObjectList__iterator* __iter__() /Factory/;
    %MethodCode
        sipRes =  new wxRichTextObjectList__iterator(sipCpp->GetFirst());
    %End

    // TODO:  add support for index(value, [start, [stop]])
    int index(wxRichTextObject* obj);
    %MethodCode
        int idx = sipCpp->IndexOf((wxRichTextObject*)obj);
        if (idx == wxNOT_FOUND) {
            sipError = sipErrorFail;
            wxPyErr_SetString(PyExc_ValueError,
                              "sequence.index(x): x not in sequence");
        }
        sipRes = idx;
    %End

    
};

%Extract(id=pycode_richtext)
def _RichTextObjectList____repr__(self):
    return "RichTextObjectList_: " + repr(list(self))
RichTextObjectList_.__repr__ = _RichTextObjectList____repr__
del _RichTextObjectList____repr__
%End


class wxRichTextFileHandlerList_iterator /Abstract/
{
    // the C++ implementation of this class
    %TypeHeaderCode
        
        typedef wxList wxRichTextFileHandlerList;
        class wxRichTextFileHandlerList_iterator {
        public:
            wxRichTextFileHandlerList_iterator(wxRichTextFileHandlerList::compatibility_iterator start)
                : m_node(start) {}

            wxRichTextFileHandler* __next__() {
                wxRichTextFileHandler* obj = NULL;
                if (m_node) {
                    obj = (wxRichTextFileHandler*) m_node->GetData();
                    m_node = m_node->GetNext();
                }
                else {
                    PyErr_SetString(PyExc_StopIteration, "");
                }
                return (wxRichTextFileHandler*)obj;
            }
        private:
            wxRichTextFileHandlerList::compatibility_iterator m_node;
        };
    %End
public:
    wxRichTextFileHandler* __next__();
    %MethodCode
        sipRes = sipCpp->__next__();
        if (PyErr_Occurred())
            return NULL;
    %End
};

class wxRichTextFileHandlerList
{
    %TypeHeaderCode
        
        typedef wxList wxRichTextFileHandlerList;
    %End
public:
    SIP_SSIZE_T __len__();
    %MethodCode
        sipRes = sipCpp->size();
    %End

    wxRichTextFileHandler* __getitem__(long index);
    %MethodCode
        if (0 > index)
            index += sipCpp->size();

        if (index < sipCpp->size() && (0 <= index)) {
            wxRichTextFileHandlerList::compatibility_iterator node = sipCpp->Item(index);
            if (node)
                sipRes = (wxRichTextFileHandler*)node->GetData();
        }
        else {
            wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
            sipError = sipErrorFail;
        }
    %End

    int __contains__(const wxRichTextFileHandler* obj);
    %MethodCode
        wxRichTextFileHandlerList::compatibility_iterator node;
        node = sipCpp->Find((wxRichTextFileHandler*)obj);
        sipRes = node != NULL;
    %End

    wxRichTextFileHandlerList_iterator* __iter__() /Factory/;
    %MethodCode
        sipRes =  new wxRichTextFileHandlerList_iterator(sipCpp->GetFirst());
    %End

    // TODO:  add support for index(value, [start, [stop]])
    int index(wxRichTextFileHandler* obj);
    %MethodCode
        int idx = sipCpp->IndexOf((wxRichTextFileHandler*)obj);
        if (idx == wxNOT_FOUND) {
            sipError = sipErrorFail;
            wxPyErr_SetString(PyExc_ValueError,
                              "sequence.index(x): x not in sequence");
        }
        sipRes = idx;
    %End

    
};

%Extract(id=pycode_richtext)
def _RichTextFileHandlerList___repr__(self):
    return "RichTextFileHandlerList: " + repr(list(self))
RichTextFileHandlerList.__repr__ = _RichTextFileHandlerList___repr__
del _RichTextFileHandlerList___repr__
%End


class wxRichTextDrawingHandlerList_iterator /Abstract/
{
    // the C++ implementation of this class
    %TypeHeaderCode
        
        typedef wxList wxRichTextDrawingHandlerList;
        class wxRichTextDrawingHandlerList_iterator {
        public:
            wxRichTextDrawingHandlerList_iterator(wxRichTextDrawingHandlerList::compatibility_iterator start)
                : m_node(start) {}

            wxRichTextDrawingHandler* __next__() {
                wxRichTextDrawingHandler* obj = NULL;
                if (m_node) {
                    obj = (wxRichTextDrawingHandler*) m_node->GetData();
                    m_node = m_node->GetNext();
                }
                else {
                    PyErr_SetString(PyExc_StopIteration, "");
                }
                return (wxRichTextDrawingHandler*)obj;
            }
        private:
            wxRichTextDrawingHandlerList::compatibility_iterator m_node;
        };
    %End
public:
    wxRichTextDrawingHandler* __next__();
    %MethodCode
        sipRes = sipCpp->__next__();
        if (PyErr_Occurred())
            return NULL;
    %End
};

class wxRichTextDrawingHandlerList
{
    %TypeHeaderCode
        
        typedef wxList wxRichTextDrawingHandlerList;
    %End
public:
    SIP_SSIZE_T __len__();
    %MethodCode
        sipRes = sipCpp->size();
    %End

    wxRichTextDrawingHandler* __getitem__(long index);
    %MethodCode
        if (0 > index)
            index += sipCpp->size();

        if (index < sipCpp->size() && (0 <= index)) {
            wxRichTextDrawingHandlerList::compatibility_iterator node = sipCpp->Item(index);
            if (node)
                sipRes = (wxRichTextDrawingHandler*)node->GetData();
        }
        else {
            wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
            sipError = sipErrorFail;
        }
    %End

    int __contains__(const wxRichTextDrawingHandler* obj);
    %MethodCode
        wxRichTextDrawingHandlerList::compatibility_iterator node;
        node = sipCpp->Find((wxRichTextDrawingHandler*)obj);
        sipRes = node != NULL;
    %End

    wxRichTextDrawingHandlerList_iterator* __iter__() /Factory/;
    %MethodCode
        sipRes =  new wxRichTextDrawingHandlerList_iterator(sipCpp->GetFirst());
    %End

    // TODO:  add support for index(value, [start, [stop]])
    int index(wxRichTextDrawingHandler* obj);
    %MethodCode
        int idx = sipCpp->IndexOf((wxRichTextDrawingHandler*)obj);
        if (idx == wxNOT_FOUND) {
            sipError = sipErrorFail;
            wxPyErr_SetString(PyExc_ValueError,
                              "sequence.index(x): x not in sequence");
        }
        sipRes = idx;
    %End

    
};

%Extract(id=pycode_richtext)
def _RichTextDrawingHandlerList___repr__(self):
    return "RichTextDrawingHandlerList: " + repr(list(self))
RichTextDrawingHandlerList.__repr__ = _RichTextDrawingHandlerList___repr__
del _RichTextDrawingHandlerList___repr__
%End


class wxRichTextActionList_iterator /Abstract/
{
    // the C++ implementation of this class
    %TypeHeaderCode
        
        typedef wxList wxRichTextActionList;
        class wxRichTextActionList_iterator {
        public:
            wxRichTextActionList_iterator(wxRichTextActionList::compatibility_iterator start)
                : m_node(start) {}

            wxRichTextAction* __next__() {
                wxRichTextAction* obj = NULL;
                if (m_node) {
                    obj = (wxRichTextAction*) m_node->GetData();
                    m_node = m_node->GetNext();
                }
                else {
                    PyErr_SetString(PyExc_StopIteration, "");
                }
                return (wxRichTextAction*)obj;
            }
        private:
            wxRichTextActionList::compatibility_iterator m_node;
        };
    %End
public:
    wxRichTextAction* __next__();
    %MethodCode
        sipRes = sipCpp->__next__();
        if (PyErr_Occurred())
            return NULL;
    %End
};

class wxRichTextActionList
{
    %TypeHeaderCode
        
        typedef wxList wxRichTextActionList;
    %End
public:
    SIP_SSIZE_T __len__();
    %MethodCode
        sipRes = sipCpp->size();
    %End

    wxRichTextAction* __getitem__(long index);
    %MethodCode
        if (0 > index)
            index += sipCpp->size();

        if (index < sipCpp->size() && (0 <= index)) {
            wxRichTextActionList::compatibility_iterator node = sipCpp->Item(index);
            if (node)
                sipRes = (wxRichTextAction*)node->GetData();
        }
        else {
            wxPyErr_SetString(PyExc_IndexError, "sequence index out of range");
            sipError = sipErrorFail;
        }
    %End

    int __contains__(const wxRichTextAction* obj);
    %MethodCode
        wxRichTextActionList::compatibility_iterator node;
        node = sipCpp->Find((wxRichTextAction*)obj);
        sipRes = node != NULL;
    %End

    wxRichTextActionList_iterator* __iter__() /Factory/;
    %MethodCode
        sipRes =  new wxRichTextActionList_iterator(sipCpp->GetFirst());
    %End

    // TODO:  add support for index(value, [start, [stop]])
    int index(wxRichTextAction* obj);
    %MethodCode
        int idx = sipCpp->IndexOf((wxRichTextAction*)obj);
        if (idx == wxNOT_FOUND) {
            sipError = sipErrorFail;
            wxPyErr_SetString(PyExc_ValueError,
                              "sequence.index(x): x not in sequence");
        }
        sipRes = idx;
    %End

    
};

%Extract(id=pycode_richtext)
def _RichTextActionList___repr__(self):
    return "RichTextActionList: " + repr(list(self))
RichTextActionList.__repr__ = _RichTextActionList___repr__
del _RichTextActionList___repr__
%End



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



More information about the PyQt mailing list