Several minor improvements to wxSTC and documentation and one crash fix
under macOS.

See https://github.com/wxWidgets/wxWidgets/pull/1412

Closes #18434.
This commit is contained in:
Vadim Zeitlin
2019-07-15 13:16:15 +02:00
10 changed files with 199 additions and 360 deletions

View File

@@ -5187,16 +5187,6 @@ public:
// Register an image for use in autocompletion lists. // Register an image for use in autocompletion lists.
void RegisterImage(int type, const wxBitmap& bmp); void RegisterImage(int type, const wxBitmap& bmp);
// Set the colours used to display the items in an autocompletion list.
void AutoCompSetColours(const wxColour& background, const wxColour& text,
const wxColour& highlight,
const wxColour& highlightText);
// Use a wxListCtrl to display autocompletion lists.
void AutoCompUseListCtrl(bool useListCtrl = true,
const wxColour& currentBgColour = wxNullColour,
const wxColour& currentTextColour = wxNullColour);
// The following methods are nearly equivalent to their similarly named // The following methods are nearly equivalent to their similarly named
@@ -5672,6 +5662,7 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_COPY, wxStyledTex
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_COMPLETED, wxStyledTextEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_COMPLETED, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MARGIN_RIGHT_CLICK, wxStyledTextEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MARGIN_RIGHT_CLICK, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_SELECTION_CHANGE, wxStyledTextEvent );
#else #else
enum { enum {
@@ -5713,7 +5704,8 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MARGIN_RIGHT_CLICK, wxStyle
wxEVT_STC_CLIPBOARD_COPY, wxEVT_STC_CLIPBOARD_COPY,
wxEVT_STC_CLIPBOARD_PASTE, wxEVT_STC_CLIPBOARD_PASTE,
wxEVT_STC_AUTOCOMP_COMPLETED, wxEVT_STC_AUTOCOMP_COMPLETED,
wxEVT_STC_MARGIN_RIGHT_CLICK wxEVT_STC_MARGIN_RIGHT_CLICK,
wxEVT_STC_AUTOCOMP_SELECTION_CHANGE
}; };
#endif #endif
@@ -5760,7 +5752,7 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
#define EVT_STC_CLIPBOARD_PASTE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_PASTE, 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 ),
#define EVT_STC_AUTOCOMP_COMPLETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_COMPLETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), #define EVT_STC_AUTOCOMP_COMPLETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_COMPLETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_MARGIN_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGIN_RIGHT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), #define EVT_STC_MARGIN_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGIN_RIGHT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_AUTOCOMP_SELECTION_CHANGE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#endif #endif
#endif // wxUSE_STC #endif // wxUSE_STC

View File

