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

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

Issue 7129022: Move last of event handlers down to NativeWidgetWin/Gtk. (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_win_unittest.cc ('k') | views/widget/widget.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_WIDGET_H_ 5 #ifndef VIEWS_WIDGET_WIDGET_H_
6 #define VIEWS_WIDGET_WIDGET_H_ 6 #define VIEWS_WIDGET_WIDGET_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 public FocusTraversable { 86 public FocusTraversable {
87 public: 87 public:
88 enum FrameType { 88 enum FrameType {
89 FRAME_TYPE_DEFAULT, // Use whatever the default would be. 89 FRAME_TYPE_DEFAULT, // Use whatever the default would be.
90 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame. 90 FRAME_TYPE_FORCE_CUSTOM, // Force the custom frame.
91 FRAME_TYPE_FORCE_NATIVE // Force the native frame. 91 FRAME_TYPE_FORCE_NATIVE // Force the native frame.
92 }; 92 };
93 93
94 struct InitParams { 94 struct InitParams {
95 enum Type { 95 enum Type {
96 TYPE_WINDOW, // A Window, like a frame window. 96 TYPE_WINDOW, // A decorated Window, like a frame window.
97 // Widgets of TYPE_WINDOW will have a NonClientView.
97 TYPE_WINDOW_FRAMELESS, 98 TYPE_WINDOW_FRAMELESS,
98 // An undecorated Window. 99 // An undecorated Window.
99 TYPE_CONTROL, // A control, like a button. 100 TYPE_CONTROL, // A control, like a button.
100 TYPE_POPUP, // An undecorated Window, with transient properties. 101 TYPE_POPUP, // An undecorated Window, with transient properties.
101 TYPE_MENU // An undecorated Window, with transient properties 102 TYPE_MENU // An undecorated Window, with transient properties
102 // specialized to menus. 103 // specialized to menus.
103 }; 104 };
104 enum Ownership { 105 enum Ownership {
105 // Default. Creator is not responsible for managing the lifetime of the 106 // Default. Creator is not responsible for managing the lifetime of the
106 // Widget, it is destroyed when the corresponding NativeWidget is 107 // Widget, it is destroyed when the corresponding NativeWidget is
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 gfx::Rect* rect); 160 gfx::Rect* rect);
160 161
161 // SetPureViews and IsPureViews update and return the state of a global 162 // SetPureViews and IsPureViews update and return the state of a global
162 // setting that tracks whether to use available pure Views implementations. 163 // setting that tracks whether to use available pure Views implementations.
163 static void SetPureViews(bool pure); 164 static void SetPureViews(bool pure);
164 static bool IsPureViews(); 165 static bool IsPureViews();
165 166
166 // Passes through to NativeWidget::GetWidgetForNativeView(). 167 // Passes through to NativeWidget::GetWidgetForNativeView().
167 static Widget* GetWidgetForNativeView(gfx::NativeView native_view); 168 static Widget* GetWidgetForNativeView(gfx::NativeView native_view);
168 169
170
171 // Returns the preferred size of the contents view of this window based on
172 // its localized size data. The width in cols is held in a localized string
173 // resource identified by |col_resource_id|, the height in the same fashion.
174 // TODO(beng): This should eventually live somewhere else, probably closer to
175 // ClientView.
176 static int GetLocalizedContentsWidth(int col_resource_id);
177 static int GetLocalizedContentsHeight(int row_resource_id);
178 static gfx::Size GetLocalizedContentsSize(int col_resource_id,
179 int row_resource_id);
180
169 void Init(const InitParams& params); 181 void Init(const InitParams& params);
170 182
171 // Unconverted methods ------------------------------------------------------- 183 // Unconverted methods -------------------------------------------------------
172 184
173 // TODO(beng): reorder, they've been converted now. 185 // TODO(beng): reorder, they've been converted now.
174 186
175 // Returns the gfx::NativeView associated with this Widget. 187 // Returns the gfx::NativeView associated with this Widget.
176 gfx::NativeView GetNativeView() const; 188 gfx::NativeView GetNativeView() const;
177 189
178 // Returns the gfx::NativeWindow associated with this Widget. This may return 190 // Returns the gfx::NativeWindow associated with this Widget. This may return
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 bool send_native_event); 452 bool send_native_event);
441 453
442 const NativeWidget* native_widget() const { return native_widget_; } 454 const NativeWidget* native_widget() const { return native_widget_; }
443 NativeWidget* native_widget() { return native_widget_; } 455 NativeWidget* native_widget() { return native_widget_; }
444 456
445 // TODO(beng): remove once Window is folded in. 457 // TODO(beng): remove once Window is folded in.
446 virtual Window* AsWindow(); 458 virtual Window* AsWindow();
447 virtual const Window* AsWindow() const; 459 virtual const Window* AsWindow() const;
448 460
449 // Overridden from NativeWidgetDelegate: 461 // Overridden from NativeWidgetDelegate:
462 virtual bool IsModal() const OVERRIDE;
463 virtual bool IsDialogBox() const OVERRIDE;
450 virtual bool CanActivate() const OVERRIDE; 464 virtual bool CanActivate() const OVERRIDE;
451 virtual bool IsInactiveRenderingDisabled() const OVERRIDE; 465 virtual bool IsInactiveRenderingDisabled() const OVERRIDE;
452 virtual void EnableInactiveRendering() OVERRIDE; 466 virtual void EnableInactiveRendering() OVERRIDE;
453 virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE; 467 virtual void OnNativeWidgetActivationChanged(bool active) OVERRIDE;
454 virtual void OnNativeFocus(gfx::NativeView focused_view) OVERRIDE; 468 virtual void OnNativeFocus(gfx::NativeView focused_view) OVERRIDE;
455 virtual void OnNativeBlur(gfx::NativeView focused_view) OVERRIDE; 469 virtual void OnNativeBlur(gfx::NativeView focused_view) OVERRIDE;
456 virtual void OnNativeWidgetCreated() OVERRIDE; 470 virtual void OnNativeWidgetCreated() OVERRIDE;
457 virtual void OnNativeWidgetDestroying() OVERRIDE; 471 virtual void OnNativeWidgetDestroying() OVERRIDE;
458 virtual void OnNativeWidgetDestroyed() OVERRIDE; 472 virtual void OnNativeWidgetDestroyed() OVERRIDE;
459 virtual gfx::Size GetMinimumSize() OVERRIDE; 473 virtual gfx::Size GetMinimumSize() OVERRIDE;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 // Try to create a compositor if one hasn't been created yet. 525 // Try to create a compositor if one hasn't been created yet.
512 void EnsureCompositor(); 526 void EnsureCompositor();
513 527
514 // Returns whether capture should be released on mouse release. 528 // Returns whether capture should be released on mouse release.
515 virtual bool ShouldReleaseCaptureOnMouseReleased() const; 529 virtual bool ShouldReleaseCaptureOnMouseReleased() const;
516 530
517 // Persists the window's restored position and maximized state using the 531 // Persists the window's restored position and maximized state using the
518 // window delegate. 532 // window delegate.
519 void SaveWindowPosition(); 533 void SaveWindowPosition();
520 534
535 // Sizes and positions the window just after it is created.
536 void SetInitialBounds(const gfx::Rect& bounds);
537
521 NativeWidget* native_widget_; 538 NativeWidget* native_widget_;
522 539
523 // Non-owned pointer to the Widget's delegate. May be NULL if no delegate is 540 // Non-owned pointer to the Widget's delegate. May be NULL if no delegate is
524 // being used. 541 // being used.
525 WidgetDelegate* widget_delegate_; 542 WidgetDelegate* widget_delegate_;
526 543
527 // The root of the View hierarchy attached to this window. 544 // The root of the View hierarchy attached to this window.
528 // WARNING: see warning in tooltip_manager_ for ordering dependencies with 545 // WARNING: see warning in tooltip_manager_ for ordering dependencies with
529 // this and tooltip_manager_. 546 // this and tooltip_manager_.
530 scoped_ptr<internal::RootView> root_view_; 547 scoped_ptr<internal::RootView> root_view_;
(...skipping 30 matching lines...) Expand all
561 // FRAME_TYPE_DEFAULT. 578 // FRAME_TYPE_DEFAULT.
562 FrameType frame_type_; 579 FrameType frame_type_;
563 580
564 // True when the window should be rendered as active, regardless of whether 581 // True when the window should be rendered as active, regardless of whether
565 // or not it actually is. 582 // or not it actually is.
566 bool disable_inactive_rendering_; 583 bool disable_inactive_rendering_;
567 584
568 // Set to true if the widget is in the process of closing. 585 // Set to true if the widget is in the process of closing.
569 bool widget_closed_; 586 bool widget_closed_;
570 587
588 // The saved maximized state for this window. See note in SetInitialBounds
589 // that explains why we save this.
590 bool saved_maximized_state_;
591
592 // The smallest size the window can be.
593 gfx::Size minimum_size_;
594
571 DISALLOW_COPY_AND_ASSIGN(Widget); 595 DISALLOW_COPY_AND_ASSIGN(Widget);
572 }; 596 };
573 597
574 } // namespace views 598 } // namespace views
575 599
576 #endif // VIEWS_WIDGET_WIDGET_H_ 600 #endif // VIEWS_WIDGET_WIDGET_H_
OLDNEW
« no previous file with comments | « views/widget/native_widget_win_unittest.cc ('k') | views/widget/widget.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698