00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
#include "precomp.h"
00014
#pragma hdrstop
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 LONG
SLCreate(
00028
PED ped,
00029 LPCREATESTRUCT lpCreateStruct)
00030 {
00031 LPSTR lpWindowText;
00032 LONG windowStyle = ped->
pwnd->style;
00033
00034
00035
00036
00037
if (!
ECCreate(ped, windowStyle))
00038
return (-1);
00039
00040
00041
00042
00043 ped->
cLines = 1;
00044 ped->undoType =
UNDO_NONE;
00045
00046
00047
00048
00049
00050
if (windowStyle & ES_COMBOBOX)
00051 ped->
listboxHwnd =
GetDlgItem(lpCreateStruct->hwndParent,
CBLISTBOXID);
00052
00053
00054
00055
00056
ECSetFont(ped,
NULL,
FALSE);
00057
00058
00059
00060
00061
00062
if ((ULONG_PTR)lpCreateStruct->lpszName >
gHighestUserAddress)
00063 lpWindowText =
REBASEPTR(ped->
pwnd, (PVOID)lpCreateStruct->lpszName);
00064
else
00065 lpWindowText = (LPSTR)lpCreateStruct->lpszName;
00066
00067
if ((lpWindowText !=
NULL)
00068 && !
IsEmptyString(lpWindowText, ped->
fAnsi)
00069 && !
ECSetText(ped, lpWindowText)) {
00070
return (-1);
00071 }
00072
00073
if (windowStyle & ES_PASSWORD)
00074
ECSetPasswordChar(ped, (
UINT)
'*');
00075
00076
return TRUE;
00077 }
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 BOOL SLUndo(
00088
PED ped)
00089 {
00090
PBYTE hDeletedText = ped->hDeletedText;
00091
BOOL fDelete = (
BOOL)(ped->undoType &
UNDO_DELETE);
00092
ICH cchDeleted = ped->cchDeleted;
00093
ICH ichDeleted = ped->ichDeleted;
00094
BOOL fUpdate =
FALSE;
00095
00096
if (ped->undoType ==
UNDO_NONE) {
00097
00098
00099
00100
00101
return FALSE;
00102 }
00103
00104 ped->hDeletedText =
NULL;
00105 ped->cchDeleted = 0;
00106 ped->ichDeleted = (
ICH)-1;
00107 ped->undoType &= ~
UNDO_DELETE;
00108
00109
if (ped->undoType ==
UNDO_INSERT) {
00110 ped->undoType =
UNDO_NONE;
00111
00112
00113
00114
00115
SLSetSelection(ped, ped->ichInsStart, ped->ichInsEnd);
00116 ped->ichInsStart = ped->ichInsEnd = (
ICH)-1;
00117
00118
#ifdef NEVER
00119
00120
00121
00122
00123 SLCharHandler(pped, VK_BACK);
00124 fUpdate =
TRUE;
00125
#else
00126
00127
00128
00129
00130
00131
00132
00133
00134
if (
ECDeleteText(ped)) {
00135
00136
00137
00138
00139 fUpdate =
TRUE;
00140
SLSetSelection(ped, ichDeleted, ichDeleted);
00141 }
00142
#endif
00143
}
00144
00145
if (fDelete) {
00146 HWND hwndSave = ped->
hwnd;
00147
00148
00149
00150
00151
SLSetSelection(ped, ichDeleted, ichDeleted);
00152
SLInsertText(ped, hDeletedText, cchDeleted);
00153
UserGlobalFree(hDeletedText);
00154
if (!
IsWindow(hwndSave))
00155
return FALSE;
00156
SLSetSelection(ped, ichDeleted, ichDeleted + cchDeleted);
00157 fUpdate =
TRUE;
00158 }
00159
00160
if (fUpdate) {
00161
00162
00163
00164
00165
00166
ECNotifyParent(ped, EN_UPDATE);
00167
00168
if (
FChildVisible(ped->
hwnd)) {
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
ECInvalidateClient(ped,
FALSE);
00180 }
00181
00182
ECNotifyParent(ped, EN_CHANGE);
00183
00184
if (
FWINABLE()) {
00185
NotifyWinEvent(EVENT_OBJECT_VALUECHANGE, ped->
hwnd, OBJID_CLIENT, INDEXID_CONTAINER);
00186 }
00187 }
00188
00189
return TRUE;
00190 }