HWND WinGui::Window::Create(){ if(cls_reg == true) RegisterClass(wnd); hWnd = CreateWindowEx( wnd_ex_type, clsname, title, wnd_type, pos_x, pos_y, width, height, parent, NULL, GetModuleHandle(NULL), NULL ); if(hWnd == NULL) return NULL; PopupMenu->setHWND(hWnd); if(PopupMenu->linkWithRightButton() == true) RButtonDown(WinGui::RBDown); if(isNoTL == true) SetWindowLong(hWnd, GWL_STYLE, GetWindowLong(hWnd, GWL_STYLE) & (~WS_CAPTION)); hDC = GetDC(hWnd); isCreate = true; return hWnd; }
void CDrawLine::DblLButtonDown(CDPoint p,CDPoint s) { // Second line.. LButtonDown(p,s); // .. and end RButtonDown(p,s); }
void CDrawLine::LButtonUp(CDPoint p) { // Only do this if this is the first // m_segment we have placed... if (has_placed) { return; } // If the user has made a significant movement, // then consider this a placement.... double offset_x = m_point_a.x - m_point_b.x; double offset_y = m_point_a.y - m_point_b.y; if (offset_x < 0) { offset_x = -offset_x; } if (offset_y < 0) { offset_y = -offset_y; } if (offset_x > 10 || offset_y > 10) { // Ok, we can place if (!m_segment && !is_stuck) { // First line LButtonDown(p,p); } // Second line.. LButtonDown(p,p); // .. and end RButtonDown(p,p); } else { has_placed = TRUE; } }
void CDrawLine::EndEdit() { Display(); if (!m_re_edit) { g_EditToolBar.m_DrawLineEdit.Close(); // Cancel line editing RButtonDown(CDPoint(0, 0), CDPoint(0, 0)); } else { g_EditToolBar.m_LineEdit.Close(); m_drag_utils_a.End(true); m_drag_utils_b.End(true); CDragUtils q(m_pDesign); q.MergeLinePoint(this); } }
// Place the object into the design void CDrawSquare::LButtonDown(CDPoint p, CDPoint s) { // New undo level for each placement... m_pDesign->BeginNewChangeSet(); if (m_segment) { m_point_a=p; m_point_b=p; m_segment=!m_segment; Display(); } else { m_point_b=p; Display(); CDrawingObject *pObject = Store(); RButtonDown(p, s); // Now select the top object and switch back // to the Edit tool m_pDesign->UnSelect(); m_pDesign->Select( pObject ); m_pDesign->SelectObject( new CDrawEditItem(m_pDesign) ); } }
WMSG_RESULT CUIBase::MouseMessage(MSG* pMsg) { WMSG_RESULT ret = WMSG_FAIL; UINT16 x = LOWORD(pMsg->lParam); UINT16 y = HIWORD(pMsg->lParam); // 포커스가 있다면 먼저 처리하자 CUIBase* pUI = CUIFocus::getSingleton()->getUI(); switch (pMsg->message) { case WM_LBUTTONDOWN: { if (pUI) ret = pUI->LButtonDown(x, y); if (ret == WMSG_FAIL) ret = LButtonDown(x, y); } break; case WM_LBUTTONUP: { if (pUI) ret = pUI->LButtonUp(x, y); if (ret == WMSG_FAIL) ret = LButtonUp(x, y); } break; case WM_LBUTTONDBLCLK: { if (pUI) ret = pUI->LButtonDBLClick(x, y); if (ret == WMSG_FAIL) ret = LButtonDBLClick(x, y); } break; case WM_RBUTTONDOWN: { if (pUI) ret = pUI->RButtonDown(x, y); if (ret == WMSG_FAIL) ret = RButtonDown(x, y); } break; case WM_RBUTTONUP: { if (pUI) ret = pUI->RButtonUp(x, y); if (ret == WMSG_FAIL) ret = RButtonUp(x, y); } break; case WM_RBUTTONDBLCLK: { if (pUI) ret = pUI->RButtonDBLClick(x, y); if (ret == WMSG_FAIL) ret = RButtonDBLClick(x, y); } break; case WM_MOUSEMOVE: { if (pUI) ret = pUI->MouseMove(x, y, pMsg); if (ret == WMSG_FAIL) ret = MouseMove(x, y, pMsg); } break; case WM_MOUSEWHEEL: { int wheel = (short)HIWORD(pMsg->wParam); if (pUI) ret = pUI->MouseWheel(x, y, wheel); if (ret == WMSG_FAIL) ret = MouseWheel(x, y, wheel); } break; } return ret; }
void CControl::LButtonDown(CGame * member,const POINT& p)//鼠标单击 { static int i=0; switch(member->GetGameState()) { case PREPARE: switch(m_member.ClickImage(member->m_imageButton,p)) { case 0://1分 break; case 1://2分 break; case 2://3分 ForceHost(member);//强地主 member->SetGameState(START);//设置状态为开始游戏 member->SetWhoIsHost(PLAYER_B); member->SetWhoSendCard(PLAYER_B);//设置当前出牌为玩家B m_member.DeleteImage(member->m_imageButton);//输出准备游戏的按钮图片 break; case 3://不叫 break; } break; case START: m_member.ClickCard(member->m_playB,p);//单击牌 if (member->GetWhoSendCard()==PLAYER_B) { switch(m_member.ClickImage(member->m_imageButton,p))//单击图片按钮 { case 0://出牌 RButtonDown(member); break; case 1://提示 break; case 2://不出 m_member.m_noSendNum+=1; PASS temp; temp.isShow=true; temp.x=350; temp.y=370; member->setPass(temp); for (vector<SENDCARDS>::iterator iter=member->m_sendCard.begin();iter!=member->m_sendCard.end();) { if (iter->ID==PLAYER_B) { iter=member->m_sendCard.erase(iter); }else iter ++; } member->SetWhoSendCard(PLAYER_C);//设置当前出牌为玩家B member->SetMessage(true); break; } } break; } }
void CDrawLine::LButtonDown(CDPoint p, CDPoint s) { // New undo level for each placement... m_pDesign->BeginNewChangeSet(); p = GetStickyPoint( p ); if (m_segment) { m_point_a=p; m_point_b=p; m_segment=!m_segment; if (is_junction) { m_pDesign->AddNewJunction( m_point_a ); } // If there was an object of the same type under this point, // then take it's colour & style drawingIterator i = m_pDesign->GetDrawingBegin(); while (i != m_pDesign->GetDrawingEnd()) { if ((*i)->GetType() == xtype) { // Is this within our start range? CDrawLine *line = static_cast<CDrawLine*>(*i); CLineUtils l( line->m_point_a, line->m_point_b ); double d; if (l.IsPointOnLine( p,d )) { m_use_default_style = line->m_use_default_style; m_style = line->m_style; break; } } ++ i; } } else { m_point_b=p; ToAngle(); // Remove from screen Display(); CDPoint c=m_point_b; switch (g_EditToolBar.m_DrawLineEdit.mode) { case 1: m_point_b=CDPoint(m_point_b.x,m_point_a.y); break; case 2: m_point_b=CDPoint(m_point_a.x,m_point_b.y); break; } BOOL was_stuck = is_stuck; if (is_stuck && g_EditToolBar.m_DrawLineEdit.mode > 0) { int old_is_junction = is_junction; is_junction = FALSE; // Place two lines is_stuck = FALSE; if (m_point_a != m_point_b) { // Store and then Check for merge & junctions m_drag_utils_a.MergeLinePoint( Store() ); } m_point_a = m_point_b; m_point_b = c; is_junction = old_is_junction; } is_stuck = FALSE; if (m_point_a != m_point_b) { // Store and then Check for merge & junctions m_drag_utils_a.MergeLinePoint( Store() ); } Display(); // Write to screen if (!was_stuck) { m_point_a=m_point_b; m_point_b=c; m_segment=0; ToAngle(); } else { RButtonDown(p,s); } } Display(); }
void CDrawPower::EndEdit() { RButtonDown(CDPoint(0, 0), CDPoint(0, 0)); g_EditToolBar.m_PowerEdit.Close(); }