Add SetModal() widget interface to nsIWidget, and provide an implementation

for Gtk+. Now, when we do modal dialogs, Gtk+ calls a routine that makes the
dialog modal within Gtk+; this is in addition to the code in nsWebShellWindow
that is being invoked to support modals on the other platforms. For Gtk+, the
nsWebShellWindow code doesn't appear to be enough; in order for the event
plumbing to stay alive, we need to call into Gtk+, and unless we actually make
the dialog modal using Gtk+ mechanisms, the user can still get to the menu bar, which is not good.
This commit is contained in:
syd%netscape.com 1999-06-13 20:56:08 +00:00
Родитель 21297e7a96
Коммит 8e3da9f573
6 изменённых файлов: 28 добавлений и 0 удалений

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

@ -253,6 +253,14 @@ 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
*

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

@ -248,6 +248,19 @@ 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) {

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

@ -64,6 +64,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);

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

@ -784,3 +784,7 @@ NS_METHOD nsBaseWidget::EnableFileDrop(PRBool aEnable)
return NS_OK;
}
NS_METHOD nsBaseWidget::SetModal(void)
{
return NS_ERROR_FAILURE;
}

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

@ -74,6 +74,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[]);

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

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