Compare commits
9 Commits
tags/arele
...
WIDGET_IDL
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bacf018470 | ||
|
|
661845527f | ||
|
|
2695f743d2 | ||
|
|
383ba86d8b | ||
|
|
8c455b008e | ||
|
|
e09c15621a | ||
|
|
6b3eface10 | ||
|
|
e815a771b0 | ||
|
|
0605f9fbfb |
@@ -1,12 +0,0 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// stdafx.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
|
||||
#ifdef _ATL_STATIC_REGISTRY
|
||||
#include <statreg.h>
|
||||
#include <statreg.cpp>
|
||||
#endif
|
||||
|
||||
#include <atlimpl.cpp>
|
||||
@@ -1,28 +0,0 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently,
|
||||
// but are changed infrequently
|
||||
|
||||
#if !defined(AFX_STDAFX_H__3B3A8A37_A147_4D96_BFA3_51B0F69B5D8D__INCLUDED_)
|
||||
#define AFX_STDAFX_H__3B3A8A37_A147_4D96_BFA3_51B0F69B5D8D__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define STRICT
|
||||
#ifndef _WIN32_WINNT
|
||||
#define _WIN32_WINNT 0x0400
|
||||
#endif
|
||||
#define _ATL_APARTMENT_THREADED
|
||||
|
||||
#include <atlbase.h>
|
||||
//You may derive a class from CComModule and use it if you want to override
|
||||
//something, but do not change the name of _Module
|
||||
extern CComModule _Module;
|
||||
#include <atlcom.h>
|
||||
#include <comdef.h>
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__3B3A8A37_A147_4D96_BFA3_51B0F69B5D8D__INCLUDED)
|
||||
@@ -1,28 +0,0 @@
|
||||
#ifndef XPCDispUtilities_h
|
||||
#define XPCDispUtilities_h
|
||||
|
||||
template <class T>
|
||||
inline
|
||||
HRESULT XPCCreateInstance(const CLSID & clsid, const IID & iid, T ** result)
|
||||
{
|
||||
return CoCreateInstance(clsid, 0, CLSCTX_ALL, iid, reinterpret_cast<void**>(result));
|
||||
}
|
||||
|
||||
DISPID GetIDsOfNames(IDispatch * pIDispatch , CComBSTR const & name)
|
||||
{
|
||||
DISPID dispid;
|
||||
OLECHAR * pName = name;
|
||||
HRESULT hresult = pIDispatch->GetIDsOfNames(
|
||||
IID_NULL,
|
||||
&pName,
|
||||
1,
|
||||
LOCALE_SYSTEM_DEFAULT,
|
||||
&dispid);
|
||||
if (!SUCCEEDED(hresult))
|
||||
{
|
||||
dispid = 0;
|
||||
}
|
||||
return dispid;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,86 +0,0 @@
|
||||
// XPCIDispatchTest.cpp : Implementation of DLL Exports.
|
||||
|
||||
|
||||
// Note: Proxy/Stub Information
|
||||
// To build a separate proxy/stub DLL,
|
||||
// run nmake -f IDispatchTestps.mk in the project directory.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "resource.h"
|
||||
#include <initguid.h>
|
||||
#include "XPCIDispatchTest.h"
|
||||
|
||||
#include "XPCIDispatchTest_i.c"
|
||||
#include "nsXPCDispTestMethods.h"
|
||||
#include "nsXPCDispSimple.h"
|
||||
#include "nsXPCDispTestNoIDispatch.h"
|
||||
#include "nsXPCDispTestProperties.h"
|
||||
#include "nsXPCDispTestArrays.h"
|
||||
#include "nsXPCDispTestScriptOn.h"
|
||||
#include "nsXPCDispTestScriptOff.h"
|
||||
#include "nsXPCDispTestWrappedJS.h"
|
||||
|
||||
CComModule _Module;
|
||||
|
||||
BEGIN_OBJECT_MAP(ObjectMap)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestMethods, nsXPCDispTestMethods)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispSimple, nsXPCDispSimple)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestNoIDispatch, nsXPCDispTestNoIDispatch)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestProperties, nsXPCDispTestProperties)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestArrays, nsXPCDispTestArrays)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestScriptOn, nsXPCDispTestScriptOn)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestScriptOff, nsXPCDispTestScriptOff)
|
||||
OBJECT_ENTRY(CLSID_nsXPCDispTestWrappedJS, nsXPCDispTestWrappedJS)
|
||||
END_OBJECT_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DLL Entry Point
|
||||
|
||||
extern "C"
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
|
||||
{
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
_Module.Init(ObjectMap, hInstance, &LIBID_IDispatchTestLib);
|
||||
DisableThreadLibraryCalls(hInstance);
|
||||
}
|
||||
else if (dwReason == DLL_PROCESS_DETACH)
|
||||
_Module.Term();
|
||||
return TRUE; // ok
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Used to determine whether the DLL can be unloaded by OLE
|
||||
|
||||
STDAPI DllCanUnloadNow(void)
|
||||
{
|
||||
return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Returns a class factory to create an object of the requested type
|
||||
|
||||
STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
|
||||
{
|
||||
return _Module.GetClassObject(rclsid, riid, ppv);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DllRegisterServer - Adds entries to the system registry
|
||||
|
||||
STDAPI DllRegisterServer(void)
|
||||
{
|
||||
// registers object, typelib and all interfaces in typelib
|
||||
return _Module.RegisterServer(TRUE);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DllUnregisterServer - Removes entries from the system registry
|
||||
|
||||
STDAPI DllUnregisterServer(void)
|
||||
{
|
||||
return _Module.UnregisterServer(TRUE);
|
||||
}
|
||||
|
||||
|
||||
#include "nsXPCDispTestWrappedJS.h"
|
||||
@@ -1,9 +0,0 @@
|
||||
; XPCIDispatchTest.def : Declares the module parameters.
|
||||
|
||||
LIBRARY "XPCIDispatchTest.DLL"
|
||||
|
||||
EXPORTS
|
||||
DllCanUnloadNow @1 PRIVATE
|
||||
DllGetClassObject @2 PRIVATE
|
||||
DllRegisterServer @3 PRIVATE
|
||||
DllUnregisterServer @4 PRIVATE
|
||||
@@ -1,318 +0,0 @@
|
||||
# Microsoft Developer Studio Project File - Name="XPCIDispatchTest" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=XPCIDispatchTest - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "XPCIDispatchTest.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "XPCIDispatchTest.mak" CFG="XPCIDispatchTest - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "XPCIDispatchTest - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "XPCIDispatchTest - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "XPCIDispatchTest - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W4 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386 /pdbtype:sept
|
||||
# Begin Custom Build - Performing registration
|
||||
OutDir=.\Debug
|
||||
TargetPath=.\Debug\XPCIDispatchTest.dll
|
||||
InputPath=.\Debug\XPCIDispatchTest.dll
|
||||
SOURCE="$(InputPath)"
|
||||
|
||||
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
regsvr32 /s /c "$(TargetPath)"
|
||||
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "XPCIDispatchTest - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "XPCIDispatchTest___Win32_Release"
|
||||
# PROP BASE Intermediate_Dir "XPCIDispatchTest___Win32_Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "_ATL_DLL" /D "_ATL_MIN_CRT" /Yu"stdafx.h" /FD /c
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
|
||||
# Begin Custom Build - Performing registration
|
||||
OutDir=.\Release
|
||||
TargetPath=.\Release\XPCIDispatchTest.dll
|
||||
InputPath=.\Release\XPCIDispatchTest.dll
|
||||
SOURCE="$(InputPath)"
|
||||
|
||||
"$(OutDir)\regsvr32.trg" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
regsvr32 /s /c "$(TargetPath)"
|
||||
echo regsvr32 exec. time > "$(OutDir)\regsvr32.trg"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "XPCIDispatchTest - Win32 Debug"
|
||||
# Name "XPCIDispatchTest - Win32 Release"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispSimple.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestArrays.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestMethods.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestNoIDispatch.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestProperties.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestScriptOff.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestScriptOn.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestWrappedJS.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
# ADD CPP /Yc"stdafx.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\XPCIDispatchTest.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\XPCIDispatchTest.def
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\XPCIDispatchTest.idl
|
||||
# ADD MTL /tlb ".\XPCIDispatchTest.tlb" /h "XPCIDispatchTest.h" /iid "XPCIDispatchTest_i.c" /Oicf
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\XPCIDispatchTest.rc
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispSimple.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestArrays.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestMethods.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestNoIDispatch.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestProperties.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestScriptOff.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestScriptOn.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestWrappedJS.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\XPCDispUtilities.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispSimple.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestArrays.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestMethods.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestNoIDispatch.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestNoScript.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestProperties.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestScriptOff.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestScriptOn.rgs
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\nsXPCDispTestWrappedJS.rgs
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "JS Files"
|
||||
|
||||
# PROP Default_Filter "js"
|
||||
# Begin Group "WrappedCOM"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "Arrays"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedCOM\Arrays\XPCIDispatchArrayTests.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Attributes"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedCOM\Attributes\XPCIDispatchAttributeTests.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "General"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedCOM\General\XPCIDispatchInstantiations.js
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedCOM\General\XPCStress.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Methods"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedCOM\Methods\XPCIDispatchMethodTests.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedCOM\shell.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "WrappedJS"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Group "General (WJS)"
|
||||
|
||||
# PROP Default_Filter ""
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedJS\General\XPCIDispatchTestWrappedJS.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\Tests\WrappedJS\shell.js
|
||||
# End Source File
|
||||
# End Group
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -1,29 +0,0 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "XPCIDispatchTest"=.\XPCIDispatchTest.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -1,454 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// XPCIDispatchTest.idl : IDL source for XPCIDispatchTest.dll
|
||||
//
|
||||
|
||||
// This file will be processed by the MIDL tool to
|
||||
// produce the type library (XPCIDispatchTest.tlb) and marshalling code.
|
||||
|
||||
import "oaidl.idl";
|
||||
import "ocidl.idl";
|
||||
import "objsafe.idl";
|
||||
|
||||
[
|
||||
uuid(83A51226-F49D-488A-8F78-75BB2F927F4C),
|
||||
version(1.0),
|
||||
helpstring("XPCIDispatchTest 1.0 Type Library")
|
||||
]
|
||||
library IDispatchTestLib
|
||||
{
|
||||
importlib("stdole32.tlb");
|
||||
importlib("stdole2.tlb");
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(0de5dbae-1d78-45cb-91a2-24516fef2837),
|
||||
dual,
|
||||
helpstring("nsIXPCDispSimple interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispSimple : IDispatch
|
||||
{
|
||||
[id(1), helpstring("Simple method returning the name of the class")]
|
||||
HRESULT ClassName([out]BSTR * name);
|
||||
[propget, id(2), helpstring("Simple number property")]
|
||||
HRESULT Number([out, retval]long * result);
|
||||
[propput, id(2), helpstring("Simple number property")]
|
||||
HRESULT Number([in]long result);
|
||||
}
|
||||
[
|
||||
uuid(9F39237C-D179-4260-8EF3-4B6D4D7D5570),
|
||||
helpstring("nsXPCDispSimple Class")
|
||||
]
|
||||
coclass nsXPCDispSimple
|
||||
{
|
||||
[default] interface nsIXPCDispSimple;
|
||||
};
|
||||
[
|
||||
object,
|
||||
uuid(47bf6c99-a30c-4105-8af6-de76dcfdd6dd),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestMethods interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestMethods : IDispatch
|
||||
{
|
||||
/* Return values test */
|
||||
[id(1), helpstring("method with no parameters")]
|
||||
HRESULT NoParameters();
|
||||
[id(2), helpstring("method that returns a string")]
|
||||
HRESULT ReturnBSTR([out, retval]BSTR * result);
|
||||
[id(3), helpstring("method that returns a 32 bit signed integer")]
|
||||
HRESULT ReturnI4([out, retval]int * result);
|
||||
[id(4), helpstring("method that returns an 8 bit unsigned integer")]
|
||||
HRESULT ReturnUI1([out, retval]unsigned char * result);
|
||||
[id(5), helpstring("method that returns a 16 bit signed integer")]
|
||||
HRESULT ReturnI2([out, retval]short * result);
|
||||
[id(6), helpstring("method that returns a 32 bit floating point number")]
|
||||
HRESULT ReturnR4([out, retval]float * result);
|
||||
[id(7), helpstring("method that returns a 64 bit floating point number")]
|
||||
HRESULT ReturnR8([out, retval]double * result);
|
||||
[id(8), helpstring("method that returns a boolean")]
|
||||
HRESULT ReturnBool([out, retval]VARIANT_BOOL * result);
|
||||
[id(9), helpstring("method that returns an IDispatch pointer")]
|
||||
HRESULT ReturnIDispatch([out, retval]IDispatch ** result);
|
||||
[id(10), helpstring("method that returns an error")]
|
||||
HRESULT ReturnError([out, retval]SCODE * result);
|
||||
[id(12), helpstring("method that returns a date")]
|
||||
HRESULT ReturnDate([out, retval]DATE * result);
|
||||
[id(13), helpstring("method that returns an IUnknown")]
|
||||
HRESULT ReturnIUnknown([out, retval]IUnknown ** result);
|
||||
[id(14), helpstring("method that returns a signed 8 bit integer")]
|
||||
HRESULT ReturnI1([out, retval]char * result);
|
||||
[id(15), helpstring("method that returns an unsigned 16 bit integer")]
|
||||
HRESULT ReturnUI2([out, retval]unsigned short * result);
|
||||
[id(16), helpstring("method that returns an unsigned 32 bit integer")]
|
||||
HRESULT ReturnUI4([out, retval]unsigned long * result);
|
||||
[id(17), helpstring("method that returns an integer")]
|
||||
HRESULT ReturnInt([out, retval]int * result);
|
||||
[id(18), helpstring("method that returns an unsigned integer")]
|
||||
HRESULT ReturnUInt([out, retval]unsigned int * result);
|
||||
|
||||
/* Single input parameter tests */
|
||||
[id(19), helpstring("method that takes a string")]
|
||||
HRESULT TakesBSTR([in]BSTR result);
|
||||
[id(20), helpstring("method that takes a 32 bit signed integer")]
|
||||
HRESULT TakesI4([in]int result);
|
||||
[id(21), helpstring("method that takes an 8 bit unsigned integer")]
|
||||
HRESULT TakesUI1([in]unsigned char result);
|
||||
[id(22), helpstring("method that takes a 16 bit signed integer")]
|
||||
HRESULT TakesI2([in]short result);
|
||||
[id(23), helpstring("method that takes a 32 bit floating point number")]
|
||||
HRESULT TakesR4([in]float result);
|
||||
[id(24), helpstring("method that takes a 64 bit floating point number")]
|
||||
HRESULT TakesR8([in]double result);
|
||||
[id(25), helpstring("method that takes a boolean")]
|
||||
HRESULT TakesBool([in]VARIANT_BOOL result);
|
||||
[id(26), helpstring("method that takes an IDispatch pointer")]
|
||||
HRESULT TakesIDispatch([in]IDispatch * result);
|
||||
[id(27), helpstring("method that takes an error")]
|
||||
HRESULT TakesError([in]SCODE result);
|
||||
[id(29), helpstring("method that takes a date")]
|
||||
HRESULT TakesDate([in]DATE result);
|
||||
[id(30), helpstring("method that takes an IUnknown")]
|
||||
HRESULT TakesIUnknown([in]IUnknown * result);
|
||||
[id(31), helpstring("method that takes a signed 8 bit integer")]
|
||||
HRESULT TakesI1([in]char result);
|
||||
[id(32), helpstring("method that takes an unsigned 16 bit integer")]
|
||||
HRESULT TakesUI2([in]unsigned short result);
|
||||
[id(33), helpstring("method that takes an unsigned 32 bit integer")]
|
||||
HRESULT TakesUI4([in]unsigned long result);
|
||||
[id(34), helpstring("method that takes an integer")]
|
||||
HRESULT TakesInt([in]int result);
|
||||
[id(35), helpstring("method that takes an unsigned integer")]
|
||||
HRESULT TakesUInt([in]unsigned int result);
|
||||
|
||||
/* output parameter tests */
|
||||
[id(36), helpstring("method that outputs a string")]
|
||||
HRESULT OutputsBSTR([out]BSTR * result);
|
||||
[id(37), helpstring("method that outputs a 32 bit signed integer")]
|
||||
HRESULT OutputsI4([out]long * result);
|
||||
[id(38), helpstring("method that outputs an 8 bit unsigned integer")]
|
||||
HRESULT OutputsUI1([out]unsigned char * result);
|
||||
[id(39), helpstring("method that outputs a 16 bit signed integer")]
|
||||
HRESULT OutputsI2([out]short * result);
|
||||
[id(40), helpstring("method that outputs a 32 bit floating point number")]
|
||||
HRESULT OutputsR4([out]float * result);
|
||||
[id(41), helpstring("method that outputs a 64 bit floating point number")]
|
||||
HRESULT OutputsR8([out]double * result);
|
||||
[id(42), helpstring("method that outputs a boolean")]
|
||||
HRESULT OutputsBool([out]VARIANT_BOOL * result);
|
||||
[id(43), helpstring("method that outputs an IDispatch pointer")]
|
||||
HRESULT OutputsIDispatch([out]IDispatch ** result);
|
||||
[id(44), helpstring("method that outputs an error")]
|
||||
HRESULT OutputsError([out]SCODE * result);
|
||||
[id(46), helpstring("method that outputs a date")]
|
||||
HRESULT OutputsDate([out]DATE * result);
|
||||
[id(47), helpstring("method that outputs an IUnknown")]
|
||||
HRESULT OutputsIUnknown([out]IUnknown ** result);
|
||||
[id(48), helpstring("method that outputs a signed 8 bit integer")]
|
||||
HRESULT OutputsI1([out]char * result);
|
||||
[id(49), helpstring("method that outputs an unsigned 16 bit integer")]
|
||||
HRESULT OutputsUI2([out]unsigned short * result);
|
||||
[id(50), helpstring("method that outputs an unsigned 32 bit integer")]
|
||||
HRESULT OutputsUI4([out]unsigned long * result);
|
||||
|
||||
/* in/outparameter tests */
|
||||
[id(53), helpstring("method that in/outs a string")]
|
||||
HRESULT InOutsBSTR([in, out]BSTR * result);
|
||||
[id(54), helpstring("method that in/outs a 32 bit signed integer")]
|
||||
HRESULT InOutsI4([in, out]long * result);
|
||||
[id(55), helpstring("method that in/outs an 8 bit unsigned integer")]
|
||||
HRESULT InOutsUI1([in, out]unsigned char * result);
|
||||
[id(56), helpstring("method that in/outs a 16 bit signed integer")]
|
||||
HRESULT InOutsI2([in, out]short * result);
|
||||
[id(57), helpstring("method that in/outs a 32 bit floating point number")]
|
||||
HRESULT InOutsR4([in, out]float * result);
|
||||
[id(58), helpstring("method that in/outs a 64 bit floating point number")]
|
||||
HRESULT InOutsR8([in, out]double * result);
|
||||
[id(59), helpstring("method that in/outs a boolean")]
|
||||
HRESULT InOutsBool([in, out]VARIANT_BOOL * result);
|
||||
[id(60), helpstring("method that in/outs an IDispatch pointer")]
|
||||
HRESULT InOutsIDispatch([in, out]IDispatch ** result);
|
||||
[id(61), helpstring("method that in/outs an error")]
|
||||
HRESULT InOutsError([in, out]SCODE * result);
|
||||
[id(63), helpstring("method that in/outs a date")]
|
||||
HRESULT InOutsDate([in, out]DATE * result);
|
||||
[id(64), helpstring("method that in/outs an IUnknown")]
|
||||
HRESULT InOutsIUnknown([in, out]IUnknown ** result);
|
||||
[id(65), helpstring("method that in/outs a signed 8 bit integer")]
|
||||
HRESULT InOutsI1([in, out]char * result);
|
||||
[id(66), helpstring("method that in/outs an unsigned 16 bit integer")]
|
||||
HRESULT InOutsUI2([in, out]unsigned short * result);
|
||||
[id(67), helpstring("method that in/outs an unsigned 32 bit integer")]
|
||||
HRESULT InOutsUI4([in, out]unsigned long * result);
|
||||
|
||||
/* input and return tests*/
|
||||
[id(70), helpstring("method that takes an long and returns it")]
|
||||
HRESULT OneParameterWithReturn([in]long input, [out,retval]long* result);
|
||||
[id(71), helpstring("method that takes a string and returns it")]
|
||||
HRESULT StringInputAndReturn([in]BSTR str, [out, retval]BSTR* result);
|
||||
[id(72), helpstring("method that takes an IDispatch and returns it")]
|
||||
HRESULT IDispatchInputAndReturn([in]IDispatch* input, [out,retval]IDispatch** result);
|
||||
|
||||
/* Multiple parameters */
|
||||
[id(73), helpstring("method that takes two parameters")]
|
||||
HRESULT TwoParameters([in]long one, [in]long two);
|
||||
[id(74), helpstring("method that takes 12 input parameters")]
|
||||
HRESULT TwelveInParameters([in]long one, [in]long two, [in]long three,
|
||||
[in]long four, [in]long five, [in]long six,
|
||||
[in]long seven, [in]long eight,
|
||||
[in]long nine, [in]long ten,
|
||||
[in]long eleven, [in]long twelve);
|
||||
[id(75), helpstring("method that takes 12 out parameters")]
|
||||
HRESULT TwelveOutParameters([out]long *one, [out]long *two,
|
||||
[out]long *three, [out]long *four,
|
||||
[out]long *five, [out]long *six,
|
||||
[out]long *seven, [out]long *eight,
|
||||
[out]long *nine, [out]long *ten,
|
||||
[out]long *eleven, [out]long *twelve);
|
||||
[id(76), helpstring("method that takes 12 input string parameters")]
|
||||
HRESULT TwelveStrings([in]BSTR one, [in]BSTR two, [in]BSTR three,
|
||||
[in]BSTR four, [in]BSTR five, [in]BSTR six,
|
||||
[in]BSTR seven, [in]BSTR eight, [in]BSTR nine,
|
||||
[in]BSTR ten, [in]BSTR eleven, [in]BSTR twelve);
|
||||
[id(77), helpstring("method that takes 12 input string parameters")]
|
||||
HRESULT TwelveOutStrings([out]BSTR* one, [out]BSTR* two,
|
||||
[out]BSTR* three, [out]BSTR* four,
|
||||
[out]BSTR* five, [out]BSTR* six,
|
||||
[out]BSTR* seven, [out]BSTR* eight,
|
||||
[out]BSTR* nine, [out]BSTR* ten,
|
||||
[out]BSTR* eleven, [out]BSTR* twelve);
|
||||
[id(78), helpstring("method that takes 12 input string parameters")]
|
||||
HRESULT TwelveIDispatch([in]IDispatch* one, [in]IDispatch* two,
|
||||
[in]IDispatch* three, [in]IDispatch* four,
|
||||
[in]IDispatch* five, [in]IDispatch* six,
|
||||
[in]IDispatch* seven, [in]IDispatch* eight,
|
||||
[in]IDispatch* nine, [in]IDispatch* ten,
|
||||
[in]IDispatch* eleven,
|
||||
[in]IDispatch* twelve);
|
||||
[id(79), helpstring("method that takes 12 input string parameters")]
|
||||
HRESULT TwelveOutIDispatch([out]IDispatch** one,
|
||||
[out]IDispatch** two,
|
||||
[out]IDispatch** three,
|
||||
[out]IDispatch** four,
|
||||
[out]IDispatch** five,
|
||||
[out]IDispatch** six,
|
||||
[out]IDispatch** seven,
|
||||
[out]IDispatch** eight,
|
||||
[out]IDispatch** nine,
|
||||
[out]IDispatch** ten,
|
||||
[out]IDispatch** eleven,
|
||||
[out]IDispatch** twelve);
|
||||
[id(80), helpstring("method that generates an error")]
|
||||
HRESULT CreateError();
|
||||
}
|
||||
[
|
||||
uuid(745D1149-9F46-418C-B176-71EAA98974BA),
|
||||
helpstring("nsXPCDispTestMethods Class")
|
||||
]
|
||||
coclass nsXPCDispTestMethods
|
||||
{
|
||||
[default] interface nsIXPCDispTestMethods;
|
||||
};
|
||||
[
|
||||
object,
|
||||
uuid(f876c083-ae00-4b78-93b8-8305980f0864),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestArrays interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestArrays : IDispatch
|
||||
{
|
||||
[id(1), helpstring("returns a SAFEARRAY")]
|
||||
HRESULT ReturnSafeArray([out, retval]SAFEARRAY(VARIANT)* result);
|
||||
[id(2), helpstring("returns a SAFEARRAY")]
|
||||
HRESULT ReturnSafeArrayBSTR([out, retval]SAFEARRAY(VARIANT)* result);
|
||||
[id(3), helpstring("returns a SAFEARRAY")]
|
||||
HRESULT ReturnSafeArrayIDispatch([out, retval]SAFEARRAY(VARIANT)* result);
|
||||
[id(4), helpstring("method that takes a SAFEARRAY")]
|
||||
HRESULT TakesSafeArray([in]SAFEARRAY(VARIANT) array);
|
||||
[id(5), helpstring("method that takes a SAFEARRAY")]
|
||||
HRESULT TakesSafeArrayBSTR([in]SAFEARRAY(VARIANT) array);
|
||||
[id(6), helpstring("method that takes a SAFEARRAY")]
|
||||
HRESULT TakesSafeArrayIDispatch([in]SAFEARRAY(VARIANT) array);
|
||||
[id(7), helpstring("method that takes a SAFEARRAY")]
|
||||
HRESULT InOutSafeArray([in, out]SAFEARRAY(VARIANT) * array);
|
||||
[id(8), helpstring("method that takes a SAFEARRAY")]
|
||||
HRESULT InOutSafeArrayBSTR([in, out]SAFEARRAY(VARIANT) * array);
|
||||
[id(9), helpstring("method that takes a SAFEARRAY")]
|
||||
HRESULT InOutSafeArrayIDispatch([in, out]SAFEARRAY(VARIANT) * array);
|
||||
}
|
||||
[
|
||||
uuid(AB085C43-C619-48C8-B68C-C495BDE12DFB),
|
||||
helpstring("nsXPCDispTestArrays Class")
|
||||
]
|
||||
coclass nsXPCDispTestArrays
|
||||
{
|
||||
[default] interface nsIXPCDispTestArrays;
|
||||
};
|
||||
[
|
||||
object,
|
||||
uuid(9782107f-14cc-40b2-b0cd-988d81a46e9e),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestNoIDispatch interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestNoIDispatch : IUnknown
|
||||
{
|
||||
}
|
||||
[
|
||||
uuid(7414404F-A4CC-4E3C-9B32-BB20CB22F541),
|
||||
helpstring("nsXPCDispTestNoIDispatch Class")
|
||||
]
|
||||
coclass nsXPCDispTestNoIDispatch
|
||||
{
|
||||
[default] interface nsIXPCDispTestNoIDispatch;
|
||||
};
|
||||
[
|
||||
object,
|
||||
uuid(7830CACE-5019-489D-8B69-029E70CF39B7),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestProperties Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestProperties : IDispatch
|
||||
{
|
||||
[propget, id(1), helpstring("property Short")] HRESULT Short([out, retval] short *pVal);
|
||||
[propput, id(1), helpstring("property Short")] HRESULT Short([in] short newVal);
|
||||
[propget, id(2), helpstring("property Long")] HRESULT Long([out, retval] long *pVal);
|
||||
[propput, id(2), helpstring("property Long")] HRESULT Long([in] long newVal);
|
||||
[propget, id(3), helpstring("property Float")] HRESULT Float([out, retval] float *pVal);
|
||||
[propput, id(3), helpstring("property Float")] HRESULT Float([in] float newVal);
|
||||
[propget, id(4), helpstring("property Double")] HRESULT Double([out, retval] double *pVal);
|
||||
[propput, id(4), helpstring("property Double")] HRESULT Double([in] double newVal);
|
||||
[propget, id(5), helpstring("property Currency")] HRESULT Currency([out, retval] CURRENCY *pVal);
|
||||
[propput, id(5), helpstring("property Currency")] HRESULT Currency([in] CURRENCY newVal);
|
||||
[propget, id(6), helpstring("property Date")] HRESULT Date([out, retval] DATE *pVal);
|
||||
[propput, id(6), helpstring("property Date")] HRESULT Date([in] DATE newVal);
|
||||
[propget, id(7), helpstring("property String")] HRESULT String([out, retval] BSTR *pVal);
|
||||
[propput, id(7), helpstring("property String")] HRESULT String([in] BSTR newVal);
|
||||
[propget, id(8), helpstring("property DispatchPtr")] HRESULT DispatchPtr([out, retval] IDispatch* *pVal);
|
||||
[propput, id(8), helpstring("property DispatchPtr")] HRESULT DispatchPtr([in] IDispatch* newVal);
|
||||
[propget, id(9), helpstring("property SCode")] HRESULT SCode([out, retval] SCODE *pVal);
|
||||
[propput, id(9), helpstring("property SCode")] HRESULT SCode([in] SCODE newVal);
|
||||
[propget, id(10), helpstring("property Boolean")] HRESULT Boolean([out, retval] BOOL *pVal);
|
||||
[propput, id(10), helpstring("property Boolean")] HRESULT Boolean([in] BOOL newVal);
|
||||
[propget, id(11), helpstring("property Variant")] HRESULT Variant([out, retval] VARIANT *pVal);
|
||||
[propput, id(11), helpstring("property Variant")] HRESULT Variant([in] VARIANT newVal);
|
||||
[propget, id(12), helpstring("property COMPtr")] HRESULT COMPtr([out, retval] IUnknown* *pVal);
|
||||
[propput, id(12), helpstring("property COMPtr")] HRESULT COMPtr([in] IUnknown* newVal);
|
||||
[propget, id(13), helpstring("property Char")] HRESULT Char([out, retval] unsigned char *pVal);
|
||||
[propput, id(13), helpstring("property Char")] HRESULT Char([in] unsigned char newVal);
|
||||
[propget, id(14), helpstring("property ParameterizedProperty")] HRESULT ParameterizedProperty([in]long aIndex, [out, retval] long *pVal);
|
||||
[propput, id(14), helpstring("property ParameterizedProperty")] HRESULT ParameterizedProperty([in]long aIndex, [in] long newVal);
|
||||
[propget, id(15), helpstring("property ParameterizedPropertyCount")] HRESULT ParameterizedPropertyCount([out, retval] long *pVal);
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(0797788A-CB08-4995-BD45-7BF8C468DE21),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestScriptOn Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestScriptOn : IDispatch
|
||||
{
|
||||
};
|
||||
|
||||
[
|
||||
uuid(2A06373F-3E61-4882-A3D7-A104F70B09ED),
|
||||
helpstring("nsXPCDispTestScriptOn Class")
|
||||
]
|
||||
coclass nsXPCDispTestScriptOn
|
||||
{
|
||||
[default] interface nsIXPCDispTestScriptOn;
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(EE6F9DB5-890F-422D-B9DC-9C5AB5A1D654),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestScriptOff Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestScriptOff : IDispatch
|
||||
{
|
||||
};
|
||||
|
||||
[
|
||||
object,
|
||||
uuid(D84352CA-1A01-4E72-9072-77AFA669B3AD),
|
||||
dual,
|
||||
helpstring("nsIXPCDispTestWrappedJS Interface"),
|
||||
pointer_default(unique)
|
||||
]
|
||||
interface nsIXPCDispTestWrappedJS : IDispatch
|
||||
{
|
||||
[id(1), helpstring("method TestParamTypes")] HRESULT TestParamTypes([in] IDispatch * obj, [out, retval]BSTR * errMsg);
|
||||
};
|
||||
|
||||
[
|
||||
uuid(EAEE6BB2-C005-4B91-BCA7-6613236F6F69),
|
||||
helpstring("nsXPCDispTestWrappedJS Class")
|
||||
]
|
||||
coclass nsXPCDispTestWrappedJS
|
||||
{
|
||||
[default] interface nsIXPCDispTestWrappedJS;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(959CD122-9826-4757-BA09-DE327D55F9E7),
|
||||
helpstring("nsXPCDispTestScriptOff Class")
|
||||
]
|
||||
coclass nsXPCDispTestScriptOff
|
||||
{
|
||||
[default] interface nsIXPCDispTestScriptOff;
|
||||
};
|
||||
|
||||
[
|
||||
uuid(D8B4265B-1768-4CA9-A285-7CCAEEB51C74),
|
||||
helpstring("nsXPCDispTestProperties Class")
|
||||
]
|
||||
coclass nsXPCDispTestProperties
|
||||
{
|
||||
[default] interface nsIXPCDispTestProperties;
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
@@ -1,145 +0,0 @@
|
||||
//Microsoft Developer Studio generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"#include ""winres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE DISCARDABLE
|
||||
BEGIN
|
||||
"1 TYPELIB ""XPCIDispatchTest.tlb""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifndef _MAC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,1
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904B0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "XPCIDispatchTest Module\0"
|
||||
VALUE "FileVersion", "1, 0, 0, 1\0"
|
||||
VALUE "InternalName", "XPCIDispatchTest\0"
|
||||
VALUE "LegalCopyright", "Copyright 2002\0"
|
||||
VALUE "OriginalFilename", "XPCIDispatchTest.DLL\0"
|
||||
VALUE "ProductName", "XPCIDispatchTest Module\0"
|
||||
VALUE "ProductVersion", "1, 0, 0, 1\0"
|
||||
VALUE "OLESelfRegister", "\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x409, 1200
|
||||
END
|
||||
END
|
||||
|
||||
#endif // !_MAC
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// REGISTRY
|
||||
//
|
||||
|
||||
IDR_nsXPCDispTestMethods REGISTRY DISCARDABLE "nsXPCDispTestMethods.rgs"
|
||||
IDR_nsXPCDispSimple REGISTRY DISCARDABLE "nsXPCDispSimple.rgs"
|
||||
IDR_nsXPCDispTestNoIDispatch REGISTRY DISCARDABLE "nsXPCDispTestNoIDispatch.rgs"
|
||||
IDR_nsXPCDispTestProperties REGISTRY DISCARDABLE "nsXPCDispTestProperties.rgs"
|
||||
IDR_nsXPCDispTestArrays REGISTRY DISCARDABLE "nsXPCDispTestArrays.rgs"
|
||||
IDR_nsXPCDispTestScriptOn REGISTRY DISCARDABLE "nsXPCDispTestScriptOn.rgs"
|
||||
IDR_nsXPCDispTestScriptOff REGISTRY DISCARDABLE "nsXPCDispTestScriptOff.rgs"
|
||||
IDR_nsXPCDispTestWrappedJS REGISTRY DISCARDABLE "nsXPCDispTestWrappedJS.rgs"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_PROJNAME "XPCIDispatchTest"
|
||||
IDS_NSXPCDISPTTESTMETHODS_DESC "nsXPCDisptTestMethods Class"
|
||||
IDS_NSXPCDISPTESTMETHODS_DESC "nsXPCDispTestMethods Class"
|
||||
IDS_NSXPCDISPSIMPLE_DESC "nsXPCDispSimple Class"
|
||||
IDS_NSXPCDISPTESTNOIDISPATCH_DESC "nsXPCDispTestNoIDispatch Class"
|
||||
IDS_NSXPCDISPTESTNOSCRIPT_DESC "nsXPCDispTestNoScript Class"
|
||||
IDS_NSXPCDISPTESTPROPERTIES_DESC "nsXPCDispTestProperties Class"
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_NSXPCDISPTESTARRAYS_DESC "nsXPCDispTestArrays Class"
|
||||
IDS_NSXPCDISPTESTSCRIPTON_DESC "nsXPCDispTestScriptOn Class"
|
||||
IDS_NSXPCDISPTESTSCRIPTOFF_DESC "nsXPCDispTestScriptOff Class"
|
||||
IDS_NSXPCDISPTESTWRAPPEDJS_DESC "nsXPCDispTestWrappedJS Class"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
1 TYPELIB "XPCIDispatchTest.tlb"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -1,44 +0,0 @@
|
||||
// nsXPCDispSimple.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispSimple.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispSimple::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispSimple,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispSimple::ClassName(BSTR * name)
|
||||
{
|
||||
if (name == NULL)
|
||||
return E_POINTER;
|
||||
CComBSTR x("nsXPCDispSimple");
|
||||
*name = x.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispSimple::get_Number(LONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = mNumber;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispSimple::put_Number(LONG result)
|
||||
{
|
||||
mNumber = result;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
// nsXPCDispSimple.h: Definition of the nsXPCDispSimple class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPSIMPLE_H__5502A675_46D9_4762_A7F9_1A023A052152__INCLUDED_)
|
||||
#define AFX_NSXPCDISPSIMPLE_H__5502A675_46D9_4762_A7F9_1A023A052152__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispSimple
|
||||
|
||||
class nsXPCDispSimple :
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispSimple,&CLSID_nsXPCDispSimple>,
|
||||
public IDispatchImpl<nsIXPCDispSimple, &IID_nsIXPCDispSimple, &LIBID_IDispatchTestLib>
|
||||
{
|
||||
public:
|
||||
nsXPCDispSimple() : mNumber(5) {}
|
||||
BEGIN_CATEGORY_MAP(nsXPCDispSimple)
|
||||
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
|
||||
END_CATEGORY_MAP()
|
||||
BEGIN_COM_MAP(nsXPCDispSimple)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispSimple)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispSimple)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispSimple)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispSimple
|
||||
public:
|
||||
// nsIXPCDispSimple
|
||||
STDMETHOD(ClassName)(BSTR * name);
|
||||
STDMETHOD(get_Number)(LONG * result);
|
||||
STDMETHOD(put_Number)(LONG result);
|
||||
template <class T>
|
||||
static HRESULT CreateInstance(T ** result)
|
||||
{
|
||||
return CoCreateInstance(CLSID_nsXPCDispSimple, 0, CLSCTX_ALL,
|
||||
__uuidof(T),
|
||||
reinterpret_cast<void**>(result));
|
||||
}
|
||||
private:
|
||||
long mNumber;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPSIMPLE_H__5502A675_46D9_4762_A7F9_1A023A052152__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispSimple.1 = s 'nsXPCDispSimple Class'
|
||||
{
|
||||
CLSID = s '{9F39237C-D179-4260-8EF3-4B6D4D7D5570}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispSimple = s 'nsXPCDispSimple Class'
|
||||
{
|
||||
CLSID = s '{9F39237C-D179-4260-8EF3-4B6D4D7D5570}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {9F39237C-D179-4260-8EF3-4B6D4D7D5570} = s 'nsXPCDispSimple Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispSimple.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispSimple'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,221 +0,0 @@
|
||||
// nsXPCDispTestArrays.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestArrays.h"
|
||||
|
||||
unsigned int zero = 0;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestArrays::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestArrays,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestArrays::ReturnSafeArray(LPSAFEARRAY * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*result = SafeArrayCreateVector(VT_I4, 0, 3);
|
||||
for (long index = 0; index < 3; ++index)
|
||||
{
|
||||
SafeArrayPutElement(*result, &index, &index);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestArrays::ReturnSafeArrayBSTR(LPSAFEARRAY * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*result = SafeArrayCreateVector(VT_BSTR, 0, 3);
|
||||
for (long index = 0; index < 3; ++index)
|
||||
{
|
||||
_variant_t var(index);
|
||||
HRESULT hr = VariantChangeType(&var, &var, VARIANT_ALPHABOOL, VT_BSTR);
|
||||
|
||||
if (FAILED(hr))
|
||||
return hr;
|
||||
SafeArrayPutElement(*result, &index, var.bstrVal);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestArrays::ReturnSafeArrayIDispatch(LPSAFEARRAY * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*result = SafeArrayCreateVector(VT_DISPATCH, 0, 3);
|
||||
for (long index = 0; index < 3; ++index)
|
||||
{
|
||||
CComPtr<nsIXPCDispSimple> ptr;
|
||||
ptr.CoCreateInstance(CLSID_nsXPCDispSimple);
|
||||
SafeArrayPutElement(*result, &index, ptr.p);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#define RETURN_IF_FAIL(x) hr = x; if (FAILED(hr)) return hr;
|
||||
|
||||
STDMETHODIMP nsXPCDispTestArrays::TakesSafeArray(LPSAFEARRAY array)
|
||||
{
|
||||
long lbound;
|
||||
long ubound;
|
||||
HRESULT hr;
|
||||
|
||||
RETURN_IF_FAIL(SafeArrayGetLBound(array, 1, &lbound));
|
||||
if (lbound != 0)
|
||||
return E_FAIL;
|
||||
RETURN_IF_FAIL(SafeArrayGetUBound(array, 1, &ubound));
|
||||
if (ubound != 3)
|
||||
return E_FAIL;
|
||||
for (long index = lbound; index <= ubound; ++index)
|
||||
{
|
||||
_variant_t value;
|
||||
RETURN_IF_FAIL(SafeArrayGetElement(array, &index, &value));
|
||||
if (value != _variant_t(index))
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestArrays::TakesSafeArrayBSTR(LPSAFEARRAY array)
|
||||
{
|
||||
long lbound;
|
||||
long ubound;
|
||||
HRESULT hr;
|
||||
|
||||
RETURN_IF_FAIL(SafeArrayGetLBound(array, 1, &lbound));
|
||||
if (lbound != 0)
|
||||
return E_FAIL;
|
||||
RETURN_IF_FAIL(SafeArrayGetUBound(array, 1, &ubound));
|
||||
if (ubound != 3)
|
||||
return E_FAIL;
|
||||
for (long index = lbound; index <= ubound; ++index)
|
||||
{
|
||||
_variant_t value;
|
||||
RETURN_IF_FAIL(SafeArrayGetElement(array, &index, &value));
|
||||
_variant_t test(index);
|
||||
if (_bstr_t(value) != _bstr_t(test))
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestArrays::TakesSafeArrayIDispatch(LPSAFEARRAY array)
|
||||
{
|
||||
long lbound;
|
||||
long ubound;
|
||||
HRESULT hr;
|
||||
|
||||
RETURN_IF_FAIL(SafeArrayGetLBound(array, 0, &lbound));
|
||||
if (lbound != 0)
|
||||
return E_FAIL;
|
||||
RETURN_IF_FAIL(SafeArrayGetUBound(array, 0, &ubound));
|
||||
if (ubound != 3)
|
||||
return E_FAIL;
|
||||
for (long index = lbound; index <= ubound; ++index)
|
||||
{
|
||||
_variant_t value;
|
||||
RETURN_IF_FAIL(SafeArrayGetElement(array, &index, &value));
|
||||
// We need to do more here, but this is good enough for now
|
||||
if (!value.pdispVal)
|
||||
return E_FAIL;
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestArrays::InOutSafeArray(LPSAFEARRAY * array)
|
||||
{
|
||||
if (array == NULL)
|
||||
return E_POINTER;
|
||||
long lbound;
|
||||
long ubound;
|
||||
HRESULT hr;
|
||||
|
||||
RETURN_IF_FAIL(SafeArrayGetLBound(*array, 0, &lbound));
|
||||
if (lbound != 0)
|
||||
return E_FAIL;
|
||||
RETURN_IF_FAIL(SafeArrayGetUBound(*array, 0, &ubound));
|
||||
if (ubound != 3)
|
||||
return E_FAIL;
|
||||
LPSAFEARRAY newArray = SafeArrayCreateVector(VT_I4, lbound, ubound);
|
||||
for (long index = lbound; index <= ubound; ++index)
|
||||
{
|
||||
long value;
|
||||
RETURN_IF_FAIL(SafeArrayGetElement(*array, &index, &value));
|
||||
if (value != index)
|
||||
return E_FAIL;
|
||||
value += 42;
|
||||
RETURN_IF_FAIL(SafeArrayPutElement(newArray, &index, &value));
|
||||
}
|
||||
SafeArrayDestroy(*array);
|
||||
*array = newArray;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestArrays::InOutSafeArrayBSTR(LPSAFEARRAY * array)
|
||||
{
|
||||
if (array == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
long lbound;
|
||||
long ubound;
|
||||
HRESULT hr;
|
||||
|
||||
RETURN_IF_FAIL(SafeArrayGetLBound(*array, 0, &lbound));
|
||||
if (lbound != 0)
|
||||
return E_FAIL;
|
||||
RETURN_IF_FAIL(SafeArrayGetUBound(*array, 0, &ubound));
|
||||
if (ubound != 3)
|
||||
return E_FAIL;
|
||||
LPSAFEARRAY newArray = SafeArrayCreateVector(VT_BSTR, lbound, ubound);
|
||||
for (long index = lbound; index <= ubound; ++index)
|
||||
{
|
||||
BSTR value;
|
||||
RETURN_IF_FAIL(SafeArrayGetElement(*array, &index, &value));
|
||||
_bstr_t newValue(value, TRUE);
|
||||
newValue += L"Appended";
|
||||
RETURN_IF_FAIL(SafeArrayPutElement(newArray, &index, newValue.copy()));
|
||||
}
|
||||
SafeArrayDestroy(*array);
|
||||
*array = newArray;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestArrays::InOutSafeArrayIDispatch(LPSAFEARRAY * array)
|
||||
{
|
||||
if (array == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
long lbound;
|
||||
long ubound;
|
||||
HRESULT hr;
|
||||
|
||||
RETURN_IF_FAIL(SafeArrayGetLBound(*array, 0, &lbound));
|
||||
if (lbound != 0)
|
||||
return E_FAIL;
|
||||
RETURN_IF_FAIL(SafeArrayGetUBound(*array, 0, &ubound));
|
||||
if (ubound != 3)
|
||||
return E_FAIL;
|
||||
LPSAFEARRAY newArray = SafeArrayCreateVector(VT_DISPATCH, lbound, ubound);
|
||||
for (long index = lbound; index <= ubound; ++index)
|
||||
{
|
||||
IDispatch* value;
|
||||
RETURN_IF_FAIL(SafeArrayGetElement(*array, &index, &value));
|
||||
RETURN_IF_FAIL(SafeArrayPutElement(newArray, &index, &value));
|
||||
}
|
||||
SafeArrayDestroy(*array);
|
||||
*array = newArray;
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
// nsXPCDispTestArrays.h: Definition of the nsXPCDispTestArrays class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTARRAYS_H__5F59BD4C_16A4_4BD6_8281_796DE6A2889C__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTARRAYS_H__5F59BD4C_16A4_4BD6_8281_796DE6A2889C__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestArrays
|
||||
|
||||
class nsXPCDispTestArrays :
|
||||
public IDispatchImpl<nsIXPCDispTestArrays, &IID_nsIXPCDispTestArrays, &LIBID_IDispatchTestLib>,
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestArrays,&CLSID_nsXPCDispTestArrays>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestArrays() {}
|
||||
BEGIN_CATEGORY_MAP(nsXPCDispTestArrays)
|
||||
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
|
||||
END_CATEGORY_MAP()
|
||||
BEGIN_COM_MAP(nsXPCDispTestArrays)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestArrays)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispTestArrays)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestArrays)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestArrays
|
||||
public:
|
||||
// nsIXPCDispTestArrays
|
||||
STDMETHOD(ReturnSafeArray)(LPSAFEARRAY * result);
|
||||
STDMETHOD(ReturnSafeArrayBSTR)(LPSAFEARRAY * result);
|
||||
STDMETHOD(ReturnSafeArrayIDispatch)(LPSAFEARRAY * result);
|
||||
STDMETHOD(TakesSafeArray)(LPSAFEARRAY array);
|
||||
STDMETHOD(TakesSafeArrayBSTR)(LPSAFEARRAY array);
|
||||
STDMETHOD(TakesSafeArrayIDispatch)(LPSAFEARRAY array);
|
||||
STDMETHOD(InOutSafeArray)(LPSAFEARRAY * array);
|
||||
STDMETHOD(InOutSafeArrayBSTR)(LPSAFEARRAY * array);
|
||||
STDMETHOD(InOutSafeArrayIDispatch)(LPSAFEARRAY * array);
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTARRAYS_H__5F59BD4C_16A4_4BD6_8281_796DE6A2889C__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestArrays.1 = s 'nsXPCDispTestArrays Class'
|
||||
{
|
||||
CLSID = s '{AB085C43-C619-48C8-B68C-C495BDE12DFB}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestArrays = s 'nsXPCDispTestArrays Class'
|
||||
{
|
||||
CLSID = s '{AB085C43-C619-48C8-B68C-C495BDE12DFB}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {AB085C43-C619-48C8-B68C-C495BDE12DFB} = s 'nsXPCDispTestArrays Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestArrays.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestArrays'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,699 +0,0 @@
|
||||
// nsXPCDispTestMethods.cpp : Implementation of CIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestMethods.h"
|
||||
#include "XPCDispUtilities.h"
|
||||
#include "nsXPCDispSimple.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestMethods::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestMethods,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestMethods::NoParameters()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnBSTR(BSTR * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
CComBSTR x("Boo");
|
||||
*result = x.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnI4(INT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnUI1(BYTE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnI2(SHORT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 9999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnR4(FLOAT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99999.1f;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnR8(DOUBLE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99999999999.99;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnBool(VARIANT_BOOL * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = VARIANT_TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnIDispatch(IDispatch * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
return nsXPCDispSimple::CreateInstance(result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnError(SCODE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = E_FAIL;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnDate(DATE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
CComBSTR dateStr(L"5/2/02");
|
||||
return VarDateFromStr(dateStr, LOCALE_SYSTEM_DEFAULT,
|
||||
LOCALE_NOUSEROVERRIDE, result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnIUnknown(IUnknown * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
return XPCCreateInstance<IUnknown>(CLSID_nsXPCDispTestNoIDispatch, IID_IUnknown, result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnI1(unsigned char * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*result = 120;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnUI2(USHORT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 9999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnUI4(ULONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 3000000000;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnInt(INT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = -999999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::ReturnUInt(UINT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*result = 3000000000;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesBSTR(BSTR result)
|
||||
{
|
||||
CComBSTR str(result);
|
||||
static CComBSTR test(L"TakesBSTR");
|
||||
return str == test ? S_OK: E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesI4(INT result)
|
||||
{
|
||||
return result == 999999 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesUI1(BYTE result)
|
||||
{
|
||||
return result == 42 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesI2(SHORT result)
|
||||
{
|
||||
return result == 32000 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesR4(FLOAT result)
|
||||
{
|
||||
// Hopefully we won't run into any precision/rounding issues
|
||||
return result == 99999.99f ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesR8(DOUBLE result)
|
||||
{
|
||||
// Hopefully we won't run into any precision/rounding issues
|
||||
return result == 999999999.99 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesBool(VARIANT_BOOL result)
|
||||
{
|
||||
return result ? S_OK : E_FAIL;
|
||||
}
|
||||
|
||||
inline
|
||||
HRESULT GetProperty(IDispatch *pDisp, const CComBSTR & name, CComVariant& output)
|
||||
{
|
||||
DISPID dispid = GetIDsOfNames(pDisp, name);
|
||||
DISPPARAMS dispParams;
|
||||
dispParams.cArgs = 0;
|
||||
dispParams.cNamedArgs = 0;
|
||||
dispParams.rgdispidNamedArgs = 0;
|
||||
dispParams.rgvarg = 0;
|
||||
return pDisp->Invoke(dispid, IID_NULL, LOCALE_SYSTEM_DEFAULT,DISPATCH_PROPERTYGET, &dispParams, &output, 0, 0);
|
||||
}
|
||||
|
||||
inline
|
||||
HRESULT PutProperty(IDispatch *pDisp, const CComBSTR & name, const CComVariant& input)
|
||||
{
|
||||
DISPPARAMS dispParams;
|
||||
DISPID did = DISPID_PROPERTYPUT;
|
||||
dispParams.cArgs = 1;
|
||||
CComVariant var(input);
|
||||
dispParams.rgvarg = &var;
|
||||
dispParams.cNamedArgs = 1;
|
||||
dispParams.rgdispidNamedArgs = &did;
|
||||
CComVariant result;
|
||||
DISPID dispID = GetIDsOfNames(pDisp, name);
|
||||
return pDisp->Invoke(dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT,
|
||||
DISPATCH_PROPERTYPUT, &dispParams, &result,
|
||||
0, 0);
|
||||
}
|
||||
|
||||
HRESULT VerifynsXPCDispSimple(IDispatch * result)
|
||||
{
|
||||
CComVariant property;
|
||||
HRESULT hResult = GetProperty(result, L"Number", property);
|
||||
CComVariant test((long)5);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
if (property != test)
|
||||
return E_FAIL;
|
||||
return PutProperty(result, L"Number", 76);
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesIDispatch(IDispatch * result)
|
||||
{
|
||||
return VerifynsXPCDispSimple(result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesError(SCODE result)
|
||||
{
|
||||
return result == E_FAIL ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesDate(DATE result)
|
||||
{
|
||||
CComBSTR dateStr(L"5/2/02");
|
||||
DATE myDate;
|
||||
HRESULT hResult = VarDateFromStr(dateStr, LOCALE_SYSTEM_DEFAULT,
|
||||
LOCALE_NOUSEROVERRIDE, &myDate);
|
||||
if (SUCCEEDED(hResult))
|
||||
return myDate == result ? S_OK : E_FAIL;
|
||||
else
|
||||
return hResult;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesIUnknown(IUnknown * result)
|
||||
{
|
||||
CComPtr<IUnknown> ptr(result);
|
||||
ULONG before = result->AddRef();
|
||||
ULONG after = result->Release();
|
||||
CComQIPtr<nsIXPCDispTestNoIDispatch> noIDispatch(ptr);
|
||||
return before - 1 == after ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesI1(unsigned char result)
|
||||
{
|
||||
return result == 42 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesUI2(USHORT result)
|
||||
{
|
||||
return result == 50000 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesUI4(ULONG result)
|
||||
{
|
||||
return result == 0xF0000000 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesInt(INT result)
|
||||
{
|
||||
return result == -10000000 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TakesUInt(UINT result)
|
||||
{
|
||||
return result == 0xE0000000 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsBSTR(BSTR * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
CComBSTR x("Boo");
|
||||
*result = x.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsI4(LONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsUI1(BYTE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsI2(SHORT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 9999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsR4(FLOAT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 999999.1f;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsR8(DOUBLE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 99999999999.99;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsBool(VARIANT_BOOL * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = VARIANT_TRUE;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsIDispatch(IDispatch * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
return nsXPCDispSimple::CreateInstance(result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsError(SCODE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = E_FAIL;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsDate(DATE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
CComBSTR dateStr(L"5/2/02");
|
||||
return VarDateFromStr(dateStr, LOCALE_SYSTEM_DEFAULT,
|
||||
LOCALE_NOUSEROVERRIDE, result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsIUnknown(IUnknown * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
return XPCCreateInstance<IUnknown>(CLSID_nsXPCDispTestNoIDispatch, IID_IUnknown, result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsI1(unsigned char * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
*result = L'x';
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsUI2(USHORT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 9999;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OutputsUI4(ULONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = 3000000000;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsBSTR(BSTR * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
CComBSTR str(*result);
|
||||
str += L"Appended";
|
||||
SysFreeString(*result);
|
||||
*result = str.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsI4(LONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result -= 4000000;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsUI1(BYTE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result -= 42;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsI2(SHORT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result += 10000;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsR4(FLOAT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result += 5.05f;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsR8(DOUBLE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result += 50000000.00000005;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsBool(VARIANT_BOOL * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = !*result;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsIDispatch(IDispatch * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
CComPtr<nsIXPCDispSimple> ptr;
|
||||
ptr.CoCreateInstance(CLSID_nsXPCDispSimple);
|
||||
CComPtr<IDispatch> incoming(*result);
|
||||
CComVariant value;
|
||||
HRESULT hResult = GetProperty(incoming, L"Number", value);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
if (value.lVal != 10)
|
||||
return E_FAIL;
|
||||
hResult = ptr->put_Number(value.lVal + 5);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
|
||||
*result = ptr.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsError(SCODE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result += 1;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsDate(DATE * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
ULONG days;
|
||||
HRESULT hResult = VarUI4FromDate(*result, &days);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
|
||||
return VarDateFromUI4(days + 1, result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsIUnknown(IUnknown * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
CComPtr<IUnknown> ptr(*result);
|
||||
ULONG before = (*result)->AddRef();
|
||||
ULONG after = (*result)->Release();
|
||||
if (before - 1 != after)
|
||||
return E_FAIL;
|
||||
return nsXPCDispSimple::CreateInstance(result);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsI1(unsigned char * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
++*result;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsUI2(USHORT * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result += 42;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::InOutsUI4(ULONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result -= 42;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::OneParameterWithReturn(LONG input,
|
||||
LONG * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
*result = input + 42;
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::StringInputAndReturn(BSTR str,
|
||||
BSTR * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
CComBSTR input(str);
|
||||
input += L"Appended";
|
||||
*result = input.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::IDispatchInputAndReturn(IDispatch * input, IDispatch * * result)
|
||||
{
|
||||
if (result == NULL)
|
||||
return E_POINTER;
|
||||
HRESULT hResult = VerifynsXPCDispSimple(input);
|
||||
|
||||
hResult = XPCCreateInstance<IDispatch>(CLSID_nsXPCDispSimple, IID_IDispatch, result);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
CComVariant variant;
|
||||
hResult = GetProperty(input, L"Number", variant);
|
||||
if (FAILED(hResult))
|
||||
return hResult;
|
||||
return PutProperty(*result, L"Number", variant.lVal + 5);
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwoParameters(LONG one, LONG two)
|
||||
{
|
||||
return one + 1 == two ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwelveInParameters(LONG one, LONG two,
|
||||
LONG three, LONG four,
|
||||
LONG five, LONG six,
|
||||
LONG seven, LONG eight,
|
||||
LONG nine, LONG ten,
|
||||
LONG eleven, LONG twelve)
|
||||
{
|
||||
return one + two + three + four + five + six + seven + eight + nine +
|
||||
ten + eleven + twelve == 78 ? S_OK : E_FAIL;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwelveOutParameters(LONG * one, LONG * two,
|
||||
LONG * three,
|
||||
LONG * four,
|
||||
LONG * five, LONG * six,
|
||||
LONG * seven,
|
||||
LONG * eight,
|
||||
LONG * nine, LONG * ten,
|
||||
LONG * eleven,
|
||||
LONG * twelve)
|
||||
{
|
||||
if (one == 0 || two == 0 || three == 0 || four == 0 ||
|
||||
five == 0 || six == 0 || seven == 0 || eight == 0 ||
|
||||
nine == 0 || ten == 0 || eleven == 0 || twelve == 0)
|
||||
return E_POINTER;
|
||||
|
||||
*one = 1;
|
||||
*two = 2;
|
||||
*three = 3;
|
||||
*four = 4;
|
||||
*five = 5;
|
||||
*six = 6;
|
||||
*seven = 7;
|
||||
*eight = 8;
|
||||
*nine = 9;
|
||||
*ten = 10;
|
||||
*eleven = 11;
|
||||
*twelve = 12;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
inline
|
||||
boolean Equals(BSTR left, const char * str)
|
||||
{
|
||||
return CComBSTR(left) == str;
|
||||
}
|
||||
#define TESTPARAM(val) Equals(val, #val)
|
||||
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwelveStrings(BSTR one, BSTR two, BSTR three, BSTR four, BSTR five, BSTR six, BSTR seven, BSTR eight, BSTR nine, BSTR ten, BSTR eleven, BSTR twelve)
|
||||
{
|
||||
return TESTPARAM(one) && TESTPARAM(two) && TESTPARAM(three) &&
|
||||
TESTPARAM(four) && TESTPARAM(five) && TESTPARAM(six) &&
|
||||
TESTPARAM(seven) && TESTPARAM(eight) && TESTPARAM(nine) &&
|
||||
TESTPARAM(ten) && TESTPARAM(eleven) && TESTPARAM(twelve) ?
|
||||
S_OK : E_FAIL;
|
||||
}
|
||||
|
||||
#define ASSIGNPARAM(val) \
|
||||
if (val == 0) \
|
||||
return E_POINTER; \
|
||||
*val = CComBSTR(#val).Detach()
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwelveOutStrings(BSTR * one, BSTR * two, BSTR * three, BSTR * four, BSTR * five, BSTR * six, BSTR * seven, BSTR * eight, BSTR * nine, BSTR * ten, BSTR * eleven, BSTR * twelve)
|
||||
{
|
||||
ASSIGNPARAM(one);
|
||||
ASSIGNPARAM(two);
|
||||
ASSIGNPARAM(three);
|
||||
ASSIGNPARAM(four);
|
||||
ASSIGNPARAM(five);
|
||||
ASSIGNPARAM(six);
|
||||
ASSIGNPARAM(seven);
|
||||
ASSIGNPARAM(eight);
|
||||
ASSIGNPARAM(nine);
|
||||
ASSIGNPARAM(ten);
|
||||
ASSIGNPARAM(eleven);
|
||||
ASSIGNPARAM(twelve);
|
||||
return S_OK;
|
||||
}
|
||||
#define VERIFYSIMPLE(param) \
|
||||
hResult = VerifynsXPCDispSimple(param); \
|
||||
if (FAILED(hResult)) \
|
||||
return hResult
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwelveIDispatch(IDispatch * one,
|
||||
IDispatch * two,
|
||||
IDispatch * three,
|
||||
IDispatch * four,
|
||||
IDispatch * five,
|
||||
IDispatch * six,
|
||||
IDispatch * seven,
|
||||
IDispatch * eight,
|
||||
IDispatch * nine,
|
||||
IDispatch * ten,
|
||||
IDispatch * eleven,
|
||||
IDispatch * twelve)
|
||||
{
|
||||
HRESULT hResult;
|
||||
VERIFYSIMPLE(one);
|
||||
VERIFYSIMPLE(two);
|
||||
VERIFYSIMPLE(three);
|
||||
VERIFYSIMPLE(four);
|
||||
VERIFYSIMPLE(five);
|
||||
VERIFYSIMPLE(six);
|
||||
VERIFYSIMPLE(seven);
|
||||
VERIFYSIMPLE(eight);
|
||||
VERIFYSIMPLE(nine);
|
||||
VERIFYSIMPLE(ten);
|
||||
VERIFYSIMPLE(eleven);
|
||||
VERIFYSIMPLE(twelve);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#define ASSIGNSIMPLE(param) \
|
||||
if (param == 0) \
|
||||
return E_POINTER; \
|
||||
hResult = nsXPCDispSimple::CreateInstance(param); \
|
||||
if (FAILED(hResult)) \
|
||||
return hResult; \
|
||||
|
||||
STDMETHODIMP nsXPCDispTestMethods::TwelveOutIDispatch(IDispatch * * one,
|
||||
IDispatch * * two,
|
||||
IDispatch * * three,
|
||||
IDispatch * * four,
|
||||
IDispatch * * five,
|
||||
IDispatch * * six,
|
||||
IDispatch * * seven,
|
||||
IDispatch * * eight,
|
||||
IDispatch * * nine,
|
||||
IDispatch * * ten,
|
||||
IDispatch * * eleven,
|
||||
IDispatch * * twelve){
|
||||
HRESULT hResult;
|
||||
ASSIGNSIMPLE(one);
|
||||
ASSIGNSIMPLE(two);
|
||||
ASSIGNSIMPLE(three);
|
||||
ASSIGNSIMPLE(four);
|
||||
ASSIGNSIMPLE(five);
|
||||
ASSIGNSIMPLE(six);
|
||||
ASSIGNSIMPLE(seven);
|
||||
ASSIGNSIMPLE(eight);
|
||||
ASSIGNSIMPLE(nine);
|
||||
ASSIGNSIMPLE(ten);
|
||||
ASSIGNSIMPLE(eleven);
|
||||
ASSIGNSIMPLE(twelve);
|
||||
return S_OK;
|
||||
}
|
||||
STDMETHODIMP nsXPCDispTestMethods::CreateError()
|
||||
{
|
||||
CComBSTR someText(L"CreateError Test");
|
||||
ICreateErrorInfo * pCreateError;
|
||||
IErrorInfo * pError;
|
||||
HRESULT result = CreateErrorInfo(&pCreateError);
|
||||
if (FAILED(result))
|
||||
return E_NOTIMPL;
|
||||
result = pCreateError->QueryInterface(&pError);
|
||||
if (FAILED(result))
|
||||
return E_NOTIMPL;
|
||||
result = pCreateError->SetDescription(someText);
|
||||
if (FAILED(result))
|
||||
return E_NOTIMPL;
|
||||
result = pCreateError->SetGUID(IID_nsIXPCDispTestMethods);
|
||||
if (FAILED(result))
|
||||
return E_NOTIMPL;
|
||||
CComBSTR source(L"XPCIDispatchTest.nsXPCDispTestMethods.1");
|
||||
result = pCreateError->SetSource(source);
|
||||
if (FAILED(result))
|
||||
return E_NOTIMPL;
|
||||
result = SetErrorInfo(0, pError);
|
||||
if (FAILED(result))
|
||||
return E_NOTIMPL;
|
||||
pError->Release();
|
||||
pCreateError->Release();
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
// nsXPCDispTestMethods.h: Definition of the nsXPCDispTestMethods class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTMETHODS_H__A516B1D7_1971_419C_AE35_EDFAC27D1227__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTMETHODS_H__A516B1D7_1971_419C_AE35_EDFAC27D1227__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include "XPCIDispatchTest.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestMethods
|
||||
|
||||
class nsXPCDispTestMethods :
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestMethods,&CLSID_nsXPCDispTestMethods>,
|
||||
public IDispatchImpl<nsIXPCDispTestMethods, &IID_nsIXPCDispTestMethods, &LIBID_IDispatchTestLib>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestMethods() {}
|
||||
BEGIN_CATEGORY_MAP(nsXPCDispTestMethods)
|
||||
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
|
||||
END_CATEGORY_MAP()
|
||||
BEGIN_COM_MAP(nsXPCDispTestMethods)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestMethods)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispTestMethods)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestMethods)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestMethods
|
||||
public:
|
||||
// nsIXPCDispTestMethod
|
||||
STDMETHOD(NoParameters)();
|
||||
STDMETHOD(ReturnBSTR)(BSTR * result);
|
||||
STDMETHOD(ReturnI4)(INT * result);
|
||||
STDMETHOD(ReturnUI1)(BYTE * result);
|
||||
STDMETHOD(ReturnI2)(SHORT * result);
|
||||
STDMETHOD(ReturnR4)(FLOAT * result);
|
||||
STDMETHOD(ReturnR8)(DOUBLE * result);
|
||||
STDMETHOD(ReturnBool)(VARIANT_BOOL * result);
|
||||
STDMETHOD(ReturnIDispatch)(IDispatch * * result);
|
||||
STDMETHOD(ReturnError)(SCODE * result);
|
||||
STDMETHOD(ReturnDate)(DATE * result);
|
||||
STDMETHOD(ReturnIUnknown)(IUnknown * * result);
|
||||
STDMETHOD(ReturnI1)(unsigned char * result);
|
||||
STDMETHOD(ReturnUI2)(USHORT * result);
|
||||
STDMETHOD(ReturnUI4)(ULONG * result);
|
||||
STDMETHOD(ReturnInt)(INT * result);
|
||||
STDMETHOD(ReturnUInt)(UINT * result);
|
||||
STDMETHOD(TakesBSTR)(BSTR result);
|
||||
STDMETHOD(TakesI4)(INT result);
|
||||
STDMETHOD(TakesUI1)(BYTE result);
|
||||
STDMETHOD(TakesI2)(SHORT result);
|
||||
STDMETHOD(TakesR4)(FLOAT result);
|
||||
STDMETHOD(TakesR8)(DOUBLE result);
|
||||
STDMETHOD(TakesBool)(VARIANT_BOOL result);
|
||||
STDMETHOD(TakesIDispatch)(IDispatch * result);
|
||||
STDMETHOD(TakesError)(SCODE result);
|
||||
STDMETHOD(TakesDate)(DATE result);
|
||||
STDMETHOD(TakesIUnknown)(IUnknown * result);
|
||||
STDMETHOD(TakesI1)(unsigned char result);
|
||||
STDMETHOD(TakesUI2)(USHORT result);
|
||||
STDMETHOD(TakesUI4)(ULONG result);
|
||||
STDMETHOD(TakesInt)(INT result);
|
||||
STDMETHOD(TakesUInt)(UINT result);
|
||||
STDMETHOD(OutputsBSTR)(BSTR * result);
|
||||
STDMETHOD(OutputsI4)(LONG * result);
|
||||
STDMETHOD(OutputsUI1)(BYTE * result);
|
||||
STDMETHOD(OutputsI2)(SHORT * result);
|
||||
STDMETHOD(OutputsR4)(FLOAT * result);
|
||||
STDMETHOD(OutputsR8)(DOUBLE * result);
|
||||
STDMETHOD(OutputsBool)(VARIANT_BOOL * result);
|
||||
STDMETHOD(OutputsIDispatch)(IDispatch * * result);
|
||||
STDMETHOD(OutputsError)(SCODE * result);
|
||||
STDMETHOD(OutputsDate)(DATE * result);
|
||||
STDMETHOD(OutputsIUnknown)(IUnknown * * result);
|
||||
STDMETHOD(OutputsI1)(unsigned char * result);
|
||||
STDMETHOD(OutputsUI2)(USHORT * result);
|
||||
STDMETHOD(OutputsUI4)(ULONG * result);
|
||||
STDMETHOD(InOutsBSTR)(BSTR * result);
|
||||
STDMETHOD(InOutsI4)(LONG * result);
|
||||
STDMETHOD(InOutsUI1)(BYTE * result);
|
||||
STDMETHOD(InOutsI2)(SHORT * result);
|
||||
STDMETHOD(InOutsR4)(FLOAT * result);
|
||||
STDMETHOD(InOutsR8)(DOUBLE * result);
|
||||
STDMETHOD(InOutsBool)(VARIANT_BOOL * result);
|
||||
STDMETHOD(InOutsIDispatch)(IDispatch * * result);
|
||||
STDMETHOD(InOutsError)(SCODE * result);
|
||||
STDMETHOD(InOutsDate)(DATE * result);
|
||||
STDMETHOD(InOutsIUnknown)(IUnknown * * result);
|
||||
STDMETHOD(InOutsI1)(unsigned char * result);
|
||||
STDMETHOD(InOutsUI2)(USHORT * result);
|
||||
STDMETHOD(InOutsUI4)(ULONG * result);
|
||||
STDMETHOD(OneParameterWithReturn)(LONG input, LONG * result);
|
||||
STDMETHOD(StringInputAndReturn)(BSTR str, BSTR * result);
|
||||
STDMETHOD(IDispatchInputAndReturn)(IDispatch * input, IDispatch** result);
|
||||
STDMETHOD(TwoParameters)(LONG one, LONG two);
|
||||
STDMETHOD(TwelveInParameters)(LONG one, LONG two, LONG three, LONG four,
|
||||
LONG five, LONG six, LONG seven, LONG eight,
|
||||
LONG nine, LONG ten, LONG eleven,
|
||||
LONG twelve);
|
||||
STDMETHOD(TwelveOutParameters)(LONG * one, LONG * two, LONG * three,
|
||||
LONG * four, LONG * five, LONG * six,
|
||||
LONG * seven, LONG * eight, LONG * nine,
|
||||
LONG * ten, LONG * eleven, LONG * twelve);
|
||||
STDMETHOD(TwelveStrings)(BSTR one, BSTR two, BSTR three, BSTR four,
|
||||
BSTR five, BSTR six, BSTR seven, BSTR eight,
|
||||
BSTR nine, BSTR ten, BSTR eleven, BSTR twelve);
|
||||
STDMETHOD(TwelveOutStrings)(BSTR * one, BSTR * two, BSTR * three,
|
||||
BSTR * four, BSTR * five, BSTR * six,
|
||||
BSTR * seven, BSTR * eight, BSTR * nine,
|
||||
BSTR * ten, BSTR * eleven, BSTR * twelve);
|
||||
STDMETHOD(TwelveIDispatch)(IDispatch * one, IDispatch * two,
|
||||
IDispatch * three, IDispatch * four,
|
||||
IDispatch * five, IDispatch * six,
|
||||
IDispatch * seven, IDispatch * eight,
|
||||
IDispatch * nine, IDispatch * ten,
|
||||
IDispatch * eleven, IDispatch * twelve);
|
||||
STDMETHOD(TwelveOutIDispatch)(IDispatch * * one, IDispatch * * two,
|
||||
IDispatch * * three, IDispatch * * four,
|
||||
IDispatch * * five, IDispatch * * six,
|
||||
IDispatch * * seven, IDispatch * * eight,
|
||||
IDispatch * * nine, IDispatch * * ten,
|
||||
IDispatch * * eleven, IDispatch * * twelve);
|
||||
STDMETHOD(CreateError)();
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTMETHODS_H__A516B1D7_1971_419C_AE35_EDFAC27D1227__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestMethods.1 = s 'nsXPCDispTestMethods Class'
|
||||
{
|
||||
CLSID = s '{745D1149-9F46-418C-B176-71EAA98974BA}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestMethods = s 'nsXPCDispTestMethods Class'
|
||||
{
|
||||
CLSID = s '{745D1149-9F46-418C-B176-71EAA98974BA}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {745D1149-9F46-418C-B176-71EAA98974BA} = s 'nsXPCDispTestMethods Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestMethods.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestMethods'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
// nsXPCDispTestNoIDispatch.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestNoIDispatch.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestNoIDispatch::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestNoIDispatch,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
// nsXPCDispTestNoIDispatch.h: Definition of the nsXPCDispTestNoIDispatch class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTNOIDISPATCH_H__E4B74F67_BA6B_4654_8674_E60E487129F7__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTNOIDISPATCH_H__E4B74F67_BA6B_4654_8674_E60E487129F7__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestNoIDispatch
|
||||
|
||||
class nsXPCDispTestNoIDispatch :
|
||||
public nsIXPCDispTestNoIDispatch,
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestNoIDispatch,&CLSID_nsXPCDispTestNoIDispatch>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestNoIDispatch() {}
|
||||
BEGIN_COM_MAP(nsXPCDispTestNoIDispatch)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestNoIDispatch)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
END_COM_MAP()
|
||||
//DECLARE_NOT_AGGREGATABLE(nsXPCDispTestNoIDispatch)
|
||||
// Remove the comment from the line above if you don't want your object to
|
||||
// support aggregation.
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestNoIDispatch)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestNoIDispatch
|
||||
public:
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTNOIDISPATCH_H__E4B74F67_BA6B_4654_8674_E60E487129F7__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestNoIDispatch.1 = s 'nsXPCDispTestNoIDispatch Class'
|
||||
{
|
||||
CLSID = s '{7414404F-A4CC-4E3C-9B32-BB20CB22F541}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestNoIDispatch = s 'nsXPCDispTestNoIDispatch Class'
|
||||
{
|
||||
CLSID = s '{7414404F-A4CC-4E3C-9B32-BB20CB22F541}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {7414404F-A4CC-4E3C-9B32-BB20CB22F541} = s 'nsXPCDispTestNoIDispatch Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestNoIDispatch.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestNoIDispatch'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,256 +0,0 @@
|
||||
// nsXPCDispTestProperties.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestProperties.h"
|
||||
|
||||
const long PARAMETERIZED_PROPERTY_COUNT = 5;
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestProperties,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
nsXPCDispTestProperties::nsXPCDispTestProperties() :
|
||||
mChar('a'),
|
||||
mBOOL(FALSE),
|
||||
mSCode(0),
|
||||
mDATE(0),
|
||||
mDouble(0.0),
|
||||
mFloat(0.0f),
|
||||
mLong(0),
|
||||
mShort(0),
|
||||
mParameterizedProperty(new long[PARAMETERIZED_PROPERTY_COUNT])
|
||||
{
|
||||
mCURRENCY.int64 = 0;
|
||||
CComBSTR string("Initial value");
|
||||
mBSTR = string.Detach();
|
||||
for (long index = 0; index < PARAMETERIZED_PROPERTY_COUNT; ++index)
|
||||
mParameterizedProperty[index] = index + 1;
|
||||
}
|
||||
|
||||
nsXPCDispTestProperties::~nsXPCDispTestProperties()
|
||||
{
|
||||
delete [] mParameterizedProperty;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Short(short *pVal)
|
||||
{
|
||||
*pVal = mShort;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Short(short newVal)
|
||||
{
|
||||
mShort = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Long(long *pVal)
|
||||
{
|
||||
*pVal = mLong;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Long(long newVal)
|
||||
{
|
||||
mLong = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Float(float *pVal)
|
||||
{
|
||||
*pVal = mFloat;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Float(float newVal)
|
||||
{
|
||||
mFloat = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Double(double *pVal)
|
||||
{
|
||||
*pVal = mDouble;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Double(double newVal)
|
||||
{
|
||||
mDouble = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Currency(CURRENCY *pVal)
|
||||
{
|
||||
*pVal = mCURRENCY;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Currency(CURRENCY newVal)
|
||||
{
|
||||
mCURRENCY = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Date(DATE *pVal)
|
||||
{
|
||||
*pVal = mDATE;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Date(DATE newVal)
|
||||
{
|
||||
mDATE = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_String(BSTR *pVal)
|
||||
{
|
||||
*pVal = mBSTR.Copy();
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_String(BSTR newVal)
|
||||
{
|
||||
mBSTR = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_DispatchPtr(IDispatch **pVal)
|
||||
{
|
||||
mIDispatch.CopyTo(pVal);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_DispatchPtr(IDispatch *newVal)
|
||||
{
|
||||
mIDispatch = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_SCode(SCODE *pVal)
|
||||
{
|
||||
*pVal = mSCode;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_SCode(SCODE newVal)
|
||||
{
|
||||
mSCode = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Boolean(BOOL *pVal)
|
||||
{
|
||||
*pVal = mBOOL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Boolean(BOOL newVal)
|
||||
{
|
||||
mBOOL = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Variant(VARIANT *pVal)
|
||||
{
|
||||
::VariantCopy(pVal, &mVariant);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Variant(VARIANT newVal)
|
||||
{
|
||||
mVariant = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_COMPtr(IUnknown **pVal)
|
||||
{
|
||||
mIUnknown.CopyTo(pVal);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_COMPtr(IUnknown *newVal)
|
||||
{
|
||||
mIUnknown = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_Char(unsigned char *pVal)
|
||||
{
|
||||
*pVal = mChar;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_Char(unsigned char newVal)
|
||||
{
|
||||
mChar = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_ParameterizedProperty(long aIndex, long *pVal)
|
||||
{
|
||||
if (aIndex < 0 || aIndex >= PARAMETERIZED_PROPERTY_COUNT)
|
||||
return E_FAIL;
|
||||
|
||||
*pVal = mParameterizedProperty[aIndex];
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::put_ParameterizedProperty(long aIndex, long newVal)
|
||||
{
|
||||
if (aIndex < 0 || aIndex >= PARAMETERIZED_PROPERTY_COUNT)
|
||||
return E_FAIL;
|
||||
|
||||
mParameterizedProperty[aIndex] = newVal;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestProperties::get_ParameterizedPropertyCount(long *pVal)
|
||||
{
|
||||
*pVal = PARAMETERIZED_PROPERTY_COUNT;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
// nsXPCDispTestProperties.h: Definition of the nsXPCDispTestProperties class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTPROPERTIES_H__9E10C7AC_36AF_4A3A_91C7_2CFB9EB166A5__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTPROPERTIES_H__9E10C7AC_36AF_4A3A_91C7_2CFB9EB166A5__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestProperties
|
||||
|
||||
class nsXPCDispTestProperties :
|
||||
public IDispatchImpl<nsIXPCDispTestProperties, &IID_nsIXPCDispTestProperties, &LIBID_IDispatchTestLib>,
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestProperties,&CLSID_nsXPCDispTestProperties>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestProperties();
|
||||
virtual ~nsXPCDispTestProperties();
|
||||
BEGIN_CATEGORY_MAP(nsXPCDispTestProperties)
|
||||
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
|
||||
END_CATEGORY_MAP()
|
||||
BEGIN_COM_MAP(nsXPCDispTestProperties)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestProperties)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispTestProperties)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestProperties)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestProperties
|
||||
public:
|
||||
STDMETHOD(get_ParameterizedPropertyCount)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(get_ParameterizedProperty)(/*[in]*/long aIndex, /*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_ParameterizedProperty)(/*[in]*/long aIndex, /*[in]*/ long newVal);
|
||||
STDMETHOD(get_Char)(/*[out, retval]*/ unsigned char *pVal);
|
||||
STDMETHOD(put_Char)(/*[in]*/ unsigned char newVal);
|
||||
STDMETHOD(get_COMPtr)(/*[out, retval]*/ IUnknown* *pVal);
|
||||
STDMETHOD(put_COMPtr)(/*[in]*/ IUnknown* newVal);
|
||||
STDMETHOD(get_Variant)(/*[out, retval]*/ VARIANT *pVal);
|
||||
STDMETHOD(put_Variant)(/*[in]*/ VARIANT newVal);
|
||||
STDMETHOD(get_Boolean)(/*[out, retval]*/ BOOL *pVal);
|
||||
STDMETHOD(put_Boolean)(/*[in]*/ BOOL newVal);
|
||||
STDMETHOD(get_SCode)(/*[out, retval]*/ SCODE *pVal);
|
||||
STDMETHOD(put_SCode)(/*[in]*/ SCODE newVal);
|
||||
STDMETHOD(get_DispatchPtr)(/*[out, retval]*/ IDispatch* *pVal);
|
||||
STDMETHOD(put_DispatchPtr)(/*[in]*/ IDispatch* newVal);
|
||||
STDMETHOD(get_String)(/*[out, retval]*/ BSTR *pVal);
|
||||
STDMETHOD(put_String)(/*[in]*/ BSTR newVal);
|
||||
STDMETHOD(get_Date)(/*[out, retval]*/ DATE *pVal);
|
||||
STDMETHOD(put_Date)(/*[in]*/ DATE newVal);
|
||||
STDMETHOD(get_Currency)(/*[out, retval]*/ CURRENCY *pVal);
|
||||
STDMETHOD(put_Currency)(/*[in]*/ CURRENCY newVal);
|
||||
STDMETHOD(get_Double)(/*[out, retval]*/ double *pVal);
|
||||
STDMETHOD(put_Double)(/*[in]*/ double newVal);
|
||||
STDMETHOD(get_Float)(/*[out, retval]*/ float *pVal);
|
||||
STDMETHOD(put_Float)(/*[in]*/ float newVal);
|
||||
STDMETHOD(get_Long)(/*[out, retval]*/ long *pVal);
|
||||
STDMETHOD(put_Long)(/*[in]*/ long newVal);
|
||||
STDMETHOD(get_Short)(/*[out, retval]*/ short *pVal);
|
||||
STDMETHOD(put_Short)(/*[in]*/ short newVal);
|
||||
private:
|
||||
unsigned char mChar;
|
||||
CComPtr<IUnknown> mIUnknown;
|
||||
CComVariant mVariant;
|
||||
BOOL mBOOL;
|
||||
SCODE mSCode;
|
||||
CComPtr<IDispatch> mIDispatch;
|
||||
CComBSTR mBSTR;
|
||||
DATE mDATE;
|
||||
CURRENCY mCURRENCY;
|
||||
double mDouble;
|
||||
float mFloat;
|
||||
long mLong;
|
||||
short mShort;
|
||||
long * mParameterizedProperty;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTPROPERTIES_H__9E10C7AC_36AF_4A3A_91C7_2CFB9EB166A5__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestProperties.1 = s 'nsXPCDispTestProperties Class'
|
||||
{
|
||||
CLSID = s '{D8B4265B-1768-4CA9-A285-7CCAEEB51C74}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestProperties = s 'nsXPCDispTestProperties Class'
|
||||
{
|
||||
CLSID = s '{D8B4265B-1768-4CA9-A285-7CCAEEB51C74}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {D8B4265B-1768-4CA9-A285-7CCAEEB51C74} = s 'nsXPCDispTestProperties Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestProperties.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestProperties'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
// nsXPCDispTestScriptOff.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestScriptOff.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestScriptOff::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestScriptOff,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
// nsXPCDispTestScriptOff.h: Definition of the nsXPCDispTestScriptOff class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTSCRIPTOFF_H__EEC88DE0_F502_4893_9918_4E435DBC9815__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTSCRIPTOFF_H__EEC88DE0_F502_4893_9918_4E435DBC9815__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include <ATLCTL.H>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestScriptOff
|
||||
|
||||
class nsXPCDispTestScriptOff :
|
||||
public IDispatchImpl<nsIXPCDispTestScriptOff, &IID_nsIXPCDispTestScriptOff, &LIBID_IDispatchTestLib>,
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestScriptOff,&CLSID_nsXPCDispTestScriptOff>,
|
||||
public IObjectSafetyImpl<nsXPCDispTestScriptOff, 0>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestScriptOff() {}
|
||||
BEGIN_COM_MAP(nsXPCDispTestScriptOff)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestScriptOff)
|
||||
COM_INTERFACE_ENTRY(IObjectSafety)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispTestScriptOff)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestScriptOff)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestScriptOff
|
||||
public:
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTSCRIPTOFF_H__EEC88DE0_F502_4893_9918_4E435DBC9815__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestScriptOff.1 = s 'nsXPCDispTestScriptOff Class'
|
||||
{
|
||||
CLSID = s '{959CD122-9826-4757-BA09-DE327D55F9E7}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestScriptOff = s 'nsXPCDispTestScriptOff Class'
|
||||
{
|
||||
CLSID = s '{959CD122-9826-4757-BA09-DE327D55F9E7}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {959CD122-9826-4757-BA09-DE327D55F9E7} = s 'nsXPCDispTestScriptOff Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestScriptOff.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestScriptOff'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
// nsXPCDispTestScriptOn.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestScriptOn.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestScriptOn::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestScriptOn,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
nsXPCDispTestScriptOn::nsXPCDispTestScriptOn()
|
||||
{
|
||||
m_dwCurrentSafety = INTERFACESAFE_FOR_UNTRUSTED_CALLER |
|
||||
INTERFACESAFE_FOR_UNTRUSTED_DATA;
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
// nsXPCDispTestScriptOn.h: Definition of the nsXPCDispTestScriptOn class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTSCRIPTON_H__C037D462_C403_48FF_A02F_6C36544F0833__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTSCRIPTON_H__C037D462_C403_48FF_A02F_6C36544F0833__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
#include <ATLCTL.H>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestScriptOn
|
||||
|
||||
class nsXPCDispTestScriptOn :
|
||||
public IDispatchImpl<nsIXPCDispTestScriptOn, &IID_nsIXPCDispTestScriptOn, &LIBID_IDispatchTestLib>,
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestScriptOn,&CLSID_nsXPCDispTestScriptOn>,
|
||||
public IObjectSafetyImpl<nsXPCDispTestScriptOn,
|
||||
INTERFACESAFE_FOR_UNTRUSTED_CALLER |
|
||||
INTERFACESAFE_FOR_UNTRUSTED_DATA>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestScriptOn();
|
||||
BEGIN_COM_MAP(nsXPCDispTestScriptOn)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestScriptOn)
|
||||
COM_INTERFACE_ENTRY(IObjectSafety)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispTestScriptOn)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestScriptOn)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestScriptOn
|
||||
public:
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTSCRIPTON_H__C037D462_C403_48FF_A02F_6C36544F0833__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestScriptOn.1 = s 'nsXPCDispTestScriptOn Class'
|
||||
{
|
||||
CLSID = s '{2A06373F-3E61-4882-A3D7-A104F70B09ED}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestScriptOn = s 'nsXPCDispTestScriptOn Class'
|
||||
{
|
||||
CLSID = s '{2A06373F-3E61-4882-A3D7-A104F70B09ED}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {2A06373F-3E61-4882-A3D7-A104F70B09ED} = s 'nsXPCDispTestScriptOn Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestScriptOn.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestScriptOn'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
// nsXPCDispTestWrappedJS.cpp : Implementation of CXPCIDispatchTestApp and DLL registration.
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "XPCIDispatchTest.h"
|
||||
#include "nsXPCDispTestWrappedJS.h"
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
STDMETHODIMP nsXPCDispTestWrappedJS::InterfaceSupportsErrorInfo(REFIID riid)
|
||||
{
|
||||
static const IID* arr[] =
|
||||
{
|
||||
&IID_nsIXPCDispTestWrappedJS,
|
||||
};
|
||||
|
||||
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++)
|
||||
{
|
||||
if (InlineIsEqualGUID(*arr[i],riid))
|
||||
return S_OK;
|
||||
}
|
||||
return S_FALSE;
|
||||
}
|
||||
|
||||
struct TestData
|
||||
{
|
||||
typedef bool (*CompFunc)(const _variant_t & left, const _variant_t & right);
|
||||
TestData(const char * name, const _variant_t & value, CompFunc cf) :
|
||||
mName(name), mValue(value), mCompFunc(cf) {}
|
||||
const char * mName;
|
||||
_variant_t mValue;
|
||||
CompFunc mCompFunc;
|
||||
|
||||
};
|
||||
|
||||
bool CompareVariant(const _variant_t & left, const _variant_t & right)
|
||||
{
|
||||
return left == right;
|
||||
}
|
||||
|
||||
// These should be a template but VC++6 is brain dead in this area
|
||||
#define CompareFunction(type) \
|
||||
bool CompareVariant##type(const _variant_t & left, const _variant_t & right) \
|
||||
{ \
|
||||
return static_cast<type>(left) == static_cast<type>(right); \
|
||||
}
|
||||
|
||||
CompareFunction(long);
|
||||
CompareFunction(float);
|
||||
CompareFunction(double);
|
||||
CompareFunction(_bstr_t);
|
||||
|
||||
DISPID GetIDsOfNames(IDispatch * pIDispatch , char const * i_Method)
|
||||
{
|
||||
DISPID dispid;
|
||||
CComBSTR method(i_Method);
|
||||
OLECHAR * pMethod = method;
|
||||
HRESULT hresult = pIDispatch->GetIDsOfNames(
|
||||
IID_NULL,
|
||||
&pMethod,
|
||||
1,
|
||||
LOCALE_SYSTEM_DEFAULT,
|
||||
&dispid);
|
||||
if (!SUCCEEDED(hresult))
|
||||
{
|
||||
dispid = 0;
|
||||
}
|
||||
return dispid;
|
||||
}
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
inline
|
||||
_bstr_t ConvertVariantFromBSTR(_variant_t & variant)
|
||||
{
|
||||
VARIANT temp = variant;
|
||||
if (SUCCEEDED(VariantChangeType(&temp, &temp, 0, VT_BSTR)))
|
||||
{
|
||||
variant.Attach(temp);
|
||||
return static_cast<_bstr_t>(variant);
|
||||
}
|
||||
return "**Type Conversion failed";
|
||||
}
|
||||
|
||||
std::string DispInvoke(IDispatch * obj, const TestData & testData)
|
||||
{
|
||||
// Perform a put on the property
|
||||
ITypeInfo * pTypeInfo;
|
||||
obj->GetTypeInfo(0, LOCALE_SYSTEM_DEFAULT, &pTypeInfo);
|
||||
DISPID dispID = ::GetIDsOfNames(obj, testData.mName);
|
||||
DISPPARAMS dispParams;
|
||||
dispParams.cArgs = 1;
|
||||
dispParams.rgvarg = const_cast<VARIANT*>(&reinterpret_cast<const VARIANT&>(testData.mValue));
|
||||
dispParams.cNamedArgs = 1;
|
||||
DISPID propPut = DISPID_PROPERTYPUT;
|
||||
dispParams.rgdispidNamedArgs = &propPut;
|
||||
_variant_t result1;
|
||||
HRESULT hResult = obj->Invoke(dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYPUT, &dispParams, &result1, 0, 0);
|
||||
if (FAILED(hResult))
|
||||
{
|
||||
std::ostringstream msg;
|
||||
msg << "IDispatch::Invoke on " << testData.mName << " failed to set property with result " << hResult;
|
||||
return msg.str();
|
||||
}
|
||||
dispParams.cArgs = 1;
|
||||
dispParams.rgvarg = const_cast<VARIANT*>(&reinterpret_cast<const VARIANT&>(testData.mValue));
|
||||
dispParams.cNamedArgs = 0;
|
||||
dispParams.rgdispidNamedArgs = 0;
|
||||
_variant_t result2;
|
||||
hResult = obj->Invoke(dispID, IID_NULL, LOCALE_SYSTEM_DEFAULT, DISPATCH_PROPERTYGET, &dispParams, &result2, 0, 0);
|
||||
if (FAILED(hResult))
|
||||
{
|
||||
std::ostringstream msg;
|
||||
msg << "IDispatch::Invoke on " << testData.mName << " failed to retrieve property with result " << hResult;
|
||||
return msg.str();
|
||||
}
|
||||
if (!testData.mCompFunc(result2,testData.mValue))
|
||||
{
|
||||
std::ostringstream msg;
|
||||
VARIANT temp = testData.mValue;
|
||||
char const * const desired = SUCCEEDED(VariantChangeType(&temp, &temp, 0, VT_BSTR)) ? 0 : "**Conversion Failed";
|
||||
char const * const actual = SUCCEEDED(VariantChangeType(&result2, &result2, 0, VT_BSTR)) ? 0 : "**Conversion Failed";
|
||||
|
||||
msg << testData.mName << " ["
|
||||
<< (desired ? desired : static_cast<char const *>(static_cast<_bstr_t>(testData.mValue))) << "] ["
|
||||
<< (actual ? actual : static_cast<char const *>(static_cast<_bstr_t>(result2))) << "]";
|
||||
return msg.str();
|
||||
}
|
||||
return std::string();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
STDMETHODIMP nsXPCDispTestWrappedJS::TestParamTypes(IDispatch *obj, BSTR *errMsg)
|
||||
{
|
||||
CComPtr<IDispatch> ptr;
|
||||
CComBSTR progID("XPCIDispatchTest.nsXPCDispSimple.1");
|
||||
ptr.CoCreateInstance(progID);
|
||||
_variant_t dispatchPtr;
|
||||
dispatchPtr = static_cast<IDispatch*>(ptr);
|
||||
CURRENCY currency;
|
||||
currency.int64 = 55555;
|
||||
_variant_t date(3000.0, VT_DATE);
|
||||
_variant_t nullVariant;
|
||||
nullVariant.ChangeType(VT_NULL);
|
||||
const TestData tests[] =
|
||||
{
|
||||
TestData("Boolean", _variant_t(true), CompareVariant),
|
||||
TestData("Short", _variant_t(short(4200)), reinterpret_cast<TestData::CompFunc>(CompareVariantlong)),
|
||||
TestData("Long", _variant_t(long(-42000000)), CompareVariantlong),
|
||||
TestData("Float", _variant_t(float(4.5)), CompareVariantfloat),
|
||||
TestData("Double", _variant_t(-11111.11), CompareVariant),
|
||||
// TestData("Currency", _variant_t(currency), CompareVariantdouble),
|
||||
TestData("Date", date, CompareVariant_bstr_t),
|
||||
TestData("String", _variant_t("A String"), CompareVariant),
|
||||
TestData("DispatchPtr", dispatchPtr, CompareVariant),
|
||||
// TestData("SCode", _variant_t(long(5), VT_ERROR), CompareVariant_bstr_t),
|
||||
TestData("Variant", nullVariant, CompareVariant),
|
||||
TestData("Char", _variant_t(BYTE('x')), CompareVariant_bstr_t)
|
||||
};
|
||||
std::string errors;
|
||||
for (size_t index = 0; index < sizeof(tests) / sizeof(TestData); ++index)
|
||||
{
|
||||
std::string msg = DispInvoke(obj, tests[index]);
|
||||
if (!msg.empty())
|
||||
{
|
||||
errors += msg;
|
||||
errors += "\r\n";
|
||||
}
|
||||
}
|
||||
CComBSTR errorMsg(errors.c_str());
|
||||
*errMsg = errorMsg.Detach();
|
||||
return S_OK;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
// nsXPCDispTestWrappedJS.h: Definition of the nsXPCDispTestWrappedJS class
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_NSXPCDISPTESTWRAPPEDJS_H__DAAB3C99_1894_40C2_B12B_A360739F8977__INCLUDED_)
|
||||
#define AFX_NSXPCDISPTESTWRAPPEDJS_H__DAAB3C99_1894_40C2_B12B_A360739F8977__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// nsXPCDispTestWrappedJS
|
||||
|
||||
class nsXPCDispTestWrappedJS :
|
||||
public IDispatchImpl<nsIXPCDispTestWrappedJS, &IID_nsIXPCDispTestWrappedJS, &LIBID_IDispatchTestLib>,
|
||||
public ISupportErrorInfo,
|
||||
public CComObjectRoot,
|
||||
public CComCoClass<nsXPCDispTestWrappedJS,&CLSID_nsXPCDispTestWrappedJS>
|
||||
{
|
||||
public:
|
||||
nsXPCDispTestWrappedJS() {}
|
||||
BEGIN_CATEGORY_MAP(nsXPCDispTestWrappedJS)
|
||||
IMPLEMENTED_CATEGORY(CATID_SafeForScripting)
|
||||
END_CATEGORY_MAP()
|
||||
BEGIN_COM_MAP(nsXPCDispTestWrappedJS)
|
||||
COM_INTERFACE_ENTRY(IDispatch)
|
||||
COM_INTERFACE_ENTRY(nsIXPCDispTestWrappedJS)
|
||||
COM_INTERFACE_ENTRY(ISupportErrorInfo)
|
||||
END_COM_MAP()
|
||||
DECLARE_NOT_AGGREGATABLE(nsXPCDispTestWrappedJS)
|
||||
|
||||
DECLARE_REGISTRY_RESOURCEID(IDR_nsXPCDispTestWrappedJS)
|
||||
// ISupportsErrorInfo
|
||||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid);
|
||||
|
||||
// nsIXPCDispTestWrappedJS
|
||||
public:
|
||||
/**
|
||||
* This tests interacting with JS Objects via IDispatch
|
||||
* @param obj the object being tested
|
||||
* @param errMsg string receiving any error message, blank if no error
|
||||
*/
|
||||
STDMETHOD(TestParamTypes)(/*[in]*/ IDispatch * obj,
|
||||
/*[out]*/BSTR * errMsg);
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_NSXPCDISPTESTWRAPPEDJS_H__DAAB3C99_1894_40C2_B12B_A360739F8977__INCLUDED_)
|
||||
@@ -1,23 +0,0 @@
|
||||
HKCR
|
||||
{
|
||||
XPCIDispatchTest.nsXPCDispTestWrappedJS.1 = s 'nsXPCDispTestWrappedJS Class'
|
||||
{
|
||||
CLSID = s '{EAEE6BB2-C005-4B91-BCA7-6613236F6F69}'
|
||||
}
|
||||
XPCIDispatchTest.nsXPCDispTestWrappedJS = s 'nsXPCDispTestWrappedJS Class'
|
||||
{
|
||||
CLSID = s '{EAEE6BB2-C005-4B91-BCA7-6613236F6F69}'
|
||||
}
|
||||
NoRemove CLSID
|
||||
{
|
||||
ForceRemove {EAEE6BB2-C005-4B91-BCA7-6613236F6F69} = s 'nsXPCDispTestWrappedJS Class'
|
||||
{
|
||||
ProgID = s 'XPCIDispatchTest.nsXPCDispTestWrappedJS.1'
|
||||
VersionIndependentProgID = s 'XPCIDispatchTest.nsXPCDispTestWrappedJS'
|
||||
InprocServer32 = s '%MODULE%'
|
||||
{
|
||||
val ThreadingModel = s 'both'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by XPCIDispatchTest.rc
|
||||
//
|
||||
#define IDS_PROJNAME 100
|
||||
#define IDS_NSXPCDISPTTESTMETHODS_DESC 101
|
||||
#define IDR_nsXPCDisptTestMethods 102
|
||||
#define IDS_NSXPCDISPTESTMETHODS_DESC 103
|
||||
#define IDR_nsXPCDispTestMethods 104
|
||||
#define IDS_NSXPCDISPSIMPLE_DESC 105
|
||||
#define IDR_nsXPCDispSimple 106
|
||||
#define IDS_NSXPCDISPTESTNOIDISPATCH_DESC 107
|
||||
#define IDR_nsXPCDispTestNoIDispatch 108
|
||||
#define IDS_NSXPCDISPTESTNOSCRIPT_DESC 109
|
||||
#define IDR_nsXPCDispTestNoScript 110
|
||||
#define IDS_NSXPCDISPTESTPROPERTIES_DESC 111
|
||||
#define IDR_nsXPCDispTestProperties 112
|
||||
#define IDS_NSXPCDISPTESTARRAYS_DESC 113
|
||||
#define IDR_nsXPCDispTestArrays 114
|
||||
#define IDS_NSXPCDISPTESTSCRIPTON_DESC 115
|
||||
#define IDR_nsXPCDispTestScriptOn 116
|
||||
#define IDS_NSXPCDISPTESTSCRIPTOFF_DESC 117
|
||||
#define IDR_nsXPCDispTestScriptOff 118
|
||||
#define IDS_NSXPCDISPTESTWRAPPEDJS_DESC 119
|
||||
#define IDR_nsXPCDispTestWrappedJS 120
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 204
|
||||
#define _APS_NEXT_COMMAND_VALUE 32768
|
||||
#define _APS_NEXT_CONTROL_VALUE 201
|
||||
#define _APS_NEXT_SYMED_VALUE 121
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,54 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Verify that we can access but not overwrite the values of read-only
|
||||
* attributes.
|
||||
*/
|
||||
|
||||
test();
|
||||
|
||||
function test()
|
||||
{
|
||||
printStatus("Testing arrays");
|
||||
var obj = COMObject(CLSID_nsXPCDispTestArrays);
|
||||
var anArray = [ 0, 1, 2, 3];
|
||||
obj.TakesSafeArray(anArray);
|
||||
var strArray = [ "0", "1", "2", "3"];
|
||||
obj.TakesSafeArrayBSTR(strArray);
|
||||
return 0;
|
||||
}
|
||||
@@ -1,150 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* \file XPCIDispatchAttributeTests.js
|
||||
* Test IDispatch properties and also type conversion
|
||||
*/
|
||||
|
||||
try
|
||||
{
|
||||
// Test object used to test IDispatch property.
|
||||
testObject = { one : 1, two : 2, three : 'three' };
|
||||
test();
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Unhandled exception encountered: " + e.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* Main function to perform test
|
||||
*/
|
||||
function test()
|
||||
{
|
||||
printStatus("Read-Write Attributes");
|
||||
|
||||
/*
|
||||
* These values come from xpctest_attributes.idl and xpctest_attributes.cpp
|
||||
*/
|
||||
|
||||
o = COMObject(CLSID_nsXPCDispTestProperties);
|
||||
|
||||
// Check the class an interface to make sure they're ok
|
||||
reportCompare(
|
||||
"object",
|
||||
typeof o,
|
||||
"typeof COMObject(CLSID_nsXPCDispTestProperties)");
|
||||
// Make sure we can read the values
|
||||
testProperty("o.Boolean", ["true", "1","testObject", "'T'", "'F'", "'true'","'false'"], false);
|
||||
testProperty("o.Char", ["32"], true);
|
||||
testProperty("o.COMPtr", ["0"], true);
|
||||
testProperty("o.Currency", ["0", "0.5", "10000.00"], true);
|
||||
testProperty("o.Date", ["'04/01/03'"], false);
|
||||
testProperty("o.DispatchPtr", ["testObject"], false);
|
||||
testProperty("o.Double", ["5.555555555555555555555", "5.555555555555555555555", "5", "-5"], true);
|
||||
testProperty("o.Float", ["-5.55555555", "5.5555555", "5", "-5"], true);
|
||||
testProperty("o.Long", ["-5", "1073741823", "-1073741824", "1073741824", "-1073741825", "5.5"], true);
|
||||
testProperty("o.SCode", ["5"], true);
|
||||
testProperty("o.Short", ["5", "-5", "32767", "-32768"], true);
|
||||
testProperty("o.String", ["'A String'", "'c'", "5", "true"], false);
|
||||
testProperty("o.Variant", ["'A Variant String'", "testObject", "10", "5.5"], false);
|
||||
|
||||
// Parameterized property tests
|
||||
for (index = 0; index < o.ParameterizedPropertyCount; ++index)
|
||||
compareExpression(
|
||||
"o.ParameterizedProperty(index)",
|
||||
index + 1,
|
||||
"Reading initial value from parameterized property " + index);
|
||||
for (index = 0; index < o.ParameterizedPropertyCount; ++index)
|
||||
compareExpression(
|
||||
"o.ParameterizedProperty(index) = index + 5",
|
||||
index + 5,
|
||||
"Assigning parameterized property " + index);
|
||||
|
||||
for (index = 0; index < o.ParameterizedPropertyCount; ++index)
|
||||
compareExpression(
|
||||
"o.ParameterizedProperty(index)",
|
||||
index + 5,
|
||||
"Reading new value from parameterized property " + index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests retrieving a value from a property and setting multiple values on
|
||||
* the property
|
||||
*/
|
||||
function testProperty(propertyExpression, values, tryString)
|
||||
{
|
||||
print(propertyExpression);
|
||||
try
|
||||
{
|
||||
reportCompare(
|
||||
eval(propertyExpression),
|
||||
eval(propertyExpression),
|
||||
propertyExpression);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing initial value of " + propertyExpression + " Exception: " + e.toString());
|
||||
}
|
||||
for (i = 0; i < values.length; ++i)
|
||||
{
|
||||
var value = values[i];
|
||||
var expression = propertyExpression + "=" + value;
|
||||
print(expression);
|
||||
try
|
||||
{
|
||||
reportCompare(
|
||||
eval(expression),
|
||||
eval(value),
|
||||
expression);
|
||||
if (tryString)
|
||||
{
|
||||
expression = propertyExpression + "='" + value + "'";
|
||||
print(expression);
|
||||
reportCompare(
|
||||
eval(expression),
|
||||
eval("'" + value + "'"),
|
||||
expression);
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing assignment: " + expression + " Exception: " + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,122 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Verify that we can access but not overwrite the values of read-only
|
||||
* attributes.
|
||||
*/
|
||||
|
||||
test();
|
||||
|
||||
function testInstantiate(name, id, scriptable, methods)
|
||||
{
|
||||
var IDISPATCH_TEXT = "[xpconnect wrapped IDispatch";
|
||||
var obj = COMObject(id);
|
||||
var value = obj.toString().substr(0, IDISPATCH_TEXT.length);
|
||||
reportCompare(
|
||||
IDISPATCH_TEXT,
|
||||
value,
|
||||
"var obj = COMObject(" + id + ");");
|
||||
try
|
||||
{
|
||||
obj = COMObject(id);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
if (scriptable)
|
||||
{
|
||||
reportFailure("COMObject('" + id + "') generated an exception");
|
||||
}
|
||||
return;
|
||||
}
|
||||
value = obj.toString().substr(0, IDISPATCH_TEXT.length);
|
||||
reportCompare(
|
||||
scriptable ? IDISPATCH_TEXT : undefined,
|
||||
scriptable ? value : obj,
|
||||
"var obj = COMObject(" + id + ");");
|
||||
}
|
||||
|
||||
function testEnumeration(compInfo)
|
||||
{
|
||||
var obj = COMObject(compInfo.cid);
|
||||
compareObject(obj, compInfo, "Enumeration Test");
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
printStatus("Instantiation Tests - " + objectsDesc.length + " objects to test");
|
||||
for (index = 0; index < objectsDesc.length; ++index)
|
||||
{
|
||||
compInfo = objectsDesc[index];
|
||||
printStatus("Testing " + compInfo.name);
|
||||
testInstantiate(compInfo.name, compInfo.cid, compInfo.scriptable);
|
||||
testInstantiate(compInfo.name, compInfo.progid, compInfo.scriptable);
|
||||
}
|
||||
// Test a non-existant COM object
|
||||
var obj;
|
||||
try
|
||||
{
|
||||
obj = COMObject("dwbnonexistantobject");
|
||||
printFailure("var obj = COMObject('dwbnonexistantobject'); did not throw an exception");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
}
|
||||
try
|
||||
{
|
||||
obj = COMObject("dwbnonexistantobject");
|
||||
printFailure("obj = COMObject('dwbnonexistantobject'); did not throw an exception");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
}
|
||||
printStatus("Enumeration Tests - testing " + objectsDesc.length + " objects");
|
||||
for (var index = 0; index < objectsDesc.length; ++index)
|
||||
{
|
||||
printStatus("Enumerating " + objectsDesc[index].name);
|
||||
testEnumeration(objectsDesc[index]);
|
||||
}
|
||||
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Unhandled exception occured:" + e.toString());
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Make repeated calls so GC kicks in and we can check for memory leaks.
|
||||
*/
|
||||
|
||||
test();
|
||||
|
||||
function test()
|
||||
{
|
||||
printStatus("Stress testing");
|
||||
for (index = 0; index < 10000; ++index)
|
||||
{
|
||||
for (x = 0; x < objectsDesc.length; ++x)
|
||||
{
|
||||
var obj = COMObject(objectsDesc[x].cid);
|
||||
for (prop in obj)
|
||||
{
|
||||
print(index + ":" +objectsDesc[x].name + ":" + prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,376 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* Verify that we can access but not overwrite the values of read-only
|
||||
* attributes.
|
||||
*/
|
||||
|
||||
test();
|
||||
|
||||
function TestOutMethod(obj, method, value)
|
||||
{
|
||||
printDebug("TestOutMethod - " + method);
|
||||
var x = new Object();
|
||||
try
|
||||
{
|
||||
obj[method](x);
|
||||
reportCompare(value, x.value, "Testing output parameter: " + method);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing output parameter failed: " + method + ": " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
function TestReturnMethod(obj, method, value)
|
||||
{
|
||||
printDebug("TestReturnMethod - " + method);
|
||||
try
|
||||
{
|
||||
reportCompare(value, obj[method](), "Testing output parameter: " + method);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing return value failed: " + method + ": " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
function TestInputMethod(obj, method, value)
|
||||
{
|
||||
printDebug("TestInputMethod - " + method);
|
||||
try
|
||||
{
|
||||
obj[method.toLowerCase()](value);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing input parameter failed: " + method + ": " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
function TestInOutMethod(obj, method, inValue, outValue)
|
||||
{
|
||||
printDebug("TestInOutMethod - " + method);
|
||||
try
|
||||
{
|
||||
var param = { value : inValue };
|
||||
obj[method](param);
|
||||
reportCompare(outValue, param.value, "Testing in/out parameter: " + method);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing in/out parameter failed: " + method + ": " + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
function test()
|
||||
{
|
||||
printStatus("Testing methods");
|
||||
var obj = COMObject(CLSID_nsXPCDispTestMethods);
|
||||
try
|
||||
{
|
||||
obj.NoParameters();
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("NoParameters failed: " + e.toString());
|
||||
}
|
||||
printStatus("Test method - Return values");
|
||||
TestReturnMethod(obj, "ReturnBSTR", "Boo");
|
||||
TestReturnMethod(obj, "ReturnI4",99999);
|
||||
TestReturnMethod(obj, "ReturnUI1", 99);
|
||||
TestReturnMethod(obj, "ReturnI2",9999);
|
||||
TestReturnMethod(obj, "ReturnR4",99999.1);
|
||||
TestReturnMethod(obj, "ReturnR8", 99999999999.99);
|
||||
TestReturnMethod(obj, "ReturnBool", true);
|
||||
|
||||
printStatus("TestReturnMethod - ReturnIDispatch");
|
||||
compareObject(obj.ReturnIDispatch(), nsXPCDispSimpleDesc, "Test method - Return IDispatch");
|
||||
var E_FAIL= -2147467259;
|
||||
TestReturnMethod(obj, "ReturnError", E_FAIL);
|
||||
TestReturnMethod(obj, "ReturnDate", "5/2/2002");
|
||||
// TestReturnMethod(obj, ReturnIUnknown(IUnknown * * result)
|
||||
TestReturnMethod(obj, "ReturnI1", 120);
|
||||
TestReturnMethod(obj, "ReturnUI2", 9999);
|
||||
TestReturnMethod(obj, "ReturnUI4", 3000000000);
|
||||
TestReturnMethod(obj, "ReturnInt", -999999);
|
||||
TestReturnMethod(obj, "ReturnUInt", 3000000000);
|
||||
|
||||
printStatus("Test method - Input params");
|
||||
TestInputMethod(obj, "TakesBSTR", "TakesBSTR");
|
||||
TestInputMethod(obj, "TakesI4", 999999);
|
||||
TestInputMethod(obj, "TakesUI1", 42);
|
||||
TestInputMethod(obj, "TakesI2", 32000);
|
||||
TestInputMethod(obj, "TakesR4", 99999.99);
|
||||
TestInputMethod(obj, "TakesR8", 999999999.99);
|
||||
TestInputMethod(obj, "TakesBool", true);
|
||||
var x = { Number : 5, ClassName : "nsXPCDispSimple" };
|
||||
TestInputMethod(obj, "TakesIDispatch", x);
|
||||
// This would always fail, type mismatch (no way to indicate this is going
|
||||
// to an error, and there's no automatic conversion from integers to error
|
||||
// codes
|
||||
// TestInputMethod(obj, "TakesError", E_FAIL);
|
||||
TestInputMethod(obj, "TakesDate", "5/2/2002");
|
||||
// TestInputMethod(obj, TakesIUnknown, );
|
||||
TestInputMethod(obj, "TakesI1", 42);
|
||||
TestInputMethod(obj, "TakesUI2", 50000);
|
||||
TestInputMethod(obj, "TakesUI4", 4026531840);
|
||||
TestInputMethod(obj, "TakesInt", -10000000);
|
||||
TestInputMethod(obj, "TakesUInt", 3758096384);
|
||||
|
||||
printStatus("Test method - Output params");
|
||||
TestOutMethod(obj, "OutputsBSTR", "Boo");
|
||||
TestOutMethod(obj, "OutputsI4",99999);
|
||||
TestOutMethod(obj, "OutputsUI1", 99);
|
||||
TestOutMethod(obj, "OutputsI2",9999);
|
||||
TestOutMethod(obj, "OutputsR4",999999.1);
|
||||
TestOutMethod(obj, "OutputsR8", 99999999999.99);
|
||||
TestOutMethod(obj, "OutputsBool", true);
|
||||
|
||||
var outParam = new Object();
|
||||
obj.OutputsIDispatch(outParam);
|
||||
compareObject(outParam.value, nsXPCDispSimpleDesc, "Test method - Output params");
|
||||
TestOutMethod(obj, "OutputsError", E_FAIL);
|
||||
TestOutMethod(obj, "OutputsDate", "5/2/2002");
|
||||
// TestOutMethod(obj, OutputsIUnknown(IUnknown * * result)
|
||||
TestOutMethod(obj, "OutputsI1", 120);
|
||||
TestOutMethod(obj, "OutputsUI2", 9999);
|
||||
TestOutMethod(obj, "OutputsUI4", 3000000000);
|
||||
|
||||
printStatus("Test method - In/out params");
|
||||
TestInOutMethod(obj, "InOutsBSTR", "String", "StringAppended");
|
||||
TestInOutMethod(obj, "InOutsI4", 2000000, -2000000);
|
||||
TestInOutMethod(obj, "InOutsUI1", 50, 8);
|
||||
TestInOutMethod(obj, "InOutsI2", -1000, 9000);
|
||||
TestInOutMethod(obj, "InOutsR4", -2.05, 3.0);
|
||||
TestInOutMethod(obj, "InOutsR8", -5.5, 49999994.50000005);
|
||||
TestInOutMethod(obj, "InOutsBool", true, false);
|
||||
TestInOutMethod(obj, "InOutsBool", false, true);
|
||||
var inoutParam = { value : {ClassName : "InOutTest", Number : 10 } };
|
||||
try
|
||||
{
|
||||
obj.InOutsIDispatch(inoutParam);
|
||||
if (inoutParam.value.Number != 15)
|
||||
reportFailure("Testing in/out parameter failed: IDispatch");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing in/out parameter failed: IDispatch - " + e.toString());
|
||||
}
|
||||
// See the TakesError case
|
||||
//TestInOutMethod(obj, "InOutsError", E_FAIL, E_FAIL + 1);
|
||||
TestInOutMethod(obj, "InOutsDate", "5/23/2001", "5/24/2001");
|
||||
//TestInOutMethod(obj, InOutsIUnknown(IUnknown * * result)
|
||||
TestInOutMethod(obj, "InOutsI1", -42, -41);
|
||||
TestInOutMethod(obj, "InOutsUI2", 43, 85);
|
||||
TestInOutMethod(obj, "InOutsUI4", 88, 46);
|
||||
|
||||
try
|
||||
{
|
||||
reportCompare(obj.OneParameterWithReturn(-20), 22, "Testing OneParameterWithReturn");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing OneParameterWithReturn: " + e.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
reportCompare(obj.StringInputAndReturn("A String "), "A String Appended", "Testing StringInputAndReturn");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing StringInputAndReturn: " + e.toString());
|
||||
}
|
||||
try
|
||||
{
|
||||
var inoutIDispatch = { className : "inouttest", Number : 5 };
|
||||
var result = obj.IDispatchInputAndReturn(inoutIDispatch);
|
||||
reportCompare(81, result.Number, "IDispatchInputAndReturn");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing IDispatchInputAndReturn: " + e.toString());
|
||||
}
|
||||
try
|
||||
{
|
||||
obj.TwoParameters(1, 2);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwoParameters: " + e.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
obj.TwelveInParameters(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwelveInParameters: " + e.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var out1 = new Object();
|
||||
var out2 = new Object();
|
||||
var out3 = new Object();
|
||||
var out4 = new Object();
|
||||
var out5 = new Object();
|
||||
var out6 = new Object();
|
||||
var out7 = new Object();
|
||||
var out8 = new Object();
|
||||
var out9 = new Object();
|
||||
var out10 = new Object();
|
||||
var out11 = new Object();
|
||||
var out12 = new Object();
|
||||
obj.TwelveOutParameters(out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12);
|
||||
reportCompare(78, out1.value + out2.value + out3.value + out4.value + out5.value + out6.value + out7.value + out8.value + out9.value + out10.value + out11.value + out12.value, "Testing TwelveOutParameters");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwelveOutParameters: " + e.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
obj.TwelveStrings("one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwelveStrings: " + e.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var out1 = new Object();
|
||||
var out2 = new Object();
|
||||
var out3 = new Object();
|
||||
var out4 = new Object();
|
||||
var out5 = new Object();
|
||||
var out6 = new Object();
|
||||
var out7 = new Object();
|
||||
var out8 = new Object();
|
||||
var out9 = new Object();
|
||||
var out10 = new Object();
|
||||
var out11 = new Object();
|
||||
var out12 = new Object();
|
||||
obj.TwelveOutStrings(out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12);
|
||||
reportCompare(true, out1.value == "one" && out2.value == "two" &&
|
||||
out3.value == "three" && out4.value == "four" &&
|
||||
out5.value == "five" && out6.value == "six" &&
|
||||
out7.value == "seven" && out8.value == "eight" &&
|
||||
out9.value == "nine" && out10.value == "ten" &&
|
||||
out11.value == "eleven" && out12.value == "twelve",
|
||||
"Testing TwelveOutString");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwelveOutParameters: " + e.toString());
|
||||
}
|
||||
try
|
||||
{
|
||||
var out1 = { className : "out1", Number : 5 };
|
||||
var out2 = { className : "out2", Number : 5 };
|
||||
var out3 = { className : "out3", Number : 5 };
|
||||
var out4 = { className : "out4", Number : 5 };
|
||||
var out5 = { className : "out5", Number : 5 };
|
||||
var out6 = { className : "out6", Number : 5 };
|
||||
var out7 = { className : "out7", Number : 5 };
|
||||
var out8 = { className : "out8", Number : 5 };
|
||||
var out9 = { className : "out9", Number : 5 };
|
||||
var out10 = { className : "out10", Number : 5 };
|
||||
var out11 = { className : "out11", Number : 5 };
|
||||
var out12 = { className : "out12", Number : 5 };
|
||||
obj.TwelveIDispatch(out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwelveIDispatch: " + e.toString());
|
||||
}
|
||||
try
|
||||
{
|
||||
var out1 = new Object();
|
||||
var out2 = new Object();
|
||||
var out3 = new Object();
|
||||
var out4 = new Object();
|
||||
var out5 = new Object();
|
||||
var out6 = new Object();
|
||||
var out7 = new Object();
|
||||
var out8 = new Object();
|
||||
var out9 = new Object();
|
||||
var out10 = new Object();
|
||||
var out11 = new Object();
|
||||
var out12 = new Object();
|
||||
obj.TwelveOutIDispatch(out1, out2, out3, out4, out5, out6, out7, out8, out9, out10, out11, out12);
|
||||
print("out1.value" + out1.value.Number);
|
||||
reportCompare(true, out1.value.Number == 5 && out2.value.Number == 5 &&
|
||||
out3.value.Number == 5 && out4.value.Number == 5 &&
|
||||
out5.value.Number == 5 && out6.value.Number == 5 &&
|
||||
out7.value.Number == 5 && out8.value.Number == 5 &&
|
||||
out9.value.Number == 5 && out10.value.Number == 5 &&
|
||||
out11.value.Number == 5 && out12.value.Number == 5,
|
||||
"Testing TwelveOutIDispatch");
|
||||
compareObject(out1.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out1");
|
||||
compareObject(out2.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out2");
|
||||
compareObject(out3.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out3");
|
||||
compareObject(out4.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out4");
|
||||
compareObject(out5.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out5");
|
||||
compareObject(out6.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out6");
|
||||
compareObject(out7.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out7");
|
||||
compareObject(out8.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out8");
|
||||
compareObject(out9.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out9");
|
||||
compareObject(out10.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out10");
|
||||
compareObject(out11.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out11");
|
||||
compareObject(out12.value, nsXPCDispSimpleDesc, "Testing TwelveOutParameters - out12");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure("Testing TwelveOutIDispatch: " + e.toString());
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
obj.CreateError();
|
||||
reportFailure("Testing CreateError: Didn't generate a catchable exception");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportCompare(true, e.toString().search("CreateError Test") != -1, "Testing CreateError");
|
||||
}
|
||||
}
|
||||
@@ -1,361 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; 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 Communicator client code, released March
|
||||
* 31, 1998.
|
||||
*
|
||||
* 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):
|
||||
* Rob Ginda rginda@netscape.com
|
||||
*/
|
||||
|
||||
FAILED = "FAILED!: ";
|
||||
STATUS = "STATUS: ";
|
||||
BUGNUMBER = "BUGNUMBER: ";
|
||||
DEBUGLINE = "DEBUG: ";
|
||||
|
||||
DEBUG = false;
|
||||
VERBOSE = false;
|
||||
|
||||
var CLSID_nsXPCDispSimple = "{9F39237C-D179-4260-8EF3-4B6D4D7D5570}";
|
||||
var ProgID_nsXPCDispSimple = "XPCIDispatchTest.nsXPCDispSimple.1";
|
||||
var nsXPCDispSimpleDesc =
|
||||
{
|
||||
name : "nsXPCDispSimple",
|
||||
cid : CLSID_nsXPCDispSimple,
|
||||
progid : ProgID_nsXPCDispSimple,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"ClassName",
|
||||
"Number"
|
||||
]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestMethods = "{745D1149-9F46-418C-B176-71EAA98974BA}";
|
||||
var ProgID_nsXPCDispTestMethods = "XPCIDispatchTest.nsXPCDispTestMethods.1";
|
||||
var nsXPCDispTestMethodsDesc =
|
||||
{
|
||||
name : "nsXPCDispTestMethods",
|
||||
cid : CLSID_nsXPCDispTestMethods,
|
||||
progid : ProgID_nsXPCDispTestMethods,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"NoParameters", "ReturnBSTR", "ReturnI4",
|
||||
"ReturnUI1", "ReturnI2", "ReturnR4", "ReturnR8", "ReturnBool",
|
||||
"ReturnIDispatch", "ReturnError", "ReturnDate",
|
||||
"ReturnIUnknown", "ReturnI1", "ReturnUI2", "ReturnUI4",
|
||||
"ReturnInt", "ReturnUInt", "TakesBSTR", "TakesI4", "TakesUI1",
|
||||
"TakesI2", "TakesR4", "TakesR8", "TakesBool",
|
||||
"TakesIDispatch", "TakesError", "TakesDate", "TakesIUnknown",
|
||||
"TakesI1", "TakesUI2", "TakesUI4", "TakesInt", "TakesUInt",
|
||||
"OutputsBSTR", "OutputsI4", "OutputsUI1", "OutputsI2",
|
||||
"OutputsR4", "OutputsR8", "OutputsBool", "OutputsIDispatch",
|
||||
"OutputsError", "OutputsDate", "OutputsIUnknown", "OutputsI1",
|
||||
"OutputsUI2", "OutputsUI4", "InOutsBSTR", "InOutsI4",
|
||||
"InOutsUI1", "InOutsI2", "InOutsR4", "InOutsR8", "InOutsBool",
|
||||
"InOutsIDispatch", "InOutsError", "InOutsDate",
|
||||
"InOutsIUnknown", "InOutsI1", "InOutsUI2", "InOutsUI4",
|
||||
"InOutsInt", "InOutsUInt", "OneParameterWithReturn",
|
||||
"StringInputAndReturn", "IDispatchInputAndReturn",
|
||||
"TwoParameters", "TwelveInParameters", "TwelveOutParameters",
|
||||
"TwelveStrings", "TwelveOutStrings", "TwelveIDispatch",
|
||||
"TwelveOutIDispatch", "CreateError"
|
||||
]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestArrays = "{AB085C43-C619-48C8-B68C-C495BDE12DFB}";
|
||||
var ProgID_nsXPCDispTestArrays = "XPCIDispatchTest.nsXPCDispTestArrays.1";
|
||||
var nsXPCDispTestArraysDesc =
|
||||
{
|
||||
name : "nsXPCDispTestArrays",
|
||||
cid : CLSID_nsXPCDispTestArrays,
|
||||
progid : ProgID_nsXPCDispTestArrays,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"ReturnSafeArray", "ReturnSafeArrayBSTR", "ReturnSafeArrayIDispatch",
|
||||
"TakesSafeArray", "TakesSafeArrayBSTR", "TakesSafeArrayIDispatch",
|
||||
"InOutSafeArray", "InOutSafeArrayBSTR", "InOutSafeArrayIDispatch"
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
var CLSID_nsXPCDispTestNoIDispatch = "{7414404F-A4CC-4E3C-9B32-BB20CB22F541}";
|
||||
var ProgID_nsXPCDispTestNoIDispatch = "XPCIDispatchTest.nsXPCDispTestNoIDispatch.1";
|
||||
|
||||
var CLSID_nsXPCDispTestNoScript = "{F8D54F00-4FC4-4731-B467-10F1CB8DB0AD}";
|
||||
var ProgID_nsXPCDispTestNoScript = "XPCIDispatchTest.nsXPCDispTestNoScript.1";
|
||||
|
||||
var CLSID_nsXPCDispTestProperties = "{D8B4265B-1768-4CA9-A285-7CCAEEB51C74}";
|
||||
var ProgID_nsXPCDispTestProperties = "XPCIDispatchTest.nsXPCDispTestProperties.1";
|
||||
var nsXPCDispTestPropertiesDesc =
|
||||
{
|
||||
name : "nsXPCDispTestProperties",
|
||||
cid : CLSID_nsXPCDispTestProperties,
|
||||
progid : ProgID_nsXPCDispTestProperties,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"Short", "Long", "Float", "Double", "Currency",
|
||||
"Date", "String", "DispatchPtr", "SCode", "Boolean", "Variant",
|
||||
"COMPtr", "Char"
|
||||
]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestScriptOn = "{2A06373F-3E61-4882-A3D7-A104F70B09ED}";
|
||||
var ProgID_nsXPCDispTestScriptOn = "XPCIDispatchTest.nsXPCDispTestScriptOn.1";
|
||||
var nsXPCDispTestScriptOnDesc =
|
||||
{
|
||||
name : "nsXPCDispTestScriptOn",
|
||||
cid : CLSID_nsXPCDispTestScriptOn,
|
||||
progid : ProgID_nsXPCDispTestScriptOn,
|
||||
scriptable : true,
|
||||
methods : [ ]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestScriptOff = "{959CD122-9826-4757-BA09-DE327D55F9E7}";
|
||||
var ProgID_nsXPCDispTestScriptOff = "XPCIDispatchTest.nsXPCDispTestScriptOff.1";
|
||||
var nsXPCDispTestScriptOffDesc =
|
||||
{
|
||||
name : "nsXPCDispTestScriptOff",
|
||||
cid : CLSID_nsXPCDispTestScriptOff,
|
||||
progid : ProgID_nsXPCDispTestScriptOff,
|
||||
scriptable : false,
|
||||
methods : [ ]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestWrappedJS = "{EAEE6BB2-C005-4B91-BCA7-6613236F6F69}";
|
||||
var ProgID_nsXPCDispTestWrappedJS = "XPCIDispatchTest.nsXPCDispTestWrappedJS.1";
|
||||
var nsXPCDispTestWrappedJSDesc =
|
||||
{
|
||||
name : "nsXPCDispTestWrappedJS",
|
||||
cid : CLSID_nsXPCDispTestWrappedJS,
|
||||
progid : ProgID_nsXPCDispTestWrappedJS,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"TestParamTypes"
|
||||
]
|
||||
};
|
||||
|
||||
// create list of COM components
|
||||
var objectsDesc =
|
||||
[
|
||||
nsXPCDispSimpleDesc,
|
||||
nsXPCDispTestMethodsDesc,
|
||||
nsXPCDispTestArraysDesc,
|
||||
nsXPCDispTestPropertiesDesc,
|
||||
nsXPCDispTestScriptOnDesc,
|
||||
nsXPCDispTestScriptOffDesc,
|
||||
nsXPCDispTestWrappedJSDesc
|
||||
];
|
||||
|
||||
function findProp(prop, array, marked)
|
||||
{
|
||||
len = array.length;
|
||||
for (index = 0; index < len; ++index)
|
||||
{
|
||||
if (prop == array[index])
|
||||
{
|
||||
marked[index] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function compareObject(obj, objDesc, testName)
|
||||
{
|
||||
if (obj == undefined)
|
||||
{
|
||||
reportFailure("compareObject passed an invalid object");
|
||||
return;
|
||||
}
|
||||
var marked = new Array();
|
||||
for (prop in obj)
|
||||
{
|
||||
printDebug("Found " + prop);
|
||||
reportCompare(
|
||||
true,
|
||||
findProp(prop, objDesc.methods, marked),
|
||||
testName + ": " + prop + " exists on " + objDesc.name + ", but was not expected");
|
||||
}
|
||||
len = objDesc.methods.length;
|
||||
for (var index = 0; index < len; ++index)
|
||||
{
|
||||
reportCompare(
|
||||
true,
|
||||
marked[index],
|
||||
testName + ": " + objDesc.methods[index] + " does not exist on " + objDesc.name);
|
||||
}
|
||||
}
|
||||
|
||||
function compareExpression(expression, expectedResult, testName)
|
||||
{
|
||||
if (VERBOSE && (typeof testName != "undefined"))
|
||||
printStatus(testName + " - evaluating:" + expression);
|
||||
|
||||
try
|
||||
{
|
||||
reportCompare(
|
||||
expectedResult,
|
||||
eval(expression),
|
||||
testName);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure(expression + " generated the following exception:" + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
var callStack = new Array();
|
||||
|
||||
/*
|
||||
* Report a failure in the 'accepted' manner
|
||||
*/
|
||||
function reportFailure (msg)
|
||||
{
|
||||
var lines = msg.split ("\n");
|
||||
var l;
|
||||
var funcName = currentFunc();
|
||||
var prefix = (funcName) ? "[reported from " + funcName + "] ": "";
|
||||
|
||||
for (var i=0; i<lines.length; i++)
|
||||
print (FAILED + prefix + lines[i]);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a non-failure message.
|
||||
*/
|
||||
function printDebug (msg)
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
var lines = msg.split ("\n");
|
||||
var l;
|
||||
|
||||
for (var i=0; i<lines.length; i++)
|
||||
print (DEBUGLINE + lines[i]);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Print a non-failure message.
|
||||
*/
|
||||
function printStatus (msg)
|
||||
{
|
||||
var lines = msg.split ("\n");
|
||||
var l;
|
||||
|
||||
for (var i=0; i<lines.length; i++)
|
||||
print (STATUS + lines[i]);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a bugnumber message.
|
||||
*/
|
||||
function printBugNumber (num)
|
||||
{
|
||||
|
||||
print (BUGNUMBER + num);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare expected result to actual result, if they differ (in value and/or
|
||||
* type) report a failure. If description is provided, include it in the
|
||||
* failure report.
|
||||
*/
|
||||
function reportCompare (expected, actual, description)
|
||||
{
|
||||
var expected_t = typeof expected;
|
||||
var actual_t = typeof actual;
|
||||
var output = "";
|
||||
|
||||
if ((VERBOSE) && (typeof description != "undefined"))
|
||||
printStatus ("Comparing '" + description + "'");
|
||||
|
||||
if (expected_t != actual_t)
|
||||
output += "Type mismatch, expected type " + expected_t +
|
||||
", actual type " + actual_t + "\n";
|
||||
else if (VERBOSE)
|
||||
printStatus ("Expected type '" + actual_t + "' matched actual " +
|
||||
"type '" + expected_t + "'");
|
||||
|
||||
if (expected != actual)
|
||||
output += "Expected value '" + expected + "', Actual value '" + actual +
|
||||
"'\n";
|
||||
else if (VERBOSE)
|
||||
printStatus ("Expected value '" + actual + "' matched actual " +
|
||||
"value '" + expected + "'");
|
||||
|
||||
if (output != "")
|
||||
{
|
||||
if (typeof description != "undefined")
|
||||
reportFailure (description);
|
||||
reportFailure (output);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Puts funcName at the top of the call stack. This stack is used to show
|
||||
* a function-reported-from field when reporting failures.
|
||||
*/
|
||||
function enterFunc (funcName)
|
||||
{
|
||||
|
||||
if (!funcName.match(/\(\)$/))
|
||||
funcName += "()";
|
||||
|
||||
callStack.push(funcName);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Pops the top funcName off the call stack. funcName is optional, and can be
|
||||
* used to check push-pop balance.
|
||||
*/
|
||||
function exitFunc (funcName)
|
||||
{
|
||||
var lastFunc = callStack.pop();
|
||||
|
||||
if (funcName)
|
||||
{
|
||||
if (!funcName.match(/\(\)$/))
|
||||
funcName += "()";
|
||||
|
||||
if (lastFunc != funcName)
|
||||
reportFailure ("Test driver failure, expected to exit function '" +
|
||||
funcName + "' but '" + lastFunc + "' came off " +
|
||||
"the stack");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Peeks at the top of the call stack.
|
||||
*/
|
||||
function currentFunc()
|
||||
{
|
||||
|
||||
return callStack[callStack.length - 1];
|
||||
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the IDispatch implementation for XPConnect
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* David Bradley.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
/**
|
||||
* \file
|
||||
* This file contains the tests for making sure that JS Objects access via the IDispatch interface
|
||||
* work properly
|
||||
*/
|
||||
|
||||
test();
|
||||
|
||||
function test()
|
||||
{
|
||||
try
|
||||
{
|
||||
var variantObj = Components.classes["@mozilla.org/variant;1"].createInstance(Components.interfaces.nsIVariant);
|
||||
var jsobj =
|
||||
{
|
||||
Boolean : false,
|
||||
Short : 0,
|
||||
Long : 0,
|
||||
Float : 0.0,
|
||||
Double : 0.0,
|
||||
Currency : 0.0,
|
||||
Date : new Date(),
|
||||
String : "",
|
||||
DispatchPtr : {},
|
||||
SCode : 0,
|
||||
Variant : variantObj,
|
||||
Char : 'a'
|
||||
};
|
||||
var obj = COMObject(CLSID_nsXPCDispTestWrappedJS);
|
||||
reportCompare(
|
||||
obj.TestParamTypes(jsobj),
|
||||
"",
|
||||
"Testing IDispatch wrapped JS objects");
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure(e.toString());
|
||||
}
|
||||
}
|
||||
@@ -1,361 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; 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 Communicator client code, released March
|
||||
* 31, 1998.
|
||||
*
|
||||
* 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):
|
||||
* Rob Ginda rginda@netscape.com
|
||||
*/
|
||||
|
||||
FAILED = "FAILED!: ";
|
||||
STATUS = "STATUS: ";
|
||||
BUGNUMBER = "BUGNUMBER: ";
|
||||
DEBUGLINE = "DEBUG: ";
|
||||
|
||||
DEBUG = false;
|
||||
VERBOSE = false;
|
||||
|
||||
var CLSID_nsXPCDispSimple = "{9F39237C-D179-4260-8EF3-4B6D4D7D5570}";
|
||||
var ProgID_nsXPCDispSimple = "XPCIDispatchTest.nsXPCDispSimple.1";
|
||||
var nsXPCDispSimpleDesc =
|
||||
{
|
||||
name : "nsXPCDispSimple",
|
||||
cid : CLSID_nsXPCDispSimple,
|
||||
progid : ProgID_nsXPCDispSimple,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"ClassName",
|
||||
"Number"
|
||||
]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestMethods = "{745D1149-9F46-418C-B176-71EAA98974BA}";
|
||||
var ProgID_nsXPCDispTestMethods = "XPCIDispatchTest.nsXPCDispTestMethods.1";
|
||||
var nsXPCDispTestMethodsDesc =
|
||||
{
|
||||
name : "nsXPCDispTestMethods",
|
||||
cid : CLSID_nsXPCDispTestMethods,
|
||||
progid : ProgID_nsXPCDispTestMethods,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"NoParameters", "ReturnBSTR", "ReturnI4",
|
||||
"ReturnUI1", "ReturnI2", "ReturnR4", "ReturnR8", "ReturnBool",
|
||||
"ReturnIDispatch", "ReturnError", "ReturnDate",
|
||||
"ReturnIUnknown", "ReturnI1", "ReturnUI2", "ReturnUI4",
|
||||
"ReturnInt", "ReturnUInt", "TakesBSTR", "TakesI4", "TakesUI1",
|
||||
"TakesI2", "TakesR4", "TakesR8", "TakesBool",
|
||||
"TakesIDispatch", "TakesError", "TakesDate", "TakesIUnknown",
|
||||
"TakesI1", "TakesUI2", "TakesUI4", "TakesInt", "TakesUInt",
|
||||
"OutputsBSTR", "OutputsI4", "OutputsUI1", "OutputsI2",
|
||||
"OutputsR4", "OutputsR8", "OutputsBool", "OutputsIDispatch",
|
||||
"OutputsError", "OutputsDate", "OutputsIUnknown", "OutputsI1",
|
||||
"OutputsUI2", "OutputsUI4", "InOutsBSTR", "InOutsI4",
|
||||
"InOutsUI1", "InOutsI2", "InOutsR4", "InOutsR8", "InOutsBool",
|
||||
"InOutsIDispatch", "InOutsError", "InOutsDate",
|
||||
"InOutsIUnknown", "InOutsI1", "InOutsUI2", "InOutsUI4",
|
||||
"InOutsInt", "InOutsUInt", "OneParameterWithReturn",
|
||||
"StringInputAndReturn", "IDispatchInputAndReturn",
|
||||
"TwoParameters", "TwelveInParameters", "TwelveOutParameters",
|
||||
"TwelveStrings", "TwelveOutStrings", "TwelveIDispatch",
|
||||
"TwelveOutIDispatch", "CreateError"
|
||||
]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestArrays = "{AB085C43-C619-48C8-B68C-C495BDE12DFB}";
|
||||
var ProgID_nsXPCDispTestArrays = "XPCIDispatchTest.nsXPCDispTestArrays.1";
|
||||
var nsXPCDispTestArraysDesc =
|
||||
{
|
||||
name : "nsXPCDispTestArrays",
|
||||
cid : CLSID_nsXPCDispTestArrays,
|
||||
progid : ProgID_nsXPCDispTestArrays,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"ReturnSafeArray", "ReturnSafeArrayBSTR", "ReturnSafeArrayIDispatch",
|
||||
"TakesSafeArray", "TakesSafeArrayBSTR", "TakesSafeArrayIDispatch",
|
||||
"InOutSafeArray", "InOutSafeArrayBSTR", "InOutSafeArrayIDispatch"
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
var CLSID_nsXPCDispTestNoIDispatch = "{7414404F-A4CC-4E3C-9B32-BB20CB22F541}";
|
||||
var ProgID_nsXPCDispTestNoIDispatch = "XPCIDispatchTest.nsXPCDispTestNoIDispatch.1";
|
||||
|
||||
var CLSID_nsXPCDispTestNoScript = "{F8D54F00-4FC4-4731-B467-10F1CB8DB0AD}";
|
||||
var ProgID_nsXPCDispTestNoScript = "XPCIDispatchTest.nsXPCDispTestNoScript.1";
|
||||
|
||||
var CLSID_nsXPCDispTestProperties = "{D8B4265B-1768-4CA9-A285-7CCAEEB51C74}";
|
||||
var ProgID_nsXPCDispTestProperties = "XPCIDispatchTest.nsXPCDispTestProperties.1";
|
||||
var nsXPCDispTestPropertiesDesc =
|
||||
{
|
||||
name : "nsXPCDispTestProperties",
|
||||
cid : CLSID_nsXPCDispTestProperties,
|
||||
progid : ProgID_nsXPCDispTestProperties,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"Short", "Long", "Float", "Double", "Currency",
|
||||
"Date", "String", "DispatchPtr", "SCode", "Boolean", "Variant",
|
||||
"COMPtr", "Char"
|
||||
]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestScriptOn = "{2A06373F-3E61-4882-A3D7-A104F70B09ED}";
|
||||
var ProgID_nsXPCDispTestScriptOn = "XPCIDispatchTest.nsXPCDispTestScriptOn.1";
|
||||
var nsXPCDispTestScriptOnDesc =
|
||||
{
|
||||
name : "nsXPCDispTestScriptOn",
|
||||
cid : CLSID_nsXPCDispTestScriptOn,
|
||||
progid : ProgID_nsXPCDispTestScriptOn,
|
||||
scriptable : true,
|
||||
methods : [ ]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestScriptOff = "{959CD122-9826-4757-BA09-DE327D55F9E7}";
|
||||
var ProgID_nsXPCDispTestScriptOff = "XPCIDispatchTest.nsXPCDispTestScriptOff.1";
|
||||
var nsXPCDispTestScriptOffDesc =
|
||||
{
|
||||
name : "nsXPCDispTestScriptOff",
|
||||
cid : CLSID_nsXPCDispTestScriptOff,
|
||||
progid : ProgID_nsXPCDispTestScriptOff,
|
||||
scriptable : false,
|
||||
methods : [ ]
|
||||
};
|
||||
|
||||
var CLSID_nsXPCDispTestWrappedJS = "{EAEE6BB2-C005-4B91-BCA7-6613236F6F69}";
|
||||
var ProgID_nsXPCDispTestWrappedJS = "XPCIDispatchTest.nsXPCDispTestWrappedJS.1";
|
||||
var nsXPCDispTestWrappedJSDesc =
|
||||
{
|
||||
name : "nsXPCDispTestWrappedJS",
|
||||
cid : CLSID_nsXPCDispTestWrappedJS,
|
||||
progid : ProgID_nsXPCDispTestWrappedJS,
|
||||
scriptable : true,
|
||||
methods :
|
||||
[
|
||||
"TestParamTypes"
|
||||
]
|
||||
};
|
||||
|
||||
// create list of COM components
|
||||
var objectsDesc =
|
||||
[
|
||||
nsXPCDispSimpleDesc,
|
||||
nsXPCDispTestMethodsDesc,
|
||||
nsXPCDispTestArraysDesc,
|
||||
nsXPCDispTestPropertiesDesc,
|
||||
nsXPCDispTestScriptOnDesc,
|
||||
nsXPCDispTestScriptOffDesc,
|
||||
nsXPCDispTestWrappedJSDesc
|
||||
];
|
||||
|
||||
function findProp(prop, array, marked)
|
||||
{
|
||||
len = array.length;
|
||||
for (index = 0; index < len; ++index)
|
||||
{
|
||||
if (prop == array[index])
|
||||
{
|
||||
marked[index] = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function compareObject(obj, objDesc, testName)
|
||||
{
|
||||
if (obj == undefined)
|
||||
{
|
||||
reportFailure("compareObject passed an invalid object");
|
||||
return;
|
||||
}
|
||||
var marked = new Array();
|
||||
for (prop in obj)
|
||||
{
|
||||
printDebug("Found " + prop);
|
||||
reportCompare(
|
||||
true,
|
||||
findProp(prop, objDesc.methods, marked),
|
||||
testName + ": " + prop + " exists on " + objDesc.name + ", but was not expected");
|
||||
}
|
||||
len = objDesc.methods.length;
|
||||
for (var index = 0; index < len; ++index)
|
||||
{
|
||||
reportCompare(
|
||||
true,
|
||||
marked[index],
|
||||
testName + ": " + objDesc.methods[index] + " does not exist on " + objDesc.name);
|
||||
}
|
||||
}
|
||||
|
||||
function compareExpression(expression, expectedResult, testName)
|
||||
{
|
||||
if (VERBOSE && (typeof testName != "undefined"))
|
||||
printStatus(testName + " - evaluating:" + expression);
|
||||
|
||||
try
|
||||
{
|
||||
reportCompare(
|
||||
expectedResult,
|
||||
eval(expression),
|
||||
testName);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
reportFailure(expression + " generated the following exception:" + e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
var callStack = new Array();
|
||||
|
||||
/*
|
||||
* Report a failure in the 'accepted' manner
|
||||
*/
|
||||
function reportFailure (msg)
|
||||
{
|
||||
var lines = msg.split ("\n");
|
||||
var l;
|
||||
var funcName = currentFunc();
|
||||
var prefix = (funcName) ? "[reported from " + funcName + "] ": "";
|
||||
|
||||
for (var i=0; i<lines.length; i++)
|
||||
print (FAILED + prefix + lines[i]);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a non-failure message.
|
||||
*/
|
||||
function printDebug (msg)
|
||||
{
|
||||
if (DEBUG)
|
||||
{
|
||||
var lines = msg.split ("\n");
|
||||
var l;
|
||||
|
||||
for (var i=0; i<lines.length; i++)
|
||||
print (DEBUGLINE + lines[i]);
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Print a non-failure message.
|
||||
*/
|
||||
function printStatus (msg)
|
||||
{
|
||||
var lines = msg.split ("\n");
|
||||
var l;
|
||||
|
||||
for (var i=0; i<lines.length; i++)
|
||||
print (STATUS + lines[i]);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Print a bugnumber message.
|
||||
*/
|
||||
function printBugNumber (num)
|
||||
{
|
||||
|
||||
print (BUGNUMBER + num);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Compare expected result to actual result, if they differ (in value and/or
|
||||
* type) report a failure. If description is provided, include it in the
|
||||
* failure report.
|
||||
*/
|
||||
function reportCompare (expected, actual, description)
|
||||
{
|
||||
var expected_t = typeof expected;
|
||||
var actual_t = typeof actual;
|
||||
var output = "";
|
||||
|
||||
if ((VERBOSE) && (typeof description != "undefined"))
|
||||
printStatus ("Comparing '" + description + "'");
|
||||
|
||||
if (expected_t != actual_t)
|
||||
output += "Type mismatch, expected type " + expected_t +
|
||||
", actual type " + actual_t + "\n";
|
||||
else if (VERBOSE)
|
||||
printStatus ("Expected type '" + actual_t + "' matched actual " +
|
||||
"type '" + expected_t + "'");
|
||||
|
||||
if (expected != actual)
|
||||
output += "Expected value '" + expected + "', Actual value '" + actual +
|
||||
"'\n";
|
||||
else if (VERBOSE)
|
||||
printStatus ("Expected value '" + actual + "' matched actual " +
|
||||
"value '" + expected + "'");
|
||||
|
||||
if (output != "")
|
||||
{
|
||||
if (typeof description != "undefined")
|
||||
reportFailure (description);
|
||||
reportFailure (output);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Puts funcName at the top of the call stack. This stack is used to show
|
||||
* a function-reported-from field when reporting failures.
|
||||
*/
|
||||
function enterFunc (funcName)
|
||||
{
|
||||
|
||||
if (!funcName.match(/\(\)$/))
|
||||
funcName += "()";
|
||||
|
||||
callStack.push(funcName);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Pops the top funcName off the call stack. funcName is optional, and can be
|
||||
* used to check push-pop balance.
|
||||
*/
|
||||
function exitFunc (funcName)
|
||||
{
|
||||
var lastFunc = callStack.pop();
|
||||
|
||||
if (funcName)
|
||||
{
|
||||
if (!funcName.match(/\(\)$/))
|
||||
funcName += "()";
|
||||
|
||||
if (lastFunc != funcName)
|
||||
reportFailure ("Test driver failure, expected to exit function '" +
|
||||
funcName + "' but '" + lastFunc + "' came off " +
|
||||
"the stack");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Peeks at the top of the call stack.
|
||||
*/
|
||||
function currentFunc()
|
||||
{
|
||||
|
||||
return callStack[callStack.length - 1];
|
||||
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
perl jsDriver.pl -e xpcshell %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
File diff suppressed because it is too large
Load Diff
28
mozilla/widget/Makefile.in
Normal file
28
mozilla/widget/Makefile.in
Normal file
@@ -0,0 +1,28 @@
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
#
|
||||
|
||||
DEPTH = ..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
DIRS = public src
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
21
mozilla/widget/build.bat
Executable file
21
mozilla/widget/build.bat
Executable file
@@ -0,0 +1,21 @@
|
||||
rem -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
rem
|
||||
rem The contents of this file are subject to the Netscape Public License
|
||||
rem Version 1.0 (the "NPL"); you may not use this file except in
|
||||
rem compliance with the NPL. You may obtain a copy of the NPL at
|
||||
rem http://www.mozilla.org/NPL/
|
||||
rem
|
||||
rem Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
rem WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
rem for the specific language governing rights and limitations under the
|
||||
rem NPL.
|
||||
rem
|
||||
rem The Initial Developer of this code under the NPL is Netscape
|
||||
rem Communications Corporation. Portions created by Netscape are
|
||||
rem Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
rem Reserved.
|
||||
rem
|
||||
|
||||
del s:\ns\raptor\ui\src\windows\win32_d.obj\%1.obj
|
||||
del s:\ns\raptor\ui\tests\windows\win32_d.obj\winmain.obj
|
||||
nmake -f makefile.win
|
||||
11
mozilla/widget/macbuild/Widget.prefix
Normal file
11
mozilla/widget/macbuild/Widget.prefix
Normal file
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// Widget.Prefix
|
||||
//
|
||||
// Global prefix file for the Widget project.
|
||||
//
|
||||
|
||||
#include "MacPrefix.h"
|
||||
|
||||
#include <Quickdraw.h>
|
||||
#include <Events.h>
|
||||
#include <MacWindows.h>
|
||||
11
mozilla/widget/macbuild/WidgetDebug.prefix
Normal file
11
mozilla/widget/macbuild/WidgetDebug.prefix
Normal file
@@ -0,0 +1,11 @@
|
||||
//
|
||||
// WidgetDebug.Prefix
|
||||
//
|
||||
// Global prefix file for the debug Widget project.
|
||||
//
|
||||
|
||||
#include "MacPrefix_debug.h"
|
||||
|
||||
#include <Quickdraw.h>
|
||||
#include <Events.h>
|
||||
#include <MacWindows.h>
|
||||
22
mozilla/widget/macbuild/WidgetSharedDebugPrefix.h
Normal file
22
mozilla/widget/macbuild/WidgetSharedDebugPrefix.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define MAC_SHARED 1
|
||||
#define _IMPL_NS_WIDGET 1
|
||||
|
||||
#include "WidgetDebug.prefix"
|
||||
22
mozilla/widget/macbuild/WidgetSharedPrefix.h
Normal file
22
mozilla/widget/macbuild/WidgetSharedPrefix.h
Normal file
@@ -0,0 +1,22 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define MAC_SHARED 1
|
||||
#define _IMPL_NS_WIDGET 1
|
||||
|
||||
#include "Widget.prefix"
|
||||
21
mozilla/widget/macbuild/WidgetStaticDebugPrefix.h
Normal file
21
mozilla/widget/macbuild/WidgetStaticDebugPrefix.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define MAC_STATIC 1
|
||||
|
||||
#include "WidgetDebug.prefix"
|
||||
21
mozilla/widget/macbuild/WidgetStaticPrefix.h
Normal file
21
mozilla/widget/macbuild/WidgetStaticPrefix.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/* -*- 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.0 (the "NPL"); you may not use this file except in
|
||||
* compliance with the NPL. You may obtain a copy of the NPL at
|
||||
* http://www.mozilla.org/NPL/
|
||||
*
|
||||
* Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
* for the specific language governing rights and limitations under the
|
||||
* NPL.
|
||||
*
|
||||
* The Initial Developer of this code under the NPL is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
* Reserved.
|
||||
*/
|
||||
|
||||
#define MAC_STATIC 1
|
||||
|
||||
#include "Widget.prefix"
|
||||
BIN
mozilla/widget/macbuild/widget.mcp
Normal file
BIN
mozilla/widget/macbuild/widget.mcp
Normal file
Binary file not shown.
35
mozilla/widget/macbuild/widget.toc
Normal file
35
mozilla/widget/macbuild/widget.toc
Normal file
@@ -0,0 +1,35 @@
|
||||
# target: widgetDebug.shlb
|
||||
mozilla/widget/src/mac/nsAppShell.cpp
|
||||
mozilla/widget/src/mac/nsButton.cpp
|
||||
mozilla/widget/src/mac/nsCheckButton.cpp
|
||||
mozilla/widget/src/mac/nsFileWidget.cpp
|
||||
mozilla/widget/src/mac/nsLookAndFeel.cpp
|
||||
mozilla/widget/src/mac/nsMacControl.cpp
|
||||
mozilla/widget/src/mac/nsMacEventHandler.cpp
|
||||
mozilla/widget/src/mac/nsMacMessagePump.cpp
|
||||
mozilla/widget/src/mac/nsMacMessageSink.cpp
|
||||
mozilla/widget/src/mac/nsMacWindow.cpp
|
||||
mozilla/widget/src/mac/nsMenu.cpp
|
||||
mozilla/widget/src/mac/nsMenuBar.cpp
|
||||
mozilla/widget/src/mac/nsMenuItem.cpp
|
||||
mozilla/widget/src/mac/nsRadioButton.cpp
|
||||
mozilla/widget/src/mac/nsScrollbar.cpp
|
||||
mozilla/widget/src/mac/nsTextAreaWidget.cpp
|
||||
mozilla/widget/src/mac/nsTextWidget.cpp
|
||||
mozilla/widget/src/mac/nsToolkit.cpp
|
||||
mozilla/widget/src/mac/nsWidgetFactory.cpp
|
||||
mozilla/widget/src/mac/nsWidgetSupport.cpp
|
||||
mozilla/widget/src/mac/nsWindow.cpp
|
||||
mozilla/widget/src/xpwidgets/nsBaseWidget.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTColumn.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTControlStripItem.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTDataModel.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTItem.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTTreeDataModel.cpp
|
||||
mozilla/widget/src/xpwidgets/nsHTTreeItem.cpp
|
||||
mozilla/widget/src/xpwidgets/nsImageButton.cpp
|
||||
mozilla/widget/src/xpwidgets/nsMenuButton.cpp
|
||||
mozilla/widget/src/xpwidgets/nsToolbar.cpp
|
||||
mozilla/widget/src/xpwidgets/nsToolbarItemHolder.cpp
|
||||
mozilla/widget/src/xpwidgets/nsToolbarManager.cpp
|
||||
mozilla/widget/src/xpwidgets/nsTreeView.cpp
|
||||
BIN
mozilla/widget/macbuild/widgetIDL.mcp
Normal file
BIN
mozilla/widget/macbuild/widgetIDL.mcp
Normal file
Binary file not shown.
23
mozilla/widget/makefile.win
Normal file
23
mozilla/widget/makefile.win
Normal file
@@ -0,0 +1,23 @@
|
||||
#!nmake
|
||||
#
|
||||
# The contents of this file are subject to the Netscape Public License
|
||||
# Version 1.0 (the "NPL"); you may not use this file except in
|
||||
# compliance with the NPL. You may obtain a copy of the NPL at
|
||||
# http://www.mozilla.org/NPL/
|
||||
#
|
||||
# Software distributed under the NPL is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
|
||||
# for the specific language governing rights and limitations under the
|
||||
# NPL.
|
||||
#
|
||||
# The Initial Developer of this code under the NPL is Netscape
|
||||
# Communications Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All Rights
|
||||
# Reserved.
|
||||
|
||||
DEPTH=..
|
||||
|
||||
|
||||
DIRS=public timer src
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
33
mozilla/widget/public/MANIFEST
Normal file
33
mozilla/widget/public/MANIFEST
Normal file
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:widget directory
|
||||
#
|
||||
|
||||
nsIDragSessionMac.h
|
||||
nsIWidget.h
|
||||
nsIKBStateControl.h
|
||||
nsIButton.h
|
||||
nsICheckButton.h
|
||||
nsIListWidget.h
|
||||
nsIComboBox.h
|
||||
nsITextWidget.h
|
||||
nsITextAreaWidget.h
|
||||
nsIComboBox.h
|
||||
nsIListBox.h
|
||||
nsIScrollbar.h
|
||||
nsGUIEvent.h
|
||||
nsIRadioButton.h
|
||||
nsIMouseListener.h
|
||||
nsIEventListener.h
|
||||
nsIFileWidget.h
|
||||
nsIMenuListener.h
|
||||
nsWidgetsCID.h
|
||||
nsILabel.h
|
||||
nsILookAndFeel.h
|
||||
nsWidgetSupport.h
|
||||
nsIMenu.h
|
||||
nsIMenuBar.h
|
||||
nsIMenuItem.h
|
||||
nsIPopUpMenu.h
|
||||
nsIKeyBindMgr.h
|
||||
nsStringUtil.h
|
||||
nsIContextMenu.h
|
||||
16
mozilla/widget/public/MANIFEST_IDL
Normal file
16
mozilla/widget/public/MANIFEST_IDL
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# This is a list of local files which get copied to the mozilla:dist:idl directory
|
||||
#
|
||||
|
||||
nsIAppShell.idl
|
||||
nsIFilePicker.idl
|
||||
nsIFileSpecWithUI.idl
|
||||
nsISound.idl
|
||||
nsIToolkit.idl
|
||||
nsITransferable.idl
|
||||
nsIDragSession.idl
|
||||
nsIDragService.idl
|
||||
nsIFormatConverter.idl
|
||||
nsIClipboard.idl
|
||||
nsIClipboardOwner.idl
|
||||
nsIRollupListener.idl
|
||||
92
mozilla/widget/public/Makefile.in
Normal file
92
mozilla/widget/public/Makefile.in
Normal file
@@ -0,0 +1,92 @@
|
||||
#
|
||||
# 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 = raptor
|
||||
XPIDL_MODULE = widget
|
||||
|
||||
EXPORTS = \
|
||||
nsIFontSizeIterator.h \
|
||||
nsIFontNameIterator.h \
|
||||
nsIFontRetrieverService.h \
|
||||
nsIMenuBar.h \
|
||||
nsIMenu.h \
|
||||
nsIMenuItem.h \
|
||||
nsIPopUpMenu.h \
|
||||
nsIFileWidget.h \
|
||||
nsStringUtil.h \
|
||||
nsIKBStateControl.h \
|
||||
nsIButton.h \
|
||||
nsICheckButton.h \
|
||||
nsIListWidget.h \
|
||||
nsIComboBox.h \
|
||||
nsITextWidget.h \
|
||||
nsITextAreaWidget.h \
|
||||
nsIComboBox.h \
|
||||
nsIListBox.h \
|
||||
nsIScrollbar.h \
|
||||
nsGUIEvent.h \
|
||||
nsIRadioButton.h \
|
||||
nsIMouseListener.h \
|
||||
nsIEventListener.h \
|
||||
nsIMenuListener.h \
|
||||
nsWidgetsCID.h \
|
||||
nsILookAndFeel.h \
|
||||
nsILabel.h \
|
||||
nsIMenuBar.h \
|
||||
nsIMenu.h \
|
||||
nsIMenuItem.h \
|
||||
nsIPopUpMenu.h \
|
||||
nsIFontNameIterator.h \
|
||||
nsIFontSizeIterator.h \
|
||||
nsIFontRetrieverService.h \
|
||||
nsIContextMenu.h \
|
||||
$(NULL)
|
||||
|
||||
XPIDLSRCS = \
|
||||
nsIAppShell.idl \
|
||||
nsIFilePicker.idl \
|
||||
nsIFileSpecWithUI.idl \
|
||||
nsIToolkit.idl \
|
||||
nsISound.idl \
|
||||
nsITransferable.idl \
|
||||
nsIDragSession.idl \
|
||||
nsIDragService.idl \
|
||||
nsIFormatConverter.idl \
|
||||
nsIClipboard.idl \
|
||||
nsIClipboardOwner.idl \
|
||||
nsIRollupListener.idl \
|
||||
nsIWidget.idl \
|
||||
nsIWindow.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
DEFINES += -D_IMPL_NS_UI
|
||||
|
||||
78
mozilla/widget/public/makefile.win
Normal file
78
mozilla/widget/public/makefile.win
Normal file
@@ -0,0 +1,78 @@
|
||||
#!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=..\..
|
||||
|
||||
|
||||
DEFINES=-D_IMPL_NS_UI
|
||||
MODULE=raptor
|
||||
XPIDL_MODULE=widget
|
||||
|
||||
XPIDLSRCS = \
|
||||
.\nsIAppShell.idl \
|
||||
.\nsIFilePicker.idl \
|
||||
.\nsIFileSpecWithUI.idl \
|
||||
.\nsISound.idl \
|
||||
.\nsIToolkit.idl \
|
||||
.\nsITransferable.idl \
|
||||
.\nsIDragSession.idl \
|
||||
.\nsIDragService.idl \
|
||||
.\nsIFormatConverter.idl \
|
||||
.\nsIClipboard.idl \
|
||||
.\nsIClipboardOwner.idl \
|
||||
.\nsIRollupListener.idl \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS=\
|
||||
nsIFontSizeIterator.h \
|
||||
nsIFontNameIterator.h \
|
||||
nsIFontRetrieverService.h \
|
||||
nsIFileWidget.h \
|
||||
nsIWidget.h \
|
||||
nsIKBStateControl.h \
|
||||
nsIButton.h \
|
||||
nsICheckButton.h \
|
||||
nsIListWidget.h \
|
||||
nsIComboBox.h \
|
||||
nsITextWidget.h \
|
||||
nsITextAreaWidget.h \
|
||||
nsIComboBox.h \
|
||||
nsIListBox.h \
|
||||
nsIScrollbar.h \
|
||||
nsGUIEvent.h \
|
||||
nsIRadioButton.h \
|
||||
nsIMouseListener.h \
|
||||
nsIEventListener.h \
|
||||
nsIMenuListener.h \
|
||||
nsWidgetsCID.h \
|
||||
nsStringUtil.h \
|
||||
nsILookAndFeel.h \
|
||||
nsILabel.h \
|
||||
nsIMenuBar.h \
|
||||
nsIMenu.h \
|
||||
nsIMenuItem.h \
|
||||
nsIContextMenu.h \
|
||||
nsIPopUpMenu.h \
|
||||
$(NULL)
|
||||
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
509
mozilla/widget/public/nsGUIEvent.h
Normal file
509
mozilla/widget/public/nsGUIEvent.h
Normal file
@@ -0,0 +1,509 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsGUIEvent_h__
|
||||
#define nsGUIEvent_h__
|
||||
|
||||
#include "nsPoint.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
class nsIRenderingContext;
|
||||
class nsIRegion;
|
||||
class nsIWidget;
|
||||
class nsIMenuItem;
|
||||
|
||||
/**
|
||||
* Return status for event processors.
|
||||
*/
|
||||
|
||||
enum nsEventStatus {
|
||||
/// The event is ignored, do default processing
|
||||
nsEventStatus_eIgnore,
|
||||
/// The event is consumed, don't do default processing
|
||||
nsEventStatus_eConsumeNoDefault,
|
||||
/// The event is consumed, but do default processing
|
||||
nsEventStatus_eConsumeDoDefault
|
||||
};
|
||||
|
||||
/**
|
||||
* General event
|
||||
*/
|
||||
|
||||
struct nsEvent {
|
||||
/// See event struct types
|
||||
PRUint8 eventStructType;
|
||||
/// See GUI MESSAGES,
|
||||
PRUint32 message;
|
||||
/// in widget relative coordinates, modified to be relative to current view in layout.
|
||||
nsPoint point;
|
||||
// in widget relative coordinates, not modified by layout code.
|
||||
nsPoint refPoint;
|
||||
/// elapsed time, in milliseconds, from the time the system was started to the time the message was created
|
||||
PRUint32 time;
|
||||
// flags to hold event flow stage and capture/bubble cancellation status
|
||||
PRUint32 flags;
|
||||
};
|
||||
|
||||
/**
|
||||
* General graphic user interface event
|
||||
*/
|
||||
|
||||
struct nsGUIEvent : public nsEvent {
|
||||
/// Originator of the event
|
||||
nsIWidget* widget;
|
||||
/// Internal platform specific message.
|
||||
void* nativeMsg;
|
||||
};
|
||||
|
||||
/**
|
||||
* Window resize event
|
||||
*/
|
||||
|
||||
struct nsSizeEvent : public nsGUIEvent {
|
||||
/// x,y width, height in pixels (client area)
|
||||
nsRect *windowSize;
|
||||
/// width of entire window (in pixels)
|
||||
PRInt32 mWinWidth;
|
||||
/// height of entire window (in pixels)
|
||||
PRInt32 mWinHeight;
|
||||
};
|
||||
|
||||
/**
|
||||
* Window repaint event
|
||||
*/
|
||||
|
||||
struct nsPaintEvent : public nsGUIEvent {
|
||||
/// Context to paint in.
|
||||
nsIRenderingContext *renderingContext;
|
||||
/// area to paint (should be used instead of rect)
|
||||
nsIRegion *region;
|
||||
/// x,y, width, height in pixels of area to paint
|
||||
nsRect *rect;
|
||||
};
|
||||
|
||||
/**
|
||||
* Scrollbar event
|
||||
*/
|
||||
|
||||
struct nsScrollbarEvent : public nsGUIEvent {
|
||||
/// ranges between scrollbar 0 and (maxRange - thumbSize). See nsIScrollbar
|
||||
PRUint32 position;
|
||||
};
|
||||
|
||||
|
||||
struct nsInputEvent : public nsGUIEvent {
|
||||
/// PR_TRUE indicates the shift key is down
|
||||
PRBool isShift;
|
||||
/// PR_TRUE indicates the control key is down
|
||||
PRBool isControl;
|
||||
/// PR_TRUE indicates the alt key is down
|
||||
PRBool isAlt;
|
||||
/// PR_TRUE indicates the meta key is down
|
||||
/// (or, on Mac, the Command key)
|
||||
PRBool isMeta;
|
||||
};
|
||||
|
||||
/**
|
||||
* Mouse event
|
||||
*/
|
||||
|
||||
struct nsMouseEvent : public nsInputEvent {
|
||||
/// The number of mouse clicks
|
||||
PRUint32 clickCount;
|
||||
/// Special return code for MOUSE_ACTIVATE to signal
|
||||
/// if the target accepts activation (1), or denies it (0)
|
||||
PRBool acceptActivation;
|
||||
};
|
||||
|
||||
/**
|
||||
* Keyboard event
|
||||
*/
|
||||
|
||||
struct nsKeyEvent : public nsInputEvent {
|
||||
/// see NS_VK codes
|
||||
PRUint32 keyCode;
|
||||
/// OS translated Unicode char
|
||||
PRUint32 charCode;
|
||||
// indicates whether the event signifies a printable character
|
||||
PRBool isChar;
|
||||
};
|
||||
|
||||
/**
|
||||
* IME Related Events
|
||||
*/
|
||||
struct nsTextRange {
|
||||
PRUint32 mStartOffset;
|
||||
PRUint32 mEndOffset;
|
||||
PRUint32 mRangeType;
|
||||
};
|
||||
|
||||
typedef struct nsTextRange nsTextRange;
|
||||
typedef nsTextRange* nsTextRangeArray;
|
||||
|
||||
struct nsTextEventReply {
|
||||
nsPoint mCursorPosition;
|
||||
PRBool mCursorIsCollapsed;
|
||||
};
|
||||
|
||||
typedef struct nsTextEventReply nsTextEventReply;
|
||||
|
||||
struct nsTextEvent : public nsInputEvent {
|
||||
PRUnichar* theText;
|
||||
nsTextEventReply theReply;
|
||||
PRUint32 rangeCount;
|
||||
nsTextRangeArray rangeArray;
|
||||
PRBool isChar;
|
||||
};
|
||||
|
||||
struct nsCompositionEvent : public nsInputEvent {
|
||||
PRUint32 compositionMessage;
|
||||
nsTextEventReply theReply;
|
||||
};
|
||||
|
||||
/**
|
||||
* Tooltip event
|
||||
*/
|
||||
struct nsTooltipEvent : public nsGUIEvent {
|
||||
/// Index of tooltip area which generated the event. @see SetTooltips in nsIWidget
|
||||
PRUint32 tipIndex;
|
||||
};
|
||||
|
||||
/**
|
||||
* MenuItem event
|
||||
*
|
||||
* When this event occurs the widget field in nsGUIEvent holds the "target"
|
||||
* for the event
|
||||
*/
|
||||
|
||||
struct nsMenuEvent : public nsGUIEvent {
|
||||
nsIMenuItem * mMenuItem;
|
||||
PRUint32 mCommand;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Event status for D&D Event
|
||||
*/
|
||||
enum nsDragDropEventStatus {
|
||||
/// The event is a enter
|
||||
nsDragDropEventStatus_eDragEntered,
|
||||
/// The event is exit
|
||||
nsDragDropEventStatus_eDragExited,
|
||||
/// The event is drop
|
||||
nsDragDropEventStatus_eDrop
|
||||
};
|
||||
|
||||
/**
|
||||
* Event Struct Types
|
||||
*/
|
||||
#define NS_EVENT 1
|
||||
#define NS_GUI_EVENT 2
|
||||
#define NS_SIZE_EVENT 3
|
||||
#define NS_PAINT_EVENT 4
|
||||
#define NS_SCROLLBAR_EVENT 5
|
||||
#define NS_INPUT_EVENT 6
|
||||
#define NS_KEY_EVENT 7
|
||||
#define NS_MOUSE_EVENT 8
|
||||
|
||||
#define NS_MENU_EVENT 10
|
||||
#define NS_DRAGDROP_EVENT 11
|
||||
#define NS_TEXT_EVENT 12
|
||||
#define NS_COMPOSITION_START 13
|
||||
#define NS_COMPOSITION_END 14
|
||||
|
||||
/**
|
||||
* GUI MESSAGES
|
||||
*/
|
||||
//@{
|
||||
|
||||
#define NS_WINDOW_START 100
|
||||
|
||||
// Widget is being created
|
||||
#define NS_CREATE (NS_WINDOW_START)
|
||||
// Widget is being destroyed
|
||||
#define NS_DESTROY (NS_WINDOW_START + 1)
|
||||
// Widget was resized
|
||||
#define NS_SIZE (NS_WINDOW_START + 2)
|
||||
// Widget gained focus
|
||||
#define NS_GOTFOCUS (NS_WINDOW_START + 3)
|
||||
// Widget lost focus
|
||||
#define NS_LOSTFOCUS (NS_WINDOW_START + 4)
|
||||
// Widget got activated
|
||||
#define NS_ACTIVATE (NS_WINDOW_START + 5)
|
||||
// Widget got deactivated
|
||||
#define NS_DEACTIVATE (NS_WINDOW_START + 6)
|
||||
// Widget needs to be repainted
|
||||
#define NS_PAINT (NS_WINDOW_START + 30)
|
||||
// Key is pressed within a window
|
||||
#define NS_KEY_PRESS (NS_WINDOW_START + 31)
|
||||
// Key is released within a window
|
||||
#define NS_KEY_UP (NS_WINDOW_START + 32)
|
||||
// Key is pressed within a window
|
||||
#define NS_KEY_DOWN (NS_WINDOW_START + 33)
|
||||
// Window has been moved to a new location.
|
||||
// The events point contains the x, y location in screen coordinates
|
||||
#define NS_MOVE (NS_WINDOW_START + 34)
|
||||
|
||||
// Tab control's selected tab has changed
|
||||
#define NS_TABCHANGE (NS_WINDOW_START + 35)
|
||||
|
||||
|
||||
|
||||
// Menu item selected
|
||||
#define NS_MENU_SELECTED (NS_WINDOW_START + 38)
|
||||
|
||||
// Form control changed: currently == combo box selection changed
|
||||
// but could be expanded to mean textbox, checkbox changed, etc.
|
||||
// This is a GUI specific event that does not necessarily correspond
|
||||
// directly to a mouse click or a key press.
|
||||
#define NS_CONTROL_CHANGE (NS_WINDOW_START + 39)
|
||||
|
||||
// Indicates the display has changed depth
|
||||
#define NS_DISPLAYCHANGED (NS_WINDOW_START + 40)
|
||||
|
||||
|
||||
#define NS_MOUSE_MESSAGE_START 300
|
||||
#define NS_MOUSE_MOVE (NS_MOUSE_MESSAGE_START)
|
||||
#define NS_MOUSE_LEFT_BUTTON_UP (NS_MOUSE_MESSAGE_START + 1)
|
||||
#define NS_MOUSE_LEFT_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 2)
|
||||
#define NS_MOUSE_MIDDLE_BUTTON_UP (NS_MOUSE_MESSAGE_START + 10)
|
||||
#define NS_MOUSE_MIDDLE_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 11)
|
||||
#define NS_MOUSE_RIGHT_BUTTON_UP (NS_MOUSE_MESSAGE_START + 20)
|
||||
#define NS_MOUSE_RIGHT_BUTTON_DOWN (NS_MOUSE_MESSAGE_START + 21)
|
||||
#define NS_MOUSE_ENTER (NS_MOUSE_MESSAGE_START + 22)
|
||||
#define NS_MOUSE_EXIT (NS_MOUSE_MESSAGE_START + 23)
|
||||
#define NS_MOUSE_LEFT_DOUBLECLICK (NS_MOUSE_MESSAGE_START + 24)
|
||||
#define NS_MOUSE_MIDDLE_DOUBLECLICK (NS_MOUSE_MESSAGE_START + 25)
|
||||
#define NS_MOUSE_RIGHT_DOUBLECLICK (NS_MOUSE_MESSAGE_START + 26)
|
||||
#define NS_MOUSE_LEFT_CLICK (NS_MOUSE_MESSAGE_START + 27)
|
||||
#define NS_MOUSE_MIDDLE_CLICK (NS_MOUSE_MESSAGE_START + 28)
|
||||
#define NS_MOUSE_RIGHT_CLICK (NS_MOUSE_MESSAGE_START + 29)
|
||||
#define NS_MOUSE_ACTIVATE (NS_MOUSE_MESSAGE_START + 30)
|
||||
|
||||
#define NS_SCROLLBAR_MESSAGE_START 1000
|
||||
#define NS_SCROLLBAR_POS (NS_SCROLLBAR_MESSAGE_START)
|
||||
#define NS_SCROLLBAR_PAGE_NEXT (NS_SCROLLBAR_MESSAGE_START + 1)
|
||||
#define NS_SCROLLBAR_PAGE_PREV (NS_SCROLLBAR_MESSAGE_START + 2)
|
||||
#define NS_SCROLLBAR_LINE_NEXT (NS_SCROLLBAR_MESSAGE_START + 3)
|
||||
#define NS_SCROLLBAR_LINE_PREV (NS_SCROLLBAR_MESSAGE_START + 4)
|
||||
|
||||
#define NS_STREAM_EVENT_START 1100
|
||||
#define NS_PAGE_LOAD (NS_STREAM_EVENT_START)
|
||||
#define NS_PAGE_UNLOAD (NS_STREAM_EVENT_START + 1)
|
||||
#define NS_IMAGE_LOAD (NS_STREAM_EVENT_START + 2)
|
||||
#define NS_IMAGE_ABORT (NS_STREAM_EVENT_START + 3)
|
||||
#define NS_IMAGE_ERROR (NS_STREAM_EVENT_START + 4)
|
||||
|
||||
#define NS_FORM_EVENT_START 1200
|
||||
#define NS_FORM_SUBMIT (NS_FORM_EVENT_START)
|
||||
#define NS_FORM_RESET (NS_FORM_EVENT_START + 1)
|
||||
#define NS_FORM_CHANGE (NS_FORM_EVENT_START + 2)
|
||||
#define NS_FORM_SELECTED (NS_FORM_EVENT_START + 3)
|
||||
#define NS_FORM_INPUT (NS_FORM_EVENT_START + 4)
|
||||
|
||||
//Need separate focus/blur notifications for non-native widgets
|
||||
#define NS_FOCUS_EVENT_START 1300
|
||||
#define NS_FOCUS_CONTENT (NS_FOCUS_EVENT_START)
|
||||
#define NS_BLUR_CONTENT (NS_FOCUS_EVENT_START + 1)
|
||||
|
||||
|
||||
#define NS_DRAGDROP_EVENT_START 1400
|
||||
#define NS_DRAGDROP_ENTER (NS_DRAGDROP_EVENT_START)
|
||||
#define NS_DRAGDROP_OVER (NS_DRAGDROP_EVENT_START + 1)
|
||||
#define NS_DRAGDROP_EXIT (NS_DRAGDROP_EVENT_START + 2)
|
||||
#define NS_DRAGDROP_DROP (NS_DRAGDROP_EVENT_START + 3)
|
||||
#define NS_DRAGDROP_GESTURE (NS_DRAGDROP_EVENT_START + 4)
|
||||
|
||||
// Events for popups
|
||||
#define NS_MENU_EVENT_START 1500
|
||||
#define NS_MENU_CREATE (NS_MENU_EVENT_START)
|
||||
#define NS_MENU_DESTROY (NS_MENU_EVENT_START+1)
|
||||
#define NS_MENU_ACTION (NS_MENU_EVENT_START+2)
|
||||
#define NS_XUL_BROADCAST (NS_MENU_EVENT_START+3)
|
||||
#define NS_XUL_COMMAND_UPDATE (NS_MENU_EVENT_START+4)
|
||||
//@}
|
||||
|
||||
|
||||
#define NS_IS_MOUSE_EVENT(evnt) \
|
||||
(((evnt)->message == NS_MOUSE_LEFT_BUTTON_DOWN) || \
|
||||
((evnt)->message == NS_MOUSE_LEFT_BUTTON_UP) || \
|
||||
((evnt)->message == NS_MOUSE_LEFT_CLICK) || \
|
||||
((evnt)->message == NS_MOUSE_LEFT_DOUBLECLICK) || \
|
||||
((evnt)->message == NS_MOUSE_MIDDLE_BUTTON_DOWN) || \
|
||||
((evnt)->message == NS_MOUSE_MIDDLE_BUTTON_UP) || \
|
||||
((evnt)->message == NS_MOUSE_MIDDLE_CLICK) || \
|
||||
((evnt)->message == NS_MOUSE_MIDDLE_DOUBLECLICK) || \
|
||||
((evnt)->message == NS_MOUSE_RIGHT_BUTTON_DOWN) || \
|
||||
((evnt)->message == NS_MOUSE_RIGHT_BUTTON_UP) || \
|
||||
((evnt)->message == NS_MOUSE_RIGHT_CLICK) || \
|
||||
((evnt)->message == NS_MOUSE_RIGHT_DOUBLECLICK) || \
|
||||
((evnt)->message == NS_MOUSE_ENTER) || \
|
||||
((evnt)->message == NS_MOUSE_EXIT) || \
|
||||
((evnt)->message == NS_MOUSE_MOVE))
|
||||
|
||||
#define NS_IS_KEY_EVENT(evnt) \
|
||||
(((evnt)->message == NS_KEY_DOWN) || \
|
||||
((evnt)->message == NS_KEY_PRESS) || \
|
||||
((evnt)->message == NS_KEY_UP))
|
||||
|
||||
/*
|
||||
* Virtual key bindings for keyboard events
|
||||
* NOTE: These are repeated in nsIDOMEvent.h and must be kept in sync
|
||||
*/
|
||||
|
||||
#define NS_VK_CANCEL 0x03
|
||||
#define NS_VK_BACK 0x08
|
||||
#define NS_VK_TAB 0x09
|
||||
#define NS_VK_CLEAR 0x0C
|
||||
#define NS_VK_RETURN 0x0D
|
||||
#define NS_VK_ENTER 0x0E
|
||||
#define NS_VK_SHIFT 0x10
|
||||
#define NS_VK_CONTROL 0x11
|
||||
#define NS_VK_ALT 0x12
|
||||
#define NS_VK_PAUSE 0x13
|
||||
#define NS_VK_CAPS_LOCK 0x14
|
||||
#define NS_VK_ESCAPE 0x1B
|
||||
#define NS_VK_SPACE 0x20
|
||||
#define NS_VK_PAGE_UP 0x21
|
||||
#define NS_VK_PAGE_DOWN 0x22
|
||||
#define NS_VK_END 0x23
|
||||
#define NS_VK_HOME 0x24
|
||||
#define NS_VK_LEFT 0x25
|
||||
#define NS_VK_UP 0x26
|
||||
#define NS_VK_RIGHT 0x27
|
||||
#define NS_VK_DOWN 0x28
|
||||
#define NS_VK_PRINTSCREEN 0x2C
|
||||
#define NS_VK_INSERT 0x2D
|
||||
#define NS_VK_DELETE 0x2E
|
||||
|
||||
// NS_VK_0 - NS_VK_9 match their ascii values
|
||||
#define NS_VK_0 0x30
|
||||
#define NS_VK_1 0x31
|
||||
#define NS_VK_2 0x32
|
||||
#define NS_VK_3 0x33
|
||||
#define NS_VK_4 0x34
|
||||
#define NS_VK_5 0x35
|
||||
#define NS_VK_6 0x36
|
||||
#define NS_VK_7 0x37
|
||||
#define NS_VK_8 0x38
|
||||
#define NS_VK_9 0x39
|
||||
|
||||
#define NS_VK_SEMICOLON 0x3B
|
||||
#define NS_VK_EQUALS 0x3D
|
||||
|
||||
// NS_VK_A - NS_VK_Z match their ascii values
|
||||
#define NS_VK_A 0x41
|
||||
#define NS_VK_B 0x42
|
||||
#define NS_VK_C 0x43
|
||||
#define NS_VK_D 0x44
|
||||
#define NS_VK_E 0x45
|
||||
#define NS_VK_F 0x46
|
||||
#define NS_VK_G 0x47
|
||||
#define NS_VK_H 0x48
|
||||
#define NS_VK_I 0x49
|
||||
#define NS_VK_J 0x4A
|
||||
#define NS_VK_K 0x4B
|
||||
#define NS_VK_L 0x4C
|
||||
#define NS_VK_M 0x4D
|
||||
#define NS_VK_N 0x4E
|
||||
#define NS_VK_O 0x4F
|
||||
#define NS_VK_P 0x50
|
||||
#define NS_VK_Q 0x51
|
||||
#define NS_VK_R 0x52
|
||||
#define NS_VK_S 0x53
|
||||
#define NS_VK_T 0x54
|
||||
#define NS_VK_U 0x55
|
||||
#define NS_VK_V 0x56
|
||||
#define NS_VK_W 0x57
|
||||
#define NS_VK_X 0x58
|
||||
#define NS_VK_Y 0x59
|
||||
#define NS_VK_Z 0x5A
|
||||
|
||||
#define NS_VK_NUMPAD0 0x60
|
||||
#define NS_VK_NUMPAD1 0x61
|
||||
#define NS_VK_NUMPAD2 0x62
|
||||
#define NS_VK_NUMPAD3 0x63
|
||||
#define NS_VK_NUMPAD4 0x64
|
||||
#define NS_VK_NUMPAD5 0x65
|
||||
#define NS_VK_NUMPAD6 0x66
|
||||
#define NS_VK_NUMPAD7 0x67
|
||||
#define NS_VK_NUMPAD8 0x68
|
||||
#define NS_VK_NUMPAD9 0x69
|
||||
#define NS_VK_MULTIPLY 0x6A
|
||||
#define NS_VK_ADD 0x6B
|
||||
#define NS_VK_SEPARATOR 0x6C
|
||||
#define NS_VK_SUBTRACT 0x6D
|
||||
#define NS_VK_DECIMAL 0x6E
|
||||
#define NS_VK_DIVIDE 0x6F
|
||||
#define NS_VK_F1 0x70
|
||||
#define NS_VK_F2 0x71
|
||||
#define NS_VK_F3 0x72
|
||||
#define NS_VK_F4 0x73
|
||||
#define NS_VK_F5 0x74
|
||||
#define NS_VK_F6 0x75
|
||||
#define NS_VK_F7 0x76
|
||||
#define NS_VK_F8 0x77
|
||||
#define NS_VK_F9 0x78
|
||||
#define NS_VK_F10 0x79
|
||||
#define NS_VK_F11 0x7A
|
||||
#define NS_VK_F12 0x7B
|
||||
#define NS_VK_F13 0x7C
|
||||
#define NS_VK_F14 0x7D
|
||||
#define NS_VK_F15 0x7E
|
||||
#define NS_VK_F16 0x7F
|
||||
#define NS_VK_F17 0x80
|
||||
#define NS_VK_F18 0x81
|
||||
#define NS_VK_F19 0x82
|
||||
#define NS_VK_F20 0x83
|
||||
#define NS_VK_F21 0x84
|
||||
#define NS_VK_F22 0x85
|
||||
#define NS_VK_F23 0x86
|
||||
#define NS_VK_F24 0x87
|
||||
|
||||
#define NS_VK_NUM_LOCK 0x90
|
||||
#define NS_VK_SCROLL_LOCK 0x91
|
||||
|
||||
#define NS_VK_COMMA 0xBC
|
||||
#define NS_VK_PERIOD 0xBE
|
||||
#define NS_VK_SLASH 0xBF
|
||||
#define NS_VK_BACK_QUOTE 0xC0
|
||||
#define NS_VK_OPEN_BRACKET 0xDB
|
||||
#define NS_VK_BACK_SLASH 0xDC
|
||||
#define NS_VK_CLOSE_BRACKET 0xDD
|
||||
#define NS_VK_QUOTE 0xDE
|
||||
|
||||
#define NS_EVENT_FLAG_NONE 0x0000
|
||||
#define NS_EVENT_FLAG_INIT 0x0001
|
||||
#define NS_EVENT_FLAG_BUBBLE 0x0002
|
||||
#define NS_EVENT_FLAG_CAPTURE 0x0004
|
||||
#define NS_EVENT_FLAG_STOP_DISPATCH 0x0008
|
||||
#define NS_EVENT_FLAG_NO_DEFAULT 0x0010
|
||||
|
||||
// IME Constants -- keep in synch with nsIDOMTextRange.h
|
||||
#define NS_TEXTRANGE_CARETPOSITION 0x01
|
||||
#define NS_TEXTRANGE_RAWINPUT 0X02
|
||||
#define NS_TEXTRANGE_SELECTEDRAWTEXT 0x03
|
||||
#define NS_TEXTRANGE_CONVERTEDTEXT 0x04
|
||||
#define NS_TEXTRANGE_SELECTEDCONVERTEDTEXT 0x05
|
||||
|
||||
#endif // nsGUIEvent_h__
|
||||
|
||||
122
mozilla/widget/public/nsIAppShell.idl
Normal file
122
mozilla/widget/public/nsIAppShell.idl
Normal file
@@ -0,0 +1,122 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
native int(int);
|
||||
[ptr] native nsDispatchListener(nsDispatchListener);
|
||||
[ptr] native nsIEventQueue(nsIEventQueue);
|
||||
[ptr] native UndefinednsIWidget(nsIWidget);
|
||||
[ref] native PRBoolRef(PRBool);
|
||||
[ref] native voidStarRef(void *);
|
||||
|
||||
%{ C++
|
||||
#include "nsIEventQueue.h"
|
||||
|
||||
/**
|
||||
* Flags for the getNativeData function.
|
||||
* See GetNativeData()
|
||||
*/
|
||||
#define NS_NATIVE_SHELL 0
|
||||
|
||||
/**
|
||||
* During the nsIAppShell Run method notify this listener
|
||||
* after each message dispatch.
|
||||
* @see SetDispatchListener member function of nsIAppShell
|
||||
*/
|
||||
class nsDispatchListener {
|
||||
public:
|
||||
virtual void AfterDispatch() = 0;
|
||||
};
|
||||
|
||||
class nsIWidget;
|
||||
%}
|
||||
|
||||
|
||||
[uuid(a0757c31-eeac-11d1-9ec1-00aa002fb821)]
|
||||
interface nsIAppShell : nsISupports
|
||||
{
|
||||
/**
|
||||
* Creates an application shell
|
||||
*/
|
||||
|
||||
void Create(inout int argc, inout string argv);
|
||||
|
||||
/**
|
||||
* Enter an event loop.
|
||||
* Don't leave until application exits.
|
||||
*/
|
||||
|
||||
void Run();
|
||||
|
||||
/**
|
||||
* Prepare to process events.
|
||||
*/
|
||||
|
||||
void Spinup();
|
||||
|
||||
/**
|
||||
* Prepare to stop processing events.
|
||||
*/
|
||||
|
||||
void Spindown();
|
||||
|
||||
/**
|
||||
* An event queue has been created or destroyed. Hook or unhook it from
|
||||
* your system, as necessary.
|
||||
* @param aQueue the queue in question
|
||||
* @param aListen PR_TRUE for a new queue wanting hooking up. PR_FALSE
|
||||
* for a queue wanting to be unhooked.
|
||||
*/
|
||||
void ListenToEventQueue(in nsIEventQueue aQueue, in PRBool aListen);
|
||||
|
||||
/**
|
||||
* After event dispatch execute app specific code
|
||||
*/
|
||||
|
||||
void GetNativeEvent(in PRBoolRef aRealEvent, in voidStarRef aEvent);
|
||||
|
||||
/**
|
||||
* After event dispatch execute app specific code
|
||||
*/
|
||||
|
||||
void DispatchNativeEvent(in PRBool aRealEvent, in voidStar aEvent);
|
||||
|
||||
/**
|
||||
* After event dispatch execute app specific code
|
||||
*/
|
||||
|
||||
void SetDispatchListener(in nsDispatchListener aDispatchListener);
|
||||
|
||||
/**
|
||||
* Exit the handle event loop
|
||||
*/
|
||||
|
||||
void Exit();
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIAppShell_h__
|
||||
|
||||
|
||||
63
mozilla/widget/public/nsIButton.h
Normal file
63
mozilla/widget/public/nsIButton.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIButton_h__
|
||||
#define nsIButton_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {18032AD0-B265-11d1-AA2A-000000000000}
|
||||
#define NS_IBUTTON_IID \
|
||||
{ 0x18032ad0, 0xb265, 0x11d1, \
|
||||
{ 0xaa, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
/**
|
||||
* Push button widget.
|
||||
* Automatically shows itself as depressed when clicked on.
|
||||
*/
|
||||
class nsIButton : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IBUTTON_IID)
|
||||
|
||||
/**
|
||||
* Set the label
|
||||
*
|
||||
* @param Set the label to aText
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the button label
|
||||
*
|
||||
* @param aBuffer contains label upon return
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
81
mozilla/widget/public/nsICheckButton.h
Normal file
81
mozilla/widget/public/nsICheckButton.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsICheckButton_h__
|
||||
#define nsICheckButton_h__
|
||||
|
||||
// {961085F5-BD28-11d1-97EF-00609703C14E}
|
||||
#define NS_ICHECKBUTTON_IID \
|
||||
{ 0x961085f5, 0xbd28, 0x11d1, { 0x97, 0xef, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWidget.h"
|
||||
|
||||
|
||||
/**
|
||||
* Checkbox widget.
|
||||
* Can show itself in a checked or unchecked state.
|
||||
* The checkbox widget does not automatically show itself checked or unchecked when clicked on.
|
||||
*/
|
||||
class nsICheckButton : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICHECKBUTTON_IID)
|
||||
|
||||
/**
|
||||
* Set the button label
|
||||
*
|
||||
* @param aText button label
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the button label
|
||||
*
|
||||
* @param aBuffer contains label upon return
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
|
||||
|
||||
/**
|
||||
* Set the check state.
|
||||
* @param aState PR_TRUE show as checked. PR_FALSE show unchecked.
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetState(const PRBool aState) = 0;
|
||||
|
||||
/**
|
||||
* Get the check state.
|
||||
* @param aState PR_TRUE if checked. PR_FALSE if unchecked.
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetState(PRBool& aState) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsICheckButton_h__
|
||||
|
||||
88
mozilla/widget/public/nsIClipboard.idl
Normal file
88
mozilla/widget/public/nsIClipboard.idl
Normal file
@@ -0,0 +1,88 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
#include "nsITransferable.idl"
|
||||
#include "nsIClipboardOwner.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(8B5314BA-DB01-11d2-96CE-0060B0FB9956)]
|
||||
interface nsIClipboard : nsISupports
|
||||
{
|
||||
/**
|
||||
* Given a transferable, set the data on the native clipboard
|
||||
*
|
||||
* @param aTransferable The transferable
|
||||
* @param anOwner The owner of the transferable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
void setData ( in nsITransferable aTransferable, in nsIClipboardOwner anOwner) ;
|
||||
|
||||
/**
|
||||
* Given a transferable, get the clipboard data.
|
||||
*
|
||||
* @param aTransferable The transferable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
void getData ( in nsITransferable aTransferable ) ;
|
||||
|
||||
/**
|
||||
* This empties the clipboard and notifies the clipboard owner.
|
||||
* This empties the "logical" clipboard. It does not clear the native clipboard.
|
||||
*
|
||||
* @result NS_OK if successful.
|
||||
*/
|
||||
|
||||
void emptyClipboard ( ) ;
|
||||
|
||||
/**
|
||||
* Some platforms support deferred notification for putting data on the clipboard
|
||||
* This method forces the data onto the clipboard in its various formats
|
||||
* This may be used if the application going away.
|
||||
*
|
||||
* @result NS_OK if successful.
|
||||
*/
|
||||
|
||||
void forceDataToClipboard ( ) ;
|
||||
|
||||
/**
|
||||
* This provides a way to give correct UI feedback about, for instance, a paste
|
||||
* should be allowed. It does _NOT_ actually retreive the data and should be a very
|
||||
* inexpensive call. All it does is check if there is data on the clipboard matching
|
||||
* any of the flavors in the given list.
|
||||
*
|
||||
* @aFlavorList - nsISupportsString's in a nsISupportsArray (for JavaScript).
|
||||
* @outResult - if data is present matching one of
|
||||
* @result NS_OK if successful.
|
||||
*/
|
||||
boolean hasDataMatchingFlavors ( in nsISupportsArray aFlavorList ) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
45
mozilla/widget/public/nsIClipboardOwner.idl
Normal file
45
mozilla/widget/public/nsIClipboardOwner.idl
Normal file
@@ -0,0 +1,45 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsITransferable.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(5A31C7A1-E122-11d2-9A57-000064657374)]
|
||||
interface nsIClipboardOwner : nsISupports
|
||||
{
|
||||
/**
|
||||
* Notifies the owner of the clipboard transferable that the
|
||||
* transferable is being removed from the clipboard
|
||||
*
|
||||
* @param aTransferable The transferable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
void LosingOwnership ( in nsITransferable aTransferable ) ;
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
141
mozilla/widget/public/nsIComboBox.h
Normal file
141
mozilla/widget/public/nsIComboBox.h
Normal file
@@ -0,0 +1,141 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIComboBox_h__
|
||||
#define nsIComboBox_h__
|
||||
|
||||
#include "nsIListWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {961085F6-BD28-11d1-97EF-00609703C14E}
|
||||
#define NS_ICOMBOBOX_IID \
|
||||
{ 0x961085f6, 0xbd28, 0x11d1, { 0x97, 0xef, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
/**
|
||||
* Initialize combobox data
|
||||
*/
|
||||
|
||||
struct nsComboBoxInitData : public nsWidgetInitData {
|
||||
nsComboBoxInitData()
|
||||
: mDropDownHeight(0)
|
||||
{
|
||||
}
|
||||
|
||||
PRUint32 mDropDownHeight; // in pixels
|
||||
};
|
||||
|
||||
/**
|
||||
* Single selection drop down list. See nsIListWidget for capabilities
|
||||
*/
|
||||
|
||||
class nsIComboBox : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICOMBOBOX_IID);
|
||||
|
||||
/**
|
||||
* Set an item at the specific position
|
||||
*
|
||||
* @param aItem the item name. The item has to be null terminated
|
||||
* @param aPosition the position the item should be inserted at
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*/
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Finds the first occurrence of the specified item
|
||||
*
|
||||
* @param aItem the string to be filled
|
||||
* @param aStartPos the starting position (index)
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos) = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of items in the list
|
||||
*
|
||||
* @return the number of items
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetItemCount() = 0;
|
||||
|
||||
/**
|
||||
* Remove the first occurrence of the specified item
|
||||
*
|
||||
* @param aPosition the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRBool RemoveItemAt(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets an item at a specific location
|
||||
*
|
||||
* @param anItem on return contains the string of the item at that position
|
||||
* @param aPosition the Position of the item
|
||||
*
|
||||
*/
|
||||
virtual PRBool GetItemAt(nsString& anItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets the selected item for a single selection list
|
||||
*
|
||||
* @param aItem on return contains the string of the selected item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetSelectedItem(nsString &aItem) = 0;
|
||||
|
||||
/**
|
||||
* Returns with the index of the selected item
|
||||
*
|
||||
* @return PRInt32, index of selected item
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetSelectedIndex() = 0;
|
||||
|
||||
/**
|
||||
* Select the item at the specified position
|
||||
*
|
||||
* @param PRInt32, the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Deselects all the items in the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Deselect() = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // nsIComboBox_h__
|
||||
|
||||
|
||||
|
||||
148
mozilla/widget/public/nsIContextMenu.h
Normal file
148
mozilla/widget/public/nsIContextMenu.h
Normal file
@@ -0,0 +1,148 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIContextMenu_h__
|
||||
#define nsIContextMenu_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
class nsIMenuBar;
|
||||
class nsIMenu;
|
||||
class nsIMenuItem;
|
||||
class nsIMenuListener;
|
||||
|
||||
//Generate this!
|
||||
// {35A3DEC1-4992-11d2-8DBA-00609703C14E}
|
||||
#define NS_ICONTEXTMENU_IID \
|
||||
{ 0x35a3dec1, 0x4992, 0x11d2, \
|
||||
{ 0x8d, 0xba, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* Menu widget
|
||||
*/
|
||||
class nsIContextMenu : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ICONTEXTMENU_IID)
|
||||
|
||||
/**
|
||||
* Creates the context menu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsISupports * aParent, const nsString& anAlignment, const nsString& anAnchorAlignment) = 0;
|
||||
|
||||
/**
|
||||
* Get the context menu's Parent
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParent(nsISupports *&aParent) = 0;
|
||||
|
||||
/**
|
||||
* Adds a context menu Item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddItem(nsISupports* aItem) = 0;
|
||||
|
||||
/**
|
||||
* Adds a separator
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddSeparator() = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of context menu items
|
||||
* This does count separators as items
|
||||
*/
|
||||
NS_IMETHOD GetItemCount(PRUint32 &aCount) = 0;
|
||||
|
||||
/**
|
||||
* Returns a Menu or Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetItemAt(const PRUint32 aPos, nsISupports *& aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Inserts a Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aPos, nsISupports * aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Removes an Menu Item from a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveItem(const PRUint32 aPos) = 0;
|
||||
|
||||
/**
|
||||
* Removes all the Menu Items
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveAll() = 0;
|
||||
|
||||
/**
|
||||
* Gets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void** aData) = 0;
|
||||
|
||||
/**
|
||||
* Adds menu listener for dynamic construction
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Removes menu listener for dynamic construction
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Set location
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetLocation(PRInt32 aX, PRInt32 aY) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMNode
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMNode(nsIDOMNode * aMenuNode) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMElement
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aMenuElement) = 0;
|
||||
|
||||
/**
|
||||
* Set WebShell
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
70
mozilla/widget/public/nsIDragService.idl
Normal file
70
mozilla/widget/public/nsIDragService.idl
Normal file
@@ -0,0 +1,70 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
#include "nsIDragSession.idl"
|
||||
#include "nsIScriptableRegion.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(8B5314BB-DB01-11d2-96CE-0060B0FB9956)]
|
||||
interface nsIDragService : nsISupports
|
||||
{
|
||||
const long DRAGDROP_ACTION_NONE = 0;
|
||||
const long DRAGDROP_ACTION_COPY = 1;
|
||||
const long DRAGDROP_ACTION_MOVE = 2;
|
||||
const long DRAGDROP_ACTION_LINK = 4;
|
||||
|
||||
/**
|
||||
* Starts a modal drag session with an array of transaferables
|
||||
*
|
||||
* @param aTransferables - an array of transferables to be dragged
|
||||
* @param aRegion - a region containing rectangles for cursor feedback,
|
||||
* in window coordinates.
|
||||
* @param aActionType - specified which of copy/move/link are allowed
|
||||
*/
|
||||
void invokeDragSession ( in nsISupportsArray aTransferables,
|
||||
in nsIScriptableRegion aRegion, in unsigned long aActionType );
|
||||
|
||||
/**
|
||||
* Returns the current Drag Session
|
||||
*/
|
||||
nsIDragSession getCurrentSession ( ) ;
|
||||
|
||||
/**
|
||||
* Tells the Drag Service to start a drag session. This is called when
|
||||
* an external drag occurs
|
||||
*/
|
||||
void startDragSession ( ) ;
|
||||
|
||||
/**
|
||||
* Tells the Drag Service to end a drag session. This is called when
|
||||
* an external drag occurs
|
||||
*/
|
||||
void endDragSession ( ) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
80
mozilla/widget/public/nsIDragSession.idl
Normal file
80
mozilla/widget/public/nsIDragSession.idl
Normal file
@@ -0,0 +1,80 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
#include "nsITransferable.idl"
|
||||
|
||||
%{ C++
|
||||
#include "nsSize.h"
|
||||
%}
|
||||
|
||||
native nsSize (nsSize);
|
||||
|
||||
|
||||
[scriptable, uuid(CBA22C53-FCCE-11d2-96D4-0060B0FB9956)]
|
||||
interface nsIDragSession : nsISupports
|
||||
{
|
||||
/**
|
||||
* Set the current state of the drag whether it can be dropped or not.
|
||||
* usually the target "frame" sets this so the native system can render the correct feedback
|
||||
*/
|
||||
attribute boolean canDrop;
|
||||
|
||||
/**
|
||||
* Sets the action (copy, move, link, et.c) for the current drag
|
||||
*/
|
||||
attribute unsigned long dragAction;
|
||||
|
||||
/**
|
||||
* Sets the current width and height if the drag target area.
|
||||
* It will contain the current size of the Frame that the drag is currently in
|
||||
*/
|
||||
attribute nsSize targetSize;
|
||||
|
||||
/**
|
||||
* Get the number items that were dropped
|
||||
*/
|
||||
readonly attribute unsigned long numDropItems;
|
||||
|
||||
/**
|
||||
* Get data from a Drag&Drop. Can be called while the drag is in process
|
||||
* or after the drop has completed.
|
||||
*
|
||||
* @param aTransferable the transferable for the data to be put into
|
||||
* @param aItemIndex which of multiple drag items, zero-based
|
||||
*/
|
||||
void getData ( in nsITransferable aTransferable, in unsigned long aItemIndex ) ;
|
||||
|
||||
/**
|
||||
* Check to set if ant of the native data on the clipboard matches this data flavor
|
||||
*
|
||||
* @result NS_OK if if the data flavor is supported and, NS_ERROR_FAILURE is it is not
|
||||
*/
|
||||
boolean isDataFlavorSupported ( in string aDataFlavor ) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
51
mozilla/widget/public/nsIDragSessionMac.h
Normal file
51
mozilla/widget/public/nsIDragSessionMac.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIDragSessionMac_h__
|
||||
#define nsIDragSessionMac_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include <Drag.h>
|
||||
|
||||
|
||||
#define NS_IDRAGSESSIONMAC_IID \
|
||||
{ 0x36c4c380, 0x09e2, 0x11d3, { 0xb0, 0x33, 0xa4, 0x20, 0xf4, 0x2c, 0xfd, 0x7c } };
|
||||
|
||||
|
||||
class nsIDragSessionMac : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDRAGSESSIONMAC_IID)
|
||||
|
||||
/**
|
||||
* Since the drag may originate in an external application, we need some way of
|
||||
* communicating the DragManager's DragRef to the session so it can use it
|
||||
* when filling in data requests.
|
||||
*
|
||||
* @param aDragRef the MacOS DragManager's ref number for the current drag
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetDragReference ( DragReference aDragRef ) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
52
mozilla/widget/public/nsIEventListener.h
Normal file
52
mozilla/widget/public/nsIEventListener.h
Normal file
@@ -0,0 +1,52 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIEventListener_h__
|
||||
#define nsIEventListener_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
/**
|
||||
* Event listener interface.
|
||||
* Alternative to a callback for recieving events.
|
||||
*/
|
||||
|
||||
// {c83f6b80-d7ce-11d2-8360-c4c894c4917c}
|
||||
#define NS_IEVENTLISTENER_IID \
|
||||
{ 0xc83f6b80, 0xd7ce, 0x11d2, { 0x83, 0x60, 0xc4, 0xc8, 0x94, 0xc4, 0x91, 0x7c } }
|
||||
|
||||
class nsIEventListener : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IEVENTLISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes all events.
|
||||
* If a mouse listener is registered this method will not process mouse events.
|
||||
* @param anEvent the event to process. See nsGUIEvent.h for event types.
|
||||
*/
|
||||
|
||||
virtual nsEventStatus ProcessEvent(const nsGUIEvent & anEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIEventListener_h__
|
||||
75
mozilla/widget/public/nsIFileDialogsMgr.h
Normal file
75
mozilla/widget/public/nsIFileDialogsMgr.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- 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) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIFileDialogsMgr_h__
|
||||
#define nsIFileDialogsMgr_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
// {0ef98781-e34b-11d2-b345-00a0cc3c1cde}
|
||||
#define NS_IFILEDIALOGSMGR_IID \
|
||||
{ 0xef98781, 0xe34b, 0x11d2, { 0xb3, 0x45, 0x0, 0xa0, 0xcc, 0x3c, 0x1c, 0xde } }
|
||||
|
||||
#define NS_FILEDIALOGSMGR_CID \
|
||||
{ 0xef98784, 0xe34b, 0x11d2, { 0xb3, 0x45, 0x0, 0xa0, 0xcc, 0x3c, 0x1c, 0xde } }
|
||||
|
||||
enum nsFileDlgResults {
|
||||
nsFileDlgResults_Cancel, // User hit cancel, ignore selection
|
||||
nsFileDlgResults_OK, // User hit Ok, process selection
|
||||
nsFileDlgResults_Replace // User acknowledged file already exists so ok to replace, process selection
|
||||
};
|
||||
|
||||
/**
|
||||
* (native) File Dialogs utility.
|
||||
* Provides an XP wrapper to platform native file dialogs:
|
||||
* GetFile - Presents a file browser and returns an nsFileSpec for the selected file
|
||||
* GetFolder - Presents a folder/path selection dialog and returns an nsFileSpec
|
||||
* PutFile - Presents a file save dialog to the user and returns an nsFileSpec with
|
||||
* the name and path to save the file
|
||||
*
|
||||
*/
|
||||
|
||||
class nsIFileDialogsMgr : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFILEDIALOGSMGR_IID)
|
||||
|
||||
NS_IMETHOD GetFile(
|
||||
nsFileSpec & theFileSpec, // Populate with initial path for file dialog
|
||||
nsFileDlgResults & theResult, // Result from the file selection dialog prompt
|
||||
const nsString * promptString, // Window title for file selection dialog
|
||||
void * filterList) = 0;
|
||||
|
||||
NS_IMETHOD GetFolder(
|
||||
nsFileSpec & theFileSpec, // Populate with initial path for file dialog
|
||||
nsFileDlgResults & theResult, // Result from the folder selection dialog prompt
|
||||
const nsString * promptString) = 0; // Window title for folder selection dialog
|
||||
|
||||
NS_IMETHOD PutFile(
|
||||
nsFileSpec & theFileSpec, // Populate with initial path for file dialog
|
||||
nsFileDlgResults & theResult, // Result from the file save dialog prompt
|
||||
const nsString * promptString) = 0; // Window title for file save dialog
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIFileDialogsMgr_h__
|
||||
96
mozilla/widget/public/nsIFilePicker.idl
Normal file
96
mozilla/widget/public/nsIFilePicker.idl
Normal file
@@ -0,0 +1,96 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIFileSpec.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
|
||||
[scriptable, uuid(c47de916-1dd1-11b2-8141-82507fa02b21)]
|
||||
interface nsIFilePicker : nsISupports
|
||||
{
|
||||
const short modeLoad = 0; // Load a file or directory
|
||||
const short modeSave = 1; // Save a file or directory
|
||||
const short modeGetFolder = 2; // Select a fodler/directory
|
||||
|
||||
const short returnOK = 0; // User hit cancel, ignore selection
|
||||
const short returnCancel = 1; // User hit Ok, process selection
|
||||
const short returnReplace = 2; // User acknowledged file already exists so ok to replace, process selection
|
||||
|
||||
/**
|
||||
* Create the file widget.
|
||||
*
|
||||
* @param parent nsIDOMWindow parent. This dialog should be dependant on this parent.
|
||||
* @param title The title for the file widget
|
||||
* @param mode load, save, or get folder
|
||||
*
|
||||
*/
|
||||
void create(in nsIDOMWindow parent, in wstring title, in short mode);
|
||||
|
||||
/**
|
||||
* Set the list of file filters
|
||||
*
|
||||
* @param titles array of filter titles
|
||||
* @param filters array of filters to associate with titles
|
||||
* @param numberOfFilters number of filters.
|
||||
*
|
||||
*/
|
||||
void setFilterList(in long numberOfFilters,
|
||||
[array, size_is(numberOfFilters)] in wstring titles,
|
||||
[array, size_is(numberOfFilters)] in wstring filters);
|
||||
|
||||
/**
|
||||
* Get the index into the filter list for the type of file the user wants to save
|
||||
*
|
||||
* @param selectedFilter the index of the selected item in the filter list
|
||||
*
|
||||
*/
|
||||
readonly attribute long selectedFilter;
|
||||
|
||||
/* what is this? */
|
||||
attribute wstring defaultString;
|
||||
|
||||
/**
|
||||
* Set the directory that the file open/save dialog initially displays
|
||||
*
|
||||
* @param displayDirectory the name of the directory
|
||||
*
|
||||
*/
|
||||
attribute nsIFileSpec displayDirectory;
|
||||
|
||||
|
||||
/**
|
||||
* Get the nsFileSpec for the file or directory.
|
||||
*
|
||||
* @return Returns the file currently selected
|
||||
*/
|
||||
readonly attribute nsIFileSpec file;
|
||||
|
||||
/**
|
||||
* Show File Dialog. The dialog is displayed modally.
|
||||
*
|
||||
* @return returnOK if the user selects OK, returnCancel if the user selects cancel
|
||||
*
|
||||
*/
|
||||
short show();
|
||||
};
|
||||
112
mozilla/widget/public/nsIFileSpecWithUI.idl
Normal file
112
mozilla/widget/public/nsIFileSpecWithUI.idl
Normal file
@@ -0,0 +1,112 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
// This is the only correct cross-platform way to specify a file.
|
||||
// Strings are not such a way. If you grew up on windows or unix, you
|
||||
// may think they are. Welcome to reality.
|
||||
|
||||
#include "nsIFileSpec.idl"
|
||||
|
||||
%{C++
|
||||
#include "nscore.h" // for NS_WIDGET
|
||||
#include "nsIComponentManager.h"
|
||||
%}
|
||||
native StandardFilterMask(nsIFileSpecWithUI::StandardFilterMask);
|
||||
|
||||
[scriptable, uuid(8ddf7681-139a-11d3-915f-dc1f8c138b7c)]
|
||||
interface nsIFileSpecWithUI : nsIFileSpec
|
||||
{
|
||||
%{C++
|
||||
//
|
||||
// The "choose" functions present the file picker UI in order to set the
|
||||
// value of the file spec.
|
||||
%}
|
||||
|
||||
%{C++
|
||||
// The mask for standard filters is given as follows:
|
||||
enum StandardFilterMask
|
||||
{
|
||||
eAllReadable = (1<<0)
|
||||
, eHTMLFiles = (1<<1)
|
||||
, eXMLFiles = (1<<2)
|
||||
, eImageFiles = (1<<3)
|
||||
, eMailFiles = (1<<4)
|
||||
, eTextFiles = (1<<5)
|
||||
, eAllFiles = (1<<6)
|
||||
|
||||
// Mask containing all the above default filters
|
||||
, eAllStandardFilters = (
|
||||
eAllReadable
|
||||
| eHTMLFiles
|
||||
| eXMLFiles
|
||||
| eImageFiles
|
||||
| eMailFiles
|
||||
| eTextFiles
|
||||
| eAllFiles)
|
||||
, eAllMailOutputFilters = (
|
||||
eHTMLFiles
|
||||
| eMailFiles
|
||||
| eTextFiles)
|
||||
|
||||
// The "extra filter" bit should be set if the "extra filter"
|
||||
// is passed in to chooseInputFile.
|
||||
, eExtraFilter = (1<<31)
|
||||
};
|
||||
enum { kNumStandardFilters = 7, kNumMailFilters = 3 };
|
||||
%}
|
||||
[noscript] void chooseInputFile(
|
||||
in string title
|
||||
, in StandardFilterMask standardFilterMask
|
||||
, in string extraFilterTitle
|
||||
, in string extraFilter
|
||||
);
|
||||
|
||||
[noscript] void chooseOutputFile(in string windowTitle,
|
||||
in string suggestedLeafName,
|
||||
in StandardFilterMask standardFilterMask);
|
||||
|
||||
string chooseFile(in string title);
|
||||
string chooseDirectory(in string title);
|
||||
};
|
||||
|
||||
%{C++
|
||||
// Define Progid and CID
|
||||
// {e3326a80-2816-11d3-a7e5-98cb48c74f3c}
|
||||
#define NS_FILESPECWITHUI_CID \
|
||||
{ 0xe3326a80, 0x2816, 0x11d3, { 0xa7, 0xe5, 0x98, 0xcb, 0x48, 0xc7, 0x4f, 0x3c } }
|
||||
|
||||
#define NS_FILESPECWITHUI_PROGID "component://netscape/filespecwithui"
|
||||
#define NS_FILESPECWITHUI_CLASSNAME "nsIFileSpecWithUI"
|
||||
|
||||
// Factory methods
|
||||
inline nsIFileSpecWithUI* NS_CreateFileSpecWithUI()
|
||||
{
|
||||
nsIFileSpecWithUI* spec = nsnull;
|
||||
nsresult rv = nsComponentManager::CreateInstance(
|
||||
(const char*)NS_FILESPECWITHUI_PROGID,
|
||||
(nsISupports*)nsnull,
|
||||
(const nsID&)nsIFileSpecWithUI::GetIID(),
|
||||
(void**)&spec);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "ERROR: Could not make a file spec.");
|
||||
return spec;
|
||||
}
|
||||
%}
|
||||
178
mozilla/widget/public/nsIFileWidget.h
Normal file
178
mozilla/widget/public/nsIFileWidget.h
Normal file
@@ -0,0 +1,178 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIFileWidget_h__
|
||||
#define nsIFileWidget_h__
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
class nsIWidget;
|
||||
class nsIDeviceContext;
|
||||
class nsIAppShell;
|
||||
class nsIToolkit;
|
||||
|
||||
// {F8030015-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_IFILEWIDGET_IID \
|
||||
{ 0xf8030015, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
/**
|
||||
* File selector mode
|
||||
*/
|
||||
|
||||
enum nsFileDlgMode {
|
||||
/// Load a file or directory
|
||||
eMode_load,
|
||||
/// Save a file or directory
|
||||
eMode_save,
|
||||
/// Select a fodler/directory
|
||||
eMode_getfolder
|
||||
};
|
||||
|
||||
|
||||
enum nsFileDlgResults {
|
||||
nsFileDlgResults_Cancel, // User hit cancel, ignore selection
|
||||
nsFileDlgResults_OK, // User hit Ok, process selection
|
||||
nsFileDlgResults_Replace // User acknowledged file already exists so ok to replace, process selection
|
||||
};
|
||||
|
||||
/**
|
||||
* File selector widget.
|
||||
* Modally selects files for loading or saving from a list.
|
||||
*/
|
||||
|
||||
class nsIFileWidget : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFILEWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Create the file filter. This differs from the standard
|
||||
* widget Create method because it passes in the mode
|
||||
*
|
||||
* @param aParent the parent to place this widget into
|
||||
* @param aTitle The title for the file widget
|
||||
* @param aMode load or save
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsString& aTitle,
|
||||
nsFileDlgMode aMode,
|
||||
nsIDeviceContext *aContext = nsnull,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
void *aInitData = nsnull) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the list of file filters
|
||||
*
|
||||
* @param aNumberOfFilter number of filters.
|
||||
* @param aTitle array of filter titles
|
||||
* @param aFilter array of filters to associate with titles
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetFilterList(PRUint32 aNumberOfFilters,const nsString aTitles[],const nsString aFilters[]) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get the index into the filter list for the type of file the user wants to save
|
||||
*
|
||||
* @param theType the index into the filter list
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetSelectedType(PRInt16& theType) = 0;
|
||||
|
||||
/**
|
||||
* Show File Dialog. The dialog is displayed modally.
|
||||
*
|
||||
* @return PR_TRUE if user selects OK, PR_FALSE if user selects CANCEL
|
||||
*
|
||||
*/
|
||||
|
||||
virtual PRBool Show() = 0;
|
||||
|
||||
/**
|
||||
* Get the nsFileSpec for the file or directory.
|
||||
*
|
||||
* @param aFile on exit it contains the file or directory selected
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetFile(nsFileSpec& aFile) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the default string that appears in file open/save dialog
|
||||
*
|
||||
* @param aString the name of the file
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDefaultString(const nsString& aString) = 0;
|
||||
|
||||
/**
|
||||
* Set the directory that the file open/save dialog initially displays
|
||||
*
|
||||
* @param aDirectory the name of the directory
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDisplayDirectory(const nsFileSpec& aDirectory) = 0;
|
||||
|
||||
/**
|
||||
* Get the directory that the file open/save dialog was last displaying
|
||||
*
|
||||
* @param aDirectory the name of the directory
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetDisplayDirectory(nsFileSpec& aDirectory) = 0;
|
||||
|
||||
|
||||
virtual nsFileDlgResults GetFile(
|
||||
nsIWidget * aParent,
|
||||
const nsString & promptString, // Window title for the dialog
|
||||
nsFileSpec & theFileSpec) = 0; // Populate with initial path for file dialog
|
||||
|
||||
virtual nsFileDlgResults GetFolder(
|
||||
nsIWidget * aParent,
|
||||
const nsString & promptString, // Window title for the dialog
|
||||
nsFileSpec & theFileSpec) = 0; // Populate with initial path for file dialog
|
||||
|
||||
virtual nsFileDlgResults PutFile(
|
||||
nsIWidget * aParent,
|
||||
const nsString & promptString, // Window title for the dialog
|
||||
nsFileSpec & theFileSpec) = 0; // Populate with initial path for file dialog
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIFileWidget_h__
|
||||
|
||||
51
mozilla/widget/public/nsIFontNameIterator.h
Normal file
51
mozilla/widget/public/nsIFontNameIterator.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIFontNameIterator_h__
|
||||
#define nsIFontNameIterator_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsString;
|
||||
|
||||
// {CEEB39D1-0949-11d3-9A87-0050046CDA96}
|
||||
#define NS_IFONTNAMEITERATOR_IID \
|
||||
{ 0xceeb39d1, 0x949, 0x11d3, { 0x9a, 0x87, 0x0, 0x50, 0x4, 0x6c, 0xda, 0x96 } };
|
||||
|
||||
class nsIFontNameIterator : public nsISupports
|
||||
// Fonts are identified by strings, |Get| and |Advance| are distinct to facility wrapping
|
||||
// with C++ objects as standard iterators.
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFONTNAMEITERATOR_IID)
|
||||
|
||||
NS_IMETHOD Reset() = 0;
|
||||
// does not need to be called initially, returns iterator to initial state
|
||||
|
||||
NS_IMETHOD Get( nsString* aFontName ) = 0;
|
||||
// returns an error when no more names are available
|
||||
|
||||
NS_IMETHOD Advance() = 0;
|
||||
// returns an error when no more names are available
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
50
mozilla/widget/public/nsIFontRetrieverService.h
Normal file
50
mozilla/widget/public/nsIFontRetrieverService.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIFontRetrieverService_h__
|
||||
#define nsIFontRetrieverService_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
class nsIFontNameIterator;
|
||||
class nsIFontSizeIterator;
|
||||
class nsString;
|
||||
|
||||
// {285EF9B2-094A-11d3-9A87-0050046CDA96}
|
||||
#define NS_IFONTRETRIEVERSERVICE_IID \
|
||||
{ 0x285ef9b2, 0x94a, 0x11d3, { 0x9a, 0x87, 0x0, 0x50, 0x4, 0x6c, 0xda, 0x96 } };
|
||||
|
||||
class nsIFontRetrieverService : public nsISupports
|
||||
// This (singleton) service exists soley as a factory to manufacture iterators
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFONTRETRIEVERSERVICE_IID)
|
||||
|
||||
NS_IMETHOD CreateFontNameIterator( nsIFontNameIterator** aIterator ) = 0;
|
||||
|
||||
NS_IMETHOD CreateFontSizeIterator( const nsString &aFontName, nsIFontSizeIterator** aIterator ) = 0;
|
||||
|
||||
NS_IMETHOD IsFontScalable( const nsString &aFontName, PRBool* aResult ) = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
51
mozilla/widget/public/nsIFontSizeIterator.h
Normal file
51
mozilla/widget/public/nsIFontSizeIterator.h
Normal file
@@ -0,0 +1,51 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIFontSizeIterator_h__
|
||||
#define nsIFontSizeIterator_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsString;
|
||||
|
||||
// {285EF9B1-094A-11d3-9A87-0050046CDA96}
|
||||
#define NS_IFONTSIZEITERATOR_IID \
|
||||
{ 0x285ef9b1, 0x94a, 0x11d3, { 0x9a, 0x87, 0x0, 0x50, 0x4, 0x6c, 0xda, 0x96 } };
|
||||
|
||||
class nsIFontSizeIterator : public nsISupports
|
||||
// Font sizes are identified with doubles (e.g., for the possibility of fractional sizes from MM, etc.).
|
||||
// |Get| and |Advance| are distinct to facility wrapping with C++ objects as standard iterators.
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IFONTSIZEITERATOR_IID)
|
||||
|
||||
NS_IMETHOD Reset() = 0;
|
||||
// does not need to be called initially, returns iterator to initial state
|
||||
|
||||
NS_IMETHOD Get( double* aFontSize ) = 0;
|
||||
// returns an error when no more sizes are available
|
||||
|
||||
NS_IMETHOD Advance() = 0;
|
||||
// returns an error when no more sizes are available
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
69
mozilla/widget/public/nsIFormatConverter.idl
Normal file
69
mozilla/widget/public/nsIFormatConverter.idl
Normal file
@@ -0,0 +1,69 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
|
||||
|
||||
[scriptable, uuid(948A0023-E3A7-11d2-96CF-0060B0FB9956)]
|
||||
interface nsIFormatConverter : nsISupports
|
||||
{
|
||||
/**
|
||||
* Get the list of the "input" data flavors (mime types as nsISupportsString),
|
||||
* in otherwords, the flavors that this converter can convert "from" (the
|
||||
* incoming data to the converter).
|
||||
*/
|
||||
nsISupportsArray getInputDataFlavors ( ) ;
|
||||
|
||||
/**
|
||||
* Get the list of the "output" data flavors (mime types as nsISupportsString),
|
||||
* in otherwords, the flavors that this converter can convert "to" (the
|
||||
* outgoing data to the converter).
|
||||
*
|
||||
* @param aDataFlavorList fills list with supported flavors
|
||||
*/
|
||||
nsISupportsArray getOutputDataFlavors ( ) ;
|
||||
|
||||
/**
|
||||
* Determines whether a converion from one flavor to another is supported
|
||||
*
|
||||
* @param aFromFormatConverter flavor to convert from
|
||||
* @param aFromFormatConverter flavor to convert to
|
||||
*/
|
||||
boolean canConvert ( in string aFromDataFlavor, in string aToDataFlavor ) ;
|
||||
|
||||
/**
|
||||
* Converts from one flavor to another.
|
||||
*
|
||||
* @param aFromFormatConverter flavor to convert from
|
||||
* @param aFromFormatConverter flavor to convert to (destination own the memory)
|
||||
* @returns returns NS_OK if it was converted
|
||||
*/
|
||||
void convert ( in string aFromDataFlavor, in nsISupports aFromData, in unsigned long aDataLen,
|
||||
in string aToDataFlavor, out nsISupports aToData, out unsigned long aDataToLen ) ;
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
%}
|
||||
60
mozilla/widget/public/nsIKeyBindMgr.h
Normal file
60
mozilla/widget/public/nsIKeyBindMgr.h
Normal file
@@ -0,0 +1,60 @@
|
||||
/* -*- 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) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIKeyBindMgr_h__
|
||||
#define nsIKeyBindMgr_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIContent.h"
|
||||
|
||||
// {a91c0821-de58-11d2-b345-00a0cc3c1cde}
|
||||
#define NS_IKEYBINDMGR_IID \
|
||||
{ 0xa91c0821, 0xde58, 0x11d2, \
|
||||
{ 0xb3, 0x45, 0x0, 0xa0, 0xcc, 0x3c, 0x1c, 0xde } }
|
||||
|
||||
// {8B5314BD-DB01-11d2-96CE-0060B0FB9977}
|
||||
#define NS_KEYBINDMGR_CID \
|
||||
{ 0x8b5314bd, 0xdb01, 0x11d2, { 0x96, 0xce, 0x0, 0x60, 0xb0, 0xfb, 0x99, 0x77 } }
|
||||
|
||||
/**
|
||||
* Keyboard Binding utility.
|
||||
* Given a key event and a DOM node to search executes any 'key' command
|
||||
* that matches the event
|
||||
*/
|
||||
|
||||
class nsIKeyBindMgr : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IKEYBINDMGR_IID)
|
||||
|
||||
NS_IMETHOD ProcessKeyEvent(
|
||||
nsIDOMDocument * domDoc,
|
||||
const nsKeyEvent & theEvent,
|
||||
nsIWebShell * webShell,
|
||||
nsEventStatus & theStatus) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIKeyBindMgr_h__
|
||||
91
mozilla/widget/public/nsILabel.h
Normal file
91
mozilla/widget/public/nsILabel.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsILabel_h__
|
||||
#define nsILabel_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
/* F3131891-3DC7-11d2-8DB8-00609703C14E */
|
||||
#define NS_ILABEL_IID \
|
||||
{ 0xf3131891, 0x3dc7, 0x11d2, \
|
||||
{ 0x8d, 0xb8, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* Label Alignments
|
||||
*/
|
||||
|
||||
enum nsLabelAlignment {
|
||||
eAlign_Right,
|
||||
eAlign_Left,
|
||||
eAlign_Center
|
||||
};
|
||||
|
||||
struct nsLabelInitData : public nsWidgetInitData {
|
||||
nsLabelInitData()
|
||||
: mAlignment(eAlign_Left)
|
||||
{
|
||||
}
|
||||
|
||||
nsLabelAlignment mAlignment;
|
||||
};
|
||||
|
||||
/**
|
||||
* Label widget.
|
||||
* Automatically shows itself as depressed when clicked on.
|
||||
*/
|
||||
class nsILabel : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILABEL_IID)
|
||||
|
||||
/**
|
||||
* Set the label
|
||||
*
|
||||
* @param Set the label to aText
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the button label
|
||||
*
|
||||
* @param aBuffer contains label upon return
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the Label Alignemnt for creation
|
||||
*
|
||||
* @param aAlignment the alignment
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD SetAlignment(nsLabelAlignment aAlignment) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
183
mozilla/widget/public/nsIListBox.h
Normal file
183
mozilla/widget/public/nsIListBox.h
Normal file
@@ -0,0 +1,183 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIListBox_h__
|
||||
#define nsIListBox_h__
|
||||
|
||||
#include "nsIListWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {F8030014-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_ILISTBOX_IID \
|
||||
{ 0xf8030014, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
/**
|
||||
* Initialize list box data
|
||||
*/
|
||||
|
||||
struct nsListBoxInitData : public nsWidgetInitData {
|
||||
nsListBoxInitData()
|
||||
: mMultiSelect(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
PRBool mMultiSelect;
|
||||
};
|
||||
|
||||
/**
|
||||
* Single or multi selection list of items.
|
||||
* Unlike a nsIWidget, The the list widget must automatically clear
|
||||
* itself to the background color when paint messages are generated.
|
||||
* The listbox always has a vertical scrollbar. It never has a
|
||||
* horizontal scrollbar.
|
||||
*/
|
||||
|
||||
class nsIListBox : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILISTBOX_IID)
|
||||
|
||||
/**
|
||||
* Set an item at the specific position
|
||||
*
|
||||
* @param aItem the item name. The item has to be null terminated
|
||||
* @param aPosition the position the item should be inserted at
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*/
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Finds the first occurrence of the specified item
|
||||
*
|
||||
* @param aItem the string to be filled
|
||||
* @param aStartPos the starting position (index)
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos) = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of items in the list
|
||||
*
|
||||
* @return the number of items
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetItemCount() = 0;
|
||||
|
||||
/**
|
||||
* Remove the first occurrence of the specified item
|
||||
*
|
||||
* @param aPosition the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRBool RemoveItemAt(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets an item at a specific location
|
||||
*
|
||||
* @param anItem on return contains the string of the item at that position
|
||||
* @param aPosition the Position of the item
|
||||
*
|
||||
*/
|
||||
virtual PRBool GetItemAt(nsString& anItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets the selected item for a single selection list
|
||||
*
|
||||
* @param aItem on return contains the string of the selected item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetSelectedItem(nsString &aItem) = 0;
|
||||
|
||||
/**
|
||||
* Returns with the index of the selected item
|
||||
*
|
||||
* @return PRInt32, index of selected item
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetSelectedIndex() = 0;
|
||||
|
||||
/**
|
||||
* Select the item at the specified position
|
||||
*
|
||||
* @param PRInt32, the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Deselects all the items in the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Deselect() = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the listbox to be multi-select.
|
||||
* @param aMultiple PR_TRUE can have multiple selections. PR_FALSE single
|
||||
* selections only.
|
||||
* @return void
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetMultipleSelection(PRBool aMultipleSelections) = 0;
|
||||
|
||||
/**
|
||||
* Return the number of selected items. For single selection list box this
|
||||
* @return the number of selected items
|
||||
* can be 1 or 0.
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetSelectedCount() = 0;
|
||||
|
||||
/**
|
||||
* Retrieves the indices of the selected items.
|
||||
* @param aIndices Array to hold the selected items. Use GetSelectedCount to
|
||||
* determine how large the array needs to be.
|
||||
* @param aSize Size of the aIndices array
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize) = 0;
|
||||
|
||||
/**
|
||||
* Sets the indices of the selected items.
|
||||
* @param aIndices Array to hold the selected items. Use GetSelectedCount to
|
||||
* determine how large the array needs to be.
|
||||
* @param aSize Size of the aIndices array
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetSelectedIndices(PRInt32 aIndices[], PRInt32 aSize) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIListBox_h__
|
||||
|
||||
|
||||
|
||||
130
mozilla/widget/public/nsIListWidget.h
Normal file
130
mozilla/widget/public/nsIListWidget.h
Normal file
@@ -0,0 +1,130 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIListWidget_h__
|
||||
#define nsIListWidget_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {F8030013-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_ILISTWIDGET_IID \
|
||||
{ 0xf8030013, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
*
|
||||
* Base class for nsIListBox and nsIComboBox
|
||||
*
|
||||
*/
|
||||
|
||||
class nsIListWidget : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILISTWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Set an item at the specific position
|
||||
*
|
||||
* @param aItem the item name. The item has to be null terminated
|
||||
* @param aPosition the position the item should be inserted at
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*/
|
||||
NS_IMETHOD AddItemAt(nsString &aItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Finds the first occurrence of the specified item
|
||||
*
|
||||
* @param aItem the string to be filled
|
||||
* @param aStartPos the starting position (index)
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos) = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of items in the list
|
||||
*
|
||||
* @return the number of items
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetItemCount() = 0;
|
||||
|
||||
/**
|
||||
* Remove the first occurrence of the specified item
|
||||
*
|
||||
* @param aPosition the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
* @return PR_TRUE if successful, PR_FALSE otherwise
|
||||
*
|
||||
*/
|
||||
virtual PRBool RemoveItemAt(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets an item at a specific location
|
||||
*
|
||||
* @param anItem on return contains the string of the item at that position
|
||||
* @param aPosition the Position of the item
|
||||
*
|
||||
*/
|
||||
virtual PRBool GetItemAt(nsString& anItem, PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Gets the selected item for a single selection list
|
||||
*
|
||||
* @param aItem on return contains the string of the selected item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetSelectedItem(nsString &aItem) = 0;
|
||||
|
||||
/**
|
||||
* Returns with the index of the selected item
|
||||
*
|
||||
* @return PRInt32, index of selected item
|
||||
*
|
||||
*/
|
||||
virtual PRInt32 GetSelectedIndex() = 0;
|
||||
|
||||
/**
|
||||
* Select the item at the specified position
|
||||
*
|
||||
* @param PRInt32, the item position
|
||||
* 0 is at the top of the list
|
||||
* -1 is at the end of the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SelectItem(PRInt32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Deselects all the items in the list
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Deselect() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIListWidget_h__
|
||||
|
||||
|
||||
|
||||
161
mozilla/widget/public/nsILookAndFeel.h
Normal file
161
mozilla/widget/public/nsILookAndFeel.h
Normal file
@@ -0,0 +1,161 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef __nsILookAndFeel
|
||||
#define __nsILookAndFeel
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsFont.h"
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
#include "nsSize.h"
|
||||
#endif
|
||||
|
||||
|
||||
// {21B51DE1-21A3-11d2-B6E0-00805F8A2676}
|
||||
#define NS_ILOOKANDFEEL_IID \
|
||||
{ 0x21b51de1, 0x21a3, 0x11d2, \
|
||||
{ 0xb6, 0xe0, 0x0, 0x80, 0x5f, 0x8a, 0x26, 0x76 } }
|
||||
|
||||
class nsILookAndFeel: public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ILOOKANDFEEL_IID)
|
||||
|
||||
typedef enum {
|
||||
eColor_WindowBackground,
|
||||
eColor_WindowForeground,
|
||||
eColor_WidgetBackground,
|
||||
eColor_WidgetForeground,
|
||||
eColor_WidgetSelectBackground,
|
||||
eColor_WidgetSelectForeground,
|
||||
eColor_Widget3DHighlight,
|
||||
eColor_Widget3DShadow,
|
||||
eColor_TextBackground,
|
||||
eColor_TextForeground,
|
||||
eColor_TextSelectBackground,
|
||||
eColor_TextSelectForeground,
|
||||
|
||||
// New CSS 2 color definitions
|
||||
eColor_activeborder,
|
||||
eColor_activecaption,
|
||||
eColor_appworkspace,
|
||||
eColor_background,
|
||||
eColor_buttonface,
|
||||
eColor_buttonhighlight,
|
||||
eColor_buttonshadow,
|
||||
eColor_buttontext,
|
||||
eColor_captiontext,
|
||||
eColor_graytext,
|
||||
eColor_highlight,
|
||||
eColor_highlighttext,
|
||||
eColor_inactiveborder,
|
||||
eColor_inactivecaption,
|
||||
eColor_inactivecaptiontext,
|
||||
eColor_infobackground,
|
||||
eColor_infotext,
|
||||
eColor_menu,
|
||||
eColor_menutext,
|
||||
eColor_scrollbar,
|
||||
eColor_threeddarkshadow,
|
||||
eColor_threedface,
|
||||
eColor_threedhighlight,
|
||||
eColor_threedlightshadow,
|
||||
eColor_threedshadow,
|
||||
eColor_window,
|
||||
eColor_windowframe,
|
||||
eColor_windowtext
|
||||
|
||||
} nsColorID;
|
||||
|
||||
typedef enum {
|
||||
eMetric_WindowTitleHeight,
|
||||
eMetric_WindowBorderWidth,
|
||||
eMetric_WindowBorderHeight,
|
||||
eMetric_Widget3DBorder,
|
||||
eMetric_TextFieldBorder, // Native border size
|
||||
eMetric_TextFieldHeight,
|
||||
eMetric_TextVerticalInsidePadding, // needed only because of GTK
|
||||
eMetric_TextShouldUseVerticalInsidePadding, // needed only because of GTK
|
||||
eMetric_TextHorizontalInsideMinimumPadding,
|
||||
eMetric_TextShouldUseHorizontalInsideMinimumPadding, // needed only because of GTK
|
||||
eMetric_ButtonHorizontalInsidePaddingNavQuirks,
|
||||
eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks,
|
||||
eMetric_CheckboxSize,
|
||||
eMetric_RadioboxSize,
|
||||
|
||||
eMetric_ListShouldUseHorizontalInsideMinimumPadding, // needed only because of GTK
|
||||
eMetric_ListHorizontalInsideMinimumPadding,
|
||||
|
||||
eMetric_ListShouldUseVerticalInsidePadding, // needed only because of GTK
|
||||
eMetric_ListVerticalInsidePadding, // needed only because of GTK
|
||||
|
||||
eMetric_CaretBlinkTime, // default, may be overriden by OS
|
||||
eMetric_CaretWidthTwips
|
||||
} nsMetricID;
|
||||
|
||||
typedef enum {
|
||||
eMetricFloat_TextFieldVerticalInsidePadding,
|
||||
eMetricFloat_TextFieldHorizontalInsidePadding,
|
||||
eMetricFloat_TextAreaVerticalInsidePadding,
|
||||
eMetricFloat_TextAreaHorizontalInsidePadding,
|
||||
eMetricFloat_ListVerticalInsidePadding,
|
||||
eMetricFloat_ListHorizontalInsidePadding,
|
||||
eMetricFloat_ButtonVerticalInsidePadding,
|
||||
eMetricFloat_ButtonHorizontalInsidePadding
|
||||
} nsMetricFloatID;
|
||||
|
||||
|
||||
NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor) = 0;
|
||||
NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric) = 0;
|
||||
NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric) = 0;
|
||||
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
typedef enum {
|
||||
eMetricSize_TextField = 0,
|
||||
eMetricSize_TextArea = 1,
|
||||
eMetricSize_ListBox = 2,
|
||||
eMetricSize_ComboBox = 3,
|
||||
eMetricSize_Radio = 4,
|
||||
eMetricSize_CheckBox = 5,
|
||||
eMetricSize_Button = 6
|
||||
} nsMetricNavWidgetID;
|
||||
|
||||
typedef enum {
|
||||
eMetricSize_Courier = 0,
|
||||
eMetricSize_SansSerif = 1
|
||||
} nsMetricNavFontID;
|
||||
|
||||
// This method returns the actual (or nearest estimate)
|
||||
// of the Navigator size for a given form control for a given font
|
||||
// and font size. This is used in NavQuirks mode to see how closely
|
||||
// we match its size
|
||||
NS_IMETHOD GetNavSize(const nsMetricNavWidgetID aWidgetID,
|
||||
const nsMetricNavFontID aFontID,
|
||||
const PRInt32 aFontSize,
|
||||
nsSize &aSize) = 0;
|
||||
#endif
|
||||
};
|
||||
|
||||
#define nsLAF nsILookAndFeel
|
||||
|
||||
#endif /* __nsILookAndFeel */
|
||||
190
mozilla/widget/public/nsIMenu.h
Normal file
190
mozilla/widget/public/nsIMenu.h
Normal file
@@ -0,0 +1,190 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIMenu_h__
|
||||
#define nsIMenu_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
class nsIMenuBar;
|
||||
class nsIMenu;
|
||||
class nsIMenuItem;
|
||||
class nsIMenuListener;
|
||||
|
||||
// {35A3DEC1-4992-11d2-8DBA-00609703C14E}
|
||||
#define NS_IMENU_IID \
|
||||
{ 0x35a3dec1, 0x4992, 0x11d2, \
|
||||
{ 0x8d, 0xba, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
/**
|
||||
* Menu widget
|
||||
*/
|
||||
class nsIMenu : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENU_IID)
|
||||
|
||||
/**
|
||||
* Creates the Menu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsISupports * aParent, const nsString &aLabel) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu's Parent
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParent(nsISupports *&aParent) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu label
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetLabel(nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Set the Menu label
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu Access Key
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetAccessKey(nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Set the Menu Access Key
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetAccessKey(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Set the Menu enabled state
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetEnabled(PRBool aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu enabled state
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetEnabled(PRBool* aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Query if this is the help menu. Mostly for MacOS voodoo.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD IsHelpMenu(PRBool* aIsHelpMenu) = 0;
|
||||
|
||||
/**
|
||||
* Adds a Menu Item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddItem(nsISupports* aItem) = 0;
|
||||
|
||||
/**
|
||||
* Adds a separator
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddSeparator() = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of menu items
|
||||
* This does count separators as items
|
||||
*/
|
||||
NS_IMETHOD GetItemCount(PRUint32 &aCount) = 0;
|
||||
|
||||
/**
|
||||
* Returns a Menu or Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetItemAt(const PRUint32 aPos, nsISupports *& aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Inserts a Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aPos, nsISupports * aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Removes an Menu Item from a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveItem(const PRUint32 aPos) = 0;
|
||||
|
||||
/**
|
||||
* Removes all the Menu Items
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveAll() = 0;
|
||||
|
||||
/**
|
||||
* Gets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void** aData) = 0;
|
||||
|
||||
/**
|
||||
* Sets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetNativeData(void* aData) = 0;
|
||||
|
||||
/**
|
||||
* Adds menu listener for dynamic construction
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Removes menu listener for dynamic construction
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMNode
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMNode(nsIDOMNode * aMenuNode) = 0;
|
||||
|
||||
/**
|
||||
* Set DOMElement
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aMenuElement) = 0;
|
||||
|
||||
/**
|
||||
* Set WebShell
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
120
mozilla/widget/public/nsIMenuBar.h
Normal file
120
mozilla/widget/public/nsIMenuBar.h
Normal file
@@ -0,0 +1,120 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIMenuBar_h__
|
||||
#define nsIMenuBar_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIMenu.h"
|
||||
#include "nsIWebShell.h"
|
||||
|
||||
class nsIWidget;
|
||||
|
||||
// {BC658C81-4BEB-11d2-8DBB-00609703C14E}
|
||||
#define NS_IMENUBAR_IID \
|
||||
{ 0xbc658c81, 0x4beb, 0x11d2, \
|
||||
{ 0x8d, 0xbb, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* MenuBar widget
|
||||
*/
|
||||
class nsIMenuBar : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENUBAR_IID)
|
||||
|
||||
/**
|
||||
* Creates the MenuBar
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget * aParent) = 0;
|
||||
|
||||
/**
|
||||
* Get the MenuBar's Parent
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParent(nsIWidget *&aParent) = 0;
|
||||
|
||||
/**
|
||||
* Set the MenuBar's Parent
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetParent(nsIWidget *aParent) = 0;
|
||||
|
||||
/**
|
||||
* Adds the Menu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenu(nsIMenu * aMenu) = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of menus
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetMenuCount(PRUint32 &aCount) = 0;
|
||||
|
||||
/**
|
||||
* Returns a Menu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetMenuAt(const PRUint32 aCount, nsIMenu *& aMenu) = 0;
|
||||
|
||||
/**
|
||||
* Inserts a Menu at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertMenuAt(const PRUint32 aCount, nsIMenu *& aMenu) = 0;
|
||||
|
||||
/**
|
||||
* Removes an Menu from a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveMenu(const PRUint32 aCount) = 0;
|
||||
|
||||
/**
|
||||
* Removes all the Menus
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveAll() = 0;
|
||||
|
||||
/**
|
||||
* Gets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void*& aData) = 0;
|
||||
|
||||
/**
|
||||
* Sets Native MenuHandle. Temporary hack for mac until
|
||||
* nsMenuBar does it's own construction
|
||||
*/
|
||||
NS_IMETHOD SetNativeData(void* aData) = 0;
|
||||
|
||||
/**
|
||||
* Draw the menubar
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Paint() = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
189
mozilla/widget/public/nsIMenuItem.h
Normal file
189
mozilla/widget/public/nsIMenuItem.h
Normal file
@@ -0,0 +1,189 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIMenuItem_h__
|
||||
#define nsIMenuItem_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
|
||||
#include "nsIWebShell.h"
|
||||
#include "nsIDOMElement.h"
|
||||
|
||||
// {7F045771-4BEB-11d2-8DBB-00609703C14E}
|
||||
#define NS_IMENUITEM_IID \
|
||||
{ 0x7f045771, 0x4beb, 0x11d2, \
|
||||
{ 0x8d, 0xbb, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
class nsIMenu;
|
||||
class nsIPopUpMenu;
|
||||
class nsIWidget;
|
||||
class nsIMenuListener;
|
||||
|
||||
enum {
|
||||
knsMenuItemNoModifier = 0,
|
||||
knsMenuItemShiftModifier = (1 << 0),
|
||||
knsMenuItemAltModifier = (1 << 1),
|
||||
knsMenuItemControlModifier = (1 << 2),
|
||||
knsMenuItemCommandModifier = (1 << 3)
|
||||
};
|
||||
|
||||
/**
|
||||
* MenuItem widget
|
||||
*/
|
||||
class nsIMenuItem : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENUITEM_IID)
|
||||
|
||||
/**
|
||||
* Creates the MenuItem
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsISupports * aParent,
|
||||
const nsString & aLabel,
|
||||
PRBool isSeparator) = 0;
|
||||
|
||||
/**
|
||||
* Get the MenuItem label
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetLabel(nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the MenuItem label
|
||||
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetLabel(nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Set the Menu shortcut char
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetShortcutChar(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the Menu shortcut char
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetShortcutChar(nsString &aText) = 0;
|
||||
/**
|
||||
* Sets whether the item is enabled or disabled
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetEnabled(PRBool aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Gets whether the item is enabled or disabled
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetEnabled(PRBool *aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Sets whether the item is checked or not
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetChecked(PRBool aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Gets whether the item is checked or not
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetChecked(PRBool *aIsEnabled) = 0;
|
||||
|
||||
/**
|
||||
* Sets whether the item is a checkbox type
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetCheckboxType(PRBool aIsCheckbox) = 0;
|
||||
|
||||
/**
|
||||
* Gets whether the item is a checkbox type
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetCheckboxType(PRBool *aIsCheckbox) = 0;
|
||||
|
||||
/**
|
||||
* Gets the MenuItem Command identifier
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetCommand(PRUint32 & aCommand) = 0;
|
||||
|
||||
/**
|
||||
* Gets the target for MenuItem
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetTarget(nsIWidget *& aTarget) = 0;
|
||||
|
||||
/**
|
||||
* Gets Native Menu Handle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void*& aData) = 0;
|
||||
|
||||
/**
|
||||
* Adds menu listener
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Removes menu listener
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveMenuListener(nsIMenuListener * aMenuListener) = 0;
|
||||
|
||||
/**
|
||||
* Indicates whether it is a separator
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD IsSeparator(PRBool & aIsSep) = 0;
|
||||
|
||||
/**
|
||||
* Sets the JavaScript Command to be invoked when a "gui" event occurs on a source widget
|
||||
* @param aStrCmd the JS command to be cached for later execution
|
||||
* @return NS_OK
|
||||
*/
|
||||
NS_IMETHOD SetCommand(const nsString & aStrCmd) = 0;
|
||||
|
||||
/**
|
||||
* Executes the "cached" JavaScript Command
|
||||
* @return NS_OK if the command was executed properly, otherwise an error code
|
||||
*/
|
||||
NS_IMETHOD DoCommand() = 0;
|
||||
|
||||
NS_IMETHOD SetDOMNode(nsIDOMNode * aDOMNode) = 0;
|
||||
NS_IMETHOD GetDOMNode(nsIDOMNode ** aDOMNode) = 0;
|
||||
NS_IMETHOD SetDOMElement(nsIDOMElement * aDOMElement) = 0;
|
||||
NS_IMETHOD GetDOMElement(nsIDOMElement ** aDOMElement) = 0;
|
||||
NS_IMETHOD SetWebShell(nsIWebShell * aWebShell) = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetModifiers(PRUint8 aModifiers) = 0;
|
||||
NS_IMETHOD GetModifiers(PRUint8 * aModifiers) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
85
mozilla/widget/public/nsIMenuListener.h
Normal file
85
mozilla/widget/public/nsIMenuListener.h
Normal file
@@ -0,0 +1,85 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIMenuListener_h__
|
||||
#define nsIMenuListener_h__
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
// TODO: This needs to be generated!
|
||||
// {BC658C81-4BEB-11d2-8DBB-00609703C14E}
|
||||
#define NS_IMENULISTENER_IID \
|
||||
{ 0xbc658c81, 0x4beb, 0x11d2, \
|
||||
{ 0x8d, 0xbb, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x9e } }
|
||||
|
||||
static NS_DEFINE_IID(kIMenuListenerIID, NS_IMENULISTENER_IID);
|
||||
|
||||
/**
|
||||
*
|
||||
* Menu event listener
|
||||
* This interface should only be implemented by the menu manager
|
||||
* These are registered with nsWindows to recieve menu events
|
||||
*/
|
||||
|
||||
class nsIMenuListener : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMENULISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes a menu item selected event
|
||||
* @param aMenuEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MenuItemSelected(const nsMenuEvent & aMenuEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a menu selected event
|
||||
* @param aMenuEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MenuSelected(const nsMenuEvent & aMenuEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a menu deselect event
|
||||
* @param aMenuEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MenuDeselected(const nsMenuEvent & aMenuEvent) = 0;
|
||||
|
||||
virtual nsEventStatus MenuConstruct(
|
||||
|
||||
const nsMenuEvent & aMenuEvent,
|
||||
|
||||
nsIWidget * aParentWindow,
|
||||
|
||||
void * menubarNode,
|
||||
|
||||
void * aWebShell) = 0;
|
||||
|
||||
|
||||
|
||||
virtual nsEventStatus MenuDestruct(const nsMenuEvent & aMenuEvent) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIMenuListener_h__
|
||||
75
mozilla/widget/public/nsIMouseListener.h
Normal file
75
mozilla/widget/public/nsIMouseListener.h
Normal file
@@ -0,0 +1,75 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
|
||||
#ifndef nsIMouseListener_h__
|
||||
#define nsIMouseListener_h__
|
||||
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
/**
|
||||
*
|
||||
* Mouse up/down/move event listener
|
||||
*
|
||||
*/
|
||||
|
||||
// {c83f6b81-d7ce-11d2-8360-c4c894c4917c}
|
||||
#define NS_IMOUSELISTENER_IID \
|
||||
{ 0xc83f6b81, 0xd7ce, 0x11d2, { 0x83, 0x60, 0xc4, 0xc8, 0x94, 0xc4, 0x91, 0x7c } }
|
||||
|
||||
class nsIMouseListener : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IMOUSELISTENER_IID)
|
||||
|
||||
/**
|
||||
* Processes a mouse pressed event
|
||||
* @param aMouseEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MousePressed(const nsGUIEvent & aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse release event
|
||||
* @param aMouseEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MouseReleased(const nsGUIEvent & aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse clicked event
|
||||
* @param aMouseEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*
|
||||
*/
|
||||
virtual nsEventStatus MouseClicked(const nsGUIEvent & aMouseEvent) = 0;
|
||||
|
||||
/**
|
||||
* Processes a mouse moved event
|
||||
* @param aMouseEvent See nsGUIEvent.h
|
||||
* @return whether the event was consumed or ignored. See nsEventStatus
|
||||
*/
|
||||
virtual nsEventStatus MouseMoved(const nsGUIEvent & aMouseEvent) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIMouseListener_h__
|
||||
138
mozilla/widget/public/nsIPopUpMenu.h
Normal file
138
mozilla/widget/public/nsIPopUpMenu.h
Normal file
@@ -0,0 +1,138 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIPopUpMenu_h__
|
||||
#define nsIPopUpMenu_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsString.h"
|
||||
#include "nsIMenuItem.h"
|
||||
|
||||
class nsIMenu;
|
||||
class nsIWidget;
|
||||
|
||||
// {F6CD4F21-53AF-11d2-8DC4-00609703C14E}
|
||||
#define NS_IPOPUPMENU_IID \
|
||||
{ 0xf6cd4f21, 0x53af, 0x11d2, \
|
||||
{ 0x8d, 0xc4, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* PopUpMenu widget
|
||||
*/
|
||||
class nsIPopUpMenu : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IPOPUPMENU_IID)
|
||||
|
||||
/**
|
||||
* Creates the PopUpMenu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget * aParent) = 0;
|
||||
|
||||
/**
|
||||
* Adds a PopUpMenu Item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddItem(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Adds a PopUpMenu Item
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddItem(nsIMenuItem * aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Adds a Cascading PopUpMenu
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddMenu(nsIMenu * aMenu) = 0;
|
||||
|
||||
/**
|
||||
* Adds Separator
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD AddSeparator() = 0;
|
||||
|
||||
/**
|
||||
* Returns the number of menu items
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetItemCount(PRUint32 &aCount) = 0;
|
||||
|
||||
/**
|
||||
* Returns a PopUpMenu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Inserts a PopUpMenu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aCount, nsIMenuItem *& aMenuItem) = 0;
|
||||
|
||||
/**
|
||||
* Creates and inserts a PopUpMenu Item at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertItemAt(const PRUint32 aCount, const nsString & aMenuItemName) = 0;
|
||||
|
||||
/**
|
||||
* Creates and inserts a Separator at a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD InsertSeparator(const PRUint32 aCount) = 0;
|
||||
|
||||
/**
|
||||
* Removes an PopUpMenu Item from a specified Index
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveItem(const PRUint32 aCount) = 0;
|
||||
|
||||
/**
|
||||
* Removes all the PopUpMenu Items
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD RemoveAll() = 0;
|
||||
|
||||
/**
|
||||
* Shows menu and waits for action
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD ShowMenu(PRInt32 aX, PRInt32 aY) = 0;
|
||||
|
||||
/**
|
||||
* Gets Native MenuHandle
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetNativeData(void*& aData) = 0;
|
||||
|
||||
/**
|
||||
* Gets parent widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetParent(nsIWidget *& aParent) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
80
mozilla/widget/public/nsIRadioButton.h
Normal file
80
mozilla/widget/public/nsIRadioButton.h
Normal file
@@ -0,0 +1,80 @@
|
||||
/* -*- Mode: C++; tab-width: 4; 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIRadioButton_h__
|
||||
#define nsIRadioButton_h__
|
||||
|
||||
#include "nsIButton.h"
|
||||
|
||||
#define NS_IRADIOBUTTON_IID \
|
||||
{ 0x18032ad4, 0xb265, 0x11d2, \
|
||||
{ 0xaa, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
/**
|
||||
* RadioButton widget. Can show itself in a checked or unchecked state.
|
||||
* The RadioButton widget automatically shows itself checked or unchecked when clicked on.
|
||||
*/
|
||||
|
||||
class nsIRadioButton : public nsISupports {
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IRADIOBUTTON_IID)
|
||||
|
||||
/**
|
||||
* Set the button label
|
||||
*
|
||||
* @param aText button label
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetLabel(const nsString &aText) = 0;
|
||||
|
||||
/**
|
||||
* Get the button label
|
||||
*
|
||||
* @param aBuffer contains label upon return
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetLabel(nsString &aBuffer) = 0;
|
||||
|
||||
/**
|
||||
* Set the check state.
|
||||
* @param aState PR_TRUE show as checked. PR_FALSE show unchecked.
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetState(const PRBool aState) = 0;
|
||||
|
||||
/**
|
||||
* Get the check state.
|
||||
* @param aState PR_TRUE if checked. PR_FALSE if unchecked.
|
||||
* @result set to NS_OK if method successful
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetState(PRBool& aState) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIRadioButton_h__
|
||||
|
||||
|
||||
35
mozilla/widget/public/nsIRollupListener.idl
Normal file
35
mozilla/widget/public/nsIRollupListener.idl
Normal file
@@ -0,0 +1,35 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Rod Spears <rods@netscape.com>
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
[uuid(23C2BA03-6C76-11d3-96ED-0060B0FB9956)]
|
||||
interface nsIRollupListener : nsISupports
|
||||
{
|
||||
/**
|
||||
* Notifies the object to rollup
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
void Rollup();
|
||||
};
|
||||
124
mozilla/widget/public/nsIScrollbar.h
Normal file
124
mozilla/widget/public/nsIScrollbar.h
Normal file
@@ -0,0 +1,124 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIScrollbar_h__
|
||||
#define nsIScrollbar_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
|
||||
// {18032AD2-B265-11d1-AA2A-000000000000}
|
||||
#define NS_ISCROLLBAR_IID \
|
||||
{ 0x18032ad2, 0xb265, 0x11d1, \
|
||||
{ 0xaa, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Scrollbar, converts mouse input into values that can be used
|
||||
* to shift the contents of a window.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
class nsIScrollbar : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISCROLLBAR_IID)
|
||||
|
||||
/**
|
||||
* Set the scrollbar range
|
||||
* @param aEndRange set range for scrollbar from 0 to aEndRange
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetMaxRange(PRUint32 aEndRange) = 0;
|
||||
|
||||
/**
|
||||
* Get the scrollbar range
|
||||
* @return the upper end of the scrollbar range
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD GetMaxRange(PRUint32& aMaxRange) = 0;
|
||||
|
||||
/**
|
||||
* Set the thumb position.
|
||||
* @param aPos a value between (startRange) and (endRange - thumbSize)
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetPosition(PRUint32 aPos) = 0;
|
||||
|
||||
/**
|
||||
* Get the thumb position.
|
||||
* @return a value between (startRange) and (endRange - thumbSize)
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetPosition(PRUint32& aPos) = 0;
|
||||
|
||||
/**
|
||||
* Set the thumb size.
|
||||
* @param aSize size of the thumb. Must be a value between
|
||||
* startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD SetThumbSize(PRUint32 aSize) = 0;
|
||||
|
||||
/**
|
||||
* Get the thumb size.
|
||||
* @return size of the thumb. The value is between
|
||||
* startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD GetThumbSize(PRUint32& aSize) = 0;
|
||||
|
||||
/**
|
||||
* Set the line increment.
|
||||
* @param aSize size of the line increment. The value must
|
||||
* be between startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD SetLineIncrement(PRUint32 aSize) = 0;
|
||||
|
||||
/**
|
||||
* Get the line increment.
|
||||
* @return size of the line increment. The value is
|
||||
* between startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD GetLineIncrement(PRUint32& aSize) = 0;
|
||||
|
||||
/**
|
||||
* Set all scrollbar parameters at once
|
||||
* @param aMaxRange set range for scrollbar from 0 to aMaxRange
|
||||
* @param aThumbSize size of the thumb. Must be a value between
|
||||
* startRange and endRange
|
||||
* @param aPosition a value between (startRange) and (endRange - thumbSize)
|
||||
* @param aLineIncrement size of the line increment. The value must
|
||||
* be between startRange and endRange
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD SetParameters(PRUint32 aMaxRange, PRUint32 aThumbSize,
|
||||
PRUint32 aPosition, PRUint32 aLineIncrement) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIScrollbar_h__
|
||||
43
mozilla/widget/public/nsISound.idl
Normal file
43
mozilla/widget/public/nsISound.idl
Normal file
@@ -0,0 +1,43 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIFileSpec.idl"
|
||||
|
||||
[scriptable, uuid(B148EED1-236D-11d3-B35C-00A0CC3C1CDE)]
|
||||
interface nsISound : nsISupports
|
||||
{
|
||||
void Init();
|
||||
|
||||
void Play(in nsIFileSpec filespec);
|
||||
// void Stop();
|
||||
|
||||
void Beep();
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
extern nsresult
|
||||
NS_NewSound(nsISound** aSound);
|
||||
|
||||
%}
|
||||
158
mozilla/widget/public/nsITextAreaWidget.h
Normal file
158
mozilla/widget/public/nsITextAreaWidget.h
Normal file
@@ -0,0 +1,158 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsITextAreaWidget_h__
|
||||
#define nsITextAreaWidget_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsITextWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {F8030012-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_ITEXTAREAWIDGET_IID \
|
||||
{ 0xf8030012, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
/**
|
||||
* Multi-line text editor.
|
||||
* See nsITextWidget for capabilities.
|
||||
* Displays a scrollbar when the text content exceeds the number of lines
|
||||
* displayed.
|
||||
* Unlike a nsIWidget, The textarea must automatically clear
|
||||
* itself to the background color when paint messages are generated.
|
||||
*/
|
||||
|
||||
class nsITextAreaWidget : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITEXTAREAWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Get the text of this component.
|
||||
*
|
||||
* @param aTextBuffer on return contains the text of this component
|
||||
* @param aBufferSize the size of the buffer passed in
|
||||
* @param aActualSize the number of char copied
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetText(nsString &aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Set the text of this component.
|
||||
*
|
||||
* @param aText -- an object containing a copy of the text
|
||||
* @return the number of chars in the text string
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetText(const nsString &aText, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Insert text into this component.
|
||||
* When aStartPos and aEndPos are a valid range this function performs a replace.
|
||||
* When aStartPos and aEndPos are equal this function performs an insert.
|
||||
* When aStartPos and aEndPos are both -1 (0xFFFFFFFF) this function performs an append.
|
||||
* If aStartPos and aEndPos are out of range they are rounded to the closest end.
|
||||
*
|
||||
* @param aText the text to set
|
||||
* @param aStartPos starting position for inserting text
|
||||
* @param aEndPos ending position for inserting text
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Remove any content from this text widget
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD RemoveText(void) = 0;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of characters the widget can hold
|
||||
*
|
||||
* @param aChars maximum number of characters for this widget. if 0 then there isn't any limit
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetMaxTextLength(PRUint32 aChars) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the text widget to be read-only
|
||||
*
|
||||
* @param aReadOnlyFlag PR_TRUE the widget is read-only,
|
||||
* PR_FALSE indicates the widget is writable.
|
||||
* @param PR_TRUE if it was read only. PR_FALSE if it was writable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetReadOnly(PRBool aNewReadOnlyFlag, PRBool& aOldReadOnlyFlag) = 0;
|
||||
|
||||
/**
|
||||
* Select all of the contents
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SelectAll() = 0;
|
||||
|
||||
/**
|
||||
* Set the selection in this text component
|
||||
* @param aStartSel starting selection position in characters
|
||||
* @param aEndSel ending selection position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetSelection(PRUint32 aStartSel, PRUint32 aEndSel) = 0;
|
||||
|
||||
/**
|
||||
* Get the selection in this text component
|
||||
* @param aStartSel starting selection position in characters
|
||||
* @param aEndSel ending selection position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) = 0;
|
||||
|
||||
/**
|
||||
* Set the caret position
|
||||
* @param aPosition caret position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetCaretPosition(PRUint32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Get the caret position
|
||||
* @return caret position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetCaretPosition(PRUint32& aPosition) = 0;
|
||||
};
|
||||
|
||||
#endif // nsITextAreaWidget_h__
|
||||
|
||||
179
mozilla/widget/public/nsITextWidget.h
Normal file
179
mozilla/widget/public/nsITextWidget.h
Normal file
@@ -0,0 +1,179 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
#ifndef nsITextWidget_h__
|
||||
#define nsITextWidget_h__
|
||||
|
||||
#include "nsIWidget.h"
|
||||
#include "nsString.h"
|
||||
|
||||
// {F8030011-C342-11d1-97F0-00609703C14E}
|
||||
#define NS_ITEXTWIDGET_IID \
|
||||
{ 0xf8030011, 0xc342, 0x11d1, { 0x97, 0xf0, 0x0, 0x60, 0x97, 0x3, 0xc1, 0x4e } }
|
||||
|
||||
|
||||
struct nsTextWidgetInitData : public nsWidgetInitData {
|
||||
nsTextWidgetInitData()
|
||||
: mIsPassword(PR_FALSE),
|
||||
mIsReadOnly(PR_FALSE)
|
||||
{
|
||||
}
|
||||
|
||||
PRBool mIsPassword;
|
||||
PRBool mIsReadOnly;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Single line text editor.
|
||||
* Unlike a nsIWidget, The text editor must automatically clear
|
||||
* itself to the background color when paint messages are generated.
|
||||
*
|
||||
*/
|
||||
|
||||
class nsITextWidget : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ITEXTWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Get the text of this component.
|
||||
*
|
||||
* @param aTextBuffer on return contains the text of this component
|
||||
* @param aBufferSize the size of the buffer passed in
|
||||
* @param aActualSize the number of char copied
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetText(nsString &aTextBuffer, PRUint32 aBufferSize, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Set the text of this component.
|
||||
*
|
||||
* @param aText -- an object containing a copy of the text
|
||||
* @return the number of chars in the text string
|
||||
* @result NS_Ok if no errors
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetText(const nsString &aText, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Insert text into this component.
|
||||
* When aStartPos and aEndPos are a valid range this function performs a replace.
|
||||
* When aStartPos and aEndPos are equal this function performs an insert.
|
||||
* When aStartPos and aEndPos are both -1 (0xFFFFFFFF) this function performs an append.
|
||||
* If aStartPos and aEndPos are out of range they are rounded to the closest end.
|
||||
*
|
||||
* @param aText the text to set
|
||||
* @param aStartPos starting position for inserting text
|
||||
* @param aEndPos ending position for inserting text
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD InsertText(const nsString &aText, PRUint32 aStartPos, PRUint32 aEndPos, PRUint32& aActualSize) = 0;
|
||||
|
||||
/**
|
||||
* Remove any content from this text widget
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD RemoveText(void) = 0;
|
||||
|
||||
/**
|
||||
* Indicates a password will be entered.
|
||||
*
|
||||
* @param aIsPassword PR_TRUE shows contents as asterisks. PR_FALSE shows
|
||||
* contents as normal text.
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetPassword(PRBool aIsPassword) = 0;
|
||||
|
||||
/**
|
||||
* Sets the maximum number of characters the widget can hold
|
||||
*
|
||||
* @param aChars maximum number of characters for this widget. if 0 then there isn't any limit
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetMaxTextLength(PRUint32 aChars) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Set the text widget to be read-only
|
||||
*
|
||||
* @param aReadOnlyFlag PR_TRUE the widget is read-only,
|
||||
* PR_FALSE indicates the widget is writable.
|
||||
* @param PR_TRUE if it was read only. PR_FALSE if it was writable
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetReadOnly(PRBool aNewReadOnlyFlag, PRBool& aOldReadOnlyFlag) = 0;
|
||||
|
||||
/**
|
||||
* Select all of the contents
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SelectAll() = 0;
|
||||
|
||||
/**
|
||||
* Set the selection in this text component
|
||||
* @param aStartSel starting selection position in characters
|
||||
* @param aEndSel ending selection position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetSelection(PRUint32 aStartSel, PRUint32 aEndSel) = 0;
|
||||
|
||||
/**
|
||||
* Get the selection in this text component
|
||||
* @param aStartSel starting selection position in characters
|
||||
* @param aEndSel ending selection position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel) = 0;
|
||||
|
||||
/**
|
||||
* Set the caret position
|
||||
* @param aPosition caret position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetCaretPosition(PRUint32 aPosition) = 0;
|
||||
|
||||
/**
|
||||
* Get the caret position
|
||||
* @return caret position in characters
|
||||
* @result NS_Ok if no errors
|
||||
*/
|
||||
|
||||
NS_IMETHOD GetCaretPosition(PRUint32& aPosition) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsITextWidget_h__
|
||||
|
||||
50
mozilla/widget/public/nsIToolkit.idl
Normal file
50
mozilla/widget/public/nsIToolkit.idl
Normal file
@@ -0,0 +1,50 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 the Mozilla browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1999 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Stuart Parmenter <pavlov@netscape.com>
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
%{ C++
|
||||
#include "prthread.h"
|
||||
%}
|
||||
|
||||
[ptr] native PRThread(PRThread);
|
||||
|
||||
|
||||
[uuid(18032BD0-B265-11d1-AA2A-000000000000)]
|
||||
interface nsIToolkit : nsISupports
|
||||
{
|
||||
/**
|
||||
* Initialize this toolkit with aThread.
|
||||
* @param aThread The thread passed in runs the message pump.
|
||||
* NULL can be passed in, in which case a new thread gets created
|
||||
* and a message pump will run in that thread
|
||||
*
|
||||
*/
|
||||
void Init(in PRThread aThread);
|
||||
|
||||
};
|
||||
|
||||
|
||||
%{ C++
|
||||
extern NS_METHOD NS_GetCurrentToolkit(nsIToolkit* *aResult);
|
||||
%}
|
||||
123
mozilla/widget/public/nsITransferable.idl
Normal file
123
mozilla/widget/public/nsITransferable.idl
Normal file
@@ -0,0 +1,123 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla 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/MPL/
|
||||
*
|
||||
* 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 Communicator.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape Communications
|
||||
* Corp. Portions created by Netscape are Copyright (C) 1999 Netscape
|
||||
* Communications Corp. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Pinkerton
|
||||
*/
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsISupportsArray.idl"
|
||||
#include "nsIFormatConverter.idl"
|
||||
|
||||
|
||||
%{ C++
|
||||
|
||||
// these probably shouldn't live here, but in some central repository shared
|
||||
// by the entire app.
|
||||
#define kTextMime "text/plain"
|
||||
#define kXIFMime "text/xif"
|
||||
#define kUnicodeMime "text/unicode"
|
||||
#define kHTMLMime "text/html"
|
||||
#define kAOLMailMime "AOLMAIL"
|
||||
#define kPNGImageMime "image/png"
|
||||
#define kJPEGImageMime "image/jpg"
|
||||
#define kGIFImageMime "image/gif"
|
||||
#define kDropFilesMime "text/dropfiles"
|
||||
|
||||
%}
|
||||
|
||||
|
||||
[scriptable, uuid(8B5314BC-DB01-11d2-96CE-0060B0FB9956)]
|
||||
interface nsITransferable : nsISupports
|
||||
{
|
||||
/**
|
||||
* Computes a list of flavors (mime types as nsISupportsString) that the transferable
|
||||
* can export, either through intrinsic knowledge or output data converters.
|
||||
*
|
||||
* @param aDataFlavorList fills list with supported flavors. This is a copy of
|
||||
* the internal list, so it may be edited w/out affecting the transferable.
|
||||
*/
|
||||
nsISupportsArray flavorsTransferableCanExport ( ) ;
|
||||
|
||||
/**
|
||||
* Given a flavor retrieve the data.
|
||||
*
|
||||
* @param aFlavor (in parameter) the flavor of data to retrieve
|
||||
* @param aData the data. Some variant of class in nsISupportsPrimitives.idl
|
||||
* @param aDataLen the length of the data
|
||||
*/
|
||||
void getTransferData ( in string aFlavor, out nsISupports aData, out unsigned long aDataLen ) ;
|
||||
|
||||
/**
|
||||
* Returns the best flavor in the transferable, given those that have
|
||||
* been added to it with |AddFlavor()|
|
||||
*
|
||||
* @param aFlavor (out parameter) the flavor of data that was retrieved
|
||||
* @param aData the data. Some variant of class in nsISupportsPrimitives.idl
|
||||
* @param aDataLen the length of the data
|
||||
*/
|
||||
void getAnyTransferData ( out string aFlavor, out nsISupports aData, out unsigned long aDataLen ) ;
|
||||
|
||||
/**
|
||||
* Returns true if the data is large.
|
||||
*/
|
||||
boolean isLargeDataSet ( ) ;
|
||||
|
||||
///////////////////////////////
|
||||
// Setter part of interface
|
||||
///////////////////////////////
|
||||
|
||||
/**
|
||||
* Computes a list of flavors (mime types as nsISupportsString) that the transferable can
|
||||
* accept into it, either through intrinsic knowledge or input data converters.
|
||||
*
|
||||
* @param outFlavorList fills list with supported flavors. This is a copy of
|
||||
* the internal list, so it may be edited w/out affecting the transferable.
|
||||
*/
|
||||
nsISupportsArray flavorsTransferableCanImport ( ) ;
|
||||
|
||||
/**
|
||||
* Sets the data in the transferable with the specified flavor. The transferable
|
||||
* will maintain its own copy the data, so it is not necessary to do that beforehand.
|
||||
*
|
||||
* @param aFlavor the flavor of data that is being set
|
||||
* @param aData the data, some variant of class in nsISupportsPrimitives.idl
|
||||
* @param aDataLen the length of the data
|
||||
*/
|
||||
void setTransferData ( in string aFlavor, in nsISupports aData, in unsigned long aDataLen ) ;
|
||||
|
||||
/**
|
||||
* Add the data flavor, indicating that this transferable
|
||||
* can receive this type of flavor
|
||||
*
|
||||
* @param aDataFlavor a new data flavor to handle
|
||||
*/
|
||||
void addDataFlavor ( in string aDataFlavor ) ;
|
||||
|
||||
/**
|
||||
* Removes the data flavor matching the given one (string compare) and the data
|
||||
* that goes along with it.
|
||||
*
|
||||
* @param aDataFlavor a data flavor to remove
|
||||
*/
|
||||
void removeDataFlavor ( in string aDataFlavor ) ;
|
||||
|
||||
attribute nsIFormatConverter converter;
|
||||
|
||||
};
|
||||
|
||||
725
mozilla/widget/public/nsIWidget.h
Normal file
725
mozilla/widget/public/nsIWidget.h
Normal file
@@ -0,0 +1,725 @@
|
||||
/* -*- 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.
|
||||
*
|
||||
* Contributor(s):
|
||||
*/
|
||||
|
||||
#ifndef nsIWidget_h__
|
||||
#define nsIWidget_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsColor.h"
|
||||
#include "nsIMouseListener.h"
|
||||
#include "nsIMenuListener.h"
|
||||
#include "nsIImage.h"
|
||||
|
||||
#include "prthread.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
// forward declarations
|
||||
class nsIAppShell;
|
||||
class nsIToolkit;
|
||||
class nsIFontMetrics;
|
||||
class nsIToolkit;
|
||||
class nsIRenderingContext;
|
||||
class nsIEnumerator;
|
||||
class nsIDeviceContext;
|
||||
struct nsRect;
|
||||
struct nsFont;
|
||||
class nsIMenuBar;
|
||||
class nsIEventListener;
|
||||
class nsIRollupListener;
|
||||
|
||||
/**
|
||||
* Callback function that processes events.
|
||||
* The argument is actually a subtype (subclass) of nsEvent which carries
|
||||
* platform specific information about the event. Platform specific code knows
|
||||
* how to deal with it.
|
||||
* The return value determines whether or not the default action should take place.
|
||||
*/
|
||||
|
||||
typedef nsEventStatus (*PR_CALLBACK EVENT_CALLBACK)(nsGUIEvent *event);
|
||||
|
||||
/**
|
||||
* Flags for the getNativeData function.
|
||||
* See getNativeData()
|
||||
*/
|
||||
#define NS_NATIVE_WINDOW 0
|
||||
#define NS_NATIVE_GRAPHIC 1
|
||||
#define NS_NATIVE_COLORMAP 2
|
||||
#define NS_NATIVE_WIDGET 3
|
||||
#define NS_NATIVE_DISPLAY 4
|
||||
#define NS_NATIVE_REGION 5
|
||||
#define NS_NATIVE_OFFSETX 6
|
||||
#define NS_NATIVE_OFFSETY 7
|
||||
#define NS_NATIVE_PLUGIN_PORT 8
|
||||
#define NS_NATIVE_SCREEN 9
|
||||
|
||||
// {18032AD5-B265-11d1-AA2A-000000000000}
|
||||
#define NS_IWIDGET_IID \
|
||||
{ 0x18032ad5, 0xb265, 0x11d1, \
|
||||
{ 0xaa, 0x2a, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 } }
|
||||
|
||||
|
||||
// Hide the native window systems real window type so as to avoid
|
||||
// including native window system types and api's. This is necessary
|
||||
// to ensure cross-platform code.
|
||||
typedef void* nsNativeWidget;
|
||||
|
||||
/**
|
||||
* Border styles
|
||||
*/
|
||||
|
||||
enum nsWindowType {
|
||||
// default top level window
|
||||
eWindowType_toplevel,
|
||||
// top level window but usually handled differently by the OS
|
||||
eWindowType_dialog,
|
||||
// used for combo boxes, etc
|
||||
eWindowType_popup,
|
||||
// child windows (contained inside a window on the desktop (has no border))
|
||||
eWindowType_child
|
||||
};
|
||||
|
||||
|
||||
enum nsBorderStyle
|
||||
{
|
||||
// no border, titlebar, etc.. opposite of all
|
||||
eBorderStyle_none = 0,
|
||||
|
||||
// all window decorations
|
||||
eBorderStyle_all = 1 << 0,
|
||||
|
||||
// enables the border on the window. these are only for decoration and are not resize hadles
|
||||
eBorderStyle_border = 1 << 1,
|
||||
|
||||
// enables the resize handles for the window. if this is set, border is implied to also be set
|
||||
eBorderStyle_resizeh = 1 << 2,
|
||||
|
||||
// enables the titlebar for the window
|
||||
eBorderStyle_title = 1 << 3,
|
||||
|
||||
// enables the window menu button on the title bar. this being on should force the title bar to display
|
||||
eBorderStyle_menu = 1 << 4,
|
||||
|
||||
// enables the minimize button so the user can minimize the window.
|
||||
// turned off for tranient windows since they can not be minimized seperate from their parent
|
||||
eBorderStyle_minimize = 1 << 5,
|
||||
|
||||
// enables the maxmize button so the user can maximize the window
|
||||
eBorderStyle_maximize = 1 << 6,
|
||||
|
||||
// show the close button
|
||||
eBorderStyle_close = 1 << 7,
|
||||
|
||||
// whatever the OS wants... i.e. don't do anything
|
||||
eBorderStyle_default = -1
|
||||
};
|
||||
|
||||
/**
|
||||
* Cursor types.
|
||||
*/
|
||||
|
||||
enum nsCursor { ///(normal cursor, usually rendered as an arrow)
|
||||
eCursor_standard,
|
||||
///(system is busy, usually rendered as a hourglass or watch)
|
||||
eCursor_wait,
|
||||
///(Selecting something, usually rendered as an IBeam)
|
||||
eCursor_select,
|
||||
///(can hyper-link, usually rendered as a human hand)
|
||||
eCursor_hyperlink,
|
||||
///(west/east sizing, usually rendered as ->||<-)
|
||||
eCursor_sizeWE,
|
||||
///(north/south sizing, usually rendered as sizeWE rotated 90 degrees)
|
||||
eCursor_sizeNS,
|
||||
eCursor_arrow_north,
|
||||
eCursor_arrow_north_plus,
|
||||
eCursor_arrow_south,
|
||||
eCursor_arrow_south_plus,
|
||||
eCursor_arrow_west,
|
||||
eCursor_arrow_west_plus,
|
||||
eCursor_arrow_east,
|
||||
eCursor_arrow_east_plus,
|
||||
eCursor_crosshair,
|
||||
//Don't know what 'move' cursor should be. See CSS2.
|
||||
eCursor_move,
|
||||
eCursor_help
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Basic struct for widget initialization data.
|
||||
* @see Create member function of nsIWidget
|
||||
*/
|
||||
|
||||
struct nsWidgetInitData {
|
||||
nsWidgetInitData()
|
||||
: clipChildren(PR_FALSE), clipSiblings(PR_FALSE),
|
||||
mWindowType(eWindowType_child),
|
||||
mBorderStyle(eBorderStyle_default)
|
||||
{
|
||||
}
|
||||
|
||||
// when painting exclude area occupied by child windows and sibling windows
|
||||
PRPackedBool clipChildren, clipSiblings;
|
||||
nsWindowType mWindowType;
|
||||
nsBorderStyle mBorderStyle;
|
||||
};
|
||||
|
||||
/**
|
||||
* The base class for all the widgets. It provides the interface for
|
||||
* all basic and necessary functionality.
|
||||
*/
|
||||
class nsIWidget : public nsISupports {
|
||||
|
||||
public:
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_IWIDGET_IID)
|
||||
|
||||
/**
|
||||
* Create and initialize a widget.
|
||||
*
|
||||
* The widget represents a window that can be drawn into. It also is the
|
||||
* base class for user-interface widgets such as buttons and text boxes.
|
||||
*
|
||||
* All the arguments can be NULL in which case a top level window
|
||||
* with size 0 is created. The event callback function has to be
|
||||
* provided only if the caller wants to deal with the events this
|
||||
* widget receives. The event callback is basically a preprocess
|
||||
* hook called synchronously. The return value determines whether
|
||||
* the event goes to the default window procedure or it is hidden
|
||||
* to the os. The assumption is that if the event handler returns
|
||||
* false the widget does not see the event. The widget should not
|
||||
* automatically clear the window to the background color. The
|
||||
* calling code must handle paint messages and clear the background
|
||||
* itself.
|
||||
*
|
||||
* @param parent or null if it's a top level window
|
||||
* @param aRect the widget dimension
|
||||
* @param aHandleEventFunction the event handler callback function
|
||||
* @param aContext
|
||||
* @param aAppShell the parent application shell. If nsnull,
|
||||
* the parent window's application shell will be used.
|
||||
* @param aToolkit
|
||||
* @param aInitData data that is used for widget initialization
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Create(nsIWidget *aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull) = 0;
|
||||
|
||||
/**
|
||||
* Create and initialize a widget with a native window parent
|
||||
*
|
||||
* The widget represents a window that can be drawn into. It also is the
|
||||
* base class for user-interface widgets such as buttons and text boxes.
|
||||
*
|
||||
* All the arguments can be NULL in which case a top level window
|
||||
* with size 0 is created. The event callback function has to be
|
||||
* provided only if the caller wants to deal with the events this
|
||||
* widget receives. The event callback is basically a preprocess
|
||||
* hook called synchronously. The return value determines whether
|
||||
* the event goes to the default window procedure or it is hidden
|
||||
* to the os. The assumption is that if the event handler returns
|
||||
* false the widget does not see the event.
|
||||
*
|
||||
* @param aParent native window.
|
||||
* @param aRect the widget dimension
|
||||
* @param aHandleEventFunction the event handler callback function
|
||||
*/
|
||||
NS_IMETHOD Create(nsNativeWidget aParent,
|
||||
const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction,
|
||||
nsIDeviceContext *aContext,
|
||||
nsIAppShell *aAppShell = nsnull,
|
||||
nsIToolkit *aToolkit = nsnull,
|
||||
nsWidgetInitData *aInitData = nsnull) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Accessor functions to get and set the client data associated with the
|
||||
* widget.
|
||||
*/
|
||||
//@{
|
||||
NS_IMETHOD GetClientData(void*& aClientData) = 0;
|
||||
NS_IMETHOD SetClientData(void* aClientData) = 0;
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Close and destroy the internal native window.
|
||||
* This method does not delete the widget.
|
||||
*/
|
||||
|
||||
NS_IMETHOD Destroy(void) = 0;
|
||||
|
||||
/**
|
||||
* Return the parent Widget of this Widget or nsnull if this is a
|
||||
* top level window
|
||||
*
|
||||
* @return the parent widget or nsnull if it does not have a parent
|
||||
*
|
||||
*/
|
||||
virtual nsIWidget* GetParent(void) = 0;
|
||||
|
||||
/**
|
||||
* Return an nsEnumerator over the children of this widget.
|
||||
*
|
||||
* @return an enumerator over the list of children or nsnull if it does not
|
||||
* have any children
|
||||
*
|
||||
*/
|
||||
virtual nsIEnumerator* GetChildren(void) = 0;
|
||||
|
||||
/**
|
||||
* Show or hide this widget
|
||||
*
|
||||
* @param aState PR_TRUE to show the Widget, PR_FALSE to hide it
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Show(PRBool aState) = 0;
|
||||
|
||||
/**
|
||||
* Make the window modal
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetModal(PRBool aModal) = 0;
|
||||
|
||||
/**
|
||||
* Returns whether the window is visible
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD IsVisible(PRBool & aState) = 0;
|
||||
|
||||
/**
|
||||
* Move this widget.
|
||||
*
|
||||
* @param aX the new x position expressed in the parent's coordinate system
|
||||
* @param aY the new y position expressed in the parent's coordinate system
|
||||
*
|
||||
**/
|
||||
NS_IMETHOD Move(PRInt32 aX, PRInt32 aY) = 0;
|
||||
|
||||
/**
|
||||
* Resize this widget.
|
||||
*
|
||||
* @param aWidth the new width expressed in the parent's coordinate system
|
||||
* @param aHeight the new height expressed in the parent's coordinate system
|
||||
* @param aRepaint whether the widget should be repainted
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Resize(PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
PRBool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Move or resize this widget.
|
||||
*
|
||||
* @param aX the new x position expressed in the parent's coordinate system
|
||||
* @param aY the new y position expressed in the parent's coordinate system
|
||||
* @param aWidth the new width expressed in the parent's coordinate system
|
||||
* @param aHeight the new height expressed in the parent's coordinate system
|
||||
* @param aRepaint whether the widget should be repainted if the size changes
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Resize(PRInt32 aX,
|
||||
PRInt32 aY,
|
||||
PRInt32 aWidth,
|
||||
PRInt32 aHeight,
|
||||
PRBool aRepaint) = 0;
|
||||
|
||||
/**
|
||||
* Set's the widget's z-index.
|
||||
*/
|
||||
NS_IMETHOD SetZIndex(PRInt32 aZIndex) = 0;
|
||||
|
||||
/**
|
||||
* Get's the widget's z-index.
|
||||
*/
|
||||
NS_IMETHOD GetZIndex(PRInt32* aZIndex) = 0;
|
||||
|
||||
/**
|
||||
* Enable or disable this Widget
|
||||
*
|
||||
* @param aState PR_TRUE to enable the Widget, PR_FALSE to disable it.
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Enable(PRBool aState) = 0;
|
||||
|
||||
/**
|
||||
* Give focus to this widget.
|
||||
*/
|
||||
NS_IMETHOD SetFocus(void) = 0;
|
||||
|
||||
/**
|
||||
* Get this widget's outside dimensions relative to it's parent widget
|
||||
*
|
||||
* @param aRect on return it holds the x. y, width and height of this widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetBounds(nsRect &aRect) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* Get this widget's client area dimensions, if the window has a 3D border appearance
|
||||
* this returns the area inside the border, The x and y are always zero
|
||||
*
|
||||
* @param aRect on return it holds the x. y, width and height of the client area of this widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetClientBounds(nsRect &aRect) = 0;
|
||||
|
||||
/**
|
||||
* Gets the width and height of the borders
|
||||
* @param aWidth the width of the border
|
||||
* @param aHeight the height of the border
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetBorderSize(PRInt32 &aWidth, PRInt32 &aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Get the foreground color for this widget
|
||||
*
|
||||
* @return this widget's foreground color
|
||||
*
|
||||
*/
|
||||
virtual nscolor GetForegroundColor(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the foreground color for this widget
|
||||
*
|
||||
* @param aColor the new foreground color
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetForegroundColor(const nscolor &aColor) = 0;
|
||||
|
||||
/**
|
||||
* Get the background color for this widget
|
||||
*
|
||||
* @return this widget's background color
|
||||
*
|
||||
*/
|
||||
|
||||
virtual nscolor GetBackgroundColor(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the background color for this widget
|
||||
*
|
||||
* @param aColor the new background color
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetBackgroundColor(const nscolor &aColor) = 0;
|
||||
|
||||
/**
|
||||
* Get the font for this widget
|
||||
*
|
||||
* @return the font metrics
|
||||
*/
|
||||
|
||||
virtual nsIFontMetrics* GetFont(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the font for this widget
|
||||
*
|
||||
* @param aFont font to display. See nsFont for allowable fonts
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetFont(const nsFont &aFont) = 0;
|
||||
|
||||
/**
|
||||
* Get the cursor for this widget.
|
||||
*
|
||||
* @return this widget's cursor.
|
||||
*/
|
||||
|
||||
virtual nsCursor GetCursor(void) = 0;
|
||||
|
||||
/**
|
||||
* Set the cursor for this widget
|
||||
*
|
||||
* @param aCursor the new cursor for this widget
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetCursor(nsCursor aCursor) = 0;
|
||||
|
||||
/**
|
||||
* Invalidate the widget and repaint it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
|
||||
NS_IMETHOD Invalidate(PRBool aIsSynchronous) = 0;
|
||||
|
||||
/**
|
||||
* Invalidate a specified rect for a widget and repaints it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
|
||||
NS_IMETHOD Invalidate(const nsRect & aRect, PRBool aIsSynchronous) = 0;
|
||||
|
||||
/**
|
||||
* Invalidate a specified region for a widget and repaints it.
|
||||
*
|
||||
* @param aIsSynchronouse PR_TRUE then repaint synchronously. If PR_FALSE repaint later.
|
||||
* @see #Update()
|
||||
*/
|
||||
|
||||
NS_IMETHOD InvalidateRegion(const nsIRegion* aRegion, PRBool aIsSynchronous) = 0;
|
||||
|
||||
/**
|
||||
* Force a synchronous repaint of the window if there are dirty rects.
|
||||
*
|
||||
* @see Invalidate()
|
||||
*/
|
||||
|
||||
NS_IMETHOD Update() = 0;
|
||||
|
||||
/**
|
||||
* Adds a mouse listener to this widget
|
||||
* Any existing mouse listener is replaced
|
||||
*
|
||||
* @param aListener mouse listener to add to this widget.
|
||||
*/
|
||||
|
||||
NS_IMETHOD AddMouseListener(nsIMouseListener * aListener) = 0;
|
||||
|
||||
/**
|
||||
* Adds an event listener to this widget
|
||||
* Any existing event listener is replaced
|
||||
*
|
||||
* @param aListener event listener to add to this widget.
|
||||
*/
|
||||
|
||||
NS_IMETHOD AddEventListener(nsIEventListener * aListener) = 0;
|
||||
|
||||
/**
|
||||
* Adds a menu listener to this widget
|
||||
* Any existing menu listener is replaced
|
||||
*
|
||||
* @param aListener menu listener to add to this widget.
|
||||
*/
|
||||
|
||||
NS_IMETHOD AddMenuListener(nsIMenuListener * aListener) = 0;
|
||||
|
||||
/**
|
||||
* Return the widget's toolkit
|
||||
*
|
||||
* @return the toolkit this widget was created in. See nsToolkit.
|
||||
*/
|
||||
|
||||
virtual nsIToolkit* GetToolkit() = 0;
|
||||
|
||||
/**
|
||||
* Set the color map for this widget
|
||||
*
|
||||
* @param aColorMap color map for displaying this widget
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetColorMap(nsColorMap *aColorMap) = 0;
|
||||
|
||||
/**
|
||||
* Scroll this widget.
|
||||
*
|
||||
* @param aDx amount to scroll along the x-axis
|
||||
* @param aDy amount to scroll along the y-axis.
|
||||
* @param aClipRect clipping rectangle to limit the scroll to.
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect) = 0;
|
||||
|
||||
/**
|
||||
* Scroll an area of this widget.
|
||||
*
|
||||
* @param aRect source rectangle to scroll in the widget
|
||||
* @param aDx x offset from the source
|
||||
* @param aDy y offset from the source
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD ScrollRect(nsRect &aSrcRect, PRInt32 aDx, PRInt32 aDy) = 0;
|
||||
|
||||
/**
|
||||
* Internal methods
|
||||
*/
|
||||
|
||||
//@{
|
||||
virtual void AddChild(nsIWidget* aChild) = 0;
|
||||
virtual void RemoveChild(nsIWidget* aChild) = 0;
|
||||
virtual void* GetNativeData(PRUint32 aDataType) = 0;
|
||||
virtual void FreeNativeData(void * data, PRUint32 aDataType) = 0;//~~~
|
||||
virtual nsIRenderingContext* GetRenderingContext() = 0;
|
||||
virtual nsIDeviceContext* GetDeviceContext() = 0;
|
||||
virtual nsIAppShell *GetAppShell() = 0;
|
||||
//@}
|
||||
|
||||
/**
|
||||
* Set border style
|
||||
* Must be called before Create.
|
||||
* @param aBorderStyle @see nsBorderStyle
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetBorderStyle(nsBorderStyle aBorderStyle) = 0;
|
||||
|
||||
/**
|
||||
* Set the widget's title.
|
||||
* Must be called after Create.
|
||||
*
|
||||
* @param aTitle string displayed as the title of the widget
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetTitle(const nsString& aTitle) = 0;
|
||||
|
||||
/**
|
||||
* Set the widget's MenuBar.
|
||||
* Must be called after Create.
|
||||
*
|
||||
* @param aMenuBar the menubar
|
||||
*/
|
||||
|
||||
NS_IMETHOD SetMenuBar(nsIMenuBar * aMenuBar) = 0;
|
||||
|
||||
/**
|
||||
* Set the widget's MenuBar's visibility
|
||||
*
|
||||
* @param aShow PR_TRUE to show, PR_FALSE to hide
|
||||
*/
|
||||
|
||||
NS_IMETHOD ShowMenuBar(PRBool aShow) = 0;
|
||||
|
||||
/**
|
||||
* Convert from this widget coordinates to screen coordinates.
|
||||
*
|
||||
* @param aOldRect widget coordinates stored in the x,y members
|
||||
* @param aNewRect screen coordinates stored in the x,y members
|
||||
*/
|
||||
|
||||
NS_IMETHOD WidgetToScreen(const nsRect& aOldRect, nsRect& aNewRect) = 0;
|
||||
|
||||
/**
|
||||
* Convert from screen coordinates to this widget's coordinates.
|
||||
*
|
||||
* @param aOldRect screen coordinates stored in the x,y members
|
||||
* @param aNewRect widget's coordinates stored in the x,y members
|
||||
*/
|
||||
|
||||
NS_IMETHOD ScreenToWidget(const nsRect& aOldRect, nsRect& aNewRect) = 0;
|
||||
|
||||
/**
|
||||
* When adjustments are to made to a whole set of child widgets, call this
|
||||
* before resizing/positioning the child windows to minimize repaints. Must
|
||||
* be followed by EndResizingChildren() after child windows have been
|
||||
* adjusted.
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD BeginResizingChildren(void) = 0;
|
||||
|
||||
/**
|
||||
* Call this when finished adjusting child windows. Must be preceded by
|
||||
* BeginResizingChildren().
|
||||
*
|
||||
*/
|
||||
|
||||
NS_IMETHOD EndResizingChildren(void) = 0;
|
||||
|
||||
/**
|
||||
* Returns the preferred width and height for the widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD GetPreferredSize(PRInt32& aWidth, PRInt32& aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Set the preferred width and height for the widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetPreferredSize(PRInt32 aWidth, PRInt32 aHeight) = 0;
|
||||
|
||||
/**
|
||||
* Dispatches and event to the widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus) = 0;
|
||||
|
||||
|
||||
#ifdef LOSER
|
||||
/**
|
||||
* FSets the vertical scrollbar widget
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD SetVerticalScrollbar(nsIWidget * aScrollbar) = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* For printing and lightweight widgets
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD Paint(nsIRenderingContext& aRenderingContext,
|
||||
const nsRect& aDirtyRect) = 0;
|
||||
|
||||
/**
|
||||
* Enables the dropping of files to a widget (XXX this is temporary)
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD EnableDragDrop(PRBool aEnable) = 0;
|
||||
|
||||
virtual void ConvertToDeviceCoordinates(nscoord &aX,nscoord &aY) = 0;
|
||||
|
||||
/**
|
||||
* Enables/Disables system mouse capture.
|
||||
* @param aCapture PR_TRUE enables mouse capture, PR_FALSE disables mouse capture
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD CaptureMouse(PRBool aCapture) = 0;
|
||||
|
||||
/**
|
||||
* Enables/Disables system capture of any and all events that would cause a
|
||||
* dropdown to be rolled up, This method ignores the aConsumeRollupEvent
|
||||
* parameter when aDoCapture is FALSE
|
||||
* @param aCapture PR_TRUE enables capture, PR_FALSE disables capture
|
||||
* @param aConsumeRollupEvent PR_TRUE consumes the rollup event, PR_FALSE dispatches rollup event
|
||||
*
|
||||
*/
|
||||
NS_IMETHOD CaptureRollupEvents(nsIRollupListener * aListener, PRBool aDoCapture, PRBool aConsumeRollupEvent) = 0;
|
||||
|
||||
/**
|
||||
* Determine whether a given event should be processed assuming we are
|
||||
* the currently active modal window.
|
||||
* Note that the exact semantics of this method are platform-dependent.
|
||||
* The Macintosh, for instance, cares deeply that this method do exactly
|
||||
* as advertised. Gtk, for instance, handles modality in a completely
|
||||
* different fashion and does little if anything with this method.
|
||||
* @param aRealEvent event is real or a null placeholder (Macintosh)
|
||||
* @param aEvent void pointer to native event structure
|
||||
* @param aForWindow return value. PR_TRUE iff event should be processed.
|
||||
*/
|
||||
NS_IMETHOD ModalEventFilter(PRBool aRealEvent, void *aEvent, PRBool *aForWindow) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // nsIWidget_h__
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user