a little bit better
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good
This commit is contained in:
parent
ab1dfc2e60
commit
1214cc0854
2 changed files with 47 additions and 2 deletions
|
|
@ -42,6 +42,8 @@ class MwView : public BView {
|
|||
void MessageReceived(BMessage* message);
|
||||
void PostMessage(BMessage* message);
|
||||
void PostMessage(uint32 command);
|
||||
status_t SendMessage(BMessage* message);
|
||||
status_t SendMessage(uint32 command);
|
||||
void Invalidate();
|
||||
|
||||
void AttachedToWindow();
|
||||
|
|
@ -88,7 +90,8 @@ enum BVIEW_MW_WHAT {
|
|||
BVIEW_MW_POLYGON,
|
||||
BVIEW_MW_LINE,
|
||||
BVIEW_MW_BITMAP,
|
||||
BVIEW_MW_RENDER
|
||||
BVIEW_MW_RENDER,
|
||||
BVIEW_MW_GET_MOUSE
|
||||
};
|
||||
|
||||
enum BWIN_MW_WHAT {
|
||||
|
|
|
|||
|
|
@ -178,6 +178,17 @@ void MwView::MessageReceived(BMessage* message) {
|
|||
this->Invalidate();
|
||||
break;
|
||||
}
|
||||
case BVIEW_MW_GET_MOUSE:
|
||||
{
|
||||
BPoint* p;
|
||||
uint32 btn;
|
||||
|
||||
if(message->FindPointer("view-ppoint", (void**)&p) != B_OK) break;
|
||||
|
||||
this->GetMouse(p, &btn);
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
BView::MessageReceived(message);
|
||||
|
|
@ -203,6 +214,24 @@ void MwView::PostMessage(uint32 command) {
|
|||
this->PostMessage(&msg);
|
||||
}
|
||||
|
||||
status_t MwView::SendMessage(BMessage* message) {
|
||||
BMessage copy = *message;
|
||||
BMessage reply;
|
||||
MwLL top = this->handle;
|
||||
|
||||
while(top->haiku.parent != NULL) top = top->haiku.parent;
|
||||
|
||||
copy.AddPointer("window-view", this);
|
||||
|
||||
return BMessenger(top->haiku.app->window).SendMessage(©, &reply);
|
||||
}
|
||||
|
||||
status_t MwView::SendMessage(uint32 command) {
|
||||
BMessage msg(command);
|
||||
|
||||
return this->SendMessage(&msg);
|
||||
}
|
||||
|
||||
void MwView::Invalidate() {
|
||||
this->Draw(BRect(0, 0, 0, 0));
|
||||
}
|
||||
|
|
@ -700,7 +729,20 @@ void MwLLSetClipboardImpl(MwLL handle, const char* text, int clipboard_type) {}
|
|||
|
||||
void MwLLGetClipboardImpl(MwLL handle, int clipboard_type) {}
|
||||
|
||||
void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) {}
|
||||
void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) {
|
||||
MwLL top = handle;
|
||||
BMessage msg(BVIEW_MW_GET_MOUSE);
|
||||
BPoint p;
|
||||
while(top->haiku.parent != NULL) {
|
||||
top = top->haiku.parent;
|
||||
}
|
||||
|
||||
msg.AddPointer("view-ppoint", &p);
|
||||
top->haiku.view->SendMessage(&msg);
|
||||
|
||||
point->x = p.x;
|
||||
point->y = p.y;
|
||||
}
|
||||
|
||||
void MwLLGetScreenSizeImpl(MwLL handle, MwRect* rect) {
|
||||
BScreen* screen = new BScreen();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue