////////////////////////////////////////////////////////////////////////////
// Name:        wx/stc/stc.h
// Purpose:     A wxWidgets implementation of Scintilla.  This class is the
//              one meant to be used directly by wx applications.  It does not
//              derive directly from the Scintilla classes, and in fact there
//              is no mention of Scintilla classes at all in this header.
//              This class delegates all method calls and events to the
//              Scintilla objects and so forth.  This allows the use of
//              Scintilla without polluting the namespace with all the
//              classes and itentifiers from Scintilla.
//
// Author:      Robin Dunn
//
// Created:     13-Jan-2000
// Copyright:   (c) 2000 by Total Control Software
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

/*
    IMPORTANT: include/wx/stc/stc.h is generated by src/stc/gen_iface.py from
               src/stc/stc.h.in, don't edit stc.h file as your changes will be
               lost after the next regeneration, edit stc.h.in and rerun the
               gen_iface.py script instead!

               Parts of this file generated by the script are found in between
               the special "{{{" and "}}}" markers, the rest of it is copied
               verbatim from src.h.in.
 */

#ifndef _WX_STC_STC_H_
#define _WX_STC_STC_H_

#include "wx/defs.h"

#if wxUSE_STC

#include "wx/control.h"
#include "wx/dnd.h"
#include "wx/stopwatch.h"
#include "wx/versioninfo.h"

#include "wx/textentry.h"
#if wxUSE_TEXTCTRL
    #include "wx/textctrl.h"
#endif // wxUSE_TEXTCTRL

class WXDLLIMPEXP_FWD_CORE wxScrollBar;

// SWIG can't handle "#if" type of conditionals, only "#ifdef"
#ifdef SWIG
#define STC_USE_DND 1
#else
#if wxUSE_DRAG_AND_DROP
#define STC_USE_DND 1
#endif
#endif

//----------------------------------------------------------------------
// STC constants generated section {{{

%(VALUES)s

//}}}
//----------------------------------------------------------------------

//----------------------------------------------------------------------
// Commands that can be bound to keystrokes section {{{

%(CMDS)s

//}}}
//----------------------------------------------------------------------

class  ScintillaWX;                      // forward declare
class  WordList;
struct SCNotification;

#ifndef SWIG
extern WXDLLIMPEXP_DATA_STC(const char) wxSTCNameStr[];
class  WXDLLIMPEXP_FWD_STC wxStyledTextCtrl;
class  WXDLLIMPEXP_FWD_STC wxStyledTextEvent;
#endif

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

class WXDLLIMPEXP_STC wxStyledTextCtrl : public wxControl,
#if wxUSE_TEXTCTRL
                                         public wxTextCtrlIface
#else // !wxUSE_TEXTCTRL
                                         public wxTextEntryBase
#endif // wxUSE_TEXTCTRL/!wxUSE_TEXTCTRL
{
public:

#ifdef SWIG
    %%pythonAppend wxStyledTextCtrl   "self._setOORInfo(self)"
    %%pythonAppend wxStyledTextCtrl() ""

    wxStyledTextCtrl(wxWindow *parent, wxWindowID id=wxID_ANY,
                     const wxPoint& pos = wxDefaultPosition,
                     const wxSize& size = wxDefaultSize, long style = 0,
                     const wxString& name = wxPySTCNameStr);
    %%RenameCtor(PreStyledTextCtrl,  wxStyledTextCtrl());

#else
    wxStyledTextCtrl(wxWindow *parent, wxWindowID id=wxID_ANY,
                     const wxPoint& pos = wxDefaultPosition,
                     const wxSize& size = wxDefaultSize, long style = 0,
                     const wxString& name = wxSTCNameStr);
    wxStyledTextCtrl() { m_swx = NULL; }
    ~wxStyledTextCtrl();

#endif

    bool Create(wxWindow *parent, wxWindowID id=wxID_ANY,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize, long style = 0,
                const wxString& name = wxSTCNameStr);


    //----------------------------------------------------------------------
    // Generated method declaration section {{{

%(METHOD_DEFS)s

    //}}}
    //----------------------------------------------------------------------

    // Manually declared methods

    // Returns the line number of the line with the caret.
    int GetCurrentLine();

    // Extract style settings from a spec-string which is composed of one or
    // more of the following comma separated elements:
    //
    //      bold                    turns on bold
    //      italic                  turns on italics
    //      fore:[name or #RRGGBB]  sets the foreground colour
    //      back:[name or #RRGGBB]  sets the background colour
    //      face:[facename]         sets the font face name to use
    //      size:[num]              sets the font size in points
    //      eol                     turns on eol filling
    //      underline               turns on underlining
    //
    void StyleSetSpec(int styleNum, const wxString& spec);


    // Get the font of a style.
    wxFont StyleGetFont(int style);


    // Set style size, face, bold, italic, and underline attributes from
    // a wxFont's attributes.
    void StyleSetFont(int styleNum, wxFont& font);



    // Set all font style attributes at once.
    void StyleSetFontAttr(int styleNum, int size,
                          const wxString& faceName,
                          bool bold, bool italic,
                          bool underline,
                          wxFontEncoding encoding=wxFONTENCODING_DEFAULT);


    // Set the character set of the font in a style.  Converts the Scintilla
    // character set values to a wxFontEncoding.
    void StyleSetCharacterSet(int style, int characterSet);

    // Set the font encoding to be used by a style.
    void StyleSetFontEncoding(int style, wxFontEncoding encoding);


    // Perform one of the operations defined by the wxSTC_CMD_* constants.
    void CmdKeyExecute(int cmd);


    // Set the left and right margin in the edit area, measured in pixels.
    void SetMargins(int left, int right);


    // Retrieve the point in the window where a position is displayed.
    wxPoint PointFromPosition(int pos);


    // Scroll enough to make the given line visible
    void ScrollToLine(int line);


    // Scroll enough to make the given column visible
    void ScrollToColumn(int column);


    // Send a message to Scintilla
    //
    // NB: this method is not really const as it can modify the control but it
    //     has to be declared as such as it's called from both const and
    //     non-const methods and we can't distinguish between the two
    wxIntPtr SendMsg(int msg, wxUIntPtr wp=0, wxIntPtr lp=0) const;


    // Set the vertical scrollbar to use instead of the ont that's built-in.
    void SetVScrollBar(wxScrollBar* bar);


    // Set the horizontal scrollbar to use instead of the ont that's built-in.
    void SetHScrollBar(wxScrollBar* bar);

    // Can be used to prevent the EVT_CHAR handler from adding the char
    bool GetLastKeydownProcessed() { return m_lastKeyDownConsumed; }
    void SetLastKeydownProcessed(bool val) { m_lastKeyDownConsumed = val; }

    // if we derive from wxTextAreaBase it already provides these methods
#if !wxUSE_TEXTCTRL
    // Write the contents of the editor to filename
    bool SaveFile(const wxString& filename);

    // Load the contents of filename into the editor
    bool LoadFile(const wxString& filename);
#endif // !wxUSE_TEXTCTRL

#ifdef STC_USE_DND
    // Allow for simulating a DnD DragEnter
    wxDragResult DoDragEnter(wxCoord x, wxCoord y, wxDragResult def);

    // Allow for simulating a DnD DragOver
    wxDragResult DoDragOver(wxCoord x, wxCoord y, wxDragResult def);

    // Allow for simulating a DnD DragLeave
    void DoDragLeave();

    // Allow for simulating a DnD DropText
    bool DoDropText(long x, long y, const wxString& data);
#endif

    // Specify whether anti-aliased fonts should be used.  Will have no effect
    // on some platforms, but on some (wxMac for example) can greatly improve
    // performance.
    void SetUseAntiAliasing(bool useAA);

    // Returns the current UseAntiAliasing setting.
    bool GetUseAntiAliasing();

    // Clear annotations from the given line.
    void AnnotationClearLine(int line);



    // The following methods are nearly equivalent to their similarly named
    // cousins above.  The difference is that these methods bypass wxString
    // and always use a char* even if used in a unicode build of wxWidgets.
    // In that case the character data will be utf-8 encoded since that is
    // what is used internally by Scintilla in unicode builds.

    // Add text to the document at current position.
    void AddTextRaw(const char* text, int length=-1);

    // Insert string at a position.
    void InsertTextRaw(int pos, const char* text);

    // Retrieve the text of the line containing the caret.
    // Returns the index of the caret on the line.
#ifdef SWIG
    wxCharBuffer GetCurLineRaw(int* OUTPUT);
#else
    wxCharBuffer GetCurLineRaw(int* linePos=NULL);
#endif

    // Retrieve the contents of a line.
    wxCharBuffer GetLineRaw(int line);

    // Retrieve the selected text.
    wxCharBuffer GetSelectedTextRaw();

    // Retrieve a range of text.
    wxCharBuffer GetTextRangeRaw(int startPos, int endPos);

    // Replace the contents of the document with the argument text.
    void SetTextRaw(const char* text);

    // Retrieve all the text in the document.
    wxCharBuffer GetTextRaw();

    // Append a string to the end of the document without changing the selection.
    void AppendTextRaw(const char* text, int length=-1);

#ifdef SWIG
    %%pythoncode "_stc_utf8_methods.py"
#endif


    // implement wxTextEntryBase pure virtual methods
    // ----------------------------------------------

    virtual void WriteText(const wxString& text)
    {
        ReplaceSelection(text);
    }

    virtual void Remove(long from, long to)
    {
        Replace(from, to, "");
    }
    virtual void Replace(long from, long to, const wxString& text)
    {
        SetTargetStart((int)from);
        SetTargetEnd((int)to);
        ReplaceTarget(text);
    }

    /*
        These functions are already declared in the generated section.

    virtual void Copy();
    virtual void Cut();
    virtual void Paste();

    virtual void Undo();
    virtual void Redo();

    virtual bool CanUndo() const;
    virtual bool CanRedo() const;

    */

    virtual void SetInsertionPoint(long pos)
    {
        SetCurrentPos(int(pos == -1 ? GetLastPosition() : pos));
    }
    virtual long GetInsertionPoint() const { return GetCurrentPos(); }
    virtual long GetLastPosition() const { return GetTextLength(); }

    virtual void SetSelection(long from, long to)
    {
        if ( from == -1 && to == -1 )
        {
            SelectAll();
        }
        else
        {
            SetSelectionStart((int)from);
            SetSelectionEnd((int)to);
        }
    }

    virtual void SelectNone()
    {
        ClearSelections();
    }

#ifdef SWIG
    void GetSelection(long* OUTPUT, long* OUTPUT) const;
#else
    virtual void GetSelection(long *from, long *to) const
    {
        if ( from )
            *from = GetSelectionStart();
        if ( to )
            *to = GetSelectionEnd();
    }

    // kept for compatibility only
    void GetSelection(int *from, int *to)
    {
        long f, t;
        GetSelection(&f, &t);
        if ( from )
            *from = (int)f;
        if ( to )
            *to = (int)t;
    }
#endif

    virtual bool IsEditable() const { return !GetReadOnly(); }
    virtual void SetEditable(bool editable) { SetReadOnly(!editable); }

    // implement wxTextAreaBase pure virtual methods
    // ---------------------------------------------

    virtual int GetLineLength(long lineNo) const { return static_cast<int>(GetLineText(lineNo).length()); }
    virtual wxString GetLineText(long lineNo) const
    {
        wxString text = GetLine(static_cast<int>(lineNo));
        size_t lastNewLine = text.find_last_not_of(wxS("\r\n"));

        if ( lastNewLine != wxString::npos )
            text.erase(lastNewLine + 1); // remove trailing cr+lf
        else
            text.clear();
        return text;
    }
    virtual int GetNumberOfLines() const { return GetLineCount(); }

    virtual bool IsModified() const { return GetModify(); }
    virtual void MarkDirty() { wxFAIL_MSG("not implemented"); }
    virtual void DiscardEdits() { SetSavePoint(); }

    virtual bool SetStyle(long WXUNUSED(start), long WXUNUSED(end),
                          const wxTextAttr& WXUNUSED(style))
    {
        wxFAIL_MSG("not implemented");

        return false;
    }

    virtual bool GetStyle(long WXUNUSED(position), wxTextAttr& WXUNUSED(style))
    {
        wxFAIL_MSG("not implemented");

        return false;
    }

    virtual bool SetDefaultStyle(const wxTextAttr& WXUNUSED(style))
    {
        wxFAIL_MSG("not implemented");

        return false;
    }

    virtual long XYToPosition(long x, long y) const
    {
        long pos = PositionFromLine((int)y);
        pos += x;
        return pos;
    }

    virtual bool PositionToXY(long pos, long *x, long *y) const
    {
        int l = LineFromPosition((int)pos);
        if ( l == -1 )
            return false;

        if ( x )
            *x = pos - PositionFromLine(l);

        if ( y )
            *y = l;

        return true;
    }

    virtual void ShowPosition(long pos) { GotoPos((int)pos); }

    using wxWindow::HitTest;

    virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt, long *pos) const
    {
        const long l = PositionFromPoint(pt);
        if ( l == -1 )
            return wxTE_HT_BELOW; // we don't really know where it was

        if ( pos )
            *pos = l;

        return wxTE_HT_ON_TEXT;
    }

    // just unhide it
    virtual wxTextCtrlHitTestResult HitTest(const wxPoint& pt,
                                            wxTextCoord *col,
                                            wxTextCoord *row) const
    {
        return wxTextAreaBase::HitTest(pt, col, row);
    }

    static wxVersionInfo GetLibraryVersionInfo();

