зеркало из https://github.com/mozilla/pjs.git
adding ShowDialog()
This commit is contained in:
Родитель
7213b94e8d
Коммит
8478aadfbb
|
@ -4,5 +4,6 @@ interface ToolkitCore : BaseAppCore
|
|||
{0x81, 0xb2, 0x00, 0x60, 0x08, 0x3a, 0x0b, 0xcf}} *\
|
||||
|
||||
void ToolkitCore();
|
||||
void ShowDialog(in wstring url, in Window parent);
|
||||
void ShowWindow(in wstring url, in Window parent);
|
||||
};
|
||||
|
|
|
@ -35,20 +35,24 @@ class nsIDOMToolkitCore : public nsIDOMBaseAppCore {
|
|||
public:
|
||||
static const nsIID& GetIID() { static nsIID iid = NS_IDOMTOOLKITCORE_IID; return iid; }
|
||||
|
||||
NS_IMETHOD ShowDialog(const nsString& aUrl, nsIDOMWindow* aParent)=0;
|
||||
|
||||
NS_IMETHOD ShowWindow(const nsString& aUrl, nsIDOMWindow* aParent)=0;
|
||||
};
|
||||
|
||||
|
||||
#define NS_DECL_IDOMTOOLKITCORE \
|
||||
NS_IMETHOD ShowDialog(const nsString& aUrl, nsIDOMWindow* aParent); \
|
||||
NS_IMETHOD ShowWindow(const nsString& aUrl, nsIDOMWindow* aParent); \
|
||||
|
||||
|
||||
|
||||
#define NS_FORWARD_IDOMTOOLKITCORE(_to) \
|
||||
NS_IMETHOD ShowDialog(const nsString& aUrl, nsIDOMWindow* aParent) { return _to##ShowDialog(aUrl, aParent); } \
|
||||
NS_IMETHOD ShowWindow(const nsString& aUrl, nsIDOMWindow* aParent) { return _to##ShowWindow(aUrl, aParent); } \
|
||||
|
||||
|
||||
extern nsresult NS_InitToolkitCoreClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
extern "C" NS_DOM nsresult NS_InitToolkitCoreClass(nsIScriptContext *aContext, void **aPrototype);
|
||||
|
||||
extern "C" NS_DOM nsresult NS_NewScriptToolkitCore(nsIScriptContext *aContext, nsISupports *aSupports, nsISupports *aParent, void **aReturn);
|
||||
|
||||
|
|
|
@ -127,6 +127,44 @@ nsToolkitCore::Init(const nsString& aId) {
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsToolkitCore::ShowDialog(const nsString& aUrl, nsIDOMWindow* aParent) {
|
||||
|
||||
nsresult rv;
|
||||
nsString controllerCID;
|
||||
nsIAppShellService *appShell;
|
||||
nsIWidget *window;
|
||||
|
||||
window = nsnull;
|
||||
|
||||
nsCOMPtr<nsIURL> urlObj;
|
||||
rv = NS_NewURL(getter_AddRefs(urlObj), aUrl);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
rv = nsServiceManager::GetService(kAppShellServiceCID, kIAppShellServiceIID,
|
||||
(nsISupports**) &appShell);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
// hardwired temporary hack. See nsAppRunner.cpp at main()
|
||||
controllerCID = "43147b80-8a39-11d2-9938-0080c7cb1081";
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> webWindow = DOMWindowToWebShellWindow(aParent);
|
||||
nsCOMPtr<nsIWidget> parent;
|
||||
if (webWindow)
|
||||
webWindow->GetWidget(*getter_AddRefs(parent));
|
||||
|
||||
appShell->CreateTopLevelWindow(parent, urlObj, controllerCID, window,
|
||||
nsnull, nsnull, 615, 650);
|
||||
nsServiceManager::ReleaseService(kAppShellServiceCID, appShell);
|
||||
|
||||
if (window != nsnull)
|
||||
window->Show(PR_TRUE);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsToolkitCore::ShowWindow(const nsString& aUrl, nsIDOMWindow* aParent) {
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче