这个输入框的自动完成的功能,是比较智能化的。因为它会根据以往的输入自动完成,或者智能提示所需要的连接或者内容。
下面就来先看这个类的定义:
#001
// Provides the implementation of an edit control with a drop-down
#002
// autocomplete box. The box itself is implemented in autocomplete_popup.cc
#003
// This file implements the edit box and management for the popup.
#004
//
#005
// This implementation is currently appropriate for the URL bar, where the
#006
// autocomplete dropdown is always displayed because there is always a
#007
// default item. For web page autofill and other applications, this is
#008
// probably not appropriate. We may want to add a flag to determine which
#009
// of these modes we're in.
#010
class AutocompleteEdit
#011
: public CWindowImpl<AutocompleteEdit,
#012
CRichEditCtrl,
#013
CWinTraits<WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL |
#014
ES_NOHIDESEL> >,
#015
public CRichEditCommands<AutocompleteEdit>,
#016
public Menu::Delegate {
类
AutocompleteEdit
继承了类
CWindowImpl
、类
CRichEditCommands
、类
Menu::Delegate
。其中类
CWindowImpl
实现了
Windows
窗口,它是
WTL
里的窗口模板类,主要用来创建窗口界面类,并且使用类
CRichEditCtrl
作为基类,类
CRichEditCtrl
主要调用
Windows
里的编辑类。类
CRichEditCommands
实现
RichEdit
的命令功能。
Menu::Delegate
类是实现智能下拉式菜单的提示界面。因此,要学习开发
chrome
,需要先学习
WTL
的开发,它是一套基于模板的窗口框架。下一次再仔细地分析自动完成的实现过程。