Ejemplo n.º 1
0
//--------------------------------------------------------------------------
void VeWindows::_SetWindowBordered(Window* pkWindow, bool bBordered)
{
	WindowData* pkData = (WindowData*)(VeRefObject*)pkWindow->m_spDriverData;
	DWORD dwStyle = GetWindowLong(pkData->m_hWnd, GWL_STYLE);
	if(bBordered)
	{
		dwStyle &= ~STYLE_BORDERLESS;
		dwStyle |= STYLE_NORMAL;
	}
	else
	{
		dwStyle &= ~STYLE_NORMAL;
		dwStyle |= STYLE_BORDERLESS;
	}
	SetWindowLong(pkData->m_hWnd, GWL_STYLE, dwStyle);
	SetWindowPositionInternal(pkWindow, SWP_NOCOPYBITS | SWP_FRAMECHANGED | SWP_NOREPOSITION | SWP_NOZORDER |SWP_NOACTIVATE | SWP_NOSENDCHANGING);
}
Ejemplo n.º 2
0
//--------------------------------------------------------------------------
void WindowsVideoDevice::_SetWindowBordered(VeWindow::Data* pkWindow,
	VE_BOOL bBordered) noexcept
{
	VE_ASSERT(pkWindow);
	HWND hWnd = ((VeWindowData*)pkWindow->m_spDriverdata)->m_hWnd;
	DWORD dwStyle = GetWindowLongA(hWnd, GWL_STYLE);

	if (bBordered)
	{
		dwStyle &= ~STYLE_BORDERLESS;
		dwStyle |= STYLE_NORMAL;
	}
	else {
		dwStyle &= ~STYLE_NORMAL;
		dwStyle |= STYLE_BORDERLESS;
	}

	SetWindowLongA(hWnd, GWL_STYLE, dwStyle);
	SetWindowPositionInternal(pkWindow, SWP_NOCOPYBITS | SWP_FRAMECHANGED
		| SWP_NOREPOSITION | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOSENDCHANGING);
}
Ejemplo n.º 3
0
//--------------------------------------------------------------------------
void VeWindows::SetupWindowData(Window* pkWindow, HWND hWnd,
	VE_BOOL bCreated)
{
	WindowData* pkData = VE_NEW WindowData();
	pkData->m_pkWindow = pkWindow;
	pkData->m_hWnd = hWnd;
	pkData->m_hHdc = GetDC(hWnd);
	pkData->m_hImc = NULL;
	pkData->m_bCreated = bCreated;
	pkData->m_u32MouseButtonFlags = 0;

	pkWindow->m_spDriverData = pkData;

#	ifdef GWLP_WNDPROC
	pkData->m_pfuncWndProc = (WNDPROC)GetWindowLongPtr(hWnd, GWLP_WNDPROC);
	if(pkData->m_pfuncWndProc == VeWindows::WndProc)
	{
		pkData->m_pfuncWndProc = NULL;
	}
	else
	{
		SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)VeWindows::WndProc);
	}
#	else
	pkData->m_pfuncWndProc = (WNDPROC)GetWindowLong(hWnd, GWL_WNDPROC);
	if(pkData->m_pfuncWndProc == VeWindows::WndProc)
	{
		pkData->m_pfuncWndProc = NULL;
	}
	else
	{
		SetWindowLong(hWnd, GWL_WNDPROC, (LONG_PTR)VeWindows::WndProc);
	}
#	endif

	{
		RECT kRect;
		if(GetClientRect(hWnd, &kRect))
		{
			int w = kRect.right;
			int h = kRect.bottom;
			if ((pkWindow->w && pkWindow->w != w) || (pkWindow->h && pkWindow->h != h))
			{
				SetWindowPositionInternal(pkWindow, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE);
			}
			else
			{
				pkWindow->w = w;
				pkWindow->h = h;
			}
		}
	}
	{
		POINT kPoint;
		kPoint.x = 0;
		kPoint.y = 0;
		if(ClientToScreen(hWnd, &kPoint))
		{
			pkWindow->x = kPoint.x;
			pkWindow->y = kPoint.y;
		}
	}
	{
		DWORD dwStyle = GetWindowLong(hWnd, GWL_STYLE);
		if(dwStyle & WS_VISIBLE)
		{
			pkWindow->m_u32Flags |= WINDOW_SHOWN;
		}
		else
		{
			pkWindow->m_u32Flags &= ~WINDOW_SHOWN;
		}
		if(dwStyle & (WS_BORDER | WS_THICKFRAME))
		{
			pkWindow->m_u32Flags &= ~WINDOW_BORDERLESS;
		}
		else
		{
			pkWindow->m_u32Flags |= WINDOW_BORDERLESS;
		}
		if(dwStyle & WS_THICKFRAME)
		{
			pkWindow->m_u32Flags |= WINDOW_RESIZABLE;
		} else
		{
			pkWindow->m_u32Flags &= ~WINDOW_RESIZABLE;
		}
#		ifdef WS_MAXIMIZE
		if(dwStyle & WS_MAXIMIZE)
		{
			pkWindow->m_u32Flags |= WINDOW_MAXIMIZED;
		}
		else
#		endif
		{
			pkWindow->m_u32Flags &= ~WINDOW_MAXIMIZED;
		}
#		ifdef WS_MINIMIZE
		if(dwStyle & WS_MINIMIZE)
		{
			pkWindow->m_u32Flags |= WINDOW_MINIMIZED;
		}
		else
#		endif
		{
			pkWindow->m_u32Flags &= ~WINDOW_MINIMIZED;
		}
	}
	if(GetFocus() == hWnd)
	{
		pkWindow->m_u32Flags |= WINDOW_INPUT_FOCUS;
		//SetKeyboardFocus(data->window);
		if(pkWindow->m_u32Flags & WINDOW_INPUT_GRABBED)
		{
			RECT kRect;
			GetClientRect(hWnd, &kRect);
			ClientToScreen(hWnd, (LPPOINT) & kRect);
			ClientToScreen(hWnd, (LPPOINT) & kRect + 1);
			ClipCursor(&kRect);
		}
	}
}
Ejemplo n.º 4
0
//--------------------------------------------------------------------------
void VeWindows::_RaiseWindow(Window* pkWindow)
{
	SetWindowPositionInternal(pkWindow, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE);
}
Ejemplo n.º 5
0
//--------------------------------------------------------------------------
void VeWindows::_SetWindowSize(Window* pkWindow)
{
	SetWindowPositionInternal(pkWindow, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOACTIVATE);
}
Ejemplo n.º 6
0
//--------------------------------------------------------------------------
void WindowsVideoDevice::_RaiseWindow(VeWindow::Data* pkWindow) noexcept
{
	SetWindowPositionInternal(pkWindow, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOSIZE);
}
Ejemplo n.º 7
0
//--------------------------------------------------------------------------
void WindowsVideoDevice::_SetWindowSize(VeWindow::Data* pkWindow) noexcept
{
	SetWindowPositionInternal(pkWindow, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOACTIVATE);
}
Ejemplo n.º 8
0
//--------------------------------------------------------------------------
bool WindowsVideoDevice::SetupWindowData(VeWindow::Data* pkWindow,
	HWND hWnd, VE_BOOL bCreated) noexcept
{
	VE_ASSERT(pkWindow);
	VeWindowData* pkData = VE_NEW VeWindowData;
	VE_ASSERT(pkData);
	pkData->m_pkWindow = pkWindow;
	pkData->m_hWnd = hWnd;
	pkData->m_hDc = GetDC(hWnd);
	pkData->m_bCreated = bCreated;
	pkData->m_u32MouseButtonFlags = 0;
	pkWindow->m_spDriverdata = pkData;

	if (!SetProp(hWnd, TEXT("VeWindowData"), pkData))
	{
		ReleaseDC(hWnd, pkData->m_hDc);
		pkWindow->m_spDriverdata = nullptr;
		pkData = nullptr;
		return false;
	}

	pkData->m_pfuncWndProc = (WNDPROC)GetWindowLongPtr(hWnd, GWLP_WNDPROC);
	if (pkData->m_pfuncWndProc == WindowProc)
	{
		pkData->m_pfuncWndProc = nullptr;
	}
	else
	{
		SetWindowLongPtr(hWnd, GWLP_WNDPROC, (LONG_PTR)WindowProc);
	}

	{
		RECT rect;
		if (GetClientRect(hWnd, &rect))
		{
			VeInt32 w = rect.right;
			VeInt32 h = rect.bottom;
			if ((pkWindow->w && pkWindow->w != w) || (pkWindow->h && pkWindow->h != h))
			{
				SetWindowPositionInternal(pkWindow,
					SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE);
			}
			else
			{
				pkWindow->w = w;
				pkWindow->h = h;
			}
		}
	}

	{
		POINT point;
		point.x = 0;
		point.y = 0;
		if (ClientToScreen(hWnd, &point))
		{
			pkWindow->x = point.x;
			pkWindow->y = point.y;
		}
	}

	{
		DWORD style = GetWindowLong(hWnd, GWL_STYLE);
		if (style & WS_VISIBLE)
		{
			pkWindow->m_u32Flags |= VE_WINDOW_SHOWN;
		}
		else
		{
			pkWindow->m_u32Flags &= ~VE_WINDOW_SHOWN;
		}
		if (style & (WS_BORDER | WS_THICKFRAME))
		{
			pkWindow->m_u32Flags &= ~VE_WINDOW_BORDERLESS;
		}
		else
		{
			pkWindow->m_u32Flags |= VE_WINDOW_BORDERLESS;
		}
		if (style & WS_THICKFRAME)
		{
			pkWindow->m_u32Flags |= VE_WINDOW_RESIZABLE;
		}
		else
		{
			pkWindow->m_u32Flags &= ~VE_WINDOW_RESIZABLE;
		}
#		ifdef WS_MAXIMIZE
		if (style & WS_MAXIMIZE)
		{
			pkWindow->m_u32Flags |= VE_WINDOW_MAXIMIZED;
		}
		else
#		endif
		{
			pkWindow->m_u32Flags &= ~VE_WINDOW_MAXIMIZED;
		}
#		ifdef WS_MINIMIZE
		if (style & WS_MINIMIZE)
		{
			pkWindow->m_u32Flags |= VE_WINDOW_MINIMIZED;
		}
		else
#		endif
		{
			pkWindow->m_u32Flags &= ~VE_WINDOW_MINIMIZED;
		}
	}

	if (GetFocus() == hWnd)
	{
		pkWindow->m_u32Flags |= VE_WINDOW_INPUT_FOCUS;
		//SDL_SetKeyboardFocus(data->window);

		if (pkWindow->m_u32Flags & VE_WINDOW_INPUT_GRABBED)
		{
			RECT rect;
			GetClientRect(hWnd, &rect);
			ClientToScreen(hWnd, (LPPOINT)& rect);
			ClientToScreen(hWnd, (LPPOINT)& rect + 1);
			ClipCursor(&rect);
		}
	}

	/*if (videodata->RegisterTouchWindow)
	{
		videodata->RegisterTouchWindow(hwnd, (TWF_FINETOUCH | TWF_WANTPALM));
	}*/

	DragAcceptFiles(hWnd, TRUE);

	return true;
}