OSDN Git Service

2012/01/20 17:02:52
[nlite/nlite.git] / nlite / nlite_commentview.h
1 #pragma once
2
3 namespace nlite{
4
5         namespace commentViewConstant{
6                 const static LPCTSTR  NLITE_COMMENTVIEW = TEXT("NLITE_COMMENTVIEW");
7
8                 const static LPCTSTR NLITE_COMMENTLISTBASE = TEXT("NLITE_COMMENTLISTBASE");
9
10                 const static LPCTSTR NLITE_COMMENTLISTWINDOW = TEXT("NLITE_COMMENTLISTWINDOW");
11
12                 const static UINT_PTR HEADER_HAIGHT = 20;
13
14                 const static UINT_PTR HEADER_ID = 257;
15
16                 const static UINT_PTR LISTBOX_ID = 258;
17
18                 const static UINT_PTR MENU_OR_ID = 256;
19         }
20
21         class CCommentView;
22         //\83R\83\81\83\93\83g\95\\8e¦\97p\83E\83B\83\93\83h\83E
23         class CCommentListWindow:public CWindowImpl<CCommentListWindow>,public CComAutoCriticalSection{
24
25                 friend CCommentView;
26                 //\83\81\83\93\83o
27         private:
28                 CCommentView &self;
29                 
30                 struct ColorList{
31                         enum type{
32                                 selectBack = RGB(255,240,240),
33                                 outLineSelect = RGB(255,0,0),
34                                 outLineNomal = RGB(0,0,0),
35                                 colLine = RGB(224,224,224)
36                         };
37                 };
38
39         public:
40
41                 DECLARE_WND_CLASS(commentViewConstant::NLITE_COMMENTLISTWINDOW)
42
43
44                 //
45                 //\83\81\83b\83Z\81[\83W\83}\83b\83v
46                 //
47                 BEGIN_MSG_MAP(CCommentListWindow)
48                         MSG_WM_LBUTTONDBLCLK(OnLButtonDbClk)
49                         MSG_WM_LBUTTONDOWN(OnLButtonDown)
50                         MSG_WM_CREATE(OnCreate)
51                         MSG_WM_ERASEBKGND(OnEraseBkGnd)
52                         MSG_WM_MOUSEWHEEL(OnMouseWheel)
53                         MSG_WM_PAINT(OnPaint)
54                         MSG_WM_SIZE(OnSize)
55                 END_MSG_MAP()
56
57
58
59         public:
60
61                 ///
62                 ///\83R\83\93\83X\83g\83\89\83N\83^
63                 ///
64                 CCommentListWindow(CCommentView &self_in);
65
66                 ///
67                 ///\83f\83X\83g\83\89\83N\83^
68                 ///
69                 ~CCommentListWindow();
70
71
72                 ///
73                 ///\83X\83N\83\8d\81[\83\8b\83y\81[\83W\8cv\8eZ
74                 ///
75                 UINT_PTR CalcScrollPage();
76
77                 ///
78                 ///\8ds\82Ì\8d\82\82³\82ð\96â\82¢\8d\87\82í\82¹
79                 ///
80                 UINT_PTR CalcItemHeight(CChatData &chatData);
81                 
82
83                 //\83v\83\89\83C\83x\81[\83g\8aÖ\90\94
84         private:
85
86                 ///
87                 ///\83A\83C\83e\83\80\95`\89æ
88                 ///
89                 VOID DrawItem(CDC &dc,RECT &rc,CChatData &chatData);
90
91
92                 
93
94                 ///
95                 ///\83N\83\8a\83b\83N\82µ\82½\8ds\82ð\8cv\8eZ
96                 ///
97                 INT_PTR CalcClickLine(INT_PTR height);
98
99                 //\83\81\83b\83Z\81[\83W\83n\83\93\83h\83\89
100         private:
101                 
102                 ///
103                 ///\83E\83B\83\93\83h\83E\8dì\90¬\8e\9e\82Ì\8f\88\97\9d
104                 ///
105                 LRESULT OnCreate(LPCREATESTRUCT lpCreateStruct);
106
107                 ///
108                 ///\83}\83E\83X\83N\83\8a\83b\83N\8e\9e\82Ì\8f\88\97\9d
109                 ///
110                 VOID OnLButtonDown(UINT wParam, _WTYPES_NS::CPoint &point);
111
112                 ///
113                 ///\95`\89æ\8f\88\97\9d
114                 ///
115                 VOID OnPaint(HDC hdc);
116
117
118                 ///
119                 ///\83T\83C\83Y\95Ï\8dX
120                 ///
121                 VOID OnSize(UINT wParam, _WTYPES_NS::CSize &windowSize);
122
123                 ///
124                 ///\83}\83E\83X\83_\83u\83\8b\83N\83\8a\83b\83N\8e\9e\82Ì\8f\88\97\9d
125                 ///
126                 VOID OnLButtonDbClk(UINT wParam, _WTYPES_NS::CPoint &point);
127
128                 ///
129                 ///\94w\8ci\93h\82è\82Â\82Ô\82µ
130                 ///
131                 LRESULT OnEraseBkGnd(HDC lparam);
132
133                 ///
134                 ///\83}\83E\83X\83z\83C\81[\83\8b
135                 ///
136                 LRESULT OnMouseWheel(UINT loWparam,SHORT hiWparam,CPoint &point);
137                 
138         };
139         
140         class CCommentView:public CWindowImpl<CCommentView>{
141
142                 friend CCommentListWindow;
143                 //\83v\83\89\83C\83x\81[\83g\8c^\81E\83N\83\89\83X\92è\8b`
144         private:
145
146                 typedef struct{
147
148                         LPTSTR *columns;
149                         UINT_PTR *holizensize;
150                         UINT_PTR count;
151
152                 }HEADERSINFO,*LPHEADERSINFO;
153
154                 
155                 
156
157                 
158
159                 //\83\81\83\93\83o\90é\8c¾
160         private:
161
162                 CHeaderCtrl m_header;
163                 CCommentListWindow  m_commentListWindow;
164                 
165                 CStreamStatus streamStatus;
166                 CCommentList commentlist;
167                 CommentViewProperty viewproperty;
168 //              INT_PTR viewStartHeight;
169                 HFONT hHeaderFontNew;
170
171                 
172
173
174                 
175                 
176
177                 
178         public:
179
180                 enum{
181                         NO,
182                         USERNAME,
183                         COMMENT,
184                         TIME,
185                         INFO
186
187                 };
188                 
189                 ///
190                 ///\83R\83\93\83X\83g\83\89\83N\83^
191                 ///
192                 CCommentView();
193                 
194                 ///
195                 ///\83f\83X\83g\83\89\83N\83^
196                 ///
197                 ~CCommentView();
198
199                 
200
201                 //
202                 //\83E\83B\83\93\83h\83E\83N\83\89\83X\90é\8c¾
203                 //
204                 DECLARE_WND_CLASS_EX(commentViewConstant::NLITE_COMMENTVIEW,0,COLOR_BACKGROUND)
205                 
206                 //
207                 //\83\81\83b\83Z\81[\83W\83}\83b\83v
208                 //
209                 BEGIN_MSG_MAP(CCommentView)
210                         MSG_WM_CREATE(OnCreate)
211                         MSG_WM_DESTROY(OnDestroy)                       
212                         MSG_WM_SIZE(OnSize)
213                         MSG_WM_HSCROLL(OnHScroll)
214                         MSG_WM_VSCROLL(OnVScroll)
215                         MSG_WM_ERASEBKGND(OnEraseBkgnd)
216                         NOTIFY_CODE_HANDLER_EX(HDN_ENDTRACK   ,OnHeaderEndTrack)
217                         NOTIFY_CODE_HANDLER_EX(HDN_ENDDRAG ,OnHeaderEndDrag)
218                 END_MSG_MAP()
219
220                 ///
221                 ///\83v\83\8d\83p\83e\83B\90Ý\92è
222                 ///
223                 VOID SetProperty(CommentViewProperty &setProperty);
224
225                 ///
226                 ///\83v\83\8d\83p\83e\83B\8eæ\93¾
227                 ///
228                 CommentViewProperty &GetProperty();
229                 
230                 ///
231                 ///\83E\83B\83\93\83h\83E\8dì\90¬
232                 ///
233                 HWND Create(HWND hWndParent);
234
235                 ///
236                 ///\83w\83b\83_\82Ì\89¡\95\9d\8eæ\93¾
237                 ///
238                 UINT_PTR GetColumnHolSizeSum();
239
240                 ///
241                 ///\83j\83R\90\82É\90Ú\91±\8e\9e\82Ì\8f\88\97\9d
242                 ///
243                 VOID OnConnect();
244
245                 ///
246                 ///\83j\83R\90\82Ì\83X\83e\81[\83^\83X\90Ý\92è
247                 ///
248                 VOID SetStreamStatus(StreamStatus &st);
249
250                 ///
251                 ///\83`\83\83\83b\83g\83R\83\81\83\93\83g\8eó\90M\8e\9e\82Ì\8f\88\97\9d
252                 ///
253                 VOID OnChatReceve(NicoLiveChat_P chat,UINT_PTR count);
254
255                 ///
256                 ///\83`\83\83\83b\83g\83R\83\81\83\93\83g\8eó\90M\8am\92è\8f\88\97\9d
257                 ///
258                 VOID OnChatReceveSettle(UINT_PTR commentCount,UINT_PTR commentCountSum);
259                 
260
261
262                 //\83v\83\89\83C\83x\81[\83g\8aÖ\90\94
263         private:
264
265
266                 ///
267                 ///\83w\83b\83_\92Ç\89Á
268                 ///
269                 VOID AddHeader(LPHEADERSINFO infos);
270                 
271                 ///
272                 ///\83w\83b\83_\82Ì\89¡\95\9d\8c\88\92è
273                 ///
274                 VOID DecisionHorzSize();
275
276
277                 ///
278                 ///\83T\83C\83Y\95Ï\8dX\8f\88\97\9d
279                 ///
280                 VOID ChangeSize(const SIZE& client);
281
282                 //\83E\83B\83\93\83h\83E\83\81\83b\83Z\81[\83W\83n\83\93\83h\83\89
283         private:
284
285                 
286
287                 ///
288                 ///\83T\83C\83Y\95Ï\8dX\8cã\8f\88\97\9d
289                 ///
290                 LRESULT OnSize(UINT wParam,SIZE lParam);
291
292                 
293                 
294
295                 ///
296                 ///\94w\8ci\93h\82è\82Â\82Ô\82µ\8f\88\97\9d
297                 ///
298                 LRESULT OnEraseBkgnd(HDC wParam);
299                 
300                 ///
301                 ///\83E\83B\83\93\83h\83E\94j\8aü\8e\9e\82Ì\8f\88\97\9d
302                 ///
303                 VOID OnDestroy();
304                 
305                 ///
306                 ///\83w\83b\83_\83A\83C\83e\83\80\95Ï\8dX\8e\9e\8f\88\97\9d
307                 ///
308                 LRESULT OnHeaderEndTrack(LPNMHDR lParam);
309
310
311                 ///
312                 ///\83w\83b\83_\83h\83\89\83b\83O\8cã\8f\88\97\9d
313                 ///
314                 LRESULT OnHeaderEndDrag(LPNMHDR lParam);
315
316
317                 ///
318                 ///\89¡\83X\83N\83\8d\81[\83\8b\8e\9e\82Ì\8f\88\97\9d
319                 ///
320                 VOID OnHScroll(INT_PTR loWParam,SHORT hiWParam,HWND lParam);
321                 
322                 ///
323                 ///\8fc\83X\83N\83\8d\81[\83\8b\8e\9e\82Ì\8f\88\97\9d
324                 ///
325                 VOID OnVScroll(INT_PTR loWParam,SHORT hiWParam,HWND lParam);
326
327                 ///
328                 ///\8dì\90¬\8e\9e\82Ì\8f\88\97\9d
329                 ///
330                 LRESULT OnCreate(LPCREATESTRUCT lpcs);
331                 
332                 
333                 
334                 
335                 
336
337
338         };
339         
340 }