@@ -2777,6 +2777,9 @@
wxStyledTextCtrl is a 1 to 1 mapping of "raw" scintilla interface, whose wxStyledTextCtrl is a 1 to 1 mapping of "raw" scintilla interface, whose
documentation can be found in the Scintilla website (http://www.scintilla.org/). documentation can be found in the Scintilla website (http://www.scintilla.org/).
Please see wxStyledTextEvent for the documentation of all event types you
can use with wxStyledTextCtrl.
@section stc_index Index of the member groups @section stc_index Index of the member groups
@@ -2830,86 +2833,6 @@
- @ref_member_group{text_entry, Text entry methods} - @ref_member_group{text_entry, Text entry methods}
- @ref_member_group{text_area, Text area methods} - @ref_member_group{text_area, Text area methods}
@section event_list Events
@beginEventEmissionTable{wxStyledTextEvent}
@event{EVT_STC_AUTOCOMP_CANCELLED(id, fn)}
Process a @c wxEVT_STC_AUTOCOMP_CANCELLED event.
@event{EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn)}
Process a @c wxEVT_STC_AUTOCOMP_CHAR_DELETED event.
@event{EVT_STC_AUTOCOMP_COMPLETED(id, fn)}
Process a @c wxEVT_STC_AUTOCOMP_COMPLETED event.
@since 3.1.1
@event{EVT_STC_AUTOCOMP_SELECTION(id, fn)}
Process a @c wxEVT_STC_AUTOCOMP_SELECTION event.
@event{EVT_STC_CALLTIP_CLICK(id, fn)}
Process a @c wxEVT_STC_CALLTIP_CLICK event.
@event{EVT_STC_CHANGE(id, fn)}
Process a @c wxEVT_STC_CHANGE event.
@event{EVT_STC_CHARADDED(id, fn)}
Process a @c wxEVT_STC_CHARADDED event.
@event{EVT_STC_CLIPBOARD_COPY(id, fn)}
Process a @c wxEVT_STC_CLIPBOARD_COPY event.
@since 3.1.0
@event{EVT_STC_CLIPBOARD_PASTE(id, fn)}
Process a @c wxEVT_STC_CLIPBOARD_PASTE event.
@since 3.1.0
@event{EVT_STC_DO_DROP(id, fn)}
Process a @c wxEVT_STC_DO_DROP event.
@event{EVT_STC_DOUBLECLICK(id, fn)}
Process a @c wxEVT_STC_DOUBLECLICK event.
@event{EVT_STC_DRAG_OVER(id, fn)}
Process a @c wxEVT_STC_DRAG_OVER event.
@event{EVT_STC_DWELLEND(id, fn)}
Process a @c wxEVT_STC_DWELLEND event.
@event{EVT_STC_DWELLSTART(id, fn)}
Process a @c wxEVT_STC_DWELLSTART event.
@event{EVT_STC_HOTSPOT_CLICK(id, fn)}
Process a @c wxEVT_STC_HOTSPOT_CLICK event.
@event{EVT_STC_HOTSPOT_DCLICK(id, fn)}
Process a @c wxEVT_STC_HOTSPOT_DCLICK event.
@event{EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn)}
Process a @c wxEVT_STC_HOTSPOT_RELEASE_CLICK event.
@event{EVT_STC_INDICATOR_CLICK(id, fn)}
Process a @c wxEVT_STC_INDICATOR_CLICK event.
@event{EVT_STC_INDICATOR_RELEASE(id, fn)}
Process a @c wxEVT_STC_INDICATOR_RELEASE event.
@event{EVT_STC_MACRORECORD(id, fn)}
Process a @c wxEVT_STC_MACRORECORD event.
@event{EVT_STC_MARGIN_RIGHT_CLICK(id, fn)}
Process a @c wxEVT_STC_MARGIN_RIGHT_CLICK event.
@since 3.1.1
@event{EVT_STC_MARGINCLICK(id, fn)}
Process a @c wxEVT_STC_MARGINCLICK event.
@event{EVT_STC_MODIFIED(id, fn)}
Process a @c wxEVT_STC_MODIFIED event.
@event{EVT_STC_NEEDSHOWN(id, fn)}
Process a @c wxEVT_STC_NEEDSHOWN event.
@event{EVT_STC_PAINTED(id, fn)}
Process a @c wxEVT_STC_PAINTED event.
@event{EVT_STC_ROMODIFYATTEMPT(id, fn)}
Process a @c wxEVT_STC_ROMODIFYATTEMPT event.
@event{EVT_STC_SAVEPOINTLEFT(id, fn)}
Process a @c wxEVT_STC_SAVEPOINTLEFT event.
@event{EVT_STC_SAVEPOINTREACHED(id, fn)}
Process a @c wxEVT_STC_SAVEPOINTREACHED event.
@event{EVT_STC_START_DRAG(id, fn)}
Process a @c wxEVT_STC_START_DRAG event.
@event{EVT_STC_STYLENEEDED(id, fn)}
Process a @c wxEVT_STC_STYLENEEDED event.
@event{EVT_STC_UPDATEUI(id, fn)}
Process a @c wxEVT_STC_UPDATEUI event.
@event{EVT_STC_USERLISTSELECTION(id, fn)}
Process a @c wxEVT_STC_USERLISTSELECTION event.
@event{EVT_STC_ZOOM(id, fn)}
Process a @c wxEVT_STC_ZOOM event.
@endEventTable
@library{wxstc} @library{wxstc}
@category{stc} @category{stc}
@@ -7423,54 +7346,6 @@ public:
*/ */
void RegisterImage(int type, const wxBitmap& bmp); void RegisterImage(int type, const wxBitmap& bmp);
/**
Set the colours used to display the items in an autocompletion list.
This method can be used if the default colours make the list hard to
read or if specific colours are desired for whatever reason.
@param background
The colour used for the background of the list.
@param text
The colour used for all text except for the selected item.
@param highlight
The colour used to highlight the selected item in the list.
@param highlightText
The colour used for the text of the selected item.
@remarks
To reset one or more of the colours to its default,
call this method with wxNullColour for the colour or colours
to be reset.
@since 3.1.3
*/
void AutoCompSetColours(const wxColour& background, const wxColour& text,
const wxColour& highlight,
const wxColour& highlightText);
/**
Use a wxListCtrl to display autocompletion and user lists.
By default lists will be displayed in a wxListBox. Use this method to
display them in a wxListCtrl instead. The primary difference is that
wxListCtrl has hot tracking to highlight the item under the mouse cursor.
@param useListCtrl
Set this to true to use a wxListCtrl and to false to use a
wxListBox.
@param currentBgColour
The colour used to highlight the item under the mouse cursor.
@param currentTextColour
The colour used for the text of the item under the mouse cursor.
@remarks
To reset one or more of the colours to its default,
call this method with wxNullColour for the colour or colours
to be reset.
@since 3.1.3
*/
void AutoCompUseListCtrl(bool useListCtrl = true,
const wxColour& currentBgColour = wxNullColour,
const wxColour& currentTextColour = wxNullColour);
//@} //@}
@@ -7591,7 +7466,7 @@ public:
@param value @param value
The value to replace the existing text with. The value to replace the existing text with.
*/ */
virtual void Replace(long from, long to, const wxString& text); virtual void Replace(long from, long to, const wxString& value);
/** /**
Sets the insertion point at the given position. Sets the insertion point at the given position.
@@ -7724,7 +7599,7 @@ public:
@return @return
The length of the line, or -1 if @a lineNo was invalid. The length of the line, or -1 if @a lineNo was invalid.
*/ */
virtual int GetLineLength(long n) const; virtual int GetLineLength(long lineNo) const;
/** /**
Returns the contents of a given line in the text control, not including Returns the contents of a given line in the text control, not including
@@ -7736,7 +7611,7 @@ public:
@return @return
The contents of the line. The contents of the line.
*/ */
virtual wxString GetLineText(long n) const; virtual wxString GetLineText(long lineNo) const;
/** /**
Returns the number of lines in the text control buffer. Returns the number of lines in the text control buffer.
@@ -7924,6 +7799,10 @@ public:
@event{EVT_STC_AUTOCOMP_SELECTION(id, fn)} @event{EVT_STC_AUTOCOMP_SELECTION(id, fn)}
Process a @c wxEVT_STC_AUTOCOMP_SELECTION event. Process a @c wxEVT_STC_AUTOCOMP_SELECTION event.
@event{EVT_STC_AUTOCOMP_SELECTION_CHANGE(id, fn)}
Process a @c wxEVT_STC_AUTOCOMP_SELECTION_CHANGE event.
@since 3.1.3
@event{EVT_STC_CALLTIP_CLICK(id, fn)} @event{EVT_STC_CALLTIP_CLICK(id, fn)}
Process a @c wxEVT_STC_CALLTIP_CLICK event. Process a @c wxEVT_STC_CALLTIP_CLICK event.
@event{EVT_STC_CHANGE(id, fn)} @event{EVT_STC_CHANGE(id, fn)}
@@ -8044,6 +7923,27 @@ public:
@link wxStyledTextEvent::GetString GetString@endlink, @link wxStyledTextEvent::GetString GetString@endlink,
@link wxStyledTextEvent::GetListCompletionMethod GetListCompletionMethod@endlink. @link wxStyledTextEvent::GetListCompletionMethod GetListCompletionMethod@endlink.
@c wxEVT_STC_AUTOCOMP_SELECTION_CHANGE
- Generated when items are highlighted in an autocompletion or user list.
- @link wxStyledTextEvent::GetPosition GetPosition@endlink will return the
position at which the list is being shown.
- For a user list, @link wxStyledTextEvent::GetListType GetListType@endlink
will return the list type. The list type is a value input in to the
@link wxStyledTextCtrl::UserListShow wxStyledTextCtrl::UserListShow@endlink
method when a user list is created.
- For an autocompletion list,
@link wxStyledTextEvent::GetListType GetListType@endlink will always return
zero.
- Valid event functions:
@link wxStyledTextEvent::GetListType GetListType@endlink,
@link wxStyledTextEvent::GetPosition GetPosition@endlink,
@link wxStyledTextEvent::GetString GetString@endlink.
@c wxEVT_STC_CALLTIP_CLICK @c wxEVT_STC_CALLTIP_CLICK
- Generated when a calltip has been clicked. - Generated when a calltip has been clicked.
@@ -8059,7 +7959,8 @@ public:
- Generated when the text of the document has changed. - Generated when the text of the document has changed.
- This an older style event and should probably not be used in new code. - This an older style event and should probably not be used in new code. Use
@c wxEVT_STC_MODIFIED instead.
- Valid event functions: none. - Valid event functions: none.
@@ -8536,7 +8437,8 @@ public:
wxStyledTextCtrl::UserListShow @endlink method and can be used to wxStyledTextCtrl::UserListShow @endlink method and can be used to
distinguish lists if more than one is used. distinguish lists if more than one is used.
This method is valid for @c wxEVT_STC_USERLISTSELECTION events. This method is valid for @c wxEVT_STC_AUTOCOMP_SELECTION_CHANGE and
@c wxEVT_STC_USERLISTSELECTION events.
*/ */
int GetListType() const; int GetListType() const;
@@ -8684,6 +8586,7 @@ public:
- @c wxEVT_STC_INDICATOR_RELEASE - @c wxEVT_STC_INDICATOR_RELEASE
- @c wxEVT_STC_CALLTIP_CLICK - @c wxEVT_STC_CALLTIP_CLICK
- @c wxEVT_STC_AUTOCOMP_SELECTION - @c wxEVT_STC_AUTOCOMP_SELECTION
- @c wxEVT_STC_AUTOCOMP_SELECTION_CHANGE
- @c wxEVT_STC_AUTOCOMP_COMPLETED - @c wxEVT_STC_AUTOCOMP_COMPLETED
- @c wxEVT_STC_MARGIN_RIGHT_CLICK - @c wxEVT_STC_MARGIN_RIGHT_CLICK
*/ */
@@ -8937,3 +8840,4 @@ const wxEventType wxEVT_STC_CLIPBOARD_COPY;
const wxEventType wxEVT_STC_CLIPBOARD_PASTE; const wxEventType wxEVT_STC_CLIPBOARD_PASTE;
const wxEventType wxEVT_STC_AUTOCOMP_COMPLETED; const wxEventType wxEVT_STC_AUTOCOMP_COMPLETED;
const wxEventType wxEVT_STC_MARGIN_RIGHT_CLICK; const wxEventType wxEVT_STC_MARGIN_RIGHT_CLICK;
const wxEventType wxEVT_STC_AUTOCOMP_SELECTION_CHANGE;

