Support for modal dialogs in Gtk+ xpfe. Reviewed by rods.

This commit is contained in:
syd%netscape.com 1999-04-19 21:18:50 +00:00
parent e1ddf7f16e
commit 74fe2092df
7 changed files with 31 additions and 2 deletions

View File

@ -264,6 +264,13 @@ class nsIWidget : public nsISupports {
*/
NS_IMETHOD Show(PRBool aState) = 0;
/**
* Make the window modal
*
*
*/
NS_IMETHOD SetModal(void) = 0;
/**
* Returns whether the window is visible
*

View File

@ -191,6 +191,22 @@ NS_METHOD nsWidget::Show(PRBool bState)
return NS_OK;
}
NS_METHOD nsWidget::SetModal(void)
{
GtkWindow *toplevel;
if (!mWidget)
return NS_ERROR_FAILURE;
toplevel = (GtkWindow *) ::gtk_widget_get_toplevel (mWidget);
if (!toplevel)
return NS_ERROR_FAILURE;
::gtk_window_set_modal(toplevel, PR_TRUE);
return NS_OK;
}
NS_METHOD nsWidget::IsVisible(PRBool &aState)
{
if (mWidget) {

View File

@ -60,6 +60,7 @@ class nsWidget : public nsBaseWidget
NS_IMETHOD Destroy(void);
nsIWidget* GetParent(void);
NS_IMETHOD SetModal(void);
NS_IMETHOD Show(PRBool state);
NS_IMETHOD IsVisible(PRBool &aState);

View File

@ -429,8 +429,6 @@ nsresult nsWindow::SetIcon(GdkPixmap *pixmap,
return NS_OK;
}
/**
* Processes an Expose Event
*

View File

@ -811,4 +811,9 @@ NS_METHOD nsBaseWidget::EnableFileDrop(PRBool aEnable)
return NS_OK;
}
NS_METHOD nsBaseWidget::SetModal(void)
{
return NS_ERROR_FAILURE;
}

View File

@ -72,6 +72,7 @@ public:
virtual nsIDeviceContext* GetDeviceContext();
virtual nsIAppShell * GetAppShell();
virtual nsIToolkit* GetToolkit();
NS_IMETHOD SetModal(void);
NS_IMETHOD SetBorderStyle(nsBorderStyle aBorderStyle);
NS_IMETHOD SetTitle(const nsString& aTitle);
NS_IMETHOD SetTooltips(PRUint32 aNumberOfTips,nsRect* aTooltipAreas[]);

View File

@ -874,6 +874,7 @@ nsWebShellWindow::ShowModalInternal()
subshell->Spinup();
nsIWidget *window = GetWidget();
window->SetModal();
NS_ADDREF(window);
mContinueModalLoop = PR_TRUE;
while (NS_SUCCEEDED(rv) && mContinueModalLoop == PR_TRUE) {