示例#1
0
ProcessResult CaptchaListener::blockArrived(JabberDataBlockRef block, const ResourceContextRef rc){

    JabberDataBlockRef challenge=block->findChildNamespace("challenge", "urn:xmpp:tmp:challenge");

    if (!challenge) return BLOCK_REJECTED;

    JabberDataBlockRef xdata=challenge->findChildNamespace("x", "jabber:x:data");

    const std::string &jid=block->getAttribute("from");
    const std::string &id=block->getAttribute("id");

    CaptchaForm::ref rform=CaptchaForm::createCaptchaForm(tabs->getHWnd(), jid, id, rc);
    
    tabs->addWindow(rform);
    tabs->switchByWndRef(rform);

    rform->bindXData(xdata);

    return BLOCK_PROCESSED;
}
LRESULT CALLBACK VirtualListView::WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) {
    VirtualListView *p=(VirtualListView *) GetWindowLong(hWnd, GWL_USERDATA);
 int klav=0;
    switch (message) {
    case WM_CREATE:
        {
            p=(VirtualListView *) (((CREATESTRUCT *)lParam)->lpCreateParams);
            SetWindowLong(hWnd, GWL_USERDATA, (LONG) p );

            //p->listScrollHWND=CreateWindow(_T("SCROLLBAR"), NULL, 
            //    SBS_VERT | WS_VISIBLE | WS_CHILD,
            //    0, 0, CW_USEDEFAULT, CW_USEDEFAULT, 
            //    hWnd, NULL, g_hInst, NULL); 

            break;

        }

    case WM_PAINT:

        {
            PAINTSTRUCT ps;
            HDC hdc;
            HDC wnd;
            wnd = BeginPaint(hWnd, &ps);

            HBITMAP buf=CreateCompatibleBitmap(wnd, p->clientRect.right, p->clientRect.bottom);

            hdc=CreateCompatibleDC(NULL);
            SelectObject(hdc, buf);

            PatBlt(hdc, 0, 0, p->clientRect.right, p->clientRect.bottom, WHITENESS);
            // TODO: Add any drawing code here...

            SetBkMode(hdc, OPAQUE);

            int y=-p->winTop;
            int index=0;

            if (p->odrlist.get()) {
                ODRList::const_iterator i=p->odrlist->begin();
                while (i!=p->odrlist->end()) {
                    ODRRef odr=*i; i++; 
                    bool oddIndex=(index & 1) && p->colorInterleaving;
                    index++;

                    bool focused = (odr.get()==p->cursorPos.get());

                    RECT ritem={0, y, p->clientRect.right, y} ;
                    odr->measure(hdc, ritem);
                    //int iHeight=odr->getHeight();
                    //y+=iHeight;
                    y=ritem.bottom;
                    //index++;

                    if (ritem.bottom < 0) continue;
                    if (ritem.top > p->clientRect.bottom) continue;

                    int bkColor=COLORS[12];
                    if (focused) {
                        // focused item
                        SetTextColor(hdc, COLORS[8]);
                        bkColor=(GetFocus()==hWnd)?COLORS[9]:COLORS[10];
                        //DrawFocusRect(hdc, &ritem);
                    } else {
                        //usual item
                        SetTextColor(hdc, odr->getColor());
                        bkColor= (oddIndex)? COLORS[11] : COLORS[12];
                    }
                    HBRUSH bkBrush=CreateSolidBrush(bkColor);
                    SetBkColor(hdc, bkColor);
                    ritem.right=p->clientRect.right; //full window-wide cursor
                    FillRect(hdc, &ritem, bkBrush);
                    DeleteObject(bkBrush);
                    odr->draw(hdc, ritem);
                }
            }

            RECT rc = {0, 0, 100, 100};

            SCROLLINFO si;
            si.cbSize=sizeof(SCROLLINFO);
            si.fMask=SIF_PAGE |SIF_POS |SIF_RANGE;
            si.nPage=p->clientRect.bottom;
            si.nPos=p->winTop;
            si.nMin=0;
            si.nMax=y+p->winTop;

            SetScrollInfo(p->thisHWnd, SB_VERT, &si, TRUE);

            /*int titleBgnd=0x808080;
            HBRUSH tb=CreateSolidBrush(titleBgnd);
            SetBkColor(hdc, titleBgnd);
            SetTextColor(hdc, 0x000000);

            LPCTSTR t=p->title.c_str();
            DrwText(hdc, t, -1, &rc, DT_CALCRECT | DT_LEFT | DT_TOP);
            rc.right=p->clientRect.right;
            FillRect(hdc, &rc, tb);
            DrwText(hdc, t, -1, &rc, DT_LEFT | DT_TOP);
            DeleteObject(tb);*/

            BitBlt(wnd, 0,0,p->clientRect.right, p->clientRect.bottom, hdc, 0,0, SRCCOPY);
            DeleteDC(hdc);
            DeleteObject(buf);

            EndPaint(hWnd, &ps);
            break;
        }

    case WM_SIZE: 
        { 
            //HDWP hdwp; 

            int height=GET_Y_LPARAM(lParam);
            int width=GET_X_LPARAM(lParam);
            // Calculate the display rectangle, assuming the 
            // tab control is the size of the client area. 
            SetRect(&(p->clientRect), 0, 0, width, height ); 

            /*hdwp = BeginDeferWindowPos(1);

            DeferWindowPos(hdwp, p->listScrollHWND, HWND_TOP, width-SCROLLWIDTH, tabHeight, 
            SCROLLWIDTH, height-tabHeight, 
            SWP_NOZORDER 
            );
            EndDeferWindowPos(hdwp); */

            p->cursorFit();
            SCROLLINFO si;
            si.cbSize=sizeof(SCROLLINFO);
            si.fMask=SIF_PAGE |SIF_POS;
            si.nPage=height;
            si.nPos=p->winTop;

            SetScrollInfo(p->thisHWnd, SB_VERT, &si, TRUE);

            break; 
        } 

    case WM_LBUTTONDOWN:
        {
            SetFocus(hWnd);
            ODRRef focused=p->moveCursorTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
            if (!(focused)) break;
            InvalidateRect(p->getHWnd(), NULL, true);

            SHRGINFO    shrg;
            shrg.cbSize = sizeof(shrg);
            shrg.hwndClient = hWnd;
            shrg.ptDown.x = LOWORD(lParam);
            shrg.ptDown.y = HIWORD(lParam);
            shrg.dwFlags = SHRG_RETURNCMD /*| SHRG_NOANIMATION*/;

            if (SHRecognizeGesture(&shrg) == GN_CONTEXTMENU) {

                HMENU hmenu = p->getContextMenu();

                VirtualListElement *velement=dynamic_cast<VirtualListElement *>(focused.get());
                if (velement) hmenu=velement->getContextMenu(hmenu);

                if (hmenu==NULL) break;

                POINT pt={LOWORD(lParam), HIWORD(lParam) };
                ClientToScreen(hWnd, &pt);
                int cmdId=TrackPopupMenuEx(hmenu,
                    /*TPM_LEFTALIGN |*/ TPM_TOPALIGN | TPM_RETURNCMD, 
                    pt.x, pt.y,
                    hWnd,
                    NULL);

                bool cmdProcessed=false;
                if (velement) 
					cmdProcessed=velement->OnMenuCommand(cmdId, p->getHWnd(), p->hEditBox);

                if (!cmdProcessed)
                    p->OnCommand(cmdId, NULL);

                DestroyMenu(hmenu);
            }
            break;
        }
    case WM_LBUTTONDBLCLK:
        {
            ODRRef oldCursor=p->cursorPos;
            ODRRef focused=p->moveCursorTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
            if (!(focused)) break;
            InvalidateRect(p->getHWnd(), NULL, true);
            if (focused==oldCursor) p->eventOk();
            break;
        }

    case WM_SETFOCUS:
    case WM_KILLFOCUS:
        {
            InvalidateRect(p->getHWnd(), NULL, true);
            break;
        }
    case WM_KEYDOWN:
        {bool kl2=1;
          int vKey=(int)wParam;
            int lkeyData=lParam;
            if (lkeyData & 0x80000000) break; //keyRelease 
            switch (vKey) {
                        /* UFO START */
                        
                        case VK_RIGHT:
                                PostMessage(tabs->getHWnd(), WM_COMMAND, TabsCtrl::NEXTTAB, 0);
                                break;

						case VK_3:kl2=0;
                              //  MessageBox(hWnd, TEXT("Clicked 3"), TEXT("!"), 0);
                               SCROLLINFO si2;
            si2.cbSize=sizeof(SCROLLINFO);
            si2.fMask=SIF_ALL;

            GetScrollInfo(p->thisHWnd, SB_VERT, &si2);

            //TODO: flicker-free scrolling
          
           /* case SB_LINEDOWN: *///  si2.nPos+=tabHeight; break;
            //case SB_LINEUP:    
			si2.nPos-=tabHeight; 
            //case SB_ENDSCROLL:  break;
            /*//case SB_PAGEUP:    */// si2.nPos-=si2.nPage; 
            //case SB_PAGEDOWN:   si2.nPos+=si2.nPage;  break;
           
      


            if (si2.nPos<0) si2.nPos=0; 
            if (si2.nPos+(int)si2.nPage >= si2.nMax) si2.nPos=si2.nMax-si2.nPage; 

            p->winTop= si2.nPos;

            //TODO: flicker-free scrolling
            InvalidateRect(p->getHWnd(), NULL, true);

            si2.fMask=SIF_POS;
            SetScrollInfo(p->thisHWnd, SB_VERT, &si2, TRUE); 
							break;
								
						case VK_9:kl2=0;
                                SCROLLINFO si3;
            si3.cbSize=sizeof(SCROLLINFO);
            si3.fMask=SIF_ALL;

            GetScrollInfo(p->thisHWnd, SB_VERT, &si3);

            //TODO: flicker-free scrolling
          
           /* case SB_LINEDOWN: *///  
			si3.nPos+=tabHeight; 
            //case SB_LINEUP:    si2.nPos-=tabHeight; 
            //case SB_ENDSCROLL:  break;
            /*//case SB_PAGEUP:    */// si2.nPos-=si2.nPage; 
            //case SB_PAGEDOWN:   si2.nPos+=si2.nPage;  break;
           
      


            if (si3.nPos<0) si3.nPos=0; 
            if (si3.nPos+(int)si3.nPage >= si3.nMax) si3.nPos=si3.nMax-si3.nPage; 

            p->winTop= si3.nPos;

            //TODO: flicker-free scrolling
            InvalidateRect(p->getHWnd(), NULL, true);

            si3.fMask=SIF_POS;
            SetScrollInfo(p->thisHWnd, SB_VERT, &si3, TRUE); 
							break;
							// MessageBox(hWnd, TEXT("Clicked 3"), TEXT("!"), 0);
                               
                        case VK_LEFT:
                                PostMessage(tabs->getHWnd(), WM_COMMAND, TabsCtrl::PREVTAB, 0);
                                break;
                        /* UFO END */
                        case VK_UP:
                p->moveCursor(-1);
                break;
				case VK_DOWN: 
                p->moveCursor(1);
                break;

           


                        case VK_RETURN:
                if (lkeyData &0xc0000000) break;
                p->eventOk();
                                break;
			}
            if(kl2)p->cursorFit();
            InvalidateRect(p->getHWnd(), NULL, true);


            SCROLLINFO si;
            si.cbSize=sizeof(SCROLLINFO);
            si.nPos=p->winTop;
            si.fMask=SIF_POS;
            SetScrollInfo(p->thisHWnd, SB_VERT, &si, TRUE);


            break;
        }
    case WM_VSCROLL:
        {
            int scrollCode=(int)LOWORD(wParam);
            int nPos=(int)HIWORD(wParam);

            SCROLLINFO si;
            si.cbSize=sizeof(SCROLLINFO);
            si.fMask=SIF_ALL;

            GetScrollInfo(p->thisHWnd, SB_VERT, &si);

            //TODO: flicker-free scrolling
            switch (scrollCode) {
            case SB_LINEDOWN:   si.nPos+=tabHeight; break;
            case SB_LINEUP:     si.nPos-=tabHeight; break;
            case SB_ENDSCROLL:  break;
            case SB_PAGEUP:     si.nPos-=si.nPage;  break;
            case SB_PAGEDOWN:   si.nPos+=si.nPage;  break;
            case SB_THUMBTRACK:
            case SB_THUMBPOSITION: si.nPos=si.nTrackPos; break;
            //default:            si.nPos=si.nTrackPos; break;
            }


            if (si.nPos<0) si.nPos=0; 
            if (si.nPos+(int)si.nPage >= si.nMax) si.nPos=si.nMax-si.nPage; 

            p->winTop= si.nPos;

            //TODO: flicker-free scrolling
            InvalidateRect(p->getHWnd(), NULL, true);

            si.fMask=SIF_POS;
            SetScrollInfo(p->thisHWnd, SB_VERT, &si, TRUE);
            return true;

        }

    case WM_COMMAND: 
        {
            int cmdId=LOWORD(wParam);
            p->OnCommand(cmdId, lParam);
            break;
        }

    case WM_VIRTUALLIST_REPLACE:
        {
            //TODO: create interconnecting message object to avoid pointers
            ODRListRef r=ODRListRef((ODRList *)lParam);
            p->bindODRList(r); //юурсмц ╧5

            //p->bindODRList(ODRSet::ref((ODRSet *)lParam)); //юурсмц ╧3
            p->notifyListUpdate(true);
            break;
        }

    case WM_DESTROY:
        //TODO: Destroy all child data associated eith this window

        return 0;

    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}
示例#3
0
LRESULT CALLBACK VirtualListView::WndProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam ) {
    VirtualListView *p=(VirtualListView *) GetWindowLong(hWnd, GWL_USERDATA);
 int klav=0;
 lParamst=lParam;
//printf(" \nmess: 0x%06X  x:%d  y:%d",message,GET_X_LPARAM(lParam),GET_Y_LPARAM(lParam));
    switch (message) {
    case WM_CREATE:
        {
            p=(VirtualListView *) (((CREATESTRUCT *)lParam)->lpCreateParams);
            SetWindowLong(hWnd, GWL_USERDATA, (LONG) p );

            //p->listScrollHWND=CreateWindow(_T("SCROLLBAR"), NULL, 
            //    SBS_VERT | WS_VISIBLE | WS_CHILD,
            //    0, 0, CW_USEDEFAULT, CW_USEDEFAULT, 
            //    hWnd, NULL, g_hInst, NULL); 

            break;

        }

	case CLEARMESS:
		{/*int result=MessageBox(
				p->getHWnd(), 
				L"ќчистить окно от сообщений?", 
				L"ќчистить", 
				MB_YESNO | MB_ICONWARNING);*/
		PostMessage(p->parentHWnd, CLEARMESS, NULL, false);}

    case WM_PAINT:

        {
            PAINTSTRUCT ps;
            HDC hdc;
            HDC wnd;
            wnd = BeginPaint(hWnd, &ps);

            HBITMAP buf=CreateCompatibleBitmap(wnd, p->clientRect.right, p->clientRect.bottom);

            hdc=CreateCompatibleDC(NULL);
            SelectObject(hdc, buf);

            PatBlt(hdc, 0, 0, p->clientRect.right, p->clientRect.bottom, WHITENESS);
            // TODO: Add any drawing code here...

            SetBkMode(hdc, OPAQUE);

            int y=-p->winTop;
            int index=0;
		
            if (p->odrlist.get()) {
                ODRList::const_iterator i=p->odrlist->begin();
                while (i!=p->odrlist->end()) {
                    ODRRef odr=*i; i++; 
                    bool oddIndex=(index & 1) && p->colorInterleaving;
                    index++;

                    bool focused = (odr.get()==p->cursorPos.get());

                    RECT ritem={0, y, p->clientRect.right, y} ;
                    odr->measure(hdc, ritem);
                    //int iHeight=odr->getHeight();
                    //y+=iHeight;
                    y=ritem.bottom;
                    //index++;

                    if (ritem.bottom < 0) continue;
                    if (ritem.top > p->clientRect.bottom) continue;

                    int bkColor=COLORS[12];
                    if (focused) {
                        // focused item
                        SetTextColor(hdc, COLORS[8]);
                        bkColor=(GetFocus()==hWnd)?COLORS[9]:COLORS[10];
                        //DrawFocusRect(hdc, &ritem);
                    } else {
                        //usual item
                        SetTextColor(hdc, odr->getColor());
                        bkColor= (oddIndex)? COLORS[11] : COLORS[12];
                    }
                    HBRUSH bkBrush=CreateSolidBrush(bkColor);
                    SetBkColor(hdc, bkColor);
                    ritem.right=p->clientRect.right; //full window-wide cursor
                    FillRect(hdc, &ritem, bkBrush);
                    DeleteObject(bkBrush);
                    odr->draw(hdc, ritem,1);
                }
            }

            RECT rc = {0, 0, 100, 100};

            SCROLLINFO si;
            si.cbSize=sizeof(SCROLLINFO);
            si.fMask=SIF_PAGE |SIF_POS |SIF_RANGE;
            si.nPage=p->clientRect.bottom;
            si.nPos=p->winTop;
            si.nMin=0;
            si.nMax=y+p->winTop;

            SetScrollInfo(p->thisHWnd, SB_VERT, &si, TRUE);

            /*int titleBgnd=0x808080;
            HBRUSH tb=CreateSolidBrush(titleBgnd);
            SetBkColor(hdc, titleBgnd);
            SetTextColor(hdc, 0x000000);

            LPCTSTR t=p->title.c_str();
            DrwText(hdc, t, -1, &rc, DT_CALCRECT | DT_LEFT | DT_TOP);
            rc.right=p->clientRect.right;
            FillRect(hdc, &rc, tb);
            DrwText(hdc, t, -1, &rc, DT_LEFT | DT_TOP);
            DeleteObject(tb);*/

            BitBlt(wnd, 0,0,p->clientRect.right, p->clientRect.bottom, hdc, 0,0, SRCCOPY);
            DeleteDC(hdc);
            DeleteObject(buf);

            EndPaint(hWnd, &ps);
            break;
        }

    case WM_SIZE: 
        { 
            //HDWP hdwp; 

            int height=GET_Y_LPARAM(lParam);
            int width=GET_X_LPARAM(lParam);
            // Calculate the display rectangle, assuming the 
            // tab control is the size of the client area. 
            SetRect(&(p->clientRect), 0, 0, width, height ); 

            /*hdwp = BeginDeferWindowPos(1);

            DeferWindowPos(hdwp, p->listScrollHWND, HWND_TOP, width-SCROLLWIDTH, tabHeight, 
            SCROLLWIDTH, height-tabHeight, 
            SWP_NOZORDER 
            );
            EndDeferWindowPos(hdwp); */

            p->cursorFit();
            SCROLLINFO si;
            si.cbSize=sizeof(SCROLLINFO);
            si.fMask=SIF_PAGE |SIF_POS;
            si.nPage=height;
            si.nPos=p->winTop;

            SetScrollInfo(p->thisHWnd, SB_VERT, &si, TRUE);

            break; 
        } 

	case MSGListFocus:
		{
			SetFocus(hWnd);
			break;
		}


    case WM_LBUTTONDOWN:
		{	smile_aktiv=40;
			xmouse=GET_X_LPARAM(lParam);
			ymouse=GET_Y_LPARAM(lParam);
			movemode=0;//неопределили пока
			zaderzhka=0;
			xmouse_d=0;
			ymouse_d=0;
			taptrue=1;
			if(movetrue){break;}
			SetFocus(hWnd);
            ODRRef focused=p->moveCursorTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
            if (!(focused)) break;
            InvalidateRect(p->getHWnd(), NULL, true);
			
            SHRGINFO    shrg;
            shrg.cbSize = sizeof(shrg);
            shrg.hwndClient = hWnd;
            shrg.ptDown.x = LOWORD(lParam);
            shrg.ptDown.y = HIWORD(lParam);
            shrg.dwFlags = SHRG_RETURNCMD /*| SHRG_NOANIMATION*/;

			if (SHRecognizeGesture(&shrg) == GN_CONTEXTMENU) {

                HMENU hmenu = p->getContextMenu();

                VirtualListElement *velement=dynamic_cast<VirtualListElement *>(focused.get());
                if (velement) hmenu=velement->getContextMenu(hmenu);

                if (hmenu==NULL) break;

                POINT pt={LOWORD(lParam), HIWORD(lParam) };
                ClientToScreen(hWnd, &pt);
                int cmdId=TrackPopupMenuEx(hmenu,
                    /*TPM_LEFTALIGN |*/ TPM_TOPALIGN | TPM_RETURNCMD, 
                    pt.x, pt.y,
                    hWnd,
                    NULL);

                bool cmdProcessed=false;
                if (velement) 
					cmdProcessed=velement->OnMenuCommand(cmdId, p->getHWnd(), p->hEditBox);

                if (!cmdProcessed)
                    p->OnCommand(cmdId, NULL);

                DestroyMenu(hmenu);
			}else{
			//нажатие на иконки
				p->is_icon_klik(xmouse);
			}
			
            break;
        }
    case WM_LBUTTONDBLCLK:
        {  smile_aktiv=40 ;
            ODRRef oldCursor=p->cursorPos;
            ODRRef focused=p->moveCursorTo(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
            if (!(focused)) break;
            InvalidateRect(p->getHWnd(), NULL, true);
            if (focused==oldCursor) p->eventOk();
            break;
        }

    case WM_SETFOCUS:
    case WM_KILLFOCUS:
        {
            InvalidateRect(p->getHWnd(), NULL, true);
            break;
        }

	case WM_MOUSEMOVE:
		{//скролл тасканием 
			//movetrue=1;
			smile_aktiv=40 ;
			if(zaderzhka>0){
			printf("mode %d X: %d  Y: %d\n",movemode,xmouse_d,ymouse_d);
			
			if(movemode){
			//собственно само движение
				if(movemode==1){
				//верт
					if(ymouse_d<0){
					PostMessage(p->getHWnd(), WM_VSCROLL, SB_LINEDOWN, 0);
					//PostMessage(p->getHWnd(), WM_VSCROLL, SB_LINEDOWN, 0);
					}else{
					 PostMessage(p->getHWnd(), WM_VSCROLL, SB_LINEUP, 0);
					// PostMessage(p->getHWnd(), WM_VSCROLL, SB_LINEUP, 0);
					}
				}else{
				//гориз
					if (abs(xmouse_d)>50){
						if (xmouse_d<0){ PostMessage(tabs->getHWnd(), WM_COMMAND, TabsCtrl::NEXTTAB, 0);}
						else{PostMessage(tabs->getHWnd(), WM_COMMAND, TabsCtrl::PREVTAB, 0);}
						xmouse_d=0;
					}}
			
			
			}
			else     
			//определ¤ем movemode 1-вертик   2-гориз
			{int absx,absy;
			 absx=xmouse_d;absy=ymouse_d;
			 if(xmouse_d<0)absx=xmouse_d*(-1);
			 if(ymouse_d<0)absy=ymouse_d*(-1);
			 
				if(absx > absy){movemode=2;}else{movemode=1;}
				movetrue=1;taptrue=0;
				printf("mode %d ax: %d  ay: %d\n",movemode,absx,absy);
			}
		zaderzhka=0;ymouse_d=0;
			}else{zaderzhka++;
			xmouse_d=xmouse_d+GET_X_LPARAM(lParam)-xmouse;
			ymouse_d=ymouse_d+GET_Y_LPARAM(lParam)- ymouse;
			
			xmouse=GET_X_LPARAM(lParam);
			ymouse=GET_Y_LPARAM(lParam);
			}
		break;}
	case WM_LBUTTONUP:
		{if(movetrue==1 && taptrue==1){
			movetrue=0;
			PostMessage(p->getHWnd(), WM_LBUTTONDOWN, 0, lParamst);
		}
		break;
		}

    case WM_KEYDOWN:
        {bool kl2=1;
		smile_aktiv=40 ;
          int vKey=(int)wParam;
            int lkeyData=lParam;
            if (lkeyData & 0x80000000) break; //keyRelease 
            switch (vKey)
			{
				/* UFO START */
				case VK_5:
				{
					ODRRef focused=p->cursorPos;
					if (!(focused)) break;
					InvalidateRect(p->getHWnd(), NULL, true);
					HMENU hmenu = p->getContextMenu();
					VirtualListElement *velement=dynamic_cast<VirtualListElement *>(focused.get());
					if (velement) hmenu=velement->getContextMenu(hmenu);
					if (hmenu==NULL) break;
					POINT pt={LOWORD(lParam), HIWORD(lParam) };
					ClientToScreen(hWnd, &pt);
					int cmdId=TrackPopupMenuEx(hmenu,
						/*TPM_LEFTALIGN |*/ TPM_TOPALIGN | TPM_RETURNCMD, 
						pt.x, pt.y,
						hWnd,
						NULL);

					bool cmdProcessed=false;
					if (velement) 
						cmdProcessed=velement->OnMenuCommand(cmdId, p->getHWnd(), p->hEditBox);

					if (!cmdProcessed)
						p->OnCommand(cmdId, NULL);

					DestroyMenu(hmenu); break;
				}

                        case VK_RIGHT:
                                PostMessage(tabs->getHWnd(), WM_COMMAND, TabsCtrl::NEXTTAB, 0);
                                break;

						case VK_3:kl2=0;
                              //  MessageBox(hWnd, TEXT("Clicked 3"), TEXT("!"), 0);
                               SCROLLINFO si2;
            si2.cbSize=sizeof(SCROLLINFO);
            si2.fMask=SIF_ALL;

            GetScrollInfo(p->thisHWnd, SB_VERT, &si2);

            //TODO: flicker-free scrolling
          
           /* case SB_LINEDOWN: *///  si2.nPos+=tabHeight; break;
            //case SB_LINEUP:    
			si2.nPos-=tabHeight; 
            //case SB_ENDSCROLL:  break;
            /*//case SB_PAGEUP:    */// si2.nPos-=si2.nPage; 
            //case SB_PAGEDOWN:   si2.nPos+=si2.nPage;  break;
           
      


            if (si2.nPos<0) si2.nPos=0; 
            if (si2.nPos+(int)si2.nPage >= si2.nMax) si2.nPos=si2.nMax-si2.nPage; 

            p->winTop= si2.nPos;

            //TODO: flicker-free scrolling
            InvalidateRect(p->getHWnd(), NULL, true);

            si2.fMask=SIF_POS;
            SetScrollInfo(p->thisHWnd, SB_VERT, &si2, TRUE); 
							break;
								
						case VK_9:kl2=0;
                                SCROLLINFO si3;
            si3.cbSize=sizeof(SCROLLINFO);
            si3.fMask=SIF_ALL;

            GetScrollInfo(p->thisHWnd, SB_VERT, &si3);

            //TODO: flicker-free scrolling
          
           /* case SB_LINEDOWN: *///  
			si3.nPos+=tabHeight; 
            //case SB_LINEUP:    si2.nPos-=tabHeight; 
            //case SB_ENDSCROLL:  break;
            /*//case SB_PAGEUP:    */// si2.nPos-=si2.nPage; 
            //case SB_PAGEDOWN:   si2.nPos+=si2.nPage;  break;
           
      


            if (si3.nPos<0) si3.nPos=0; 
            if (si3.nPos+(int)si3.nPage >= si3.nMax) si3.nPos=si3.nMax-si3.nPage; 

            p->winTop= si3.nPos;

            //TODO: flicker-free scrolling
            InvalidateRect(p->getHWnd(), NULL, true);

            si3.fMask=SIF_POS;
            SetScrollInfo(p->thisHWnd, SB_VERT, &si3, TRUE); 
							break;
							// MessageBox(hWnd, TEXT("Clicked 3"), TEXT("!"), 0);
                               
                        case VK_LEFT:
                                PostMessage(tabs->getHWnd(), WM_COMMAND, TabsCtrl::PREVTAB, 0);
                                break;
                        /* UFO END */
                        case VK_UP:
                p->moveCursor(-1);
                break;
				case VK_DOWN: 
					/* UFO START */
					// переключаем фокус в поле ввода после второго нажати¤ кнопки вниз на последнем сообщении
					if (p->cursorAtEnd() && IsWindow(p->hEditBox) ) SetFocus(p->hEditBox);
					/* UFO END */
					p->moveCursor(1);
                break;

                case VK_RETURN:
					SHRGINFO    shrg;
					shrg.cbSize = sizeof(shrg);
					shrg.hwndClient = hWnd;
					shrg.ptDown.x = LOWORD(lParam);
					shrg.ptDown.y = HIWORD(lParam);
					shrg.dwFlags = SHRG_RETURNCMD | SHRG_NOANIMATION;

					if (SHRecognizeGesture(&shrg) == GN_CONTEXTMENU)
					{
						ODRRef focused=p->cursorPos;
						if (!(focused)) break;
						InvalidateRect(p->getHWnd(), NULL, true);
						HMENU hmenu = p->getContextMenu();
						VirtualListElement *velement=dynamic_cast<VirtualListElement *>(focused.get());
						if (velement) hmenu=velement->getContextMenu(hmenu);
						if (hmenu==NULL) break;
						POINT pt={LOWORD(lParam), HIWORD(lParam) };
						ClientToScreen(hWnd, &pt);
						int cmdId=TrackPopupMenuEx(hmenu,
							/*TPM_LEFTALIGN |*/ TPM_TOPALIGN | TPM_RETURNCMD, 
							pt.x, pt.y,
							hWnd,
							NULL);

						bool cmdProcessed=false;
						if (velement) 
							cmdProcessed=velement->OnMenuCommand(cmdId, p->getHWnd(), p->hEditBox);

						if (!cmdProcessed)
							p->OnCommand(cmdId, NULL);

						DestroyMenu(hmenu);
						break;
					}
					if (lkeyData &0xc0000000) break;
					p->eventOk();
				break;
			}
            if(kl2)p->cursorFit();
            InvalidateRect(p->getHWnd(), NULL, true);


            SCROLLINFO si;
            si.cbSize=sizeof(SCROLLINFO);
            si.nPos=p->winTop;
            si.fMask=SIF_POS;
            SetScrollInfo(p->thisHWnd, SB_VERT, &si, TRUE);


            break;
        }
    case WM_VSCROLL:
        {   smile_aktiv=40 ;
            int scrollCode=(int)LOWORD(wParam);
            int nPos=(int)HIWORD(wParam);

            SCROLLINFO si;
            si.cbSize=sizeof(SCROLLINFO);
            si.fMask=SIF_ALL;

            GetScrollInfo(p->thisHWnd, SB_VERT, &si);

            //TODO: flicker-free scrolling
            switch (scrollCode) {
            case SB_LINEDOWN:   si.nPos+=tabHeight; break;
            case SB_LINEUP:     si.nPos-=tabHeight; break;
            case SB_ENDSCROLL:  break;
            case SB_PAGEUP:     si.nPos-=si.nPage;  break;
            case SB_PAGEDOWN:   si.nPos+=si.nPage;  break;
            case SB_THUMBTRACK:
            case SB_THUMBPOSITION: si.nPos=si.nTrackPos; break;
            //default:            si.nPos=si.nTrackPos; break;
            }


            if (si.nPos<0) si.nPos=0; 
            if (si.nPos+(int)si.nPage >= si.nMax) si.nPos=si.nMax-si.nPage; 

            p->winTop= si.nPos;

            //TODO: flicker-free scrolling
            InvalidateRect(p->getHWnd(), NULL, true);

            si.fMask=SIF_POS;
            SetScrollInfo(p->thisHWnd, SB_VERT, &si, TRUE);
            return true;

        }

    case WM_COMMAND: 
        {
            int cmdId=LOWORD(wParam);
            p->OnCommand(cmdId, lParam);
            break;
        }

    case WM_VIRTUALLIST_REPLACE:
        {
            //TODO: create interconnecting message object to avoid pointers
            ODRListRef r=ODRListRef((ODRList *)lParam);
            p->bindODRList(r); //ј’“”Ќ√ є5

            //p->bindODRList(ODRSet::ref((ODRSet *)lParam)); //ј’“”Ќ√ є3
            p->notifyListUpdate(true);
            break;
        }

    case WM_DESTROY:
        //TODO: Destroy all child data associated eith this window

        return 0;

    default:
        return DefWindowProc(hWnd, message, wParam, lParam);
    }
    return 0;
}
示例#4
0
void ServiceDiscovery::registerForm() {
    WndRef rform=RegisterForm::createRegisterForm(tabs->getHWnd(), jid, rc);
    tabs->addWindow(rform);
    tabs->switchByWndRef(rform);
}
示例#5
0
void ServiceDiscovery::execute() {
    WndRef exeForm=AdHocForm::createAdHocForm(tabs->getHWnd(), jid, node, rc);
    tabs->addWindow(exeForm);
    tabs->switchByWndRef(exeForm);
}
示例#6
0
void ServiceDiscovery::joingc() {
    DlgMucJoin::createDialog(tabs->getHWnd(), rc, jid);
}
示例#7
0
void ServiceDiscovery::vcard() {
    WndRef vcardForm=VcardForm::createVcardForm(tabs->getHWnd(), jid, rc, false);
    tabs->addWindow(vcardForm);
    tabs->switchByWndRef(vcardForm);
}