home *** CD-ROM | disk | FTP | other *** search
/ ftp.funduc.com / 2014.08.ftp.funduc.com.tar / ftp.funduc.com / fshedcode-072212.zip / RemoveBookmarkDlg.cpp < prev    next >
C/C++ Source or Header  |  2011-01-27  |  3KB  |  105 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. //    License (GPLv2+):
  3. //    This program is free software; you can redistribute it and/or modify
  4. //    it under the terms of the GNU General Public License as published by
  5. //    the Free Software Foundation; either version 2 of the License, or
  6. //    (at your option) any later version.
  7. //
  8. //    This program is distributed in the hope that it will be useful, but
  9. //    WITHOUT ANY WARRANTY; without even the implied warranty of
  10. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11. //    General Public License for more details.
  12. //
  13. //    You should have received a copy of the GNU General Public License
  14. //    along with this program; if not, write to the Free Software
  15. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  16. /////////////////////////////////////////////////////////////////////////////
  17.  
  18. #include "stdafx.h"
  19. #include "fshed.h"
  20. #include "RemoveBookmarkDlg.h"
  21.  
  22. #ifdef _DEBUG
  23. #define new DEBUG_NEW
  24. #undef THIS_FILE
  25. static char THIS_FILE[] = __FILE__;
  26. #endif
  27.  
  28. /////////////////////////////////////////////////////////////////////////////
  29. // CRemoveBookmarkDlg dialog
  30.  
  31.  
  32. CRemoveBookmarkDlg::CRemoveBookmarkDlg(CWnd* pParent /*=NULL*/)
  33.     : CDialog(CRemoveBookmarkDlg::IDD, pParent)
  34. {
  35.     //{{AFX_DATA_INIT(CRemoveBookmarkDlg)
  36.     //}}AFX_DATA_INIT
  37.    m_nSelBookmark = -1;
  38.    m_pbmkRemove = NULL;
  39.    m_nNumBookmarks = 0;
  40.    m_uWindowTitle = 0;
  41. }
  42.  
  43. void CRemoveBookmarkDlg::DoDataExchange(CDataExchange* pDX)
  44. {
  45.     CDialog::DoDataExchange(pDX);
  46.     //{{AFX_DATA_MAP(CRemoveBookmarkDlg)
  47.     DDX_Control(pDX, IDC_LIST1, m_listBookmarks);
  48.     //}}AFX_DATA_MAP
  49.    if (pDX->m_bSaveAndValidate)
  50.    {
  51.        m_nSelBookmark = m_listBookmarks.GetCurSel();
  52.        if (m_nSelBookmark == LB_ERR)
  53.        {
  54.           AfxMessageBox(IDS_ERR_SELBK2DEL);
  55.           pDX->Fail();
  56.        }
  57.    }
  58. }
  59.  
  60.  
  61. BEGIN_MESSAGE_MAP(CRemoveBookmarkDlg, CDialog)
  62.     //{{AFX_MSG_MAP(CRemoveBookmarkDlg)
  63.     ON_LBN_DBLCLK(IDC_LIST1, OnDblclklist)
  64.     //}}AFX_MSG_MAP
  65. END_MESSAGE_MAP()
  66.  
  67. /////////////////////////////////////////////////////////////////////////////
  68. // CRemoveBookmarkDlg message handlers
  69.  
  70. BOOL CRemoveBookmarkDlg::OnInitDialog() 
  71. {
  72.     CDialog::OnInitDialog();
  73.     
  74.    CString strLine;
  75.     for (int i = 0; i < m_nNumBookmarks; i++)
  76.     {
  77.         if (m_pbmkRemove[i].name == NULL)
  78.             strLine.Format(_T("%d) 0x%x"), i+1, m_pbmkRemove[i].offset);
  79.         else
  80.             strLine.Format(_T("%d) 0x%x:%s"), i+1, m_pbmkRemove[i].offset, m_pbmkRemove[i].name);
  81.       m_listBookmarks.AddString(strLine);
  82.     }
  83.  
  84.    if (m_uWindowTitle)
  85.    {
  86.       strLine.LoadString(m_uWindowTitle);
  87.       SetWindowText(strLine);
  88.    }
  89.     
  90.     return TRUE;  // return TRUE unless you set the focus to a control
  91.                   // EXCEPTION: OCX Property Pages should return FALSE
  92. }
  93.  
  94. void CRemoveBookmarkDlg::OnDblclklist()
  95. {
  96.     OnOK();
  97. }
  98.  
  99. void CRemoveBookmarkDlg::OnOK() 
  100. {
  101.    m_nSelBookmark = m_listBookmarks.GetCurSel();
  102.  
  103.    CDialog::OnOK();
  104. }
  105.