29 #ifndef YCL_MinGW32_INC_Win32GUI_h_
30 #define YCL_MinGW32_INC_Win32GUI_h_ 1
43 inline namespace Windows
52 class YF_API WindowReference
66 GetClientBounds() const;
68 GetClientLocation() const;
70 GetClientSize() const;
88 SetClientBounds(const YSLib::Drawing::Rect&);
101 SetText(const
wchar_t*);
119 Move(const YSLib::Drawing::
Point&);
126 Resize(const YSLib::Drawing::Size&);
133 ResizeClient(const YSLib::Drawing::Size&);
150 const
wchar_t* = L"", ::DWORD = WS_POPUP, ::DWORD = WS_EX_LTRREADING);
173 ScreenBuffer(ScreenBuffer&&) ynothrow;
178 operator=(ScreenBuffer&&);
183 DefGetter(const ynothrow, ::HBITMAP, NativeHandle, hBitmap)
184 DefGetter(const ynothrow, const YSLib::Drawing::Size&, Size, size)
193 Premultiply(YSLib::Drawing::BitmapPtr) ynothrow;
201 Resize(const YSLib::Drawing::Size&);
209 UpdateFrom(YSLib::Drawing::BitmapPtr) ynothrow;
217 swap(ScreenBuffer&) ynothrow;
221 inline DefSwap(ynothrow, ScreenBuffer)
236 : ScreenBuffer(s), mtx()
239 using ScreenBuffer::GetBufferPtr;
240 using ScreenBuffer::GetNativeHandle;
241 using ScreenBuffer::GetSize;
242 DefGetter(ynothrow, ScreenBuffer&, ScreenBufferRef, *
this)
245 using ScreenBuffer::Premultiply;
247 using ScreenBuffer::Resize;
250 UpdateFrom(YSLib::Drawing::BitmapPtr) ynothrow;
255 const YSLib::Drawing::Point& = {}) ynothrow;
269 class YF_API WindowMemorySurface
272 ::HDC h_owner_dc, h_mem_dc;
276 : h_owner_dc(h_dc), h_mem_dc(::CreateCompatibleDC(h_dc))
280 ::DeleteDC(h_mem_dc);
283 DefGetter(
const ynothrow, ::HDC, OwnerHandle, h_owner_dc)
284 DefGetter(const ynothrow, ::HDC, NativeHandle, h_mem_dc)
288 Update(ScreenBuffer&, const YSLib::Drawing::Point& = {}) ynothrow;
294 Update(rbuf.GetScreenBufferRef(), pt);
299 UpdatePremultiplied(ScreenBuffer&, NativeWindowHandle,
308 UpdatePremultiplied(rbuf.GetScreenBufferRef(), h_wnd, a, pt);
313 class YF_API WindowDeviceContextBase
316 NativeWindowHandle hWindow;
320 : hWindow(h_wnd), hDC(h_dc)
325 DefGetter(const ynothrow, ::HDC, DeviceContextHandle, hDC)
326 DefGetter(const ynothrow, NativeWindowHandle, WindowHandle, hWindow)
338 : WindowDeviceContextBase(h_wnd, ::GetDC(h_wnd))
342 ::ReleaseDC(hWindow, hDC);
351 class YF_API WindowRegionDeviceContext :
public WindowDeviceContextBase
362 ::EndPaint(hWindow, &ps);
373 template<
typename _type = WindowDeviceContext>
374 class GSurface :
public _type,
public WindowMemorySurface
391 ::HINSTANCE h_instance;
394 WindowClass(
const wchar_t*, ::WNDPROC, ::UINT = 0,
395 ::HBRUSH = ::HBRUSH(COLOR_MENU + 1));
416 std::atomic<bool> BoundsLimited{
false};
419 HostWindow(NativeWindowHandle);
426 using WindowReference::GetClientBounds;
427 using WindowReference::GetClientLocation;
428 using WindowReference::GetClientSize;
432 using WindowReference::GetLocation;
433 using WindowReference::GetNativeHandle;
435 using WindowReference::GetOpacity;
436 using WindowReference::GetSize;
439 using WindowReference::SetClientBounds;
441 using WindowReference::SetOpacity;
443 using WindowReference::SetText;
445 using WindowReference::Close;
448 using WindowReference::Invalidate;
450 using WindowReference::Move;
464 using WindowReference::Resize;
466 using WindowReference::ResizeClient;
468 using WindowReference::
Show;
yconstexpr wchar_t WindowClassName[]
#define DefDeDtor(_t)
定义默认析构函数。
WindowReference(NativeWindowHandle h={})
WindowMemorySurface(::HDC h_dc)
~WindowRegionDeviceContext()
YF_API void Invalidate(IWidget &, const Rect &)
无效化:使相对于部件的指定区域在直接和间接的窗口缓冲区中无效。
DefGetter(const ynothrow,::HKEY, Key, h_key)}
void UpdateFrom(YSLib::Drawing::BitmapPtr) ynothrow
YF_API void Show(IWidget &)
显示部件。
void Update(ScreenRegionBuffer &rbuf, const YSLib::Drawing::Point &pt={}) ynothrow
YF_API NativeWindowHandle CreateNativeWindow(const wchar_t *, const YSLib::Drawing::Size &, const wchar_t *=L"",::DWORD=WS_POPUP,::DWORD=WS_EX_LTRREADING)
按指定窗口类名、客户区大小、标题文本、样式和附加样式创建本机顶层窗口。
void UpdatePremultiplied(ScreenRegionBuffer &rbuf, NativeWindowHandle h_wnd, YSLib::Drawing::AlphaType a=0xFF, const YSLib::Drawing::Point &pt={}) ynothrow
void swap(any &x, any &y)
交换对象。
不可复制对象:禁止派生类调用默认原型的复制构造函数和复制赋值操作符。
GSurface(NativeWindowHandle h_wnd)
GBinaryGroup< SPos > Point
屏幕二维点(直角坐标表示)。
#define DefDeMoveCtor(_t)
WindowDeviceContextBase(NativeWindowHandle h_wnd,::HDC h_dc)
#define ynothrow
YSLib 无异常抛出保证:若支持 noexcept 关键字, 指定特定的 noexcept 异常规范。
void UpdateTo(NativeWindowHandle, const YSLib::Drawing::Point &={}) ynothrow
ScreenRegionBuffer(const YSLib::Drawing::Size &s)
虚拟屏幕区域缓存。
void UpdatePremultipliedTo(NativeWindowHandle, YSLib::Drawing::AlphaType=0xFF, const YSLib::Drawing::Point &={}) ynothrow
::ANativeWindow * NativeWindowHandle
#define yconstexpr
指定编译时常量表达式。
WindowRegionDeviceContext(NativeWindowHandle h_wnd)
WindowDeviceContext(NativeWindowHandle h_wnd)
#define DefDelMoveCtor(_t)