Back to index

lightning-sunbird  0.9+nobinonly
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes
CRegMozCtlDlg Class Reference

#include <RegMozCtlDlg.h>

Collaboration diagram for CRegMozCtlDlg:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { IDD = IDD_REGMOZCTL_DIALOG }

Public Member Functions

 CRegMozCtlDlg (CWnd *pParent=NULL)

Public Attributes

CListCtrl m_cTaskList
CString m_szMozillaDir

Protected Member Functions

virtual void DoDataExchange (CDataExchange *pDX)
virtual BOOL OnInitDialog ()
afx_msg void OnPaint ()
afx_msg HCURSOR OnQueryDragIcon ()
afx_msg void OnRegister ()
afx_msg void OnUnregister ()
afx_msg void OnPickDir ()
void RegisterMozillaControl (BOOL bRegister)
BOOL SetSystemPath (const CString &szNewPath)
CString GetSystemPath ()

Protected Attributes

HICON m_hIcon
CRegTaskManager m_cTaskMgr

Detailed Description

Definition at line 16 of file RegMozCtlDlg.h.


Member Enumeration Documentation

anonymous enum
Enumerator:
IDD 

Definition at line 24 of file RegMozCtlDlg.h.


Constructor & Destructor Documentation

CRegMozCtlDlg::CRegMozCtlDlg ( CWnd *  pParent = NULL)

Definition at line 17 of file RegMozCtlDlg.cpp.

       : CDialog(CRegMozCtlDlg::IDD, pParent)
{
       //{{AFX_DATA_INIT(CRegMozCtlDlg)
       m_szMozillaDir = _T("");
       //}}AFX_DATA_INIT
       // Note that LoadIcon does not require a subsequent DestroyIcon in Win32
       m_hIcon = AfxGetApp()->LoadIcon(IDI_MOZILLA);

       GetCurrentDirectory(1024, m_szMozillaDir.GetBuffer(1024));
       m_szMozillaDir.ReleaseBuffer();
}

Member Function Documentation

void CRegMozCtlDlg::DoDataExchange ( CDataExchange *  pDX) [protected, virtual]

Definition at line 30 of file RegMozCtlDlg.cpp.

{
       CDialog::DoDataExchange(pDX);
       //{{AFX_DATA_MAP(CRegMozCtlDlg)
       DDX_Control(pDX, IDC_TASKLIST, m_cTaskList);
       DDX_Text(pDX, IDC_MOZILLADIR, m_szMozillaDir);
       //}}AFX_DATA_MAP
}
CString CRegMozCtlDlg::GetSystemPath ( ) [protected]

Definition at line 248 of file RegMozCtlDlg.cpp.

{
       // TODO
       return _T("");
}
BOOL CRegMozCtlDlg::OnInitDialog ( ) [protected, virtual]

Definition at line 52 of file RegMozCtlDlg.cpp.

{
       // Set the icon for this dialog.  The framework does this automatically
       //  when the application's main window is not a dialog
       SetIcon(m_hIcon, TRUE);                   // Set big icon
       SetIcon(m_hIcon, FALSE);           // Set small icon
       
       // Get values from the registry
       TCHAR szValue[1024];
       DWORD dwSize = sizeof(szValue) / sizeof(szValue[0]);
       CRegKey cKey;
       cKey.Create(HKEY_LOCAL_MACHINE, MOZ_CONTROL_REG_KEY);
       
       memset(szValue, 0, sizeof(szValue));
       if (cKey.QueryValue(szValue, MOZ_CONTROL_REG_VALUE_BIN_DIR_PATH, &dwSize) == ERROR_SUCCESS)
       {
              m_szMozillaDir = CString(szValue);
       }

    CDialog::OnInitDialog();

    CRegTask::PopulateTasks(m_cTaskMgr);

       // Add icons to image list
//     m_cImageList.Create(16, 16, ILC_MASK, 0, 5);
//     m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_DOESNTCONTAINIE));
//     m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_CONTAINSIE));
//     m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_CONTAINSMOZILLA));
//     m_cImageList.Add(AfxGetApp()->LoadIcon(IDI_UNKNOWNSTATUS));

       // Associate image list with file list
//     m_cFileList.SetImageList(&m_cImageList, LVSIL_SMALL);

       struct ColumnData
       {
              TCHAR *sColumnTitle;
              int nPercentageWidth;
              int nFormat;
       };

       ColumnData aColData[] =
       {
              { _T("Task"), 70, LVCFMT_LEFT },
              { _T("Status"),      30, LVCFMT_LEFT }
       };

       // Get the size of the file list control and neatly
       // divide it into columns

       CRect rcList;
       m_cTaskList.GetClientRect(&rcList);

       int nColTotal = sizeof(aColData) / sizeof(aColData[0]);
       int nWidthRemaining = rcList.Width();
       
       for (int nCol = 0; nCol < nColTotal; nCol++)
       {
              ColumnData *pData = &aColData[nCol];

              int nColWidth = (rcList.Width() * pData->nPercentageWidth) / 100;
              if (nCol == nColTotal - 1)
              {
                     nColWidth = nWidthRemaining;
              }
              else if (nColWidth > nWidthRemaining)
              {
                     nColWidth = nWidthRemaining;
              }

              m_cTaskList.InsertColumn(nCol, pData->sColumnTitle, pData->nFormat, nColWidth);

              nWidthRemaining -= nColWidth;
              if (nColWidth <= 0)
              {
                     break;
              }
       }

    for (int i = 0; i < m_cTaskMgr.GetTaskCount(); i++)
    {
        CRegTask *pTask = m_cTaskMgr.GetTask(i);
        m_cTaskList.InsertItem(i, pTask->GetDescription());
    }

       return TRUE;  // return TRUE  unless you set the focus to a control
}

