1. wxTextCtrl compilation fixes for wxGTK and more ugfixes (untested yet)

for wxMSW. Small doc update, too.
2. wxFFile compilation fixes for wxGTK
3. new files added to gtk/Makefile.am


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3006 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-07-15 13:42:27 +00:00
parent 8b04a037d0
commit 0efe5ba76e
12 changed files with 74 additions and 266 deletions

View File

@@ -603,17 +603,41 @@ long wxTextCtrl::XYToPosition(long x, long y) const
return (long)(x + charIndex);
}
void wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
bool wxTextCtrl::PositionToXY(long pos, long *x, long *y) const
{
HWND hWnd = GetHwnd();
// This gets the line number containing the character
int lineNo = (int)SendMessage(hWnd, EM_LINEFROMCHAR, (WPARAM)pos, (LPARAM)0);
int lineNo;
#if wxUSE_RICHEDIT
if ( m_isRich )
{
lineNo = (int)SendMessage(hWnd, EM_EXLINEFROMCHAR, 0, (LPARAM)pos);
}
else
#endif // wxUSE_RICHEDIT
lineNo = (int)SendMessage(hWnd, EM_LINEFROMCHAR, (WPARAM)pos, 0);
if ( lineNo == -1 )
{
// no such line
return FALSE;
}
// This gets the char index for the _beginning_ of this line
int charIndex = (int)SendMessage(hWnd, EM_LINEINDEX, (WPARAM)lineNo, (LPARAM)0);
if ( charIndex == -1 )
{
return FALSE;
}
// The X position must therefore be the different between pos and charIndex
*x = (long)(pos - charIndex);
*y = (long)lineNo;
if ( x )
*x = (long)(pos - charIndex);
if ( y )
*y = (long)lineNo;
return TRUE;
}
void wxTextCtrl::ShowPosition(long pos)