⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kingbookdialog.cpp

📁 个人电子图书管理系统.提供电子书的书名和其他信息.检查电子书信息的合法性(E-1) .为这本电子书生成 id.使用分类id
💻 CPP
字号:
// 文件: KingBookDialog.cpp
// 目的: 定义KingBook使用的对话框
// 项目:
// 摘要:
// 时间: 2006-11-8 22:23:29
// D:\KingBook\KingBook\GUI\KingBookDialog.cpp : 实现文件
//

#include "stdafx.h"
#include "KingBook.h"
#include "KingBookDialog.h"



#if BLOCK("CBookInfoBaseDlg")
// CBookInfoBaseDlg 对话框

IMPLEMENT_DYNAMIC(CBookInfoBaseDlg, CPropertyPage)

CBookInfoBaseDlg::CBookInfoBaseDlg(CWnd* pParent /*=NULL*/)
	: CPropertyPage(CBookInfoBaseDlg::IDD)
{

}

CBookInfoBaseDlg::~CBookInfoBaseDlg()
{
}

void CBookInfoBaseDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CBookInfoBaseDlg, CPropertyPage)
END_MESSAGE_MAP()


// CBookInfoBaseDlg 消息处理程序
/// <summary>初始化属性页, 填充图书基本信息</summary>
BOOL CBookInfoBaseDlg::OnInitDialog()
{
    CPropertyPage::OnInitDialog();

    CBookInfoDlg* pInfoDlg = (CBookInfoDlg*)this->GetParent();

    // 设置控件
    GetDlgItem(IDC_EDT_BOOK_NAME)->SetWindowText(pInfoDlg->bookInfo.GetName().c_str());
    GetDlgItem(IDC_EDT_BOOK_AUTHOR)->SetWindowText(pInfoDlg->bookInfo.GetAuthor().c_str());
    GetDlgItem(IDC_EDT_BOOK_BRIEF)->SetWindowText(pInfoDlg->bookInfo.GetBrief().c_str());


    return TRUE;  // return TRUE unless you set the focus to a control
    // 异常: OCX 属性页应返回 FALSE
}

/// <summary>确定修改图书信息</summary>
void CBookInfoBaseDlg::OnOK()
{
    CBookInfoDlg* pInfoDlg = (CBookInfoDlg*)this->GetParent();
    CString strText;
    GetDlgItem(IDC_EDT_BOOK_NAME)->GetWindowText(strText);
    pInfoDlg->bookInfo.SetName(strText.GetBuffer());
    GetDlgItem(IDC_EDT_BOOK_AUTHOR)->GetWindowText(strText);
    pInfoDlg->bookInfo.SetAuthor(strText.GetBuffer());
    GetDlgItem(IDC_EDT_BOOK_BRIEF)->GetWindowText(strText);
    pInfoDlg->bookInfo.SetBrief(strText.GetBuffer());
    

    CPropertyPage::OnOK();
}
#endif // BLOCK("CBookInfoBaseDlg")

#if BLOCK("CBookInfoDetailDlg")
// CBookInfoDetailDlg 对话框

IMPLEMENT_DYNAMIC(CBookInfoDetailDlg, CPropertyPage)

CBookInfoDetailDlg::CBookInfoDetailDlg(CWnd* pParent /*=NULL*/)
	: CPropertyPage(CBookInfoDetailDlg::IDD)
{

}

CBookInfoDetailDlg::~CBookInfoDetailDlg()
{
}

void CBookInfoDetailDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CBookInfoDetailDlg, CDialog)
    ON_BN_CLICKED(IDC_BTN_BOOK_URL, &CBookInfoDetailDlg::OnBnClickedBtnBookUrl)
    ON_BN_CLICKED(IDC_BTN_BOOK_IMAGE, &CBookInfoDetailDlg::OnBnClickedBtnBookImage)
END_MESSAGE_MAP()