protected:
    virtual void DoSetValue(const wxString& value, int flags);
    virtual wxString DoGetValue() const { return GetText(); }
    virtual wxWindow *GetEditableWindow() { return this; }

#ifndef SWIG
    virtual bool DoLoadFile(const wxString& file, int fileType);
    virtual bool DoSaveFile(const wxString& file, int fileType);

    // Event handlers
    void OnPaint(wxPaintEvent& evt);
    void OnScrollWin(wxScrollWinEvent& evt);
    void OnScroll(wxScrollEvent& evt);
    void OnSize(wxSizeEvent& evt);
    void OnMouseLeftDown(wxMouseEvent& evt);
    void OnMouseMove(wxMouseEvent& evt);
    void OnMouseLeftUp(wxMouseEvent& evt);
    void OnMouseRightUp(wxMouseEvent& evt);
    void OnMouseMiddleUp(wxMouseEvent& evt);
    void OnContextMenu(wxContextMenuEvent& evt);
    void OnMouseWheel(wxMouseEvent& evt);
    void OnChar(wxKeyEvent& evt);
    void OnKeyDown(wxKeyEvent& evt);
    void OnLoseFocus(wxFocusEvent& evt);
    void OnGainFocus(wxFocusEvent& evt);
    void OnSysColourChanged(wxSysColourChangedEvent& evt);
    void OnEraseBackground(wxEraseEvent& evt);
    void OnMenu(wxCommandEvent& evt);
    void OnListBox(wxCommandEvent& evt);
    void OnIdle(wxIdleEvent& evt);

    virtual wxSize DoGetBestSize() const;

    // Turn notifications from Scintilla into events
    void NotifyChange();
    void NotifyParent(SCNotification* scn);

private:
    DECLARE_EVENT_TABLE()
    DECLARE_DYNAMIC_CLASS(wxStyledTextCtrl)

protected:

    ScintillaWX*        m_swx;
    wxStopWatch         m_stopWatch;
    wxScrollBar*        m_vScrollBar;
    wxScrollBar*        m_hScrollBar;

    bool                m_lastKeyDownConsumed;

    friend class ScintillaWX;
    friend class Platform;
#endif // !SWIG
};

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

class WXDLLIMPEXP_STC wxStyledTextEvent : public wxCommandEvent {
public:
    wxStyledTextEvent(wxEventType commandType=0, int id=0);
#ifndef SWIG
    wxStyledTextEvent(const wxStyledTextEvent& event);
#endif
    ~wxStyledTextEvent() {}

    void SetPosition(int pos)             { m_position = pos; }
    void SetKey(int k)                    { m_key = k; }
    void SetModifiers(int m)              { m_modifiers = m; }
    void SetModificationType(int t)       { m_modificationType = t; }
    // Kept for backwards compatibility, use SetString().
    void SetText(const wxString& t)       { SetString(t); }
    void SetLength(int len)               { m_length = len; }
    void SetLinesAdded(int num)           { m_linesAdded = num; }
    void SetLine(int val)                 { m_line = val; }
    void SetFoldLevelNow(int val)         { m_foldLevelNow = val; }
    void SetFoldLevelPrev(int val)        { m_foldLevelPrev = val; }
    void SetMargin(int val)               { m_margin = val; }
    void SetMessage(int val)              { m_message = val; }
    void SetWParam(int val)               { m_wParam = val; }
    void SetLParam(int val)               { m_lParam = val; }
    void SetListType(int val)             { m_listType = val; }
    void SetX(int val)                    { m_x = val; }
    void SetY(int val)                    { m_y = val; }
    void SetToken(int val)                { m_token = val; }
    void SetAnnotationLinesAdded(int val) { m_annotationLinesAdded = val; }
    void SetUpdated(int val)              { m_updated = val; }
#ifdef  STC_USE_DND
    // Kept for backwards compatibility, use SetString().
    void SetDragText(const wxString& val) { SetString(val); }
    void SetDragFlags(int flags)          { m_dragFlags = flags; }
    void SetDragResult(wxDragResult val)  { m_dragResult = val; }

    // This method is kept mainly for backwards compatibility, use
    // SetDragFlags() in the new code.
    void SetDragAllowMove(bool allow)
    {
        if ( allow )
            m_dragFlags |= wxDrag_AllowMove;
        else
            m_dragFlags &= ~(wxDrag_AllowMove | wxDrag_DefaultMove);
    }
#endif

    int  GetPosition() const         { return m_position; }
    int  GetKey()  const             { return m_key; }
    int  GetModifiers() const        { return m_modifiers; }
    int  GetModificationType() const { return m_modificationType; }
    // Kept for backwards compatibility, use GetString().
    wxString GetText() const         { return GetString(); }
    int  GetLength() const           { return m_length; }
    int  GetLinesAdded() const       { return m_linesAdded; }
    int  GetLine() const             { return m_line; }
    int  GetFoldLevelNow() const     { return m_foldLevelNow; }
    int  GetFoldLevelPrev() const    { return m_foldLevelPrev; }
    int  GetMargin() const           { return m_margin; }
    int  GetMessage() const          { return m_message; }
    int  GetWParam() const           { return m_wParam; }
    int  GetLParam() const           { return m_lParam; }
    int  GetListType() const         { return m_listType; }
    int  GetX() const                { return m_x; }
    int  GetY() const                { return m_y; }
    int  GetToken() const                 { return m_token; }
    int  GetAnnotationsLinesAdded() const { return m_annotationLinesAdded; }
    int  GetUpdated() const               { return m_updated; }
    
#ifdef STC_USE_DND
    // Kept for backwards compatibility, use GetString().
    wxString GetDragText()           { return GetString(); }
    int GetDragFlags()               { return m_dragFlags; }
    wxDragResult GetDragResult()     { return m_dragResult; }

    bool GetDragAllowMove() { return (GetDragFlags() & wxDrag_AllowMove) != 0; }
#endif

    bool GetShift() const;
    bool GetControl() const;
    bool GetAlt() const;

    virtual wxEvent* Clone() const { return new wxStyledTextEvent(*this); }

#ifndef SWIG
private:
    DECLARE_DYNAMIC_CLASS(wxStyledTextEvent)

    int  m_position;
    int  m_key;
    int  m_modifiers;

    int  m_modificationType;    // wxEVT_STC_MODIFIED
    int  m_length;
    int  m_linesAdded;
    int  m_line;
    int  m_foldLevelNow;
    int  m_foldLevelPrev;

    int  m_margin;              // wxEVT_STC_MARGINCLICK

    int  m_message;             // wxEVT_STC_MACRORECORD
    int  m_wParam;
    int  m_lParam;

    int m_listType;
    int m_x;
    int m_y;

    int m_token;                // wxEVT_STC__MODIFIED with SC_MOD_CONTAINER 
    int m_annotationLinesAdded; // wxEVT_STC_MODIFIED with SC_MOD_CHANGEANNOTATION 
    int m_updated;              // wxEVT_STC_UPDATEUI

#if wxUSE_DRAG_AND_DROP
    int      m_dragFlags;       // wxEVT_STC_START_DRAG
    wxDragResult m_dragResult;  // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP
#endif
#endif
};



