| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_BASE_WIN_HWND_UTIL_H_ | 5 #ifndef UI_BASE_WIN_HWND_UTIL_H_ |
| 6 #define UI_BASE_WIN_HWND_UTIL_H_ | 6 #define UI_BASE_WIN_HWND_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 | 10 |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "ui/ui_api.h" | 12 #include "ui/base/ui_export.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Size; | 15 class Size; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace ui { | 18 namespace ui { |
| 19 | 19 |
| 20 // A version of the GetClassNameW API that returns the class name in an | 20 // A version of the GetClassNameW API that returns the class name in an |
| 21 // string16. An empty result indicates a failure to get the class name. | 21 // string16. An empty result indicates a failure to get the class name. |
| 22 UI_API string16 GetClassName(HWND hwnd); | 22 UI_EXPORT string16 GetClassName(HWND hwnd); |
| 23 | 23 |
| 24 // Useful for subclassing a HWND. Returns the previous window procedure. | 24 // Useful for subclassing a HWND. Returns the previous window procedure. |
| 25 UI_API WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc); | 25 UI_EXPORT WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc); |
| 26 | 26 |
| 27 // Pointer-friendly wrappers around Get/SetWindowLong(..., GWLP_USERDATA, ...) | 27 // Pointer-friendly wrappers around Get/SetWindowLong(..., GWLP_USERDATA, ...) |
| 28 // Returns the previously set value. | 28 // Returns the previously set value. |
| 29 UI_API void* SetWindowUserData(HWND hwnd, void* user_data); | 29 UI_EXPORT void* SetWindowUserData(HWND hwnd, void* user_data); |
| 30 UI_API void* GetWindowUserData(HWND hwnd); | 30 UI_EXPORT void* GetWindowUserData(HWND hwnd); |
| 31 | 31 |
| 32 // Returns true if the specified window is the current active top window or one | 32 // Returns true if the specified window is the current active top window or one |
| 33 // of its children. | 33 // of its children. |
| 34 UI_API bool DoesWindowBelongToActiveWindow(HWND window); | 34 UI_EXPORT bool DoesWindowBelongToActiveWindow(HWND window); |
| 35 | 35 |
| 36 // Sizes the window to have a client or window size (depending on the value of | 36 // Sizes the window to have a client or window size (depending on the value of |
| 37 // |pref_is_client|) of pref, then centers the window over parent, ensuring the | 37 // |pref_is_client|) of pref, then centers the window over parent, ensuring the |
| 38 // window fits on screen. | 38 // window fits on screen. |
| 39 UI_API void CenterAndSizeWindow(HWND parent, | 39 UI_EXPORT void CenterAndSizeWindow(HWND parent, |
| 40 HWND window, | 40 HWND window, |
| 41 const gfx::Size& pref, | 41 const gfx::Size& pref, |
| 42 bool pref_is_client); | 42 bool pref_is_client); |
| 43 | 43 |
| 44 // If |hwnd| is NULL logs various thing and CHECKs. Invoke right after calling | 44 // If |hwnd| is NULL logs various thing and CHECKs. Invoke right after calling |
| 45 // CreateWindow. | 45 // CreateWindow. |
| 46 UI_API void CheckWindowCreated(HWND hwnd); | 46 UI_EXPORT void CheckWindowCreated(HWND hwnd); |
| 47 | 47 |
| 48 // Shows the system menu for |window| and sends the selected command (if the | 48 // Shows the system menu for |window| and sends the selected command (if the |
| 49 // user selected something. | 49 // user selected something. |
| 50 UI_API void ShowSystemMenu(HWND window, int screen_x, int screen_y); | 50 UI_EXPORT void ShowSystemMenu(HWND window, int screen_x, int screen_y); |
| 51 | 51 |
| 52 } // namespace ui | 52 } // namespace ui |
| 53 | 53 |
| 54 #endif // UI_BASE_WIN_HWND_UTIL_H_ | 54 #endif // UI_BASE_WIN_HWND_UTIL_H_ |
| OLD | NEW |