X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7cdecac3b7597a3cbb9155d5ee46b852293d8c26..b478e7a71c67064e6a87abf476574c1331c4c906:/contrib/src/stc/stc.h.in diff --git a/contrib/src/stc/stc.h.in b/contrib/src/stc/stc.h.in index 7865f84106..70addc7abb 100644 --- a/contrib/src/stc/stc.h.in +++ b/contrib/src/stc/stc.h.in @@ -24,6 +24,37 @@ #include #include +#ifndef SWIG +/* + * If we're using wx in Dynamic Library format do we + * want wxStyledTextCtrl to be in DLL form as well? + */ +#if defined(WXUSINGDLL) && \ + (defined(WXMAKING_STC_DLL) || defined(WXUSING_STC_DLL)) + +#if defined(WXMAKING_STC_DLL) + // When building the DLL WXSTC_DECLSPEC exports classes +# define WXSTC_DECLSPEC WXEXPORT +#elif defined(WXUSING_STC_DLL) + // When using the DLL WXSTC_DECLSPEC imports classes +# define WXSTC_DECLSPEC WXIMPORT +#endif // defined(WXBUILD_STC_DLL) + +#else +// When building the static library nullify the effect of WXSTC_DECLSPEC +#define WXSTC_DECLSPEC +#endif // WXUSINGDLL && (WXMAKING_STC_DLL || WXUSING_STC_DLL) + +#endif // SWIG + + +//---------------------------------------------------------------------- + +// Should a wxPopupWindow be used for the call tips and autocomplete windows? +#ifndef wxSTC_USE_POPUP +#define wxSTC_USE_POPUP 1 +#endif + //---------------------------------------------------------------------- // BEGIN generated section. The following code is automatically generated // by gen_iface.py. Do not edit this file. Edit stc.h.in instead @@ -31,22 +62,24 @@ %(VALUES)s -// END of generated section -//---------------------------------------------------------------------- -// Others - -#define wxSTC_MASK_FOLDERS ((1 << wxSTC_MARKNUM_FOLDER) | (1 << wxSTC_MARKNUM_FOLDEROPEN)) +//----------------------------------------- +// Commands that can be bound to keystrokes +%(CMDS)s +// END of generated section //---------------------------------------------------------------------- class ScintillaWX; // forward declare class WordList; struct SCNotification; - -extern const wxChar* wxSTCNameStr; +#ifndef SWIG +extern WXSTC_DECLSPEC const wxChar* wxSTCNameStr; +class WXSTC_DECLSPEC wxStyledTextCtrl; +class WXSTC_DECLSPEC wxStyledTextEvent; +#endif //---------------------------------------------------------------------- @@ -57,7 +90,7 @@ public: wxStyledTextCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, - const char* name = "styledtext"); + const wxString& name = wxPySTCNameStr); %%pragma(python) addtomethod = "__init__:self._setOORInfo(self)" #else @@ -156,6 +189,17 @@ public: // Set the horizontal scrollbar to use instead of the ont that's built-in. void SetHScrollBar(wxScrollBar* bar) { m_hScrollBar = 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; } + + // 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); + + //---------------------------------------------------------------------- @@ -170,6 +214,7 @@ private: 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); @@ -186,11 +231,11 @@ private: void NotifyChange(); void NotifyParent(SCNotification* scn); - -private: DECLARE_EVENT_TABLE() DECLARE_CLASS(wxStyledTextCtrl) +protected: + ScintillaWX* m_swx; wxStopWatch m_stopWatch; wxScrollBar* m_vScrollBar; @@ -205,6 +250,15 @@ private: //---------------------------------------------------------------------- +// 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 + class wxStyledTextEvent : public wxCommandEvent { public: wxStyledTextEvent(wxEventType commandType=0, int id=0); @@ -217,7 +271,7 @@ public: void SetKey(int k) { m_key = k; } void SetModifiers(int m) { m_modifiers = m; } void SetModificationType(int t) { m_modificationType = t; } - void SetText(const char* t) { m_text = t; } + void SetText(const wxString& t) { m_text = t; } void SetLength(int len) { m_length = len; } void SetLinesAdded(int num) { m_linesAdded = num; } void SetLine(int val) { m_line = val; } @@ -232,7 +286,9 @@ public: void SetY(int val) { m_y = val; } void SetDragText(const wxString& val) { m_dragText = val; } void SetDragAllowMove(bool val) { m_dragAllowMove = val; } +#ifdef STC_USE_DND void SetDragResult(wxDragResult val) { m_dragResult = val; } +#endif int GetPosition() const { return m_position; } int GetKey() const { return m_key; } @@ -253,7 +309,9 @@ public: int GetY() const { return m_y; } wxString GetDragText() { return m_dragText; } bool GetDragAllowMove() { return m_dragAllowMove; } +#ifdef STC_USE_DND wxDragResult GetDragResult() { return m_dragResult; } +#endif bool GetShift() const; bool GetControl() const; @@ -290,10 +348,14 @@ private: wxString m_dragText; // wxEVT_STC_START_DRAG, wxEVT_STC_DO_DROP bool m_dragAllowMove; // wxEVT_STC_START_DRAG +#if wxUSE_DRAG_AND_DROP wxDragResult m_dragResult; // wxEVT_STC_DRAG_OVER,wxEVT_STC_DO_DROP #endif +#endif }; + + #ifndef SWIG BEGIN_DECLARE_EVENT_TYPES() DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CHANGE, 1650) @@ -318,6 +380,10 @@ BEGIN_DECLARE_EVENT_TYPES() DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_START_DRAG, 1669) DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DRAG_OVER, 1670) DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_DO_DROP, 1671) + DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_ZOOM, 1672) + DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_HOTSPOT_CLICK, 1673) + DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_HOTSPOT_DCLICK, 1674) + DECLARE_LOCAL_EVENT_TYPE(wxEVT_STC_CALLTIP_CLICK, 1675) END_DECLARE_EVENT_TYPES() #else enum { @@ -343,6 +409,10 @@ END_DECLARE_EVENT_TYPES() 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 }; #endif @@ -373,9 +443,47 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&); #define EVT_STC_START_DRAG(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_START_DRAG, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ), #define EVT_STC_DRAG_OVER(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DRAG_OVER, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ), #define EVT_STC_DO_DROP(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_DO_DROP, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ), +#define EVT_STC_ZOOM(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_ZOOM, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ), +#define EVT_STC_HOTSPOT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ), +#define EVT_STC_HOTSPOT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ), +#define EVT_STC_CALLTIP_CLICK(id, fn)) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK id, -1, (wxObjectEventFunction) (wxEventFunction) (wxStyledTextEventFunction) & fn, (wxObject *) NULL ), + #endif //---------------------------------------------------------------------- +// Utility functions used within wxSTC + +#ifndef SWIG + +inline wxString stc2wx(const char* str) { +#if wxUSE_UNICODE + return wxString(str, wxConvUTF8); +#else + return wxString(str); +#endif +} + +inline wxString stc2wx(const char* str, size_t len) { +#if wxUSE_UNICODE + return wxString(str, wxConvUTF8, len); +#else + return wxString(str, len); +#endif +} + +#if wxUSE_UNICODE +inline const wxWX2MBbuf wx2stc(const wxString& str) { + return str.mb_str(wxConvUTF8); +} +#else +inline const wxWX2MBbuf wx2stc(const wxString& str) { + return str.mbc_str(); +} +#endif + +#endif + + //---------------------------------------------------------------------- #endif