OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 5 #ifndef UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 6 #define UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 182 |
183 void SetVisibilityChangedAnimationsEnabled(bool enabled); | 183 void SetVisibilityChangedAnimationsEnabled(bool enabled); |
184 | 184 |
185 // Returns true if the title changed. | 185 // Returns true if the title changed. |
186 bool SetTitle(const base::string16& title); | 186 bool SetTitle(const base::string16& title); |
187 | 187 |
188 void SetCursor(HCURSOR cursor); | 188 void SetCursor(HCURSOR cursor); |
189 | 189 |
190 void FrameTypeChanged(); | 190 void FrameTypeChanged(); |
191 | 191 |
192 void SchedulePaintInRect(const gfx::Rect& rect); | |
193 void SetOpacity(BYTE opacity); | |
194 | |
195 void SetWindowIcons(const gfx::ImageSkia& window_icon, | 192 void SetWindowIcons(const gfx::ImageSkia& window_icon, |
196 const gfx::ImageSkia& app_icon); | 193 const gfx::ImageSkia& app_icon); |
197 | 194 |
198 void set_remove_standard_frame(bool remove_standard_frame) { | 195 void set_remove_standard_frame(bool remove_standard_frame) { |
199 remove_standard_frame_ = remove_standard_frame; | 196 remove_standard_frame_ = remove_standard_frame; |
200 } | 197 } |
201 | 198 |
202 void set_use_system_default_icon(bool use_system_default_icon) { | 199 void set_use_system_default_icon(bool use_system_default_icon) { |
203 use_system_default_icon_ = use_system_default_icon; | 200 use_system_default_icon_ = use_system_default_icon; |
204 } | 201 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 295 |
299 // Lock or unlock the window from being able to redraw itself in response to | 296 // Lock or unlock the window from being able to redraw itself in response to |
300 // updates to its invalid region. | 297 // updates to its invalid region. |
301 class ScopedRedrawLock; | 298 class ScopedRedrawLock; |
302 void LockUpdates(bool force); | 299 void LockUpdates(bool force); |
303 void UnlockUpdates(bool force); | 300 void UnlockUpdates(bool force); |
304 | 301 |
305 // Stops ignoring SetWindowPos() requests (see below). | 302 // Stops ignoring SetWindowPos() requests (see below). |
306 void StopIgnoringPosChanges() { ignore_window_pos_changes_ = false; } | 303 void StopIgnoringPosChanges() { ignore_window_pos_changes_ = false; } |
307 | 304 |
308 // Synchronously updates the invalid contents of the Widget. Valid for | |
309 // layered windows only. | |
310 void RedrawLayeredWindowContents(); | |
311 | |
312 // Attempts to force the window to be redrawn, ensuring that it gets | 305 // Attempts to force the window to be redrawn, ensuring that it gets |
313 // onscreen. | 306 // onscreen. |
314 void ForceRedrawWindow(int attempts); | 307 void ForceRedrawWindow(int attempts); |
315 | 308 |
316 // Message Handlers ---------------------------------------------------------- | 309 // Message Handlers ---------------------------------------------------------- |
317 | 310 |
318 BEGIN_SAFE_MSG_MAP_EX(weak_factory_) | 311 BEGIN_SAFE_MSG_MAP_EX(weak_factory_) |
319 // Range handlers must go first! | 312 // Range handlers must go first! |
320 CR_MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange) | 313 CR_MESSAGE_RANGE_HANDLER_EX(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseRange) |
321 CR_MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE, | 314 CR_MESSAGE_RANGE_HANDLER_EX(WM_NCMOUSEMOVE, |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
538 // When true, this flag makes us discard incoming SetWindowPos() requests that | 531 // When true, this flag makes us discard incoming SetWindowPos() requests that |
539 // only change our position/size. (We still allow changes to Z-order, | 532 // only change our position/size. (We still allow changes to Z-order, |
540 // activation, etc.) | 533 // activation, etc.) |
541 bool ignore_window_pos_changes_; | 534 bool ignore_window_pos_changes_; |
542 | 535 |
543 // The last-seen monitor containing us, and its rect and work area. These are | 536 // The last-seen monitor containing us, and its rect and work area. These are |
544 // used to catch updates to the rect and work area and react accordingly. | 537 // used to catch updates to the rect and work area and react accordingly. |
545 HMONITOR last_monitor_; | 538 HMONITOR last_monitor_; |
546 gfx::Rect last_monitor_rect_, last_work_area_; | 539 gfx::Rect last_monitor_rect_, last_work_area_; |
547 | 540 |
548 // Layered windows ----------------------------------------------------------- | |
549 | |
550 // Should we keep an off-screen buffer? This is false by default, set to true | |
551 // when WS_EX_LAYERED is specified before the native window is created. | |
552 // | |
553 // NOTE: this is intended to be used with a layered window (a window with an | |
554 // extended window style of WS_EX_LAYERED). If you are using a layered window | |
555 // and NOT changing the layered alpha or anything else, then leave this value | |
556 // alone. OTOH if you are invoking SetLayeredWindowAttributes then you'll | |
557 // most likely want to set this to false, or after changing the alpha toggle | |
558 // the extended style bit to false than back to true. See MSDN for more | |
559 // details. | |
560 bool use_layered_buffer_; | |
561 | |
562 // The default alpha to be applied to the layered window. | |
563 BYTE layered_alpha_; | |
564 | |
565 // A canvas that contains the window contents in the case of a layered | |
566 // window. | |
567 scoped_ptr<gfx::Canvas> layered_window_contents_; | |
568 | |
569 // We must track the invalid rect ourselves, for two reasons: | |
570 // For layered windows, Windows will not do this properly with | |
571 // InvalidateRect()/GetUpdateRect(). (In fact, it'll return misleading | |
572 // information from GetUpdateRect()). | |
573 // We also need to keep track of the invalid rectangle for the RootView should | |
574 // we need to paint the non-client area. The data supplied to WM_NCPAINT seems | |
575 // to be insufficient. | |
576 gfx::Rect invalid_rect_; | |
577 | |
578 // Set to true when waiting for RedrawLayeredWindowContents(). | |
579 bool waiting_for_redraw_layered_window_contents_; | |
580 | |
581 // True the first time nccalc is called on a sizable widget | 541 // True the first time nccalc is called on a sizable widget |
582 bool is_first_nccalc_; | 542 bool is_first_nccalc_; |
583 | 543 |
584 // Copy of custom window region specified via SetRegion(), if any. | 544 // Copy of custom window region specified via SetRegion(), if any. |
585 base::win::ScopedRegion custom_window_region_; | 545 base::win::ScopedRegion custom_window_region_; |
586 | 546 |
587 // If > 0 indicates a menu is running (we're showing a native menu). | 547 // If > 0 indicates a menu is running (we're showing a native menu). |
588 int menu_depth_; | 548 int menu_depth_; |
589 | 549 |
590 // Generates touch-ids for touch-events. | 550 // Generates touch-ids for touch-events. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 | 596 |
637 // The factory used with BEGIN_SAFE_MSG_MAP_EX. | 597 // The factory used with BEGIN_SAFE_MSG_MAP_EX. |
638 base::WeakPtrFactory<HWNDMessageHandler> weak_factory_; | 598 base::WeakPtrFactory<HWNDMessageHandler> weak_factory_; |
639 | 599 |
640 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); | 600 DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); |
641 }; | 601 }; |
642 | 602 |
643 } // namespace views | 603 } // namespace views |
644 | 604 |
645 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ | 605 #endif // UI_VIEWS_WIN_HWND_MESSAGE_HANDLER_H_ |
OLD | NEW |