// DlgStoreInfoM.cpp : implementation file
//
#include "stdafx.h"
#include "bbb.h"
#include "DlgStoreInfoM.h"
#include "DlgBookAdjust2.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgStoreInfoM dialog
CDlgStoreInfoM::CDlgStoreInfoM(CWnd* pParent /*=NULL*/)
: CDialog(CDlgStoreInfoM::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgStoreInfoM)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
nSelect = -1;
}
CDlgStoreInfoM::CDlgStoreInfoM(int iSelect, CWnd* pParent /*=NULL*/)
: CDialog(CDlgStoreInfoM::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgStoreInfoM)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
nSelect = iSelect;
}
void CDlgStoreInfoM::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgStoreInfoM)
DDX_Control(pDX, IDC_TAB1, m_tab);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgStoreInfoM, CDialog)
//{{AFX_MSG_MAP(CDlgStoreInfoM)
ON_COMMAND(IDC_MODIFY, OnModify)
ON_COMMAND(IDC_QUERY, OnQuery)
ON_COMMAND(IDC_ADD, OnAdd)
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()
/////////////////////////////////////////////////////////////////////////////
// CDlgStoreInfoM message handlers
BOOL CDlgStoreInfoM::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_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, 3);
// 设置每个工具按钮文字
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_SHUTDOWN, TBSTYLE_BUTTON , 2);
m_wndToolBar.SetButtonText(2, "退出");
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_BOOK_INPUT2);
m_tab.AddPage("图书定价", &m_dlg2, IDD_BOOK_PRICE2);
m_tab.AddPage("图书调价", &m_dlg3, IDD_BOOK_ADJUST_PRICE2);
m_tab.AddPage("入库退货", &m_dlg4, IDD_INPUT_BACK2);
m_tab.AddPage("图书调拨", &m_dlg5, IDD_BOOK_ADJUST2);
m_tab.AddPage("图书销售", &m_dlg6, IDD_BOOK_SALE2);
m_tab.AddPage("销售退货", &m_dlg7, IDD_SALE_BACK2);
if (nSelect >= 0)
{
m_tab.Show(nSelect);
}
else
{
m_tab.Show();
}
return TRUE;
}
void CDlgStoreInfoM::OnAdd()
{
int cur = m_tab.GetCurSel();
switch (cur)
{
case 0:
{
m_dlg1.AddOperator();
break;
}
case 1:
{
m_dlg2.BookFixPrice();
break;
}
case 2:
{
m_dlg3.BookAdjustPrice();
break;
}
case 3:
{
m_dlg4.AddOperate();
break;
}
case 4:
{
m_dlg5.AddOperate();
break;
}
case 5:
{
m_dlg6.AddOperate();
break;
}
case 6:
{
m_dlg7.AddOperate();
break;
}
}
}
void CDlgStoreInfoM::OnModify()
{
int cur = m_tab.GetCurSel();
switch (cur)
{
case 0:
{
m_dlg1.InputCancel();
break;
}
case 1:
{
m_dlg2.CancelOperate();
break;
}
case 2:
{
m_dlg3.CancelOperate();
break;
}
case 3:
{
m_dlg4.InputCancel();
break;
}
case 4:
{
m_dlg5.CancelOperate();
break;
}
case 5:
{
m_dlg6.CancelOperate();
break;
}
case 6:
{
m_dlg7.CancelOperate();
break;
}
}
}
void CDlgStoreInfoM::OnQuery()
{
}
void CDlgStoreInfoM::OnDel()
{
}
void CDlgStoreInfoM::OnFirst()
{
}
void CDlgStoreInfoM::OnBefore()
{
}
void CDlgStoreInfoM::OnAfter()
{
}
void CDlgStoreInfoM::OnEnd()
{
}
void CDlgStoreInfoM::OnShut()
{
m_tab.DestroyWindow();
CDlgStoreInfoM::OnCancel();
}