这篇教程C++ GetView函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetView函数的典型用法代码示例。如果您正苦于以下问题:C++ GetView函数的具体用法?C++ GetView怎么用?C++ GetView使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetView函数的25个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetView// If the button in the command bar is clicked, then this function will be called// virtual BOOL S2_CrvLineSegCmd::OnExecute(){ // Initialize FW_Cmd::OnExecute(); // Get active view FW_View* pView = GetView(); if(!pView) return FALSE; // Get root node GR_DLNode* pDLNode = pView->GetDLNode(); if(!pDLNode) return FALSE; m_pDLNodeSketch2D = GR_DLNodeSketch2D::GetActive(pDLNode); if(!m_pDLNodeSketch2D) return FALSE; m_pPtPrevious = NULL; m_pDLCrvPreview = NULL; return TRUE;}
开发者ID:KnowNo,项目名称:backup,代码行数:25,
示例2: ptLRESULT CSimpleGraph::OnMouseHover(WPARAM, LPARAM lp){ CPoint pt(LOWORD(lp), HIWORD(lp)); // client window coords CHexEditView *pv = GetView(); ASSERT(pv != NULL); m_bar = get_bar(pt); if (m_bar > -1 && !m_tip.IsWindowVisible()) { // Update the tip info m_tip.Clear(); CString ss; if (theApp.hex_ucase_) ss.Format("Byte: %d [%02.2Xh] %s", m_bar, m_bar, pv->DescChar(m_bar)); else ss.Format("Byte: %d [%02.2xh] %s", m_bar, m_bar, pv->DescChar(m_bar)); m_tip.AddString(ss); char buf[32]; // used with sprintf (CString::Format can't handle __int64) sprintf(buf, "%I64d", m_val[m_bar]); ss = buf; AddCommas(ss); m_tip.AddString("Count: " +ss); // Work out the tip window display position and move the tip window there CPoint tip_pt = pt + CSize(16, 16); ClientToScreen(&tip_pt); m_tip.Move(tip_pt, false); m_tip.Show(); track_mouse(TME_LEAVE); return 0; // return 0 to say we processed it } return 1;}
开发者ID:AndrewWPhillips,项目名称:HexEdit,代码行数:37,
示例3: GetView//-----------------------------------------------------------------------------// Purpose: Sets view parameters for level overview mode// Input : *rect - //-----------------------------------------------------------------------------void CViewRender::SetUpOverView(){ static int oldCRC = 0; CViewSetup &view = GetView ( STEREO_EYE_MONO ); view.m_bOrtho = true; float aspect = (float)view.width/(float)view.height; int size_y = 1024.0f * cl_leveloverview.GetFloat(); // scale factor, 1024 = OVERVIEW_MAP_SIZE int size_x = size_y * aspect; // standard screen aspect view.origin.x -= size_x / 2; view.origin.y += size_y / 2; view.m_OrthoLeft = 0; view.m_OrthoTop = -size_y; view.m_OrthoRight = size_x; view.m_OrthoBottom = 0; view.angles = QAngle( 90, 90, 0 ); // simple movement detector, show position if moved int newCRC = view.origin.x + view.origin.y + view.origin.z; if ( newCRC != oldCRC ) { Msg( "Overview: scale %.2f, pos_x %.0f, pos_y %.0f/n", cl_leveloverview.GetFloat(), view.origin.x, view.origin.y ); oldCRC = newCRC; } CMatRenderContextPtr pRenderContext( materials ); pRenderContext->ClearColor4ub( 0, 255, 0, 255 ); // render->DrawTopView( true );}
开发者ID:EspyEspurr,项目名称:game,代码行数:41,
示例4: GetViewRay Camera::GetScreenRay(float x, float y) const{ Ray ret; // If projection is invalid, just return a ray pointing forward if (!IsProjectionValid()) { ret.origin_ = node_ ? node_->GetWorldPosition() : Vector3::ZERO; ret.direction_ = node_ ? node_->GetWorldDirection() : Vector3::FORWARD; return ret; } Matrix4 viewProjInverse = (GetProjection(false) * GetView()).Inverse(); // The parameters range from 0.0 to 1.0. Expand to normalized device coordinates (-1.0 to 1.0) & flip Y axis x = 2.0f * x - 1.0f; y = 1.0f - 2.0f * y; Vector3 near(x, y, 0.0f); Vector3 far(x, y, 1.0f); ret.origin_ = viewProjInverse * near; ret.direction_ = ((viewProjInverse * far) - ret.origin_).Normalized(); return ret;}
开发者ID:Boshin,项目名称:Urho3D,代码行数:24,
示例5: GetViewBOOL DTransformScale::OnSetActive() {// return DTransformScale::OnSetActive(); GView *view = GetView(); // make translation event handler active GMoveTransformHandler *h = new GMoveTransformHandler(view); h->SetMapMode(m_type); h->SetTransformMode(GMoveTransformHandler::MODE_SCALE); h->SetDialog(this); h->SetAxes(GetAxes()); h->scaleUniform = m_uniform; h->ref(); m_pView->Message("Select and drag scales object"); m_handler = h; view->PushEventHandler(h); return CPropertyPage::OnSetActive();}
开发者ID:deepmatrix,项目名称:blaxxun-cc3d,代码行数:24,
示例6: GetView// Sends the bitmap extracted from the View window to a printer of your choice// This function provides a useful reference for printing bitmaps in generalvoid CDoc::Print(){ // Get the dimensions of the View window CRect rcView = GetView().GetClientRect(); int Width = rcView.Width(); int Height = rcView.Height(); // Copy the bitmap from the View window CClientDC ViewDC(GetView()); CMemDC MemDC(ViewDC); CBitmap bmView; bmView.CreateCompatibleBitmap(ViewDC, Width, Height); MemDC.SelectObject(bmView); MemDC.BitBlt(0, 0, Width, Height, ViewDC, 0, 0, SRCCOPY); CPrintDialog PrintDlg; try { // Bring up a dialog to choose the printer if (PrintDlg.DoModal(GetView()) == IDOK) // throws exception if there is no default printer { // Zero and then initialize the members of a DOCINFO structure. DOCINFO di; memset(&di, 0, sizeof(DOCINFO)); di.cbSize = sizeof(DOCINFO); di.lpszDocName = _T("Scribble Printout"); di.lpszOutput = (LPTSTR)NULL; di.lpszDatatype = (LPTSTR)NULL; di.fwType = 0; // Begin a print job by calling the StartDoc function. CDC dcPrint = PrintDlg.GetPrinterDC(); if (SP_ERROR == StartDoc(dcPrint, &di)) throw CUserException(_T("Failed to start print job")); // Inform the driver that the application is about to begin sending data. if (0 > StartPage(dcPrint)) throw CUserException(_T("StartPage failed")); BITMAPINFOHEADER bi; ZeroMemory(&bi, sizeof(BITMAPINFOHEADER)); bi.biSize = sizeof(BITMAPINFOHEADER); bi.biHeight = Height; bi.biWidth = Width; bi.biPlanes = 1; bi.biBitCount = 24; bi.biCompression = BI_RGB; // Note: BITMAPINFO and BITMAPINFOHEADER are the same for 24 bit bitmaps // Get the size of the image data MemDC.GetDIBits(bmView, 0, Height, NULL, reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS); // Retrieve the image data std::vector<byte> vBits(bi.biSizeImage, 0); // a vector to hold the byte array byte* pByteArray = &vBits.front(); MemDC.GetDIBits(bmView, 0, Height, pByteArray, reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS); // Determine the scaling factors required to print the bitmap and retain its original proportions. float fLogPelsX1 = (float)ViewDC.GetDeviceCaps(LOGPIXELSX); float fLogPelsY1 = (float)ViewDC.GetDeviceCaps(LOGPIXELSY); float fLogPelsX2 = (float)GetDeviceCaps(dcPrint, LOGPIXELSX); float fLogPelsY2 = (float)GetDeviceCaps(dcPrint, LOGPIXELSY); float fScaleX = MAX(fLogPelsX1, fLogPelsX2) / MIN(fLogPelsX1, fLogPelsX2); float fScaleY = MAX(fLogPelsY1, fLogPelsY2) / MIN(fLogPelsY1, fLogPelsY2); // Compute the coordinates of the upper left corner of the centered bitmap. int cWidthPels = GetDeviceCaps(dcPrint, HORZRES); int xLeft = ((cWidthPels / 2) - ((int)(((float)Width) * fScaleX)) / 2); int cHeightPels = GetDeviceCaps(dcPrint, VERTRES); int yTop = ((cHeightPels / 2) - ((int)(((float)Height) * fScaleY)) / 2); // Use StretchDIBits to scale the bitmap and maintain its original proportions if (GDI_ERROR == (UINT)StretchDIBits(dcPrint, xLeft, yTop, (int)((float)Width * fScaleX), (int)((float)Height * fScaleY), 0, 0, Width, Height, pByteArray, reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS, SRCCOPY)) { throw CUserException(_T("Failed to resize image for printing")); } // Inform the driver that the page is finished. if (0 > EndPage(dcPrint)) throw CUserException(_T("EndPage failed")); // Inform the driver that document has ended. if (0 > EndDoc(dcPrint)) throw CUserException(_T("EndDoc failed")); } } catch (const CException& e) { // Display a message box indicating why printing failed. CString strMsg = CString(e.GetText()) + CString("/n") + e.GetErrorString(); CString strType = CString(e.what()); ::MessageBox(NULL, strMsg, strType, MB_ICONWARNING); }}
开发者ID:the-reverend,项目名称:Win32xx,代码行数:100,
示例7: UpdateViewVisibilityvoid CGUIViewControl::SetCurrentView(int viewMode, bool bRefresh /* = false */){ // grab the previous control CGUIControl *previousView = NULL; if (m_currentView >= 0 && m_currentView < (int)m_visibleViews.size()) previousView = m_visibleViews[m_currentView]; UpdateViewVisibility(); // viewMode is of the form TYPE << 16 | ID VIEW_TYPE type = (VIEW_TYPE)(viewMode >> 16); int id = viewMode & 0xffff; // first find a view that matches this view, if possible... int newView = GetView(type, id); if (newView < 0) // no suitable view that matches both id and type, so try just type newView = GetView(type, 0); if (newView < 0 && type == VIEW_TYPE_BIG_ICON) // try icon view if they want big icon newView = GetView(VIEW_TYPE_ICON, 0); if (newView < 0 && type == VIEW_TYPE_BIG_INFO) newView = GetView(VIEW_TYPE_INFO, 0); if (newView < 0) // try a list view newView = GetView(VIEW_TYPE_LIST, 0); if (newView < 0) // try anything! newView = GetView(VIEW_TYPE_NONE, 0); if (newView < 0) return; m_currentView = newView; CGUIControl *pNewView = m_visibleViews[m_currentView]; // make only current control visible... for (ciViews view = m_allViews.begin(); view != m_allViews.end(); ++view) (*view)->SetVisible(false); pNewView->SetVisible(true); if (!bRefresh && pNewView == previousView) return; // no need to actually update anything (other than visibility above)// CLog::Log(LOGDEBUG,"SetCurrentView: Oldview: %i, Newview :%i", m_currentView, viewMode); bool hasFocus(false); int item = -1; if (previousView) { // have an old view - let's clear it out and hide it. hasFocus = previousView->HasFocus(); item = GetSelectedItem(previousView); CGUIMessage msg(GUI_MSG_LABEL_RESET, m_parentWindow, previousView->GetID()); previousView->OnMessage(msg); } // Update it with the contents UpdateContents(pNewView, item); // and focus if necessary if (hasFocus) { CGUIMessage msg(GUI_MSG_SETFOCUS, m_parentWindow, pNewView->GetID(), 0); g_windowManager.SendMessage(msg, m_parentWindow); } UpdateViewAsControl(((IGUIContainer *)pNewView)->GetLabel());}
开发者ID:KenJusticeJr,项目名称:xbmc,代码行数:64,
|