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 5#ifndef UI_BASE_BASE_WINDOW_H_ 6#define UI_BASE_BASE_WINDOW_H_ 7 8#include "base/compiler_specific.h" 9#include "ui/base/ui_base_types.h" // WindowShowState 10#include "ui/gfx/native_widget_types.h" 11 12namespace gfx { 13class Rect; 14} 15 16class SkRegion; 17 18namespace ui { 19 20// Provides an interface to perform actions on windows, and query window 21// state. 22class BaseWindow { 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 33 // Returns true if the window is full screen. 34 virtual bool IsFullscreen() const = 0; 35 36 // Return a platform dependent identifier for this window. 37 virtual gfx::NativeWindow GetNativeWindow() = 0; 38 39 // Returns the nonmaximized bounds of the window (even if the window is 40 // currently maximized or minimized) in terms of the screen coordinates. 41 virtual gfx::Rect GetRestoredBounds() const = 0; 42 43 // Returns the restore state for the window (platform dependent). 44 virtual ui::WindowShowState GetRestoredState() const = 0; 45 46 // Retrieves the window's current bounds, including its window. 47 // This will only differ from GetRestoredBounds() for maximized 48 // and minimized windows. 49 virtual gfx::Rect GetBounds() const = 0; 50 51 // Shows the window, or activates it if it's already visible. 52 virtual void Show() = 0; 53 54 // Hides the window. 55 virtual void Hide() = 0; 56 57 // Show the window, but do not activate it. Does nothing if window 58 // is already visible. 59 virtual void ShowInactive() = 0; 60 61 // Closes the window as soon as possible. The close action may be delayed 62 // if an operation is in progress (e.g. a drag operation). 63 virtual void Close() = 0; 64 65 // Activates (brings to front) the window. Restores the window from minimized 66 // state if necessary. 67 virtual void Activate() = 0; 68 69 // Deactivates the window, making the next window in the Z order the active 70 // window. 71 virtual void Deactivate() = 0; 72 73 // Maximizes/minimizes/restores the window. 74 virtual void Maximize() = 0; 75 virtual void Minimize() = 0; 76 virtual void Restore() = 0; 77 78 // Sets the window's size and position to the specified values. 79 virtual void SetBounds(const gfx::Rect& bounds) = 0; 80 81 // Flashes the taskbar item associated with this window. 82 // Set |flash| to true to initiate flashing, false to stop flashing. 83 virtual void FlashFrame(bool flash) = 0; 84 85 // Returns true if a window is set to be always on top. 86 virtual bool IsAlwaysOnTop() const = 0; 87}; 88 89} // namespace ui 90 91#endif // UI_BASE_BASE_WINDOW_H_ 92