// Helper classes for ListBox
-// This is a simple subclass of wxLIstView that just resets focus to the
+// This is a simple subclass of wxListView that just resets focus to the
// parent when it gets it.
class wxSTCListBox : public wxListView {
public:
event.Skip();
}
+ void OnKillFocus(wxFocusEvent& event) {
+ // Do nothing. Prevents base class from resetting the colors...
+ }
+
private:
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(wxSTCListBox, wxListView)
EVT_SET_FOCUS( wxSTCListBox::OnFocus)
+ EVT_KILL_FOCUS(wxSTCListBox::OnKillFocus)
END_EVENT_TABLE()
lv->SetCursor(wxCursor(wxCURSOR_ARROW));
lv->InsertColumn(0, wxEmptyString);
lv->InsertColumn(1, wxEmptyString);
+
+ // Eventhough we immediately reset the focus to the parent, this helps
+ // things to look right...
+ lv->SetFocus();
+
Hide();
}
ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) {
capturedMouse = false;
+ focusEvent = false;
wMain = win;
stc = win;
wheelRotation = 0;
}
+// This method is overloaded from ScintillaBase in order to prevent the
+// AutoComplete window from being destroyed when it gets the focus. There is
+// a side effect that the AutoComp will also not be destroyed when switching
+// to another window, but I think that is okay.
+void ScintillaWX::CancelModes() {
+ if (! focusEvent)
+ AutoCompleteCancel();
+ ct.CallTipCancel();
+ Editor::CancelModes();
+}
+
+
void ScintillaWX::Copy() {
if (currentPos != anchor) {
}
void ScintillaWX::DoLoseFocus(){
+ focusEvent = true;
SetFocusState(false);
+ focusEvent = false;
}
void ScintillaWX::DoGainFocus(){
+ focusEvent = true;
SetFocusState(true);
+ focusEvent = false;
}
void ScintillaWX::DoSysColourChange() {
virtual void NotifyChange();
virtual void NotifyParent(SCNotification scn);
+ virtual void CancelModes();
// Event delegates
void DoPaint(wxDC* dc, wxRect rect);
private:
bool capturedMouse;
+ bool focusEvent;
wxStyledTextCtrl* stc;
#if wxUSE_DRAG_AND_DROP
// Helper classes for ListBox
-// This is a simple subclass of wxLIstView that just resets focus to the
+// This is a simple subclass of wxListView that just resets focus to the
// parent when it gets it.
class wxSTCListBox : public wxListView {
public:
event.Skip();
}
+ void OnKillFocus(wxFocusEvent& event) {
+ // Do nothing. Prevents base class from resetting the colors...
+ }
+
private:
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(wxSTCListBox, wxListView)
EVT_SET_FOCUS( wxSTCListBox::OnFocus)
+ EVT_KILL_FOCUS(wxSTCListBox::OnKillFocus)
END_EVENT_TABLE()
lv->SetCursor(wxCursor(wxCURSOR_ARROW));
lv->InsertColumn(0, wxEmptyString);
lv->InsertColumn(1, wxEmptyString);
+
+ // Eventhough we immediately reset the focus to the parent, this helps
+ // things to look right...
+ lv->SetFocus();
+
Hide();
}
ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) {
capturedMouse = false;
+ focusEvent = false;
wMain = win;
stc = win;
wheelRotation = 0;
}
+// This method is overloaded from ScintillaBase in order to prevent the
+// AutoComplete window from being destroyed when it gets the focus. There is
+// a side effect that the AutoComp will also not be destroyed when switching
+// to another window, but I think that is okay.
+void ScintillaWX::CancelModes() {
+ if (! focusEvent)
+ AutoCompleteCancel();
+ ct.CallTipCancel();
+ Editor::CancelModes();
+}
+
+
void ScintillaWX::Copy() {
if (currentPos != anchor) {
}
void ScintillaWX::DoLoseFocus(){
+ focusEvent = true;
SetFocusState(false);
+ focusEvent = false;
}
void ScintillaWX::DoGainFocus(){
+ focusEvent = true;
SetFocusState(true);
+ focusEvent = false;
}
void ScintillaWX::DoSysColourChange() {
virtual void NotifyChange();
virtual void NotifyParent(SCNotification scn);
+ virtual void CancelModes();
// Event delegates
void DoPaint(wxDC* dc, wxRect rect);
private:
bool capturedMouse;
+ bool focusEvent;
wxStyledTextCtrl* stc;
#if wxUSE_DRAG_AND_DROP