[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 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 | ||||
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | 5f39adc | 2013-05-23 11:50:46 | [diff] [blame] | 5 | #ifndef UI_BASE_BASE_WINDOW_H_ |
6 | #define UI_BASE_BASE_WINDOW_H_ | ||||
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 7 | |
8 | #include "base/compiler_specific.h" | ||||
[email protected] | 68eeede | 2013-05-09 06:10:57 | [diff] [blame] | 9 | #include "ui/base/ui_base_types.h" // WindowShowState |
[email protected] | 764864e | 2012-06-11 19:16:16 | [diff] [blame] | 10 | #include "ui/gfx/native_widget_types.h" |
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 11 | |
12 | namespace gfx { | ||||
13 | class Rect; | ||||
14 | } | ||||
15 | |||||
[email protected] | 1443fe8 | 2012-04-02 08:48:03 | [diff] [blame] | 16 | class SkRegion; |
17 | |||||
[email protected] | 5f39adc | 2013-05-23 11:50:46 | [diff] [blame] | 18 | namespace ui { |
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 19 | |
[email protected] | 5f39adc | 2013-05-23 11:50:46 | [diff] [blame] | 20 | // Provides an interface to perform actions on windows, and query window |
21 | // state. | ||||
[email protected] | 9552c2d | 2014-01-06 02:05:32 | [diff] [blame] | 22 | class UI_BASE_EXPORT BaseWindow { |
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 23 | public: |
24 | // Returns true if the window is currently the active/focused window. | ||||
25 | virtual bool IsActive() const = 0; | ||||
26 | |||||
27 | // Returns true if the window is maximized (aka zoomed). | ||||
28 | virtual bool IsMaximized() const = 0; | ||||
29 | |||||
30 | // Returns true if the window is minimized. | ||||
31 | virtual bool IsMinimized() const = 0; | ||||
32 | |||||
[email protected] | c80ed69 | 2012-04-18 19:51:10 | [diff] [blame] | 33 | // Returns true if the window is full screen. |
34 | virtual bool IsFullscreen() const = 0; | ||||
35 | |||||
[email protected] | b954da47 | 2013-08-27 00:20:17 | [diff] [blame] | 36 | // Returns true if the window is fully restored (not Fullscreen, Maximized, |
37 | // Minimized). | ||||
38 | static bool IsRestored(const BaseWindow& window); | ||||
39 | |||||
[email protected] | 764864e | 2012-06-11 19:16:16 | [diff] [blame] | 40 | // Return a platform dependent identifier for this window. |
yoz | f506725 | 2014-11-05 22:10:11 | [diff] [blame] | 41 | virtual gfx::NativeWindow GetNativeWindow() const = 0; |
[email protected] | 764864e | 2012-06-11 19:16:16 | [diff] [blame] | 42 | |
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 43 | // Returns the nonmaximized bounds of the window (even if the window is |
44 | // currently maximized or minimized) in terms of the screen coordinates. | ||||
45 | virtual gfx::Rect GetRestoredBounds() const = 0; | ||||
46 | |||||
[email protected] | 68eeede | 2013-05-09 06:10:57 | [diff] [blame] | 47 | // Returns the restore state for the window (platform dependent). |
48 | virtual ui::WindowShowState GetRestoredState() const = 0; | ||||
49 | |||||
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 50 | // Retrieves the window's current bounds, including its window. |
51 | // This will only differ from GetRestoredBounds() for maximized | ||||
52 | // and minimized windows. | ||||
53 | virtual gfx::Rect GetBounds() const = 0; | ||||
54 | |||||
55 | // Shows the window, or activates it if it's already visible. | ||||
56 | virtual void Show() = 0; | ||||
57 | |||||
[email protected] | 7d412f7 | 2012-10-25 04:59:15 | [diff] [blame] | 58 | // Hides the window. |
59 | virtual void Hide() = 0; | ||||
60 | |||||
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 61 | // Show the window, but do not activate it. Does nothing if window |
62 | // is already visible. | ||||
63 | virtual void ShowInactive() = 0; | ||||
64 | |||||
65 | // Closes the window as soon as possible. The close action may be delayed | ||||
66 | // if an operation is in progress (e.g. a drag operation). | ||||
67 | virtual void Close() = 0; | ||||
68 | |||||
69 | // Activates (brings to front) the window. Restores the window from minimized | ||||
70 | // state if necessary. | ||||
71 | virtual void Activate() = 0; | ||||
72 | |||||
73 | // Deactivates the window, making the next window in the Z order the active | ||||
74 | // window. | ||||
75 | virtual void Deactivate() = 0; | ||||
76 | |||||
77 | // Maximizes/minimizes/restores the window. | ||||
78 | virtual void Maximize() = 0; | ||||
79 | virtual void Minimize() = 0; | ||||
80 | virtual void Restore() = 0; | ||||
81 | |||||
82 | // Sets the window's size and position to the specified values. | ||||
83 | virtual void SetBounds(const gfx::Rect& bounds) = 0; | ||||
84 | |||||
85 | // Flashes the taskbar item associated with this window. | ||||
86 | // Set |flash| to true to initiate flashing, false to stop flashing. | ||||
87 | virtual void FlashFrame(bool flash) = 0; | ||||
[email protected] | d101b0c | 2012-03-16 00:30:57 | [diff] [blame] | 88 | |
89 | // Returns true if a window is set to be always on top. | ||||
90 | virtual bool IsAlwaysOnTop() const = 0; | ||||
[email protected] | 46d4605 | 2013-10-11 11:27:22 | [diff] [blame] | 91 | |
92 | // If set to true, the window will stay on top of other windows which do not | ||||
93 | // have this flag enabled. | ||||
94 | virtual void SetAlwaysOnTop(bool always_on_top) = 0; | ||||
[email protected] | 41d9faf | 2012-02-28 23:46:02 | [diff] [blame] | 95 | }; |
96 | |||||
[email protected] | 5f39adc | 2013-05-23 11:50:46 | [diff] [blame] | 97 | } // namespace ui |
98 | |||||
99 | #endif // UI_BASE_BASE_WINDOW_H_ |