diff --git a/xpfe/components/autocomplete/.cvsignore b/xpfe/components/autocomplete/.cvsignore new file mode 100644 index 00000000000..f3c7a7c5da6 --- /dev/null +++ b/xpfe/components/autocomplete/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/xpfe/components/autocomplete/Makefile.in b/xpfe/components/autocomplete/Makefile.in new file mode 100644 index 00000000000..136dc7a9926 --- /dev/null +++ b/xpfe/components/autocomplete/Makefile.in @@ -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 + diff --git a/xpfe/components/autocomplete/macbuild/AutoComplete.mcp b/xpfe/components/autocomplete/macbuild/AutoComplete.mcp new file mode 100644 index 00000000000..e69de29bb2d diff --git a/xpfe/components/autocomplete/macbuild/AutoCompleteIDL.mcp b/xpfe/components/autocomplete/macbuild/AutoCompleteIDL.mcp new file mode 100644 index 00000000000..e69de29bb2d diff --git a/xpfe/components/autocomplete/macbuild/AutoCompletePrefix.h b/xpfe/components/autocomplete/macbuild/AutoCompletePrefix.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/xpfe/components/autocomplete/macbuild/AutoCompletePrefix_debug.h b/xpfe/components/autocomplete/macbuild/AutoCompletePrefix_debug.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/xpfe/components/autocomplete/makefile.win b/xpfe/components/autocomplete/makefile.win new file mode 100644 index 00000000000..a0dcae2fa3b --- /dev/null +++ b/xpfe/components/autocomplete/makefile.win @@ -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> diff --git a/xpfe/components/autocomplete/public/.cvsignore b/xpfe/components/autocomplete/public/.cvsignore new file mode 100644 index 00000000000..f3c7a7c5da6 --- /dev/null +++ b/xpfe/components/autocomplete/public/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/xpfe/components/autocomplete/public/MANIFEST_IDL b/xpfe/components/autocomplete/public/MANIFEST_IDL new file mode 100644 index 00000000000..7f0c8cce122 --- /dev/null +++ b/xpfe/components/autocomplete/public/MANIFEST_IDL @@ -0,0 +1 @@ +nsIAutoCompleteSession.idl diff --git a/xpfe/components/autocomplete/public/Makefile.in b/xpfe/components/autocomplete/public/Makefile.in new file mode 100644 index 00000000000..600b8ba4ad0 --- /dev/null +++ b/xpfe/components/autocomplete/public/Makefile.in @@ -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 + diff --git a/xpfe/components/autocomplete/public/makefile.win b/xpfe/components/autocomplete/public/makefile.win new file mode 100644 index 00000000000..5d218d507d8 --- /dev/null +++ b/xpfe/components/autocomplete/public/makefile.win @@ -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> diff --git a/xpfe/components/autocomplete/public/nsIAutoCompleteListener.idl b/xpfe/components/autocomplete/public/nsIAutoCompleteListener.idl new file mode 100644 index 00000000000..bcc70e4ba12 --- /dev/null +++ b/xpfe/components/autocomplete/public/nsIAutoCompleteListener.idl @@ -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); +}; diff --git a/xpfe/components/autocomplete/public/nsIAutoCompleteResults.idl b/xpfe/components/autocomplete/public/nsIAutoCompleteResults.idl new file mode 100644 index 00000000000..833c1191767 --- /dev/null +++ b/xpfe/components/autocomplete/public/nsIAutoCompleteResults.idl @@ -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" +%} + diff --git a/xpfe/components/autocomplete/public/nsIAutoCompleteSession.idl b/xpfe/components/autocomplete/public/nsIAutoCompleteSession.idl new file mode 100644 index 00000000000..a920cd5203f --- /dev/null +++ b/xpfe/components/autocomplete/public/nsIAutoCompleteSession.idl @@ -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); +}; diff --git a/xpfe/components/autocomplete/resources/.cvsignore b/xpfe/components/autocomplete/resources/.cvsignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/xpfe/components/autocomplete/resources/Makefile.in b/xpfe/components/autocomplete/resources/Makefile.in new file mode 100644 index 00000000000..1faac270f53 --- /dev/null +++ b/xpfe/components/autocomplete/resources/Makefile.in @@ -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 + diff --git a/xpfe/components/autocomplete/resources/makefile.win b/xpfe/components/autocomplete/resources/makefile.win new file mode 100644 index 00000000000..ec874985099 --- /dev/null +++ b/xpfe/components/autocomplete/resources/makefile.win @@ -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> diff --git a/xpfe/components/autocomplete/resources/skin/.cvsignore b/xpfe/components/autocomplete/resources/skin/.cvsignore new file mode 100644 index 00000000000..e69de29bb2d diff --git a/xpfe/components/autocomplete/resources/skin/MANIFEST b/xpfe/components/autocomplete/resources/skin/MANIFEST new file mode 100644 index 00000000000..e69de29bb2d diff --git a/xpfe/components/autocomplete/resources/skin/Makefile.in b/xpfe/components/autocomplete/resources/skin/Makefile.in new file mode 100644 index 00000000000..b331aba77c4 --- /dev/null +++ b/xpfe/components/autocomplete/resources/skin/Makefile.in @@ -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 diff --git a/xpfe/components/autocomplete/resources/skin/autocomplete.xml b/xpfe/components/autocomplete/resources/skin/autocomplete.xml new file mode 100644 index 00000000000..4110b3dcf92 --- /dev/null +++ b/xpfe/components/autocomplete/resources/skin/autocomplete.xml @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + >> 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; + } + ]]> + + + + + + + + + + + + + + + + diff --git a/xpfe/components/autocomplete/resources/skin/makefile.win b/xpfe/components/autocomplete/resources/skin/makefile.win new file mode 100644 index 00000000000..2ab5b7e2a9c --- /dev/null +++ b/xpfe/components/autocomplete/resources/skin/makefile.win @@ -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 diff --git a/xpfe/components/autocomplete/src/.cvsignore b/xpfe/components/autocomplete/src/.cvsignore new file mode 100644 index 00000000000..f3c7a7c5da6 --- /dev/null +++ b/xpfe/components/autocomplete/src/.cvsignore @@ -0,0 +1 @@ +Makefile diff --git a/xpfe/components/autocomplete/src/Makefile.in b/xpfe/components/autocomplete/src/Makefile.in new file mode 100644 index 00000000000..e477f975961 --- /dev/null +++ b/xpfe/components/autocomplete/src/Makefile.in @@ -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 + diff --git a/xpfe/components/autocomplete/src/makefile.win b/xpfe/components/autocomplete/src/makefile.win new file mode 100644 index 00000000000..656ddf249a5 --- /dev/null +++ b/xpfe/components/autocomplete/src/makefile.win @@ -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 diff --git a/xpfe/components/autocomplete/src/nsAutoComplete.cpp b/xpfe/components/autocomplete/src/nsAutoComplete.cpp new file mode 100644 index 00000000000..c17603a41c0 --- /dev/null +++ b/xpfe/components/autocomplete/src/nsAutoComplete.cpp @@ -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; +} diff --git a/xpfe/components/autocomplete/src/nsAutoComplete.h b/xpfe/components/autocomplete/src/nsAutoComplete.h new file mode 100644 index 00000000000..6b8fbefa86e --- /dev/null +++ b/xpfe/components/autocomplete/src/nsAutoComplete.h @@ -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 mParam; +}; + +/****************************************************************************** + * nsAutoCompleteResults + ******************************************************************************/ +class nsAutoCompleteResults : public nsIAutoCompleteResults +{ +public: + nsAutoCompleteResults(); + virtual ~nsAutoCompleteResults(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIAUTOCOMPLETERESULTS + +private: + nsString mSearchString; + nsCOMPtr mParam; + nsCOMPtr mInputElement; + + nsCOMPtr mItems; + PRInt32 mDefaultItemIndex; + nsString mDefaultComment; +}; + +#endif