Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(873)

Side by Side Diff: views/widget/native_widget_win.h

Issue 7054052: Move more from Window onto Widget. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « views/widget/native_widget_views.cc ('k') | views/widget/native_widget_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ 5 #ifndef VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_
6 #define VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ 6 #define VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_
7 #pragma once 7 #pragma once
8 8
9 #include <atlbase.h> 9 #include <atlbase.h>
10 #include <atlapp.h> 10 #include <atlapp.h>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 public MessageLoopForUI::Observer, 81 public MessageLoopForUI::Observer,
82 public internal::InputMethodDelegate { 82 public internal::InputMethodDelegate {
83 public: 83 public:
84 explicit NativeWidgetWin(internal::NativeWidgetDelegate* delegate); 84 explicit NativeWidgetWin(internal::NativeWidgetDelegate* delegate);
85 virtual ~NativeWidgetWin(); 85 virtual ~NativeWidgetWin();
86 86
87 // Returns true if we are on Windows Vista or greater and composition is 87 // Returns true if we are on Windows Vista or greater and composition is
88 // enabled. 88 // enabled.
89 static bool IsAeroGlassEnabled(); 89 static bool IsAeroGlassEnabled();
90 90
91 // Show the window with the specified show command.
92 void Show(int show_state);
93
91 // Disable Layered Window updates by setting to false. 94 // Disable Layered Window updates by setting to false.
92 void set_can_update_layered_window(bool can_update_layered_window) { 95 void set_can_update_layered_window(bool can_update_layered_window) {
93 can_update_layered_window_ = can_update_layered_window; 96 can_update_layered_window_ = can_update_layered_window;
94 } 97 }
95 98
96 // Obtain the view event with the given MSAA child id. Used in 99 // Obtain the view event with the given MSAA child id. Used in
97 // NativeViewAccessibilityWin::get_accChild to support requests for 100 // NativeViewAccessibilityWin::get_accChild to support requests for
98 // children of windowless controls. May return NULL 101 // children of windowless controls. May return NULL
99 // (see ViewHierarchyChanged). 102 // (see ViewHierarchyChanged).
100 View* GetAccessibilityViewEventAt(int id); 103 View* GetAccessibilityViewEventAt(int id);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 virtual void GetWindowBoundsAndMaximizedState(gfx::Rect* bounds, 207 virtual void GetWindowBoundsAndMaximizedState(gfx::Rect* bounds,
205 bool* maximized) const OVERRIDE; 208 bool* maximized) const OVERRIDE;
206 virtual void SetWindowTitle(const std::wstring& title) OVERRIDE; 209 virtual void SetWindowTitle(const std::wstring& title) OVERRIDE;
207 virtual void SetWindowIcons(const SkBitmap& window_icon, 210 virtual void SetWindowIcons(const SkBitmap& window_icon,
208 const SkBitmap& app_icon) OVERRIDE; 211 const SkBitmap& app_icon) OVERRIDE;
209 virtual void SetAccessibleName(const std::wstring& name) OVERRIDE; 212 virtual void SetAccessibleName(const std::wstring& name) OVERRIDE;
210 virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE; 213 virtual void SetAccessibleRole(ui::AccessibilityTypes::Role role) OVERRIDE;
211 virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE; 214 virtual void SetAccessibleState(ui::AccessibilityTypes::State state) OVERRIDE;
212 virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE; 215 virtual gfx::Rect GetWindowScreenBounds() const OVERRIDE;
213 virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE; 216 virtual gfx::Rect GetClientAreaScreenBounds() const OVERRIDE;
217 virtual gfx::Rect GetRestoredBounds() const OVERRIDE;
214 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 218 virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
215 virtual void SetSize(const gfx::Size& size) OVERRIDE; 219 virtual void SetSize(const gfx::Size& size) OVERRIDE;
216 virtual void SetBoundsConstrained(const gfx::Rect& bounds, 220 virtual void SetBoundsConstrained(const gfx::Rect& bounds,
217 Widget* other_widget) OVERRIDE; 221 Widget* other_widget) OVERRIDE;
218 virtual void MoveAbove(gfx::NativeView native_view) OVERRIDE; 222 virtual void MoveAbove(gfx::NativeView native_view) OVERRIDE;
219 virtual void SetShape(gfx::NativeRegion shape) OVERRIDE; 223 virtual void SetShape(gfx::NativeRegion shape) OVERRIDE;
220 virtual void Close() OVERRIDE; 224 virtual void Close() OVERRIDE;
221 virtual void CloseNow() OVERRIDE; 225 virtual void CloseNow() OVERRIDE;
226 virtual void EnableClose(bool enable) OVERRIDE;
222 virtual void Show() OVERRIDE; 227 virtual void Show() OVERRIDE;
223 virtual void Hide() OVERRIDE; 228 virtual void Hide() OVERRIDE;
229 virtual void ShowNativeWidget(ShowState state) OVERRIDE;
224 virtual bool IsVisible() const OVERRIDE; 230 virtual bool IsVisible() const OVERRIDE;
225 virtual void Activate() OVERRIDE; 231 virtual void Activate() OVERRIDE;
226 virtual void Deactivate() OVERRIDE; 232 virtual void Deactivate() OVERRIDE;
227 virtual bool IsActive() const OVERRIDE; 233 virtual bool IsActive() const OVERRIDE;
228 virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; 234 virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE;
229 virtual void Maximize() OVERRIDE; 235 virtual void Maximize() OVERRIDE;
230 virtual void Minimize() OVERRIDE; 236 virtual void Minimize() OVERRIDE;
231 virtual bool IsMaximized() const OVERRIDE; 237 virtual bool IsMaximized() const OVERRIDE;
232 virtual bool IsMinimized() const OVERRIDE; 238 virtual bool IsMinimized() const OVERRIDE;
233 virtual void Restore() OVERRIDE; 239 virtual void Restore() OVERRIDE;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 virtual void OnSysCommand(UINT notification_code, CPoint click); 417 virtual void OnSysCommand(UINT notification_code, CPoint click);
412 virtual void OnThemeChanged(); 418 virtual void OnThemeChanged();
413 virtual void OnVScroll(int scroll_type, short position, HWND scrollbar); 419 virtual void OnVScroll(int scroll_type, short position, HWND scrollbar);
414 virtual void OnWindowPosChanging(WINDOWPOS* window_pos); 420 virtual void OnWindowPosChanging(WINDOWPOS* window_pos);
415 virtual void OnWindowPosChanged(WINDOWPOS* window_pos); 421 virtual void OnWindowPosChanged(WINDOWPOS* window_pos);
416 422
417 // Deletes this window as it is destroyed, override to provide different 423 // Deletes this window as it is destroyed, override to provide different
418 // behavior. 424 // behavior.
419 virtual void OnFinalMessage(HWND window); 425 virtual void OnFinalMessage(HWND window);
420 426
427 // Retrieve the show state of the window. This is one of the SW_SHOW* flags
428 // passed into Windows' ShowWindow method. For normal windows this defaults
429 // to SW_SHOWNORMAL, however windows (e.g. the main window) can override this
430 // method to provide different values (e.g. retrieve the user's specified
431 // show state from the shortcut starutp info).
432 virtual int GetShowState() const;
433
434 // Returns the insets of the client area relative to the non-client area of
435 // the window. Override this function instead of OnNCCalcSize, which is
436 // crazily complicated.
437 virtual gfx::Insets GetClientAreaInsets() const;
438
421 // Start tracking all mouse events so that this window gets sent mouse leave 439 // Start tracking all mouse events so that this window gets sent mouse leave
422 // messages too. 440 // messages too.
423 void TrackMouseEvents(DWORD mouse_tracking_flags); 441 void TrackMouseEvents(DWORD mouse_tracking_flags);
424 442
425 // Called when a MSAA screen reader client is detected. 443 // Called when a MSAA screen reader client is detected.
426 virtual void OnScreenReaderDetected(); 444 virtual void OnScreenReaderDetected();
427 445
428 // Sets-up the focus manager with the view that should have focus when the 446 // Sets-up the focus manager with the view that should have focus when the
429 // window is shown the first time. If NULL is returned, the focus goes to the 447 // window is shown the first time. If NULL is returned, the focus goes to the
430 // button if there is one, otherwise the to the Cancel button. 448 // button if there is one, otherwise the to the Cancel button.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 486
469 void SetInitParams(const Widget::InitParams& params); 487 void SetInitParams(const Widget::InitParams& params);
470 488
471 // Synchronously paints the invalid contents of the Widget. 489 // Synchronously paints the invalid contents of the Widget.
472 void RedrawInvalidRect(); 490 void RedrawInvalidRect();
473 491
474 // Synchronously updates the invalid contents of the Widget. Valid for 492 // Synchronously updates the invalid contents of the Widget. Valid for
475 // layered windows only. 493 // layered windows only.
476 void RedrawLayeredWindowContents(); 494 void RedrawLayeredWindowContents();
477 495
496 // Lock or unlock the window from being able to redraw itself in response to
497 // updates to its invalid region.
498 class ScopedRedrawLock;
499 void LockUpdates();
500 void UnlockUpdates();
501
478 // Responds to the client area changing size, either at window creation time 502 // Responds to the client area changing size, either at window creation time
479 // or subsequently. 503 // or subsequently.
480 void ClientAreaSizeChanged(); 504 void ClientAreaSizeChanged();
481 505
482 // Resets the window region for the current widget bounds if necessary. 506 // Resets the window region for the current widget bounds if necessary.
483 // If |force| is true, the window region is reset to NULL even for native 507 // If |force| is true, the window region is reset to NULL even for native
484 // frame windows. 508 // frame windows.
485 void ResetWindowRegion(bool force); 509 void ResetWindowRegion(bool force);
486 510
511 // Calls the default WM_NCACTIVATE handler with the specified activation
512 // value, safely wrapping the call in a ScopedRedrawLock to prevent frame
513 // flicker.
514 LRESULT CallDefaultNCActivateHandler(BOOL active);
515
487 // Overridden from NativeWidget. 516 // Overridden from NativeWidget.
488 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE; 517 virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
489 518
490 // Overridden from internal::InputMethodDelegate 519 // Overridden from internal::InputMethodDelegate
491 virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE; 520 virtual void DispatchKeyEventPostIME(const KeyEvent& key) OVERRIDE;
492 521
493 // A delegate implementation that handles events received here. 522 // A delegate implementation that handles events received here.
494 // See class documentation for Widget in widget.h for a note about ownership. 523 // See class documentation for Widget in widget.h for a note about ownership.
495 internal::NativeWidgetDelegate* delegate_; 524 internal::NativeWidgetDelegate* delegate_;
496 525
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 // If this is greater than zero, we should prevent attempts to make the window 612 // If this is greater than zero, we should prevent attempts to make the window
584 // visible when we handle WM_WINDOWPOSCHANGING. Some calls like 613 // visible when we handle WM_WINDOWPOSCHANGING. Some calls like
585 // ShowWindow(SW_RESTORE) make the window visible in addition to restoring it, 614 // ShowWindow(SW_RESTORE) make the window visible in addition to restoring it,
586 // when all we want to do is restore it. 615 // when all we want to do is restore it.
587 int force_hidden_count_; 616 int force_hidden_count_;
588 617
589 // The window styles before we modified them for the drag frame appearance. 618 // The window styles before we modified them for the drag frame appearance.
590 DWORD drag_frame_saved_window_style_; 619 DWORD drag_frame_saved_window_style_;
591 DWORD drag_frame_saved_window_ex_style_; 620 DWORD drag_frame_saved_window_ex_style_;
592 621
622 // True if updates to this window are currently locked.
623 bool lock_updates_;
624
625 // The window styles of the window before updates were locked.
626 DWORD saved_window_style_;
627
593 DISALLOW_COPY_AND_ASSIGN(NativeWidgetWin); 628 DISALLOW_COPY_AND_ASSIGN(NativeWidgetWin);
594 }; 629 };
595 630
596 } // namespace views 631 } // namespace views
597 632
598 #endif // VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_ 633 #endif // VIEWS_WIDGET_NATIVE_WIDGET_WIN_H_
OLDNEW
« no previous file with comments | « views/widget/native_widget_views.cc ('k') | views/widget/native_widget_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698