Here is the call graph for this function:

void CRegMozCtlDlg::OnPaint ( ) [protected]

Definition at line 143 of file RegMozCtlDlg.cpp.

{
       if (IsIconic())
       {
              CPaintDC dc(this); // device context for painting

              SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

              // Center icon in client rectangle
              int cxIcon = GetSystemMetrics(SM_CXICON);
              int cyIcon = GetSystemMetrics(SM_CYICON);
              CRect rect;
              GetClientRect(&rect);
              int x = (rect.Width() - cxIcon + 1) / 2;
              int y = (rect.Height() - cyIcon + 1) / 2;

              // Draw the icon
              dc.DrawIcon(x, y, m_hIcon);
       }
       else
       {
              CDialog::OnPaint();
       }
}
void CRegMozCtlDlg::OnPickDir ( ) [protected]

Definition at line 200 of file RegMozCtlDlg.cpp.

{
       BROWSEINFO bi;
       TCHAR szFolder[MAX_PATH + 1];

       memset(szFolder, 0, sizeof(szFolder));

       memset(&bi, 0, sizeof(bi));
       bi.hwndOwner = GetSafeHwnd();
       bi.pidlRoot = NULL;
       bi.pszDisplayName = szFolder;
       bi.lpszTitle = _T("Pick a folder to scan");

       // Open the folder browser dialog
       LPITEMIDLIST pItemList = SHBrowseForFolder(&bi);
       if (pItemList)
       {
              IMalloc *pShellAllocator = NULL;
              
              SHGetMalloc(&pShellAllocator);
              if (pShellAllocator)
              {
                     char szPath[MAX_PATH + 1];

                     if (SHGetPathFromIDList(pItemList, szPath))
                     {
                            // Chop off the end path separator
                            int nPathSize = strlen(szPath);
                            if (nPathSize > 0)
                            {
                                   if (szPath[nPathSize - 1] == '\\')
                                   {
                                          szPath[nPathSize - 1] = '\0';
                                   }
                            }

                            m_szMozillaDir = CString(szPath);

                            UpdateData(FALSE);
                     }

                     pShellAllocator->Free(pItemList);
                     pShellAllocator->Release();
              }
       }
}

Here is the call graph for this function:

HCURSOR CRegMozCtlDlg::OnQueryDragIcon ( ) [protected]

Definition at line 170 of file RegMozCtlDlg.cpp.

{
       return (HCURSOR) m_hIcon;
}

Definition at line 175 of file RegMozCtlDlg.cpp.

Here is the call graph for this function:

Definition at line 180 of file RegMozCtlDlg.cpp.

Here is the call graph for this function:

void CRegMozCtlDlg::RegisterMozillaControl ( BOOL  bRegister) [protected]

Definition at line 185 of file RegMozCtlDlg.cpp.

{
       UpdateData();

    m_cTaskMgr.SetValue(c_szValueBinDirPath, m_szMozillaDir);

    for (int i = 0; i < m_cTaskMgr.GetTaskCount(); i++)
    {
        CRegTask *pTask = m_cTaskMgr.GetTask(i);
        pTask->DoTask();
    }

    AfxMessageBox(bRegister ? _T("Register completed") : _T("Unregister completed"));
}

Here is the call graph for this function:

Here is the caller graph for this function:

BOOL CRegMozCtlDlg::SetSystemPath ( const CString &  szNewPath) [protected]

Definition at line 254 of file RegMozCtlDlg.cpp.

{
       // TODO
       return TRUE;
}

Member Data Documentation

Definition at line 25 of file RegMozCtlDlg.h.

Definition at line 38 of file RegMozCtlDlg.h.

HICON CRegMozCtlDlg::m_hIcon [protected]

Definition at line 37 of file RegMozCtlDlg.h.

Definition at line 26 of file RegMozCtlDlg.h.


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