OSDN Git Service

コメ番、ユーザ名のマウスカーソル変更処理
authorqwerty2501 <riot313@gmail.com>
Thu, 2 Feb 2012 15:23:08 +0000 (00:23 +0900)
committerqwerty2501 <riot313@gmail.com>
Thu, 2 Feb 2012 15:23:08 +0000 (00:23 +0900)
nlite.suo
nlite/nlite_commentview.cpp
nlite/nlite_commentview.h
nlite/nlite_mainframe.h

index aa5db29..5424a50 100644 (file)
Binary files a/nlite.suo and b/nlite.suo differ
index 91c8f49..8fc7148 100644 (file)
@@ -281,11 +281,11 @@ namespace nlite{
 
        VOID CCommentView::OnConnect(){
                m_commentListWindow.SetRedraw(FALSE);
+               m_commentListWindow.ResetViewSellHeight();
 
-#ifdef USE_RICHEDIT
                chatChildCtrlsList.AllHide();
 
-#endif
+
                commentlist.OnConnect();
 
                SCROLLINFO vScrollInfo = {0};
@@ -783,7 +783,8 @@ namespace nlite{
        ////////////////////////////////////////////////////////////////////
 
        CCommentListWindow::CCommentListWindow(CCommentView &in_self):
-       self(in_self)
+       self(in_self),
+       viewSellHeight(0)
        {}
 
        CCommentListWindow::~CCommentListWindow(){
@@ -860,7 +861,7 @@ namespace nlite{
                                        listRect.top = listRect.bottom;
                                }
 
-       
+                               viewSellHeight = listRect.bottom;
                                
 
                                if(selectFlag == TRUE){
@@ -1094,6 +1095,12 @@ overclientrect:
                return;
        }
 
+       VOID CCommentListWindow::ResetViewSellHeight(){
+
+               viewSellHeight = 0;
+
+               return;
+       }
 
 
        VOID CCommentListWindow::ShowCurSel(){
@@ -1160,7 +1167,8 @@ end:
                CCommentList::iterator chatData = self.commentlist.GetShortCut();
                CCommentList::iterator end  = self.commentlist.end();
 
-       
+
+               
                for(; chatData != end ;(++chatData)){
                        CalcItemHeight(*chatData);
                        heightSum += chatData->viewData.height;
@@ -1206,42 +1214,45 @@ end:
 
 
 
-               if(point.x > (INT_PTR)self.GetColumnHolSizeSum()) return;
-               auto end  = self.commentlist.end();
-               auto lineIte = CalcClickLine(point.y);
-               if( lineIte == end)return;
+               if(!(point.x > (INT_PTR)self.GetColumnHolSizeSum() || self.commentlist.empty() == TRUE)){
                
+                       auto end  = self.commentlist.end();
+                       auto lineIte = CalcClickLine(point.y);
+                       if( lineIte == end)goto  endlabel;
                
-               COLORREF bkColor;
-               if(lineIte->listenerData->originBkFlag == FALSE){
-                       CListenerColorCollector colorCollector;
-                       listenerList.BkColorCollect(colorCollector);
-                       UCHAR red;
-                       UCHAR green;
-                       UCHAR blue;
-
-                       srand((unsigned int)time(NULL));
-                       do{
-
-                               red = getrgb();
-                               green = getrgb();
-                               blue = getrgb();
-                               bkColor = PALETTERGB(red,green,blue);
-
-                       }while(colorCollector.Find(bkColor));
-
-                       lineIte->listenerData->originBkFlag = TRUE;
-                       lineIte->listenerData->SetBkColor(bkColor);
-               } else {
+               
+                       COLORREF bkColor;
+                       if(lineIte->listenerData->originBkFlag == FALSE){
+                               CListenerColorCollector colorCollector;
+                               listenerList.BkColorCollect(colorCollector);
+                               UCHAR red;
+                               UCHAR green;
+                               UCHAR blue;
+
+                               srand((unsigned int)time(NULL));
+                               do{
+
+                                       red = getrgb();
+                                       green = getrgb();
+                                       blue = getrgb();
+                                       bkColor = PALETTERGB(red,green,blue);
+
+                               }while(colorCollector.Find(bkColor));
+
+                               lineIte->listenerData->originBkFlag = TRUE;
+                               lineIte->listenerData->SetBkColor(bkColor);
+                       } else {
 
 
-                       lineIte->listenerData->originBkFlag = FALSE;
+                               lineIte->listenerData->originBkFlag = FALSE;
+                       }
                }
 
 
 
 
 
+endlabel:
 
 
                this->Invalidate(TRUE);
@@ -1292,6 +1303,35 @@ end:
                return;
        }
 
+       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){
+                       
+                       dumpln(TEXT("\8ew"));
+                       ::SetCursor(::LoadCursorW(NULL,IDC_HAND));
+
+               } else {
+
+                       DefWindowProc ();
+
+               }
+               
+
+               
+       
+
+               return FALSE;
+       }
+
        LRESULT CCommentListWindow::OnMouseWheel(UINT loWparam,SHORT hiWparam,CPoint &point){
 
 
index 6f861d5..4540bbf 100644 (file)
@@ -138,6 +138,7 @@ namespace nlite{
                //\83\81\83\93\83o
        private:
                CCommentView &self;
+               UINT_PTR viewSellHeight;
                enum {
                        CALCEDIT_ID = 100
 
@@ -161,6 +162,7 @@ namespace nlite{
                        MSG_WM_PAINT(OnPaint)
                        MSG_WM_SIZE(OnSize)
                        MSG_WM_KEYDOWN(OnKeyDown)
+                       MSG_WM_SETCURSOR(OnSetCursor)
                        MESSAGE_HANDLER_EX(UM_COMMENTVIEW_SETCTRL,OnSetCtrol)
                        NOTIFY_ID_HANDLER_EX(CChatChildCtrls::CHAT_DISPCTRL_ID,OnChatControlNortify)
                        NOTIFY_HANDLER_EX(CALCEDIT_ID,EN_REQUESTRESIZE,OnCalcSellSize)
@@ -207,7 +209,10 @@ namespace nlite{
                ///
                VOID DrawItem(CDC &dc,const RECT &rc,CChatData &chatData);
 
-
+               ///
+               ///\95`\89æ\8d\82\82³\82ð\83\8a\83Z\83b\83g
+               ///
+               VOID ResetViewSellHeight();
                
 
                ///
@@ -263,6 +268,10 @@ namespace nlite{
                ///
                VOID OnKeyDown(TCHAR vKey,UINT loLParam,UINT hiLParam);
 
+               ///
+               ///\83J\81[\83\\83\8b\95Ï\8dX\8f\88\97\9d
+               ///
+               LRESULT OnSetCursor(HWND wparam,UINT loLparam,UINT hiLparam);
 
                ///
                ///\83`\83\83\83b\83g\83R\83\93\83g\83\8d\81[\83\8b\92Ê\92m
index 6c49658..901166b 100644 (file)
@@ -186,6 +186,7 @@ namespace nlite{
                CMultiPaneStatusBarCtrl m_hStatusBar;           //\83}\83\8b\83`\83y\83C\83\93\83X\83e\81[\83^\83X\83o\81[
                CProgressBarCtrl  m_progresBar;                         //\83v\83\8d\83O\83\8c\83X\83o\81[
                
+               
        private:
                // \83\81\83b\83Z\81[\83W\83t\83B\83\8b\83^\8f\88\97\9d
                virtual BOOL PreTranslateMessage(MSG* pMsg);