This commit is contained in:
spider 1998-06-12 18:30:53 +00:00
Родитель 9b4001bc60
Коммит 916ed5c8f8
4 изменённых файлов: 143 добавлений и 90 удалений

Просмотреть файл

@ -15,39 +15,44 @@
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsIApplicationShell_h___
#define nsIApplicationShell_h___
#include "nsISupports.h"
#include "nsshell.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} }
//2293d960-deff-11d1-9244-00805f8a7ab6
#define NS_IAPPLICATIONSHELL_CID \
{ 0x2293d960, 0xdeff, 0x11d1, \
{0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
// All Applications must implement this C interface
extern "C" nsresult NS_RegisterApplicationShellFactory();
// Interface to the application shell.
class nsIApplicationShell : public nsISupports {
// Application Shell Interface
class nsIApplicationShell : public nsISupports
{
public:
// Create a native window for this web widget; may be called once
/**
* 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;
};
extern NS_SHELL nsresult NS_NewApplicationShell(nsIApplicationShell** aInstancePtrResult);
#endif /* nsIApplicationShell_h___ */

Просмотреть файл

@ -19,47 +19,98 @@
#ifndef nsIShellInstance_h___
#define nsIShellInstance_h___
#include "nscore.h"
#include "nsshell.h"
#include "nsISupports.h"
#include "nsIApplicationShell.h"
#include "nsIWidget.h"
#include "nsshell.h"
#include "nscore.h"
class nsIApplicationShell;
// bf88e640-df99-11d1-9244-00805f8a7ab6
#define NS_ISHELLINSTANCE_IID \
{ 0xbf88e640, 0xdf99, 0x11d1, \
{0x92, 0x44, 0x00, 0x80, 0x5f, 0x8a, 0x7a, 0xb6} }
// 90487580-fefe-11d1-becd-00805f8a8dbd
#define NS_SHELLINSTANCE_CID \
{ 0x90487580, 0xfefe, 0x11d1, \
{0xbe, 0xcd, 0x00, 0x80, 0x5f, 0x8a, 0x8d, 0xbd} }
// Interface to the application shell.
class nsIShellInstance : public nsISupports {
// An Interface for interacting with a specific Application Instance
class nsIShellInstance : public nsISupports
{
public:
// Create a native window for this web widget; may be called once
/**
* 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 ;
};

Просмотреть файл

@ -1,69 +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 enums
*/
enum nsModalMessageType {
///OK Modal Message
eModalMessage_ok,
///OK/CANCEL Modal Message
eModalMessage_ok_cancel,
};
class NS_SHELL nsApplicationManager {
private:
static PRMonitor *monitor;
static nsHashtable * applications;
static nsresult checkInitialized();
public:
static nsresult Initialize();
static nsresult GetShellInstance(nsIApplicationShell * aApplicationShell,
nsIShellInstance **aShellInstance);
static nsresult SetShellAssociation(nsIApplicationShell * aApplicationShell,
nsIShellInstance *aShellInstance);
static nsresult DeleteShellAssociation(nsIApplicationShell * aApplicationShell,
nsIShellInstance *aShellInstance);
static nsresult ModalMessage(const nsString &aMessage, const nsString &aTitle, nsModalMessageType aModalMessageType);
};
#endif

Просмотреть файл

@ -26,8 +26,14 @@
// platform independent native handle to application instance
typedef void * nsNativeApplicationInstance ;
class nsShellInstance : public nsIShellInstance {
class nsShellInstance : public nsIShellInstance
{
public:
/**
* Constructor and Destructor
*/
nsShellInstance();
~nsShellInstance();
@ -37,34 +43,94 @@ public:
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();
NS_IMETHOD_(void) SetApplicationShell(nsIApplicationShell * aApplicationShell);
/**
* 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() ;
private:
nsNativeApplicationInstance mNativeInstance ;
nsIApplicationShell * mApplicationShell ;
nsIWidget * mApplicationWindow ;
nsIApplicationShell * mApplicationShell ;
nsIWidget * mApplicationWindow ;
};