2015-01-22 18:55:55 +01:00
|
|
|
// Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
|
|
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
|
|
// can be found in the LICENSE file.
|
|
|
|
|
2016-11-18 00:52:42 +01:00
|
|
|
#ifndef CEF_TESTS_SHARED_BROWSER_UTIL_WIN_H_
|
|
|
|
#define CEF_TESTS_SHARED_BROWSER_UTIL_WIN_H_
|
2015-01-31 01:55:56 +01:00
|
|
|
#pragma once
|
|
|
|
|
2015-01-22 18:55:55 +01:00
|
|
|
#include <windows.h>
|
|
|
|
#include <string>
|
|
|
|
|
2015-08-08 01:00:07 +02:00
|
|
|
#include "include/internal/cef_types_wrappers.h"
|
|
|
|
|
2015-01-22 18:55:55 +01:00
|
|
|
namespace client {
|
|
|
|
|
2018-09-26 13:25:58 +02:00
|
|
|
// Returns the current time in microseconds.
|
|
|
|
uint64_t GetTimeNow();
|
|
|
|
|
2015-01-22 18:55:55 +01:00
|
|
|
// Set the window's user data pointer.
|
|
|
|
void SetUserDataPtr(HWND hWnd, void* ptr);
|
|
|
|
|
|
|
|
// Return the window's user data pointer.
|
|
|
|
template <typename T>
|
|
|
|
T GetUserDataPtr(HWND hWnd) {
|
|
|
|
return reinterpret_cast<T>(GetWindowLongPtr(hWnd, GWLP_USERDATA));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Set the window's window procedure pointer and return the old value.
|
|
|
|
WNDPROC SetWndProcPtr(HWND hWnd, WNDPROC wndProc);
|
|
|
|
|
2015-01-27 01:03:25 +01:00
|
|
|
// Return the resource string with the specified id.
|
|
|
|
std::wstring GetResourceString(UINT id);
|
|
|
|
|
2015-01-23 18:37:23 +01:00
|
|
|
int GetCefMouseModifiers(WPARAM wparam);
|
|
|
|
int GetCefKeyboardModifiers(WPARAM wparam, LPARAM lparam);
|
|
|
|
bool IsKeyDown(WPARAM wparam);
|
|
|
|
|
2015-08-08 01:00:07 +02:00
|
|
|
// Returns the device scale factor. For example, 200% display scaling will
|
|
|
|
// return 2.0.
|
|
|
|
float GetDeviceScaleFactor();
|
|
|
|
|
2015-01-22 18:55:55 +01:00
|
|
|
} // namespace client
|
2015-01-31 01:55:56 +01:00
|
|
|
|
2016-11-18 00:52:42 +01:00
|
|
|
#endif // CEF_TESTS_SHARED_BROWSER_UTIL_WIN_H_
|