зеркало из https://github.com/mozilla/pjs.git
First Checked In.
This commit is contained in:
Родитель
0c1a0cba5e
Коммит
7f86a82fe3
|
@ -0,0 +1 @@
|
|||
Makefile
|
|
@ -0,0 +1,32 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src resources
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..
|
||||
|
||||
DIRS= public src resources
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
|
@ -0,0 +1 @@
|
|||
Makefile
|
|
@ -0,0 +1 @@
|
|||
nsIAutoCompleteSession.idl
|
|
@ -0,0 +1,38 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
XPIDL_MODULE = autocomplete
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIAutoCompleteListener.idl \
|
||||
nsIAutoCompleteResults.idl \
|
||||
nsIAutoCompleteSession.idl \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
|
||||
|
||||
MODULE=xpfe\components
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
XPIDL_MODULE=autocomplete
|
||||
|
||||
XPIDLSRCS=\
|
||||
.\nsIAutoCompleteListener.idl \
|
||||
.\nsIAutoCompleteResults.idl \
|
||||
.\nsIAutoCompleteSession.idl \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
|
@ -0,0 +1,47 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Jean-Francois Ducarroz (ducarroz@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAutoCompleteResults.idl"
|
||||
|
||||
|
||||
typedef long AutoCompleteStatus;
|
||||
|
||||
[scriptable, uuid(4BA0A180-097C-11d4-A449-CD1A8B47ED7C)]
|
||||
interface nsIAutoCompleteStatus {
|
||||
const long failed = -1;
|
||||
const long noMatch = 0;
|
||||
const long matchFound = 1;
|
||||
const long ignored = 2;
|
||||
};
|
||||
|
||||
[scriptable, uuid(4BA0A181-097C-11d4-A449-CD1A8B47ED7C)]
|
||||
interface nsIAutoCompleteListener : nsISupports {
|
||||
|
||||
/* onStatus is called by the autocomplete session during the seach */
|
||||
void onStatus(in wstring statusText);
|
||||
|
||||
/* onAutoComplete is called by the autocomplete session when the search is done or over */
|
||||
void onAutoComplete(in nsIAutoCompleteResults result, in AutoCompleteStatus status);
|
||||
};
|
|
@ -0,0 +1,61 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Jean-Francois Ducarroz (ducarroz@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsICollection.idl"
|
||||
|
||||
[scriptable, uuid(88DCFA80-062F-11d4-a449-B36A1A94C0FC)]
|
||||
interface nsIAutoCompleteItem : nsISupports {
|
||||
attribute wstring value; // the result value
|
||||
attribute wstring comment; // an extra comment that will be displayed next to the value but that
|
||||
// will not be part of the value itself
|
||||
attribute string className; // class name used to define some style through css like the colors, an
|
||||
// icon url, etc...
|
||||
attribute nsISupports param; // parameter use by the search engin
|
||||
};
|
||||
|
||||
|
||||
[scriptable, uuid(88DCFA81-062F-11d4-a449-B36A1A94C0FC)]
|
||||
interface nsIAutoCompleteResults : nsISupports {
|
||||
attribute wstring searchString; // the original search string
|
||||
attribute nsISupports param; // param use by the the search engine
|
||||
|
||||
attribute nsICollection items; // Array of result items (nsIAutoCompleteItem)
|
||||
attribute long defaultItemIndex; // Index (0 base) of the defaut item that will be preselected and displayed
|
||||
attribute wstring defaultComment; // will be displayed in the input element only if the selected item doesn't
|
||||
// have its own comment (blurr type only)
|
||||
};
|
||||
|
||||
%{ C++
|
||||
// {FE4FC780-063D-11d4-A449-D45A120774BC}
|
||||
#define NS_AUTOCOMPLETERESULTS_CID \
|
||||
{ 0xfe4fc780, 0x063d, 0x11d4, { 0xa4, 0x49, 0xd4, 0x5a, 0x12, 0x07, 0x74, 0xbc } }
|
||||
#define NS_AUTOCOMPLETERESULTS_PROGID "component://netscape/autocomplete/results"
|
||||
|
||||
// {FE4FC781-063D-11d4-A449-D45A120774BC}
|
||||
#define NS_AUTOCOMPLETEITEM_CID \
|
||||
{ 0xfe4fc781, 0x063d, 0x11d4, { 0xa4, 0x49, 0xd4, 0x5a, 0x12, 0x07, 0x74, 0xbc } }
|
||||
#define NS_AUTOCOMPLETEITEM_PROGID "component://netscape/autocomplete/item"
|
||||
%}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Jean-Francois Ducarroz (ducarroz@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIAutoCompleteResults.idl"
|
||||
#include "nsIAutoCompleteListener.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsIDOMEvent.h"
|
||||
%}
|
||||
|
||||
interface nsIDOMEvents;
|
||||
|
||||
[scriptable, uuid(E0140B60-0264-11d4-8378-000000000000)]
|
||||
interface nsIAutoCompleteSession : nsISupports {
|
||||
|
||||
/* onStartLookup is called when the user has stop typing for a predifined elapse time */
|
||||
void onStartLookup(in nsIDOMEvents event, in nsIAutoCompleteResults previousSearchResult,
|
||||
in nsIAutoCompleteListener listener);
|
||||
|
||||
/* onStopLookup is called each time the user press a key */
|
||||
void onStopLookup(in nsIDOMEvents event);
|
||||
|
||||
/* onAutoComplete is called either when the user press enter/return or when the input element loose focus */
|
||||
void onAutoComplete(in nsIDOMEvents event, in nsIAutoCompleteResults previousSearchResult,
|
||||
in nsIAutoCompleteListener listener);
|
||||
};
|
|
@ -0,0 +1,32 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = skin
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..
|
||||
|
||||
DIRS= skin
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
|
@ -0,0 +1,33 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
EXPORT_CHROME = $(srcdir)/autocomplete.xml \
|
||||
$(NULL)
|
||||
|
||||
install::
|
||||
$(INSTALL) $(EXPORT_CHROME) $(DIST)/bin/chrome
|
|
@ -0,0 +1,129 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<bindings id="autocompleteBindings"
|
||||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
|
||||
<binding name="autocomplete" extends="xul:box">
|
||||
<content>
|
||||
<xul:box
|
||||
onkeydown="me = this.parentNode;
|
||||
me.callListener('stopLookup', this);
|
||||
if (me.autoCompleteTimer) {
|
||||
clearTimeout(me.autoCompleteTimer);
|
||||
dump(' Clear timer id=' + me.autoCompleteTimer + '\n');
|
||||
me.autoCompleteTimer = 0;
|
||||
}"
|
||||
onkeyup="me = this.parentNode;
|
||||
if (me.autoCompleteTimer)
|
||||
clearTimeout(me.autoCompleteTimer);
|
||||
if (event.which != 13) {
|
||||
me.needToAutocomplete = true;
|
||||
me.autoCompleteTimer = setTimeout(me.callListener, me.timeout, 'startLookup', this);
|
||||
dump('timer id=' + me.autoCompleteTimer + ', timeout=' + me.timeout + '\n');
|
||||
}
|
||||
"
|
||||
>
|
||||
|
||||
<xul:textfield class="addressingWidget" inherits="value,timeout"/>
|
||||
<xul:menupopup/>
|
||||
</xul:box>
|
||||
</content>
|
||||
|
||||
<interface>
|
||||
|
||||
<property name="value" onset="dump('SET VALUE ATTRIBUTE\n');return this.anonymousContent[0].firstChild.value = val;"
|
||||
onget="return this.anonymousContent[0].firstChild.value;"/>
|
||||
|
||||
<property name="timeout" onset="return this.setAttribute('timeout', val);"
|
||||
onget="return this.getAttribute('timeout');"/>
|
||||
|
||||
<property name="autoCompleteSession">
|
||||
<![CDATA[
|
||||
searchSession = 'component://' + unescape(this.getAttribute('searchSessionClass'));
|
||||
try {
|
||||
Components.classes[searchSession].getService(Components.interfaces.nsIAbAutoCompleteSession);
|
||||
} catch (e) {}
|
||||
]]>
|
||||
</property>
|
||||
|
||||
<property name="autoCompleteTimer">
|
||||
<![CDATA[
|
||||
0;
|
||||
]]>
|
||||
</property>
|
||||
|
||||
<property name="autoCompleteListener">
|
||||
<![CDATA[
|
||||
({
|
||||
onAutoCompleteResult: function(aItem, aOriginalString, aMatch)
|
||||
{
|
||||
dump("onAutoCompleteResult, item=" + aItem + ", match=" + aMatch + "\n");
|
||||
dump("textfield= " + aItem.anonymousContent[0].firstChild + "\n");
|
||||
dump("input=" + aItem.anonymousContent[0].firstChild.anonymousContent[0].firstChild + "\n");
|
||||
if ( aItem )
|
||||
{
|
||||
aItem.value = aMatch;
|
||||
}
|
||||
}
|
||||
})
|
||||
]]>
|
||||
</property>
|
||||
|
||||
<method name="autoComplete">
|
||||
<argument name="aSearchString"/>
|
||||
<argument name="resultListener"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
return this.autoCompleteSession.autoComplete(null, this, aSearchString, this.autoCompleteListener);
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
|
||||
<method name="callListener">
|
||||
<argument name="action"/>
|
||||
<argument name="me"/>
|
||||
<body>
|
||||
<![CDATA[
|
||||
dump("callListener, action=" + action + ", me=" + me + "\n");
|
||||
switch (action) {
|
||||
case 'startLookup':
|
||||
dump('>>> startLookup...\n');
|
||||
break;
|
||||
case 'stopLookup':
|
||||
dump('>>> stopLookup...\n');
|
||||
break;
|
||||
case 'autoComplete':
|
||||
dump('>>> autoComplete...\n');
|
||||
if (this.autoCompleteTimer) {
|
||||
clearTimeout(this.autoCompleteTimer);
|
||||
this.autoCompleteTimer = 0;
|
||||
}
|
||||
autoComplete(me.value, me.autoCompleteListener);
|
||||
this.needToAutocomplete = false;
|
||||
break;
|
||||
}
|
||||
]]>
|
||||
</body>
|
||||
</method>
|
||||
</interface>
|
||||
|
||||
<handlers>
|
||||
<handler type="keypress" keycode="vk_return"
|
||||
value="dump('value=' + this.value + '\n'); this.callListener('autoComplete', me);"
|
||||
/>
|
||||
|
||||
<handler type="focus" value="this.needToAutocomplete = false;" />
|
||||
|
||||
<handler type="blur"
|
||||
value="if (this.needToAutocomplete)
|
||||
this.callListener('autoComplete', this);
|
||||
"
|
||||
/>
|
||||
</handlers>
|
||||
|
||||
</binding>
|
||||
|
||||
|
||||
</bindings>
|
|
@ -0,0 +1,34 @@
|
|||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
DEPTH=..\..\..\..
|
||||
|
||||
DIRS=win
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
DISTXUL=$(DIST)\bin\chrome
|
||||
|
||||
install::
|
||||
$(MAKE_INSTALL) autocomplete.xml $(DISTXUL)
|
||||
|
||||
clobber::
|
||||
rm -f $(DISTXUL)\autocomplete.xml
|
|
@ -0,0 +1 @@
|
|||
Makefile
|
|
@ -0,0 +1,44 @@
|
|||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
#
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = autocomplete
|
||||
LIBRARY_NAME = autocomplete
|
||||
IS_COMPONENT = 1
|
||||
|
||||
CPPSRCS = nsAutoComplete.cpp
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
-L$(DIST)/bin \
|
||||
-L$(DIST)/lib \
|
||||
$(XPCOM_LIBS) \
|
||||
-lmozjs \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
#!gmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
|
||||
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Specify the depth of the current directory relative to the
|
||||
#// root of NS
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
DEPTH = ..\..\..\..
|
||||
include <$(DEPTH)/config/config.mak>
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Make Variables here: (ie. PDFFILE, MAPFILE, ...)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
|
||||
DLLNAME = autocomplete
|
||||
DLL1NAME = autocomplete
|
||||
PDBFILE = $(DLLNAME).pdb
|
||||
MAPFILE = $(DLLNAME).map
|
||||
DLL =.\$(OBJDIR)\$(DLLNAME).dll
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
|
||||
LINCS = \
|
||||
-I$(PUBLIC)/xpcom \
|
||||
# -I$(PUBLIC)/txtsvc \
|
||||
# -I$(PUBLIC)/xpfe/components \
|
||||
# -I$(PUBLIC)/raptor \
|
||||
# -I$(PUBLIC)/rdf \
|
||||
# -I$(PUBLIC)/dom \
|
||||
$(NULL)
|
||||
|
||||
LLIBS = \
|
||||
$(LIBNSPR) \
|
||||
$(DIST)\lib\xpcom.lib \
|
||||
# $(DIST)\lib\js3250.lib \
|
||||
!ifndef NECKO
|
||||
# $(DIST)\lib\netlib.lib \
|
||||
!endif
|
||||
$(NULL)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define the files necessary to build the target (ie. OBJS)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\nsAutoComplete.obj \
|
||||
$(NULL)
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Define any Public Targets here (ie. PROGRAM, LIBRARY, DLL, ...)
|
||||
#// (these must be defined before the common makefiles are included)
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
LIBRARY=.\$(OBJDIR)\$(LIBNAME).lib
|
||||
|
||||
#//------------------------------------------------------------------------
|
||||
#//
|
||||
#// Include the common makefile rules
|
||||
#//
|
||||
#//------------------------------------------------------------------------
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin\components
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\components\$(DLLNAME).dll
|
|
@ -0,0 +1,214 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Jean-Francois Ducarroz (ducarroz@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "prtypes.h"
|
||||
#include "nsIModule.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "nsAutoComplete.h"
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteItem)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsAutoCompleteResults)
|
||||
|
||||
|
||||
static nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "AutoComplete Search Results", NS_AUTOCOMPLETERESULTS_CID, NS_AUTOCOMPLETERESULTS_PROGID,
|
||||
nsAutoCompleteResultsConstructor,
|
||||
nsnull,
|
||||
nsnull,
|
||||
},
|
||||
{ "AutoComplete Search Item", NS_AUTOCOMPLETEITEM_CID, NS_AUTOCOMPLETEITEM_PROGID,
|
||||
nsAutoCompleteItemConstructor,
|
||||
nsnull,
|
||||
nsnull,
|
||||
}
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// Implement the NSGetModule() exported function for your module
|
||||
// and the entire implementation of the module object.
|
||||
//
|
||||
// NOTE: If you want to use the module shutdown to release any
|
||||
// module specific resources, use the macro
|
||||
// NS_IMPL_NSGETMODULE_WITH_DTOR() instead of the vanilla
|
||||
// NS_IMPL_NSGETMODULE()
|
||||
//
|
||||
|
||||
// e.g. xpconnect uses this to release some singletons;
|
||||
// xdr search on ..._WITH_DTOR
|
||||
|
||||
NS_IMPL_NSGETMODULE("nsAutoCompleteModule", components)
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* nsAutoCompleteItem
|
||||
******************************************************************************/
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsAutoCompleteItem, nsIAutoCompleteItem)
|
||||
|
||||
nsAutoCompleteItem::nsAutoCompleteItem()
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsAutoCompleteItem::~nsAutoCompleteItem()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAutoCompleteItem::GetValue(PRUnichar * *aValue)
|
||||
{
|
||||
if (!aValue) return NS_ERROR_NULL_POINTER;
|
||||
*aValue = mValue.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAutoCompleteItem::SetValue(const PRUnichar * aValue)
|
||||
{
|
||||
mValue = aValue;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAutoCompleteItem::GetComment(PRUnichar * *aComment)
|
||||
{
|
||||
if (!aComment) return NS_ERROR_NULL_POINTER;
|
||||
*aComment = mComment.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsAutoCompleteItem::SetComment(const PRUnichar * aComment)
|
||||
{
|
||||
mComment = aComment;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute string className; */
|
||||
NS_IMETHODIMP nsAutoCompleteItem::GetClassName(char * *aClassName)
|
||||
{
|
||||
if (!aClassName) return NS_ERROR_NULL_POINTER;
|
||||
*aClassName = mClassName.ToNewCString();
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsAutoCompleteItem::SetClassName(const char * aClassName)
|
||||
{
|
||||
mClassName = aClassName;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* attribute nsISupports param; */
|
||||
NS_IMETHODIMP nsAutoCompleteItem::GetParam(nsISupports * *aParam)
|
||||
{
|
||||
if (!aParam) return NS_ERROR_NULL_POINTER;
|
||||
*aParam = mParam;
|
||||
NS_IF_ADDREF(*aParam);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_IMETHODIMP nsAutoCompleteItem::SetParam(nsISupports * aParam)
|
||||
{
|
||||
mParam = aParam;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* nsAutoCompleteResults
|
||||
******************************************************************************/
|
||||
NS_IMPL_ISUPPORTS1(nsAutoCompleteResults, nsIAutoCompleteResults)
|
||||
|
||||
nsAutoCompleteResults::nsAutoCompleteResults() :
|
||||
mDefaultItemIndex(0)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsAutoCompleteResults::~nsAutoCompleteResults()
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAutoCompleteResults::GetSearchString(PRUnichar * *aSearchString)
|
||||
{
|
||||
if (!aSearchString) return NS_ERROR_NULL_POINTER;
|
||||
*aSearchString = mSearchString.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAutoCompleteResults::SetSearchString(const PRUnichar * aSearchString)
|
||||
{
|
||||
mSearchString = aSearchString;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAutoCompleteResults::GetParam(nsISupports * *aParam)
|
||||
{
|
||||
if (!aParam) return NS_ERROR_NULL_POINTER;
|
||||
*aParam = mParam;
|
||||
NS_IF_ADDREF(*aParam);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAutoCompleteResults::SetParam(nsISupports * aParam)
|
||||
{
|
||||
mParam = aParam;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAutoCompleteResults::GetItems(nsICollection * *aItems)
|
||||
{
|
||||
if (!aItems) return NS_ERROR_NULL_POINTER;
|
||||
*aItems = mItems;
|
||||
NS_IF_ADDREF(*aItems);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAutoCompleteResults::SetItems(nsICollection * aItems)
|
||||
{
|
||||
mItems = aItems;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAutoCompleteResults::GetDefaultItemIndex(PRInt32 *aDefaultItemIndex)
|
||||
{
|
||||
if (!aDefaultItemIndex) return NS_ERROR_NULL_POINTER;
|
||||
*aDefaultItemIndex = mDefaultItemIndex;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAutoCompleteResults::SetDefaultItemIndex(PRInt32 aDefaultItemIndex)
|
||||
{
|
||||
mDefaultItemIndex = aDefaultItemIndex;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAutoCompleteResults::GetDefaultComment(PRUnichar * *aDefaultComment)
|
||||
{
|
||||
if (!aDefaultComment) return NS_ERROR_NULL_POINTER;
|
||||
*aDefaultComment = mDefaultComment.ToNewUnicode();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsAutoCompleteResults::SetDefaultComment(const PRUnichar * aDefaultComment)
|
||||
{
|
||||
mDefaultComment = aDefaultComment;
|
||||
return NS_OK;
|
||||
}
|
|
@ -0,0 +1,77 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public
|
||||
* License Version 1.1 (the "License"); you may not use this file
|
||||
* except in compliance with the License. You may obtain a copy of
|
||||
* the License at http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS
|
||||
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
* implied. See the License for the specific language governing
|
||||
* rights and limitations under the License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Original Author: Jean-Francois Ducarroz (ducarroz@netscape.com)
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsAutoComplete_h___
|
||||
#define nsAutoComplete_h___
|
||||
|
||||
#include "nslayout.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMHTMLInputElement.h"
|
||||
#include "nsIAutoCompleteListener.h"
|
||||
#include "nsIAutoCompleteResults.h"
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* nsAutoCompleteItem
|
||||
******************************************************************************/
|
||||
class nsAutoCompleteItem : public nsIAutoCompleteItem
|
||||
{
|
||||
public:
|
||||
nsAutoCompleteItem();
|
||||
virtual ~nsAutoCompleteItem();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIAUTOCOMPLETEITEM
|
||||
|
||||
private:
|
||||
nsString mValue;
|
||||
nsString mComment;
|
||||
nsString mClassName;
|
||||
|
||||
nsCOMPtr<nsISupports> mParam;
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* nsAutoCompleteResults
|
||||
******************************************************************************/
|
||||
class nsAutoCompleteResults : public nsIAutoCompleteResults
|
||||
{
|
||||
public:
|
||||
nsAutoCompleteResults();
|
||||
virtual ~nsAutoCompleteResults();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIAUTOCOMPLETERESULTS
|
||||
|
||||
private:
|
||||
nsString mSearchString;
|
||||
nsCOMPtr<nsISupports> mParam;
|
||||
nsCOMPtr<nsIDOMHTMLInputElement> mInputElement;
|
||||
|
||||
nsCOMPtr<nsICollection> mItems;
|
||||
PRInt32 mDefaultItemIndex;
|
||||
nsString mDefaultComment;
|
||||
};
|
||||
|
||||
#endif
|
Загрузка…
Ссылка в новой задаче