| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_WINDOW_WINDOW_DELEGATE_H_ | 5 #ifndef VIEWS_WINDOW_WINDOW_DELEGATE_H_ |
| 6 #define VIEWS_WINDOW_WINDOW_DELEGATE_H_ | 6 #define VIEWS_WINDOW_WINDOW_DELEGATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 // Returns true if the window can ever be resized. | 46 // Returns true if the window can ever be resized. |
| 47 virtual bool CanResize() const { | 47 virtual bool CanResize() const { |
| 48 return false; | 48 return false; |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Returns true if the window can ever be maximized. | 51 // Returns true if the window can ever be maximized. |
| 52 virtual bool CanMaximize() const { | 52 virtual bool CanMaximize() const { |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Returns true if the window should be placed on top of all other windows on | |
| 57 // the system, even when it is not active. If HasAlwaysOnTopMenu() returns | |
| 58 // true, then this method is only used the first time the window is opened, it | |
| 59 // is stored in the preferences for next runs. | |
| 60 virtual bool IsAlwaysOnTop() const { | |
| 61 return false; | |
| 62 } | |
| 63 | |
| 64 // Returns whether an "always on top" menu should be added to the system menu | |
| 65 // of the window. | |
| 66 virtual bool HasAlwaysOnTopMenu() const { | |
| 67 return false; | |
| 68 } | |
| 69 | |
| 70 // Returns true if the dialog should be displayed modally to the window that | 56 // Returns true if the dialog should be displayed modally to the window that |
| 71 // opened it. Only windows with WindowType == DIALOG can be modal. | 57 // opened it. Only windows with WindowType == DIALOG can be modal. |
| 72 virtual bool IsModal() const { | 58 virtual bool IsModal() const { |
| 73 return false; | 59 return false; |
| 74 } | 60 } |
| 75 | 61 |
| 76 // Returns the text to be displayed in the window title. | 62 // Returns the text to be displayed in the window title. |
| 77 virtual std::wstring GetWindowTitle() const { | 63 virtual std::wstring GetWindowTitle() const { |
| 78 return L""; | 64 return L""; |
| 79 } | 65 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 98 // Execute a command in the window's controller. Returns true if the command | 84 // Execute a command in the window's controller. Returns true if the command |
| 99 // was handled, false if it was not. | 85 // was handled, false if it was not. |
| 100 virtual bool ExecuteWindowsCommand(int command_id) { return false; } | 86 virtual bool ExecuteWindowsCommand(int command_id) { return false; } |
| 101 | 87 |
| 102 // Returns the window's name identifier. Used to identify this window for | 88 // Returns the window's name identifier. Used to identify this window for |
| 103 // state restoration. | 89 // state restoration. |
| 104 virtual std::wstring GetWindowName() const { | 90 virtual std::wstring GetWindowName() const { |
| 105 return std::wstring(); | 91 return std::wstring(); |
| 106 } | 92 } |
| 107 | 93 |
| 108 // Saves the window's bounds, maximized and always-on-top states. By default | 94 // Saves the window's bounds and maximized states. By default this uses the |
| 109 // this uses the process' local state keyed by window name (See GetWindowName | 95 // process' local state keyed by window name (See GetWindowName above). This |
| 110 // above). This behavior can be overridden to provide additional | 96 // behavior can be overridden to provide additional functionality. |
| 111 // functionality. | 97 virtual void SaveWindowPlacement(const gfx::Rect& bounds, bool maximized); |
| 112 virtual void SaveWindowPlacement(const gfx::Rect& bounds, | |
| 113 bool maximized, | |
| 114 bool always_on_top); | |
| 115 | 98 |
| 116 // Retrieves the window's bounds, maximized and always-on-top states. By | 99 // Retrieves the window's bounds and maximized states. |
| 117 // default, this uses the process' local state keyed by window name (See | 100 // This behavior can be overridden to provide additional functionality. |
| 118 // GetWindowName above). This behavior can be overridden to provide | |
| 119 // additional functionality. | |
| 120 virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const; | 101 virtual bool GetSavedWindowBounds(gfx::Rect* bounds) const; |
| 121 virtual bool GetSavedMaximizedState(bool* maximized) const; | 102 virtual bool GetSavedMaximizedState(bool* maximized) const; |
| 122 virtual bool GetSavedAlwaysOnTopState(bool* always_on_top) const; | |
| 123 | 103 |
| 124 // Called when the window closes. | 104 // Called when the window closes. |
| 125 virtual void WindowClosing() { } | 105 virtual void WindowClosing() { } |
| 126 | 106 |
| 127 // Called when the window is destroyed. No events must be sent or received | 107 // Called when the window is destroyed. No events must be sent or received |
| 128 // after this point. The delegate can use this opportunity to delete itself at | 108 // after this point. The delegate can use this opportunity to delete itself at |
| 129 // this time if necessary. | 109 // this time if necessary. |
| 130 virtual void DeleteDelegate() { } | 110 virtual void DeleteDelegate() { } |
| 131 | 111 |
| 132 // Returns the View that is contained within this Window. | 112 // Returns the View that is contained within this Window. |
| (...skipping 21 matching lines...) Expand all Loading... |
| 154 // initialized to NULL automatically. We do this because we want to allow | 134 // initialized to NULL automatically. We do this because we want to allow |
| 155 // people using this helper to not have to call a ctor on this object. | 135 // people using this helper to not have to call a ctor on this object. |
| 156 // Instead we just release the owning ref this pointer has when we are | 136 // Instead we just release the owning ref this pointer has when we are |
| 157 // destroyed. | 137 // destroyed. |
| 158 scoped_ptr<Window> window_; | 138 scoped_ptr<Window> window_; |
| 159 }; | 139 }; |
| 160 | 140 |
| 161 } // namespace views | 141 } // namespace views |
| 162 | 142 |
| 163 #endif // VIEWS_WINDOW_WINDOW_DELEGATE_H_ | 143 #endif // VIEWS_WINDOW_WINDOW_DELEGATE_H_ |
| OLD | NEW |