blob: 883dfc4311f5e52a9f23059cc3d89fb1488f54c2 [file] [log] [blame]
[email protected]41d9faf2012-02-28 23:46:021// 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]5f39adc2013-05-23 11:50:465#ifndef UI_BASE_BASE_WINDOW_H_
6#define UI_BASE_BASE_WINDOW_H_
[email protected]41d9faf2012-02-28 23:46:027
Henrique Ferreiro376c7652020-05-22 09:00:048#include "base/component_export.h"
Daniel Bratell2e13fbc2017-12-28 11:08:159#include "build/build_config.h"
Avi Drissman9e6533282019-07-17 17:25:1210#include "ui/base/ui_base_types.h"
[email protected]764864e2012-06-11 19:16:1611#include "ui/gfx/native_widget_types.h"
[email protected]41d9faf2012-02-28 23:46:0212
13namespace gfx {
14class Rect;
15}
16
[email protected]5f39adc2013-05-23 11:50:4617namespace ui {
[email protected]41d9faf2012-02-28 23:46:0218
[email protected]5f39adc2013-05-23 11:50:4619// Provides an interface to perform actions on windows, and query window
20// state.
Henrique Ferreiro376c7652020-05-22 09:00:0421class COMPONENT_EXPORT(UI_BASE) BaseWindow {
[email protected]41d9faf2012-02-28 23:46:0222 public:
23 // Returns true if the window is currently the active/focused window.
24 virtual bool IsActive() const = 0;
25
26 // Returns true if the window is maximized (aka zoomed).
27 virtual bool IsMaximized() const = 0;
28
29 // Returns true if the window is minimized.
30 virtual bool IsMinimized() const = 0;
31
[email protected]c80ed692012-04-18 19:51:1032 // Returns true if the window is full screen.
33 virtual bool IsFullscreen() const = 0;
34
[email protected]b954da472013-08-27 00:20:1735 // Returns true if the window is fully restored (not Fullscreen, Maximized,
36 // Minimized).
37 static bool IsRestored(const BaseWindow& window);
38
Christopher Cameron3cf47fe2022-03-16 23:40:2439 // IsFullscreenFakedForTesting is set by tests that are not written robustly
40 // to asynchronous transitions to fullscreen (e.g, by using
41 // ScopedFakeNSWindowFullscreen on macOS).
42 static void SetFullscreenFakedForTesting(bool);
43 static bool IsFullscreenFakedForTesting();
44
[email protected]764864e2012-06-11 19:16:1645 // Return a platform dependent identifier for this window.
yozf5067252014-11-05 22:10:1146 virtual gfx::NativeWindow GetNativeWindow() const = 0;
[email protected]764864e2012-06-11 19:16:1647
[email protected]41d9faf2012-02-28 23:46:0248 // Returns the nonmaximized bounds of the window (even if the window is
49 // currently maximized or minimized) in terms of the screen coordinates.
50 virtual gfx::Rect GetRestoredBounds() const = 0;
51
[email protected]68eeede2013-05-09 06:10:5752 // Returns the restore state for the window (platform dependent).
53 virtual ui::WindowShowState GetRestoredState() const = 0;
54
[email protected]41d9faf2012-02-28 23:46:0255 // Retrieves the window's current bounds, including its window.
56 // This will only differ from GetRestoredBounds() for maximized
57 // and minimized windows.
58 virtual gfx::Rect GetBounds() const = 0;
59
60 // Shows the window, or activates it if it's already visible.
61 virtual void Show() = 0;
62
[email protected]7d412f72012-10-25 04:59:1563 // Hides the window.
64 virtual void Hide() = 0;
65
Elly Fong-Jones9421d882018-03-21 12:19:2666 // Returns whether the window is visible.
67 virtual bool IsVisible() const = 0;
68
[email protected]41d9faf2012-02-28 23:46:0269 // Show the window, but do not activate it. Does nothing if window
70 // is already visible.
71 virtual void ShowInactive() = 0;
72
73 // Closes the window as soon as possible. The close action may be delayed
74 // if an operation is in progress (e.g. a drag operation).
75 virtual void Close() = 0;
76
77 // Activates (brings to front) the window. Restores the window from minimized
78 // state if necessary.
79 virtual void Activate() = 0;
80
81 // Deactivates the window, making the next window in the Z order the active
82 // window.
83 virtual void Deactivate() = 0;
84
85 // Maximizes/minimizes/restores the window.
86 virtual void Maximize() = 0;
87 virtual void Minimize() = 0;
88 virtual void Restore() = 0;
89
90 // Sets the window's size and position to the specified values.
91 virtual void SetBounds(const gfx::Rect& bounds) = 0;
92
93 // Flashes the taskbar item associated with this window.
94 // Set |flash| to true to initiate flashing, false to stop flashing.
95 virtual void FlashFrame(bool flash) = 0;
[email protected]d101b0c2012-03-16 00:30:5796
Avi Drissman9e6533282019-07-17 17:25:1297 // Returns the z-order level of the window.
98 virtual ZOrderLevel GetZOrderLevel() const = 0;
[email protected]46d46052013-10-11 11:27:2299
Avi Drissman9e6533282019-07-17 17:25:12100 // Sets the z-order level of the window.
101 virtual void SetZOrderLevel(ZOrderLevel order) = 0;
[email protected]41d9faf2012-02-28 23:46:02102};
103
[email protected]5f39adc2013-05-23 11:50:46104} // namespace ui
105
106#endif // UI_BASE_BASE_WINDOW_H_