Initial community commit
This commit is contained in:
parent
537bcbc862
commit
fc06254474
16440 changed files with 4239995 additions and 2 deletions
52
Src/Wasabi/api/wnd/paintcb.cpp
Normal file
52
Src/Wasabi/api/wnd/paintcb.cpp
Normal file
|
@ -0,0 +1,52 @@
|
|||
#include "precomp.h"
|
||||
#include "paintcb.h"
|
||||
#include "api_window.h"
|
||||
|
||||
#define CBCLASS PaintCallbackInfoI
|
||||
START_DISPATCH;
|
||||
CB(PAINTCBINFO_GETCANVAS, getCanvas);
|
||||
CB(PAINTCBINFO_GETREGION, getRegion);
|
||||
END_DISPATCH;
|
||||
|
||||
PaintCallback::PaintCallback(ifc_window *w) {
|
||||
monitorWindow(w);
|
||||
}
|
||||
|
||||
PaintCallback::~PaintCallback() {
|
||||
if (wnd != NULL) viewer_delViewItem(wnd);
|
||||
}
|
||||
|
||||
void PaintCallback::monitorWindow(ifc_window *w) {
|
||||
if (wnd != NULL) {
|
||||
viewer_delViewItem(wnd);
|
||||
wnd = NULL;
|
||||
}
|
||||
if (w != NULL) {
|
||||
viewer_addViewItem(w);
|
||||
wnd = w;
|
||||
}
|
||||
}
|
||||
|
||||
int PaintCallback::viewer_onItemDeleted(ifc_window *item) {
|
||||
ASSERT(item == wnd);//jic
|
||||
onWindowDeleted(wnd);
|
||||
wnd = NULL;
|
||||
return 1;
|
||||
}
|
||||
|
||||
int PaintCallback::viewer_onEvent(ifc_window *item, int event, intptr_t param, void *ptr, size_t ptrlen) {
|
||||
PaintCallbackInfo *info = reinterpret_cast<PaintCallbackInfo *>(ptr);
|
||||
switch (event) {
|
||||
case ifc_window::Event_ONPAINT:
|
||||
if (param == BEFOREPAINT)
|
||||
onBeforePaint(info);
|
||||
else
|
||||
onAfterPaint(info);
|
||||
break;
|
||||
case ifc_window::Event_ONINVALIDATE:
|
||||
onInvalidation(info);
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue