1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #include "nsBaseWidget.h"
18 class nsWindow final
: public nsBaseWidget
{
19 typedef nsBaseWidget Inherited
;
24 NS_INLINE_DECL_REFCOUNTING_INHERITED(nsWindow
, Inherited
)
30 [[nodiscard
]] virtual nsresult
Create(nsIWidget
* aParent
, nsNativeWidget aNativeParent
,
31 const LayoutDeviceIntRect
& aRect
,
32 widget::InitData
* aInitData
= nullptr) override
;
33 virtual void Destroy() override
;
34 virtual void Show(bool aState
) override
;
35 virtual void Enable(bool aState
) override
{}
36 virtual bool IsEnabled() const override
{ return true; }
37 virtual bool IsVisible() const override
{ return mVisible
; }
38 virtual void SetFocus(Raise
, mozilla::dom::CallerType aCallerType
) override
;
39 virtual LayoutDeviceIntPoint
WidgetToScreenOffset() override
;
41 virtual void SetBackgroundColor(const nscolor
& aColor
) override
;
42 virtual void* GetNativeData(uint32_t aDataType
) override
;
44 virtual void Move(double aX
, double aY
) override
;
45 virtual nsSizeMode
SizeMode() override
{ return mSizeMode
; }
46 virtual void SetSizeMode(nsSizeMode aMode
) override
;
47 void EnteredFullScreen(bool aFullScreen
);
48 virtual void Resize(double aWidth
, double aHeight
, bool aRepaint
) override
;
49 virtual void Resize(double aX
, double aY
, double aWidth
, double aHeight
, bool aRepaint
) override
;
50 virtual LayoutDeviceIntRect
GetScreenBounds() override
;
51 void ReportMoveEvent();
52 void ReportSizeEvent();
53 void ReportSizeModeEvent(nsSizeMode aMode
);
55 CGFloat
BackingScaleFactor();
56 void BackingScaleFactorChanged();
57 virtual float GetDPI() override
{
61 virtual double GetDefaultScaleInternal() override
{ return BackingScaleFactor(); }
62 virtual int32_t RoundsWidgetCoordinatesTo() override
;
64 virtual nsresult
SetTitle(const nsAString
& aTitle
) override
{ return NS_OK
; }
66 virtual void Invalidate(const LayoutDeviceIntRect
& aRect
) override
;
67 virtual nsresult
DispatchEvent(mozilla::WidgetGUIEvent
* aEvent
, nsEventStatus
& aStatus
) override
;
69 void WillPaintWindow();
70 bool PaintWindow(LayoutDeviceIntRegion aRegion
);
72 bool HasModalDescendents() { return false; }
75 // NotifyIME(const IMENotification& aIMENotification) override;
76 virtual void SetInputContext(const InputContext
& aContext
, const InputContextAction
& aAction
);
77 virtual InputContext
GetInputContext();
79 virtual bool ExecuteNativeKeyBinding(
80 NativeKeyBindingsType aType,
81 const mozilla::WidgetKeyboardEvent& aEvent,
82 DoCommandCallback aCallback,
83 void* aCallbackData) override;
89 nsWindow
* FindTopLevel();
91 nsresult
GetCurrentOffset(uint32_t& aOffset
, uint32_t& aLength
);
92 nsresult
DeleteRange(int aOffset
, int aLen
);
96 ChildView
* mNativeView
;
99 nsTArray
<nsWindow
*> mChildren
;
101 InputContext mInputContext
;
103 void OnSizeChanged(const mozilla::gfx::IntSize
& aSize
);
105 static void DumpWindows();
106 static void DumpWindows(const nsTArray
<nsWindow
*>& wins
, int indent
= 0);
107 static void LogWindow(nsWindow
* win
, int index
, int indent
);
110 #endif /* NSWINDOW_H_ */