View File

@@ -2010,9 +2010,14 @@ PRectangle Window::GetMonitorRect(Point pt) {
wxNonOwnedWindow::Create(parent, m_nativeWin); wxNonOwnedWindow::Create(parent, m_nativeWin);
m_stc = wxDynamicCast(parent, wxStyledTextCtrl); m_stc = wxDynamicCast(parent, wxStyledTextCtrl);
m_isShown = false; m_isShown = false;
m_cursorSetByPopup = false;
m_prevCursor = wxSTC_CURSORNORMAL;
Bind(wxEVT_ENTER_WINDOW, &wxSTCPopupBase::OnMouseEnter, this); Bind(wxEVT_ENTER_WINDOW, &wxSTCPopupBase::OnMouseEnter, this);
Bind(wxEVT_LEAVE_WINDOW, &wxSTCPopupBase::OnMouseLeave, this); Bind(wxEVT_LEAVE_WINDOW, &wxSTCPopupBase::OnMouseLeave, this);
if ( m_stc )
m_stc->Bind(wxEVT_DESTROY, &wxSTCPopupBase::OnParentDestroy, this);
} }
wxSTCPopupBase::~wxSTCPopupBase() wxSTCPopupBase::~wxSTCPopupBase()
@@ -2020,7 +2025,11 @@ PRectangle Window::GetMonitorRect(Point pt) {
UnsubclassWin(); UnsubclassWin();
CloseFloatingWindow(m_nativeWin); CloseFloatingWindow(m_nativeWin);
SetSTCCursor(wxSTC_CURSORNORMAL); if ( m_stc )
{
m_stc->Unbind(wxEVT_DESTROY, &wxSTCPopupBase::OnParentDestroy,this);
RestoreSTCCursor();
}
} }
bool wxSTCPopupBase::Show(bool show) bool wxSTCPopupBase::Show(bool show)
@@ -2038,7 +2047,7 @@ PRectangle Window::GetMonitorRect(Point pt) {
else else
{ {
HideFloatingWindow(m_nativeWin); HideFloatingWindow(m_nativeWin);
SetSTCCursor(wxSTC_CURSORNORMAL); RestoreSTCCursor();
} }
return true; return true;
@@ -2056,8 +2065,21 @@ PRectangle Window::GetMonitorRect(Point pt) {
void wxSTCPopupBase::SetSTCCursor(int cursor) void wxSTCPopupBase::SetSTCCursor(int cursor)
{ {
if ( m_stc ) if ( m_stc )
{
m_cursorSetByPopup = true;
m_prevCursor = m_stc->GetSTCCursor();
m_stc->SetSTCCursor(cursor); m_stc->SetSTCCursor(cursor);
} }
}
void wxSTCPopupBase::RestoreSTCCursor()
{
if ( m_stc != NULL && m_cursorSetByPopup )
m_stc->SetSTCCursor(m_prevCursor);
m_cursorSetByPopup = false;
m_prevCursor = wxSTC_CURSORNORMAL;
}
void wxSTCPopupBase::OnMouseEnter(wxMouseEvent& WXUNUSED(event)) void wxSTCPopupBase::OnMouseEnter(wxMouseEvent& WXUNUSED(event))
{ {
@@ -2066,7 +2088,12 @@ PRectangle Window::GetMonitorRect(Point pt) {
void wxSTCPopupBase::OnMouseLeave(wxMouseEvent& WXUNUSED(event)) void wxSTCPopupBase::OnMouseLeave(wxMouseEvent& WXUNUSED(event))
{ {
SetSTCCursor(wxSTC_CURSORNORMAL); RestoreSTCCursor();
}
void wxSTCPopupBase::OnParentDestroy(wxWindowDestroyEvent& WXUNUSED(event))
{
m_stc = NULL;
} }
#elif wxUSE_POPUPWIN #elif wxUSE_POPUPWIN
@@ -2328,6 +2355,12 @@ public:
const wxColour& GetCurrentBgColour() const; const wxColour& GetCurrentBgColour() const;
const wxColour& GetCurrentTextColour() const; const wxColour& GetCurrentTextColour() const;
// Data needed for SELECTION_CHANGE event
void SetSciListData(int*, int*, int*);
int GetListType() const;
int GetPosStart() const;
int GetStartLen() const;
private: private:
WX_DECLARE_HASH_MAP(int, wxBitmap, wxIntegerHash, wxIntegerEqual, ImgList); WX_DECLARE_HASH_MAP(int, wxBitmap, wxIntegerHash, wxIntegerEqual, ImgList);
@@ -2349,6 +2382,10 @@ private:
wxColour m_currentTextColour; wxColour m_currentTextColour;
bool m_useDefaultCurrentBgColour; bool m_useDefaultCurrentBgColour;
bool m_useDefaultCurrentTextColour; bool m_useDefaultCurrentTextColour;
int* m_listType;
int* m_posStart;
int* m_startLen;
}; };
wxSTCListBoxVisualData::wxSTCListBoxVisualData(int d):m_desiredVisibleRows(d), wxSTCListBoxVisualData::wxSTCListBoxVisualData(int d):m_desiredVisibleRows(d),
@@ -2356,9 +2393,10 @@ wxSTCListBoxVisualData::wxSTCListBoxVisualData(int d):m_desiredVisibleRows(d),
m_useDefaultTextColour(true), m_useDefaultTextColour(true),
m_useDefaultHighlightBgColour(true), m_useDefaultHighlightBgColour(true),
m_useDefaultHighlightTextColour(true), m_useDefaultHighlightTextColour(true),
m_hasListCtrlAppearance(false), m_hasListCtrlAppearance(true),
m_useDefaultCurrentBgColour(true), m_useDefaultCurrentBgColour(true),
m_useDefaultCurrentTextColour(true) m_useDefaultCurrentTextColour(true),
m_listType(NULL), m_posStart(NULL), m_startLen(NULL)
{ {
ComputeColours(); ComputeColours();
} }
@@ -2557,6 +2595,28 @@ const wxColour& wxSTCListBoxVisualData::GetCurrentTextColour() const
return m_currentTextColour; return m_currentTextColour;
} }
void wxSTCListBoxVisualData::SetSciListData(int* type, int* pos, int* len)
{
m_listType = type;
m_posStart = pos;
m_startLen = len;
}
int wxSTCListBoxVisualData::GetListType() const
{
return (m_listType?*m_listType:0);
}
int wxSTCListBoxVisualData::GetPosStart() const
{
return (m_posStart?*m_posStart:0);
}
int wxSTCListBoxVisualData::GetStartLen() const
{
return (m_startLen?*m_startLen:0);
}
// The class is intended to look like a standard listbox (with an optional // The class is intended to look like a standard listbox (with an optional
// icon). However, it needs to look like it has focus even when it doesn't. // icon). However, it needs to look like it has focus even when it doesn't.
class wxSTCListBox : public wxSystemThemedControl<wxVListBox> class wxSTCListBox : public wxSystemThemedControl<wxVListBox>
@@ -2587,11 +2647,13 @@ public:
protected: protected:
// Helpers // Helpers
void AppendHelper(const wxString& text, int type); void AppendHelper(const wxString& text, int type);
void SelectHelper(int i);
void AccountForBitmap(int type, bool recalculateItemHeight); void AccountForBitmap(int type, bool recalculateItemHeight);
void RecalculateItemHeight(); void RecalculateItemHeight();
int TextBoxFromClientEdge() const; int TextBoxFromClientEdge() const;
// Event handlers // Event handlers
void OnSelection(wxCommandEvent&);
void OnDClick(wxCommandEvent&); void OnDClick(wxCommandEvent&);
void OnSysColourChanged(wxSysColourChangedEvent& event); void OnSysColourChanged(wxSysColourChangedEvent& event);
void OnMouseMotion(wxMouseEvent& event); void OnMouseMotion(wxMouseEvent& event);
@@ -2646,6 +2708,7 @@ wxSTCListBox::wxSTCListBox(wxWindow* parent, wxSTCListBoxVisualData* v, int ht)
SetBackgroundColour(m_visualData->GetBgColour()); SetBackgroundColour(m_visualData->GetBgColour());
Bind(wxEVT_LISTBOX, &wxSTCListBox::OnSelection, this);
Bind(wxEVT_LISTBOX_DCLICK, &wxSTCListBox::OnDClick, this); Bind(wxEVT_LISTBOX_DCLICK, &wxSTCListBox::OnDClick, this);
Bind(wxEVT_SYS_COLOUR_CHANGED, &wxSTCListBox::OnSysColourChanged, this); Bind(wxEVT_SYS_COLOUR_CHANGED, &wxSTCListBox::OnSysColourChanged, this);
@@ -2759,6 +2822,7 @@ int wxSTCListBox::Length() const
void wxSTCListBox::Select(int n) void wxSTCListBox::Select(int n)
{ {
SetSelection(n); SetSelection(n);
SelectHelper(n);
} }
void wxSTCListBox::GetValue(int n, char *value, int len) const void wxSTCListBox::GetValue(int n, char *value, int len) const
@@ -2806,6 +2870,37 @@ void wxSTCListBox::AppendHelper(const wxString& text, int type)
SetItemCount(m_labels.size()); SetItemCount(m_labels.size());
} }
void wxSTCListBox::SelectHelper(int i)
{
// This method is used to trigger the wxEVT_STC_AUTOCOMP_SELECTION_CHANGE
// event. This event is generated directly here since the version of
// Scintilla currently used does not support it.
//If the Scintilla component is updated, it should be sufficient to:
// 1) Change this method to use a callback to let Scintilla generate the
// event.
// 2) Remove the SELECTION_CHANGE event data from the wxSTCListBoxVisualData
// class and the SetListInfo method from the ListBoxImpl class since they
// will no longer be needed.
wxStyledTextCtrl* stc = wxDynamicCast(GetGrandParent(), wxStyledTextCtrl);
if ( stc )
{
wxStyledTextEvent evt(wxEVT_STC_AUTOCOMP_SELECTION_CHANGE,stc->GetId());
evt.SetEventObject(stc);
evt.SetListType(m_visualData->GetListType());
evt.SetPosition(m_visualData->GetPosStart() -
m_visualData->GetStartLen());
if ( 0 <= i && i < static_cast<int>(m_labels.size()) )
evt.SetString(m_labels[i]);
stc->ProcessWindowEvent(evt);
}
}
void wxSTCListBox::AccountForBitmap(int type, bool recalculateItemHeight) void wxSTCListBox::AccountForBitmap(int type, bool recalculateItemHeight)
{ {
const int oldHeight = m_imageAreaHeight; const int oldHeight = m_imageAreaHeight;
@@ -2836,6 +2931,11 @@ int wxSTCListBox::TextBoxFromClientEdge() const
return (m_imageAreaWidth == 0 ? 0 : m_imageAreaWidth + 2 * m_imagePadding); return (m_imageAreaWidth == 0 ? 0 : m_imageAreaWidth + 2 * m_imagePadding);
} }
void wxSTCListBox::OnSelection(wxCommandEvent& event)
{
SelectHelper(event.GetSelection());
}
void wxSTCListBox::OnDClick(wxCommandEvent& WXUNUSED(event)) void wxSTCListBox::OnDClick(wxCommandEvent& WXUNUSED(event))
{ {
if ( m_doubleClickAction ) if ( m_doubleClickAction )
@@ -3163,16 +3263,9 @@ void ListBoxImpl::SetDoubleClickAction(CallBackAction action, void *data) {
m_listBox->SetDoubleClickAction(action, data); m_listBox->SetDoubleClickAction(action, data);
} }
void ListBoxImpl::SetColours(const wxColour& background, const wxColour& text, void ListBoxImpl::SetListInfo(int* listType, int* posStart, int* startLen)
const wxColour& hiliBg, const wxColour& hiliText)
{ {
m_visualData->SetColours(background, text, hiliBg, hiliText); m_visualData->SetSciListData(listType,posStart,startLen);
}
void ListBoxImpl::UseListCtrlStyle(bool useListCtrl, const wxColour& currentBg,
const wxColour& currentText)
{
m_visualData->UseListCtrlStyle(useListCtrl, currentBg, currentText);
} }

View File

@@ -49,9 +49,7 @@ public:
virtual void ClearRegisteredImages() wxOVERRIDE; virtual void ClearRegisteredImages() wxOVERRIDE;
virtual void SetDoubleClickAction(CallBackAction, void *) wxOVERRIDE; virtual void SetDoubleClickAction(CallBackAction, void *) wxOVERRIDE;
virtual void SetList(const char* list, char separator, char typesep) wxOVERRIDE; virtual void SetList(const char* list, char separator, char typesep) wxOVERRIDE;
void SetColours(const wxColour&, const wxColour&, void SetListInfo(int*, int*, int*);
const wxColour&, const wxColour&);
void UseListCtrlStyle(bool, const wxColour&, const wxColour&);
}; };
@@ -80,12 +78,16 @@ public:
protected: protected:
virtual void DoSetSize(int, int, int, int, int) wxOVERRIDE; virtual void DoSetSize(int, int, int, int, int) wxOVERRIDE;
void SetSTCCursor(int); void SetSTCCursor(int);
void RestoreSTCCursor();
void OnMouseEnter(wxMouseEvent&); void OnMouseEnter(wxMouseEvent&);
void OnMouseLeave(wxMouseEvent&); void OnMouseLeave(wxMouseEvent&);
void OnParentDestroy(wxWindowDestroyEvent& event);
private: private:
WX_NSWindow m_nativeWin; WX_NSWindow m_nativeWin;
wxStyledTextCtrl* m_stc; wxStyledTextCtrl* m_stc;
bool m_cursorSetByPopup;
int m_prevCursor;
}; };
#elif wxUSE_POPUPWIN #elif wxUSE_POPUPWIN

View File

@@ -293,6 +293,9 @@ void ScintillaWX::Initialise() {
kmap.AssignCmdKey(SCK_UP, SCI_CTRL, SCI_DOCUMENTSTART); kmap.AssignCmdKey(SCK_UP, SCI_CTRL, SCI_DOCUMENTSTART);
kmap.AssignCmdKey(SCK_DOWN, SCI_CTRL, SCI_DOCUMENTEND); kmap.AssignCmdKey(SCK_DOWN, SCI_CTRL, SCI_DOCUMENTEND);
#endif // __WXMAC__ #endif // __WXMAC__
static_cast<ListBoxImpl*>(ac.lb)->SetListInfo(&listType, &(ac.posStart),
&(ac.startLen));
} }
@@ -1399,24 +1402,6 @@ void ScintillaWX::DoRegisterImage(int type, const wxBitmap& bmp) {
static_cast<ListBoxImpl*>(ac.lb)->RegisterImageHelper(type, bmp); static_cast<ListBoxImpl*>(ac.lb)->RegisterImageHelper(type, bmp);
} }
void ScintillaWX::SetListBoxColours(const wxColour& background,
const wxColour& text,
const wxColour& highlight,
const wxColour& highlightText)
{
static_cast<ListBoxImpl*>(ac.lb)->SetColours(background, text,
highlight, highlightText);
}
void ScintillaWX::UseListCtrlStyleForLists(bool useListCtrl,
const wxColour& currentBgColour,
const wxColour& currentTextColour)
{
static_cast<ListBoxImpl*>(ac.lb)->UseListCtrlStyle(useListCtrl,
currentBgColour,
currentTextColour);
}
sptr_t ScintillaWX::DirectFunction( sptr_t ScintillaWX::DirectFunction(
ScintillaWX* swx, unsigned int iMessage, uptr_t wParam, sptr_t lParam) { ScintillaWX* swx, unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
return swx->WndProc(iMessage, wParam, lParam); return swx->WndProc(iMessage, wParam, lParam);

View File

@@ -201,9 +201,6 @@ public:
void SetPaintAbandoned(){paintState = paintAbandoned;} void SetPaintAbandoned(){paintState = paintAbandoned;}
void DoMarkerDefineBitmap(int markerNumber, const wxBitmap& bmp); void DoMarkerDefineBitmap(int markerNumber, const wxBitmap& bmp);
void DoRegisterImage(int type, const wxBitmap& bmp); void DoRegisterImage(int type, const wxBitmap& bmp);
void SetListBoxColours(const wxColour&, const wxColour&,
const wxColour&, const wxColour&);
void UseListCtrlStyleForLists(bool, const wxColour&, const wxColour&);
private: private:
bool capturedMouse; bool capturedMouse;

View File

@@ -136,6 +136,7 @@ wxDEFINE_EVENT( wxEVT_STC_CLIPBOARD_COPY, wxStyledTextEvent );
wxDEFINE_EVENT( wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent );
wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_COMPLETED, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_COMPLETED, wxStyledTextEvent );
wxDEFINE_EVENT( wxEVT_STC_MARGIN_RIGHT_CLICK, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_MARGIN_RIGHT_CLICK, wxStyledTextEvent );
wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_SELECTION_CHANGE, wxStyledTextEvent );
wxBEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl) wxBEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
@@ -5046,22 +5047,6 @@ void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp)
m_swx->DoRegisterImage(type, bmp); m_swx->DoRegisterImage(type, bmp);
} }
void wxStyledTextCtrl::AutoCompSetColours(const wxColour& background,
const wxColour& text,
const wxColour& highlight,
const wxColour& highlightText)
{
m_swx->SetListBoxColours(background, text, highlight, highlightText);
}
void wxStyledTextCtrl::AutoCompUseListCtrl(bool useListCtrl,
const wxColour& currentBgColour,
const wxColour& currentTextColour)
{
m_swx->UseListCtrlStyleForLists(useListCtrl, currentBgColour,
currentTextColour);
}

