Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

CDialog Class Reference

#include <dialog.h>

Inheritance diagram for CDialog:

CAddDeviceDialog CAddDeviceDialog CAdvancedPage CColorMatchDialog CInstallPage CProfilePropertySheet List of all members.

Public Member Functions

 CDialog (HINSTANCE hiWhere, int id, HWND hwndParent=NULL)
 CDialog (CDialog &cdOwner, int id)
 ~CDialog ()
LONG DoModal ()
void Create ()
void Destroy ()
void Adjust (RECT &rc)
virtual BOOL OnCommand (WORD wNotifyCode, WORD wid, HWND hwndCtl)
virtual BOOL OnNotify (int idCtrl, LPNMHDR pnmh)
virtual BOOL OnInit ()
virtual BOOL OnHelp (LPHELPINFO pHelp)
virtual BOOL OnContextMenu (HWND hwnd)

Protected Attributes

HWND m_hwndParent
HWND m_hwnd
HINSTANCE m_hiWhere
DLGPROC m_dpHook
LPARAM m_lpHook

Static Private Member Functions

INT_PTR CALLBACK DialogProc (HWND hwndPage, UINT uMsg, WPARAM wp, LPARAM lp)

Private Attributes

int m_idMain
BOOL m_bIsModal

Constructor & Destructor Documentation

CDialog::CDialog HINSTANCE  hiWhere,
int  id,
HWND  hwndParent = NULL
 

Definition at line 24 of file dialog.cpp.

References CDialog(), FALSE, m_bIsModal, m_dpHook, m_hiWhere, m_hwnd, m_hwndParent, m_idMain, m_lpHook, and NULL.

Referenced by CDialog().

00024 { 00025 m_idMain = id; 00026 m_hwndParent = hwndParent; 00027 m_hiWhere = hiWhere; 00028 m_bIsModal = FALSE; 00029 m_hwnd = NULL; 00030 m_dpHook = NULL; 00031 m_lpHook = 0; 00032 }

CDialog::CDialog CDialog cdOwner,
int  id
 

Definition at line 34 of file dialog.cpp.

References CDialog(), FALSE, m_bIsModal, m_dpHook, m_hiWhere, m_hwnd, m_hwndParent, m_idMain, m_lpHook, and NULL.

00034 { 00035 m_idMain = id; 00036 m_hwndParent = cdOwner.m_hwnd; 00037 m_hiWhere = cdOwner.m_hiWhere; 00038 m_bIsModal = FALSE; 00039 m_hwnd = NULL; 00040 m_dpHook = NULL; 00041 m_lpHook = 0; 00042 }

CDialog::~CDialog  ) 
 

Definition at line 46 of file dialog.cpp.

References Destroy().

00046 { 00047 Destroy(); 00048 }


Member Function Documentation

void CDialog::Adjust RECT &  rc  ) 
 

Definition at line 147 of file dialog.cpp.

References Adjust(), m_hwnd, and SetWindowPos.

Referenced by Adjust().

00147 { 00148 SetWindowPos(m_hwnd, HWND_TOP, rc.left, rc.top, 0, 0, 00149 SWP_NOACTIVATE | SWP_NOSIZE | SWP_SHOWWINDOW); 00150 }

void CDialog::Create  ) 
 

Definition at line 60 of file dialog.cpp.

References DialogProc(), FALSE, m_bIsModal, m_hiWhere, m_hwnd, m_hwndParent, and m_idMain.

Referenced by CProfilePropertySheet::OnInit(), and CProfilePropertySheet::OnNotify().

00060 { 00061 if (!m_bIsModal && m_hwnd) 00062 return; // We'va already got one! 00063 00064 m_bIsModal = FALSE; 00065 CreateDialogParam(m_hiWhere, MAKEINTRESOURCE(m_idMain), 00066 m_hwndParent, CDialog::DialogProc, (LPARAM) this); 00067 }

void CDialog::Destroy  ) 
 

Definition at line 71 of file dialog.cpp.

References DestroyWindow, m_bIsModal, m_hwnd, and NULL.

Referenced by CProfilePropertySheet::OnNotify(), and ~CDialog().

00071 { 00072 if (!m_bIsModal && m_hwnd) { 00073 DestroyWindow(m_hwnd); 00074 m_hwnd = NULL; 00075 } 00076 }

INT_PTR CALLBACK CDialog::DialogProc HWND  hwndPage,
UINT  uMsg,
WPARAM  wp,
LPARAM  lp
[static, private]
 

Definition at line 83 of file dialog.cpp.

References BOOL, DialogProc(), FALSE, GetWindowLongPtr(), m_dpHook, m_hwnd, m_lpHook, OnCommand(), OnContextMenu(), OnHelp(), OnInit(), OnNotify(), SetWindowLongPtr(), TRUE, and UINT.

Referenced by Create(), DialogProc(), and DoModal().

