-
Notifications
You must be signed in to change notification settings - Fork 0
/
Adapter_MessageList.h
61 lines (47 loc) · 1.59 KB
/
Adapter_MessageList.h
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
#ifndef __ADAPTER_MESSAGELIST_H__
#define __ADAPTER_MESSAGELIST_H__
#pragma once
#include <helper/SAdapterBase.h>
#include <vector>
#include "GlobalUnits.h"
struct MessageListItemData
{
int nType; //0文件传输助手,1个人聊天,2多人聊天,3订阅号,4新闻,5公众号
std::string strID;
};
class CAdapter_MessageList : public SAdapterBase
{
public:
struct IListener
{
virtual void MessageListItemClick(int nType, const std::string& strID) = 0;
virtual void MessageListItemRClick(int nType, const std::string& strID) = 0;
};
public:
CAdapter_MessageList(SListView* pOwner, IListener* pListener);
~CAdapter_MessageList(void);
public:
void AddItem(const int& nType, const std::string& strID);
void MoveItemToTop(const std::string& strID);
void EnsureVisable(const std::string& strID);
void SetCurSel(const std::string& strID);
int GetItemIndexByID(const std::string& strID);
void UpdateData(){notifyDataSetChanged();}
protected:
virtual void getView(int position, SWindow* pItem, pugi::xml_node xmlTemplate);\
virtual int getCount();
virtual SStringT getColunName(int iCol) const;
bool OnEventLvSelChangeing(EventLVSelChanging* pEvt);
bool OnEventItemPanelClick(EventArgs* e);
bool OnEventItemPanelRClick(EventArgs* e);
private:
Times stamp_to_standard(int stampTime);
SStringW OperateTimestamp(const std::string& strTimestamp);
private:
std::vector<MessageListItemData*> m_vecItemInfo;
SListView* m_pOwner;
IListener* m_pListener;
MemberFunctionSlot<CAdapter_MessageList, EventArgs> m_evtItemClick;
MemberFunctionSlot<CAdapter_MessageList, EventArgs> m_evtItemRClick;
};
#endif