29 #include YFM_Helper_HostRenderer
30 #include YFM_Helper_Host // for Host::Environment;
36 using namespace Drawing;
46 MessageMap[WM_PAINT] += [
this]{
47 GSurface<WindowRegionDeviceContext> sf(GetNativeHandle());
49 renderer.get().UpdateToSurface(sf);
57 auto& rd(GetRenderer());
58 auto&
wgt(rd.GetWidgetRef());
61 {rd.GetContext(), Point(), rd.GetInvalidatedArea()}))
62 rd.Update(rd.GetContext().GetBufferPtr());
66 WindowThread::~WindowThread()
68 const auto p_wnd_val(GetWindowPtr());
79 catch(Win32Exception&)
89 catch(std::system_error& e)
95 catch(std::exception& e)
112 ThreadLoop(make_unique<Window>(h_wnd));
115 WindowThread::ThreadLoop(unique_ptr<Window> p)
117 YAssert(!p_wnd,
"Duplicate window initialization detected.");
124 WindowThread::WindowLoop(
Window& wnd)
127 auto& env(wnd.GetHost());
129 env.EnterWindowThread();
134 Environment::HostLoop();
136 env.LeaveWindowThread();
153 if(
const auto p_wnd = GetWindowPtr())
157 const Rect cbounds(p_wnd->GetSize());
159 const auto& cbounds(p_wnd->GetClientBounds());
162 auto& view(widget.get().GetView());
163 const auto& loc(view.GetLocation());
167 bounds.GetPointRef() += loc;
168 view.SetLocation({});
169 rInvalidated = {{},
bounds.GetSize()};
170 Validate(widget, widget, {GetContext(),
Point(), rInvalidated});
172 bounds.GetSizeRef() = view.GetSize();
175 p_wnd->SetClientBounds(
bounds);
177 p_wnd->UpdateFrom(buf, rbuf);
180 catch(Win32Exception&)
pt pt Y const IWidget &wgt const IWidget &wgt GetSizeOf
无效化:使相对于部件的子部件的指定区域在直接和间接的窗口缓冲区中无效。
void Refresh(PaintEventArgs &&) override
刷新:按指定参数绘制界面并更新状态。
#define yunused(...)
标记未使用的表达式。
YF_API TLCIter Validate(TLCIter b, TLCIter e)
遍历记号列表,验证基本合法性:圆括号是否对应。
sizeof(AlphaType)*GetAreaOf(GetSize())) using CompactPixmap void SetSize(const Size &) override
重新设置缓冲区大小。
GBinaryGroup< SPos > Point
屏幕二维点(直角坐标表示)。
std::exception Exception
YSLib 异常基类。
yconstfn const string & name
#define YAssertNonnull(_expr)
::ANativeWindow * NativeWindowHandle
#define YTraceDe(...)
YCLib 默认调试跟踪。
#define YAssert(_expr, _msg)