您的位置:首页 > 其它

谷歌浏览器的源码分析(6)

2008-09-14 23:33 260 查看
前面已经介绍了这么引人的输入自动完成功能,并且可以在输入超级连接框里直接通过GOOGLE搜索所有的内容,这是比较大的创新,不但可以节省界面的占用面积,还很方便大家查询的需要,比如记不住的连接,根本不需要去记了,只要你记住需要的内容就行了。这样既不需要到什么门户网站去找连接,也不需要去记住众多的网站,这个功能是非常方便的。

这个输入框的自动完成的功能,是比较智能化的。因为它会根据以往的输入自动完成,或者智能提示所需要的连接或者内容。

下面就来先看这个类的定义:

#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的开发,它是一套基于模板的窗口框架。下一次再仔细地分析自动完成的实现过程。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: