Completed work on -width and -height for specifying the initial size of the window

This commit is contained in:
rods%netscape.com 1999-02-18 21:52:27 +00:00
Родитель 3c89f2bf4e
Коммит 7396ccd682
4 изменённых файлов: 26 добавлений и 14 удалений

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

@ -50,11 +50,13 @@ public:
NS_IMETHOD CreateTopLevelWindow(nsIURL* aUrl, NS_IMETHOD CreateTopLevelWindow(nsIURL* aUrl,
nsString& aControllerIID, nsString& aControllerIID,
nsIWidget*& aResult, nsIStreamObserver* anObserver) = 0; nsIWidget*& aResult, nsIStreamObserver* anObserver,
PRInt32 aInitialWidth, PRInt32 aInitialHeight) = 0;
NS_IMETHOD CreateDialogWindow(nsIWidget * aParent, NS_IMETHOD CreateDialogWindow(nsIWidget * aParent,
nsIURL* aUrl, nsIURL* aUrl,
nsString& aControllerIID, nsString& aControllerIID,
nsIWidget*& aResult, nsIStreamObserver* anObserver) = 0; nsIWidget*& aResult, nsIStreamObserver* anObserver,
PRInt32 aInitialWidth, PRInt32 aInitialHeight) = 0;
NS_IMETHOD CloseTopLevelWindow(nsIWidget* aWindow) = 0; NS_IMETHOD CloseTopLevelWindow(nsIWidget* aWindow) = 0;
NS_IMETHOD RegisterTopLevelWindow(nsIWidget* aWindow) = 0; NS_IMETHOD RegisterTopLevelWindow(nsIWidget* aWindow) = 0;
NS_IMETHOD UnregisterTopLevelWindow(nsIWidget* aWindow) = 0; NS_IMETHOD UnregisterTopLevelWindow(nsIWidget* aWindow) = 0;

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