View File

@@ -136,6 +136,7 @@ wxDEFINE_EVENT( wxEVT_STC_CLIPBOARD_COPY, wxStyledTextEvent );
wxDEFINE_EVENT( wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent );
wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_COMPLETED, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_COMPLETED, wxStyledTextEvent );
wxDEFINE_EVENT( wxEVT_STC_MARGIN_RIGHT_CLICK, wxStyledTextEvent ); wxDEFINE_EVENT( wxEVT_STC_MARGIN_RIGHT_CLICK, wxStyledTextEvent );
wxDEFINE_EVENT( wxEVT_STC_AUTOCOMP_SELECTION_CHANGE, wxStyledTextEvent );
wxBEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl) wxBEGIN_EVENT_TABLE(wxStyledTextCtrl, wxControl)
@@ -573,22 +574,6 @@ void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp)
m_swx->DoRegisterImage(type, bmp); m_swx->DoRegisterImage(type, bmp);
} }
void wxStyledTextCtrl::AutoCompSetColours(const wxColour& background,
const wxColour& text,
const wxColour& highlight,
const wxColour& highlightText)
{
m_swx->SetListBoxColours(background, text, highlight, highlightText);
}
void wxStyledTextCtrl::AutoCompUseListCtrl(bool useListCtrl,
const wxColour& currentBgColour,
const wxColour& currentTextColour)
{
m_swx->UseListCtrlStyleForLists(useListCtrl, currentBgColour,
currentTextColour);
}

View File

@@ -304,16 +304,6 @@ public:
// Register an image for use in autocompletion lists. // Register an image for use in autocompletion lists.
void RegisterImage(int type, const wxBitmap& bmp); void RegisterImage(int type, const wxBitmap& bmp);
// Set the colours used to display the items in an autocompletion list.
void AutoCompSetColours(const wxColour& background, const wxColour& text,
const wxColour& highlight,
const wxColour& highlightText);
// Use a wxListCtrl to display autocompletion lists.
void AutoCompUseListCtrl(bool useListCtrl = true,
const wxColour& currentBgColour = wxNullColour,
const wxColour& currentTextColour = wxNullColour);
// The following methods are nearly equivalent to their similarly named // The following methods are nearly equivalent to their similarly named
@@ -789,6 +779,7 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_COPY, wxStyledTex
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CLIPBOARD_PASTE, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_COMPLETED, wxStyledTextEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_COMPLETED, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MARGIN_RIGHT_CLICK, wxStyledTextEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MARGIN_RIGHT_CLICK, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_SELECTION_CHANGE, wxStyledTextEvent );
#else #else
enum { enum {
@@ -830,7 +821,8 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_MARGIN_RIGHT_CLICK, wxStyle
wxEVT_STC_CLIPBOARD_COPY, wxEVT_STC_CLIPBOARD_COPY,
wxEVT_STC_CLIPBOARD_PASTE, wxEVT_STC_CLIPBOARD_PASTE,
wxEVT_STC_AUTOCOMP_COMPLETED, wxEVT_STC_AUTOCOMP_COMPLETED,
wxEVT_STC_MARGIN_RIGHT_CLICK wxEVT_STC_MARGIN_RIGHT_CLICK,
wxEVT_STC_AUTOCOMP_SELECTION_CHANGE
}; };
#endif #endif
@@ -877,7 +869,7 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
#define EVT_STC_CLIPBOARD_PASTE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CLIPBOARD_PASTE, 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 ),
#define EVT_STC_AUTOCOMP_COMPLETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_COMPLETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), #define EVT_STC_AUTOCOMP_COMPLETED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_COMPLETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_MARGIN_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGIN_RIGHT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), #define EVT_STC_MARGIN_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_MARGIN_RIGHT_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_AUTOCOMP_SELECTION_CHANGE(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION_CHANGE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#endif #endif
#endif // wxUSE_STC #endif // wxUSE_STC

View File

