blob: 974ba998289f4aa4d991b286e6285e36f6f01f5f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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;
}
|