Cette traduction est incomplète. Aidez à traduire cet article depuis l'anglais.
Ce guide a pour but de vous initier à Gecko, et de vous permettre de créer des composants XPCOM pour les applications Gecko. Bien que le principal objectif soit de vous permettre d'inclure du code C++ dans des composants utilisables dans Gecko, nous espérons pouvoir vous présenter tous les outils, techniques, et technologies qui constituent XPCOM. En conséquence, ce livre est agencé de telle sorte que vous puissiez suivre et créer vos propres composants ou en apprendre davantage sur les différents sujets XPCOM individuellement, comme un ouvrage de référence. Par exemple, l'introduction inclue une analyse des composants, et le premier chapitre - dans lequel vous compilerez le code de base et vous l'enregistrerez avec Mozilla - explique la relation entre les composants et les modules, les interfaces XPCOM, et le processus d'enregistrement de manière générale.
Remarque: De manière générale, essayez d'éviter de créer des composants XPCOM. Les add-ons devraient utiliser le nouveau Add-on SDK autant que possible ; cependant, il est probable que dans certains cas cela soit inévitable.
Remarque : Cet article décrit une méthode qui utilise xpidl mais vous devriez plutôt utiliser webidl.
Preface
Un aperçu de XPCOM
Utilisation des composants XPCOM
Composants Internes
Creating the Component Code
- What We'll Be Working On
- Component Registration
- Overview of the WebLock Module Source
- Digging In: Required Includes and Constants
webLock1.cpp
Using XPCOM Utilities to Make Things Easier
Starting WebLock
- Getting Called at Startup
- Providing Access to WebLock
- Creating the WebLock Programming Interface
- Defining the WebLock Interface in XPIDL
- Implementing WebLock
- Declaration Macros
- Representing Return Values in XPCOM
- XPIDL Code Generation
- Getting the WebLock Service from a Client
- Implementing the
iWebLock
Interface - The Directory Service
- Modifying Paths with
nsIFile
- Manipulating Files with
nsIFile
- Using
nsILocalFile
for Reading Data - Processing the White List Data
iWebLock
Method By Method
Finishing the Component
Building the WebLock UI
- User Interface Package List
- Client Code Overview
- XUL
- Overlaying New User Interface Into Mozilla
- Other Resources
Packaging WebLock
- Component Installation Overview
- Archiving Resources
- The WebLock Installation Script
- The WebLock Trigger Script
- Distributing Your Component
Appendix A - Setting up the Gecko SDK
- Downloading and Setting the SDK
- Building a Microsoft Visual Cpp Project
- Building a Windows Project
- A Makefile for Unix
Appendix B - Resources
Copyright (c) 2003 by Doug Turner and Ian Oeschger. This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.02 or later. Distribution of substantively modified versions of this document is prohibited without the explicit permission of the copyright holder. Distribution of the work or derivative of the work in any standard (paper) book form is prohibited unless prior permission is obtained from the copyright holder.