projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixed compilation for strict ANSI compilers
[wxWidgets.git]
/
src
/
univ
/
textctrl.cpp
diff --git
a/src/univ/textctrl.cpp
b/src/univ/textctrl.cpp
index 98b53bda8a47bc6118e19f94746a0ddc3699620d..2f552fe06337ca85259236beddaea709efe75dcb 100644
(file)
--- a/
src/univ/textctrl.cpp
+++ b/
src/univ/textctrl.cpp
@@
-5,7
+5,7
@@
// Modified by:
// Created: 15.09.00
// RCS-ID: $Id$
// Modified by:
// Created: 15.09.00
// RCS-ID: $Id$
-// Copyright: (c) 2000
Vadim Zeitlin
+// Copyright: (c) 2000
SciTech Software, Inc. (www.scitechsoft.com)
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
@@
-138,6
+138,7
@@
#endif
#include "wx/clipbrd.h"
#endif
#include "wx/clipbrd.h"
+
#include "wx/textfile.h"
#include "wx/caret.h"
#include "wx/textfile.h"
#include "wx/caret.h"
@@
-1412,6
+1413,10
@@
void wxTextCtrl::SetSelection(wxTextPos from, wxTextPos to)
}
else // valid sel range
{
}
else // valid sel range
{
+ // remember the 'to' position as the current position, used to move the
+ // caret there later
+ wxTextPos toOrig = to;
+
OrderPositions(from, to);
wxCHECK_RET( to <= GetLastPosition(),
OrderPositions(from, to);
wxCHECK_RET( to <= GetLastPosition(),
@@
-1457,8
+1462,8
@@
void wxTextCtrl::SetSelection(wxTextPos from, wxTextPos to)
}
//else: nothing to do
}
//else: nothing to do
- // the insertion point is put at the
end of selection
- DoSetInsertionPoint(to);
+ // the insertion point is put at the
location where the caret was moved
+ DoSetInsertionPoint(to
Orig
);
}
}
}
}
@@
-1735,6
+1740,8
@@
wxTextCoord wxTextCtrl::GetRowsPerLine(wxTextCoord line) const
wxTextCoord wxTextCtrl::GetRowCount() const
{
wxTextCoord count = GetLineCount();
wxTextCoord wxTextCtrl::GetRowCount() const
{
wxTextCoord count = GetLineCount();
+ if (count == 0)
+ return 0;
if ( WrapLines() )
{
count = GetFirstRowOfLine(count - 1) +
if ( WrapLines() )
{
count = GetFirstRowOfLine(count - 1) +
@@
-4702,7
+4709,7
@@
wxTextPos wxStdTextCtrlInputHandler::HitTest(const wxTextCtrl *text,
return pos;
}
return pos;
}
-bool wxStdTextCtrlInputHandler::HandleKey(wx
Control *control
,
+bool wxStdTextCtrlInputHandler::HandleKey(wx
InputConsumer *consumer
,
const wxKeyEvent& event,
bool pressed)
{
const wxKeyEvent& event,
bool pressed)
{
@@
-4819,22
+4826,22
@@
bool wxStdTextCtrlInputHandler::HandleKey(wxControl *control,
if ( (action != wxACTION_NONE) && (action != wxACTION_TEXT_PREFIX_SEL) )
{
if ( (action != wxACTION_NONE) && (action != wxACTION_TEXT_PREFIX_SEL) )
{
- con
trol
->PerformAction(action, -1, str);
+ con
sumer
->PerformAction(action, -1, str);
return TRUE;
}
return TRUE;
}
- return wxStdInputHandler::HandleKey(con
trol
, event, pressed);
+ return wxStdInputHandler::HandleKey(con
sumer
, event, pressed);
}
}
-bool wxStdTextCtrlInputHandler::HandleMouse(wx
Control *control
,
+bool wxStdTextCtrlInputHandler::HandleMouse(wx
InputConsumer *consumer
,
const wxMouseEvent& event)
{
if ( event.LeftDown() )
{
wxASSERT_MSG( !m_winCapture, _T("left button going down twice?") );
const wxMouseEvent& event)
{
if ( event.LeftDown() )
{
wxASSERT_MSG( !m_winCapture, _T("left button going down twice?") );
- wxTextCtrl *text = wxStaticCast(con
trol
, wxTextCtrl);
+ wxTextCtrl *text = wxStaticCast(con
sumer->GetInputWindow()
, wxTextCtrl);
m_winCapture = text;
m_winCapture->CaptureMouse();
m_winCapture = text;
m_winCapture->CaptureMouse();
@@
-4850,7
+4857,7
@@
bool wxStdTextCtrlInputHandler::HandleMouse(wxControl *control,
else if ( event.LeftDClick() )
{
// select the word the cursor is on
else if ( event.LeftDClick() )
{
// select the word the cursor is on
- con
trol
->PerformAction(wxACTION_TEXT_SEL_WORD);
+ con
sumer
->PerformAction(wxACTION_TEXT_SEL_WORD);
}
else if ( event.LeftUp() )
{
}
else if ( event.LeftUp() )
{
@@
-4863,10
+4870,10
@@
bool wxStdTextCtrlInputHandler::HandleMouse(wxControl *control,
}
}
}
}
- return wxStdInputHandler::HandleMouse(con
trol
, event);
+ return wxStdInputHandler::HandleMouse(con
sumer
, event);
}
}
-bool wxStdTextCtrlInputHandler::HandleMouseMove(wx
Control *control
,
+bool wxStdTextCtrlInputHandler::HandleMouseMove(wx
InputConsumer *consumer
,
const wxMouseEvent& event)
{
if ( m_winCapture )
const wxMouseEvent& event)
{
if ( m_winCapture )
@@
-4880,13
+4887,13
@@
bool wxStdTextCtrlInputHandler::HandleMouseMove(wxControl *control,
}
}
}
}
- return wxStdInputHandler::HandleMouseMove(con
trol
, event);
+ return wxStdInputHandler::HandleMouseMove(con
sumer
, event);
}
}
-bool wxStdTextCtrlInputHandler::HandleFocus(wx
Control *control
,
+bool wxStdTextCtrlInputHandler::HandleFocus(wx
InputConsumer *consumer
,
const wxFocusEvent& event)
{
const wxFocusEvent& event)
{
- wxTextCtrl *text = wxStaticCast(con
trol
, wxTextCtrl);
+ wxTextCtrl *text = wxStaticCast(con
sumer->GetInputWindow()
, wxTextCtrl);
// the selection appearance changes depending on whether we have the focus
text->RefreshSelection();
// the selection appearance changes depending on whether we have the focus
text->RefreshSelection();