OSDN Git Service

主コメ選択時にエディットの色が変わる機能を追加
[nlite/nlite.git] / nlite / nlite_commentWrite.h
1 #pragma once
2
3 namespace nlite{
4
5         template <typename T>
6         struct CommentInfo{
7                 LPCTSTR name;
8                 T userData;
9         };
10
11         typedef CommentInfo<COLORREF> CommentColorInfo;
12         typedef CommentInfo<LPCTSTR> CommentSizeInfo; 
13         typedef CommentInfo<LPCTSTR> CommentPosInfo;
14
15         class CNicoLiveStream;
16
17         ///
18         ///\88ê\94Ê\89ï\88õ\83R\83}\83\93\83h
19         ///
20         namespace generalUser{
21                 ///
22                 ///\88ê\94Ê\89ï\88õ\83R\83\81\83\93\83g\90F\83\8a\83X\83g
23                 ///
24                 extern const  CommentColorInfo COMMENT_COLORLIST[];
25
26                 ///
27                 ///\88ê\94Ê\89ï\88õ\83T\83C\83Y\83R\83}\83\93\83h\83\8a\83X\83g
28                 ///
29                 extern const CommentSizeInfo COMMENT_SIZELIST[];
30
31                 ///
32                 ///\88ê\94Ê\89ï\88õ\83R\83\81\83\93\83g\88Ê\92u\83\8a\83X\83g
33                 ///
34                 extern const CommentPosInfo COMMENT_POSLIST[];
35
36         }
37
38         ///
39         ///\83v\83\8c\83~\83A\83\80\89ï\88õ\83R\83}\83\93\83h
40         ///
41         namespace premiumUser{
42                 ///
43                 ///\83v\83\8c\83~\83A\83\80\89ï\88õ\83R\83\81\83\93\83g\90F\83\8a\83X\83g
44                 ///
45                 extern const CommentColorInfo COMMENT_COLORLIST[];
46
47
48                 ///
49                 ///\83v\83\8c\83~\83A\83\80\89ï\88õ\83T\83C\83Y\83R\83}\83\93\83h\83\8a\83X\83g
50                 ///
51                 extern const CommentSizeInfo COMMENT_SIZELIST[];
52
53                 ///
54                 ///\83v\83\8c\83~\83A\83\80\89ï\88õ\83R\83\81\83\93\83g\88Ê\92u\83\8a\83X\83g
55                 ///
56                 extern const CommentPosInfo COMMENT_POSLIST[];
57
58         }
59
60
61         class CCommentWriteWindow;
62         class CSubChatEdit:public CWindowImpl<CSubChatEdit,CEdit>{
63
64
65
66         private:
67                 CCommentWriteWindow &self;
68                 CComAutoCriticalSection cs;
69                 BOOL untilConnectingFlag;
70
71         public:
72                 CSubChatEdit(CCommentWriteWindow &in_commentWriteWindow):self(in_commentWriteWindow){}
73
74
75                 BEGIN_MSG_MAP_EX(CSubLiveNoComboBox)
76                         MSG_WM_KEYDOWN(OnKeyDown)
77                 END_MSG_MAP()
78
79                         void OnKeyDown(TCHAR wParam, UINT upLParam,UINT loLParam);
80
81
82                         VOID AgreeEnter();
83
84
85         };
86
87
88         const static LPCTSTR COMMENTWRITEWINDOW = TEXT("commentWriteWindow");
89
90
91         ///
92         ///\83R\83\81\83\93\83g\8f\91\82«\8d\9e\82Ý\97p\83E\83B\83\93\83h\83E\83N\83\89\83X
93         ///
94         class CCommentWriteWindow:public CWindowImpl<CCommentWriteWindow>{
95
96                 friend CSubChatEdit;
97         private:
98                 CComboBox commentPosBox;                                                                //\83R\83\81\83\93\83g\88Ê\92u\91I\91ð\83R\83\93\83{\83{\83b\83N\83X
99                 CComAutoCriticalSection commentPosBoxCS;                                //\83R\83\81\83\93\83g\88Ê\92u\91I\91ð\83R\83\93\83{\83{\83b\83N\83X\83N\83\8a\83e\83B\83J\83\8b\83Z\83N\83V\83\87\83\93
100                 CComboBox commentSizeBox;                                                               //\83R\83\81\83\93\83g\82Ì\91å\82«\82³\91I\91ð\83R\83\93\83{\83{\83b\83N\83X
101                 CComAutoCriticalSection commentSizeBoxCS;                               //\83R\83\81\83\93\83g\82Ì\91å\82«\82³\91I\91ð\83R\83\93\83{\83{\83b\83N\83X\83N\83\8a\83e\83B\83J\83\8b\83Z\83N\83V\83\87\83\93
102                 CComboBox commentColorBox;                                                              //\83R\83\81\83\93\83g\90F\91I\91ð\83R\83\93\83{\83{\83b\83N\83X
103                 CButton anonymousButton;                                                                //184\91I\91ð\83{\83^\83\93
104                 CButton ownerModeButton;                                                                //\8eå\83R\83\81\91I\91ð\83{\83^\83\93
105                 CSubChatEdit commentSubEdit;                                                    //\83R\83\81\83\93\83g\8f\91\82«\8d\9e\82Ý\97p\83G\83f\83B\83b\83g\83T\83u\83N\83\89\83X
106                 CButton commentWriteButton;                                                             //\83R\83\81\83\93\83g\8f\91\82«\8d\9e\82Ý\83{\83^\83\93
107                 UINT_PTR commentWriteMaxLength;                                                 //\83R\83\81\83\93\83g\8f\91\82«\8d\9e\82Ý\92·\8dÅ\91å\92l
108                 UINT_PTR commentWriteHeight;                                                    //\83R\83\81\83\93\83g\8f\91\82«\8d\9e\82Ý\83R\83\93\83g\83\8d\81[\83\8b\94z\92u\97Ì\88æ\82Ì\8d\82\82³
109                 UINT_PTR infoDispHeight;                                                                //\83R\83\81\83\93\83g\8f\91\82«\8d\9e\82Ý\82É\8aÖ\82·\82é\82à\82Ì\88È\8aO\82Ì\8fî\95ñ\95\\8e¦\97Ì\88æ\82Ì\8d\82\82³
110                 UINT_PTR commentWriteInternalHeight;                                    //\83R\83\81\83\93\83g\8f\91\82«\8d\9e\82Ý\83R\83\93\83g\83\8d\81[\83\8b\94z\92u\97Ì\88æ\82Ì\8d\82\82³(\93à\95\94)
111                 CNicoLiveStream &nicoLiveStream;                                                //\95ú\91\97\83I\83u\83W\83F\83N\83g\82Ì\8eQ\8fÆ
112                 time_t streamTime;                                                                              //\95ú\91\97\8co\89ß\8e\9e\8aÔ
113                 CFont checkButtonFont;                                                                  //184\95\\8e¦\97p\83t\83H\83\93\83g
114                 CFont timeFont;                                                                                 //\8co\89ß\8e\9e\8aÔ\95\\8e¦\97p\83t\83H\83\93\83g
115                 COLORREF editBkColor;                                                                   //\83G\83f\83B\83b\83g\82Ì\94w\8ci\90F
116                 CBrush editBkBrush;                                                                             //\83G\83f\83B\83b\83g\82Ì\94w\8ci\83u\83\89\83V
117
118                 //\83R\83\93\83g\83\8d\81[\83\8bID
119                 enum CONTROLID{
120                         COMMENTPOS_BOX = 1,
121                         COMMENTSIZE_BOX = 2,
122                         COMMENTCOLOR_BOX = 3,
123                         ANONYMOUS_BUTTON = 4,
124                         COMMENT_EDIT = 5,
125                         COMMENTWRITE_BOTTON = 6,
126                         TIMER_ID = 7,
127                         OWNERMODE_BUTTON = 5
128                 };
129                 
130
131
132         public:
133
134                 DECLARE_WND_CLASS(COMMENTWRITEWINDOW)
135                 //\83\81\83b\83Z\81[\83W\83}\83b\83v
136                 BEGIN_MSG_MAP(CCommentWriteWindow)
137                         MSG_WM_CREATE(OnCreate)
138                         MSG_WM_DESTROY(OnDestroy)
139                         MSG_WM_PAINT(OnPaint)
140                         MSG_WM_SIZE(OnSize)
141                         MSG_WM_ERASEBKGND(OnEraseBkGnd)
142                         MSG_WM_CTLCOLOREDIT(OnCtlolorEdit)
143                         MSG_WM_DRAWITEM(OnDrawItem)
144                         MSG_WM_MEASUREITEM(OnMeasureItem)
145                         MSG_WM_TIMER(OnTimer)
146                         COMMAND_CODE_HANDLER_EX(BN_CLICKED,OnButton)
147                 END_MSG_MAP()
148
149
150
151
152                 public:
153
154                 ///
155                 ///\83R\83\93\83X\83g\83\89\83N\83^
156                 ///
157                 CCommentWriteWindow(CNicoLiveStream &nicoLiveStream);
158
159                 ///
160                 ///\82±\82Ì\83E\83B\83\93\83h\83E\82Ì\8d\82\82³\82ð\8eæ\93¾
161                 ///
162                 UINT_PTR GetHeight();
163
164                 ///
165                 ///\83R\83\81\83\93\83g\91\97\90M
166                 ///
167                 BOOL SendChat();
168
169                 ///
170                 ///\83R\83\81\83\93\83g\91\97\90M\97\93\82É\95\8e\9a\97ñ\82ð\90Ý\92è
171                 ///
172                 BOOL SetText(LPCTSTR lpStr);
173
174                 ///
175                 ///\83R\83\81\83\93\83g\8eó\90M\8aJ\8en\8e\9e\82Ì\8f\88\97\9d
176                 ///
177                 VOID OnChatReceveStart(CNicoLiveStream &nicoLiveStream,NicoLiveThreadComment_P threadComment);
178
179                 ///
180                 ///\83R\83\81\83\93\83g\91\97\90M\8c\8b\89Ê\8eó\90M\8e\9e\82Ì\8f\88\97\9d
181                 ///
182                 VOID OnSendChatResult();
183
184                 ///
185                 ///\83n\81[\83g\83r\81[\83g\91\97\90M\8e\9e\82Ì\8f\88\97\9d
186                 ///
187                 VOID OnHeartBeat(NicoLiveHeartBeat_P heartBeat);
188
189                 ///
190                 ///\95ú\91\97\90Ø\92f\8e\9e\82Ì\8f\88\97\9d
191                 ///
192                 VOID OnDisConnect();
193
194                 //
195                 //\83\81\83b\83Z\81[\83W\83n\83\93\83h\83\89
196                 //
197         private:
198
199                 ///
200                 ///\83E\83B\83\93\83h\83E\8dì\90¬\8e\9e\82Ì\8f\88\97\9d
201                 ///
202                 LRESULT OnCreate(LPCREATESTRUCT lpReateStruct);
203
204
205                 ///
206                 ///\83E\83B\83\93\83h\83E\94j\8aü\8e\9e\82Ì\8f\88\97\9d
207                 ///
208                 VOID OnDestroy();
209
210                 ///
211                 ///\95`\89æ\8e\9e\82Ì\8f\88\97\9d
212                 ///
213                 VOID OnPaint(HDC hdc);
214
215
216                 ///
217                 ///\83T\83C\83Y\95Ï\8dX\8e\9e\82Ì\8f\88\97\9d
218                 ///
219                 LRESULT OnSize(UINT wParam,SIZE lParam);
220
221                 ///
222                 ///\83T\83C\83Y\95Ï\8dX\8f\88\97\9d
223                 ///
224                 VOID ChangeSize(SIZE &size);
225
226
227                 ///
228                 ///\83A\83C\83e\83\80\95`\89æ\8f\88\97\9d
229                 ///
230                 VOID OnDrawItem(UINT wParam,LPDRAWITEMSTRUCT lParam);
231
232                 ///
233                 ///\83A\83C\83e\83\80\82Ì\8d\82\82³\95Ï\8dX\8f\88\97\9d
234                 ///
235                 VOID OnMeasureItem(UINT wParam,LPMEASUREITEMSTRUCT lParam);
236
237                 ///
238                 ///\94w\8ci\82Ì\83`\83\89\83c\83L\82ð\97}\82¦\82é
239                 ///
240                 LRESULT OnEraseBkGnd(HDC wParam);
241
242                 ///
243                 ///\83{\83^\83\93\89\9f\89º\8e\9e\82Ì\8f\88\97\9d
244                 ///
245                 LRESULT OnButton(UINT hiWparam,INT_PTR loWparam,HWND lParam);
246
247
248                 ///
249                 ///\83G\83f\83B\83b\83g\83R\83\93\83g\83\8d\81[\83\8b\83J\83X\83^\83\80\83h\83\8d\81[
250                 ///
251                 LRESULT OnCtlolorEdit(HDC hdc,HWND hWnd);
252
253                 VOID OnTimer(UINT id);
254
255
256         };
257
258 }