зеркало из https://github.com/mozilla/gecko-dev.git
Removing no longer used mozilla/shell
This commit is contained in:
Родитель
4689aa292a
Коммит
abde4120e0
|
@ -1,23 +0,0 @@
|
|||
#!gmake
|
||||
#
|
||||
# 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 = ..
|
||||
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
|
@ -1,32 +0,0 @@
|
|||
#!gmake
|
||||
#
|
||||
# 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 = ../..
|
||||
|
||||
MODULE = shell
|
||||
|
||||
EXPORTS = \
|
||||
nsMenuBar.h \
|
||||
nsMenuItem.h \
|
||||
nsApplicationManager.h \
|
||||
nsShellInstance.h \
|
||||
nsShellCIID.h \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
|
@ -1,33 +0,0 @@
|
|||
#!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=..\..
|
||||
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
MODULE=shell
|
||||
|
||||
EXPORTS = \
|
||||
nsMenuBar.h \
|
||||
nsMenuItem.h \
|
||||
nsApplicationManager.h \
|
||||
nsShellInstance.h \
|
||||
nsShellCIID.h \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
#ifndef __nsApplicationManager_h
|
||||
#define __nsApplicationManager_h
|
||||
|
||||
|
||||
#include "nscore.h"
|
||||
#include "plstr.h"
|
||||
#include "prtypes.h"
|
||||
#include "prmon.h"
|
||||
#include "plstr.h"
|
||||
#include "nsCom.h"
|
||||
#include "nsshell.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nsIShellInstance.h"
|
||||
#include "nsIApplicationShell.h"
|
||||
|
||||
|
||||
/**
|
||||
* ModalMessage enumerations
|
||||
*/
|
||||
enum nsModalMessageType
|
||||
{
|
||||
eModalMessage_ok,
|
||||
eModalMessage_ok_cancel,
|
||||
};
|
||||
|
||||
|
||||
// Application Manager - Manages Application Instances
|
||||
class NS_SHELL nsApplicationManager
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Initialize the ApplicationManager
|
||||
* @result The result of the initialization, NS_OK if no errors
|
||||
*/
|
||||
static nsresult Initialize();
|
||||
|
||||
/**
|
||||
* Get the ShellInstance associated with an Application
|
||||
* @param aApplicationShell - The Application Shell
|
||||
* @param aShellInstance = The returned shell instance for this application
|
||||
* @result The result of the initialization, NS_OK if no errors
|
||||
*/
|
||||
static nsresult GetShellInstance(nsIApplicationShell * aApplicationShell,
|
||||
nsIShellInstance **aShellInstance);
|
||||
|
||||
/**
|
||||
* Set the ShellInstance associated with an Application
|
||||
* @param aApplicationShell - The Application Shell
|
||||
* @param aShellInstance =The Shell instance for this application
|
||||
* @result The result of the initialization, NS_OK if no errors
|
||||
*/
|
||||
static nsresult SetShellAssociation(nsIApplicationShell * aApplicationShell,
|
||||
nsIShellInstance *aShellInstance);
|
||||
|
||||
/**
|
||||
* Delete the Association of the ShellInstance with the Application
|
||||
* @param aApplicationShell - The Application Shell
|
||||
* @param aShellInstance =The Shell instance for this application
|
||||
* @result The result of the initialization, NS_OK if no errors
|
||||
*/
|
||||
static nsresult DeleteShellAssociation(nsIApplicationShell * aApplicationShell,
|
||||
nsIShellInstance *aShellInstance);
|
||||
|
||||
/**
|
||||
* Display an Application-wide Modal Message Box
|
||||
* @param aMessage The Message String to display
|
||||
* @param aTitle The String to display in title area
|
||||
* @param aModalMessageType The type of Modal Message
|
||||
* @result The result of the initialization, NS_OK if no errors
|
||||
*/
|
||||
static nsresult ModalMessage(const nsString &aMessage, const nsString &aTitle, nsModalMessageType aModalMessageType);
|
||||
|
||||
private:
|
||||
|
||||
static nsresult checkInitialized();
|
||||
|
||||
private:
|
||||
|
||||
static PRMonitor * monitor;
|
||||
static nsHashtable * applications;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,48 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#include "nsIMenuBar.h"
|
||||
|
||||
|
||||
class nsMenuBar : public nsIMenuBar
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor and Destructor
|
||||
*/
|
||||
|
||||
nsMenuBar();
|
||||
~nsMenuBar();
|
||||
|
||||
/**
|
||||
* ISupports Interface
|
||||
*/
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
/**
|
||||
* Initialize Method
|
||||
* @result The result of the initialization, NS_OK if no errors
|
||||
*/
|
||||
NS_IMETHOD Init();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#include "nsIMenuItem.h"
|
||||
|
||||
|
||||
class nsMenuItem : public nsIMenuItem
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor and Destructor
|
||||
*/
|
||||
|
||||
nsMenuItem();
|
||||
~nsMenuItem();
|
||||
|
||||
/**
|
||||
* ISupports Interface
|
||||
*/
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
/**
|
||||
* Initialize Method
|
||||
* @result The result of the initialization, NS_OK if no errors
|
||||
*/
|
||||
NS_IMETHOD Init();
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsShellCIID_h__
|
||||
#define nsShellCIID_h__
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsRepository.h"
|
||||
|
||||
#define NS_SHELLINSTANCE_CID \
|
||||
{ 0x90487580, 0xfefe, 0x11d1, \
|
||||
{0xbe, 0xcd, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
|
||||
|
||||
// 74222650-2d76-11d2-9246-00805f8a7ab6
|
||||
#define NS_MENUBAR_CID \
|
||||
{ 0x74222650, 0x2d76, 0x11d2, \
|
||||
{0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
// 7a01c6d0-2d76-11d2-9246-00805f8a7ab6
|
||||
#define NS_MENUITEM_CID \
|
||||
{ 0x7a01c6d0, 0x2d76, 0x11d2, \
|
||||
{0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
#define NS_IAPPLICATIONSHELL_CID \
|
||||
{ 0x2293d960, 0xdeff, 0x11d1, \
|
||||
{0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
#endif
|
|
@ -1,144 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nsIApplicationShell.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nscore.h"
|
||||
#include "nsweb.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsIShellInstance.h"
|
||||
|
||||
|
||||
class nsIPref;
|
||||
|
||||
|
||||
// platform independent native handle to application instance
|
||||
typedef void * nsNativeApplicationInstance ;
|
||||
|
||||
class nsShellInstance : public nsIShellInstance
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Constructor and Destructor
|
||||
*/
|
||||
|
||||
nsShellInstance();
|
||||
~nsShellInstance();
|
||||
|
||||
void* operator new(size_t sz) {
|
||||
void* rv = new char[sz];
|
||||
nsCRT::zero(rv, sz);
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* ISupports Interface
|
||||
*/
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
/**
|
||||
* Initialize Method
|
||||
* @result The result of the initialization, NS_OK if no errors
|
||||
*/
|
||||
NS_IMETHOD Init();
|
||||
|
||||
/**
|
||||
* Event Loop Execution
|
||||
* @result The result of the initialization, NS_OK if no errors
|
||||
*/
|
||||
NS_IMETHOD Run();
|
||||
|
||||
/**
|
||||
* Application Wide Factory Registration
|
||||
* @result The result of the initialization, NS_OK if no errors
|
||||
*/
|
||||
NS_IMETHOD RegisterFactories();
|
||||
|
||||
/**
|
||||
* Get the native instance associated with this shell instance
|
||||
* @result An opaque native instance pointer
|
||||
*/
|
||||
NS_IMETHOD_(void *) GetNativeInstance();
|
||||
|
||||
/**
|
||||
* Set the Native Instance associated with this shell instance
|
||||
* @param aNativeInstance The native instance
|
||||
* @result None
|
||||
*/
|
||||
NS_IMETHOD_(void) SetNativeInstance(void * aNativeInstance);
|
||||
|
||||
/**
|
||||
* Get the Application Shell
|
||||
* @result nsIApplicationShell Application Shell
|
||||
*/
|
||||
NS_IMETHOD_(nsIApplicationShell *) GetApplicationShell();
|
||||
|
||||
/**
|
||||
* Set the Application Shell for this Instance
|
||||
* @param aApplicationShell the Application Shell
|
||||
* @result None
|
||||
*/
|
||||
NS_IMETHOD_(void) SetApplicationShell(nsIApplicationShell * aApplicationShell);
|
||||
|
||||
/**
|
||||
* Create a toplevel Application Window for this application
|
||||
* @param nsRect Rect in screen coordinates of toplevel window
|
||||
* @param aHandleEventFunction Event Loop Callbacl function
|
||||
* @result a Pointer to the nsIWidget representing the toplevel Window
|
||||
*/
|
||||
NS_IMETHOD_(nsIWidget *) CreateApplicationWindow(const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction) ;
|
||||
|
||||
/**
|
||||
* Show/Hide the toplevel Application Window
|
||||
* @param show Boolean of PR_TRUE/PR_FALSE on whether to Show/Hide the window
|
||||
* @result nsresult NS_OK upon successful completion
|
||||
*/
|
||||
NS_IMETHOD ShowApplicationWindow(PRBool show) ;
|
||||
|
||||
/**
|
||||
* Get the native window associated with the toplevel Application Instance
|
||||
* @result Opaque handle to the application window native instance
|
||||
*/
|
||||
NS_IMETHOD_(void *) GetApplicationWindowNativeInstance() ;
|
||||
|
||||
/**
|
||||
* Get the widget associated with the toplevel Application Instance
|
||||
* @result a Pointer to the nsIWidget representing the toplevel Window
|
||||
*/
|
||||
NS_IMETHOD_(nsIWidget *) GetApplicationWidget() ;
|
||||
|
||||
/**
|
||||
* Exit this application
|
||||
* @result nsresult NS_OK upon succcessful completion
|
||||
*/
|
||||
NS_IMETHOD ExitApplication() ;
|
||||
|
||||
NS_IMETHOD_(nsIPref *) GetPreferences() ;
|
||||
|
||||
private:
|
||||
nsNativeApplicationInstance mNativeInstance ;
|
||||
nsIApplicationShell * mApplicationShell ;
|
||||
nsIWidget * mApplicationWindow ;
|
||||
nsIPref * mPref;
|
||||
|
||||
};
|
||||
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
#!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=..
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
|
@ -1,32 +0,0 @@
|
|||
#!gmake
|
||||
#
|
||||
# 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 = ../..
|
||||
|
||||
MODULE = shell
|
||||
|
||||
EXPORTS = \
|
||||
nsIApplicationShell.h \
|
||||
nsIShellInstance.h \
|
||||
nsIMenuBar.h \
|
||||
nsIMenuItem.h \
|
||||
nsshell.h \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
|
@ -1,33 +0,0 @@
|
|||
#!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=..\..
|
||||
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
MODULE=shell
|
||||
|
||||
EXPORTS = \
|
||||
nsIApplicationShell.h \
|
||||
nsIShellInstance.h \
|
||||
nsIMenuBar.h \
|
||||
nsIMenuItem.h \
|
||||
nsshell.h \
|
||||
$(NULL)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsIApplicationShell_h___
|
||||
#define nsIApplicationShell_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsshell.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIShellInstance.h"
|
||||
|
||||
#define NS_IAPPLICATIONSHELL_IID \
|
||||
{ 0xaf9a93e0, 0xdebc, 0x11d1, \
|
||||
{0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
extern "C" nsresult NS_RegisterApplicationShellFactory();
|
||||
|
||||
// Application Shell Interface
|
||||
class nsIApplicationShell : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Initialize the ApplicationShell
|
||||
* @result The result of the initialization, NS_OK if no errors
|
||||
*/
|
||||
NS_IMETHOD Init() = 0;
|
||||
|
||||
/**
|
||||
* Start the Shell's Event Loop.
|
||||
* @result The result of the event loop execution, NS_Ok if appropriate Exit Message occured
|
||||
*/
|
||||
NS_IMETHOD Run() = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIApplicationShell_h___ */
|
|
@ -1,44 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsIMenuBar_h___
|
||||
#define nsIMenuBar_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// 52fb95f0-2cbe-11d2-9246-00805f8a7ab6
|
||||
#define NS_IMENUBAR_IID \
|
||||
{ 0x52fb95f0, 0x2cbe, 0x11d2, \
|
||||
{0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
class nsIMenuBar : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Initialize the MenuBar
|
||||
* @result The result of the initialization, NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD Init() = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIMenuBar_h___ */
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsIMenuItem_h___
|
||||
#define nsIMenuItem_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
|
||||
// 8a400b00-2cbe-11d2-9246-00805f8a7ab6
|
||||
#define NS_IMENUITEM_IID \
|
||||
{ 0x8a400b00, 0x2cbe, 0x11d2, \
|
||||
{0x92, 0x46, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
class nsIMenuItem : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* Initialize the MenuBar
|
||||
* @result The result of the initialization, NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD Init() = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIMenuItem_h___ */
|
||||
|
|
@ -1,124 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef nsIShellInstance_h___
|
||||
#define nsIShellInstance_h___
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsshell.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIApplicationShell.h"
|
||||
#include "nsIWidget.h"
|
||||
|
||||
class nsIApplicationShell;
|
||||
class nsIPref;
|
||||
|
||||
#define NS_ISHELLINSTANCE_IID \
|
||||
{ 0xbf88e640, 0xdf99, 0x11d1, \
|
||||
{0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
|
||||
|
||||
// An Interface for interacting with a specific Application Instance
|
||||
class nsIShellInstance : public nsISupports
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Initialize the ShellInstance
|
||||
* @result The result of the initialization, NS_Ok if no errors
|
||||
*/
|
||||
NS_IMETHOD Init() = 0;
|
||||
|
||||
/**
|
||||
* Start the Shell's Event Loop.
|
||||
* @result The result of the event loop execution, NS_Ok if appropriate Exit Message occured
|
||||
*/
|
||||
NS_IMETHOD Run() = 0;
|
||||
|
||||
/**
|
||||
* Get Platform Specific Native Instance Handle representing this application
|
||||
* @result An opaque pointer to the native application instance
|
||||
*/
|
||||
NS_IMETHOD_(void *) GetNativeInstance() = 0;
|
||||
|
||||
/**
|
||||
* Set the Platform Specific Native Instance Handle representing this application
|
||||
* @param aNativeInstance Opaque handle to the native instance
|
||||
* @result none
|
||||
*/
|
||||
NS_IMETHOD_(void) SetNativeInstance(void * aNativeInstance) = 0;
|
||||
|
||||
/**
|
||||
* Get a Handle to the ApplicationShell Interface for this Instance
|
||||
* @result nsIApplicationShell* a Pointer to the ApplicationShell
|
||||
*/
|
||||
NS_IMETHOD_(nsIApplicationShell *) GetApplicationShell() = 0;
|
||||
|
||||
/**
|
||||
* Set a Handle to the ApplicationShell Interface for this Instance
|
||||
* @param aApplicationShell nsIApplicationShell Object
|
||||
* @result none
|
||||
*/
|
||||
NS_IMETHOD_(void) SetApplicationShell(nsIApplicationShell * aApplicationShell) = 0;
|
||||
|
||||
/**
|
||||
* Create a toplevel Application Window for this application
|
||||
* @param nsRect Rect in screen coordinates of toplevel window
|
||||
* @param aHandleEventFunction Event Loop Callbacl function
|
||||
* @result a Pointer to the nsIWidget representing the toplevel Window
|
||||
*/
|
||||
NS_IMETHOD_(nsIWidget *) CreateApplicationWindow(const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction) = 0 ;
|
||||
|
||||
/**
|
||||
* Show/Hide the toplevel Application Window
|
||||
* @param show Boolean of PR_TRUE/PR_FALSE on whether to Show/Hide the window
|
||||
* @result nsresult NS_OK upon successful completion
|
||||
*/
|
||||
NS_IMETHOD ShowApplicationWindow(PRBool show) = 0 ;
|
||||
|
||||
/**
|
||||
* Get the native window associated with the toplevel Application Instance
|
||||
* @result Opaque handle to the application window native instance
|
||||
*/
|
||||
NS_IMETHOD_(void *) GetApplicationWindowNativeInstance() = 0;
|
||||
|
||||
/**
|
||||
* Get the widget associated with the toplevel Application Instance
|
||||
* @result a Pointer to the nsIWidget representing the toplevel Window
|
||||
*/
|
||||
NS_IMETHOD_(nsIWidget *) GetApplicationWidget() = 0;
|
||||
|
||||
/**
|
||||
* Exit this application
|
||||
* @result nsresult NS_OK upon succcessful completion
|
||||
*/
|
||||
NS_IMETHOD ExitApplication() = 0 ;
|
||||
|
||||
/**
|
||||
* Get Preferences Object
|
||||
* @result An nsIPref pointer
|
||||
*/
|
||||
NS_IMETHOD_(nsIPref *) GetPreferences() = 0;
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIShellInstance_h___ */
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
#ifndef nsshell_h___
|
||||
#define nsshell_h___
|
||||
|
||||
#ifdef _IMPL_NS_SHELL
|
||||
#define NS_SHELL NS_EXPORT
|
||||
#else
|
||||
#define NS_SHELL NS_IMPORT
|
||||
#endif
|
||||
|
||||
#endif /* nsweb_h___ */
|
|
@ -1,74 +0,0 @@
|
|||
#!gmake
|
||||
#
|
||||
# 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 = ../..
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
DIRS = unix
|
||||
|
||||
MODULE=shell
|
||||
|
||||
LIBRARY_NAME = shell
|
||||
|
||||
DEFINES = -D_IMPL_NS_SHELL -DNSPR20
|
||||
|
||||
EXTRA_DSO_LDOPTS+= -L$(DIST)/lib \
|
||||
$(DIST)/bin/libxpcom.so \
|
||||
$(DIST)/bin/libnspr21.so \
|
||||
$(DIST)/bin/libplc21.so \
|
||||
$(DIST)/bin/libplds21.so \
|
||||
$(DIST)/bin/libnspr21.so \
|
||||
$(DIST)/bin/libreg.so \
|
||||
$(NULL) \
|
||||
|
||||
ifeq ($(OS_ARCH),linux)
|
||||
EXTRA_DSO_LDOPTS+= /usr/lib/libc.a /usr/lib/libstdc++.a
|
||||
endif
|
||||
|
||||
# This should really be done properly in 'config'
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
EXTRA_DSO_LDOPTS+= -L/usr/X11R6/lib -lXm -lXt -lX11
|
||||
else
|
||||
EXTRA_DSO_LDOPTS+= -lXm -lXt -lX11
|
||||
endif
|
||||
|
||||
LCFLAGS=-I$(PUBLIC)/xpcom -I$(PUBLIC)/raptor \
|
||||
-I$(PUBLIC)/dom -I$(PUBLIC)/js -I$(PUBLIC)/netlib -I$(PUBLIC)/shell
|
||||
|
||||
REQUIRES = xpcom raptor dom js netlib shell pref
|
||||
|
||||
CPPSRCS= \
|
||||
nsApplicationManager.cpp \
|
||||
nsShellInstance.cpp \
|
||||
nsMenuItem.cpp \
|
||||
nsMenuBar.cpp \
|
||||
nsShellFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS= \
|
||||
./$(OBJDIR)/nsApplicationManager.o \
|
||||
./$(OBJDIR)/nsShellInstance.o \
|
||||
./$(OBJDIR)/nsMenuItem.o \
|
||||
./$(OBJDIR)/nsMenuBar.o \
|
||||
./$(OBJDIR)/nsShellFactory.o \
|
||||
$(NULL)
|
||||
|
||||
|
||||
TARGETS = $(LIBRARY)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
|
@ -1,76 +0,0 @@
|
|||
#!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=..\..
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
DEFINES=-D_IMPL_NS_SHELL -DWIN32_LEAN_AND_MEAN
|
||||
MODULE=shell
|
||||
|
||||
DIRS = windows
|
||||
|
||||
CPPSRCS= \
|
||||
nsApplicationManager.cpp \
|
||||
nsShellInstance.cpp \
|
||||
nsMenuBar.cpp \
|
||||
nsMenuItem.cpp \
|
||||
nsShellFactory.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\nsApplicationManager.obj \
|
||||
.\$(OBJDIR)\nsShellInstance.obj \
|
||||
.\$(OBJDIR)\nsMenuBar.obj \
|
||||
.\$(OBJDIR)\nsMenuItem.obj \
|
||||
.\$(OBJDIR)\nsShellFactory.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\raptor \
|
||||
-I$(PUBLIC)\dom -I$(PUBLIC)\js -I$(PUBLIC)\netlib -I$(PUBLIC)\shell -I$(PUBLIC)\pref
|
||||
|
||||
MAKE_OBJ_TYPE = DLL
|
||||
DLLNAME = shell
|
||||
DLL=.\$(OBJDIR)\$(DLLNAME).dll
|
||||
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
$(DEFINES) \
|
||||
$(NULL)
|
||||
|
||||
# These are the libraries we need to link with to create the dll
|
||||
LLIBS= \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
$(DIST)\lib\raptorbase.lib \
|
||||
$(DIST)\lib\raptorgfxwin.lib \
|
||||
$(DIST)\lib\raptorhtml.lib \
|
||||
$(DIST)\lib\img3240.lib \
|
||||
$(DIST)\lib\util.lib \
|
||||
$(DIST)\lib\libplc21.lib \
|
||||
$(DIST)\lib\jsdom.lib \
|
||||
$(DIST)\lib\netlib.lib \
|
||||
$(DIST)\lib\xppref32.lib \
|
||||
$(LIBNSPR)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(DLL)
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin
|
||||
$(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\$(DLLNAME).dll
|
||||
rm -f $(DIST)\lib\$(DLLNAME).lib
|
|
@ -1,201 +0,0 @@
|
|||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
|
||||
#ifdef NS_WIN32
|
||||
#include "windows.h"
|
||||
#elif NS_UNIX
|
||||
#include <Xm/Xm.h>
|
||||
#endif
|
||||
|
||||
#include "nsApplicationManager.h"
|
||||
#include "nsString.h"
|
||||
|
||||
nsHashtable * nsApplicationManager::applications = NULL;
|
||||
PRMonitor *nsApplicationManager::monitor = NULL;
|
||||
|
||||
class ApplicationEntry {
|
||||
public:
|
||||
nsIApplicationShell * applicationshell;
|
||||
nsIShellInstance * shellinstance;
|
||||
|
||||
ApplicationEntry(nsIApplicationShell * aApplicationShell,
|
||||
nsIShellInstance * aShellInstance) {
|
||||
applicationshell = aApplicationShell;
|
||||
shellinstance = aShellInstance;
|
||||
}
|
||||
~ApplicationEntry() {
|
||||
}
|
||||
};
|
||||
|
||||
class AppKey: public nsHashKey {
|
||||
private:
|
||||
nsIApplicationShell * applicationshell;
|
||||
|
||||
public:
|
||||
AppKey(nsIApplicationShell * aApplicationShell) {
|
||||
applicationshell = aApplicationShell;
|
||||
}
|
||||
|
||||
PRUint32 HashValue(void) const {
|
||||
return ((PRUint32) (applicationshell));
|
||||
}
|
||||
|
||||
PRBool Equals(const nsHashKey *aKey) const {
|
||||
return ((PRBool)(applicationshell == ((AppKey *)aKey)->applicationshell));
|
||||
}
|
||||
|
||||
nsHashKey *Clone(void) const {
|
||||
return new AppKey(applicationshell);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
nsresult nsApplicationManager::GetShellInstance(nsIApplicationShell * aApplicationShell,
|
||||
nsIShellInstance **aShellInstance)
|
||||
{
|
||||
checkInitialized();
|
||||
|
||||
if (aShellInstance == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
PR_EnterMonitor(monitor);
|
||||
|
||||
AppKey key(aApplicationShell);
|
||||
ApplicationEntry *entry = (ApplicationEntry*) applications->Get(&key);
|
||||
|
||||
nsresult res = NS_ERROR_FAILURE;
|
||||
|
||||
PR_ExitMonitor(monitor);
|
||||
|
||||
if (entry != NULL) {
|
||||
*aShellInstance = entry->shellinstance;
|
||||
(*aShellInstance)->AddRef();
|
||||
res = NS_OK;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsApplicationManager::checkInitialized()
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
if (applications == NULL) {
|
||||
res = Initialize();
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsApplicationManager::Initialize()
|
||||
{
|
||||
if (applications == NULL) {
|
||||
applications = new nsHashtable();
|
||||
}
|
||||
if (monitor == NULL) {
|
||||
monitor = PR_NewMonitor();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
nsresult nsApplicationManager::SetShellAssociation(nsIApplicationShell * aApplicationShell,
|
||||
nsIShellInstance *aShellInstance)
|
||||
{
|
||||
checkInitialized();
|
||||
|
||||
nsIShellInstance *old = NULL;
|
||||
GetShellInstance(aApplicationShell, &old);
|
||||
|
||||
if (old != NULL) {
|
||||
old->Release();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
PR_EnterMonitor(monitor);
|
||||
|
||||
AppKey key(aApplicationShell);
|
||||
applications->Put(&key, new ApplicationEntry(aApplicationShell, aShellInstance));
|
||||
|
||||
PR_ExitMonitor(monitor);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsApplicationManager::DeleteShellAssociation(nsIApplicationShell * aApplicationShell,
|
||||
nsIShellInstance *aShellInstance)
|
||||
{
|
||||
checkInitialized();
|
||||
|
||||
nsIShellInstance *old = NULL;
|
||||
GetShellInstance(aApplicationShell, &old);
|
||||
|
||||
nsresult res = NS_ERROR_FACTORY_NOT_REGISTERED;
|
||||
if (old != NULL) {
|
||||
if (old == aShellInstance) {
|
||||
PR_EnterMonitor(monitor);
|
||||
|
||||
AppKey key(aApplicationShell);
|
||||
ApplicationEntry *entry = (ApplicationEntry *) applications->Remove(&key);
|
||||
delete entry;
|
||||
|
||||
PR_ExitMonitor(monitor);
|
||||
|
||||
res = NS_OK;
|
||||
}
|
||||
old->Release();
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsApplicationManager::ModalMessage(const nsString &aMessage,
|
||||
const nsString &aTitle,
|
||||
nsModalMessageType aModalMessageType)
|
||||
{
|
||||
|
||||
nsresult res = NS_OK ;
|
||||
|
||||
#ifdef NS_WIN32
|
||||
|
||||
PRInt32 msgtype ;
|
||||
|
||||
switch (aModalMessageType)
|
||||
{
|
||||
case eModalMessage_ok:
|
||||
msgtype = MB_OK ;
|
||||
break ;
|
||||
|
||||
case eModalMessage_ok_cancel:
|
||||
msgtype = MB_OK ;
|
||||
break ;
|
||||
|
||||
default:
|
||||
msgtype = MB_OK ;
|
||||
break ;
|
||||
|
||||
}
|
||||
::MessageBox(NULL, (const char *)aMessage.GetUnicode(), (const char *)aTitle.GetUnicode(), msgtype);
|
||||
|
||||
#endif
|
||||
|
||||
return res ;
|
||||
}
|
|
@ -1,37 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsMenuBar.h"
|
||||
|
||||
nsMenuBar::nsMenuBar()
|
||||
{
|
||||
}
|
||||
|
||||
nsMenuBar::~nsMenuBar()
|
||||
{
|
||||
}
|
||||
|
||||
NS_DEFINE_IID(kIMenuBarIID, NS_IMENUBAR_IID);
|
||||
NS_IMPL_ISUPPORTS(nsMenuBar,kIMenuBarIID);
|
||||
|
||||
nsresult nsMenuBar::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsMenuItem.h"
|
||||
|
||||
nsMenuItem::nsMenuItem()
|
||||
{
|
||||
}
|
||||
|
||||
nsMenuItem::~nsMenuItem()
|
||||
{
|
||||
}
|
||||
|
||||
NS_DEFINE_IID(kIMenuItemIID, NS_IMENUITEM_IID);
|
||||
NS_IMPL_ISUPPORTS(nsMenuItem,kIMenuItemIID);
|
||||
|
||||
nsresult nsMenuItem::Init()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -1,163 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsShellCIID.h"
|
||||
|
||||
#include "nsShellInstance.h"
|
||||
#include "nsMenuBar.h"
|
||||
#include "nsMenuItem.h"
|
||||
|
||||
static NS_DEFINE_IID(kCShellInstance, NS_SHELLINSTANCE_CID);
|
||||
static NS_DEFINE_IID(kCMenuItem, NS_MENUITEM_CID);
|
||||
static NS_DEFINE_IID(kCMenuBar, NS_MENUBAR_CID);
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
class nsShellFactory : public nsIFactory
|
||||
{
|
||||
public:
|
||||
// nsISupports methods
|
||||
NS_IMETHOD QueryInterface(const nsIID &aIID,
|
||||
void **aResult);
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void);
|
||||
NS_IMETHOD_(nsrefcnt) Release(void);
|
||||
|
||||
// nsIFactory methods
|
||||
NS_IMETHOD CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
nsShellFactory(const nsCID &aClass);
|
||||
~nsShellFactory();
|
||||
|
||||
private:
|
||||
nsrefcnt mRefCnt;
|
||||
nsCID mClassID;
|
||||
};
|
||||
|
||||
nsShellFactory::nsShellFactory(const nsCID &aClass)
|
||||
{
|
||||
mRefCnt = 0;
|
||||
mClassID = aClass;
|
||||
}
|
||||
|
||||
nsShellFactory::~nsShellFactory()
|
||||
{
|
||||
NS_ASSERTION(mRefCnt == 0, "non-zero refcnt at destruction");
|
||||
}
|
||||
|
||||
nsresult nsShellFactory::QueryInterface(const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
// Always NULL result, in case of failure
|
||||
*aResult = NULL;
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aResult = (void *)(nsISupports*)this;
|
||||
} else if (aIID.Equals(kIFactoryIID)) {
|
||||
*aResult = (void *)(nsIFactory*)this;
|
||||
}
|
||||
|
||||
if (*aResult == NULL) {
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
AddRef(); // Increase reference count for caller
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsrefcnt nsShellFactory::AddRef()
|
||||
{
|
||||
return ++mRefCnt;
|
||||
}
|
||||
|
||||
nsrefcnt nsShellFactory::Release()
|
||||
{
|
||||
if (--mRefCnt == 0) {
|
||||
delete this;
|
||||
return 0; // Don't access mRefCnt after deleting!
|
||||
}
|
||||
return mRefCnt;
|
||||
}
|
||||
|
||||
nsresult nsShellFactory::CreateInstance(nsISupports *aOuter,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aResult = NULL;
|
||||
|
||||
nsISupports *inst = nsnull;
|
||||
|
||||
if (mClassID.Equals(kCShellInstance)) {
|
||||
inst = (nsISupports *)new nsShellInstance();
|
||||
} else if (mClassID.Equals(kCMenuBar)) {
|
||||
inst = (nsISupports *)new nsMenuBar();
|
||||
} else if (mClassID.Equals(kCMenuItem)) {
|
||||
inst = (nsISupports *)new nsMenuItem();
|
||||
}
|
||||
|
||||
if (inst == NULL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (res != NS_OK) {
|
||||
// We didn't get the right interface, so clean up
|
||||
delete inst;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsShellFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
// Not implemented in simplest case.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aFactory = new nsShellFactory(aClass);
|
||||
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory);
|
||||
}
|
||||
|
|
@ -1,271 +0,0 @@
|
|||
/* -*- 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 NS_IMPL_IDS 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nscore.h"
|
||||
|
||||
#include "nspr.h"
|
||||
#include "net.h"
|
||||
|
||||
|
||||
#ifdef NS_WIN32
|
||||
#include "windows.h"
|
||||
#elif NS_UNIX
|
||||
#include <Xm/Xm.h>
|
||||
#endif
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIShellInstance.h"
|
||||
#include "nsShellInstance.h"
|
||||
#include "nsITimer.h"
|
||||
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsGfxCIID.h"
|
||||
#include "nsShellCIID.h"
|
||||
#include "nsParserCIID.h"
|
||||
|
||||
#include "nsIPref.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
static NS_DEFINE_IID(kCShellInstance, NS_SHELLINSTANCE_CID);
|
||||
|
||||
nsShellInstance::nsShellInstance()
|
||||
{
|
||||
mApplicationWindow = NULL;
|
||||
mPref = nsnull;
|
||||
}
|
||||
|
||||
nsShellInstance::~nsShellInstance()
|
||||
{
|
||||
NS_IF_RELEASE(mPref);
|
||||
}
|
||||
|
||||
NS_DEFINE_IID(kIShellInstanceIID, NS_ISHELLINSTANCE_IID);
|
||||
NS_IMPL_ISUPPORTS(nsShellInstance,kIShellInstanceIID);
|
||||
|
||||
nsresult nsShellInstance::Init()
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
|
||||
RegisterFactories() ;
|
||||
|
||||
// Load preferences
|
||||
res = NSRepository::CreateInstance(kPrefCID, NULL, kIPrefIID,
|
||||
(void **) &mPref);
|
||||
if (NS_OK != res) {
|
||||
return res;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static nsITimer* gNetTimer;
|
||||
|
||||
static void
|
||||
PollNet(nsITimer *aTimer, void *aClosure)
|
||||
{
|
||||
NET_PollSockets();
|
||||
NS_IF_RELEASE(gNetTimer);
|
||||
if (NS_OK == NS_NewTimer(&gNetTimer)) {
|
||||
gNetTimer->Init(PollNet, nsnull, 1000 / 50);
|
||||
}
|
||||
}
|
||||
|
||||
nsresult nsShellInstance::Run()
|
||||
{
|
||||
|
||||
#ifdef NS_WIN32
|
||||
MSG msg;
|
||||
PollNet(0, 0);
|
||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
NET_PollSockets();
|
||||
}
|
||||
return ((nsresult)msg.wParam);
|
||||
#elif NS_UNIX
|
||||
extern XtAppContext app_context ;
|
||||
|
||||
XtAppMainLoop(app_context) ;
|
||||
return NS_OK;
|
||||
#else
|
||||
return NS_OK;
|
||||
#endif
|
||||
}
|
||||
|
||||
void * nsShellInstance::GetNativeInstance()
|
||||
{
|
||||
return mNativeInstance ;
|
||||
}
|
||||
|
||||
nsIPref * nsShellInstance::GetPreferences()
|
||||
{
|
||||
return (mPref) ;
|
||||
}
|
||||
|
||||
void nsShellInstance::SetNativeInstance(void * aNativeInstance)
|
||||
{
|
||||
mNativeInstance = aNativeInstance;
|
||||
return ;
|
||||
}
|
||||
|
||||
nsIApplicationShell * nsShellInstance::GetApplicationShell()
|
||||
{
|
||||
return mApplicationShell ;
|
||||
}
|
||||
|
||||
void nsShellInstance::SetApplicationShell(nsIApplicationShell * aApplicationShell)
|
||||
{
|
||||
mApplicationShell = aApplicationShell;
|
||||
return ;
|
||||
}
|
||||
|
||||
// XXX We really need a standard way to enumerate
|
||||
// a set of libraries and call their self
|
||||
// registration routines... when that code is
|
||||
// XP of course.
|
||||
nsresult nsShellInstance::RegisterFactories()
|
||||
{
|
||||
// hardcode names of dll's
|
||||
#ifdef NS_WIN32
|
||||
#define GFXWIN_DLL "raptorgfxwin.dll"
|
||||
#define WIDGET_DLL "raptorwidget.dll"
|
||||
#define PARSER_DLL "raptorhtmlpars.dll"
|
||||
#define PREF_DLL "xppref32.dll"
|
||||
#else
|
||||
#define GFXWIN_DLL "libgfxunix.so"
|
||||
#define WIDGET_DLL "libwidgetunix.so"
|
||||
#define PARSER_DLL "libraptorhtmlpars.so"
|
||||
#define PREF_DLL "libpref.so"
|
||||
#endif
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
|
||||
NSRepository::RegisterFactory(kIWidgetIID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
// register graphics classes
|
||||
static NS_DEFINE_IID(kCRenderingContextIID, NS_RENDERING_CONTEXT_CID);
|
||||
static NS_DEFINE_IID(kCDeviceContextIID, NS_DEVICE_CONTEXT_CID);
|
||||
static NS_DEFINE_IID(kCFontMetricsIID, NS_FONT_METRICS_CID);
|
||||
static NS_DEFINE_IID(kCImageIID, NS_IMAGE_CID);
|
||||
|
||||
NSRepository::RegisterFactory(kCRenderingContextIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCDeviceContextIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCFontMetricsIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCImageIID, GFXWIN_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
// register widget classes
|
||||
static NS_DEFINE_IID(kCWindowCID, NS_WINDOW_CID);
|
||||
static NS_DEFINE_IID(kCChildCID, NS_CHILD_CID);
|
||||
static NS_DEFINE_IID(kCButtonCID, NS_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCCheckButtonCID, NS_CHECKBUTTON_CID);
|
||||
static NS_DEFINE_IID(kCComboBoxCID, NS_COMBOBOX_CID);
|
||||
static NS_DEFINE_IID(kCFileWidgetCID, NS_FILEWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCListBoxCID, NS_LISTBOX_CID);
|
||||
static NS_DEFINE_IID(kCRadioButtonCID, NS_RADIOBUTTON_CID);
|
||||
static NS_DEFINE_IID(kCRadioGroupCID, NS_RADIOGROUP_CID);
|
||||
static NS_DEFINE_IID(kCHorzScrollbarCID, NS_HORZSCROLLBAR_CID);
|
||||
static NS_DEFINE_IID(kCVertScrollbarCID, NS_VERTSCROLLBAR_CID);
|
||||
static NS_DEFINE_IID(kCTextAreaCID, NS_TEXTAREA_CID);
|
||||
static NS_DEFINE_IID(kCTextFieldCID, NS_TEXTFIELD_CID);
|
||||
static NS_DEFINE_IID(kCParserCID, NS_PARSER_IID);
|
||||
static NS_DEFINE_IID(kCParserNodeCID, NS_PARSER_NODE_IID);
|
||||
|
||||
NSRepository::RegisterFactory(kCWindowCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCChildCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCButtonCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCCheckButtonCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCComboBoxCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCFileWidgetCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCListBoxCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCRadioButtonCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCRadioGroupCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCHorzScrollbarCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCVertScrollbarCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCTextAreaCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCTextFieldCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCParserCID, PARSER_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCParserNodeCID, PARSER_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
NSRepository::RegisterFactory(kPrefCID, PREF_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIWidget * nsShellInstance::CreateApplicationWindow(const nsRect &aRect,
|
||||
EVENT_CALLBACK aHandleEventFunction)
|
||||
{
|
||||
|
||||
nsRect windowRect ;
|
||||
|
||||
if (aRect.IsEmpty()) {
|
||||
windowRect.SetRect(100,100,320,480);
|
||||
} else {
|
||||
windowRect.SetRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
}
|
||||
|
||||
static NS_DEFINE_IID(kIWidgetIID, NS_IWIDGET_IID);
|
||||
static NS_DEFINE_IID(kCWindowCID, NS_WINDOW_CID);
|
||||
|
||||
NSRepository::CreateInstance(kCWindowCID,
|
||||
nsnull,
|
||||
kIWidgetIID,
|
||||
(void **)&(mApplicationWindow));
|
||||
|
||||
mApplicationWindow->Create((nsIWidget*)NULL,
|
||||
aRect,
|
||||
aHandleEventFunction,
|
||||
nsnull, nsnull, nsnull, (nsWidgetInitData *) GetNativeInstance());
|
||||
|
||||
return (mApplicationWindow);
|
||||
}
|
||||
|
||||
|
||||
nsresult nsShellInstance::ShowApplicationWindow(PRBool show)
|
||||
{
|
||||
mApplicationWindow->Show(show);
|
||||
|
||||
#ifdef NS_UNIX
|
||||
XtRealizeWidget((Widget)GetNativeInstance());
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsShellInstance::ExitApplication()
|
||||
{
|
||||
|
||||
#ifdef NS_WIN32
|
||||
PostQuitMessage(0);
|
||||
#endif
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void * nsShellInstance::GetApplicationWindowNativeInstance()
|
||||
{
|
||||
return (mApplicationWindow->GetNativeData(NS_NATIVE_WINDOW));
|
||||
}
|
||||
|
||||
nsIWidget * nsShellInstance::GetApplicationWidget()
|
||||
{
|
||||
return (mApplicationWindow);
|
||||
}
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
#!gmake
|
||||
#
|
||||
# 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 = ../../..
|
||||
|
||||
MODULE=shell
|
||||
|
||||
LIBRARY_NAME = shell_s
|
||||
|
||||
DEFINES = -D_IMPL_NS_SHELL
|
||||
|
||||
LCFLAGS=-I$(PUBLIC)/xpcom -I$(PUBLIC)/raptor \
|
||||
-I$(PUBLIC)/dom -I$(PUBLIC)/js -I$(PUBLIC)/netlib -I$(PUBLIC)/shell
|
||||
|
||||
CPPSRCS= \
|
||||
main.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS= \
|
||||
./$(OBJDIR)/main.o \
|
||||
$(NULL)
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
TARGETS = $(LIBRARY)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
|
@ -1,120 +0,0 @@
|
|||
/* -*- 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.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 Private 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.
|
||||
*/
|
||||
|
||||
#include "nsRepository.h"
|
||||
#include "nsShellInstance.h"
|
||||
#include "nsApplicationManager.h"
|
||||
#include "nsGfxCIID.h"
|
||||
#include "nsShellCIID.h"
|
||||
|
||||
#include "Xm/Xm.h"
|
||||
#include "Xm/MainW.h"
|
||||
#include "Xm/Frame.h"
|
||||
#include "Xm/XmStrDefs.h"
|
||||
#include "Xm/DrawingA.h"
|
||||
|
||||
#define SHELL_DLL "libshell.so"
|
||||
|
||||
extern nsIID kIXPCOMApplicationShellCID ;
|
||||
|
||||
static NS_DEFINE_IID(kIApplicationShellIID, NS_IAPPLICATIONSHELL_IID);
|
||||
static NS_DEFINE_IID(kCApplicationShellIID, NS_IAPPLICATIONSHELL_CID);
|
||||
|
||||
static NS_DEFINE_IID(kIShellInstanceIID, NS_ISHELLINSTANCE_IID);
|
||||
static NS_DEFINE_IID(kCShellInstanceCID, NS_SHELLINSTANCE_CID);
|
||||
static NS_DEFINE_IID(kCMenuBarCID, NS_MENUBAR_CID);
|
||||
static NS_DEFINE_IID(kCMenuItemCID, NS_MENUITEM_CID);
|
||||
|
||||
XtAppContext app_context ;
|
||||
|
||||
void main(int argc, char **argv)
|
||||
{
|
||||
Widget topLevel;
|
||||
|
||||
nsresult result = NS_OK ;
|
||||
|
||||
nsIShellInstance * pShellInstance ;
|
||||
nsIApplicationShell * pApplicationShell ;
|
||||
|
||||
XtSetLanguageProc(NULL, NULL, NULL);
|
||||
|
||||
topLevel = XtVaAppInitialize(&app_context, "Shell", NULL, 0, &argc, argv, NULL, NULL);
|
||||
|
||||
|
||||
// Let get a ShellInstance for this Application instance
|
||||
NSRepository::RegisterFactory(kCShellInstanceCID, SHELL_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCMenuBarCID, SHELL_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCMenuItemCID, SHELL_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
result = NSRepository::CreateInstance(kCShellInstanceCID,
|
||||
NULL,
|
||||
kIShellInstanceIID,
|
||||
(void **) &pShellInstance) ;
|
||||
|
||||
if (result != NS_OK)
|
||||
return result ;
|
||||
|
||||
// Let's instantiate the Application's Shell
|
||||
NS_RegisterApplicationShellFactory() ;
|
||||
|
||||
result = NSRepository::CreateInstance(kIXPCOMApplicationShellCID,
|
||||
NULL,
|
||||
kIXPCOMApplicationShellCID,
|
||||
(void **) &pApplicationShell) ;
|
||||
|
||||
if (result != NS_OK)
|
||||
return result ;
|
||||
|
||||
|
||||
// Let the the State know who it's Application Instance is
|
||||
pShellInstance->SetNativeInstance((nsNativeApplicationInstance) topLevel);
|
||||
pShellInstance->SetApplicationShell(pApplicationShell);
|
||||
|
||||
// Tell the application manager to store away the association so the
|
||||
// Application can look up its State
|
||||
nsApplicationManager::SetShellAssociation(pApplicationShell, pShellInstance);
|
||||
|
||||
// Initialize the system
|
||||
|
||||
pShellInstance->Init();
|
||||
pApplicationShell->Init();
|
||||
|
||||
// Now, let actually start dispatching events.
|
||||
result = pApplicationShell->Run();
|
||||
|
||||
// We're done, clean up
|
||||
nsApplicationManager::DeleteShellAssociation(pApplicationShell, pShellInstance);
|
||||
|
||||
// book out of here
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
#!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=..\..\..
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
DEFINES=-D_IMPL_NS_SHELL -DWIN32_LEAN_AND_MEAN
|
||||
|
||||
MODULE=shell
|
||||
|
||||
CPPSRCS= \
|
||||
winmain.cpp \
|
||||
$(NULL)
|
||||
|
||||
CPP_OBJS= \
|
||||
.\$(OBJDIR)\winmain.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS=-I$(XPDIST)\public\xpcom -I$(XPDIST)\public\raptor -I$(XPDIST)\public\shell -I$(XPDIST)\public\pref -I$(XPDIST)\public\dom -I$(XPDIST)\public\js -I..
|
||||
|
||||
MAKE_OBJ_TYPE = LIB
|
||||
|
||||
LIBRARY_NAME=shell_s
|
||||
|
||||
LCFLAGS = \
|
||||
$(LCFLAGS) \
|
||||
$(DEFINES) \
|
||||
$(NULL)
|
||||
|
||||
# These are the libraries we need to link with to create the dll
|
||||
LLIBS= \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
$(DIST)\lib\raptorbase.lib \
|
||||
$(DIST)\lib\raptorgfxwin.lib \
|
||||
$(DIST)\lib\raptorhtml.lib \
|
||||
$(DIST)\lib\raptorweb.lib \
|
||||
$(DIST)\lib\img3240.lib \
|
||||
$(DIST)\lib\util.lib \
|
||||
$(DIST)\lib\libplc21.lib \
|
||||
$(DIST)\lib\jsdom.lib \
|
||||
$(DIST)\lib\xppref32.lib \
|
||||
$(LIBNSPR)
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(LIBRARY)
|
||||
$(MAKE_INSTALL) $(LIBRARY) $(DIST)\lib
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\lib\$(LIBNAME).lib
|
|
@ -1,97 +0,0 @@
|
|||
/* -*- 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.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 Private 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.
|
||||
*/
|
||||
|
||||
#ifdef WIN32_LEAN_AND_MEAN
|
||||
#undef WIN32_LEAN_AND_MEAN
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include "nsRepository.h"
|
||||
#include "nsShellInstance.h"
|
||||
#include "nsApplicationManager.h"
|
||||
#include "nsShellCIID.h"
|
||||
|
||||
#define SHELL_DLL "shell.dll"
|
||||
|
||||
extern nsIID kIXPCOMApplicationShellCID ;
|
||||
|
||||
static NS_DEFINE_IID(kIApplicationShellIID, NS_IAPPLICATIONSHELL_IID);
|
||||
static NS_DEFINE_IID(kCApplicationShellIID, NS_IAPPLICATIONSHELL_CID);
|
||||
|
||||
static NS_DEFINE_IID(kIShellInstanceIID, NS_ISHELLINSTANCE_IID);
|
||||
static NS_DEFINE_IID(kCShellInstanceCID, NS_SHELLINSTANCE_CID);
|
||||
static NS_DEFINE_IID(kCMenuBarCID, NS_MENUBAR_CID);
|
||||
static NS_DEFINE_IID(kCMenuItemCID, NS_MENUITEM_CID);
|
||||
|
||||
int PASCAL WinMain(HANDLE instance, HANDLE prevInstance, LPSTR cmdParam, int nCmdShow)
|
||||
{
|
||||
nsresult result = NS_OK ;
|
||||
|
||||
nsIShellInstance * pShellInstance ;
|
||||
nsIApplicationShell * pApplicationShell ;
|
||||
|
||||
// Let get a ShellInstance for this Application instance
|
||||
NSRepository::RegisterFactory(kCShellInstanceCID, SHELL_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCMenuBarCID, SHELL_DLL, PR_FALSE, PR_FALSE);
|
||||
NSRepository::RegisterFactory(kCMenuItemCID, SHELL_DLL, PR_FALSE, PR_FALSE);
|
||||
|
||||
result = NSRepository::CreateInstance(kCShellInstanceCID,
|
||||
NULL,
|
||||
kIShellInstanceIID,
|
||||
(void **) &pShellInstance) ;
|
||||
|
||||
if (result != NS_OK)
|
||||
return result ;
|
||||
|
||||
// Let's instantiate the Application's Shell
|
||||
NS_RegisterApplicationShellFactory() ;
|
||||
|
||||
result = NSRepository::CreateInstance(kIXPCOMApplicationShellCID,
|
||||
NULL,
|
||||
kIXPCOMApplicationShellCID,
|
||||
(void **) &pApplicationShell) ;
|
||||
|
||||
if (result != NS_OK)
|
||||
return result ;
|
||||
|
||||
// Let the the State know who it's Application Instance is
|
||||
pShellInstance->SetNativeInstance((nsNativeApplicationInstance) instance);
|
||||
pShellInstance->SetApplicationShell(pApplicationShell);
|
||||
|
||||
// Tell the application manager to store away the association so the
|
||||
// Application can look up its State
|
||||
nsApplicationManager::SetShellAssociation(pApplicationShell, pShellInstance);
|
||||
|
||||
// Initialize the system
|
||||
pShellInstance->Init();
|
||||
pApplicationShell->Init();
|
||||
|
||||
// Now, let actually start dispatching events.
|
||||
result = pApplicationShell->Run();
|
||||
|
||||
// We're done, clean up
|
||||
nsApplicationManager::DeleteShellAssociation(pApplicationShell, pShellInstance);
|
||||
|
||||
// book out of here
|
||||
return result;
|
||||
}
|
||||
|
||||
void main(int argc, char **argv)
|
||||
{
|
||||
WinMain(GetModuleHandle(NULL), NULL, 0, SW_SHOW);
|
||||
}
|
|
@ -1,24 +0,0 @@
|
|||
#!gmake
|
||||
#
|
||||
# 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 = apptest
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
|
@ -1,73 +0,0 @@
|
|||
#!gmake
|
||||
#
|
||||
# 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=../../..
|
||||
|
||||
include $(DEPTH)/config/config.mk
|
||||
|
||||
CPPSRCS = \
|
||||
nsAppTest.cpp \
|
||||
$(NULL)
|
||||
|
||||
INCLUDES+= -I$(PUBLIC)/raptor -I$(PUBLIC)/xpcom -I$(PUBLIC)/shell
|
||||
|
||||
DIRS =
|
||||
|
||||
OBJS = $(CPPSRCS:.cpp=.o)
|
||||
|
||||
EX_LIBS = \
|
||||
$(DIST)/lib/libshell_s.a \
|
||||
$(DIST)/bin/libshell.so \
|
||||
$(DIST)/bin/libwidgetunix.so \
|
||||
$(DIST)/bin/libraptorgfx.so \
|
||||
$(DIST)/bin/libgfxunix.so \
|
||||
$(DIST)/bin/libraptorbase.so \
|
||||
$(DIST)/bin/libgmbaseunix.so \
|
||||
$(DIST)/bin/libxpcom.so \
|
||||
$(DIST)/bin/libreg.so \
|
||||
$(DIST)/bin/libnspr21.so \
|
||||
$(DIST)/bin/libplc21.so \
|
||||
$(DIST)/bin/libplds21.so \
|
||||
$(DIST)/bin/libnspr21.so \
|
||||
$(NULL)
|
||||
|
||||
|
||||
PROGS = $(addprefix $(OBJDIR)/, $(CPPSRCS:.cpp=))
|
||||
|
||||
TARGETS = $(PROGS)
|
||||
|
||||
include $(DEPTH)/config/rules.mk
|
||||
|
||||
$(OBJDIR)/%.o: %.cpp
|
||||
@$(MAKE_OBJDIR)
|
||||
$(CCC) -o $@ $(CFLAGS) -c $*.cpp
|
||||
|
||||
$(PROGS):$(OBJDIR)/%: $(OBJDIR)/%.o $(EX_LIBS)
|
||||
@$(MAKE_OBJDIR)
|
||||
ifeq ($(OS_ARCH),Linux)
|
||||
$(CCC) -rdynamic -o $@ $@.o $(LDFLAGS) $(EX_LIBS) $(OS_LIBS) -L/usr/X11R6/lib -lXm -lXt -lX11 -lXp -lXext
|
||||
else
|
||||
$(CCC) -o $@ $@.o $(LDFLAGS) $(EX_LIBS) $(OS_LIBS) -lXm -lXt -lX11
|
||||
endif
|
||||
|
||||
export::
|
||||
|
||||
install:: $(TARGETS)
|
||||
$(INSTALL) $(PROGS) $(DIST)/bin
|
||||
|
||||
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
#include "resources.h"
|
||||
|
||||
APPTEST MENU DISCARDABLE
|
||||
{
|
||||
POPUP "File"
|
||||
{
|
||||
MENUITEM "Open...", TIMER_OPEN
|
||||
MENUITEM "Exit", TIMER_EXIT
|
||||
}
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
#
|
||||
# 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=..\..\..
|
||||
|
||||
MAKE_OBJ_TYPE = EXE
|
||||
PROGRAM = .\$(OBJDIR)\nsAppTest.exe
|
||||
RESFILE = apptest.res
|
||||
MAPFILE = apptest.map
|
||||
|
||||
LINCS=-I$(XPDIST)\public\raptor -I$(XPDIST)\public\shell -I$(XPDIST)\public\xpcom -I..\..\src
|
||||
|
||||
LLFLAGS = $(LLFLAGS) /SUBSYSTEM:CONSOLE
|
||||
|
||||
OBJS = \
|
||||
.\$(OBJDIR)\nsAppTest.obj \
|
||||
$(NULL)
|
||||
|
||||
LLIBS= \
|
||||
$(DIST)\lib\raptorbase.lib \
|
||||
$(DIST)\lib\raptorgfxwin.lib \
|
||||
$(DIST)\lib\raptorweb.lib \
|
||||
$(DIST)\lib\shell.lib \
|
||||
$(DIST)\lib\shell_s.lib \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
$(LIBNSPR) \
|
||||
$(DIST)\lib\libplc21.lib \
|
||||
$(DIST)\lib\img3240.lib \
|
||||
$(DIST)\lib\util.lib \
|
||||
comdlg32.lib
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
||||
|
||||
install:: $(PROGRAM)
|
||||
$(MAKE_INSTALL) $(PROGRAM) $(DIST)\bin
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\nsAppTest.exe
|
||||
|
|
@ -1,198 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
#include "nscore.h"
|
||||
#include "nsAppTest.h"
|
||||
#include "nsApplicationManager.h"
|
||||
|
||||
#include "nsString.h"
|
||||
#include "nsFont.h"
|
||||
|
||||
#ifdef NS_WIN32
|
||||
#include "windows.h"
|
||||
#endif
|
||||
|
||||
nsEventStatus HandleEventApplication(nsGUIEvent *aEvent);
|
||||
|
||||
// All Applications must specify this *special* application CID
|
||||
// to their own unique IID.
|
||||
nsIID kIXPCOMApplicationShellCID = NS_IAPPTEST_IID ;
|
||||
|
||||
// All Application Must implement this function
|
||||
nsresult NS_RegisterApplicationShellFactory()
|
||||
{
|
||||
nsresult res = NSRepository::RegisterFactory(kIXPCOMApplicationShellCID,
|
||||
new nsAppTestFactory(),
|
||||
PR_FALSE) ;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
/*
|
||||
* nsAppTest Definition
|
||||
*/
|
||||
|
||||
nsAppTest::nsAppTest()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsAppTest::~nsAppTest()
|
||||
{
|
||||
}
|
||||
|
||||
NS_DEFINE_IID(kIAppTestIID, NS_IAPPTEST_IID);
|
||||
NS_IMPL_ISUPPORTS(nsAppTest,kIAppTestIID);
|
||||
|
||||
nsresult nsAppTest::Init()
|
||||
{
|
||||
|
||||
|
||||
nsresult res = nsApplicationManager::GetShellInstance(this, &mShellInstance) ;
|
||||
|
||||
if (NS_OK != res)
|
||||
return res ;
|
||||
|
||||
nsRect aRect(100,100,540, 380) ;
|
||||
|
||||
mShellInstance->CreateApplicationWindow(aRect, HandleEventApplication);
|
||||
mShellInstance->ShowApplicationWindow(PR_TRUE) ;
|
||||
|
||||
return res ;
|
||||
|
||||
}
|
||||
|
||||
nsresult nsAppTest::Run()
|
||||
{
|
||||
return (mShellInstance->Run());
|
||||
}
|
||||
|
||||
/*
|
||||
* nsAppTestFactory Definition
|
||||
*/
|
||||
|
||||
nsAppTestFactory::nsAppTestFactory()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
||||
nsAppTestFactory::~nsAppTestFactory()
|
||||
{
|
||||
}
|
||||
|
||||
NS_DEFINE_IID(kIAppTestFactoryIID, NS_IFACTORY_IID);
|
||||
NS_IMPL_ISUPPORTS(nsAppTestFactory,kIAppTestFactoryIID);
|
||||
|
||||
|
||||
nsresult nsAppTestFactory::CreateInstance(nsISupports * aOuter,
|
||||
const nsIID &aIID,
|
||||
void ** aResult)
|
||||
{
|
||||
if (aResult == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
*aResult = NULL ;
|
||||
|
||||
nsISupports * inst = new nsAppTest() ;
|
||||
|
||||
if (inst == NULL) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
nsresult res = inst->QueryInterface(aIID, aResult);
|
||||
|
||||
if (res != NS_OK) {
|
||||
delete inst ;
|
||||
}
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
|
||||
nsresult nsAppTestFactory::LockFactory(PRBool aLock)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nsEventStatus PR_CALLBACK HandleEventApplication(nsGUIEvent *aEvent)
|
||||
{
|
||||
nsEventStatus result = nsEventStatus_eConsumeNoDefault;
|
||||
|
||||
switch(aEvent->message) {
|
||||
|
||||
case NS_CREATE:
|
||||
{
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
break ;
|
||||
|
||||
case NS_DESTROY:
|
||||
{
|
||||
//mShellInstance->ExitApplication() ;
|
||||
#ifdef NS_WIN32
|
||||
PostQuitMessage(0);
|
||||
#endif
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
break ;
|
||||
|
||||
case NS_PAINT:
|
||||
{
|
||||
|
||||
nsRect aRect(0,0,540, 380) ;
|
||||
// paint the background
|
||||
nsString aString("Hello World!\n");
|
||||
nsIRenderingContext * rndctx = ((nsPaintEvent*)aEvent)->renderingContext;
|
||||
//rndctx->SetColor(aEvent->widget->GetBackgroundColor());
|
||||
|
||||
//nsDrawingSurface drawingsurface = rndctx->CreateDrawingSurface((((nsPaintEvent*)aEvent)->rect));
|
||||
nsDrawingSurface drawingsurface = rndctx->CreateDrawingSurface(&aRect);
|
||||
rndctx->SelectOffScreenDrawingSurface(drawingsurface);
|
||||
|
||||
rndctx->SetColor(NS_RGB(0, 0, 255));
|
||||
//rndctx->FillRect(*(((nsPaintEvent*)aEvent)->rect));
|
||||
rndctx->FillRect(aRect);
|
||||
|
||||
nsFont font("Times", NS_FONT_STYLE_NORMAL,
|
||||
NS_FONT_VARIANT_NORMAL,
|
||||
NS_FONT_WEIGHT_BOLD,
|
||||
0,
|
||||
12);
|
||||
rndctx->SetFont(font);
|
||||
|
||||
rndctx->SetColor(NS_RGB(255, 0, 0));
|
||||
rndctx->DrawString(aString, 50, 50, 100);
|
||||
|
||||
//rndctx->CopyOffScreenBits(*(((nsPaintEvent*)aEvent)->rect));
|
||||
rndctx->CopyOffScreenBits(aRect);
|
||||
|
||||
return nsEventStatus_eConsumeNoDefault;
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,74 +0,0 @@
|
|||
/* -*- 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.
|
||||
*/
|
||||
|
||||
#ifndef _nsAppTest_h__
|
||||
#define _nsAppTest_h__
|
||||
|
||||
#include <stdio.h>
|
||||
#include "nsIApplicationShell.h"
|
||||
#include "nsIShellInstance.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsRepository.h"
|
||||
#include "nsShellInstance.h"
|
||||
|
||||
#define NS_IAPPTEST_IID \
|
||||
{ 0x5040bd10, 0xdec5, 0x11d1, \
|
||||
{0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
|
||||
|
||||
/*
|
||||
* AppTest Class Declaration
|
||||
*/
|
||||
|
||||
class nsAppTest : public nsIApplicationShell {
|
||||
public:
|
||||
nsAppTest();
|
||||
~nsAppTest();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD Init();
|
||||
NS_IMETHOD Run();
|
||||
|
||||
public:
|
||||
nsIShellInstance * mShellInstance;
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
* AppTestFactory Class Declaration
|
||||
*/
|
||||
|
||||
class nsAppTestFactory : public nsIFactory {
|
||||
|
||||
public:
|
||||
nsAppTestFactory();
|
||||
~nsAppTestFactory();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
NS_IMETHOD CreateInstance(nsISupports * aOuter,
|
||||
const nsIID &aIID,
|
||||
void ** aResult);
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
|
@ -1,25 +0,0 @@
|
|||
/* -*- 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.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.
|
||||
*/
|
||||
|
||||
#ifndef resources_h___
|
||||
#define resources_h___
|
||||
|
||||
#define TIMER_OPEN 40010
|
||||
#define TIMER_EXIT 40011
|
||||
|
||||
#endif /* resources_h___ */
|
|
@ -1,23 +0,0 @@
|
|||
#!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=..\..
|
||||
IGNORE_MANIFEST=1
|
||||
|
||||
DIRS= apptest
|
||||
|
||||
include <$(DEPTH)\config\rules.mak>
|
Загрузка…
Ссылка в новой задаче