native_widget_mac.h revision cedac228d2dd51db4b79ea1e72c7f249408ee061
1cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved. 2cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 3cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// found in the LICENSE file. 4cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 5cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#ifndef UI_VIEWS_WIDGET_NATIVE_WIDGET_MAC_H_ 6cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#define UI_VIEWS_WIDGET_NATIVE_WIDGET_MAC_H_ 7cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 8cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "base/mac/scoped_nsobject.h" 9cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "ui/gfx/native_widget_types.h" 10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "ui/views/widget/native_widget_private.h" 11cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 12cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace views { 13cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 14cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class VIEWS_EXPORT NativeWidgetMac : public internal::NativeWidgetPrivate { 15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) public: 16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) NativeWidgetMac(internal::NativeWidgetDelegate* delegate); 17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual ~NativeWidgetMac(); 18cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 19cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) protected: 20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // internal::NativeWidgetPrivate: 21cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void InitNativeWidget(const Widget::InitParams& params) OVERRIDE; 22cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; 23cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool ShouldUseNativeFrame() const OVERRIDE; 24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool ShouldWindowContentsBeTransparent() const OVERRIDE; 25cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void FrameTypeChanged() OVERRIDE; 26cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual Widget* GetWidget() OVERRIDE; 27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual const Widget* GetWidget() const OVERRIDE; 28cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::NativeView GetNativeView() const OVERRIDE; 29cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::NativeWindow GetNativeWindow() const OVERRIDE; 30cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual Widget* GetTopLevelWidget() OVERRIDE; 31cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual const ui::Compositor* GetCompositor() const OVERRIDE; 32cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual ui::Compositor* GetCompositor() OVERRIDE; 33cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual ui::Layer* GetLayer() OVERRIDE; 34cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void ReorderNativeViews() OVERRIDE; 35cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void ViewRemoved(View* view) OVERRIDE; 36cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetNativeWindowProperty(const char* name, void* value) OVERRIDE; 37cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void* GetNativeWindowProperty(const char* name) const OVERRIDE; 38cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual TooltipManager* GetTooltipManager() const OVERRIDE; 39cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetCapture() OVERRIDE; 40cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void ReleaseCapture() OVERRIDE; 41cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool HasCapture() const OVERRIDE; 42cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual InputMethod* CreateInputMethod() OVERRIDE; 43cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual InputMethodDelegate* GetInputMethodDelegate() OVERRIDE; 44cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual ui::InputMethod* GetHostInputMethod() OVERRIDE; 45cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void CenterWindow(const gfx::Size& size) OVERRIDE; 46cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void GetWindowPlacement( 47cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) gfx::Rect* bounds, 48cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) ui::WindowShowState* maximized) const OVERRIDE; 49cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool SetWindowTitle(const base::string16& title) OVERRIDE; 50cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetWindowIcons(const gfx::ImageSkia& window_icon, 51cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const gfx::ImageSkia& app_icon) OVERRIDE; 52cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void InitModalType(ui::ModalType modal_type) OVERRIDE; 53cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::Rect GetWindowBoundsInScreen() const OVERRIDE; 54cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::Rect GetClientAreaBoundsInScreen() const OVERRIDE; 55cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::Rect GetRestoredBounds() const OVERRIDE; 56cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE; 57cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetSize(const gfx::Size& size) OVERRIDE; 58cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void StackAbove(gfx::NativeView native_view) OVERRIDE; 59cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void StackAtTop() OVERRIDE; 60cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void StackBelow(gfx::NativeView native_view) OVERRIDE; 61cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetShape(gfx::NativeRegion shape) OVERRIDE; 62cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Close() OVERRIDE; 63cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void CloseNow() OVERRIDE; 64cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Show() OVERRIDE; 65cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Hide() OVERRIDE; 66cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void ShowMaximizedWithBounds( 67cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const gfx::Rect& restored_bounds) OVERRIDE; 68cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void ShowWithWindowState(ui::WindowShowState state) OVERRIDE; 69cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsVisible() const OVERRIDE; 70cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Activate() OVERRIDE; 71cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Deactivate() OVERRIDE; 72cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsActive() const OVERRIDE; 73cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetAlwaysOnTop(bool always_on_top) OVERRIDE; 74cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsAlwaysOnTop() const OVERRIDE; 75cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetVisibleOnAllWorkspaces(bool always_visible) OVERRIDE; 76cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Maximize() OVERRIDE; 77cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Minimize() OVERRIDE; 78cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsMaximized() const OVERRIDE; 79cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsMinimized() const OVERRIDE; 80cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void Restore() OVERRIDE; 81cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetFullscreen(bool fullscreen) OVERRIDE; 82cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsFullscreen() const OVERRIDE; 83cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetOpacity(unsigned char opacity) OVERRIDE; 84cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetUseDragFrame(bool use_drag_frame) OVERRIDE; 85cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void FlashFrame(bool flash_frame) OVERRIDE; 86cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void RunShellDrag(View* view, 87cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const ui::OSExchangeData& data, 88cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const gfx::Point& location, 89cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) int operation, 90cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) ui::DragDropTypes::DragEventSource source) OVERRIDE; 91cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SchedulePaintInRect(const gfx::Rect& rect) OVERRIDE; 92cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; 93cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual bool IsMouseEventsEnabled() const OVERRIDE; 94cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void ClearNativeFocus() OVERRIDE; 95cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::Rect GetWorkAreaBoundsInScreen() const OVERRIDE; 96cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual Widget::MoveLoopResult RunMoveLoop( 97cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) const gfx::Vector2d& drag_offset, 98cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) Widget::MoveLoopSource source, 99cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) Widget::MoveLoopEscapeBehavior escape_behavior) OVERRIDE; 100cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void EndMoveLoop() OVERRIDE; 101cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void SetVisibilityChangedAnimationsEnabled(bool value) OVERRIDE; 102cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual ui::NativeTheme* GetNativeTheme() const OVERRIDE; 103cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void OnRootViewLayout() const OVERRIDE; 104cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void RepostNativeEvent(gfx::NativeEvent native_event) OVERRIDE; 105cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 106cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) private: 107cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) internal::NativeWidgetDelegate* delegate_; 108cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) base::scoped_nsobject<NSWindow> window_; 109cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 110cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(NativeWidgetMac); 111cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}; 112cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 113cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)} // namespace views 114cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 115cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#endif // UI_VIEWS_WIDGET_NATIVE_WIDGET_MAC_H_ 116