@ -66,11 +66,13 @@ public:
NS_IMETHOD DispatchNativeEvent(void * aEvent); NS_IMETHOD DispatchNativeEvent(void * aEvent);
NS_IMETHOD Shutdown(void); NS_IMETHOD Shutdown(void);
NS_IMETHOD CreateTopLevelWindow(nsIURL* aUrl, nsString& aControllerIID, NS_IMETHOD CreateTopLevelWindow(nsIURL* aUrl, nsString& aControllerIID,
nsIWidget*& aResult, nsIStreamObserver* anObserver); nsIWidget*& aResult, nsIStreamObserver* anObserver,
PRInt32 aInitialWidth, PRInt32 aInitialHeight);
NS_IMETHOD CreateDialogWindow(nsIWidget * aParent, NS_IMETHOD CreateDialogWindow(nsIWidget * aParent,
nsIURL* aUrl, nsIURL* aUrl,
nsString& aControllerIID, nsString& aControllerIID,
nsIWidget*& aResult, nsIStreamObserver* anObserver); nsIWidget*& aResult, nsIStreamObserver* anObserver,
PRInt32 aInitialWidth, PRInt32 aInitialHeight);
NS_IMETHOD CloseTopLevelWindow(nsIWidget* aWindow); NS_IMETHOD CloseTopLevelWindow(nsIWidget* aWindow);
NS_IMETHOD RegisterTopLevelWindow(nsIWidget* aWindow); NS_IMETHOD RegisterTopLevelWindow(nsIWidget* aWindow);
NS_IMETHOD UnregisterTopLevelWindow(nsIWidget* aWindow); NS_IMETHOD UnregisterTopLevelWindow(nsIWidget* aWindow);
@ -202,7 +204,8 @@ nsAppShellService::Shutdown(void)
*/ */
NS_IMETHODIMP NS_IMETHODIMP
nsAppShellService::CreateTopLevelWindow(nsIURL* aUrl, nsString& aControllerIID, nsAppShellService::CreateTopLevelWindow(nsIURL* aUrl, nsString& aControllerIID,
nsIWidget*& aResult, nsIStreamObserver* anObserver) nsIWidget*& aResult, nsIStreamObserver* anObserver,
PRInt32 aInitialWidth, PRInt32 aInitialHeight)
{ {
nsresult rv; nsresult rv;
nsWebShellWindow* window; nsWebShellWindow* window;
@ -211,7 +214,7 @@ nsAppShellService::CreateTopLevelWindow(nsIURL* aUrl, nsString& aControllerIID,
if (nsnull == window) { if (nsnull == window) {
rv = NS_ERROR_OUT_OF_MEMORY; rv = NS_ERROR_OUT_OF_MEMORY;
} else { } else {
rv = window->Initialize(mAppShell, aUrl, aControllerIID, anObserver); rv = window->Initialize(mAppShell, aUrl, aControllerIID, anObserver, aInitialWidth, aInitialHeight);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
aResult = window->GetWidget(); aResult = window->GetWidget();
RegisterTopLevelWindow(aResult); RegisterTopLevelWindow(aResult);
@ -247,7 +250,8 @@ nsAppShellService::CloseTopLevelWindow(nsIWidget* aWindow)
NS_IMETHODIMP NS_IMETHODIMP
nsAppShellService::CreateDialogWindow(nsIWidget * aParent, nsAppShellService::CreateDialogWindow(nsIWidget * aParent,
nsIURL* aUrl, nsString& aControllerIID, nsIURL* aUrl, nsString& aControllerIID,
nsIWidget*& aResult, nsIStreamObserver* anObserver) nsIWidget*& aResult, nsIStreamObserver* anObserver,
PRInt32 aInitialWidth, PRInt32 aInitialHeight)
{ {
nsresult rv; nsresult rv;
nsWebShellWindow* window; nsWebShellWindow* window;
@ -256,7 +260,8 @@ nsAppShellService::CreateDialogWindow(nsIWidget * aParent,
if (nsnull == window) { if (nsnull == window) {
rv = NS_ERROR_OUT_OF_MEMORY; rv = NS_ERROR_OUT_OF_MEMORY;
} else { } else {
rv = window->Initialize(nsnull, mAppShell, aUrl, aControllerIID, anObserver); rv = window->Initialize(nsnull, mAppShell, aUrl, aControllerIID, anObserver,
aInitialWidth, aInitialHeight);
if (NS_SUCCEEDED(rv)) { if (NS_SUCCEEDED(rv)) {
mWindowList->AppendElement((nsIWebShellContainer*)window); mWindowList->AppendElement((nsIWebShellContainer*)window);
aResult = window->GetWidget(); aResult = window->GetWidget();

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

@ -165,14 +165,17 @@ nsWebShellWindow::QueryInterface(REFNSIID aIID, void** aInstancePtr)
nsresult nsWebShellWindow::Initialize(nsIAppShell* aShell, nsIURL* aUrl, nsresult nsWebShellWindow::Initialize(nsIAppShell* aShell, nsIURL* aUrl,
nsString& aControllerIID, nsIStreamObserver* anObserver) nsString& aControllerIID, nsIStreamObserver* anObserver,
PRInt32 aInitialWidth, PRInt32 aInitialHeight)
{ {
return Initialize(nsnull, aShell, aUrl, aControllerIID, anObserver); return Initialize(nsnull, aShell, aUrl, aControllerIID, anObserver,
aInitialWidth, aInitialHeight);
} }
nsresult nsWebShellWindow::Initialize(nsIWidget* aParent, nsresult nsWebShellWindow::Initialize(nsIWidget* aParent,
nsIAppShell* aShell, nsIURL* aUrl, nsIAppShell* aShell, nsIURL* aUrl,
nsString& aControllerIID, nsIStreamObserver* anObserver) nsString& aControllerIID, nsIStreamObserver* anObserver,
PRInt32 aInitialWidth, PRInt32 aInitialHeight)
{ {
nsresult rv; nsresult rv;
@ -183,7 +186,7 @@ nsresult nsWebShellWindow::Initialize(nsIWidget* aParent,
// XXX: need to get the default window size from prefs... // XXX: need to get the default window size from prefs...
nsRect r(0, 0, 650, 618); nsRect r(0, 0, aInitialWidth, aInitialHeight);
nsWidgetInitData initData; nsWidgetInitData initData;

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

@ -89,8 +89,10 @@ public:
NS_IMETHOD GetWidget(nsIWidget *& aWidget); NS_IMETHOD GetWidget(nsIWidget *& aWidget);
// nsWebShellWindow methods... // nsWebShellWindow methods...
nsresult Initialize(nsIAppShell* aShell, nsIURL* aUrl, nsString& aControllerIID, nsIStreamObserver* anObserver); nsresult Initialize(nsIAppShell* aShell, nsIURL* aUrl, nsString& aControllerIID, nsIStreamObserver* anObserver,
nsresult Initialize(nsIWidget * aParent, nsIAppShell* aShell, nsIURL* aUrl, nsString& aControllerIID, nsIStreamObserver* anObserver); PRInt32 aInitialWidth, PRInt32 aInitialHeight);
nsresult Initialize(nsIWidget * aParent, nsIAppShell* aShell, nsIURL* aUrl, nsString& aControllerIID, nsIStreamObserver* anObserver,
PRInt32 aInitialWidth, PRInt32 aInitialHeight);
nsIWidget* GetWidget(void) { return mWindow; } nsIWidget* GetWidget(void) { return mWindow; }
// nsIDocumentLoaderObserver // nsIDocumentLoaderObserver