www.pudn.com > GGBT.rar > CategoryPropertyDlg.cpp
// CategoryPropertyDlg.cpp : implementation file
//
#include "stdafx.h"
#include "testbt.h"
#include "CategoryPropertyDlg.h"
#include "FileBase.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCategoryPropertyDlg dialog
CCategoryPropertyDlg::CCategoryPropertyDlg(CWnd* pParent /*=NULL*/)
: CDialog(CCategoryPropertyDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CCategoryPropertyDlg)
m_strCategoryName = _T("");
m_strCategoryDir = _T("");
m_lDownloadedFiles = 0;
m_lDownloadedSize = 0;
m_lSubCategory = 0;
m_lTotalFiles = 0;
//}}AFX_DATA_INIT
m_bChangeName = false;
}
void CCategoryPropertyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCategoryPropertyDlg)
DDX_Control(pDX, IDC_BUTTON_FOLDER_SEL, m_btnBrowseDir);
DDX_Control(pDX, IDCANCEL, m_btnCancel);
DDX_Control(pDX, IDOK, m_btnOK);
DDX_Text(pDX, IDC_EDIT_CATEGORY_NAME, m_strCategoryName);
DDX_Text(pDX, IDC_EDIT_CATEGORY_DIR, m_strCategoryDir);
DDX_Text(pDX, IDC_EDIT_DOWNLOADED_FILES, m_lDownloadedFiles);
DDX_Text(pDX, IDC_EDIT_DOWNLOADED_SIZE, m_lDownloadedSize);
DDX_Text(pDX, IDC_EDIT_SUB_CATETORY, m_lSubCategory);
DDX_Text(pDX, IDC_EDIT_TOTAL_FILES, m_lTotalFiles);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCategoryPropertyDlg, CDialog)
//{{AFX_MSG_MAP(CCategoryPropertyDlg)
ON_BN_CLICKED(IDC_BUTTON_FOLDER_SEL, OnButtonFolderSel)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCategoryPropertyDlg message handlers
void CCategoryPropertyDlg::OnButtonFolderSel()
{
UpdateData();
CString strFolder;
if (!SelectFolder(m_strCategoryDir, strFolder))
return;
m_strCategoryDir = strFolder;
UpdateData(false);
}
BOOL CCategoryPropertyDlg::OnInitDialog()
{
CDialog::OnInitDialog();
//
// Create BitmapList
//
HBITMAP hbm = (HBITMAP)::LoadImage(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDB_BITMAP_DLG_ICONS),
IMAGE_BITMAP,
0,0, // cx,cy
LR_CREATEDIBSECTION); // | LR_LOADMAP3DCOLORS );
CBitmap bm;
bm.Attach(hbm);
m_ctlImage.Create(16,15, ILC_COLOR8|ILC_MASK, 3, 4);
m_ctlImage.SetBkColor(RGB(255, 255,255));
m_ctlImage.Add(&bm, (COLORREF)RGB(255,0,255));
//
// set button image.
//
// m_btnBrowseDir.Create(m_ctlImage.ExtractIcon(2), true, "Ñ¡Ôñ±£´æÂ·¾¶");
m_btnOK.Create(m_ctlImage.ExtractIcon(0));
m_btnCancel.Create(m_ctlImage.ExtractIcon(1));
// ((CEdit*)GetDlgItem(IDC_EDIT_CATEGORY_NAME))->EnableWindow(m_bChangeName);
((CEdit*)GetDlgItem(IDC_EDIT_CATEGORY_NAME))->SetReadOnly(!m_bChangeName);
int iFocusEditID = m_bChangeName ? IDC_EDIT_CATEGORY_NAME : IDC_EDIT_CATEGORY_DIR;
CEdit* pedit = (CEdit*) GetDlgItem(iFocusEditID);
pedit->SetSel(0, -1);
pedit->SetFocus();
return FALSE;
}