nsIMsgCustomColumnHandler 编辑
The nsIMsgCustomColumnHandler
interface allows you to create custom handlers for columns. It can be used in the Thunderbird threadpane for extensions to overlay their own columns.
mailnews/base/public/nsIMsgCustomColumnHandler.idl
Scriptable Please add a summary to this article. Last changed in Gecko 1.9 (Firefox 3)Inherits from: nsITreeView
This interface is meant to be implemented by extensions, as shown in the tutorial. The interface inherits from nsITreeView
, however when you're implementing a custom handler in Javascript its not necessary to implement all of nsITreeView's methods. You must implement:
nsITreeView.isEditable()
nsITreeView.GetCellProperties()
nsITreeView.GetImageSrc()
nsITreeView.GetCellText()
nsITreeView.cycleCell()
nsIMsgCustomColumnHandler.getSortStringForRow()
nsIMsgCustomColumnHandler.getSortLongForRow()
nsIMsgCustomColumnHandler.isString()
and optionally: nsITreeView.GetRowProperties()
From C++ you must implement all of nsITreeView
and nsIMsgCustomColumnHandler
.
Example Implementation
An example Javascript implementation that does nothing:
var columnHandler = { isEditable: function(aRow, aCol) {return false;}, cycleCell: function(aRow, aCol) { }, getCellText: function(aRow, aCol) { }, getSortStringForRow: function(aHdr) { return ""; }, isString: function() {return true;}, getCellProperties: function(aRow, aCol, aProps) { }, getRowProperties: function(aRow, aProps) { }, getImageSrc: function(aRow, aCol) {return null;}, getSortLongForRow: function(aHdr) {return 0;} }
to attach it use the nsIMsgDBView.addColumnHandler()
method (recall gDBView
is the global nsIMsgDBView
in Thunderbird):
gDBView.addColumnHandler("newColumn", columnHandler);
after which it can be retrieved using the nsIMsgDBView.getColumnHandler()
method:
var handler = gDBView.getColumnHandler("newColumn");
and removed using the nsIMsgDBView.removeColumnHandler()
method:
gDBView.removeColumnHandler("newColumn");
Method overview
AString getSortStringForRow(in nsIMsgDBHdr aHdr); |
unsigned long getSortLongForRow(in nsIMsgDBHdr aHdr); |
boolean isString(); |
Methods
getSortStringForRow()
If the column displays a string, this will return the string that the column should be sorted by.
AString getSortStringForRow(in nsIMsgDBHdr aHdr);
Parameters
- aHdr
- The message's
nsIMsgDBHdr
.
Return value
The string value that sorting will be done with.
getSortLongForRow()
If the column displays a number, this will return the number that the column should be sorted by.
unsigned long getSortLongForRow(in nsIMsgDBHdr aHdr);
Parameters
- aHdr
- The message's
nsIMsgDBHdr
.
Return value
The long value that sorting will be done with.
isString()
boolean isString();
Parameters
None.
Return value
true
if the column displays a string value. false
otherwise.
This affects whether getSortStringForRow or getSortLongForRow is used to determine the sort key for the column. It does not affect whether getCellText vs. getImageSrc is used to determine what to display.
See Also
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论