| OLD | NEW |
| 1 // Copyright (c) 2010 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 APP_WIN_HWND_UTIL_H_ | 5 #ifndef UI_BASE_WIN_HWND_UTIL_H_ |
| 6 #define APP_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 | 12 |
| 13 namespace gfx { | 13 namespace gfx { |
| 14 class Size; | 14 class Size; |
| 15 } | 15 } |
| 16 | 16 |
| 17 namespace app { | 17 namespace ui { |
| 18 namespace win { | |
| 19 | 18 |
| 20 // A version of the GetClassNameW API that returns the class name in an | 19 // 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. | 20 // string16. An empty result indicates a failure to get the class name. |
| 22 string16 GetClassName(HWND hwnd); | 21 string16 GetClassName(HWND hwnd); |
| 23 | 22 |
| 24 // Useful for subclassing a HWND. Returns the previous window procedure. | 23 // Useful for subclassing a HWND. Returns the previous window procedure. |
| 25 WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc); | 24 WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc); |
| 26 | 25 |
| 27 // Pointer-friendly wrappers around Get/SetWindowLong(..., GWLP_USERDATA, ...) | 26 // Pointer-friendly wrappers around Get/SetWindowLong(..., GWLP_USERDATA, ...) |
| 28 // Returns the previously set value. | 27 // Returns the previously set value. |
| 29 void* SetWindowUserData(HWND hwnd, void* user_data); | 28 void* SetWindowUserData(HWND hwnd, void* user_data); |
| 30 void* GetWindowUserData(HWND hwnd); | 29 void* GetWindowUserData(HWND hwnd); |
| 31 | 30 |
| 32 // Returns true if the specified window is the current active top window or one | 31 // Returns true if the specified window is the current active top window or one |
| 33 // of its children. | 32 // of its children. |
| 34 bool DoesWindowBelongToActiveWindow(HWND window); | 33 bool DoesWindowBelongToActiveWindow(HWND window); |
| 35 | 34 |
| 36 // Sizes the window to have a client or window size (depending on the value of | 35 // 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 | 36 // |pref_is_client|) of pref, then centers the window over parent, ensuring the |
| 38 // window fits on screen. | 37 // window fits on screen. |
| 39 void CenterAndSizeWindow(HWND parent, | 38 void CenterAndSizeWindow(HWND parent, |
| 40 HWND window, | 39 HWND window, |
| 41 const gfx::Size& pref, | 40 const gfx::Size& pref, |
| 42 bool pref_is_client); | 41 bool pref_is_client); |
| 43 | 42 |
| 44 // Returns true if we are on Windows Vista or greater and composition is | 43 // Returns true if we are on Windows Vista or greater and composition is |
| 45 // enabled. | 44 // enabled. |
| 46 bool ShouldUseVistaFrame(); | 45 bool ShouldUseVistaFrame(); |
| 47 | 46 |
| 48 } // namespace win | 47 } // namespace ui |
| 49 } // namespace app | |
| 50 | 48 |
| 51 #endif // APP_WIN_HWND_UTIL_H_ | 49 #endif // UI_BASE_WIN_HWND_UTIL_H_ |
| OLD | NEW |