|
|
@@ -31,11 +31,8 @@ void CMainWnd::Init()
|
|
|
//初始化所有页面,先创建页面对象,避免切换页面的时候被释放了
|
|
|
CreatePages();
|
|
|
|
|
|
- //默认选择点单页面
|
|
|
- m_curOptionName = L"main_diandan";
|
|
|
- m_curOption = static_cast<CControlUI*>(m_pm.FindControl(_T("main_diandan")));
|
|
|
-
|
|
|
- this->SwitchPage(DIANDAN);
|
|
|
+ //初始化左侧的功能的导航
|
|
|
+ UpdateGongnengDaohang();
|
|
|
|
|
|
m_pCloseBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("closebtn")));
|
|
|
m_pMaxBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("maxbtn")));
|
|
|
@@ -269,7 +266,10 @@ void CMainWnd::HandleClickMsg(TNotifyUI& msg)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- this->m_curPageUI->HandleClickMsg(msg);
|
|
|
+ if (this->m_curPageUI != NULL)
|
|
|
+ {
|
|
|
+ this->m_curPageUI->HandleClickMsg(msg);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -281,48 +281,10 @@ void CMainWnd::HandleSelectChangeMsg(TNotifyUI& msg)
|
|
|
CDuiString name = msg.pSender->GetName();
|
|
|
std::wstring ws_name = name;
|
|
|
|
|
|
- if (ws_name == _T("main_diandan") || ws_name == _T("main_dingdan") || ws_name == _T("main_huiyuan") || ws_name == _T("main_baobiao") || ws_name == _T("main_jiaoban") || ws_name == _T("main_setting") || ws_name == _T("main_gengduo"))
|
|
|
- {
|
|
|
- if (m_curOptionName != ws_name)
|
|
|
- {
|
|
|
- //表示切换了tab
|
|
|
- m_curOption->SetBkColor(0x00000000);
|
|
|
-
|
|
|
- msg.pSender->SetBkColor(0xFF3CB371);
|
|
|
-
|
|
|
- m_curOptionName = ws_name;
|
|
|
- m_curOption = static_cast<CControlUI*>(msg.pSender);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- //先判断主页面的tab
|
|
|
- if (name == _T("main_diandan"))
|
|
|
- {
|
|
|
- this->SwitchPage(DIANDAN);
|
|
|
- }
|
|
|
- else if(name == _T("main_dingdan"))
|
|
|
- {
|
|
|
- this->SwitchPage(DIANNEIDINGDAN);
|
|
|
- }
|
|
|
- else if (name == L"main_huiyuan")
|
|
|
+ if (ws_name == _T("main_diandan") || ws_name == _T("main_dingdan") || ws_name == _T("main_huiyuan") || ws_name == _T("main_baobiao") || ws_name == _T("main_jiaoban") || ws_name == _T("main_setting") || ws_name == _T("main_gengduo") \
|
|
|
+ || ws_name == _T("main_shangpin") || ws_name == _T("main_kucun") || ws_name == _T("main_caigou") || ws_name == _T("main_zhengcan") || ws_name == _T("main_saomashouyin"))
|
|
|
{
|
|
|
- this->SwitchPage(HUIYUAN);
|
|
|
- }
|
|
|
- else if (name == L"main_baobiao")
|
|
|
- {
|
|
|
- this->SwitchPage(BAOBIAO);
|
|
|
- }
|
|
|
- else if (name == L"main_jiaoban")
|
|
|
- {
|
|
|
- this->SwitchPage(JIAOBAN);
|
|
|
- }
|
|
|
- else if(name == _T("main_setting"))
|
|
|
- {
|
|
|
- this->SwitchPage(SHEZHI);
|
|
|
- }
|
|
|
- else if (name == L"main_gengduo")
|
|
|
- {
|
|
|
- this->SwitchPage(GENGDUO);
|
|
|
+ SwitchPageByName(ws_name);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -998,8 +960,274 @@ void CMainWnd::ShowToast(std::wstring toast_value)
|
|
|
void CMainWnd::UpdateGongnengDaohang()
|
|
|
{
|
|
|
std::string changyongString = CSetting::GetParam("setting_gongneng_changyong_string");
|
|
|
+ std::vector<string> changyongVector;
|
|
|
+ if (changyongString == "")
|
|
|
+ {
|
|
|
+ changyongVector.clear();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ changyongVector = CLewaimaiString::Split(changyongString, ",");
|
|
|
+ }
|
|
|
+
|
|
|
+ //根据数据库保存的模块设置,初始化左侧的模块控件,并处理模块选中
|
|
|
+ CVerticalLayoutUI* layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(L"main_gongneng_daohang_layout"));
|
|
|
+ layout->RemoveAll();
|
|
|
+
|
|
|
+ for (size_t i = 0; i < changyongVector.size(); i++)
|
|
|
+ {
|
|
|
+ COptionUI* newOption = new COptionUI;
|
|
|
+
|
|
|
+ //公共属性
|
|
|
+ newOption->SetGroup(L"main_tab");
|
|
|
+ newOption->SetFixedWidth(101);
|
|
|
+ newOption->SetFixedHeight(102);
|
|
|
+
|
|
|
+ RECT padding;
|
|
|
+ padding.left = 0;
|
|
|
+ padding.top = 60;
|
|
|
+ padding.right = 0;
|
|
|
+ padding.bottom = 0;
|
|
|
+ newOption->SetTextPadding(padding);
|
|
|
+
|
|
|
+ newOption->SetSelectedTextColor(0xFFFFFFFF);
|
|
|
+
|
|
|
+ std::string curName = changyongVector[i];
|
|
|
+
|
|
|
+ //开始设置个性化属性
|
|
|
+ if (curName == "diandan")
|
|
|
+ {
|
|
|
+ newOption->SetName(L"main_diandan");
|
|
|
+ newOption->SetText(L"点单");
|
|
|
+
|
|
|
+ newOption->SetNormalImage(L"file='main_diandan.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ newOption->SetSelectedImage(L"file='main_diandan_select.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ }
|
|
|
+ else if (curName == "dingdan")
|
|
|
+ {
|
|
|
+ newOption->SetName(L"main_dingdan");
|
|
|
+ newOption->SetText(L"订单");
|
|
|
+
|
|
|
+ newOption->SetNormalImage(L"file='main_dingdan.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ newOption->SetSelectedImage(L"file='main_dingdan_select.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ }
|
|
|
+ else if (curName == "huiyuan")
|
|
|
+ {
|
|
|
+ newOption->SetName(L"main_huiyuan");
|
|
|
+ newOption->SetText(L"会员");
|
|
|
+
|
|
|
+ newOption->SetNormalImage(L"file='main_huiyuan.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ newOption->SetSelectedImage(L"file='main_huiyuan_select.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ }
|
|
|
+ else if (curName == "baobiao")
|
|
|
+ {
|
|
|
+ newOption->SetName(L"main_baobiao");
|
|
|
+ newOption->SetText(L"报表");
|
|
|
+
|
|
|
+ newOption->SetNormalImage(L"file='main_baobiao.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ newOption->SetSelectedImage(L"file='main_baobiao_select.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ }
|
|
|
+ else if (curName == "jiaoban")
|
|
|
+ {
|
|
|
+ newOption->SetName(L"main_jiaoban");
|
|
|
+ newOption->SetText(L"交班");
|
|
|
+
|
|
|
+ newOption->SetNormalImage(L"file='main_jiaoban.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ newOption->SetSelectedImage(L"file='main_jiaoban_select.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ }
|
|
|
+ else if (curName == "shezhi")
|
|
|
+ {
|
|
|
+ newOption->SetName(L"main_setting");
|
|
|
+ newOption->SetText(L"设置");
|
|
|
+
|
|
|
+ newOption->SetNormalImage(L"file='main_setting.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ newOption->SetSelectedImage(L"file='main_setting_select.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ }
|
|
|
+ else if (curName == "shangpin")
|
|
|
+ {
|
|
|
+ newOption->SetName(L"main_shangpin");
|
|
|
+ newOption->SetText(L"商品");
|
|
|
+
|
|
|
+ newOption->SetNormalImage(L"file='main_shangpin.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ newOption->SetSelectedImage(L"file='main_shangpin_select.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ }
|
|
|
+ else if (curName == "kucun")
|
|
|
+ {
|
|
|
+ newOption->SetName(L"main_kucun");
|
|
|
+ newOption->SetText(L"库存");
|
|
|
+
|
|
|
+ newOption->SetNormalImage(L"file='main_kucun.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ newOption->SetSelectedImage(L"file='main_kucun_select.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ }
|
|
|
+ else if (curName == "caigou")
|
|
|
+ {
|
|
|
+ newOption->SetName(L"main_caigou");
|
|
|
+ newOption->SetText(L"采购");
|
|
|
+
|
|
|
+ newOption->SetNormalImage(L"file='main_caigou.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ newOption->SetSelectedImage(L"file='main_caigou_select.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ }
|
|
|
+ else if (curName == "zhengcan")
|
|
|
+ {
|
|
|
+ newOption->SetName(L"main_zhengcan");
|
|
|
+ newOption->SetText(L"正餐");
|
|
|
+
|
|
|
+ newOption->SetNormalImage(L"file='main_zhengcan.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ newOption->SetSelectedImage(L"file='main_zhengcan_select.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ }
|
|
|
+ else if (curName == "saomashouyin")
|
|
|
+ {
|
|
|
+ newOption->SetName(L"main_saomashouyin");
|
|
|
+ newOption->SetText(L"收银");
|
|
|
+
|
|
|
+ newOption->SetNormalImage(L"file='main_saomashouyin.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ newOption->SetSelectedImage(L"file='main_saomashouyin_select.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ }
|
|
|
+
|
|
|
+ layout->Add(newOption);
|
|
|
+ }
|
|
|
+
|
|
|
+ //还要加入一个“更多”
|
|
|
+ COptionUI* newOption = new COptionUI;
|
|
|
+
|
|
|
+ //公共属性
|
|
|
+ newOption->SetGroup(L"main_tab");
|
|
|
+ newOption->SetFixedWidth(101);
|
|
|
+ newOption->SetFixedHeight(102);
|
|
|
+
|
|
|
+ RECT padding;
|
|
|
+ padding.left = 0;
|
|
|
+ padding.top = 60;
|
|
|
+ padding.right = 0;
|
|
|
+ padding.bottom = 0;
|
|
|
+ newOption->SetTextPadding(padding);
|
|
|
+
|
|
|
+ newOption->SetSelectedTextColor(0xFFFFFFFF);
|
|
|
+
|
|
|
+ //开始设置个性化属性
|
|
|
+ newOption->SetName(L"main_gengduo");
|
|
|
+ newOption->SetText(L"更多");
|
|
|
+
|
|
|
+ newOption->SetNormalImage(L"file='main_gengduo.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+ newOption->SetSelectedImage(L"file='main_gengduo_select.png' source='0,0,50,50' dest='25,13,75,63'");
|
|
|
+
|
|
|
+ layout->Add(newOption);
|
|
|
+
|
|
|
+ //设置默认选中
|
|
|
+ if (m_curOptionName != L"main_gengduo")
|
|
|
+ {
|
|
|
+ //不是在更多页面调整,那就是初始化的时候,默认选中第一个
|
|
|
+ COptionUI* newOption = static_cast<COptionUI*>(layout->GetItemAt(0));
|
|
|
+
|
|
|
+ m_curOptionName = newOption->GetName();
|
|
|
+ m_curOption = newOption;
|
|
|
+
|
|
|
+ //触发事件切换page
|
|
|
+ newOption->Selected(true, true);
|
|
|
+ newOption->SetBkColor(0xFF3CB371);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //如果已经是更多页面,那么就选中更多,更多肯定是最后一个
|
|
|
+ COptionUI* newOption = static_cast<COptionUI*>(layout->GetItemAt(changyongVector.size()));
|
|
|
+
|
|
|
+ m_curOptionName = newOption->GetName();
|
|
|
+ m_curOption = newOption;
|
|
|
+
|
|
|
+ //已经选中更多,不用触发事件切换page
|
|
|
+ newOption->Selected(true, false);
|
|
|
+ newOption->SetBkColor(0xFF3CB371);
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+//通过页面名字,切换页面,可以给更多页面调用
|
|
|
+void CMainWnd::SwitchPageByName(std::wstring name)
|
|
|
+{
|
|
|
+ if (name == _T("main_diandan"))
|
|
|
+ {
|
|
|
+ this->SwitchPage(DIANDAN);
|
|
|
+ }
|
|
|
+ else if (name == _T("main_dingdan"))
|
|
|
+ {
|
|
|
+ this->SwitchPage(DIANNEIDINGDAN);
|
|
|
+ }
|
|
|
+ else if (name == L"main_huiyuan")
|
|
|
+ {
|
|
|
+ this->SwitchPage(HUIYUAN);
|
|
|
+ }
|
|
|
+ else if (name == L"main_baobiao")
|
|
|
+ {
|
|
|
+ this->SwitchPage(BAOBIAO);
|
|
|
+ }
|
|
|
+ else if (name == L"main_jiaoban")
|
|
|
+ {
|
|
|
+ this->SwitchPage(JIAOBAN);
|
|
|
+ }
|
|
|
+ else if (name == _T("main_setting"))
|
|
|
+ {
|
|
|
+ this->SwitchPage(SHEZHI);
|
|
|
+ }
|
|
|
+ else if (name == L"main_gengduo")
|
|
|
+ {
|
|
|
+ this->SwitchPage(GENGDUO);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //没开通的页面暂时不跳转
|
|
|
+ }
|
|
|
+
|
|
|
+ //处理左侧的高亮与选中状态
|
|
|
+
|
|
|
+ //先判断跳转的页面,是不是常用里面的
|
|
|
+ std::string changyongString = CSetting::GetParam("setting_gongneng_changyong_string");
|
|
|
+ std::vector<string> changyongVector;
|
|
|
+ if (changyongString == "")
|
|
|
+ {
|
|
|
+ changyongVector.clear();
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ changyongVector = CLewaimaiString::Split(changyongString, ",");
|
|
|
+ }
|
|
|
+
|
|
|
+ //把更多也算进去
|
|
|
+ int size = changyongVector.size() + 1;
|
|
|
|
|
|
+ CVerticalLayoutUI* layout = static_cast<CVerticalLayoutUI*>(m_pm.FindControl(L"main_gongneng_daohang_layout"));
|
|
|
|
|
|
+ bool is_found = false;
|
|
|
+ int index = 0;
|
|
|
+
|
|
|
+ for (int i = 0; i < size; i++)
|
|
|
+ {
|
|
|
+ std::wstring curName = layout->GetItemAt(i)->GetName();
|
|
|
+ if (curName == name)
|
|
|
+ {
|
|
|
+ //找到了常用里面的
|
|
|
+ is_found = true;
|
|
|
+ index = i;
|
|
|
+
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (is_found == true)
|
|
|
+ {
|
|
|
+ //新的跳转属于常用操作里面的
|
|
|
+ m_curOption->SetBkColor(0x00000000);
|
|
|
+ layout->GetItemAt(index)->SetBkColor(0xFF3CB371);
|
|
|
+
|
|
|
+ m_curOptionName = name;
|
|
|
+ m_curOption = static_cast<COptionUI*>(layout->GetItemAt(index));
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //新的跳转不属于常用操作里面的
|
|
|
+ m_curOption->SetBkColor(0x00000000);
|
|
|
+
|
|
|
+ m_curOptionName = L"";
|
|
|
+ m_curOption = NULL;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//全局监听键盘输入
|