base_window.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. #ifndef UI_BASE_BASE_WINDOW_H_
  5. #define UI_BASE_BASE_WINDOW_H_
  6. #include "base/component_export.h"
  7. #include "build/build_config.h"
  8. #include "ui/base/ui_base_types.h"
  9. #include "ui/gfx/native_widget_types.h"
  10. namespace gfx {
  11. class Rect;
  12. }
  13. namespace ui {
  14. // Provides an interface to perform actions on windows, and query window
  15. // state.
  16. class COMPONENT_EXPORT(UI_BASE) BaseWindow {
  17. public:
  18. // Returns true if the window is currently the active/focused window.
  19. virtual bool IsActive() const = 0;
  20. // Returns true if the window is maximized (aka zoomed).
  21. virtual bool IsMaximized() const = 0;
  22. // Returns true if the window is minimized.
  23. virtual bool IsMinimized() const = 0;
  24. // Returns true if the window is full screen.
  25. virtual bool IsFullscreen() const = 0;
  26. // Returns true if the window is fully restored (not Fullscreen, Maximized,
  27. // Minimized).
  28. static bool IsRestored(const BaseWindow& window);
  29. // Return a platform dependent identifier for this window.
  30. virtual gfx::NativeWindow GetNativeWindow() const = 0;
  31. // Returns the nonmaximized bounds of the window (even if the window is
  32. // currently maximized or minimized) in terms of the screen coordinates.
  33. virtual gfx::Rect GetRestoredBounds() const = 0;
  34. // Returns the restore state for the window (platform dependent).
  35. virtual ui::WindowShowState GetRestoredState() const = 0;
  36. // Retrieves the window's current bounds, including its window.
  37. // This will only differ from GetRestoredBounds() for maximized
  38. // and minimized windows.
  39. virtual gfx::Rect GetBounds() const = 0;
  40. // Shows the window, or activates it if it's already visible.
  41. virtual void Show() = 0;
  42. // Hides the window.
  43. virtual void Hide() = 0;
  44. // Returns whether the window is visible.
  45. virtual bool IsVisible() const = 0;
  46. // Show the window, but do not activate it. Does nothing if window
  47. // is already visible.
  48. virtual void ShowInactive() = 0;
  49. // Closes the window as soon as possible. The close action may be delayed
  50. // if an operation is in progress (e.g. a drag operation).
  51. virtual void Close() = 0;
  52. // Activates (brings to front) the window. Restores the window from minimized
  53. // state if necessary.
  54. virtual void Activate() = 0;
  55. // Deactivates the window, making the next window in the Z order the active
  56. // window.
  57. virtual void Deactivate() = 0;
  58. // Maximizes/minimizes/restores the window.
  59. virtual void Maximize() = 0;
  60. virtual void Minimize() = 0;
  61. virtual void Restore() = 0;
  62. // Sets the window's size and position to the specified values.
  63. virtual void SetBounds(const gfx::Rect& bounds) = 0;
  64. // Flashes the taskbar item associated with this window.
  65. // Set |flash| to true to initiate flashing, false to stop flashing.
  66. virtual void FlashFrame(bool flash) = 0;
  67. // Returns the z-order level of the window.
  68. virtual ZOrderLevel GetZOrderLevel() const = 0;
  69. // Sets the z-order level of the window.
  70. virtual void SetZOrderLevel(ZOrderLevel order) = 0;
  71. };
  72. } // namespace ui
  73. #endif // UI_BASE_BASE_WINDOW_H_