예제 #1
0
void TMainMenu::SetWelcomeName()
{
	if(TSettings::GetInstance()->GetNumUsers() == 0)
	{
		TWindow *window = GetChildWindow("welcome", -1);
		if (window)
		{
			window->SetFlags(window->GetFlags() & ~kEnabled);
		}

		window = GetChildWindow("changeplayer", -1);
		if (window)
		{
			window->SetFlags(window->GetFlags() & ~kEnabled);
		}

	}
	else
	{
		TWindow *window = GetChildWindow("welcome", -1);
		if (window)
		{
			TText *text = window->GetCast<TText>();
			text->SetText(TPlatform::GetInstance()->GetStringTable()->GetString("welcome", TSettings::GetInstance()->GetCurrentUserName()));
		}
		
	}
}
예제 #2
0
파일: ViewWindow.cpp 프로젝트: am11/ffcore
bool ff::ViewWindow::Deactivate(bool hide)
{
	assertRetVal(IsValid(), true);

	if (_active)
	{
		_active = false;
#if !METRO_APP
		if (hide)
		{
			SetWindowPos(Handle(), HWND_TOP, RectInt(0, 0, 0, 0), SWP_HIDEWINDOW | SWP_NOOWNERZORDER);
		}

		if (_mainWindow != nullptr)
		{
			HWND child = GetChildWindow();
			if (child && ff::IsAncestor(child, Handle()))
			{
				_mainWindow->HideSharedViewTarget();
			}
		}
#endif
		OnDeactivated();
	}

	return true;
}
 static Button* GetChildButton(HWND handle)
 {
     Window* wnd = GetChildWindow(handle);
     Button* btn = dynamic_cast<Button*>(wnd);
     if (NULL == btn)
     {
         std::stringstream ss;
         ss << "Trying to convert non-button control with ID = " << handle;
         throw std::runtime_error(ss.str());
     }
 }
예제 #4
0
파일: ViewWindow.cpp 프로젝트: am11/ffcore
void ff::ViewWindow::SetFocus()
{
#if !METRO_APP
	if (IsActive() && _mainWindow->IsActive())
	{
		HWND hwnd = GetChildWindow();
		if (hwnd != nullptr)
		{
			::SetFocus(hwnd);
		}
	}
#endif
}
예제 #5
0
파일: ViewWindow.cpp 프로젝트: am11/ffcore
void ff::ViewWindow::LayoutChildren()
{
#if !METRO_APP
	RectInt clientRect = GetClientRect(Handle());
	HWND target = GetChildWindow();

	if (target != nullptr)
	{
		EnsureWindowParent(target, Handle());
		MoveWindow(target, clientRect);
		EnsureWindowVisible(target, true);
	}
#endif
}
예제 #6
0
void WxFloatingFrame::OnActivate(wxActivateEvent& Event)
{
	// If the frame is being activated register ctrl + tab hot keys
	if(Event.GetActive())
	{
		WxBrowser* Browser = GetChildWindow();

		// Set focus to update the window entry in the list of trackable windows
		if(Browser)
		{
			Browser->SetFocus();
		}

		RegisterHotKey(ID_POPUP_CTRLTAB, wxMOD_CONTROL, WXK_TAB);
		RegisterHotKey(ID_POPUP_CTRLSHIFTTAB, wxMOD_CONTROL | wxMOD_SHIFT, WXK_TAB);
	}
	else
	{
		UnregisterHotKey(ID_POPUP_CTRLTAB);
		UnregisterHotKey(ID_POPUP_CTRLSHIFTTAB);
	}
}
예제 #7
0
HRESULT tTVPMFPlayer::CreateVideoPlayer() {
	if( MediaSession.p ) {
		return S_OK;	// 既に作成済み
	}

	HRESULT hr = CreateChildWindow();
	if( hr != S_OK ) return hr;

	HWND hWnd = GetChildWindow();
	if( hWnd == NULL || hWnd == INVALID_HANDLE_VALUE )
		return E_FAIL;

	if( FAILED(hr = MFCreateMediaSession( NULL, &MediaSession )) ) {
		TVPThrowExceptionMessage(L"Faild to create Media session.");
	}
	if( FAILED(hr = MediaSession->BeginGetEvent( PlayerCallback, NULL )) ) {
		TVPThrowExceptionMessage(L"Faild to begin get event.");
	}
	CComPtr<IMFSourceResolver> pSourceResolver;
	if( FAILED(hr = MFCreateSourceResolver(&pSourceResolver)) ) {
		TVPThrowExceptionMessage(L"Faild to create source resolver.");
	}
	MF_OBJECT_TYPE ObjectType = MF_OBJECT_INVALID;
	CComPtr<IUnknown> pSource;
	if( FAILED(hr = pSourceResolver->CreateObjectFromByteStream( ByteStream, StreamName.c_str(), MF_RESOLUTION_MEDIASOURCE, NULL, &ObjectType, (IUnknown**)&pSource )) ) {
	//if( FAILED(hr = pSourceResolver->CreateObjectFromURL( L"C:\\krkrz\\bin\\win32\\data\\test.mp4",
	//	MF_RESOLUTION_MEDIASOURCE, NULL, &ObjectType, (IUnknown**)&pSource)) ) {
		TVPThrowExceptionMessage(L"Faild to open stream.");
	}
	if( ObjectType != MF_OBJECT_MEDIASOURCE ) {
		TVPThrowExceptionMessage(L"Invalid media source.");
	}
	//CComPtr<IMFMediaSource> pMediaSource;
	if( FAILED(hr = pSource.QueryInterface(&MediaSource)) ) {
		TVPThrowExceptionMessage(L"Faild to query Media source.");
	}
	if( FAILED(hr = MFCreateTopology(&Topology)) ) {
		TVPThrowExceptionMessage(L"Faild to create Topology.");
	}
	CComPtr<IMFPresentationDescriptor> pPresentationDescriptor;
	if( FAILED(hr = MediaSource->CreatePresentationDescriptor(&pPresentationDescriptor)) ) {
		TVPThrowExceptionMessage(L"Faild to create Presentation Descriptor.");
	}
	DWORD streamCount;
	if( FAILED(hr = pPresentationDescriptor->GetStreamDescriptorCount(&streamCount)) ) {
		TVPThrowExceptionMessage(L"Faild to get stream count.");
	}
	if( streamCount < 1 ) {
		TVPThrowExceptionMessage(L"Not found media stream.");
	}
	for( DWORD i = 0; i < streamCount; i++ ) {
		if( FAILED(hr = AddBranchToPartialTopology(Topology, MediaSource, pPresentationDescriptor, i, hWnd)) ) {
			TVPThrowExceptionMessage(L"Faild to add nodes.");
		}
	}
	pPresentationDescriptor->GetUINT64(MF_PD_DURATION, (UINT64*)&HnsDuration);
	
	if( FAILED(hr = MediaSession->SetTopology( 0, Topology )) ) {
		TVPThrowExceptionMessage(L"Faild to set topology.");
	}
	return hr;
}