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