當前位置: 首頁>>代碼示例>>C++>>正文


C++ Activate函數代碼示例

本文整理匯總了C++中Activate函數的典型用法代碼示例。如果您正苦於以下問題:C++ Activate函數的具體用法?C++ Activate怎麽用?C++ Activate使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Activate函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: sizeof

//============================================================================
//    IMPLEMENTATION PRIVATE FUNCTION PROTOTYPES
//============================================================================
//============================================================================
//    IMPLEMENTATION PRIVATE FUNCTIONS
//============================================================================
//============================================================================
//    INTERFACE FUNCTIONS
//============================================================================
//============================================================================
//    INTERFACE CLASS BODIES
//============================================================================
// --- Archive Class ---
// Parse the Archive.
VFS_BOOL CArchive::Parse()
{
	// Read in the Archive Header.
	ARCHIVE_HEADER RawHeader;
	if( !VFS_File_Read( m_hFile, ( VFS_BYTE* ) &RawHeader, sizeof( ARCHIVE_HEADER ) ) )
		return VFS_FALSE;

	m_Header.dwDataOffset = sizeof( ARCHIVE_HEADER ) +
							RawHeader.dwNumFilters * sizeof( ARCHIVE_FILTER ) +
							RawHeader.dwNumDirs * sizeof( ARCHIVE_DIR ) +
							RawHeader.dwNumFiles * sizeof( ARCHIVE_FILE );
	m_Header.dwFileDataOffset = m_Header.dwDataOffset;

	// Read in the Filters.
	VFS_DWORD dwIndex;
	for( dwIndex = 0; dwIndex < RawHeader.dwNumFilters; dwIndex++ )
	{
		ARCHIVE_FILTER RawFilter;
		if( !VFS_File_Read( m_hFile, ( VFS_BYTE* ) &RawFilter, sizeof( ARCHIVE_FILTER ) ) )
			return VFS_FALSE;

		// Get the Filter for the Name.
		VFS_Filter* pFilter = ( VFS_Filter* ) VFS_GetFilter( RawFilter.szName );
		if( pFilter == NULL )
			return VFS_FALSE;

        // Increase the File Data Offset.
		m_Header.dwFileDataOffset += pFilter->GetConfigDataSize();

		m_Header.Filters.push_back( pFilter );
	}

	// Read in the Dirs.
	for( dwIndex = 0; dwIndex < RawHeader.dwNumDirs; dwIndex++ )
	{
		ARCHIVE_DIR RawDir;
		if( !VFS_File_Read( m_hFile, ( VFS_BYTE* ) &RawDir, sizeof( ARCHIVE_DIR ) ) )
			return VFS_FALSE;

		ArchiveDir Dir;
		Dir.dwParentDirIndex = RawDir.dwParentIndex;
		Dir.strName = RawDir.szName;

		m_Header.Dirs.push_back( Dir );
	}

	// Calculate the Full Name.
	for( dwIndex = 0; dwIndex < RawHeader.dwNumDirs; dwIndex++ )
	{
		ArchiveDir* pBase = &m_Header.Dirs[ dwIndex ];
		ArchiveDir* pDir = pBase;
		while( pDir->dwParentDirIndex != DIR_INDEX_ROOT )
		{
			pDir = &m_Header.Dirs[ pDir->dwParentDirIndex ];
			pBase->strName = pDir->strName + VFS_PATH_SEPARATOR + pBase->strName;
		}

		m_Header.DirHash[ m_Header.Dirs[ dwIndex ].strName ] = dwIndex;
	}

	// Read in the Filter Data.
	VFS_DWORD dwPos = VFS_File_Tell( m_hFile );
	if( !Activate() )
		return VFS_FALSE;
	VFS_File_Seek( m_hFile, dwPos, VFS_SET );

	// Read in the Files.
	VFS_DWORD dwDataOffset = m_Header.dwFileDataOffset;
	for( dwIndex = 0; dwIndex < RawHeader.dwNumFiles; dwIndex++ )
	{
		ARCHIVE_FILE RawFile;
		if( !VFS_File_Read( m_hFile, ( VFS_BYTE* ) &RawFile, sizeof( ARCHIVE_FILE ) ) )
			return VFS_FALSE;

		ArchiveFile File;
		File.strName = RawFile.szName;
		File.dwDirIndex = RawFile.dwDirIndex;
		if( File.dwDirIndex != DIR_INDEX_ROOT )
			File.strName = m_Header.Dirs[ File.dwDirIndex ].strName + VFS_PATH_SEPARATOR + File.strName;
		File.dwCompressedSize = RawFile.dwCompressedSize;
		File.dwUncompressedSize = RawFile.dwUncompressedSize;
		File.dwDataOffset = dwDataOffset;
		dwDataOffset += File.dwCompressedSize;
		m_Header.Files.push_back( File );

		m_Header.FileHash[ m_Header.Files[ dwIndex ].strName ] = dwIndex;
//.........這裏部分代碼省略.........
開發者ID:Keinier,項目名稱:KPackage,代碼行數:101,代碼來源:VFS_Archive.cpp

示例2: _ASSERTE

void CTabBarClass::Update(BOOL abPosted/*=FALSE*/)
{
	#ifdef _DEBUG
	if (this != gpConEmu->mp_TabBar)
	{
		_ASSERTE(this == gpConEmu->mp_TabBar);
	}
	#endif

	MCHKHEAP
	/*if (!_active)
	{
	    return;
	}*/ // Теперь - ВСЕГДА! т.к. сами управляем мультиконсолью

	if (mb_DisableRedraw)
	{
		_ASSERTE(FALSE && "mb_DisableRedraw?"); // Надо?
		return;
	}

	if (!isMainThread())
	{
		RequestPostUpdate();
		return;
	}

	gpConEmu->mp_Status->UpdateStatusBar();

	mb_PostUpdateCalled = FALSE;

	#ifdef _DEBUG
	_ASSERTE(mn_InUpdate >= 0);
	if (mn_InUpdate > 0)
	{
		_ASSERTE(mn_InUpdate == 0);
	}
	#endif

	mn_InUpdate ++;

	MCHKHEAP
	int V, I, tabIdx = 0, nCurTab = -1;
	BOOL bShowFarWindows = gpSet->bShowFarWindows;

	// Выполняться должно только в основной нити, так что CriticalSection не нужна

	#ifdef _DEBUG
	if (this != gpConEmu->mp_TabBar)
	{
		_ASSERTE(this == gpConEmu->mp_TabBar);
	}
	#endif

	TODO("Обработка gpSet->bHideInactiveConsoleTabs для новых табов");
	MCHKHEAP


	// Check if we need to AutoSHOW or AutoHIDE tab bar
	if (!IsTabsActive() && gpSet->isTabs)
	{
		int nTabs = CountActiveTabs(2);
		if (nTabs > 1)
		{
			Activate();
		}
	}
	else if (IsTabsActive() && gpSet->isTabs==2)
	{
		int nTabs = CountActiveTabs(2);
		if (nTabs <= 1)
		{
			Deactivate();
		}
	}


	// Validation?
	#ifdef _DEBUG
	if (this != gpConEmu->mp_TabBar)
	{
		_ASSERTE(this == gpConEmu->mp_TabBar);
	}
	#endif



	MCHKHEAP
	HANDLE hUpdate = m_Tabs.UpdateBegin();
	_ASSERTE(hUpdate!=NULL);

	bool bStackChanged = false;

	/* ********************* */
	/*          Go           */
	/* ********************* */
	{
		MMap<CVConGroup*,CVirtualConsole*> Groups; Groups.Init(MAX_CONSOLE_COUNT, true);

		for (V = 0; V < MAX_CONSOLE_COUNT; V++)
//.........這裏部分代碼省略.........
開發者ID:negadj,項目名稱:ConEmu,代碼行數:101,代碼來源:TabBar.cpp

示例3: PlugInShell_SetPluginState

long PlugInShell_SetPluginState(const unsigned long inNewState)
{
    long macError = eDSNoErr;
    bool isAcquired = false;

    LOG_ENTER("inNewState = 0x%08x (%s)", inNewState, StateToString(inNewState));

    if (FlagOn(inNewState, ~(kActive | kInactive)))
    {
        LOG("Ignoring unexpected state flags: 0x%08x", FlagOn(inNewState, ~(kActive | kInactive)));
    }

    if (!FlagOn(inNewState, kActive | kInactive))
    {
        // Nothing to do.
        LOG("Nothing to do because inactive/active flags are not specified.");
        macError = eDSNoErr;
        GOTO_CLEANUP();
    }

    if (FlagOn(inNewState, kActive) && FlagOn(inNewState, kInactive))
    {
        LOG_ERROR("Cannot set active and inactive at the same time.");
        macError = ePlugInError;
        GOTO_CLEANUP();
    }

    GS_ACQUIRE_EXCLUSIVE();
    isAcquired = true;

    GS_VERIFY_INITIALIZED(macError);

    LOG("Current State = 0x%08x", GlobalState.PluginState);

    if ( (FlagOn(inNewState, kActive | kInactive) == FlagOn(GlobalState.PluginState, kActive | kInactive)) )
    {
        // Nothing to do.
        LOG("Nothing to do because the state matches");
        macError = eDSNoErr;
        GOTO_CLEANUP();
    }

    if ( FlagOn(inNewState, kActive) )
    {
        LOG("Activating");
        macError = Activate();
        GOTO_CLEANUP_ON_MACERROR(macError);

        SetFlag(GlobalState.PluginState, kActive);
        ClearFlag(GlobalState.PluginState, kInactive);
    }
    else if ( FlagOn(inNewState, kInactive) )
    {
        LOG("De-activating");
        macError = Deactivate();
        GOTO_CLEANUP_ON_MACERROR(macError);

        ClearFlag(GlobalState.PluginState, kActive);
        SetFlag(GlobalState.PluginState, kInactive);
    }
    else
    {
        // This should never happen.
        LOG_ERROR("Benign unexpected code path.");
        macError = eDSNoErr;
    }

cleanup:

    if (isAcquired)
    {
        LOG("Final State = 0x%08x", GlobalState.PluginState);
        GS_RELEASE();
    }

    LOG_LEAVE("--> %d", macError);
    return macError;
}
開發者ID:virtual-void,項目名稱:pbis,代碼行數:78,代碼來源:PlugInShell.cpp

示例4: Activate

/*
================
idPhysics_Parametric::SetAngularInterpolation
================
*/
void idPhysics_Parametric::SetAngularInterpolation( int time, int accelTime, int decelTime, int duration, const idAngles &startAng, const idAngles &endAng ) {
	current.time = gameLocal.time;
	current.angularInterpolation.Init( time, accelTime, decelTime, duration, startAng, endAng );
	current.localAngles = startAng;
	Activate();
}
開發者ID:ET-NiK,項目名稱:amxxgroup,代碼行數:11,代碼來源:Physics_Parametric.cpp

示例5: filter

int filter(const SDL_Event *tEvent){
    // recursion avoidance
    static bool recursion = false;
    if ( !recursion )
    {
        class RecursionGuard
        {
        public:
            RecursionGuard( bool& recursion )
                    :recursion_( recursion )
            {
                recursion = true;
            }

            ~RecursionGuard()
            {
                recursion_ = false;
            }

        private:
            bool& recursion_;
        };

        RecursionGuard guard( recursion );

        // boss key or OS X quit command
        if ((tEvent->type==SDL_KEYDOWN && tEvent->key.keysym.sym==27 &&
                tEvent->key.keysym.mod & KMOD_SHIFT) ||
                (tEvent->type==SDL_KEYDOWN && tEvent->key.keysym.sym==113 &&
                 tEvent->key.keysym.mod & KMOD_META) ||
                (tEvent->type==SDL_QUIT)){
            // sn_SetNetState(nSTANDALONE);
            // sn_Receive();

            // register end of recording
            tRecorder::Record("END");

            st_SaveConfig();
            uMenu::quickexit=true;
            return false;
        }

        if(tEvent->type==SDL_MOUSEMOTION)
            if(tEvent->motion.x==sr_screenWidth/2 && tEvent->motion.y==sr_screenHeight/2)
                return 0;
        if (su_mouseGrab &&
                tEvent->type!=SDL_MOUSEBUTTONDOWN &&
                tEvent->type!=SDL_MOUSEBUTTONUP &&
                ((tEvent->motion.x>=sr_screenWidth-10  || tEvent->motion.x<=10) ||
                 (tEvent->motion.y>=sr_screenHeight-10 || tEvent->motion.y<=10)))
            SDL_WarpMouse(sr_screenWidth/2,sr_screenHeight/2);

        // fetch alt-tab

        if (tEvent->type==SDL_ACTIVEEVENT)
        {
            // Jonathans fullscreen bugfix.
#ifdef MACOSX
            if(currentScreensetting.fullscreen ^ lastSuccess.fullscreen) return false;
#endif
            int flags = SDL_APPINPUTFOCUS;
            if ( tEvent->active.gain && tEvent->active.state & flags )
                Activate(true);
            if ( !tEvent->active.gain && tEvent->active.state & flags )
                Activate(false);

            // reload GL stuff if application gets reactivated
            if ( tEvent->active.gain && tEvent->active.state & SDL_APPACTIVE )
            {
                // just treat it like a screen mode change, gets the job done
                rCallbackBeforeScreenModeChange::Exec();
                rCallbackAfterScreenModeChange::Exec();
            }
            return false;
        }

        if (su_prefetchInput){
            return su_StoreSDLEvent(*tEvent);
        }

    }

    return 1;
}
開發者ID:KnIfER,項目名稱:armagetron,代碼行數:84,代碼來源:gArmagetron.cpp

示例6: Activate

void CMultiStateMover::Event_Activate( idEntity *activator ) {
	Activate( activator );
}
開發者ID:SL987654,項目名稱:The-Darkmod-Experimental,代碼行數:3,代碼來源:MultiStateMover.cpp

示例7: switch

		void AndroidEventLoop::ProcessAppEvent(int32_t pCommand)
		{
			switch (pCommand)
			{
				case APP_CMD_CONFIG_CHANGED:
					LOGD("APP_CMD_CONFIG_CHANGED");
					Activate();
					m_pActivityHandler->onConfigurationChanged();
					break;
				case APP_CMD_INIT_WINDOW:
					LOGD("APP_CMD_INIT_WINDOW");
					Activate();
					break;
				case APP_CMD_DESTROY:
					LOGD("APP_CMD_DESTROY");
					m_pActivityHandler->onDestroy();
					m_window.InvalidateSurface();
					m_window.InvalidateContext();
					m_enabled = false;
					break;
				case APP_CMD_GAINED_FOCUS:
					LOGD("APP_CMD_GAINED_FOCUS");
					m_pActivityHandler->onGainFocus();
					break;
				case APP_CMD_LOST_FOCUS:
					LOGD("APP_CMD_LOST_FOCUS");
					m_pActivityHandler->onLostFocus();
					break;
				case APP_CMD_LOW_MEMORY:
					LOGD("APP_CMD_LOW_MEMORY");
					m_pActivityHandler->onLowMemory();
					break;
				case APP_CMD_PAUSE:
					LOGD("APP_CMD_PAUSE");
					m_pActivityHandler->onPause();
					m_enabled = false;
					//m_window.InvalidateSurface();
					break;
				case APP_CMD_RESUME:
					LOGD("APP_CMD_RESUME");
					Activate();
					m_pActivityHandler->onResume();
					break;
				case APP_CMD_SAVE_STATE:
					LOGD("APP_CMD_SAVE_STATE");
					m_pActivityHandler->onSaveState(&Global::pAndroidApp->savedState,
						&Global::pAndroidApp->savedStateSize);
					break;
				case APP_CMD_START:
					LOGD("APP_CMD_START");
					Activate();
					m_pActivityHandler->onStart();
					break;
				case APP_CMD_STOP:
					LOGD("APP_CMD_STOP");
					m_pActivityHandler->onStop();
					m_window.InvalidateSurface();
					m_enabled = false;
					break;
				case APP_CMD_TERM_WINDOW:
					LOGD("APP_CMD_TERM_WINDOW");
					m_window.InvalidateSurface();
					m_enabled = false;
					break;
				default:
					break;
			}

			LOGD("m_enabled = %d",m_enabled);
			LOGD("is context bound? = %d",m_window.IsContextBound());
		}
開發者ID:mirceamt,項目名稱:MPACK,代碼行數:71,代碼來源:AndroidEventLoop.cpp

示例8: Activate

/*
================
idPhysics_Player::SetAxis
================
*/
void idPhysics_Monster::SetAxis(const idMat3 &newAxis, int id)
{
	clipModel->Link(gameLocal.clip, self, 0, clipModel->GetOrigin(), newAxis);
	Activate();
}
開發者ID:AreaScout,項目名稱:dante-doom3-odroid,代碼行數:10,代碼來源:Physics_Monster.cpp

示例9: getView

int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
{
    MODULE* module = NULL;
    KIGFX::VIEW* view = getView();
    KIGFX::VIEW_CONTROLS* controls = getViewControls();
    BOARD* board = getModel<BOARD>();

    // Add a VIEW_GROUP that serves as a preview for the new item
    KIGFX::VIEW_GROUP preview( view );
    view->Add( &preview );

    m_toolMgr->RunAction( COMMON_ACTIONS::selectionClear, true );
    controls->ShowCursor( true );
    controls->SetSnapping( true );

    Activate();
    m_frame->SetToolID( ID_PCB_MODULE_BUTT, wxCURSOR_HAND, _( "Add footprint" ) );

    // Main loop: keep receiving events
    while( OPT_TOOL_EVENT evt = Wait() )
    {
        VECTOR2I cursorPos = controls->GetCursorPosition();

        if( evt->IsCancel() || evt->IsActivate() )
        {
            if( module )
            {
                board->Delete( module );  // it was added by LoadModuleFromLibrary()
                module = NULL;

                preview.Clear();
                preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
                controls->ShowCursor( true );
            }
            else
                break;

            if( evt->IsActivate() )  // now finish unconditionally
                break;
        }

        else if( module && evt->Category() == TC_COMMAND )
        {
            if( evt->IsAction( &COMMON_ACTIONS::rotate ) )
            {
                module->Rotate( module->GetPosition(), m_frame->GetRotationAngle() );
                preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
            }
            else if( evt->IsAction( &COMMON_ACTIONS::flip ) )
            {
                module->Flip( module->GetPosition() );
                preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
            }
        }

        else if( evt->IsClick( BUT_LEFT ) )
        {
            if( !module )
            {
                // Pick the module to be placed
                module = m_frame->LoadModuleFromLibrary( wxEmptyString,
                                                         m_frame->Prj().PcbFootprintLibs(),
                                                         true, NULL );
                if( module == NULL )
                    continue;

                module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );

                // Add all the drawable parts to preview
                preview.Add( module );
                module->RunOnChildren( boost::bind( &KIGFX::VIEW_GROUP::Add, &preview, _1 ) );

                preview.ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
            }
            else
            {
                // Place the selected module
                module->RunOnChildren( boost::bind( &KIGFX::VIEW::Add, view, _1 ) );
                view->Add( module );
                module->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );

                m_frame->OnModify();
                m_frame->SaveCopyInUndoList( module, UR_NEW );

                // Remove from preview
                preview.Remove( module );
                module->RunOnChildren( boost::bind( &KIGFX::VIEW_GROUP::Remove, &preview, _1 ) );
                module = NULL;  // to indicate that there is no module that we currently modify
            }

            bool placing = ( module != NULL );

            controls->SetAutoPan( placing );
            controls->CaptureCursor( placing );
            controls->ShowCursor( !placing );
        }

        else if( module && evt->IsMotion() )
        {
            module->SetPosition( wxPoint( cursorPos.x, cursorPos.y ) );
//.........這裏部分代碼省略.........
開發者ID:grtwall,項目名稱:kicad-source-mirror,代碼行數:101,代碼來源:pcb_editor_control.cpp

示例10: Activate

void UAITask_MoveTo::Resume()
{
	Activate();
	Super::Resume();
}
開發者ID:amyvmiwei,項目名稱:UnrealEngine4,代碼行數:5,代碼來源:AITask_MoveTo.cpp

示例11: Invalidate

	void CButtonUI::DoEvent(TEventUI& event)
	{
		if( !IsMouseEnabled() && event.Type > UIEVENT__MOUSEBEGIN && event.Type < UIEVENT__MOUSEEND ) {
			if( m_pParent != NULL ) m_pParent->DoEvent(event);
			else CLabelUI::DoEvent(event);
			return;
		}

		if( event.Type == UIEVENT_SETFOCUS ) 
		{
			Invalidate();
		}
		if( event.Type == UIEVENT_KILLFOCUS ) 
		{
			Invalidate();
		}
		if( event.Type == UIEVENT_KEYDOWN )
		{
			if (IsKeyboardEnabled()) {
				if( event.chKey == VK_SPACE || event.chKey == VK_RETURN ) {
					Activate();
					return;
				}
			}
		}
		if( event.Type == UIEVENT_BUTTONDOWN || event.Type == UIEVENT_DBLCLICK )
		{
			if( ::PtInRect(&m_rcItem, event.ptMouse) && IsEnabled() ) {
				m_uButtonState |= UISTATE_PUSHED | UISTATE_CAPTURED;
				Invalidate();
			}
			return;
		}
		if( event.Type == UIEVENT_MOUSEMOVE )
		{
			if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
				if( ::PtInRect(&m_rcItem, event.ptMouse) ) m_uButtonState |= UISTATE_PUSHED;
				else m_uButtonState &= ~UISTATE_PUSHED;
				Invalidate();
			}
			return;
		}
		if( event.Type == UIEVENT_BUTTONUP )
		{
			if( (m_uButtonState & UISTATE_CAPTURED) != 0 ) {
				if( ::PtInRect(&m_rcItem, event.ptMouse) ) Activate();
				m_uButtonState &= ~(UISTATE_PUSHED | UISTATE_CAPTURED);
				Invalidate();
			}
			return;
		}
		if( event.Type == UIEVENT_CONTEXTMENU )
		{
			if( IsContextMenuUsed() ) {
				m_pManager->SendNotify(this, _T("menu"), event.wParam, event.lParam);
			}
			return;
		}
		if( event.Type == UIEVENT_MOUSEENTER )
		{
			if( IsEnabled() ) {
				m_uButtonState |= UISTATE_HOT;
				Invalidate();
			}
			// return;
		}
		if( event.Type == UIEVENT_MOUSELEAVE )
		{
			if( IsEnabled() ) {
				m_uButtonState &= ~UISTATE_HOT;
				Invalidate();
			}
			// return;
		}
		if( event.Type == UIEVENT_SETCURSOR ) {
			::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW)));
			return;
		}
		CLabelUI::DoEvent(event);
	}
開發者ID:XLIVEMEN,項目名稱:ScreenCaptrue,代碼行數:80,代碼來源:UIButton.cpp

示例12: sizeof


//.........這裏部分代碼省略.........

  if(windowsContext==0)
	  std::cout << "failed getting window device context\n";
                 
	static PIXELFORMATDESCRIPTOR pfd =// pfd Tells Windows How We Want Things To Be
	{
		sizeof(PIXELFORMATDESCRIPTOR),	// Size Of This Pixel Format Descriptor
		1,								              // Version Number
		PFD_DRAW_TO_WINDOW |						// Format Must Support Window
		PFD_SUPPORT_OPENGL |						// Format Must Support OpenGL
		PFD_DOUBLEBUFFER |
		PFD_SWAP_EXCHANGE ,					    // Must Support Double Buffering
		PFD_TYPE_RGBA,							    // Request An RGBA Format
		24,								              // Select Our Color Depth
		0, 0, 0, 0, 0, 0,						    // Color Bits Ignored  if(openGLContext==0)
		0,								              // No Alpha Buffer
		0,								              // Shift Bit Ignored
		0,								              // No Accumulation Buffer
		0, 0, 0, 0,							        // Accumulation Bits Ignored
		0,								              // 16Bit Z-Buffer (Depth Buffer)
		0,								              // No Stencil Buffer
		0,								              // No Auxiliary Buffer
		PFD_MAIN_PLANE,							    // Main Drawing Layer
		0,								              // Reserved
		0, 0, 0								          // Layer Masks Ignored
	};


  // Sonstiges einstellen
  int iFormat = ChoosePixelFormat(windowsContext,&pfd);
  SetPixelFormat(windowsContext,iFormat,&pfd);


  openGLContext = wglCreateContext(windowsContext);

  int errw=GetLastError();

  if(openGLContext==0)
	  std::cout << "failed creating openGL context "<<errw<<"\n";

#else

  X_display = XOpenDisplay(NULL);

  GPGPU_ERROR( !X_display ) << "cant open X display";

  GLX_drawable = QApplication::topLevelWidgets().at(0)->winId();

  GPGPU_ERROR( !GLX_drawable ) << "cant get toplevel widget from QT";

  static int visAttributes[] = {
    GLX_RGBA,
    GLX_RED_SIZE, 1,
    GLX_GREEN_SIZE, 1,
    GLX_BLUE_SIZE, 1,
    GLX_DOUBLEBUFFER,
    None
  };

  XVisualInfo *visinfo = glXChooseVisual(X_display, 0, visAttributes);

  GPGPU_ERROR(!visinfo) << "Unable to choose specified visual!";

  openGLContext = glXCreateContext(X_display, visinfo, 0, true);

  if(visinfo)
     XFree(visinfo);

  GPGPU_ERROR(!openGLContext) << "cant create GLX context";

#endif

  Activate();

  GPGPU_INFO << "initializing glew";

  int err=glewInit();

  GPGPU_CHECKGLERR << "initializing glew";
  GPGPU_ERROR(GLEW_OK != err) << "glewInit() fails with " << err << " as text: " << glewGetErrorString(err);

  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glOrtho(0,1,0,1,-1,1);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();

  GPGPU_CHECKGLERR << "intializing projection&modelview matrix";

  glDisable(GL_CULL_FACE);
	glShadeModel(GL_SMOOTH);							// Enable Smooth Shading
	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);				// Black Background
	glClearDepth(1.0f);									// Depth Buffer Setup
  glDisable(GL_DEPTH_TEST);							// Enables Depth Testing
	glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);	// Really Nice Perspective Calculations
  glHint(GL_TEXTURE_COMPRESSION_HINT, GL_NICEST);
  glDepthMask(false);

  GPGPU_CHECKGLERR << "setting up openGL context";
}
開發者ID:david-guerrero,項目名稱:MITK,代碼行數:101,代碼來源:mitkGPGPU.cpp

