X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4fabb57533169f2f75367e0d120c762518548890..eeccd5d94ce6b11f36af95db4ac528a2e2e0c4c5:/src/msw/textctrl.cpp?ds=sidebyside diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 623a803942..17cd5ae0c6 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -23,6 +23,9 @@ #ifndef WX_PRECOMP #include "wx/textctrl.h" #include "wx/settings.h" +#include "wx/brush.h" +#include "wx/utils.h" +#include "wx/log.h" #endif #if wxUSE_CLIPBOARD @@ -45,11 +48,15 @@ #endif #include +#ifndef __MWERKS__ #include +#else +#include +#endif #if defined(__BORLANDC__) && !defined(__WIN32__) #include #else -#ifndef __GNUWIN32__ +#if !defined(__GNUWIN32__) && !defined(__SALFORDC__) #include #endif #define farmalloc malloc @@ -59,7 +66,13 @@ #include -#if defined(__WIN95__) && !defined(__GNUWIN32__) +#if defined(__WIN95__) && !defined(__TWIN32__) +#define wxUSE_RICHEDIT 1 +#else +#define wxUSE_RICHEDIT 0 +#endif + +#if wxUSE_RICHEDIT && !defined(__GNUWIN32__) #include #endif @@ -145,7 +158,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, msStyle |= ES_PASSWORD; char *windowClass = "EDIT"; -#if defined(__WIN95__) +#if wxUSE_RICHEDIT if ( m_windowStyle & wxTE_MULTILINE ) { msStyle |= ES_AUTOVSCROLL; @@ -161,7 +174,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, // If we're in Win95, and we want a simple 2D border, // then make it an EDIT control instead. -#if defined(__WIN95__) +#if wxUSE_RICHEDIT if (m_windowStyle & wxSIMPLE_BORDER) { windowClass = "EDIT"; @@ -189,7 +202,7 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, } #endif -#if defined(__WIN95__) +#if wxUSE_RICHEDIT if (m_isRich) { // Have to enable events @@ -200,9 +213,9 @@ bool wxTextCtrl::Create(wxWindow *parent, wxWindowID id, SubclassWin(GetHWND()); - if ( parent->GetFont() && parent->GetFont()->Ok() ) + if ( parent->GetFont().Ok() && parent->GetFont().Ok() ) { - SetFont(* parent->GetFont()); + SetFont(parent->GetFont()); } else { @@ -237,9 +250,13 @@ void wxTextCtrl::AdoptAttributesFromHWND(void) #else #ifdef UNICODE GetClassNameW((HWND) hWnd, buf, 256); +#else +#ifdef __TWIN32__ + GetClassName((HWND) hWnd, buf, 256); #else GetClassNameA((HWND) hWnd, buf, 256); #endif +#endif #endif wxString str(buf); @@ -328,7 +345,7 @@ void wxTextCtrl::SetSize(int x, int y, int width, int height, int sizeFlags) int cx; // button font dimensions int cy; - wxGetCharSize(GetHWND(), &cx, &cy,GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, & this->GetFont()); int control_width, control_height, control_x, control_y; @@ -387,7 +404,7 @@ void wxTextCtrl::SetInsertionPoint(long pos) { HWND hWnd = (HWND) GetHWND(); #ifdef __WIN32__ -#if defined(__WIN95__) +#if wxUSE_RICHEDIT if ( m_isRich) { CHARRANGE range; @@ -417,7 +434,7 @@ void wxTextCtrl::SetInsertionPointEnd(void) long wxTextCtrl::GetInsertionPoint(void) const { -#if defined(__WIN95__) +#if wxUSE_RICHEDIT if (m_isRich) { CHARRANGE range; @@ -510,7 +527,7 @@ void wxTextCtrl::SetSelection(long from, long to) bool wxTextCtrl::LoadFile(const wxString& file) { - if (!FileExists(WXSTRINGCAST file)) + if (!wxFileExists(WXSTRINGCAST file)) return FALSE; m_fileName = file; @@ -528,9 +545,16 @@ bool wxTextCtrl::LoadFile(const wxString& file) // positions as signed shorts. Now load in one chunk... // Note use of 'farmalloc' as in Borland 3.1 'size_t' is 16-bits... +#ifdef __SALFORDC__ + struct _stat stat_buf; + if (stat((char*) (const char*) file, &stat_buf) < 0) + return FALSE; +#else struct stat stat_buf; if (stat(file, &stat_buf) < 0) return FALSE; +#endif + // char *tmp_buffer = (char*)farmalloc(stat_buf.st_size+1); // This may need to be a bigger buffer than the file size suggests, // if it's a UNIX file. Give it an extra 1000 just in case. @@ -740,7 +764,7 @@ void wxTextCtrl::OnDropFiles(wxDropFilesEvent& event) // or when "endl" is output (Borland 4.5) //========================================================================= // Class declaration using multiple inheritance doesn't work properly for -// Borland. See note in wb_text.h. +// Borland. See note in textctrl.h. #ifndef NO_TEXT_WINDOW_STREAM int wxTextCtrl::overflow(int c) { @@ -750,7 +774,7 @@ int wxTextCtrl::overflow(int c) #if wxUSE_IOSTREAMH if ( allocate()==EOF ) { - wxError("Streambuf allocation failed","Internal error"); + wxLogError("Streambuf allocation failed"); return EOF; } #endif @@ -976,10 +1000,13 @@ void wxTextCtrl::OnChar(wxKeyEvent& event) long wxTextCtrl::MSWGetDlgCode() { long lRc = DLGC_WANTCHARS | DLGC_WANTARROWS; - if ( m_windowStyle & wxPROCESS_ENTER ) + if ( m_windowStyle & wxTE_PROCESS_ENTER ) lRc |= DLGC_WANTMESSAGE; else if ( m_windowStyle & wxTE_MULTILINE ) lRc |= DLGC_WANTMESSAGE; + // ?? + if ( m_windowStyle & wxTE_PROCESS_TAB ) + lRc |= DLGC_WANTTAB; return lRc; } @@ -1082,7 +1109,7 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) // For Rich Edit controls. Do we need it? #if 0 -#if defined(__WIN95__) +#if wxUSE_RICHEDIT bool wxTextCtrl::MSWNotify(WXWPARAM wParam, WXLPARAM lParam) { wxCommandEvent event(0, m_windowId);