00084 { 00085 00086 CDialog *pcdMe = (CDialog *) GetWindowLongPtr(hwndMe, DWLP_USER); 00087 00088 // If there is a hook procedure, it can either ignore or filter a 00089 // message by returning FALSE, or it can handle itself by returning 00090 // TRUE. WM_INITDALOG hook processing occurs AFTER all of our other 00091 // calls are made, and we allow the base class to define the LPARAM 00092 // that is passed in to the hook. 00093 // Because we do not have a pointer to the base class, we will miss 00094 // messages sent before WM_INITDIALOG (specifically WM_SETFONT) 00095 00096 if (uMsg != WM_INITDIALOG && pcdMe && pcdMe -> m_dpHook && 00097 (*pcdMe -> m_dpHook)(hwndMe, uMsg, wp, lp)) 00098 return TRUE; 00099 00100 switch (uMsg) { 00101 00102 case WM_INITDIALOG: 00103 00104 // The lp is the this pointer for the caller 00105 00106 pcdMe = (CDialog *) lp; 00107 00108 SetWindowLongPtr(hwndMe, DWLP_USER, (LONG_PTR)pcdMe); 00109 pcdMe -> m_hwnd = hwndMe; 00110 00111 // Derived classes override OnInit to initialize the dialog 00112 00113 if (!pcdMe -> m_dpHook) 00114 return pcdMe -> OnInit(); 00115 else { 00116 // If there is a hook procedure, we will call that after the 00117 // override- if the override returned FALSE, so must we 00118 BOOL bReturn = pcdMe -> OnInit(); 00119 return (*pcdMe -> m_dpHook)(hwndMe, uMsg, wp, 00120 pcdMe -> m_lpHook) && bReturn; 00121 } 00122 00123 case WM_COMMAND: 00124 00125 return pcdMe -> OnCommand(HIWORD(wp), LOWORD(wp), (HWND) lp); 00126 00127 case WM_NOTIFY: 00128 00129 return pcdMe -> OnNotify((int) wp, (LPNMHDR) lp); 00130 00131 case WM_HELP: 00132 00133 return pcdMe -> OnHelp((LPHELPINFO) lp); 00134 00135 case WM_CONTEXTMENU: 00136 00137 return pcdMe -> OnContextMenu((HWND) wp); 00138 00139 } 00140 00141 return FALSE; 00142 }

LONG CDialog::DoModal  ) 
 

Definition at line 52 of file dialog.cpp.

References DialogProc(), m_bIsModal, m_hiWhere, m_hwndParent, m_idMain, and TRUE.

Referenced by CAddDeviceDialog::CAddDeviceDialog(), CColorMatchDialog::CColorMatchDialog(), and CProfilePropertySheet::CProfilePropertySheet().

00052 { 00053 m_bIsModal = TRUE; 00054 return (LONG)DialogBoxParam(m_hiWhere, MAKEINTRESOURCE(m_idMain), m_hwndParent, 00055 CDialog::DialogProc, (LPARAM) this); 00056 }

virtual BOOL CDialog::OnCommand WORD  wNotifyCode,
WORD  wid,
HWND  hwndCtl
[inline, virtual]
 

Reimplemented in CColorMatchDialog, CAddDeviceDialog, CProfilePropertySheet, CInstallPage, CAdvancedPage, and CAddDeviceDialog.

Definition at line 98 of file dialog.h.

References BOOL, EndDialog(), FALSE, m_bIsModal, m_hwnd, and OnCommand().

Referenced by DialogProc(), and OnCommand().

00098 { 00099 // Call EndDialog for all BN_CLICKED messages on Modal boxes 00100 if (m_bIsModal && wNotifyCode == BN_CLICKED) 00101 EndDialog(m_hwnd, wid); 00102 return FALSE; 00103 }

virtual BOOL CDialog::OnContextMenu HWND  hwnd  )  [inline, virtual]
 

Reimplemented in CColorMatchDialog, and CAddDeviceDialog.

Definition at line 118 of file dialog.h.

References BOOL, OnContextMenu(), and TRUE.

Referenced by DialogProc(), and OnContextMenu().

00118 { return TRUE; }

virtual BOOL CDialog::OnHelp LPHELPINFO  pHelp  )  [inline, virtual]
 

Reimplemented in CColorMatchDialog, and CAddDeviceDialog.

Definition at line 117 of file dialog.h.

References BOOL, OnHelp(), and TRUE.

Referenced by DialogProc(), and OnHelp().

00117 { return TRUE; }

virtual BOOL CDialog::OnInit  )  [inline, virtual]
 

Reimplemented in CColorMatchDialog, CAddDeviceDialog, CProfilePropertySheet, CInstallPage, CAdvancedPage, and CAddDeviceDialog.

Definition at line 113 of file dialog.h.

References BOOL, and TRUE.

Referenced by DialogProc().

00113 { return TRUE; }

virtual BOOL CDialog::OnNotify int  idCtrl,
LPNMHDR  pnmh
[inline, virtual]
 

Reimplemented in CProfilePropertySheet.

Definition at line 107 of file dialog.h.

References BOOL, FALSE, and OnNotify().

Referenced by DialogProc(), and OnNotify().

00107 { 00108 return FALSE; 00109 }


Member Data Documentation

BOOL CDialog::m_bIsModal [private]
 

Definition at line 56 of file dialog.h.

Referenced by CDialog(), Create(), Destroy(), DoModal(), and OnCommand().

DLGPROC CDialog::m_dpHook [protected]
 

Definition at line 66 of file dialog.h.

Referenced by CDialog(), and DialogProc().

HINSTANCE CDialog::m_hiWhere [protected]
 

Definition at line 65 of file dialog.h.

Referenced by CDialog(), Create(), and DoModal().

HWND CDialog::m_hwnd [protected]
 

Definition at line 64 of file dialog.h.

Referenced by Adjust(), CDialog(), Create(), Destroy(), DialogProc(), and OnCommand().

HWND CDialog::m_hwndParent [protected]
 

Definition at line 63 of file dialog.h.

Referenced by CDialog(), Create(), and DoModal().

int CDialog::m_idMain [private]
 

Definition at line 55 of file dialog.h.

Referenced by CDialog(), Create(), and DoModal().

LPARAM CDialog::m_lpHook [protected]
 

Definition at line 67 of file dialog.h.

Referenced by CDialog(), and DialogProc().


The documentation for this class was generated from the following files:
Generated on Sat May 15 19:46:27 2004 for test by doxygen 1.3.7