DuiMainFrame.h 5.57 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
#pragma once
#include "BookInfo.h"
#include "CatalogListUI.h"
#include "LabelInfo.h"
#include "DuiShelf.h"
#include "UserDao.h"
#include "LogFile.h"
#include "CalaList.h"
#include "MyReader-DUI-MFC.h"
#include "UIMenu.h"
#include "NetThread.h"
#include "MySettingFrame.h"
#define  EVENT_LOGOUT   9999

#include "UIHeadIcon.h"

#include "NamedPipeServer.h"

namespace DuiLib
{

//////////////////////////////////////////////////////////////////////////
///

class CShelfPage : public CNotifyPump
{
public:
	CShelfPage();
	void SetPaintMagager(CPaintManagerUI* pPaintMgr);

	DUI_DECLARE_MESSAGE_MAP()
	virtual void OnClick(TNotifyUI& msg);
	virtual void OnSelectChanged( TNotifyUI &msg );
	virtual void OnItemClick( TNotifyUI &msg );
private:
	CPaintManagerUI* m_pPaintManager;
};


//////////////////////////////////////////////////////////////////////////
///

class CListPage : public CNotifyPump
{
public:
	CListPage();
	void SetPaintMagager(CPaintManagerUI* pPaintMgr);

	DUI_DECLARE_MESSAGE_MAP()
	virtual void OnClick(TNotifyUI& msg);
	virtual void OnSelectChanged( TNotifyUI &msg );
	virtual void OnItemClick( TNotifyUI &msg );
private:
	CPaintManagerUI* m_pPaintManager;
};

//////////////////////////////////////////////////////////////////////////

	class CDuiMainFrame :public WindowImplBase,public IPipeObserver
	{
	public:
		CDuiMainFrame(CCreateContext * pContext);
		~CDuiMainFrame(void);
		void CDuiMainFrame::OnFinalMessage( HWND hWnd );
		virtual LPCTSTR    GetWindowClassName() const  {   return _T("DuiMainFrame");  }
		virtual DuiLib::CDuiString GetSkinFile()             
		{
			return _T("bookshelf\\mainframe.xml");
		}
		virtual DuiLib::CDuiString GetSkinFolder()             {   return _T("");  }
		virtual CControlUI* CreateControl(LPCTSTR pstrClass);
		virtual void OnSelectChanged( TNotifyUI &msg );
		LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
		virtual LRESULT OnChar(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
		//virtual LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
		void SetSelectedItem(CCatalogListUI* pCatalogControlList,Node* node);
		void OpenBook(CBookInfo* bookInfo);
		void ShowInfoCenter();
		void UpdateBooks(int nIsReloadDB=1);
		void StartShowMessageThread();

		void SetHeadImage();
		DUI_DECLARE_MESSAGE_MAP()
		virtual void Notify(DuiLib::TNotifyUI& msg);
		//CCircleProgressUI* m_process;
		void ModifyBookDownState(int index,Book_State state);
		void CDuiMainFrame::ModifyOptionStatus(bool bflag );

		void AddAllSubject(CHorizontalLayoutUI* h);
		void AddAddHorSubject(CVerticalLayoutUI* v,std::vector<SubjectInfo*> list);

		void AddAddHorSubjectH(CHorizontalLayoutUI* h,std::vector<SubjectInfo*> list);
		void AddOneOptionSubject(CHorizontalLayoutUI* h,SubjectInfo* info);
	public:
		

		CHeadUI * m_cPeopleCenter;
		CTabLayoutUI* m_TabHead;
		void LogOut();
		void UpdateNotice();
		void UpdateSilence();
		virtual LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); 
		int CDuiMainFrame::CustomMessageBox(CString strData,int nType,bool bResult);
		
		CNetThread m_th;

		void UpdateSourceNote();

		void SetManageDisable(bool IsEnable);
	private:
		CCreateContext * m_pContext;
		std::vector<CatalogListItemInfo> catalogs_;
		//CTabLayoutUI * m_TabLayout;
		Node * m_InitSelectedNode;

		//bool SaveUserInfo();
		//void UpdateEditView();
		bool IsGradeOrTermChanged(CUserInfo oldUserInfo, CUserInfo newUserInfo);
		void ClearBooksStatus();
		int GetGradeInfoInIni();
		void UpdateGradeSelectInfoInIni(CString strGradeSelect);
		CString GetGradeSelectInfoInIni();
		int ItemIndexInCatalogList(CString strItem);

		int GetSkinId();

		
		void ResetSourceNote();

		void UpdateListPage(ListBookInfo *pListBookInfos,bool IsAll=true);
		void UpdateListPageTitle(CString grade, CString term, int bookcount);
		void UpdateListPageItem(CListUI *down_list,int index,CBookInfo* info,int leftpadding);

		virtual void InitWindow();
		void ShowGradeInfo();
		void ShowSubjectList();
		std::vector<SubjectInfo*> m_subject_list;
		CString GetSelectGrade();
		CString GetSelectTerm();
		CString GetSelectSubject();
		void SelectBookByGradeAndTerm();
		CCalaList m_cala;
	
		COptionUI* m_pSearchOption;
		CString m_search_key;

		int GetAllSelectBooks();//返回选中书籍的数量

		CBookDal m_bookDal;


	public:
		int m_iCatalogId;
		CDuiShelf* m_pShelf;

		CMySettingFrame* pSettingFrame;
		bool m_bIsShelfBooks;
		void ShowManageButton(bool flag);
		void ShowBookShelfTab();
	private:
		vector<CLabelInfo> m_LabelInfos;
		CDialogBuilder m_dlgBuilder;
		CHorizontalLayoutUI * m_pLables1;
		CHorizontalLayoutUI * m_pLables2;
		CHorizontalLayoutUI * m_pLables3;
		CVerticalLayoutUI * m_pPractise_web;

		void OpenBookSearch();//点击书籍搜索
		void CloseBookSearch();//关闭书籍搜索

		int m_current_show;//进入搜索状态前,记录当前的显示模式  常用或者所有


		
		CShelfPage m_ShelfPage;
	    CListPage m_ListPage;
		int  m_iOpenIndex;
		bool m_bIsBook;
		CDownFrame* m_pMsgBox;
		//埋点用
		BOOL m_bMenuClick;
		int m_iCurrentSkinId;//1代表simple,2代表metal,3代表black
		bool m_bIsInitCatalogList;
		ListBookInfo *m_pListBookInfos;
		CLogFile m_log;
		int m_showType;//显示模式 1缩略图显示 2列表显示
		void OpenOrCloseBookSearch();
		void DoSearchBook();
		void ClearSearch(int type=0);
		void OpenMenu(int type,CBookInfo& info);
		void DoRedirect(CString strURL);
		map<CDuiString,bool>      m_BookMenu;

		int ChangeSelectIndexBySearch();

		int CheckIsSearchResult(ListBookInfo& list,CString text);

		int GetSelectNum();

		void CheckTokenAndTime(int code);
		int m_bookShowTabType;

		CNamedPipeServer		m_PipeServer;

		virtual void OnData(LPCTSTR strData);
		
		
	};
}