VOID CChatChildCtrls::Hide(HDWP hdwp){
- chatDispCtrl.DeferWindowPos(hdwp,chatDispCtrl.m_hWnd,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_HIDEWINDOW);
+ chatDispCtrl.DeferWindowPos(hdwp,chatDispCtrl,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_HIDEWINDOW);
}
if(m_hMaster.commentlist.Size() > 0){
- dumpln(TEXT("showcntrls:start"));
+
RECT headerRect;
RECT tmpRect;
RECT listRect;
VOID CCommentView::SetProperty(CommentViewProperty &setProperty){
viewproperty = setProperty;
+ m_commentListWindow.OnSetProperty();
+
return;
}
AddHeader(&headersinfo);
- m_header.SetOrderArray(ARRAY_LENGTH(viewproperty.headerOraderArray),viewproperty.headerOraderArray);
+ m_header.SetOrderArray(ARRAY_LENGTH(viewproperty.headerOrderArray),viewproperty.headerOrderArray);
VOID CCommentView::OnDestroy(){
- m_header.GetOrderArray(ARRAY_LENGTH(viewproperty.headerOraderArray),viewproperty.headerOraderArray);
+ m_header.GetOrderArray(ARRAY_LENGTH(viewproperty.headerOrderArray),viewproperty.headerOrderArray);
INT_PTR headerItemcount = m_header.GetItemCount();
RECT headerItemRect;
for(INT_PTR itemindex = 0;itemindex < headerItemcount;itemindex++){
CCommentListWindow::CCommentListWindow(CCommentView &in_self):
self(in_self),
viewSellHeight(0)
- {}
+ {
+ CFontHandle font = ::AtlGetDefaultGuiFont();
+ LOGFONT logfont;
+ font.GetLogFont(&logfont);
+ logfont.lfUnderline = TRUE;
+
+ linkFont.CreateFontIndirect(&logfont);
+ }
CCommentListWindow::~CCommentListWindow(){
}
+ VOID CCommentListWindow::OnSetProperty(){
+
+ if(IsWindow() == TRUE)this->SetRedraw(FALSE);
+
+ if(collLinePen.IsNull() == FALSE)collLinePen.DeleteObject();
+ if(normalSellLinePen.IsNull() == FALSE)normalSellLinePen.DeleteObject();
+ if(normalBkBrush.IsNull() == FALSE)normalBkBrush.DeleteObject();
+ if(selectSellLinePen.IsNull() ==FALSE)selectSellLinePen.DeleteObject();
+ if(selectBkBrush.IsNull() == FALSE)selectBkBrush.DeleteObject();
+
+ collLinePen.CreatePen(PS_SOLID,1,self.viewproperty.colLineColor);
+ normalSellLinePen.CreatePen(PS_SOLID,1,self.viewproperty.normalSellLineColor);
+ normalBkBrush.CreateSolidBrush(self.viewproperty.backColor);
+ selectSellLinePen.CreatePen(PS_SOLID,1,self.viewproperty.selectSellLineColor);
+ selectBkBrush.CreateSolidBrush(self.viewproperty.selectBackColor);
+
+
+ if(IsWindow() == TRUE)this->SetRedraw(TRUE);
+ }
+
VOID CCommentListWindow::OnPaint(HDC in_hdc){
listRect.right = self.GetColumnHolSizeSum();
CCommentList::iterator chatData = commentList.GetShortCut();
-
-
-
- CBrush baseBkBrush;
- baseBkBrush.CreateSolidBrush(self.viewproperty.backColor);
- mdc.FillRect(&listRect,baseBkBrush);
- baseBkBrush.DeleteObject();
+
+
+
+ mdc.FillRect(&listRect,this->normalBkBrush);
+
CCommentList::iterator endData = commentList.end();
listRect.bottom = 0;
+ RECT headerRects[COMMENTVIEW_HEADERITEMSIZE];
+ RECT colLineRects[COMMENTVIEW_HEADERITEMSIZE];
+ RECT selectHeaderRects[COMMENTVIEW_HEADERITEMSIZE];
+
+ self.m_header.GetItemRect(CCommentView::NO,&headerRects[CCommentView::NO]);
+ self.m_header.GetItemRect(CCommentView::USERNAME,&headerRects[CCommentView::USERNAME]);
+ self.m_header.GetItemRect(CCommentView::COMMENT,&headerRects[CCommentView::COMMENT]);
+ self.m_header.GetItemRect(CCommentView::TIME,&headerRects[CCommentView::TIME]);
+ self.m_header.GetItemRect(CCommentView::INFO,&headerRects[CCommentView::INFO]);
+ memcpy(colLineRects,headerRects,sizeof(headerRects));
+
+
+
+
+
+ headerRects[CCommentView::NO].left += SELL_SPACE_LENGTH;
+ headerRects[CCommentView::USERNAME].left += SELL_SPACE_LENGTH;
+ headerRects[CCommentView::COMMENT].left += SELL_SPACE_LENGTH;
+ headerRects[CCommentView::TIME].left += SELL_SPACE_LENGTH;
+ headerRects[CCommentView::INFO].left += SELL_SPACE_LENGTH;
+
+ headerRects[CCommentView::NO].right -= SELL_SPACE_LENGTH;
+ headerRects[CCommentView::USERNAME].right -= SELL_SPACE_LENGTH;
+ headerRects[CCommentView::COMMENT].right -= SELL_SPACE_LENGTH;
+ headerRects[CCommentView::TIME].right -= SELL_SPACE_LENGTH;
+ headerRects[CCommentView::INFO].right -= SELL_SPACE_LENGTH;
+
+ headerRects[CCommentView::NO].top = SELL_SPACE_LENGTH;
+ headerRects[CCommentView::USERNAME].top = SELL_SPACE_LENGTH;
+ headerRects[CCommentView::COMMENT].top = SELL_SPACE_LENGTH;
+ headerRects[CCommentView::TIME].top = SELL_SPACE_LENGTH;
+ headerRects[CCommentView::INFO].top = SELL_SPACE_LENGTH;
+
+ headerRects[CCommentView::NO].bottom = SELL_SPACE_LENGTH;
+ headerRects[CCommentView::USERNAME].bottom = SELL_SPACE_LENGTH;
+ headerRects[CCommentView::COMMENT].bottom = SELL_SPACE_LENGTH;
+ headerRects[CCommentView::TIME].bottom = SELL_SPACE_LENGTH;
+ headerRects[CCommentView::INFO].bottom = SELL_SPACE_LENGTH;
+
+ INT_PTR listRectTop = listRect.top;
for(;chatData != endData && listRect.top < clientRect.bottom;++chatData){
CalcItemHeight(*chatData);
// dumpln(TEXT("height:%d"),chatData->viewData.height);
listRect.bottom += chatData->viewData.height;
+ headerRects[CCommentView::NO].top = listRect.top + SELL_SPACE_LENGTH;
+ headerRects[CCommentView::USERNAME].top = listRect.top + SELL_SPACE_LENGTH;
+ headerRects[CCommentView::COMMENT].top = listRect.top + SELL_SPACE_LENGTH;
+ headerRects[CCommentView::TIME].top = listRect.top + SELL_SPACE_LENGTH;
+ headerRects[CCommentView::INFO].top = listRect.top + SELL_SPACE_LENGTH;
+
+ headerRects[CCommentView::NO].bottom = listRect.bottom - SELL_SPACE_LENGTH;
+ headerRects[CCommentView::USERNAME].bottom = listRect.bottom - SELL_SPACE_LENGTH;
+ headerRects[CCommentView::COMMENT].bottom = listRect.bottom - SELL_SPACE_LENGTH;
+ headerRects[CCommentView::TIME].bottom = listRect.bottom - SELL_SPACE_LENGTH;
+ headerRects[CCommentView::INFO].bottom = listRect.bottom - SELL_SPACE_LENGTH;
+
if(chatData->viewData.selectFlag == TRUE){
selectFlag = TRUE;
selectData = chatData;
selectRect = listRect;
+ memcpy(selectHeaderRects,headerRects,sizeof(headerRects));
} else {
- this->DrawItem(mdc,listRect,*chatData);
+
+
+
+ this->DrawItem(mdc,listRect,headerRects,*chatData);
}
}
viewSellHeight = listRect.bottom;
-
+
+
if(selectFlag == TRUE){
- this->DrawItem(mdc,selectRect,*selectData);
+ this->DrawItem(mdc,selectRect,selectHeaderRects,*selectData);
}
+ //\8d\80\96Ú\82Ì\8fc\90ü\82ð\95`\89æ
+ mdc.SelectPen(collLinePen);
+ mdc.MoveTo(colLineRects[CCommentView::NO].right,listRectTop);
+ mdc.LineTo(colLineRects[CCommentView::NO].right,listRect.bottom);
+ mdc.MoveTo(colLineRects[CCommentView::USERNAME].right,listRectTop);
+ mdc.LineTo(colLineRects[CCommentView::USERNAME].right,listRect.bottom);
+ mdc.MoveTo(colLineRects[CCommentView::COMMENT].right,listRectTop);
+ mdc.LineTo(colLineRects[CCommentView::COMMENT].right,listRect.bottom);
+ mdc.MoveTo(colLineRects[CCommentView::TIME].right,listRectTop);
+ mdc.LineTo(colLineRects[CCommentView::TIME].right,listRect.bottom);
+ mdc.MoveTo(colLineRects[CCommentView::INFO].right,listRectTop);
+ mdc.LineTo(colLineRects[CCommentView::INFO].right,listRect.bottom);
+
}
windowRect.left = listRect.right;
mdc.FillRect(&windowRect,(HBRUSH)::GetStockObject(GRAY_BRUSH));
return rslt;
}
- VOID CCommentListWindow::DrawItem(CDC &dc,const RECT &rc,CChatData &chatData){
+ VOID CCommentListWindow::DrawItem(CDC &dc,const RECT &rc,const RECT *headerRect,CChatData &chatData){
- RECT noViewRect; //\83R\83\81\94Ô\95\\8e¦\97Ì\88æ
- RECT userNameViewRect; //\83\86\81[\83U\96¼\95\\8e¦\97Ì\88æ
- RECT timeViewRect; //\8e\9e\8aÔ\95\\8e¦\97Ì\88æ
- RECT chatViewRect; //\83R\83\81\83\93\83g\95\\8e¦\97Ì\88æ
- RECT infoViewRect; //\83R\83\81\83\93\83g\8fî\95ñ\95\\8e¦\97Ì\88æ
+ RECT noViewRect = headerRect[CCommentView::NO]; //\83R\83\81\94Ô\95\\8e¦\97Ì\88æ
+ RECT userNameViewRect = headerRect[CCommentView::USERNAME]; //\83\86\81[\83U\96¼\95\\8e¦\97Ì\88æ
+ RECT chatViewRect = headerRect[CCommentView::COMMENT]; //\83R\83\81\83\93\83g\95\\8e¦\97Ì\88æ
+ RECT timeViewRect = headerRect[CCommentView::TIME]; //\8e\9e\8aÔ\95\\8e¦\97Ì\88æ
+ RECT infoViewRect = headerRect[CCommentView::INFO]; //\83R\83\81\83\93\83g\8fî\95ñ\95\\8e¦\97Ì\88æ
//
COLORREF bkColor; //\94w\8ci\90F
- COLORREF sellLineColor; //\98g\90ü\90F
- CPen sellLinePen; //\98g\90ü\95`\89æ\97p\83y\83\93
- CPen collLinePen; //\8d\80\96Ú\8fc\90ü\95`\89æ\97p\83y\83\93
- CBrush bkBrush; //\94w\8ci\95`\89æ\97p\83u\83\89\83V
- collLinePen.CreatePen(PS_SOLID,1,self.viewproperty.colLineColor);
-
-
+ CPen originSellLinePen; //\98g\90ü\95`\89æ\97p\83y\83\93
+ CBrush originBkBrush; //\94w\8ci\95`\89æ\97p\83u\83\89\83V
+
//\91I\91ð\8fó\91Ô\82©\83`\83F\83b\83N
if (chatData.viewData.selectFlag == TRUE)
{
bkColor = self.viewproperty.selectBackColor;
- sellLineColor = self.viewproperty.selectSellLineColor;
+
+ dc.SelectBrush(this->selectBkBrush);
+ dc.SelectPen(this->selectSellLinePen);
}
else
{
- sellLineColor = chatData.viewData.sellLineColor == CChatData::ViewData::INIT_COLOR ? self.viewproperty.normalSellLineColor : chatData.viewData.sellLineColor;
+ if(chatData.viewData.sellLineColor == CChatData::ViewData::INIT_COLOR){
+ dc.SelectPen(this->normalSellLinePen);
- if(chatData.viewData.backColor != CChatData::ViewData::INIT_COLOR){
-
- bkColor = chatData.viewData.backColor;
+ } else {
- }else if(chatData.listenerData->originBkFlag == TRUE){
+ originSellLinePen.CreatePen(PS_SOLID,1,chatData.viewData.sellLineColor);
+ dc.SelectPen(originSellLinePen);
+ }
- bkColor = chatData.listenerData->bkColor;
+
+ if(chatData.viewData.backColor != CChatData::ViewData::INIT_COLOR || chatData.listenerData->originBkFlag == TRUE){
+
+ if(chatData.viewData.backColor != CChatData::ViewData::INIT_COLOR){
+ bkColor = chatData.viewData.backColor;
+ originBkBrush.CreateSolidBrush(chatData.viewData.backColor);
+
+ }else if(chatData.listenerData->originBkFlag == TRUE){
+ bkColor = chatData.listenerData->bkColor;
+ originBkBrush.CreateSolidBrush(chatData.listenerData->bkColor);
+
+ }
+
+ dc.SelectBrush(originBkBrush);
} else {
bkColor = self.viewproperty.backColor;
-
+ dc.SelectBrush(this->normalBkBrush);
+ dc.SelectBrush(this->normalBkBrush);
}
}
//\94w\8ci\82Æ\98g\90ü\82ð\95`\89æ
- sellLinePen.CreatePen(PS_SOLID,1,sellLineColor);
- bkBrush.CreateSolidBrush(bkColor);
- dc.SelectPen(sellLinePen);
- dc.SelectBrush(bkBrush);
+
+
dc.Rectangle(rc.left,rc.top - 1,rc.right ,rc.bottom + 1);
dc.SetBkColor(bkColor);
- dc.SetTextColor(chatData.viewData.stringColor == CChatData::ViewData::INIT_COLOR ? chatData.viewData.stringColor :self.viewproperty.baseStringColor);
+
//\95`\89æ\83T\83C\83Y\82ð\8cv\8eZ
- self.m_header.GetItemRect(CCommentView::NO,&noViewRect);
- self.m_header.GetItemRect(CCommentView::USERNAME,&userNameViewRect);
- self.m_header.GetItemRect(CCommentView::COMMENT,&chatViewRect);
- self.m_header.GetItemRect(CCommentView::TIME,&timeViewRect);
- self.m_header.GetItemRect(CCommentView::INFO,&infoViewRect);
-
- noViewRect.left += SELL_SPACE_LENGTH;
- userNameViewRect.left += SELL_SPACE_LENGTH;
- timeViewRect.left += SELL_SPACE_LENGTH;
- chatViewRect.left += SELL_SPACE_LENGTH;
- infoViewRect.left += SELL_SPACE_LENGTH;
-
- noViewRect.right -= SELL_SPACE_LENGTH;
- userNameViewRect.right -= SELL_SPACE_LENGTH;
- timeViewRect.right -= SELL_SPACE_LENGTH;
- chatViewRect.right -= SELL_SPACE_LENGTH;
- infoViewRect.right -= SELL_SPACE_LENGTH;
-
- noViewRect.top = rc.top + SELL_SPACE_LENGTH;
- userNameViewRect.top = rc.top + SELL_SPACE_LENGTH;
- timeViewRect.top = rc.top + SELL_SPACE_LENGTH;
- chatViewRect.top = rc.top + SELL_SPACE_LENGTH;
- infoViewRect.top = rc.top + SELL_SPACE_LENGTH;
-
- noViewRect.bottom = rc.bottom - SELL_SPACE_LENGTH;
- userNameViewRect.bottom = rc.bottom - SELL_SPACE_LENGTH;
- timeViewRect.bottom = rc.bottom - SELL_SPACE_LENGTH;
- chatViewRect.bottom = rc.bottom - SELL_SPACE_LENGTH;
- infoViewRect.bottom = rc.bottom - SELL_SPACE_LENGTH;
-
- //\8d\80\96Ú\82Ì\8fc\90ü\82ð\95`\89æ
- dc.SelectPen(collLinePen);
- dc.MoveTo(noViewRect.right,rc.top);
- dc.LineTo(noViewRect.right,rc.bottom);
- dc.MoveTo(userNameViewRect.right,rc.top);
- dc.LineTo(userNameViewRect.right,rc.bottom);
- dc.MoveTo(chatViewRect.right,rc.top);
- dc.LineTo(chatViewRect.right,rc.bottom);
- dc.MoveTo(timeViewRect.right,rc.top);
- dc.LineTo(timeViewRect.right,rc.bottom);
-
+
+
+
+ dc.SelectFont(linkFont);
+ dc.SetTextColor(self.viewproperty.linkStringColor);
//\83e\83L\83X\83g\95`\89æ
dc.DrawTextW(noString,_tcslen(noString),&noViewRect,DT_WORD_ELLIPSIS);
dc.DrawTextW(chatData.listenerData->user_id,chatData.listenerData->user_id.Length(),&userNameViewRect,DT_WORD_ELLIPSIS);
- dc.DrawTextW(chatData.chatBuf,chatData.chatBuf.Length(),&chatViewRect,DT_WORDBREAK | DT_EDITCONTROL);
+
+ dc.SelectFont(::AtlGetDefaultGuiFont());
+ dc.SetTextColor(chatData.viewData.stringColor == CChatData::ViewData::INIT_COLOR ? chatData.viewData.stringColor :self.viewproperty.baseStringColor);
dc.DrawTextW(dateString,_tcslen(dateString),&timeViewRect,DT_WORD_ELLIPSIS);
return;
}
+ BOOL CCommentListWindow::IsOnNoOrUserName(UINT_PTR index,const POINT &point){
+
+ POINT mousePoint = {0};
+ RECT rc = {0};
+
+ self.m_header.GetItemRect(index,&rc);
+ BOOL rslt = FALSE;
+
+
+ if((mousePoint.x >= rc.left && mousePoint.x <= rc.right) && (point.y < static_cast<INT_PTR>(viewSellHeight))){
+
+ INT_PTR heightsum = 0;
+ auto clickData = self.commentlist.GetShortCut();
+ auto endData = self.commentlist.end();
+ for(;clickData != endData;++clickData){
+
+ heightsum += clickData->viewData.height;
+
+ if(heightsum > point.y){
+
+ CDC cdc = this->GetDC();
+
+ rc.top = heightsum -= clickData->viewData.height;
+ SIZE stringSize;
+ //rc.bottom = rc.bottom;
+ cdc.SelectFont(linkFont);
+ ::GetTextExtentPoint32(cdc,clickData->chatBuf,clickData->chatBuf.Length(),&stringSize);
+ //cdc.DrawTextW(clickData->chatBuf,clickData->chatBuf.Length(),&rc,DT_CALCRECT | DT_WORD_ELLIPSIS);
+ rc.bottom += stringSize.cy;
+ rc.right += stringSize.cx;
+ dumpln(TEXT("rc.right :%d"),rc.right);
+ rslt = point.y >= rc.top && point.y <= rc.bottom && point.x >= rc.left && point.x <= rc.right;
+
+ break;
+
+ }
+ }
+
+ }
+
+ return rslt;
+
+ }
+
VOID CCommentListWindow::OnLButtonDown(UINT wParam, _WTYPES_NS::CPoint &point){
LRESULT CCommentListWindow::OnSetCursor(HWND wparam,UINT loLparam,UINT hiLparam){
POINT mousePoint = {0};
- RECT noRect = {0};
- RECT userRect = {0};
- self.m_header.GetItemRect(CCommentView::NO,&noRect);
- self.m_header.GetItemRect(CCommentView::USERNAME,&userRect);
+
GetCursorPos(&mousePoint);
::ScreenToClient(*this,&mousePoint);
- if(((mousePoint.x >= noRect.left && mousePoint.x <= noRect.right) || (mousePoint.x >= userRect.left && mousePoint.x <= userRect.right))&&
- mousePoint.y <= static_cast<INT_PTR>(viewSellHeight) &&
- static_cast<INT>(loLparam) == 1){
+
+ if(static_cast<INT>(loLparam) == 1 &&( IsOnNoOrUserName(CCommentView::NO,mousePoint) || IsOnNoOrUserName(CCommentView::USERNAME,mousePoint))){
- dumpln(TEXT("\8ew"));
::SetCursor(::LoadCursorW(NULL,IDC_HAND));
} else {
_WTYPES_NS::CPoint point(windowrect.left + LOWORD(pmf->lParam),windowrect.top + HIWORD(pmf->lParam));
::ScreenToClient(*this,&point);
- if(pmf->msg == WM_LBUTTONDOWN)OnLButtonDown(pmf->wParam,point);
- else if( pmf->msg== WM_LBUTTONDBLCLK)this->OnLButtonDblClk(pmf->wParam,point);
- else if( pmf->msg == WM_MOUSEWHEEL)OnMouseWheel(LOWORD(pmf->wParam),HIWORD(pmf->wParam),point);
+ switch(pmf->msg){
+
+ case WM_LBUTTONDOWN:
+ OnLButtonDown(pmf->wParam,point);
+ break;
+
+ case WM_LBUTTONDBLCLK:
+ OnLButtonDblClk(pmf->wParam,point);
+ break;
+
+ case WM_MOUSEWHEEL:
+ OnMouseWheel(LOWORD(pmf->wParam),HIWORD(pmf->wParam),point);
+ break;
+
+ default:
+
+ break;
+ }
+
}
auto pReqResize = reinterpret_cast <REQRESIZE *>(lParam);
::SetWindowPos(pReqResize->nmhdr.hwndFrom,NULL,0,0,pReqResize->rc.right - pReqResize->rc.left,pReqResize->rc.bottom - pReqResize->rc.top,SWP_NOZORDER | SWP_NOMOVE | SWP_HIDEWINDOW);
- //calcRc = pReqResize->rc;
return 0;
}