// CBookInfoDetailDlg 消息处理程序
/// <summary>初始化属性页, 填充图书的详细信息</summary>
BOOL CBookInfoDetailDlg::OnInitDialog()
{
    CPropertyPage::OnInitDialog();

    CBookInfoDlg* pInfoDlg = (CBookInfoDlg*)this->GetParent();
    GetDlgItem(IDC_EDT_BOOK_URL)->SetWindowText(pInfoDlg->bookInfo.GetURL().c_str());
    GetDlgItem(IDC_EDT_BOOK_PUBLISHER)->SetWindowText(pInfoDlg->bookInfo.GetPublisher().c_str());
    GetDlgItem(IDC_EDT_BOOK_EDITION)->SetWindowText(pInfoDlg->bookInfo.GetEdition().c_str());
    GetDlgItem(IDC_EDT_BOOK_IMAGE)->SetWindowText(pInfoDlg->bookInfo.GetImage().c_str());

    return TRUE;  // return TRUE unless you set the focus to a control
    // 异常: OCX 属性页应返回 FALSE
}

/// <summary>确定修改图书的详细信息</summary>
void CBookInfoDetailDlg::OnOK()
{
    CBookInfoDlg* pInfoDlg = (CBookInfoDlg*)this->GetParent();
    CString strText;
    GetDlgItem(IDC_EDT_BOOK_URL)->GetWindowText(strText);
    pInfoDlg->bookInfo.SetURL(strText.GetBuffer());
    GetDlgItem(IDC_EDT_BOOK_PUBLISHER)->GetWindowText(strText);
    pInfoDlg->bookInfo.SetPublisher(strText.GetBuffer());
    GetDlgItem(IDC_EDT_BOOK_EDITION)->GetWindowText(strText);
    pInfoDlg->bookInfo.SetEdition(strText.GetBuffer());
    GetDlgItem(IDC_EDT_BOOK_IMAGE)->GetWindowText(strText);
    pInfoDlg->bookInfo.SetImage(strText.GetBuffer());

    CPropertyPage::OnOK();
}

/// <summary>选择路径</summary>
void CBookInfoDetailDlg::OnBnClickedBtnBookUrl()
{
    CFileDialog fileDlg(TRUE, NULL, NULL);
    if(fileDlg.DoModal() == IDOK) // 选中一个文件
    {        
        GetDlgItem(IDC_EDT_BOOK_URL)->SetWindowText(fileDlg.GetPathName());
    }
}

/// <summary>选择封面</summary>
void CBookInfoDetailDlg::OnBnClickedBtnBookImage()
{
    const TCHAR szFilter[] = _T("图片文件(*.bmp;*.gif;*.jpg;*,jpeg;*.png;)|*.bmp;*.gif;*.jpg;*,jpeg;*.png;||"); 
    CFileDialog fileDlg(TRUE, NULL, NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, szFilter);
    if(fileDlg.DoModal() == IDOK) // 选中一个文件
    {        
        GetDlgItem(IDC_EDT_BOOK_IMAGE)->SetWindowText(fileDlg.GetPathName());
    }
    
}
#endif // BLOCK("CBookInfoDetailDlg")

#if BLOCK("CBookInfoDescDlg")
IMPLEMENT_DYNAMIC(CBookInfoDescDlg, CPropertyPage)

CBookInfoDescDlg::CBookInfoDescDlg()
	: CPropertyPage(CBookInfoDescDlg::IDD)
{

}

CBookInfoDescDlg::~CBookInfoDescDlg()
{
}

void CBookInfoDescDlg::DoDataExchange(CDataExchange* pDX)
{
	CPropertyPage::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CBookInfoDescDlg, CPropertyPage)
END_MESSAGE_MAP()


// CBookInfoDescDlg 消息处理程序
/// <summary>初始化属性页, 填充图书的描述</summary>
BOOL CBookInfoDescDlg::OnInitDialog()
{
    CPropertyPage::OnInitDialog();

    // TODO:  在此添加额外的初始化
    CBookInfoDlg* pInfoDlg = (CBookInfoDlg*)this->GetParent();
    GetDlgItem(IDC_EDT_BOOK_DESC)->SetWindowText(pInfoDlg->bookInfo.GetDescription().c_str());

    return TRUE;  // return TRUE unless you set the focus to a control
    // 异常: OCX 属性页应返回 FALSE
}

/// <summary>确定修改图书的描述</summary>
void CBookInfoDescDlg::OnOK()
{
    CBookInfoDlg* pInfoDlg = (CBookInfoDlg*)this->GetParent();
    CString strText;
    GetDlgItem(IDC_EDT_BOOK_DESC)->GetWindowText(strText);
    pInfoDlg->bookInfo.SetDescription(strText.GetBuffer());
    

    CPropertyPage::OnOK();
}
#endif // BLOCK("CBookInfoDescDlg")

#if BLOCK("CBookInfoDlg")

IMPLEMENT_DYNAMIC(CBookInfoDlg, CPropertySheet)

CBookInfoDlg::CBookInfoDlg(UINT nIDCaption, const Library::Book& bookInfo, CWnd* pParentWnd, UINT iSelectPage)
	:CPropertySheet(nIDCaption, pParentWnd, iSelectPage)
{
    this->bookInfo = bookInfo;
    this->AddPage(&(this->infoBase));
    this->AddPage(&(this->infoDetail));
    this->AddPage(&(this->infoDesc));
}

CBookInfoDlg::CBookInfoDlg(LPCTSTR pszCaption, const Library::Book& bookInfo, CWnd* pParentWnd, UINT iSelectPage)
	:CPropertySheet(pszCaption, pParentWnd, iSelectPage)
{
    this->bookInfo = bookInfo;
    this->AddPage(&(this->infoBase));
    this->AddPage(&(this->infoDetail));
    this->AddPage(&(this->infoDesc));
}

CBookInfoDlg::~CBookInfoDlg()
{
}


BEGIN_MESSAGE_MAP(CBookInfoDlg, CPropertySheet)
END_MESSAGE_MAP()


// CBookInfoDlg 消息处理程序
#endif // BLOCK("CBookInfoDlg") 

#if BLOCK("CBookClassInfoDLg")

// CBookClassInfoDLg 对话框

IMPLEMENT_DYNAMIC(CBookClassInfoDLg, CDialog)

CBookClassInfoDLg::CBookClassInfoDLg(LPCTSTR pszCaption, const Library::BookClass& r_bookClassInfo, CWnd* pParent /*=NULL*/)
	: CDialog(CBookClassInfoDLg::IDD, pParent),
    bookClassInfo(r_bookClassInfo)
{
    this->m_Cpation = pszCaption;
}

CBookClassInfoDLg::~CBookClassInfoDLg()
{
}

void CBookClassInfoDLg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CBookClassInfoDLg, CDialog)
END_MESSAGE_MAP()


// CBookClassInfoDLg 消息处理程序
/// <summary>初始化对话框, 并填充信息</summary>
BOOL CBookClassInfoDLg::OnInitDialog()
{
    CDialog::OnInitDialog();

    this->SetWindowText(this->m_Cpation);

    GetDlgItem(IDC_EDT_BOOKCLASS_NAME)->SetWindowText(this->bookClassInfo.GetName().c_str());
    GetDlgItem(IDC_EDT_BOOKCLASS_DESC)->SetWindowText(this->bookClassInfo.GetDescription().c_str());

    return TRUE;  // return TRUE unless you set the focus to a control
    // 异常: OCX 属性页应返回 FALSE
}

/// <summary>确定 分类的信息</summary>
void CBookClassInfoDLg::OnOK()
{
    CString strText;
    GetDlgItem(IDC_EDT_BOOKCLASS_NAME)->GetWindowText(strText);
    this->bookClassInfo.SetName(strText.GetBuffer());
    GetDlgItem(IDC_EDT_BOOKCLASS_DESC)->GetWindowText(strText);
    this->bookClassInfo.SetDescription(strText.GetBuffer());

    CDialog::OnOK();
}
#endif// BLOCK("CBookClassInfoDLg")


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -