test: CAddDeviceDialog class Reference

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

# CAddDeviceDialog Class Reference

`#include <profassoc.h>`

Inheritance diagram for CAddDeviceDialog:

List of all members.

## Public Member Functions

| CAddDeviceDialog (CProfileAssociationPage *pcpas, HWND hwndParent)
virtual BOOL | OnInit ()
virtual BOOL | OnCommand (WORD wNotification, WORD wid, HWND hwndControl)
virtual BOOL | OnHelp (LPHELPINFO pHelp)
virtual BOOL | OnContextMenu (HWND hwnd)
BOOL | bCanceled ()
| CAddDeviceDialog (CProfilePropertySheet &cpps, HWND hwndParent)
virtual BOOL | OnInit ()
virtual BOOL | OnCommand (WORD wNotification, WORD wid, HWND hwndControl)

## Private Attributes

CProfileAssociationPage * | m_pcpasBoss
HWND | m_hwndList
HWND | m_hwndButton
BOOL | m_bCanceled
CProfilePropertySheet & | m_cppsBoss

## Constructor & Destructor Documentation

CAddDeviceDialog::CAddDeviceDialog | ( | CProfileAssociationPage * | pcpas,
|  | HWND | hwndParent
| ) |

Definition at line 379 of file profassoc.cpp.

References AddDeviceDialog, CAddDeviceDialog(), CDialog::DoModal(), m_bCanceled, m_pcpasBoss, and TRUE.

Referenced by CAddDeviceDialog().

    00380                                                     :
    00381     CDialog(pcpas->Instance(), AddDeviceDialog, hwndParent) {
    00382     m_pcpasBoss = pcpas;
    00383     m_bCanceled = TRUE;
    00384     DoModal();
    00385 }

CAddDeviceDialog::CAddDeviceDialog | ( | CProfilePropertySheet & | cpps,
|  | HWND | hwndParent
| ) |

Definition at line 172 of file propdlg.cpp.

References AddDeviceDialog, CAddDeviceDialog(), and CDialog::DoModal().

    00173                                                     :
    00174     CDialog(cpps.Instance(), AddDeviceDialog, hwndParent), m_cppsBoss(cpps) {
    00175     DoModal();
    00176 }

## Member Function Documentation

BOOL CAddDeviceDialog::bCanceled | ( |  | ) | `[inline]`

Definition at line 93 of file profassoc.h.

References BOOL, and m_bCanceled.

Referenced by CProfileAssociationPage::OnCommand().

    00093 {return m_bCanceled;}

virtual BOOL CAddDeviceDialog::OnCommand | ( | WORD | wNotification,
|  | WORD | wid,
|  | HWND | hwndControl
| ) | `[virtual]`

| Reimplemented from CDialog.

BOOL CAddDeviceDialog::OnCommand | ( | WORD | wNotification,
|  | WORD | wid,
|  | HWND | hwndControl
| ) | `[virtual]`

Reimplemented from CDialog.

Definition at line 421 of file profassoc.cpp.

References AddDeviceButton, CProfileAssociationPage::Associate(), BOOL, EnableWindow(), FALSE, m_bCanceled, m_hwndButton, m_hwndList, m_pcpasBoss, OnCommand(), SendMessage(), and TRUE.

Referenced by OnCommand().

    00422                                                      {
    00423
    00424     switch  (wNotification) {
    00425
    00426         case    LBN_SELCHANGE:
    00427             EnableWindow(m_hwndButton, -1 !=
    00428                 SendMessage(m_hwndList, LB_GETCURSEL, 0, 0));
    00429             return  TRUE;
    00430
    00431         case    BN_CLICKED:
    00432             if  (wid == AddDeviceButton) {
    00433
    00434                 LRESULT i = SendMessage(m_hwndList, LB_GETCURSEL, 0, 0);
    00435
    00436                 if  (i == -1)
    00437                     return  TRUE;
    00438
    00439                 unsigned uItem = (unsigned) SendMessage(m_hwndList,
    00440                     LB_GETITEMDATA, i, 0);
    00441
    00442                 m_pcpasBoss->Associate(uItem);
    00443
    00444                 // Selection has been made.
    00445
    00446                 m_bCanceled = FALSE;
    00447             }
    00448             break;
    00449
    00450         case    LBN_DBLCLK:
    00451             return  OnCommand(BN_CLICKED, AddDeviceButton, m_hwndButton);
    00452     }
    00453
    00454     return  CDialog::OnCommand(wNotification, wid, hwndControl);
    00455 }

BOOL CAddDeviceDialog::OnContextMenu | ( | HWND | hwnd | ) | `[virtual]`

Reimplemented from CDialog.

Definition at line 469 of file profassoc.cpp.

References AddDeviceUIHelpIds, BOOL, DWORD, GetDlgCtrlID(), OnContextMenu(), TRUE, and WINDOWS_HELP_FILE.

Referenced by OnContextMenu().

    00469                                                  {
    00470
    00471     DWORD iCtrlID = GetDlgCtrlID(hwnd);
    00472
    00473     WinHelp(hwnd, WINDOWS_HELP_FILE,
    00474             HELP_CONTEXTMENU, (ULONG_PTR) (LPSTR) AddDeviceUIHelpIds);
    00475
    00476     return (TRUE);
    00477 }

BOOL CAddDeviceDialog::OnHelp | ( | LPHELPINFO | pHelp | ) | `[virtual]`

Reimplemented from CDialog.

Definition at line 459 of file profassoc.cpp.

References AddDeviceUIHelpIds, BOOL, OnHelp(), TRUE, and WINDOWS_HELP_FILE.

Referenced by OnHelp().

    00459                                                  {
    00460
    00461     if (pHelp->iContextType == HELPINFO_WINDOW) {
    00462         WinHelp((HWND) pHelp->hItemHandle, WINDOWS_HELP_FILE,
    00463                 HELP_WM_HELP, (ULONG_PTR) (LPSTR) AddDeviceUIHelpIds);
    00464     }
    00465
    00466     return (TRUE);
    00467 }

virtual BOOL CAddDeviceDialog::OnInit | ( |  | ) | `[virtual]`

| Reimplemented from CDialog.

BOOL CAddDeviceDialog::OnInit | ( |  | ) | `[virtual]`

Reimplemented from CDialog.

Definition at line 389 of file profassoc.cpp.

References AddDeviceButton, CProfileAssociationPage::Association(), CProfileAssociationPage::AssociationCount(), BOOL, CProfile::DeviceCount(), DeviceListControl, CProfile::DisplayName(), EnableWindow(), GetDlgItem(), m_hwndButton, m_hwndList, m_pcpasBoss, CProfileAssociationPage::Profile(), SendMessage(), and TRUE.

    00389                                  {
    00390
    00391     CProfile * pcpThis = m_pcpasBoss->Profile();
    00392
    00393     m_hwndList   = GetDlgItem(m_hwnd, DeviceListControl);
    00394     m_hwndButton = GetDlgItem(m_hwnd, AddDeviceButton);
    00395
    00396     //  This must not list associated (tentatively) devices, per the spec
    00397
    00398     for (unsigned uDevice = 0; uDevice < pcpThis->DeviceCount(); uDevice++) {
    00399         for (unsigned u = 0; u < m_pcpasBoss->AssociationCount(); u++)
    00400             if  (uDevice == m_pcpasBoss->Association(u))
    00401                 break;
    00402         if  (u < m_pcpasBoss->AssociationCount())
    00403             continue;   //  Don't insert this one...
    00404
    00405         LRESULT idItem = SendMessage(m_hwndList, LB_ADDSTRING, (WPARAM)0,
    00406             (LPARAM) pcpThis->DisplayName(uDevice));
    00407         SendMessage(m_hwndList, LB_SETITEMDATA, idItem, (LPARAM) uDevice);
    00408     }
    00409
    00410     if  (SendMessage(m_hwndList, LB_GETCOUNT, 0, 0))
    00411         SendMessage(m_hwndList, LB_SETCURSEL, 0, 0);
    00412
    00413     EnableWindow(m_hwndButton, -1 !=
    00414         SendMessage(m_hwndList, LB_GETCURSEL, 0, 0));
    00415
    00416     return  TRUE;
    00417 }

## Member Data Documentation

BOOL CAddDeviceDialog::m_bCanceled`[private]`

| Definition at line 81 of file profassoc.h. Referenced by bCanceled(), CAddDeviceDialog(), and OnCommand().

CProfilePropertySheet& CAddDeviceDialog::m_cppsBoss`[private]`

| Definition at line 83 of file propdlg.h.

HWND CAddDeviceDialog::m_hwndButton`[private]`

| Definition at line 84 of file propdlg.h. Referenced by OnCommand(), and OnInit().

HWND CAddDeviceDialog::m_hwndList`[private]`

| Definition at line 84 of file propdlg.h. Referenced by OnCommand(), and OnInit().

CProfileAssociationPage* CAddDeviceDialog::m_pcpasBoss`[private]`

| Definition at line 79 of file profassoc.h. Referenced by CAddDeviceDialog(), OnCommand(), and OnInit().

The documentation for this class was generated from the following files:

- profassoc.h
- propdlg.h
- profassoc.cpp
- propdlg.cpp