/*
* Edit control
*
* Copyright David W. Metcalfe, 1994
* Copyright William Magro, 1995, 1996
* Copyright Frans van Dorsselaer, 1996, 1997
*
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*
* NOTES
*
* This code was audited for completeness against the documented features
* of Comctl32.dll version 6.0 on Oct. 8, 2004, by Dimitrie O. Paun.
*
* Unless otherwise noted, we believe this code to be complete, as per
* the specification mentioned above.
* If you discover missing features, or bugs, please note them below.
*
* TODO:
* - EDITBALLOONTIP structure
* - EM_GETCUEBANNER/Edit_GetCueBannerText
* - EM_HIDEBALLOONTIP/Edit_HideBalloonTip
* - EM_SETCUEBANNER/Edit_SetCueBannerText
* - EM_SHOWBALLOONTIP/Edit_ShowBalloonTip
* - EM_GETIMESTATUS, EM_SETIMESTATUS
* - EN_ALIGN_LTR_EC
* - EN_ALIGN_RTL_EC
* - ES_OEMCONVERT
*
*/
//#include <user32.h>
//#include <wine/debug.h>
//WINE_DEFAULT_DEBUG_CHANNEL(edit);
//WINE_DECLARE_DEBUG_CHANNEL(combo);
//WINE_DECLARE_DEBUG_CHANNEL(relay);
#include <windows.h>
#define BUFLIMIT_INITIAL 30000 /* initial buffer size */
#define GROWLENGTH 32 /* buffers granularity in bytes: must be power of 2 */
#define ROUND_TO_GROW(size) (((size) + (GROWLENGTH - 1)) & ~(GROWLENGTH - 1))
#define HSCROLL_FRACTION 3 /* scroll window by 1/3 width */
/*
* extra flags for EDITSTATE.flags field
*/
#define EF_MODIFIED 0x0001 /* text has been modified */
#define EF_FOCUSED 0x0002 /* we have input focus */
#define EF_UPDATE 0x0004 /* notify parent of changed state */
#define EF_VSCROLL_TRACK 0x0008 /* don't SetScrollPos() since we are tracking the thumb */
#define EF_HSCROLL_TRACK 0x0010 /* don't SetScrollPos() since we are tracking the thumb */
#define EF_AFTER_WRAP 0x0080 /* the caret is displayed after the last character of a
wrapped line, instead of in front of the next character */
#define EF_USE_SOFTBRK 0x0100 /* Enable soft breaks in text. */
#define EF_APP_HAS_HANDLE 0x0200 /* Set when an app sends EM_[G|S]ETHANDLE. We are in sole control of
the text buffer if this is clear. */
#define EF_DIALOGMODE 0x0400 /* Indicates that we are inside a dialog window */
//*******************huzg************************
#define ES_COMBO 0x00000200
#define ID_CB_LISTBOX 1000
#define TRACE(fmt, ...)
#define WARN(fmt, ...)
#define FIXME(fmt, ...)
#define ERR(fmt, ...)
#define strcpyW(d,s) wcscpy((wchar_t *)(d),(const wchar_t *)(s))
#define strlenW(s) wcslen((const wchar_t *)(s))
//******************20101222**********************************
typedef enum
{
END_0 = 0, /* line ends with terminating '\0' character */
END_WRAP, /* line is wrapped */
END_HARD, /* line ends with a hard return '\r\n' */
END_SOFT, /* line ends with a soft return '\r\r\n' */
END_RICH /* line ends with a single '\n' */
} LINE_END;
typedef struct tagLINEDEF {
INT length; /* bruto length of a line in bytes */
INT net_length; /* netto length of a line in visible characters */
LINE_END ending;
INT width; /* width of the line in pixels */
INT index; /* line index into the buffer */
struct tagLINEDEF *next;
} LINEDEF;
typedef struct
{
BOOL is_unicode; /* how the control was created */
LPWSTR text; /* the actual contents of the control */
UINT text_length; /* cached length of text buffer (in WCHARs) - use get_text_length() to retrieve */
UINT buffer_size; /* the size of the buffer in characters */
UINT buffer_limit; /* the maximum size to which the buffer may grow in characters */
HFONT font; /* NULL means standard system font */
INT x_offset; /* scroll offset for multi lines this is in pixels
for single lines it's in characters */
INT line_height; /* height of a screen line in pixels */
INT char_width; /* average character width in pixels */
DWORD style; /* sane version of wnd->dwStyle */
WORD flags; /* flags that are not in es->style or wnd->flags (EF_XXX) */
INT undo_insert_count; /* number of characters inserted in sequence */
UINT undo_position; /* character index of the insertion and deletion */
LPWSTR undo_text; /* deleted text */
UINT undo_buffer_size; /* size of the deleted text buffer */
INT selection_start; /* == selection_end if no selection */
INT selection_end; /* == current caret position */
WCHAR password_char; /* == 0 if no password char, and for multi line controls */
INT left_margin; /* in pixels */
INT right_margin; /* in pixels */
RECT format_rect;
INT text_width; /* width of the widest line in pixels for multi line controls
and just line width for single line controls */
INT region_posx; /* Position of cursor relative to region: */
INT region_posy; /* -1: to left, 0: within, 1: to right */
void *word_break_proc; /* 32-bit word break proc: ANSI or Unicode */
INT line_count; /* number of lines */
INT y_offset; /* scroll offset in number of lines */
BOOL bCaptureState; /* flag indicating whether mouse was captured */
BOOL bEnableState; /* flag keeping the enable state */
HWND hwndSelf; /* the our window handle */
HWND hwndParent; /* Handle of parent for sending EN_* messages.
Even if parent will change, EN_* messages
should be sent to the first parent. */
HWND hwndListBox; /* handle of ComboBox's listbox or NULL */
/*
* only for multi line controls
*/
INT lock_count; /* amount of re-entries in the EditWndProc */
INT tabs_count;
LPINT tabs;
LINEDEF *first_line_def; /* linked list of (soft) linebreaks */
HLOCAL hloc32W; /* our unicode local memory block */
HLOCAL hloc32A; /* alias for ANSI control receiving EM_GETHANDLE
or EM_SETHANDLE */
/*
* IME Data
*/
UINT composition_len; /* length of composition, 0 == no composition */
int composition_start; /* the character position for the composition */
} EDITSTATE;
#define SWAP_UINT32(x,y) do { UINT temp = (UINT)(x); (x) = (UINT)(y); (y) = temp; } while(0)
#define ORDER_UINT(x,y) do { if ((UINT)(y) < (UINT)(x)) SWAP_UINT32((x),(y)); } while(0)
/* used for disabled or read-only edit control */
#define EDIT_NOTIFY_PARENT(es, wNotifyCode) \
do \
{ /* Notify parent which has created this edit control */ \
TRACE("notification " #wNotifyCode " sent to hwnd=%p\n", es->hwndParent); \
SendMessageW(es->hwndParent, WM_COMMAND, \
MAKEWPARAM(GetWindowLongPtrW((es->hwndSelf),GWLP_ID), wNotifyCode), \
(LPARAM)(es->hwndSelf)); \
} while(0)
static const WCHAR empty_stringW[] = {0};
/*********************************************************************
*
* EM_CANUNDO
*
*/
static inline BOOL EDIT_EM_CanUndo(const EDITSTATE *es)
{
return (es->undo_insert_count || strlenW(es->undo_text));
}
/*********************************************************************
*
* EM_EMPTYUNDOBUFFER
*
*/
static inline void EDIT_EM_EmptyUndoBuffer(EDITSTATE *es)
{
es->undo_insert_count = 0;
*es->undo_text = '\0';
}
/**********************************************************************
*
没有合适的资源?快使用搜索试试~ 我知道了~
修改WINDOW源码中的EDIT,实现透明EDIT
共13个文件
local:3个
dcu:2个
groupproj:1个
3星 · 超过75%的资源 需积分: 31 15 下载量 147 浏览量
2013-03-14
23:33:01
上传
评论
收藏 42KB RAR 举报
温馨提示
通过修改Window自带的EDIT源码,实现透明EDIT,并封装成DELPHI控件。 比起一起DIRECTUI,这种方法更直接、灵活,当然难度也大些。
资源推荐
资源详情
资源评论
收起资源包目录
HzgEdit.rar (13个子文件)
HzgEdit
ProjectGroup1.groupproj.local 406B
edit.c 140KB
EditDll.cbproj.local 271B
EditDll.cbproj 7KB
ProjectGroup1.groupproj 2KB
HzgEditPkg
PkgHzgEdit.dproj 6KB
PkgHzgEdit.dcu 3KB
__history
HzgEdit.dcu 5KB
PkgHzgEdit.identcache 55B
PkgHzgEdit.res 6KB
PkgHzgEdit.dproj.local 566B
PkgHzgEdit.dpk 543B
HzgEdit.pas 877B
共 13 条
- 1
资源评论
- 小默2013-04-11纯C写的,用的都是 api ,有一小部分功能不完整,但也很值得一看了
- djfol2023-04-11真心不知道怎么处理。
hzg134679hzg
- 粉丝: 33
- 资源: 9
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功