示例13: Logger

	DatabaseLogger::DatabaseLogger (OStream& os)
		: Logger (os)
	{
		Activate (true);
	}
開發者ID:Noxalus,項目名稱:YAPOG,代碼行數:5,代碼來源:DatabaseLogger.cpp

示例14: event

/*
   The numArg here is the listbox item index while the strArg is used
   differently for the different actions:

   a) for wxACTION_LISTBOX_FIND it has the natural meaning: this is the string
      to find

   b) for wxACTION_LISTBOX_SELECT and wxACTION_LISTBOX_EXTENDSEL it is used
      to decide if the listbox should send the notification event (it is empty)
      or not (it is not): this allows us to reuse the same action for when the
      user is dragging the mouse when it has been released although in the
      first case no notification is sent while in the second it is sent.
 */
bool wxListBox::PerformAction(const wxControlAction& action,
                              long numArg,
                              const wxString& strArg)
{
    int item = (int)numArg;

    if ( action == wxACTION_LISTBOX_SETFOCUS )
    {
        SetCurrentItem(item);
    }
    else if ( action == wxACTION_LISTBOX_ACTIVATE )
    {
        Activate(item);
    }
    else if ( action == wxACTION_LISTBOX_TOGGLE )
    {
        if ( item == -1 )
            item = m_current;

        if ( IsSelected(item) )
            DoUnselect(item);
        else
            SelectAndNotify(item);
    }
    else if ( action == wxACTION_LISTBOX_SELECT )
    {
        DeselectAll(item);

        if ( strArg.empty() )
            SelectAndNotify(item);
        else
            DoSelect(item);
    }
    else if ( action == wxACTION_LISTBOX_SELECTADD )
        DoSelect(item);
    else if ( action == wxACTION_LISTBOX_UNSELECT )
        DoUnselect(item);
    else if ( action == wxACTION_LISTBOX_MOVEDOWN )
        ChangeCurrent(1);
    else if ( action == wxACTION_LISTBOX_MOVEUP )
        ChangeCurrent(-1);
    else if ( action == wxACTION_LISTBOX_PAGEDOWN )
        ChangeCurrent(GetItemsPerPage());
    else if ( action == wxACTION_LISTBOX_PAGEUP )
        ChangeCurrent(-GetItemsPerPage());
    else if ( action == wxACTION_LISTBOX_START )
        SetCurrentItem(0);
    else if ( action == wxACTION_LISTBOX_END )
        SetCurrentItem(GetCount() - 1);
    else if ( action == wxACTION_LISTBOX_UNSELECTALL )
        DeselectAll(item);
    else if ( action == wxACTION_LISTBOX_EXTENDSEL )
        ExtendSelection(item);
    else if ( action == wxACTION_LISTBOX_FIND )
        FindNextItem(strArg);
    else if ( action == wxACTION_LISTBOX_ANCHOR )
        AnchorSelection(item == -1 ? m_current : item);
    else if ( action == wxACTION_LISTBOX_SELECTALL ||
              action == wxACTION_LISTBOX_SELTOGGLE )
        wxFAIL_MSG(_T("unimplemented yet"));
    else
        return wxControl::PerformAction(action, numArg, strArg);

    return true;
}
開發者ID:project-renard-survey,項目名稱:chandler,代碼行數:78,代碼來源:listbox.cpp

示例15: Activate

void TBWindow::OnAdded()
{
	// If we was added last, call Activate to update status etc.
	if (GetParent()->GetLastChild() == this)
		Activate();
}
開發者ID:rongzhou,項目名稱:turbobadger,代碼行數:6,代碼來源:tb_window.cpp


注:本文中的Activate函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。