#ifndef SWIG
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CHANGE, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_STYLENEEDED, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CHARADDED, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_SAVEPOINTREACHED, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_SAVEPOINTLEFT, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_ROMODIFYATTEMPT, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_KEY, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DOUBLECLICK, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_UPDATEUI, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MODIFIED, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MACRORECORD, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MARGINCLICK, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_NEEDSHOWN, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_PAINTED, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_USERLISTSELECTION, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_URIDROPPED, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DWELLSTART, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DWELLEND, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_START_DRAG, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DRAG_OVER, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_DO_DROP, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_ZOOM, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_CLICK, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_DCLICK, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CALLTIP_CLICK, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_SELECTION, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_CLICK, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_RELEASE, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_CANCELLED, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_RELEASE_CLICK, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_COPY, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent );
#else
    enum {
        wxEVT_STC_CHANGE,
        wxEVT_STC_STYLENEEDED,
        wxEVT_STC_CHARADDED,
        wxEVT_STC_SAVEPOINTREACHED,
        wxEVT_STC_SAVEPOINTLEFT,
        wxEVT_STC_ROMODIFYATTEMPT,
        wxEVT_STC_KEY,
        wxEVT_STC_DOUBLECLICK,
        wxEVT_STC_UPDATEUI,
        wxEVT_STC_MODIFIED,
        wxEVT_STC_MACRORECORD,
        wxEVT_STC_MARGINCLICK,
        wxEVT_STC_NEEDSHOWN,
        wxEVT_STC_PAINTED,
        wxEVT_STC_USERLISTSELECTION,
        wxEVT_STC_URIDROPPED,
        wxEVT_STC_DWELLSTART,
        wxEVT_STC_DWELLEND,
        wxEVT_STC_START_DRAG,
        wxEVT_STC_DRAG_OVER,
        wxEVT_STC_DO_DROP,
        wxEVT_STC_ZOOM,
        wxEVT_STC_HOTSPOT_CLICK,
        wxEVT_STC_HOTSPOT_DCLICK,
        wxEVT_STC_CALLTIP_CLICK,
        wxEVT_STC_AUTOCOMP_SELECTION,
        wxEVT_STC_INDICATOR_CLICK,
        wxEVT_STC_INDICATOR_RELEASE,
        wxEVT_STC_AUTOCOMP_CANCELLED,
        wxEVT_STC_AUTOCOMP_CHAR_DELETED,
        wxEVT_STC_HOTSPOT_RELEASE_CLICK,
        wxEVT_STC_CLIPBOARD_COPY,
        wxEVT_STC_CLIPBOARD_PASTE
    };
#endif



#ifndef SWIG
typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);

#define wxStyledTextEventHandler( func ) \
    wxEVENT_HANDLER_CAST( wxStyledTextEventFunction, func )

#define EVT_STC_CHANGE(id, fn)             wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHANGE,                id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_STYLENEEDED(id, fn)        wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_STYLENEEDED,           id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_CHARADDED(id, fn)          wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CHARADDED,             id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_SAVEPOINTREACHED(id, fn)   wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTREACHED,      id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_SAVEPOINTLEFT(id, fn)      wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_SAVEPOINTLEFT,         id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_ROMODIFYATTEMPT(id, fn)    wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ROMODIFYATTEMPT,       id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_KEY(id, fn)                wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_KEY,                   id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_DOUBLECLICK(id, fn)        wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DOUBLECLICK,           id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_UPDATEUI(id, fn)           wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_UPDATEUI,              id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_MODIFIED(id, fn)           wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MODIFIED,              id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_MACRORECORD(id, fn)        wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MACRORECORD,           id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_MARGINCLICK(id, fn)        wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGINCLICK,           id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_NEEDSHOWN(id, fn)          wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_NEEDSHOWN,             id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_PAINTED(id, fn)            wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_PAINTED,               id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_USERLISTSELECTION(id, fn)  wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_USERLISTSELECTION,     id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_URIDROPPED(id, fn)         wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_URIDROPPED,            id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_DWELLSTART(id, fn)         wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLSTART,            id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_DWELLEND(id, fn)           wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DWELLEND,              id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_START_DRAG(id, fn)         wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG,            id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_DRAG_OVER(id, fn)          wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER,             id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_DO_DROP(id, fn)            wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP,               id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_ZOOM(id, fn)               wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM,                  id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_HOTSPOT_CLICK(id, fn)      wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK,         id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_HOTSPOT_DCLICK(id, fn)     wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK,        id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_CALLTIP_CLICK(id, fn)      wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK,         id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_AUTOCOMP_SELECTION(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION,    id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_INDICATOR_CLICK(id, fn)    wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_CLICK,       id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_INDICATOR_RELEASE(id, fn)  wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_RELEASE,     id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_AUTOCOMP_CANCELLED(id, fn)    wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CANCELLED,    id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CHAR_DELETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_RELEASE_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_CLIPBOARD_COPY(id, fn)        wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_COPY,        id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_CLIPBOARD_PASTE(id, fn)       wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_PASTE,       id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),

#endif

#endif // wxUSE_STC

#endif // _WX_STC_STC_H_
