///////////////////////////////////////////////////////
CCommentView::CCommentView():
- hScrollInfo()
+ hScrollInfo(),
+ m_commentListWindow(*this)
{
hScrollInfo.fMask = SIF_ALL;
hScrollInfo.cbSize = sizeof(hScrollInfo);
VOID CCommentView::OnConnect(){
commentlist.OnConnect();
- m_listBox.SetRedraw(FALSE);
- m_listBox.ResetContent();
+ m_commentListWindow.SetRedraw(FALSE);
+ m_commentListWindow.ResetContent();
}
auto &chat = *(CChatData*)lpMersureItemStruct->itemData;
- CDC cdc = m_listBox.GetDC();
+ CDC cdc = m_commentListWindow.GetDC();
RECT drowSize;
m_header.GetItemRect(COMMENT,&drowSize);
if(lParam->hwndFrom == m_header.m_hWnd){
- INT_PTR curSel = m_listBox.GetCurSel();
+ INT_PTR curSel = m_commentListWindow.GetCurSel();
SCROLLINFO scrollInfo = {0};
scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
- m_listBox.GetScrollInfo(SB_VERT,&scrollInfo);
+ m_commentListWindow.GetScrollInfo(SB_VERT,&scrollInfo);
scrollInfo.nPos++;
BOOL scrollFlag = scrollInfo.nPos + (int)scrollInfo.nPage >= scrollInfo.nMax;
UINT_PTR commentCount = commentlist.Size();
- m_listBox.SetRedraw(FALSE);
- m_listBox.ResetContent();
+ m_commentListWindow.SetRedraw(FALSE);
+ m_commentListWindow.ResetContent();
for(UINT_PTR index =0;index < commentCount;index++){
- m_listBox.AddString((LPCTSTR)&commentlist.GetChatAt(index));
+ m_commentListWindow.AddString((LPCTSTR)&commentlist.GetChatAt(index));
}
- m_listBox.SetCurSel(curSel);
+ m_commentListWindow.SetCurSel(curSel);
- m_listBox.SetRedraw(TRUE);
- m_listBox.Invalidate();
+ m_commentListWindow.SetRedraw(TRUE);
+ m_commentListWindow.Invalidate();
if(scrollFlag == TRUE){
- m_listBox.SendMessageW(WM_VSCROLL,SB_BOTTOM,0);
+ m_commentListWindow.SendMessageW(WM_VSCROLL,SB_BOTTOM,0);
}
INT_PTR itemCount = m_header.GetItemCount();
Lock();
- m_listBox.SetRedraw(FALSE);
+ m_commentListWindow.SetRedraw(FALSE);
commentlist.OnChatReceve(chat,count);
- m_listBox.AddString((LPCTSTR)&commentlist.back());
+ m_commentListWindow.AddString((LPCTSTR)&commentlist.back());
SCROLLINFO scrollInfo = {0};
scrollInfo.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
- m_listBox.GetScrollInfo(SB_VERT,&scrollInfo);
+ m_commentListWindow.GetScrollInfo(SB_VERT,&scrollInfo);
scrollInfo.nPos++;
if(scrollInfo.nPos + (int)scrollInfo.nPage >= scrollInfo.nMax == TRUE){
- m_listBox.SendMessageW(WM_VSCROLL,MAKEWORD(SB_BOTTOM,0),0);
+ m_commentListWindow.SendMessageW(WM_VSCROLL,MAKEWORD(SB_BOTTOM,0),0);
}
Unlock();
}
VOID CCommentView::OnChatReceveSettle(UINT_PTR commentCount,UINT_PTR commentCountSum){
- m_listBox.SetRedraw(TRUE);
+ m_commentListWindow.SetRedraw(TRUE);
return;
- if(wndCtl.m_hWnd == m_listBox.m_hWnd){
+ if(wndCtl.m_hWnd == m_commentListWindow.m_hWnd){
- INT_PTR cursel = m_listBox.GetCurSel();
+ INT_PTR cursel = m_commentListWindow.GetCurSel();
if(cursel == LB_ERR)return 0;
auto chatData = commentlist.GetChatAt(cursel);
chatData.listenerData->SetBkColor(bkColor);
- m_listBox.Invalidate(TRUE);
+ m_commentListWindow.Invalidate(TRUE);
}
return 0;
VOID CCommentView::OnDrawItem(UINT wParam,LPDRAWITEMSTRUCT lpDrawItemStruct){
- if((lpDrawItemStruct->hwndItem == m_listBox.m_hWnd) && ((UINT)m_listBox.GetCount() > lpDrawItemStruct->itemID)){
+ if((lpDrawItemStruct->hwndItem == m_commentListWindow.m_hWnd) && ((UINT)m_commentListWindow.GetCount() > lpDrawItemStruct->itemID)){
RECT noViewRect;
RECT userNameViewRect;
VOID CCommentView::OnPaint(HDC wParam){
PAINTSTRUCT paintStruct;
HDC paintDC = this->BeginPaint(&paintStruct);
- HPEN hPen = (HPEN)GetStockPen(NULL_PEN);
- HPEN oldPen = (HPEN)::SelectObject(paintDC,hPen);
- HBRUSH brush = (HBRUSH)GetStockObject(LTGRAY_BRUSH);
- HBRUSH oldBrush = (HBRUSH)::SelectObject(paintDC,brush);
-
- ::Rectangle(paintDC,paintStruct.rcPaint.left,paintStruct.rcPaint.top,paintStruct.rcPaint.right,paintStruct.rcPaint.bottom);
+ ::FillRect(paintDC,&paintStruct.rcPaint,(HBRUSH)GetStockObject(LTGRAY_BRUSH));
this->EndPaint(&paintStruct);
- ::SelectObject(paintDC,oldBrush);
- ::SelectObject(paintDC,oldPen);
+
return;
}
INT_PTR movePos = -1 * hScrollInfo.nPos;
m_header.DeferWindowPos(hDwp,m_header.m_hWnd,movePos,0,0,0,SWP_NOSIZE | SWP_NOZORDER);
- m_listBox.DeferWindowPos(hDwp,m_listBox.m_hWnd,movePos,commentViewConstant::HEADER_HAIGHT,hScrollInfo.nMax,client.cy - commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER);
+ m_commentListWindow.DeferWindowPos(hDwp,m_commentListWindow.m_hWnd,movePos,commentViewConstant::HEADER_HAIGHT,hScrollInfo.nMax,client.cy - commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER);
EndDeferWindowPos(hDwp);
}
commentlist.OnDestroy();
m_header.DestroyWindow();
- m_listBox.DestroyWindow();
+ m_commentListWindow.DestroyWindow();
return;
}
if(lParam->hwndFrom == m_header.m_hWnd){
- m_listBox.Invalidate();
+ m_commentListWindow.Invalidate();
}
RECT headerPosRect;
RECT listBoxPosRect;
m_header.GetWindowRect(&headerPosRect);
- m_listBox.GetWindowRect(&listBoxPosRect);
+ m_commentListWindow.GetWindowRect(&listBoxPosRect);
INT_PTR moveRange = -(hScrollInfo.nPos);
headerPosRect.bottom -= headerPosRect.top;
headerPosRect.top = 0;
listBoxPosRect.left = moveRange;
m_header.MoveWindow(&headerPosRect);
- m_listBox.MoveWindow(&listBoxPosRect);
+ m_commentListWindow.MoveWindow(&listBoxPosRect);
HDWP hDwp = BeginDeferWindowPos(2);
m_header.DeferWindowPos(hDwp,m_header.m_hWnd,moveRange,0,0,0,SWP_NOSIZE | SWP_NOZORDER);
- m_listBox.DeferWindowPos(hDwp,m_listBox.m_hWnd,moveRange,commentViewConstant::HEADER_HAIGHT,0,0,SWP_NOSIZE | SWP_NOZORDER);
+ m_commentListWindow.DeferWindowPos(hDwp,m_commentListWindow.m_hWnd,moveRange,commentViewConstant::HEADER_HAIGHT,0,0,SWP_NOSIZE | SWP_NOZORDER);
EndDeferWindowPos(hDwp);
LRESULT CCommentView::OnCreate(LPCREATESTRUCT lpcs){
m_header.Create(m_hWnd,0,WC_HEADER,WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | HDS_BUTTONS | HDS_HOTTRACK |HDS_DRAGDROP | HDS_FULLDRAG ,0,commentViewConstant::HEADER_ID);
- m_listBox.Create(m_hWnd,0,WC_LISTBOX,WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_CLIPCHILDREN | LBS_OWNERDRAWVARIABLE | LBS_NOTIFY | LBS_NOREDRAW , 0,commentViewConstant::LISTBOX_ID);
- m_listBox.SetFont(AtlGetDefaultGuiFont());
+ m_commentListWindow.Create(m_hWnd,0,WC_LISTBOX,WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_CLIPCHILDREN | LBS_OWNERDRAWVARIABLE | LBS_NOTIFY | LBS_NOREDRAW , 0,commentViewConstant::LISTBOX_ID);
+ m_commentListWindow.SetFont(AtlGetDefaultGuiFont());
/*
- m_subListBox.SubclassWindow(m_listBox);
+ m_subListBox.SubclassWindow(m_commentListWindow);
m_subListBox.CreateMemoryDC();
*/
return 0;
RECT bkWindowRect;
this->GetClientRect(&bkWindowRect);
m_header.DeferWindowPos(hWindowPosInfo,m_header.m_hWnd,0,0,hScrollInfo.nMax,commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER | SWP_NOMOVE);
- m_listBox.DeferWindowPos(hWindowPosInfo,m_header.m_hWnd,0,0,hScrollInfo.nMax,bkWindowRect.bottom - commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER | SWP_NOMOVE);
+ m_commentListWindow.DeferWindowPos(hWindowPosInfo,m_header.m_hWnd,0,0,hScrollInfo.nMax,bkWindowRect.bottom - commentViewConstant::HEADER_HAIGHT,SWP_NOZORDER | SWP_NOMOVE);
EndDeferWindowPos(hWindowPosInfo);
bkWindowRect.left = hScrollInfo.nMax;
//\83R\83\81\83\93\83g\83r\83\85\81[\83N\83\89\83X\93à\95\94\83\8a\83X\83g\83N\83\89\83X
////////////////////////////////////////////////////////////////////
-
-VOID CCommentView::CSubCommentListBox::OnPaint(HDC hdc){
-
- PAINTSTRUCT ps;
- this->BeginPaint(&ps);
-
-
- this->EndPaint(&ps);
-
- return;
-}
-
-
-
-VOID CCommentView::CSubCommentListBox::CreateMemoryDC(){
- HDC hdc = this->GetDC();
- m_MemoryDC.CreateCompatibleDC(hdc);
- m_Bitmap.CreateCompatibleBitmap(m_MemoryDC,300,200);
-
- ReleaseDC(hdc);
- return;
-}
-
\ No newline at end of file
+CCommentListWindow::CCommentListWindow(CCommentView &in_self):self(in_self){}
\ No newline at end of file
namespace nlite{
namespace commentViewConstant{
- const static LPCTSTR NLITE_COMMENTVIEW = TEXT("commentViewConstant::NLITE_COMMENTVIEW");
+ const static LPCTSTR NLITE_COMMENTVIEW = TEXT("NLITE_COMMENTVIEW");
+
+ const static LPCTSTR NLITE_COMMENTLISTBASE = TEXT("NLITE_COMMENTLISTBASE");
+
+ const static LPCTSTR NLITE_COMMENTLISTWINDOW = TEXT("NLITE_COMMENTLISTWINDOW");
const static UINT_PTR HEADER_HAIGHT = 20;
const static UINT_PTR MENU_OR_ID = 256;
}
+
+ class CCommentView;
+ //\83R\83\81\83\93\83g\95\\8e¦\97p\83E\83B\83\93\83h\83E
+ class CCommentListWindow:public CWindowImpl<CCommentListWindow>{
+
+
+ private:
+ CCommentView &self;
+
+
- class CCommentView:public CWindowImpl<CCommentView>{
+
+
+
+ public:
+
+ DECLARE_WND_CLASS(commentViewConstant::NLITE_COMMENTLISTWINDOW)
+
+
+ //
+ //\83\81\83b\83Z\81[\83W\83}\83b\83v
+ //
+ BEGIN_MSG_MAP(CCommentListWindow)
+
+ END_MSG_MAP()
+
+ public:
+
+ ///
+ ///\83R\83\93\83X\83g\83\89\83N\83^
+ ///
+ CCommentListWindow(CCommentView &self);
+
+
+ };
+
+ class CCommentView:public CWindowImpl<CCommentView>{
+
+ friend CCommentListWindow;
//\83v\83\89\83C\83x\81[\83g\8c^\81E\83N\83\89\83X\92è\8b`
private:
}HEADERSINFO,*LPHEADERSINFO;
-
+ //\83R\83\81\83\93\83g\95\\8e¦\83E\83B\83\93\83h\83E\82Ì\83x\81[\83X\82Æ\82È\82é\83E\83B\83\93\83h\83E
+ class CCommentListBaseWindow:public CWindowImpl<CCommentListBaseWindow>{
- class CSubCommentListBox:public CDoubleBufferWindowImpl<CSubCommentListBox>{
- //\83v\83\89\83C\83x\81[\83g\83\81\83\93\83o
- private:
- CDC m_MemoryDC;
- CBitmap m_Bitmap;
- LPDWORD lpPixel;
public:
+ //
+ //\83E\83B\83\93\83h\83E\83N\83\89\83X\90é\8c¾
+ //
+ DECLARE_WND_CLASS_EX(commentViewConstant::NLITE_COMMENTLISTBASE,0,COLOR_BACKGROUND)
-
- BEGIN_MSG_MAP_EX(CSubCommentListBox)
- MSG_WM_PAINT(OnPaint)
- CHAIN_MSG_MAP(CDoubleBufferWindowImpl<CSubCommentListBox>)
- END_MSG_MAP()
-
- VOID CreateMemoryDC();
-
- private:
- VOID OnPaint(HDC hdc);
+ BEGIN_MSG_MAP(CCommentListBaseWindow)
+ MSG_WM_ERASEBKGND(OnEraseBkgnd)
+ END_MSG_MAP()
+
+ LRESULT OnEraseBkgnd(HDC wParam){
+
+ return TRUE;
+ }
};
+
+
//\83\81\83\93\83o\90é\8c¾
private:
CHeaderCtrl m_header;
- CListBox m_listBox;
+ CCommentListWindow m_commentListWindow;
CComAutoCriticalSection ccs;
CStreamStatus streamStatus;
CCommentList commentlist;