OSDN Git Service

余分なメンバを削除
[nlite/nlite.git] / nlite / nlite_commentview.h
1 #pragma once
2
3 namespace nlite{
4
5         class CCommentView;
6         class CCommentListWindow;
7         class CChatChildCtrlsList;
8
9         //\92è\90\94\97p\82Ì\96¼\91O\8bó\8aÔ
10         namespace commentViewConstant{
11
12                 //\83R\83\81\83\93\83g\83r\83\85\81[\83E\83B\83\93\83h\83E\96¼
13                 const static LPCTSTR  NLITE_COMMENTVIEW = TEXT("NLITE_COMMENTVIEW");
14
15                 //\83R\83\81\83\93\83g\83\8a\83X\83g\83E\83B\83\93\83h\83E\96¼
16                 const static LPCTSTR NLITE_COMMENTLISTWINDOW = TEXT("NLITE_COMMENTLISTWINDOW");
17
18                 //\83w\83b\83_\81[\82Ì\8d\82\82³
19                 const static UINT_PTR HEADER_HAIGHT = 20;
20
21                 //\83w\83b\83_\81[\83R\83\93\83g\83\8d\81[\83\8bID
22                 const static UINT_PTR HEADER_ID = 257;
23
24                 //\83R\83\81\83\93\83g\83\8a\83X\83g\83E\83B\83\93\83h\83EID
25                 const static UINT_PTR LISTWINDOW = 258;
26
27                 //baseWindowID
28                 const static UINT_PTR MENU_OR_ID = 256;
29         }
30
31         class CChatReadEdit :public CWindowImpl<CChatReadEdit,CRichEditCtrl>{
32
33                 BEGIN_MSG_MAP(CChatReadEdit)
34
35                 END_MSG_MAP()
36
37                 BOOL SetWindowText(LPCTSTR str);
38
39                 HWND GeneralCreate(HWND hParent,DWORD eventMask,UINT id);
40         };
41
42         class CChatChildCtrls{
43                 friend CCommentListWindow;
44                 friend CChatChildCtrlsList;
45         private:
46                 CChatReadEdit chatDispCtrl;
47                 CHyperLink noDispCtrl;
48                 CHyperLink userNameDispCtrl;
49                 CCommentView &m_master;
50                 
51
52         public:
53
54                 enum {
55                         NO_DIOSCTRL_ID = 10000000,
56                         USERNAME_DISPCTRL_ID = 20000000,
57                         CHAT_DISPCTRL_ID = 30000000
58
59                 };
60                 
61                 ///
62                 ///\83R\83\93\83X\83g\83\89\83N\83^
63                 ///
64                 CChatChildCtrls(CCommentView &hMaster);
65                 
66                 ///
67                 ///\8ew\92è\82µ\82½\8d\82\82³\82É\83R\83\93\83g\83\8d\81[\83\8b\82ð\83Z\83b\83g
68                 ///
69                 VOID SetCtrl(const RECT &rc,CCommentList::reference commen,BOOL mulutiLineFlag);
70
71                 VOID AdjustRect(RECT &rc);
72
73                 VOID Hide();
74
75                 VOID Create();
76
77                 ///
78                 ///\83R\83\93\83g\83\8d\81[\83\8b\82Ì\8cÂ\90\94\82ð\8eæ\93¾
79                 ///
80                 static UINT_PTR GetCtrlCount();
81
82
83
84         };
85
86
87         class CChatChildCtrlsList{
88                 friend CCommentView;
89                 friend CCommentListWindow;
90                 friend CChatChildCtrls;
91                 
92         private:
93                 typedef std::list<CChatChildCtrls> InternalList;
94
95                 InternalList m_list;
96                 CCommentView &m_hMaster;
97                 RECT rcBuf;
98
99
100         public:
101                 typedef InternalList::reference reference;
102                 typedef InternalList::iterator iterator;
103                 
104                 ///
105                 ///\83R\83\93\83X\83g\83\89\83N\83^
106                 ///
107                 CChatChildCtrlsList(CCommentView &hMaster);
108
109         
110
111                 ///
112                 ///\83R\83\93\83g\83\8d\81[\83\8b\82ð\95\\8e¦
113                 ///
114                 VOID ShowCntrls();
115
116                 ///
117                 ///\94ñ\95\\8e¦\8f\88\97\9d
118                 ///
119                 VOID AllHide();
120
121         private:
122
123                 ///
124                 ///\8ag\92£\8f\88\97\9d
125                 ///
126                 iterator Extend();
127
128
129         };
130
131         
132         //\83R\83\81\83\93\83g\95\\8e¦\97p\83E\83B\83\93\83h\83E
133         class CCommentListWindow:public CWindowImpl<CCommentListWindow>,public CComAutoCriticalSection{
134
135                 friend CCommentView;
136                 
137                 
138                 //\83\81\83\93\83o
139         private:
140                 CCommentView &self;
141                 MSG umsg;
142 //              CChatReadEdit calcEdit;
143 //              RECT calcRc;
144 //              CComAutoCriticalSection calcCcs;
145                 enum {
146                         CALCEDIT_ID = 100
147
148                 };
149
150         public:
151
152                 
153                 DECLARE_WND_CLASS(commentViewConstant::NLITE_COMMENTLISTWINDOW)
154
155
156                 //
157                 //\83\81\83b\83Z\81[\83W\83}\83b\83v
158                 //
159                 BEGIN_MSG_MAP(CCommentListWindow)
160                         MSG_WM_LBUTTONDBLCLK(OnLButtonDblClk)
161                         MSG_WM_LBUTTONDOWN(OnLButtonDown)
162                         MSG_WM_CREATE(OnCreate)
163                         MSG_WM_ERASEBKGND(OnEraseBkGnd)
164                         MSG_WM_MOUSEWHEEL(OnMouseWheel)
165                         MSG_WM_PAINT(OnPaint)
166                         MSG_WM_SIZE(OnSize)
167                         MSG_WM_KEYDOWN(OnKeyDown)
168                         NOTIFY_ID_HANDLER_EX(CChatChildCtrls::CHAT_DISPCTRL_ID,OnChatControlNortify)
169                         NOTIFY_HANDLER_EX(CALCEDIT_ID,EN_REQUESTRESIZE,OnCalcSellSize)
170                 END_MSG_MAP()
171
172
173
174         public:
175
176                 ///
177                 ///\83R\83\93\83X\83g\83\89\83N\83^
178                 ///
179                 CCommentListWindow(CCommentView &self_in);
180
181                 ///
182                 ///\83f\83X\83g\83\89\83N\83^
183                 ///
184                 ~CCommentListWindow();
185
186
187                 ///
188                 ///\83X\83N\83\8d\81[\83\8b\83y\81[\83W\8cv\8eZ
189                 ///
190                 UINT_PTR CalcScrollPage(UINT_PTR nMax);
191
192                 ///
193                 ///\8ds\82Ì\8d\82\82³\82ð\96â\82¢\8d\87\82í\82¹
194                 ///
195                 VOID CalcItemHeight(CChatData &chatData);
196
197                 ///
198                 ///\91I\91ð\8ds\82ð\95\\8e¦
199                 ///
200                 VOID ShowCurSel();
201
202                 VOID CalcChatRect(const CDC &cdc,RECT &rc,const CNLiteString &str);
203                 
204
205                 //\83v\83\89\83C\83x\81[\83g\8aÖ\90\94
206         private:
207
208                 ///
209                 ///\83A\83C\83e\83\80\95`\89æ
210                 ///
211                 VOID DrawItem(CDC &dc,const RECT &rc,CChatData &chatData);
212
213
214                 
215
216                 ///
217                 ///\83N\83\8a\83b\83N\82µ\82½\8ds\82ð\8cv\8eZ
218                 ///
219                 INT_PTR CalcClickLine(INT_PTR height);
220
221                 //\83\81\83b\83Z\81[\83W\83n\83\93\83h\83\89
222         private:
223                 
224                 ///
225                 ///\83E\83B\83\93\83h\83E\8dì\90¬\8e\9e\82Ì\8f\88\97\9d
226                 ///
227                 LRESULT OnCreate(LPCREATESTRUCT lpCreateStruct);
228
229                 ///
230                 ///\83}\83E\83X\83N\83\8a\83b\83N\8e\9e\82Ì\8f\88\97\9d
231                 ///
232                 VOID OnLButtonDown(UINT wParam, _WTYPES_NS::CPoint &point);
233
234                 ///
235                 ///\95`\89æ\8f\88\97\9d
236                 ///
237                 VOID OnPaint(HDC hdc);
238
239                 
240
241                 ///
242                 ///\83T\83C\83Y\95Ï\8dX
243                 ///
244                 VOID OnSize(UINT wParam, _WTYPES_NS::CSize &windowSize);
245
246                 ///
247                 ///\83}\83E\83X\83_\83u\83\8b\83N\83\8a\83b\83N\8e\9e\82Ì\8f\88\97\9d
248                 ///
249                 VOID OnLButtonDblClk(UINT wParam, _WTYPES_NS::CPoint &point);
250
251                 ///
252                 ///\94w\8ci\93h\82è\82Â\82Ô\82µ
253                 ///
254                 LRESULT OnEraseBkGnd(HDC lparam);
255
256                 ///
257                 ///\83}\83E\83X\83z\83C\81[\83\8b
258                 ///
259                 LRESULT OnMouseWheel(UINT loWparam,SHORT hiWparam,CPoint &point);
260
261                 ///
262                 ///\83L\81[\89\9f\89º\8e\9e\82Ì\8f\88\97\9d
263                 ///
264                 VOID OnKeyDown(TCHAR vKey,UINT loLParam,UINT hiLParam);
265
266
267                 ///
268                 ///\83`\83\83\83b\83g\83R\83\93\83g\83\8d\81[\83\8b\92Ê\92m
269                 ///
270                 LRESULT OnChatControlNortify(LPNMHDR lParam);
271
272                 LRESULT OnCalcSellSize(LPNMHDR lParam);
273                 
274         };
275         
276         ///
277         ///\83R\83\81\83\93\83g\83r\83\85\81[\83N\83\89\83X
278         ///
279         class CCommentView:public CWindowImpl<CCommentView>{
280                 friend CChatChildCtrls;
281                 friend CCommentListWindow;                                              //\83t\83\8c\83\93\83h\90é\8c¾
282                 friend CChatChildCtrlsList;
283                 //\83v\83\89\83C\83x\81[\83g\8c^\81E\83N\83\89\83X\92è\8b`
284         private:
285
286                 //\83w\83b\83_\81[\8fî\95ñ\8ai\94[\97p\83I\83u\83W\83F\83N\83g
287                 typedef struct{
288
289                         LPTSTR *columns;
290                         UINT_PTR *holizensize;
291                         UINT_PTR count;
292
293                 }HEADERSINFO,*LPHEADERSINFO;
294
295                 
296                 
297
298                 
299
300                 //\83\81\83\93\83o\90é\8c¾
301         private:
302
303                 CHeaderCtrl m_header;                                           //\83w\83b\83_\81[\83R\83\93\83g\83\8d\81[\83\8b
304                 CCommentListWindow  m_commentListWindow;        //\83R\83\81\83\93\83g\83\8a\83X\83g\83E\83B\83\93\83h\83E
305                 CNicoLiveStream &stream;                                //\95ú\91\97\83I\83u\83W\83F\83N\83g
306                 CCommentList commentlist;                                       //\83R\83\81\83\93\83g\83\8a\83X\83g
307                 CommentViewProperty viewproperty;                       //\95\\8e¦\83v\83\8d\83p\83e\83B
308                 HFONT hHeaderFontNew;                                           //\83w\83b\83_\81[\83t\83H\83\93\83g
309
310 #ifdef USE_RICHEDIT
311                 CChatChildCtrlsList chatChildCtrlsList;
312 #endif
313                 
314
315
316                 
317                 
318
319                 
320         public:
321
322                 enum{
323                         NO,
324                         USERNAME,
325                         COMMENT,
326                         TIME,
327                         INFO
328
329                 };
330                 
331                 ///
332                 ///\83R\83\93\83X\83g\83\89\83N\83^
333                 ///
334                 CCommentView(CNicoLiveStream &stream);
335                 
336                 ///
337                 ///\83f\83X\83g\83\89\83N\83^
338                 ///
339                 ~CCommentView();
340
341                 
342
343                 //
344                 //\83E\83B\83\93\83h\83E\83N\83\89\83X\90é\8c¾
345                 //
346                 DECLARE_WND_CLASS_EX(commentViewConstant::NLITE_COMMENTVIEW,0,COLOR_BACKGROUND)
347                 
348                 //
349                 //\83\81\83b\83Z\81[\83W\83}\83b\83v
350                 //
351                 BEGIN_MSG_MAP(CCommentView)
352                         MSG_WM_CREATE(OnCreate)
353                         MSG_WM_DESTROY(OnDestroy)                       
354                         MSG_WM_SIZE(OnSize)
355                         MSG_WM_HSCROLL(OnHScroll)
356                         MSG_WM_VSCROLL(OnVScroll)
357                         MSG_WM_ERASEBKGND(OnEraseBkgnd)
358                         NOTIFY_CODE_HANDLER_EX(HDN_ENDTRACK   ,OnHeaderEndTrack)
359                         NOTIFY_CODE_HANDLER_EX(HDN_ENDDRAG ,OnHeaderEndDrag)
360                 END_MSG_MAP()
361
362                 ///
363                 ///\83v\83\8d\83p\83e\83B\90Ý\92è
364                 ///
365                 VOID SetProperty(CommentViewProperty &setProperty);
366
367                 ///
368                 ///\83v\83\8d\83p\83e\83B\8eæ\93¾
369                 ///
370                 CommentViewProperty &GetProperty();
371                 
372                 ///
373                 ///\83E\83B\83\93\83h\83E\8dì\90¬
374                 ///
375                 HWND Create(HWND hWndParent);
376
377                 ///
378                 ///\83w\83b\83_\82Ì\89¡\95\9d\8eæ\93¾
379                 ///
380                 UINT_PTR GetColumnHolSizeSum();
381
382                 ///
383                 ///\83j\83R\90\82É\90Ú\91±\8e\9e\82Ì\8f\88\97\9d
384                 ///
385                 VOID OnConnect();
386
387                 ///
388                 ///\83`\83\83\83b\83g\83R\83\81\83\93\83g\8eó\90M\8e\9e\82Ì\8f\88\97\9d
389                 ///
390                 VOID OnChatReceve(NicoLiveChat_P chat,UINT_PTR count);
391
392                 ///
393                 ///\83`\83\83\83b\83g\83R\83\81\83\93\83g\8eó\90M\8am\92è\8f\88\97\9d
394                 ///
395                 VOID OnChatReceveSettle(UINT_PTR commentCount,UINT_PTR commentCountSum);
396                 
397
398
399                 //\83v\83\89\83C\83x\81[\83g\8aÖ\90\94
400         private:
401
402
403                 ///
404                 ///\83w\83b\83_\92Ç\89Á
405                 ///
406                 VOID AddHeader(LPHEADERSINFO infos);
407                 
408                 ///
409                 ///\83w\83b\83_\82Ì\89¡\95\9d\8c\88\92è
410                 ///
411                 VOID DecisionHorzSize();
412
413
414                 ///
415                 ///\83T\83C\83Y\95Ï\8dX\8f\88\97\9d
416                 ///
417                 VOID ChangeSize(const SIZE& client);
418
419                 //\83E\83B\83\93\83h\83E\83\81\83b\83Z\81[\83W\83n\83\93\83h\83\89
420         private:
421
422                 
423
424                 ///
425                 ///\83T\83C\83Y\95Ï\8dX\8cã\8f\88\97\9d
426                 ///
427                 LRESULT OnSize(UINT wParam,SIZE lParam);
428
429                 
430                 
431
432                 ///
433                 ///\94w\8ci\93h\82è\82Â\82Ô\82µ\8f\88\97\9d
434                 ///
435                 LRESULT OnEraseBkgnd(HDC wParam);
436                 
437                 ///
438                 ///\83E\83B\83\93\83h\83E\94j\8aü\8e\9e\82Ì\8f\88\97\9d
439                 ///
440                 VOID OnDestroy();
441                 
442                 ///
443                 ///\83w\83b\83_\83A\83C\83e\83\80\95Ï\8dX\8e\9e\8f\88\97\9d
444                 ///
445                 LRESULT OnHeaderEndTrack(LPNMHDR lParam);
446
447
448                 ///
449                 ///\83w\83b\83_\83h\83\89\83b\83O\8cã\8f\88\97\9d
450                 ///
451                 LRESULT OnHeaderEndDrag(LPNMHDR lParam);
452
453
454                 ///
455                 ///\89¡\83X\83N\83\8d\81[\83\8b\8e\9e\82Ì\8f\88\97\9d
456                 ///
457                 VOID OnHScroll(INT_PTR loWParam,SHORT hiWParam,HWND lParam);
458                 
459                 ///
460                 ///\8fc\83X\83N\83\8d\81[\83\8b\8e\9e\82Ì\8f\88\97\9d
461                 ///
462                 VOID OnVScroll(INT_PTR loWParam,SHORT hiWParam,HWND lParam);
463
464                 ///
465                 ///\8dì\90¬\8e\9e\82Ì\8f\88\97\9d
466                 ///
467                 LRESULT OnCreate(LPCREATESTRUCT lpcs);
468                 
469                 
470                 
471                 
472                 
473
474
475         };
476         
477 }