mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-18 12:55:47 -04:00
Initial community commit
This commit is contained in:
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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user