Adding support for new 'desktop' preferences

This commit is contained in:
law%netscape.com 1998-08-13 06:34:31 +00:00
Родитель 51fe5f427d
Коммит 23e8a773fa
3 изменённых файлов: 31 добавлений и 15 удалений

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

@ -215,6 +215,8 @@ DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////
// CPropertyFrameDialog implementation
HWND CPropertyFrameDialog::m_hwndShowing = 0;
// Constructor
CPropertyFrameDialog::CPropertyFrameDialog(HWND hwndOwner,
int x,
@ -286,7 +288,7 @@ CPropertyFrameDialog::InitDialog(HWND hdlg)
HWND hwnd;
// Save away the window handle for the dialog
m_hdlg = hdlg;
m_hwndShowing = m_hdlg = hdlg;
// Get the bold font we will be using. It's the same font as the
// dialog box uses, except it's bold
@ -885,6 +887,7 @@ CPropertyFrameDialog::DoModal()
// Cleanup
if (m_pCurPage)
m_pCurPage->m_pPage->SetObjects(0, NULL);
m_hwndShowing = 0;
DestroyWindow(m_hdlg);
return nResult;

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

@ -48,12 +48,18 @@ class CPropertyFrameDialog {
// a chance to translate accelerators
HRESULT TranslateAccelerator(LPMSG);
// Static functions to be used to ensure only one property frame is
// showing.
static BOOL IsShowing() { return m_hwndShowing != 0; }
static void BringToTop() { ::BringWindowToTop(m_hwndShowing); }
protected:
int RunModalLoop();
private:
HWND m_hdlg;
HWND m_hwndOwner;
static HWND m_hwndShowing;
int m_x, m_y;
LPCSTR m_lpszCaption;
ULONG m_nInitialCategory;

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

@ -330,20 +330,27 @@ NS_CreatePropertyFrame(HWND hwndOwner,
if (nCategories == 0)
return ResultFromScode(S_FALSE);
// Create the property frame dialog
CPropertyFrameDialog dialog(hwndOwner, x, y, lpszCaption, lpfnNetHelp);
// Initialize the property frame dialog
hres = dialog.CreatePages(nCategories, lplpProviders, nInitial);
if (FAILED(hres)) {
#ifdef _DEBUG
OutputDebugString("CPropertyFrameDialog::CreatePages failed\n");
#endif
return hres;
}
// Display the property frame as a modal dialog
dialog.DoModal();
// Catch cases where prefs already showing; we can get here if prefs are
// showing and user does "mozilla -prefs", for example.
if ( CPropertyFrameDialog::IsShowing() ) {
// Bring existing property frame dialog to top.
CPropertyFrameDialog::BringToTop();
} else {
// Create the property frame dialog
CPropertyFrameDialog dialog(hwndOwner, x, y, lpszCaption, lpfnNetHelp);
// Initialize the property frame dialog
hres = dialog.CreatePages(nCategories, lplpProviders, nInitial);
if (FAILED(hres)) {
#ifdef _DEBUG
OutputDebugString("CPropertyFrameDialog::CreatePages failed\n");
#endif
return hres;
}
// Display the property frame as a modal dialog
dialog.DoModal();
}
return NOERROR;
}