Add the ability to show a CallTip in the stc sample.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@75461 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -112,6 +112,8 @@ BEGIN_EVENT_TABLE (Edit, wxStyledTextCtrl)
|
|||||||
EVT_STC_MARGINCLICK (wxID_ANY, Edit::OnMarginClick)
|
EVT_STC_MARGINCLICK (wxID_ANY, Edit::OnMarginClick)
|
||||||
EVT_STC_CHARADDED (wxID_ANY, Edit::OnCharAdded)
|
EVT_STC_CHARADDED (wxID_ANY, Edit::OnCharAdded)
|
||||||
EVT_STC_KEY( wxID_ANY , Edit::OnKey )
|
EVT_STC_KEY( wxID_ANY , Edit::OnKey )
|
||||||
|
|
||||||
|
EVT_KEY_DOWN( Edit::OnKeyDown )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
Edit::Edit (wxWindow *parent, wxWindowID id,
|
Edit::Edit (wxWindow *parent, wxWindowID id,
|
||||||
@@ -210,6 +212,22 @@ void Edit::OnKey (wxStyledTextEvent &WXUNUSED(event))
|
|||||||
wxMessageBox("OnKey");
|
wxMessageBox("OnKey");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Edit::OnKeyDown (wxKeyEvent &event)
|
||||||
|
{
|
||||||
|
if (CallTipActive())
|
||||||
|
CallTipCancel();
|
||||||
|
if (event.GetKeyCode() == WXK_SPACE && event.ControlDown() && event.ShiftDown())
|
||||||
|
{
|
||||||
|
int pos = GetCurrentPos();
|
||||||
|
CallTipSetBackground(*wxYELLOW);
|
||||||
|
CallTipShow(pos,
|
||||||
|
"This is a CallTip with multiple lines.\n"
|
||||||
|
"It is meant to be a context sensitive popup helper for the user.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.Skip();
|
||||||
|
}
|
||||||
|
|
||||||
void Edit::OnEditCut (wxCommandEvent &WXUNUSED(event)) {
|
void Edit::OnEditCut (wxCommandEvent &WXUNUSED(event)) {
|
||||||
if (GetReadOnly() || (GetSelectionEnd()-GetSelectionStart() <= 0)) return;
|
if (GetReadOnly() || (GetSelectionEnd()-GetSelectionStart() <= 0)) return;
|
||||||
Cut ();
|
Cut ();
|
||||||
|
@@ -103,6 +103,8 @@ public:
|
|||||||
void OnCharAdded (wxStyledTextEvent &event);
|
void OnCharAdded (wxStyledTextEvent &event);
|
||||||
void OnKey (wxStyledTextEvent &event);
|
void OnKey (wxStyledTextEvent &event);
|
||||||
|
|
||||||
|
void OnKeyDown(wxKeyEvent &event);
|
||||||
|
|
||||||
//! language/lexer
|
//! language/lexer
|
||||||
wxString DeterminePrefs (const wxString &filename);
|
wxString DeterminePrefs (const wxString &filename);
|
||||||
bool InitializePrefs (const wxString &filename);
|
bool InitializePrefs (const wxString &filename);
|
||||||
|
Reference in New Issue
Block a user