From: <kr_...@us...> - 2003-10-07 20:20:46
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv331/src/cbits/Win32 Modified Files: EditBox.c Log Message: Rename visible attribute to password Index: EditBox.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/EditBox.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** EditBox.c 24 Aug 2003 21:07:48 -0000 1.9 --- EditBox.c 7 Oct 2003 20:20:42 -0000 1.10 *************** *** 1,92 **** ! #include "EditBox.h" ! #include "Internals.h" ! #include "Handlers_stub.h" ! ! WindowHandle osCreateEdit(WindowHandle window) ! { ! HWND hEdit; ! ! hEdit = CreateWindowEx( ! WS_EX_CLIENTEDGE, ! "EDIT", ! NULL, ! WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL | WS_TABSTOP, ! 0,0,0,0, ! window, ! NULL, ! ghModule, ! NULL ! ); ! ! return checkWindow(hEdit, "EDIT"); ! }; ! ! void osGetEditReqSize(WindowHandle edit, int *res) ! { ! SIZE sz; ! HDC hDC = GetDC(edit); ! HFONT hFont = (HFONT) SendMessage(edit,WM_GETFONT,0,0); ! int nLen = 1; ! char *buffer = "m"; /* pretend a single letter as a minimal size */ ! ! if (hFont) SelectObject(hDC, hFont); ! GetTextExtentPoint32(hDC, buffer, nLen, &sz); ! ReleaseDC(edit, hDC); ! ! res[0] = sz.cx + GetSystemMetrics(SM_CXBORDER)*2 + 6; ! res[1] = sz.cy + GetSystemMetrics(SM_CYBORDER)*2 + 6; ! } ! ! char *osGetEditText(WindowHandle editbox) ! { ! int nLen = GetWindowTextLength(editbox); ! char *buffer = (char *) rmalloc(nLen+1); ! GetWindowText(editbox, buffer, nLen+1); ! return buffer; ! }; ! ! void osSetEditText(WindowHandle editbox, char *txt) ! { ! SetWindowText(editbox, txt); ! }; ! ! void osSetEditReadOnly(WindowHandle editbox, BOOL readOnly) ! { ! SendMessage(editbox,EM_SETREADONLY,readOnly,0); ! } ! ! BOOL osGetEditReadOnly(WindowHandle editbox) ! { ! return (GetWindowLong(editbox, GWL_STYLE) & ES_READONLY) != 0; ! } ! ! void osSetEditVisibility(WindowHandle editbox, BOOL visible) ! { ! LONG lStyle; ! ! lStyle = GetWindowLong(editbox, GWL_STYLE); ! ! if (visible) ! { ! SetWindowLong(editbox, GWL_STYLE, lStyle & ~ES_PASSWORD); ! SendMessage(editbox, EM_SETPASSWORDCHAR, 0, 0); ! } ! else ! { ! SetWindowLong(editbox, GWL_STYLE, lStyle | ES_PASSWORD); ! SendMessage(editbox, EM_SETPASSWORDCHAR, (WPARAM) '*', 0); ! } ! ! InvalidateRect(editbox,NULL,TRUE); ! } ! ! BOOL osGetEditVisibility(WindowHandle editbox) ! { ! return (GetWindowLong(editbox, GWL_STYLE) & ES_PASSWORD) == 0; ! } ! ! void osChangeEditBoxFont(WindowHandle editbox, FontHandle font) ! { ! SendMessage(editbox, WM_SETFONT, (WPARAM) font, MAKELPARAM (TRUE,0)); ! osForceContainerReLayout(editbox); ! }; --- 1,92 ---- ! #include "EditBox.h" ! #include "Internals.h" ! #include "Handlers_stub.h" ! ! WindowHandle osCreateEdit(WindowHandle window) ! { ! HWND hEdit; ! ! hEdit = CreateWindowEx( ! WS_EX_CLIENTEDGE, ! "EDIT", ! NULL, ! WS_CHILD | WS_VISIBLE | WS_BORDER | ES_AUTOHSCROLL | WS_TABSTOP, ! 0,0,0,0, ! window, ! NULL, ! ghModule, ! NULL ! ); ! ! return checkWindow(hEdit, "EDIT"); ! }; ! ! void osGetEditReqSize(WindowHandle edit, int *res) ! { ! SIZE sz; ! HDC hDC = GetDC(edit); ! HFONT hFont = (HFONT) SendMessage(edit,WM_GETFONT,0,0); ! int nLen = 1; ! char *buffer = "m"; /* pretend a single letter as a minimal size */ ! ! if (hFont) SelectObject(hDC, hFont); ! GetTextExtentPoint32(hDC, buffer, nLen, &sz); ! ReleaseDC(edit, hDC); ! ! res[0] = sz.cx + GetSystemMetrics(SM_CXBORDER)*2 + 6; ! res[1] = sz.cy + GetSystemMetrics(SM_CYBORDER)*2 + 6; ! } ! ! char *osGetEditText(WindowHandle editbox) ! { ! int nLen = GetWindowTextLength(editbox); ! char *buffer = (char *) rmalloc(nLen+1); ! GetWindowText(editbox, buffer, nLen+1); ! return buffer; ! }; ! ! void osSetEditText(WindowHandle editbox, char *txt) ! { ! SetWindowText(editbox, txt); ! }; ! ! void osSetEditReadOnly(WindowHandle editbox, BOOL readOnly) ! { ! SendMessage(editbox,EM_SETREADONLY,readOnly,0); ! } ! ! BOOL osGetEditReadOnly(WindowHandle editbox) ! { ! return (GetWindowLong(editbox, GWL_STYLE) & ES_READONLY) != 0; ! } ! ! void osSetEditPassword(WindowHandle editbox, BOOL visible) ! { ! LONG lStyle; ! ! lStyle = GetWindowLong(editbox, GWL_STYLE); ! ! if (visible) ! { ! SetWindowLong(editbox, GWL_STYLE, lStyle & ~ES_PASSWORD); ! SendMessage(editbox, EM_SETPASSWORDCHAR, 0, 0); ! } ! else ! { ! SetWindowLong(editbox, GWL_STYLE, lStyle | ES_PASSWORD); ! SendMessage(editbox, EM_SETPASSWORDCHAR, (WPARAM) '*', 0); ! } ! ! InvalidateRect(editbox,NULL,TRUE); ! } ! ! BOOL osGetEditPassword(WindowHandle editbox) ! { ! return (GetWindowLong(editbox, GWL_STYLE) & ES_PASSWORD) == 0; ! } ! ! void osChangeEditBoxFont(WindowHandle editbox, FontHandle font) ! { ! SendMessage(editbox, WM_SETFONT, (WPARAM) font, MAKELPARAM (TRUE,0)); ! osForceContainerReLayout(editbox); ! }; |