@@ -61,6 +61,9 @@
wxStyledTextCtrl is a 1 to 1 mapping of "raw" scintilla interface, whose wxStyledTextCtrl is a 1 to 1 mapping of "raw" scintilla interface, whose
documentation can be found in the Scintilla website (http://www.scintilla.org/). documentation can be found in the Scintilla website (http://www.scintilla.org/).
Please see wxStyledTextEvent for the documentation of all event types you
can use with wxStyledTextCtrl.
@section stc_index Index of the member groups @section stc_index Index of the member groups
@@ -72,86 +75,6 @@
- @ref_member_group{text_entry, Text entry methods} - @ref_member_group{text_entry, Text entry methods}
- @ref_member_group{text_area, Text area methods} - @ref_member_group{text_area, Text area methods}
@section event_list Events
@beginEventEmissionTable{wxStyledTextEvent}
@event{EVT_STC_AUTOCOMP_CANCELLED(id, fn)}
Process a @c wxEVT_STC_AUTOCOMP_CANCELLED event.
@event{EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn)}
Process a @c wxEVT_STC_AUTOCOMP_CHAR_DELETED event.
@event{EVT_STC_AUTOCOMP_COMPLETED(id, fn)}
Process a @c wxEVT_STC_AUTOCOMP_COMPLETED event.
@since 3.1.1
@event{EVT_STC_AUTOCOMP_SELECTION(id, fn)}
Process a @c wxEVT_STC_AUTOCOMP_SELECTION event.
@event{EVT_STC_CALLTIP_CLICK(id, fn)}
Process a @c wxEVT_STC_CALLTIP_CLICK event.
@event{EVT_STC_CHANGE(id, fn)}
Process a @c wxEVT_STC_CHANGE event.
@event{EVT_STC_CHARADDED(id, fn)}
Process a @c wxEVT_STC_CHARADDED event.
@event{EVT_STC_CLIPBOARD_COPY(id, fn)}
Process a @c wxEVT_STC_CLIPBOARD_COPY event.
@since 3.1.0
@event{EVT_STC_CLIPBOARD_PASTE(id, fn)}
Process a @c wxEVT_STC_CLIPBOARD_PASTE event.
@since 3.1.0
@event{EVT_STC_DO_DROP(id, fn)}
Process a @c wxEVT_STC_DO_DROP event.
@event{EVT_STC_DOUBLECLICK(id, fn)}
Process a @c wxEVT_STC_DOUBLECLICK event.
@event{EVT_STC_DRAG_OVER(id, fn)}
Process a @c wxEVT_STC_DRAG_OVER event.
@event{EVT_STC_DWELLEND(id, fn)}
Process a @c wxEVT_STC_DWELLEND event.
@event{EVT_STC_DWELLSTART(id, fn)}
Process a @c wxEVT_STC_DWELLSTART event.
@event{EVT_STC_HOTSPOT_CLICK(id, fn)}
Process a @c wxEVT_STC_HOTSPOT_CLICK event.
@event{EVT_STC_HOTSPOT_DCLICK(id, fn)}
Process a @c wxEVT_STC_HOTSPOT_DCLICK event.
@event{EVT_STC_HOTSPOT_RELEASE_CLICK(id, fn)}
Process a @c wxEVT_STC_HOTSPOT_RELEASE_CLICK event.
@event{EVT_STC_INDICATOR_CLICK(id, fn)}
Process a @c wxEVT_STC_INDICATOR_CLICK event.
@event{EVT_STC_INDICATOR_RELEASE(id, fn)}
Process a @c wxEVT_STC_INDICATOR_RELEASE event.
@event{EVT_STC_MACRORECORD(id, fn)}
Process a @c wxEVT_STC_MACRORECORD event.
@event{EVT_STC_MARGIN_RIGHT_CLICK(id, fn)}
Process a @c wxEVT_STC_MARGIN_RIGHT_CLICK event.
@since 3.1.1
@event{EVT_STC_MARGINCLICK(id, fn)}
Process a @c wxEVT_STC_MARGINCLICK event.
@event{EVT_STC_MODIFIED(id, fn)}
Process a @c wxEVT_STC_MODIFIED event.
@event{EVT_STC_NEEDSHOWN(id, fn)}
Process a @c wxEVT_STC_NEEDSHOWN event.
@event{EVT_STC_PAINTED(id, fn)}
Process a @c wxEVT_STC_PAINTED event.
@event{EVT_STC_ROMODIFYATTEMPT(id, fn)}
Process a @c wxEVT_STC_ROMODIFYATTEMPT event.
@event{EVT_STC_SAVEPOINTLEFT(id, fn)}
Process a @c wxEVT_STC_SAVEPOINTLEFT event.
@event{EVT_STC_SAVEPOINTREACHED(id, fn)}
Process a @c wxEVT_STC_SAVEPOINTREACHED event.
@event{EVT_STC_START_DRAG(id, fn)}
Process a @c wxEVT_STC_START_DRAG event.
@event{EVT_STC_STYLENEEDED(id, fn)}
Process a @c wxEVT_STC_STYLENEEDED event.
@event{EVT_STC_UPDATEUI(id, fn)}
Process a @c wxEVT_STC_UPDATEUI event.
@event{EVT_STC_USERLISTSELECTION(id, fn)}
Process a @c wxEVT_STC_USERLISTSELECTION event.
@event{EVT_STC_ZOOM(id, fn)}
Process a @c wxEVT_STC_ZOOM event.
@endEventTable
@library{wxstc} @library{wxstc}
@category{stc} @category{stc}
@@ -363,54 +286,6 @@ public:
*/ */
void RegisterImage(int type, const wxBitmap& bmp); void RegisterImage(int type, const wxBitmap& bmp);
/**
Set the colours used to display the items in an autocompletion list.
This method can be used if the default colours make the list hard to
read or if specific colours are desired for whatever reason.
@param background
The colour used for the background of the list.
@param text
The colour used for all text except for the selected item.
@param highlight
The colour used to highlight the selected item in the list.
@param highlightText
The colour used for the text of the selected item.
@remarks
To reset one or more of the colours to its default,
call this method with wxNullColour for the colour or colours
to be reset.
@since 3.1.3
*/
void AutoCompSetColours(const wxColour& background, const wxColour& text,
const wxColour& highlight,
const wxColour& highlightText);
/**
Use a wxListCtrl to display autocompletion and user lists.
By default lists will be displayed in a wxListBox. Use this method to
display them in a wxListCtrl instead. The primary difference is that
wxListCtrl has hot tracking to highlight the item under the mouse cursor.
@param useListCtrl
Set this to true to use a wxListCtrl and to false to use a
wxListBox.
@param currentBgColour
The colour used to highlight the item under the mouse cursor.
@param currentTextColour
The colour used for the text of the item under the mouse cursor.
@remarks
To reset one or more of the colours to its default,
call this method with wxNullColour for the colour or colours
to be reset.
@since 3.1.3
*/
void AutoCompUseListCtrl(bool useListCtrl = true,
const wxColour& currentBgColour = wxNullColour,
const wxColour& currentTextColour = wxNullColour);
//@} //@}
@@ -531,7 +406,7 @@ public:
@param value @param value
The value to replace the existing text with. The value to replace the existing text with.
*/ */
virtual void Replace(long from, long to, const wxString& text); virtual void Replace(long from, long to, const wxString& value);
/** /**
Sets the insertion point at the given position. Sets the insertion point at the given position.
@@ -664,7 +539,7 @@ public:
@return @return
The length of the line, or -1 if @a lineNo was invalid. The length of the line, or -1 if @a lineNo was invalid.
*/ */
virtual int GetLineLength(long n) const; virtual int GetLineLength(long lineNo) const;
/** /**
Returns the contents of a given line in the text control, not including Returns the contents of a given line in the text control, not including
@@ -676,7 +551,7 @@ public:
@return @return
The contents of the line. The contents of the line.
*/ */
virtual wxString GetLineText(long n) const; virtual wxString GetLineText(long lineNo) const;
/** /**
Returns the number of lines in the text control buffer. Returns the number of lines in the text control buffer.
@@ -864,6 +739,10 @@ public:
@event{EVT_STC_AUTOCOMP_SELECTION(id, fn)} @event{EVT_STC_AUTOCOMP_SELECTION(id, fn)}
Process a @c wxEVT_STC_AUTOCOMP_SELECTION event. Process a @c wxEVT_STC_AUTOCOMP_SELECTION event.
@event{EVT_STC_AUTOCOMP_SELECTION_CHANGE(id, fn)}
Process a @c wxEVT_STC_AUTOCOMP_SELECTION_CHANGE event.
@since 3.1.3
@event{EVT_STC_CALLTIP_CLICK(id, fn)} @event{EVT_STC_CALLTIP_CLICK(id, fn)}
Process a @c wxEVT_STC_CALLTIP_CLICK event. Process a @c wxEVT_STC_CALLTIP_CLICK event.
@event{EVT_STC_CHANGE(id, fn)} @event{EVT_STC_CHANGE(id, fn)}
@@ -984,6 +863,27 @@ public:
@link wxStyledTextEvent::GetString GetString@endlink, @link wxStyledTextEvent::GetString GetString@endlink,
@link wxStyledTextEvent::GetListCompletionMethod GetListCompletionMethod@endlink. @link wxStyledTextEvent::GetListCompletionMethod GetListCompletionMethod@endlink.
@c wxEVT_STC_AUTOCOMP_SELECTION_CHANGE
- Generated when items are highlighted in an autocompletion or user list.
- @link wxStyledTextEvent::GetPosition GetPosition@endlink will return the
position at which the list is being shown.
- For a user list, @link wxStyledTextEvent::GetListType GetListType@endlink
will return the list type. The list type is a value input in to the
@link wxStyledTextCtrl::UserListShow wxStyledTextCtrl::UserListShow@endlink
method when a user list is created.
- For an autocompletion list,
@link wxStyledTextEvent::GetListType GetListType@endlink will always return
zero.
- Valid event functions:
@link wxStyledTextEvent::GetListType GetListType@endlink,
@link wxStyledTextEvent::GetPosition GetPosition@endlink,
@link wxStyledTextEvent::GetString GetString@endlink.
@c wxEVT_STC_CALLTIP_CLICK @c wxEVT_STC_CALLTIP_CLICK
- Generated when a calltip has been clicked. - Generated when a calltip has been clicked.
@@ -999,7 +899,8 @@ public:
- Generated when the text of the document has changed. - Generated when the text of the document has changed.
- This an older style event and should probably not be used in new code. - This an older style event and should probably not be used in new code. Use
@c wxEVT_STC_MODIFIED instead.
- Valid event functions: none. - Valid event functions: none.
@@ -1476,7 +1377,8 @@ public:
wxStyledTextCtrl::UserListShow @endlink method and can be used to wxStyledTextCtrl::UserListShow @endlink method and can be used to
distinguish lists if more than one is used. distinguish lists if more than one is used.
This method is valid for @c wxEVT_STC_USERLISTSELECTION events. This method is valid for @c wxEVT_STC_AUTOCOMP_SELECTION_CHANGE and
@c wxEVT_STC_USERLISTSELECTION events.
*/ */
int GetListType() const; int GetListType() const;
@@ -1624,6 +1526,7 @@ public:
- @c wxEVT_STC_INDICATOR_RELEASE - @c wxEVT_STC_INDICATOR_RELEASE
- @c wxEVT_STC_CALLTIP_CLICK - @c wxEVT_STC_CALLTIP_CLICK
- @c wxEVT_STC_AUTOCOMP_SELECTION - @c wxEVT_STC_AUTOCOMP_SELECTION
- @c wxEVT_STC_AUTOCOMP_SELECTION_CHANGE
- @c wxEVT_STC_AUTOCOMP_COMPLETED - @c wxEVT_STC_AUTOCOMP_COMPLETED
- @c wxEVT_STC_MARGIN_RIGHT_CLICK - @c wxEVT_STC_MARGIN_RIGHT_CLICK
*/ */
@@ -1877,3 +1780,4 @@ const wxEventType wxEVT_STC_CLIPBOARD_COPY;
const wxEventType wxEVT_STC_CLIPBOARD_PASTE; const wxEventType wxEVT_STC_CLIPBOARD_PASTE;
const wxEventType wxEVT_STC_AUTOCOMP_COMPLETED; const wxEventType wxEVT_STC_AUTOCOMP_COMPLETED;
const wxEventType wxEVT_STC_MARGIN_RIGHT_CLICK; const wxEventType wxEVT_STC_MARGIN_RIGHT_CLICK;
const wxEventType wxEVT_STC_AUTOCOMP_SELECTION_CHANGE;