这篇教程C++ GetWindowStyle函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetWindowStyle函数的典型用法代码示例。如果您正苦于以下问题:C++ GetWindowStyle函数的具体用法?C++ GetWindowStyle怎么用?C++ GetWindowStyle使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetWindowStyle函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetSizewxHitTest wxScrollBar::HitTestBar(const wxPoint& pt) const{ // we only need to work with either x or y coord depending on the // orientation, choose one (but still check the other one to verify if the // mouse is in the window at all) const wxSize sizeArrowSB = m_renderer->GetScrollbarArrowSize(); wxCoord coord, sizeArrow, sizeTotal; wxSize size = GetSize(); if ( GetWindowStyle() & wxVERTICAL ) { if ( pt.x < 0 || pt.x > size.x ) return wxHT_NOWHERE; coord = pt.y; sizeArrow = sizeArrowSB.y; sizeTotal = size.y; } else // horizontal { if ( pt.y < 0 || pt.y > size.y ) return wxHT_NOWHERE; coord = pt.x; sizeArrow = sizeArrowSB.x; sizeTotal = size.x; } // test for the arrows first as it's faster if ( coord < 0 || coord > sizeTotal ) { return wxHT_NOWHERE; } else if ( coord < sizeArrow ) { return wxHT_SCROLLBAR_ARROW_LINE_1; } else if ( coord > sizeTotal - sizeArrow ) { return wxHT_SCROLLBAR_ARROW_LINE_2; } else { // calculate the thumb position in pixels sizeTotal -= 2*sizeArrow; wxCoord thumbStart, thumbEnd; int range = GetRange(); if ( !range ) { // clicking the scrollbar without range has no effect return wxHT_NOWHERE; } else { GetScrollBarThumbSize(sizeTotal, GetThumbPosition(), GetThumbSize(), range, &thumbStart, &thumbEnd); } // now compare with the thumb position coord -= sizeArrow; if ( coord < thumbStart ) return wxHT_SCROLLBAR_BAR_1; else if ( coord > thumbEnd ) return wxHT_SCROLLBAR_BAR_2; else return wxHT_SCROLLBAR_THUMB; }}
开发者ID:esrrhs,项目名称:fuck-music-player,代码行数:72,
示例2: Layout// Lay out controlsvoid wxBookCtrlBase::DoSize(){ if ( !m_bookctrl ) { // we're not fully created yet or OnSize() should be hidden by derived class return; } if (GetSizer()) Layout(); else { // resize controller and the page area to fit inside our new size const wxSize sizeClient( GetClientSize() ), sizeBorder( m_bookctrl->GetSize() - m_bookctrl->GetClientSize() ), sizeCtrl( GetControllerSize() ); m_bookctrl->SetClientSize( sizeCtrl.x - sizeBorder.x, sizeCtrl.y - sizeBorder.y ); // if this changes the visibility of the scrollbars the best size changes, relayout in this case wxSize sizeCtrl2 = GetControllerSize(); if ( sizeCtrl != sizeCtrl2 ) { wxSize sizeBorder2 = m_bookctrl->GetSize() - m_bookctrl->GetClientSize(); m_bookctrl->SetClientSize( sizeCtrl2.x - sizeBorder2.x, sizeCtrl2.y - sizeBorder2.y ); } const wxSize sizeNew = m_bookctrl->GetSize(); wxPoint posCtrl; switch ( GetWindowStyle() & wxBK_ALIGN_MASK ) { default: wxFAIL_MSG( wxT("unexpected alignment") ); // fall through case wxBK_TOP: case wxBK_LEFT: // posCtrl is already ok break; case wxBK_BOTTOM: posCtrl.y = sizeClient.y - sizeNew.y; break; case wxBK_RIGHT: posCtrl.x = sizeClient.x - sizeNew.x; break; } if ( m_bookctrl->GetPosition() != posCtrl ) m_bookctrl->Move(posCtrl); } // resize all pages to fit the new control size const wxRect pageRect = GetPageRect(); const unsigned pagesCount = m_pages.GetCount(); for ( unsigned int i = 0; i < pagesCount; ++i ) { wxWindow * const page = m_pages[i]; if ( !page ) { wxASSERT_MSG( AllowNullPage(), wxT("Null page in a control that does not allow null pages?") ); continue; } page->SetSize(pageRect); }}
开发者ID:Kaoswerk,项目名称:newton-dynamics,代码行数:69,
示例3: WinMainint WINAPI WinMain( HINSTANCE hinstance, HINSTANCE hprevinstance, LPSTR lpcmdline, int ncmdshow){// this is the winmain functionWNDCLASS winclass; // this will hold the class we createHWND hwnd; // generic window handleMSG msg; // generic messageHDC hdc; // generic dcPAINTSTRUCT ps; // generic paintstruct// first fill in the window class stucturewinclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;winclass.lpfnWndProc = WindowProc;winclass.cbClsExtra = 0;winclass.cbWndExtra = 0;winclass.hInstance = hinstance;winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);winclass.hCursor = LoadCursor(NULL, IDC_ARROW);winclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);winclass.lpszMenuName = NULL; winclass.lpszClassName = WINDOW_CLASS_NAME;// register the window classif (!RegisterClass(&winclass)) return(0);// create the window, note the test to see if WINDOWED_APP is// true to select the appropriate window flagsif (!(hwnd = CreateWindow(WINDOW_CLASS_NAME, // class WINDOW_TITLE, // title (WINDOWED_APP ? (WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION) : (WS_POPUP | WS_VISIBLE)), 0,0, // x,y WINDOW_WIDTH, // width WINDOW_HEIGHT, // height NULL, // handle to parent NULL, // handle to menu hinstance,// instance NULL))) // creation parmsreturn(0);// save the window handle and instance in a globalmain_window_handle = hwnd;main_instance = hinstance;// resize the window so that client is really width x heightif (WINDOWED_APP){// now resize the window, so the client area is the actual size requested// since there may be borders and controls if this is going to be a windowed app// if the app is not windowed then it won't matterRECT window_rect = {0,0,WINDOW_WIDTH-1,WINDOW_HEIGHT-1};// make the call to adjust window_rectAdjustWindowRectEx(&window_rect, GetWindowStyle(main_window_handle), GetMenu(main_window_handle) != NULL, GetWindowExStyle(main_window_handle));// save the global client offsets, they are needed in DDraw_Flip()window_client_x0 = -window_rect.left;window_client_y0 = -window_rect.top;// now resize the window with a call to MoveWindow()MoveWindow(main_window_handle, 0, // x position 0, // y position window_rect.right - window_rect.left, // width window_rect.bottom - window_rect.top, // height FALSE);// show the window, so there's no garbage on first renderShowWindow(main_window_handle, SW_SHOW);} // end if windowed// perform all game console specific initializationGame_Init();// disable CTRL-ALT_DEL, ALT_TAB, comment this line out // if it causes your system to crashSystemParametersInfo(SPI_SCREENSAVERRUNNING, TRUE, NULL, 0);// enter main event loopwhile(1) { if (PeekMessage(&msg,NULL,0,0,PM_REMOVE)) { // test if this is a quit if (msg.message == WM_QUIT) break; // translate any accelerator keys TranslateMessage(&msg); // send the message to the window proc DispatchMessage(&msg); } // end if//.........这里部分代码省略.........
开发者ID:giantchen2012,项目名称:tricks-of-the-3d-game-programming-gurus,代码行数:101,
示例4: AdjustVideoModeParams/* Set the final window size, set the window text and icon, and then unhide the * window. */void GraphicsWindow::CreateGraphicsWindow( const VideoModeParams &p, bool bForceRecreateWindow ){ g_CurrentParams = p; // Adjust g_CurrentParams to reflect the actual display settings. AdjustVideoModeParams( g_CurrentParams ); if( g_hWndMain == NULL || bForceRecreateWindow ) { int iWindowStyle = GetWindowStyle( p.windowed ); AppInstance inst; HWND hWnd = CreateWindow( g_sClassName, "app", iWindowStyle, 0, 0, 0, 0, NULL, NULL, inst, NULL ); if( hWnd == NULL ) RageException::Throw( "%s", werr_ssprintf( GetLastError(), "CreateWindow" ).c_str() ); /* If an old window exists, transfer focus to the new window before * deleting it, or some other window may temporarily get focus, which * can cause it to be resized. */ if( g_hWndMain != NULL ) { // While we change to the new window, don't do ChangeDisplaySettings in WM_ACTIVATE. g_bRecreatingVideoMode = true; SetForegroundWindow( hWnd ); g_bRecreatingVideoMode = false; GraphicsWindow::DestroyGraphicsWindow(); } g_hWndMain = hWnd; CrashHandler::SetForegroundWindow( g_hWndMain ); g_HDC = GetDC( g_hWndMain ); } // Update the window title. do { if( m_bWideWindowClass ) { if( SetWindowText( g_hWndMain, ConvertUTF8ToACP(p.sWindowTitle).c_str() ) ) break; } SetWindowTextA( g_hWndMain, ConvertUTF8ToACP(p.sWindowTitle) ); } while(0); // Update the window icon. if( g_hIcon != NULL ) { SetClassLong( g_hWndMain, GCL_HICON, (LONG) LoadIcon(NULL,IDI_APPLICATION) ); DestroyIcon( g_hIcon ); g_hIcon = NULL; } g_hIcon = IconFromFile( p.sIconFile ); if( g_hIcon != NULL ) SetClassLong( g_hWndMain, GCL_HICON, (LONG) g_hIcon ); /* The window style may change as a result of switching to or from fullscreen; * apply it. Don't change the WS_VISIBLE bit. */ int iWindowStyle = GetWindowStyle( p.windowed ); if( GetWindowLong( g_hWndMain, GWL_STYLE ) & WS_VISIBLE ) iWindowStyle |= WS_VISIBLE; SetWindowLong( g_hWndMain, GWL_STYLE, iWindowStyle ); RECT WindowRect; SetRect( &WindowRect, 0, 0, p.width, p.height ); AdjustWindowRect( &WindowRect, iWindowStyle, FALSE ); //LOG->Warn( "w = %d, h = %d", p.width, p.height ); const int iWidth = WindowRect.right - WindowRect.left; const int iHeight = WindowRect.bottom - WindowRect.top; // If windowed, center the window. int x = 0, y = 0; if( p.windowed ) { x = GetSystemMetrics(SM_CXSCREEN)/2-iWidth/2; y = GetSystemMetrics(SM_CYSCREEN)/2-iHeight/2; } /* Move and resize the window. SWP_FRAMECHANGED causes the above * SetWindowLong to take effect. */ if( !SetWindowPos( g_hWndMain, HWND_NOTOPMOST, x, y, iWidth, iHeight, SWP_FRAMECHANGED|SWP_SHOWWINDOW ) ) LOG->Warn( "%s", werr_ssprintf( GetLastError(), "SetWindowPos" ).c_str() ); SetForegroundWindow( g_hWndMain ); /* Pump messages quickly, to make sure the window is completely set up. * If we don't do this, then starting up in a D3D fullscreen window may * cause all other windows on the system to be resized. */ MSG msg; while( PeekMessage( &msg, NULL, 0, 0, PM_NOREMOVE ) ) { GetMessage( &msg, NULL, 0, 0 ); DispatchMessage( &msg ); }//.........这里部分代码省略.........
开发者ID:Ancaro,项目名称:stepmania,代码行数:101,
示例5: GetPositionvoid CBasicWindow::GetPosition(int *pLeft,int *pTop,int *pWidth,int *pHeight) const{ if (m_hwnd!=NULL) { RECT rc; if ((GetWindowStyle() & WS_CHILD)!=0) { ::GetWindowRect(m_hwnd,&rc); ::MapWindowPoints(NULL,::GetParent(m_hwnd),reinterpret_cast<POINT*>(&rc),2); if (pLeft) *pLeft=rc.left; if (pTop) *pTop=rc.top; if (pWidth) *pWidth=rc.right-rc.left; if (pHeight) *pHeight=rc.bottom-rc.top; } else { WINDOWPLACEMENT wp; wp.length=sizeof(WINDOWPLACEMENT); ::GetWindowPlacement(m_hwnd,&wp); if (wp.showCmd==SW_SHOWNORMAL) { // 通常表示 C++ GetWindowStyleFlag函数代码示例 C++ GetWindowRect函数代码示例
|