Ignore Windows key
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44539 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -141,7 +141,7 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
|
|||||||
|
|
||||||
GetBuffer().Reset();
|
GetBuffer().Reset();
|
||||||
GetBuffer().SetRichTextCtrl(this);
|
GetBuffer().SetRichTextCtrl(this);
|
||||||
|
|
||||||
SetCaret(new wxCaret(this, wxRICHTEXT_DEFAULT_CARET_WIDTH, 16));
|
SetCaret(new wxCaret(this, wxRICHTEXT_DEFAULT_CARET_WIDTH, 16));
|
||||||
GetCaret()->Show();
|
GetCaret()->Show();
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
|
|||||||
wxRichTextCtrl::~wxRichTextCtrl()
|
wxRichTextCtrl::~wxRichTextCtrl()
|
||||||
{
|
{
|
||||||
GetBuffer().RemoveEventHandler(this);
|
GetBuffer().RemoveEventHandler(this);
|
||||||
|
|
||||||
delete m_contextMenu;
|
delete m_contextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,7 +328,7 @@ void wxRichTextCtrl::OnKillFocus(wxFocusEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void wxRichTextCtrl::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event))
|
void wxRichTextCtrl::OnCaptureLost(wxMouseCaptureLostEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
m_dragging = false;
|
m_dragging = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Left-click
|
/// Left-click
|
||||||
@@ -390,7 +390,7 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event)
|
|||||||
long position = 0;
|
long position = 0;
|
||||||
wxPoint logicalPt = event.GetLogicalPosition(dc);
|
wxPoint logicalPt = event.GetLogicalPosition(dc);
|
||||||
int hit = GetBuffer().HitTest(dc, logicalPt, position);
|
int hit = GetBuffer().HitTest(dc, logicalPt, position);
|
||||||
|
|
||||||
if (hit != wxRICHTEXT_HITTEST_NONE)
|
if (hit != wxRICHTEXT_HITTEST_NONE)
|
||||||
{
|
{
|
||||||
wxTextAttrEx attr;
|
wxTextAttrEx attr;
|
||||||
@@ -402,20 +402,20 @@ void wxRichTextCtrl::OnLeftUp(wxMouseEvent& event)
|
|||||||
if (!urlTarget.IsEmpty())
|
if (!urlTarget.IsEmpty())
|
||||||
{
|
{
|
||||||
wxMouseEvent mouseEvent(event);
|
wxMouseEvent mouseEvent(event);
|
||||||
|
|
||||||
long startPos = 0, endPos = 0;
|
long startPos = 0, endPos = 0;
|
||||||
wxRichTextObject* obj = GetBuffer().GetLeafObjectAtPosition(position);
|
wxRichTextObject* obj = GetBuffer().GetLeafObjectAtPosition(position);
|
||||||
if (obj)
|
if (obj)
|
||||||
{
|
{
|
||||||
startPos = obj->GetRange().GetStart();
|
startPos = obj->GetRange().GetStart();
|
||||||
endPos = obj->GetRange().GetEnd();
|
endPos = obj->GetRange().GetEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxTextUrlEvent urlEvent(GetId(), mouseEvent, startPos, endPos);
|
wxTextUrlEvent urlEvent(GetId(), mouseEvent, startPos, endPos);
|
||||||
InitCommandEvent(urlEvent);
|
InitCommandEvent(urlEvent);
|
||||||
|
|
||||||
urlEvent.SetString(urlTarget);
|
urlEvent.SetString(urlTarget);
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent(urlEvent);
|
GetEventHandler()->ProcessEvent(urlEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -434,9 +434,9 @@ void wxRichTextCtrl::OnMoveMouse(wxMouseEvent& event)
|
|||||||
long position = 0;
|
long position = 0;
|
||||||
wxPoint logicalPt = event.GetLogicalPosition(dc);
|
wxPoint logicalPt = event.GetLogicalPosition(dc);
|
||||||
int hit = GetBuffer().HitTest(dc, logicalPt, position);
|
int hit = GetBuffer().HitTest(dc, logicalPt, position);
|
||||||
|
|
||||||
// See if we need to change the cursor
|
// See if we need to change the cursor
|
||||||
|
|
||||||
{
|
{
|
||||||
if (hit != wxRICHTEXT_HITTEST_NONE && !(hit & wxRICHTEXT_HITTEST_OUTSIDE))
|
if (hit != wxRICHTEXT_HITTEST_NONE && !(hit & wxRICHTEXT_HITTEST_OUTSIDE))
|
||||||
{
|
{
|
||||||
@@ -590,7 +590,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
// Generate conventional event
|
// Generate conventional event
|
||||||
wxCommandEvent textEvent(wxEVT_COMMAND_TEXT_ENTER, GetId());
|
wxCommandEvent textEvent(wxEVT_COMMAND_TEXT_ENTER, GetId());
|
||||||
InitCommandEvent(textEvent);
|
InitCommandEvent(textEvent);
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent(textEvent);
|
GetEventHandler()->ProcessEvent(textEvent);
|
||||||
}
|
}
|
||||||
Update();
|
Update();
|
||||||
@@ -598,7 +598,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
else if (event.GetKeyCode() == WXK_BACK)
|
else if (event.GetKeyCode() == WXK_BACK)
|
||||||
{
|
{
|
||||||
BeginBatchUndo(_("Delete Text"));
|
BeginBatchUndo(_("Delete Text"));
|
||||||
|
|
||||||
// Submit range in character positions, which are greater than caret positions,
|
// Submit range in character positions, which are greater than caret positions,
|
||||||
// so subtract 1 for deleted character and add 1 for conversion to character position.
|
// so subtract 1 for deleted character and add 1 for conversion to character position.
|
||||||
if (m_caretPosition > -1 && !HasSelection())
|
if (m_caretPosition > -1 && !HasSelection())
|
||||||
@@ -670,7 +670,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
switch ( keycode )
|
switch ( keycode )
|
||||||
{
|
{
|
||||||
case WXK_ESCAPE:
|
case WXK_ESCAPE:
|
||||||
// case WXK_SPACE:
|
|
||||||
case WXK_DELETE:
|
case WXK_DELETE:
|
||||||
case WXK_START:
|
case WXK_START:
|
||||||
case WXK_LBUTTON:
|
case WXK_LBUTTON:
|
||||||
@@ -764,6 +763,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
case WXK_NUMPAD_SEPARATOR:
|
case WXK_NUMPAD_SEPARATOR:
|
||||||
case WXK_NUMPAD_SUBTRACT:
|
case WXK_NUMPAD_SUBTRACT:
|
||||||
case WXK_NUMPAD_DECIMAL:
|
case WXK_NUMPAD_DECIMAL:
|
||||||
|
case WXK_WINDOWS_LEFT:
|
||||||
{
|
{
|
||||||
event.Skip();
|
event.Skip();
|
||||||
return;
|
return;
|
||||||
@@ -784,7 +784,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
cmdEvent.SetFlags(flags);
|
cmdEvent.SetFlags(flags);
|
||||||
cmdEvent.SetCharacter((wxChar) keycode);
|
cmdEvent.SetCharacter((wxChar) keycode);
|
||||||
cmdEvent.SetPosition(m_caretPosition+1);
|
cmdEvent.SetPosition(m_caretPosition+1);
|
||||||
|
|
||||||
if (keycode == wxT('\t'))
|
if (keycode == wxT('\t'))
|
||||||
{
|
{
|
||||||
// See if we need to promote or demote the selection or paragraph at the cursor
|
// See if we need to promote or demote the selection or paragraph at the cursor
|
||||||
@@ -821,7 +821,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
|
|||||||
|
|
||||||
SetDefaultStyleToCursorStyle();
|
SetDefaultStyleToCursorStyle();
|
||||||
ScrollIntoView(m_caretPosition, WXK_RIGHT);
|
ScrollIntoView(m_caretPosition, WXK_RIGHT);
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent(cmdEvent);
|
GetEventHandler()->ProcessEvent(cmdEvent);
|
||||||
|
|
||||||
Update();
|
Update();
|
||||||
@@ -2681,6 +2681,10 @@ bool wxRichTextCtrl::GetCaretPositionForIndex(long position, wxRect& rect)
|
|||||||
|
|
||||||
if (GetBuffer().FindPosition(dc, position, pt, & height, m_caretAtLineStart))
|
if (GetBuffer().FindPosition(dc, position, pt, & height, m_caretAtLineStart))
|
||||||
{
|
{
|
||||||
|
// Caret height can't be zero
|
||||||
|
if (height == 0)
|
||||||
|
height = dc.GetCharHeight();
|
||||||
|
|
||||||
rect = wxRect(pt, wxSize(wxRICHTEXT_DEFAULT_CARET_WIDTH, height));
|
rect = wxRect(pt, wxSize(wxRICHTEXT_DEFAULT_CARET_WIDTH, height));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user