// DlgBaseInfoM.cpp : implementation file
//
#include "stdafx.h"
#include "bbb.h"
#include "DlgBaseInfoM.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgBaseInfoM dialog
CDlgBaseInfoM::CDlgBaseInfoM(CWnd* pParent /*=NULL*/)
: CDialog(CDlgBaseInfoM::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgBaseInfoM)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
nSelect = -1;
}
CDlgBaseInfoM::CDlgBaseInfoM(int iSelect, CWnd* pParent /*=NULL*/)
: CDialog(CDlgBaseInfoM::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgBaseInfoM)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
nSelect = iSelect;
}
void CDlgBaseInfoM::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgBaseInfoM)
DDX_Control(pDX, IDC_TAB1, m_tab);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgBaseInfoM, CDialog)
//{{AFX_MSG_MAP(CDlgBaseInfoM)
ON_COMMAND(IDC_ADD, OnAdd)
ON_COMMAND(IDC_MODIFY, OnModify)
ON_COMMAND(IDC_QUERY, OnQuery)
ON_COMMAND(IDC_DEL, OnDel)
ON_COMMAND(IDC_FIRST, OnFirst)
ON_COMMAND(IDC_BEFORE, OnBefore)
ON_COMMAND(IDC_AFTER, OnAfter)
ON_COMMAND(IDC_END, OnEnd)
ON_COMMAND(IDC_SHUTDOWN, OnShut)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgBaseInfoM message handlers
BOOL CDlgBaseInfoM::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_TOOLTIPS |CBRS_FLYBY | CBRS_SIZE_DYNAMIC))
{
return FALSE;
}
if(!m_wndReBar.Create(this,TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP|RBS_VERTICALGRIPPER
| CBRS_TOOLTIPS | CBRS_FLYBY| CBRS_SIZE_DYNAMIC))
{
return FALSE;
}
m_wndToolBar.GetToolBarCtrl().SetButtonWidth(40, 80); //设置按钮的宽度和长度
CImageList img;
//设置图标
img.Create(22, 22, ILC_COLOR24|ILC_MASK,2,2);
img.SetBkColor(::GetSysColor(COLOR_BTNFACE));
img.Add(AfxGetApp()->LoadIcon(IDI_ICON11)); //0
img.Add(AfxGetApp()->LoadIcon(IDI_ICON12)); //1
img.Add(AfxGetApp()->LoadIcon(IDI_ICON15)); //4
img.Add(AfxGetApp()->LoadIcon(IDI_ICON19)); //8
m_wndToolBar.GetToolBarCtrl().SetImageList(&img);
img.Detach();
m_wndToolBar.ModifyStyle(0, TBSTYLE_FLAT |CBRS_TOOLTIPS | TBSTYLE_TRANSPARENT|TBBS_CHECKBOX);
m_wndToolBar.SetButtons(NULL, 4); //共九个按钮
// 设置每个工具按钮文字
m_wndToolBar.SetButtonInfo(0, IDC_ADD, TBSTYLE_BUTTON, 0);
m_wndToolBar.SetButtonText(0, "增加");
m_wndToolBar.SetButtonInfo(1, IDC_MODIFY, TBSTYLE_BUTTON , 1);
m_wndToolBar.SetButtonText(1, "修改");
m_wndToolBar.SetButtonInfo(2, IDC_DEL, TBSTYLE_BUTTON, 2);
m_wndToolBar.SetButtonText(2, "删除");
m_wndToolBar.SetButtonInfo(3, IDC_SHUTDOWN, TBSTYLE_BUTTON , 3);
m_wndToolBar.SetButtonText(3, "退出");
CRect rectToolBar;
m_wndToolBar.GetItemRect(0, &rectToolBar); //得到按钮的大小
rectToolBar.right = 55;
rectToolBar.bottom= 42;
m_wndToolBar.SetSizes(rectToolBar.Size(), CSize(20,20)); //设置按钮的大小
//在Rebar中加入ToolBar
m_wndReBar.AddBar(&m_wndToolBar);
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
m_tab.AddPage("操作员", &m_dlg1, IDD_OPERATOR1);
m_tab.AddPage("图书信息", &m_dlg2, IDD_BOOK_INFO1);
m_tab.AddPage("供应商信息", &m_dlg3, IDD_PROVIDER_INFO1);
m_tab.AddPage("图书种类", &m_dlg4, IDD_BOOK_KINDS1);
m_tab.AddPage("仓库信息", &m_dlg5, IDD_STORE_INFO1);
m_tab.AddPage("柜台信息", &m_dlg6, IDD_DESK_INOF1);
if (nSelect >= 0)
{
m_tab.Show(nSelect);
}
else
{
m_tab.Show();
}
return TRUE; // return TRUE unless you set the focus to a control
}
void CDlgBaseInfoM::OnAdd()
{
int cur = m_tab.GetCurSel();
switch (cur)
{
case 0:
{
m_dlg1.AddOperator() ;
break;
}
case 1:
{
m_dlg2.AddBookInfo();
break;
}
case 2:
{
m_dlg3.AddProvider();
break;
}
case 3:
{
m_dlg4.AddBookKind();
break;
}
case 4:
{
m_dlg5.AddStorageInfo();
break;
}
case 5:
{
m_dlg6.AddCounterInfo();
break;
}
}
}
void CDlgBaseInfoM::OnModify()
{
int cur = m_tab.GetCurSel();
switch (cur)
{
case 0:
{
m_dlg1.UpdateOperator();
break;
}
case 1:
{
m_dlg2.UpdateBookInfo();
break;
}
case 2:
{
m_dlg3.UpdateProvider();
break;
}
case 3:
{
m_dlg4.UpdateBookKind();
break;
}
case 4:
{
m_dlg5.UpdateStorageInfo();
break;
}
case 5:
{
m_dlg6.UpdateCounterInfo();
break;
}
}
}
void CDlgBaseInfoM::OnQuery()
{
}
void CDlgBaseInfoM::OnDel()
{
int cur = m_tab.GetCurSel();
switch (cur)
{
case 0:
{
m_dlg1.DeleteOperator();
break;
}
case 1:
{
m_dlg2.DeleteBookInfo();
break;
}
case 2:
{
m_dlg3.DeleteProvider();
break;
}
case 3:
{
m_dlg4.DeleteBookKind();
break;
}
case 4:
{
m_dlg5.DeleteStorageInfo();
break;
}
case 5:
{
m_dlg6.DeleteCounterInfo();
break;
}
}
}
void CDlgBaseInfoM::OnFirst()
{
}
void CDlgBaseInfoM::OnBefore()
{
}
void CDlgBaseInfoM::OnAfter()
{
}
void CDlgBaseInfoM::OnEnd()
{
}
void CDlgBaseInfoM::OnShut()
{
m_tab.DestroyWindow();
CDlgBaseInfoM::OnCancel();
}