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

CProfilePropertySheet Class Reference

#include <profprop.h>

Inheritance diagram for CProfilePropertySheet:

CDialog List of all members.

Public Member Functions

 CProfilePropertySheet (HINSTANCE hiWhere, CProfile &cpTarget)
 ~CProfilePropertySheet ()
HWND Window () const
HINSTANCE Instance () const
CProfileProfile ()
BOOL DeleteIsOK () const
unsigned AssociationCount () const
unsigned Association (unsigned u)
LPCTSTR DisplayName (unsigned u)
void DeleteOnUninstall (BOOL bOn)
void Associate (unsigned u)
void Dissociate (unsigned u)
virtual BOOL OnInit ()
virtual BOOL OnNotify (int idCtrl, LPNMHDR pnmh)
virtual BOOL OnCommand (WORD wNotifyCode, WORD wid, HWND hwndControl)

Private Member Functions

void ConstructAssociations ()

Private Attributes

CProfilem_cpTarget
CDialogm_pcdPage [2]
RECT m_rcTab
BOOL m_bDelete
CUintArray m_cuaAdd
CUintArray m_cuaDelete
CUintArray m_cuaAssociate

Constructor & Destructor Documentation

CProfilePropertySheet::CProfilePropertySheet HINSTANCE  hiWhere,
CProfile cpTarget
 

Definition at line 55 of file profprop.cpp.

References ConstructAssociations(), CProfilePropertySheet(), CDialog::DoModal(), FALSE, InvalidProfileString, CProfile::IsValid(), m_bDelete, m_pcdPage, and NULL.

Referenced by CProfilePropertySheet().

00056 : 00057 CDialog(hiWhere, 00058 cpTarget.IsInstalled() ? UninstallInterface : InstallInterface), 00059 m_cpTarget(cpTarget) { 00060 00061 if (!cpTarget.IsValid()) { 00062 for (int i = 0; i < sizeof m_pcdPage / sizeof m_pcdPage[0]; i++) 00063 m_pcdPage[i] = NULL; 00064 00065 CGlobals::Report(InvalidProfileString, m_hwndParent); 00066 return; 00067 } 00068 00069 m_bDelete = FALSE; 00070 ConstructAssociations(); 00071 00072 DoModal(); 00073 }

CProfilePropertySheet::~CProfilePropertySheet  ) 
 

Definition at line 77 of file profprop.cpp.

References m_pcdPage.

00077 { 00078 for (int i = 0; i < sizeof m_pcdPage / sizeof (m_pcdPage[0]); i++) 00079 if (m_pcdPage[i]) 00080 delete m_pcdPage[i]; 00081 }


Member Function Documentation

void CProfilePropertySheet::Associate unsigned  u  ) 
 

Definition at line 85 of file profprop.cpp.

References CUintArray::Add(), Associate(), ConstructAssociations(), CUintArray::Count(), m_cuaAdd, m_cuaAssociate, and m_cuaDelete.

Referenced by Associate().

00085 { 00086 // First, see if it's on the delete list. If it is, remove it from there 00087 // Otherwise, add us to the add list, if it's a new association. 00088 00089 for (unsigned u = 0; u < m_cuaDelete.Count(); u++) 00090 if (uAdd == m_cuaDelete[u]) 00091 break; 00092 00093 if (u < m_cuaDelete.Count()) 00094 m_cuaDelete.Remove(u); 00095 else { 00096 for (u = 0; u < m_cuaAssociate.Count(); u++) 00097 if (m_cuaAssociate[u] == uAdd) 00098 break; 00099 if (u == m_cuaAssociate.Count()) 00100 m_cuaAdd.Add(uAdd); 00101 } 00102 00103 ConstructAssociations(); 00104 }

unsigned CProfilePropertySheet::Association unsigned  u  )  [inline]
 

Definition at line 61 of file profprop.h.

References Association(), and m_cuaAssociate.

Referenced by Association(), and CAdvancedPage::Update().

00061 { return m_cuaAssociate[u]; }

unsigned CProfilePropertySheet::AssociationCount  )  const [inline]
 

Definition at line 57 of file profprop.h.

References CUintArray::Count(), and m_cuaAssociate.

Referenced by CAdvancedPage::Update().

00057 { 00058 return m_cuaAssociate.Count(); 00059 }

void CProfilePropertySheet::ConstructAssociations  )  [private]
 

Definition at line 25 of file profprop.cpp.

References CUintArray::Add(), CProfile::Association(), CProfile::AssociationCount(), CUintArray::Count(), CUintArray::Empty(), m_cpTarget, m_cuaAdd, m_cuaAssociate, and m_cuaDelete.

Referenced by Associate(), CProfilePropertySheet(), and Dissociate().

00025 { 00026 00027 m_cuaAssociate.Empty(); // Clean it up! 00028 00029 for (unsigned u = 0; u < m_cpTarget.AssociationCount(); u++) { 00030 for (unsigned uDelete = 0; 00031 uDelete < m_cuaDelete.Count(); 00032 uDelete++) 00033 00034 if (m_cuaDelete[uDelete] == m_cpTarget.Association(u)) 00035 break; 00036 00037 if (uDelete == m_cuaDelete.Count()) // Not yet deleted 00038 m_cuaAssociate.Add(m_cpTarget.Association(u)); 00039 } 00040 00041 // Now, add any added associations 00042 00043 for (u = 0; u < m_cuaAdd.Count(); u++) 00044 m_cuaAssociate.Add(m_cuaAdd[u]); 00045 }

BOOL CProfilePropertySheet::DeleteIsOK  )  const [inline]
 

Definition at line 56 of file profprop.h.

References BOOL, and m_bDelete.

Referenced by CInstallPage::OnInit().

00056 { return m_bDelete; }

void CProfilePropertySheet::DeleteOnUninstall BOOL  bOn  )  [inline]
 

Definition at line 67 of file profprop.h.

References DeleteOnUninstall(), and m_bDelete.

Referenced by DeleteOnUninstall(), and CInstallPage::OnCommand().

00067 { 00068 m_bDelete = bOn; 00069 }

LPCTSTR CProfilePropertySheet::DisplayName unsigned  u  )  [inline]
 

Definition at line 63 of file profprop.h.

References CProfile::DisplayName(), DisplayName(), m_cpTarget, and m_cuaAssociate.

Referenced by DisplayName(), and CAdvancedPage::Update().

00063 { 00064 return m_cpTarget.DisplayName(m_cuaAssociate[u]); 00065 }

void CProfilePropertySheet::Dissociate unsigned  u  ) 
 

Definition at line 108 of file profprop.cpp.

References CUintArray::Add(), ConstructAssociations(), CUintArray::Count(), Dissociate(), m_cuaAdd, and m_cuaDelete.

Referenced by Dissociate(), and CAdvancedPage::OnCommand().

00108 { 00109 // First, see if it's on the add list. If it is, remove it from there 00110 // Otherwise, add us to the delete list. 00111 00112 for (unsigned u = 0; u < m_cuaAdd.Count(); u++) 00113 if (uRemove == m_cuaAdd[u]) 00114 break; 00115 00116 if (u < m_cuaAdd.Count()) 00117 m_cuaAdd.Remove(u); 00118 else 00119 m_cuaDelete.Add(uRemove); 00120 00121 ConstructAssociations(); 00122 }

HINSTANCE CProfilePropertySheet::Instance  )  const [inline]
 

Definition at line 54 of file profprop.h.

00054 { return m_hiWhere; }

BOOL CProfilePropertySheet::OnCommand WORD  wNotifyCode,
WORD  wid,
HWND  hwndControl
[virtual]
 

Reimplemented from CDialog.

Definition at line 205 of file profprop.cpp.

References CProfile::Associate(), BOOL, CUintArray::Count(), CProfile::Dissociate(), CProfile::Install(), CProfile::IsInstalled(), m_bDelete, m_cpTarget, m_cuaAdd, m_cuaDelete, OnCommand(), CUintArray::Remove(), and CProfile::Uninstall().

Referenced by OnCommand().

00206 { 00207 switch (wid) { 00208 00209 case IDOK: 00210 00211 if (wNotifyCode == BN_CLICKED && !m_cpTarget.IsInstalled()) 00212 m_cpTarget.Install(); 00213 // Remove any associations we're removing 00214 while (m_cuaDelete.Count()) { 00215 m_cpTarget.Dissociate(m_cpTarget.Device(m_cuaDelete[0])); 00216 m_cuaDelete.Remove(0); 00217 } 00218 // Add any associations we're adding 00219 while (m_cuaAdd.Count()) { 00220 m_cpTarget.Associate(m_cpTarget.Device(m_cuaAdd[0])); 00221 m_cuaAdd.Remove(0); 00222 } 00223 break; 00224 00225 case UninstallButton: 00226 00227 if (wNotifyCode == BN_CLICKED) 00228 m_cpTarget.Uninstall(m_bDelete); 00229 break; 00230 } 00231 00232 return CDialog::OnCommand(wNotifyCode, wid, hwndControl); 00233 }

BOOL CProfilePropertySheet::OnInit  )  [virtual]
 

Reimplemented from CDialog.

Definition at line 126 of file profprop.cpp.

References AdvancedString, BOOL, CDialog::Create(), DefaultIcon, FALSE, GetDlgItem(), GetWindowRect(), CProfile::IsInstalled(), CString::Load(), m_cpTarget, m_pcdPage, m_rcTab, NULL, OffsetRect(), SendDlgItemMessage(), SendMessage(), ShortInstallString, ShortUninstallString, TRUE, and UninstalledIcon.

00126 { 00127 00128 CString csWork; 00129 TC_ITEM tciThis = {TCIF_TEXT, 0, 0, NULL, 0, -1, 0}; 00130 00131 // We'll begin by determining the bounding rectangle of the client 00132 // area of the tab control 00133 00134 RECT rcWork; 00135 00136 GetWindowRect(GetDlgItem(m_hwnd, TabControl), &m_rcTab); 00137 GetWindowRect(m_hwnd, &rcWork); 00138 OffsetRect(&m_rcTab, -rcWork.left, -rcWork.top); 00139 SendDlgItemMessage(m_hwnd, TabControl, TCM_ADJUSTRECT, FALSE, 00140 (LPARAM) &m_rcTab); 00141 00142 // Then, we create the classes for the two descendants, and 00143 // initialize the first dialog. 00144 00145 m_pcdPage[0] = new CInstallPage(this); 00146 m_pcdPage[1] = new CAdvancedPage(this); 00147 m_pcdPage[0] -> Create(); 00148 m_pcdPage[0] -> Adjust(m_rcTab); 00149 00150 // Then, initialize the tab control 00151 00152 csWork.Load(m_cpTarget.IsInstalled() ? 00153 ShortUninstallString : ShortInstallString); 00154 00155 tciThis.pszText = const_cast<LPTSTR>((LPCTSTR) csWork); 00156 00157 SendDlgItemMessage(m_hwnd, TabControl, TCM_INSERTITEM, 0, 00158 (LPARAM) &tciThis); 00159 00160 csWork.Load(AdvancedString); 00161 00162 tciThis.pszText = const_cast<LPTSTR>((LPCTSTR) csWork); 00163 00164 SendDlgItemMessage(m_hwnd, TabControl, TCM_INSERTITEM, 1, 00165 (LPARAM) &tciThis); 00166 00167 // Finally, let's set the icons for this little monster... 00168 00169 HICON hi = LoadIcon(m_hiWhere, 00170 MAKEINTRESOURCE(m_cpTarget.IsInstalled() ? 00171 DefaultIcon : UninstalledIcon)); 00172 00173 SendMessage(m_hwnd, WM_SETICON, ICON_BIG, (LPARAM) hi); 00174 00175 return TRUE; // We've not set the focus anywhere 00176 }

BOOL CProfilePropertySheet::OnNotify int  idCtrl,
LPNMHDR  pnmh
[virtual]
 

Reimplemented from CDialog.

Definition at line 180 of file profprop.cpp.

References BOOL, CDialog::Create(), CDialog::Destroy(), FALSE, m_pcdPage, m_rcTab, OnNotify(), SendMessage(), and TRUE.

Referenced by OnNotify().

00180 { 00181 00182 int iPage = !!SendMessage(pnmh -> hwndFrom, TCM_GETCURSEL, 0, 0); 00183 00184 switch (pnmh -> code) { 00185 case TCN_SELCHANGING: 00186 00187 m_pcdPage[iPage] -> Destroy(); 00188 return FALSE; // Allow the selection to change. 00189 00190 case TCN_SELCHANGE: 00191 00192 // Create the appropriate dialog 00193 00194 m_pcdPage[iPage] -> Create(); 00195 m_pcdPage[iPage] -> Adjust(m_rcTab); 00196 00197 return TRUE; 00198 } 00199 00200 return TRUE; // Claim to have handled it (perhaps a bit bogus). 00201 }

CProfile& CProfilePropertySheet::Profile  )  [inline]
 

Definition at line 55 of file profprop.h.

References m_cpTarget.

Referenced by CAdvancedPage::OnInit(), CInstallPage::OnInit(), and CAdvancedPage::Update().

00055 { return m_cpTarget; }

HWND CProfilePropertySheet::Window  )  const [inline]
 

Definition at line 53 of file profprop.h.

00053 { return m_hwnd; }


Member Data Documentation

BOOL CProfilePropertySheet::m_bDelete [private]
 

Definition at line 40 of file profprop.h.

Referenced by CProfilePropertySheet(), DeleteIsOK(), DeleteOnUninstall(), and OnCommand().

CProfile& CProfilePropertySheet::m_cpTarget [private]
 

Definition at line 37 of file profprop.h.

Referenced by ConstructAssociations(), DisplayName(), OnCommand(), OnInit(), and Profile().

CUintArray CProfilePropertySheet::m_cuaAdd [private]
 

Definition at line 41 of file profprop.h.

Referenced by Associate(), ConstructAssociations(), Dissociate(), and OnCommand().

CUintArray CProfilePropertySheet::m_cuaAssociate [private]
 

Definition at line 43 of file profprop.h.

Referenced by Associate(), Association(), AssociationCount(), ConstructAssociations(), and DisplayName().

CUintArray CProfilePropertySheet::m_cuaDelete [private]
 

Definition at line 42 of file profprop.h.

Referenced by Associate(), ConstructAssociations(), Dissociate(), and OnCommand().

CDialog* CProfilePropertySheet::m_pcdPage[2] [private]
 

Definition at line 38 of file profprop.h.

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

RECT CProfilePropertySheet::m_rcTab [private]
 

Definition at line 39 of file profprop.h.

Referenced by OnInit(), and OnNotify().


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