2026-04-28 15:06:38 +00:00
|
|
|
#include <Mw/Milsko.h>
|
|
|
|
|
|
2026-04-28 17:44:59 +00:00
|
|
|
void MwApplication::ReadyToRun(){
|
|
|
|
|
this->ready = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MwApplication::Pulse(){
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MwApplication::MwApplication(BRect rc, MwLL handle) : BApplication("application/milsko-generic") {
|
|
|
|
|
BScreen* scr = new BScreen();
|
|
|
|
|
float left = rc.left;
|
|
|
|
|
float top = rc.top;
|
|
|
|
|
|
|
|
|
|
if(rc.left == MwDEFAULT) left = (scr->Frame().Width() - rc.Width()) / 2;
|
|
|
|
|
if(rc.top == MwDEFAULT) top = (scr->Frame().Height() - rc.Height()) / 2;
|
|
|
|
|
rc = BRect(BPoint(left, top), BSize(rc.Width(), rc.Height()));
|
|
|
|
|
|
|
|
|
|
this->window = new BWindow(rc, "Milsko", B_TITLED_WINDOW, 0);
|
|
|
|
|
this->window->Show();
|
|
|
|
|
|
|
|
|
|
handle->haiku.view = new BView(this->window->Bounds(), NULL, B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
|
|
|
|
|
|
|
|
|
|
this->ready = 0;
|
|
|
|
|
|
|
|
|
|
delete scr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MwApplication::~MwApplication(){
|
|
|
|
|
delete this->window;
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-28 16:30:01 +00:00
|
|
|
MwLL MwLLCreateImpl(MwLL parent, int x, int y, int width, int height) {
|
|
|
|
|
MwLL r = (MwLL)malloc(sizeof(*r));
|
2026-04-28 17:44:59 +00:00
|
|
|
BRect rc(BPoint(x, y), BSize(width, height));
|
2026-04-28 15:18:09 +09:00
|
|
|
|
2026-04-28 16:30:01 +00:00
|
|
|
MwLLCreateCommon(r);
|
|
|
|
|
|
|
|
|
|
r->common.copy_buffer = 1;
|
|
|
|
|
r->common.type = MwLLBackendHaiku;
|
|
|
|
|
|
2026-04-28 17:44:59 +00:00
|
|
|
if(parent == NULL){
|
|
|
|
|
r->haiku.app = new MwApplication(rc, r);
|
|
|
|
|
r->haiku.app->window->AddChild(r->haiku.view);
|
|
|
|
|
|
|
|
|
|
r->haiku.app->Run();
|
|
|
|
|
|
|
|
|
|
while(!r->haiku.app->ready);
|
|
|
|
|
}else{
|
|
|
|
|
r->haiku.app = NULL;
|
|
|
|
|
r->haiku.view = new BView(rc, NULL, B_FOLLOW_NONE, B_WILL_DRAW);
|
|
|
|
|
|
|
|
|
|
parent->haiku.view->AddChild(r->haiku.view);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-28 16:30:01 +00:00
|
|
|
return r;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MwLLDestroyImpl(MwLL handle) {
|
|
|
|
|
MwLLDestroyCommon(handle);
|
|
|
|
|
|
|
|
|
|
free(handle);
|
|
|
|
|
}
|
2026-04-28 15:18:09 +09:00
|
|
|
|
2026-04-28 17:44:59 +00:00
|
|
|
void MwLLPolygonImpl(MwLL handle, MwPoint* points, int points_count, MwLLColor color) {
|
|
|
|
|
BPoint* p = (BPoint*)malloc(sizeof(*p) * points_count);
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
for(i = 0; i < points_count; i++){
|
|
|
|
|
p[i] = BPoint(points[i].x, points[i].y);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handle->haiku.view->FillPolygon(p, points_count);
|
|
|
|
|
|
|
|
|
|
free(p);
|
|
|
|
|
}
|
2026-04-28 15:18:09 +09:00
|
|
|
|
|
|
|
|
void MwLLLineImpl(MwLL handle, MwPoint* points, MwLLColor color) {}
|
|
|
|
|
|
2026-04-28 15:21:11 +09:00
|
|
|
void MwLLBeginDrawImpl(MwLL handle) {}
|
2026-04-28 15:18:09 +09:00
|
|
|
|
2026-04-28 15:21:11 +09:00
|
|
|
void MwLLEndDrawImpl(MwLL handle) {}
|
2026-04-28 15:18:09 +09:00
|
|
|
|
2026-04-28 16:30:01 +00:00
|
|
|
MwLLColor MwLLAllocColorImpl(MwLL handle, int r, int g, int b) {
|
|
|
|
|
MwLLColor c = (MwLLColor)malloc(sizeof(*c));
|
|
|
|
|
MwLLColorUpdate(handle, c, r, g, b);
|
|
|
|
|
return c;
|
|
|
|
|
}
|
2026-04-28 15:18:09 +09:00
|
|
|
|
2026-04-28 16:30:01 +00:00
|
|
|
void MwLLColorUpdateImpl(MwLL handle, MwLLColor c, int r, int g, int b) {
|
|
|
|
|
c->common.red = r;
|
|
|
|
|
c->common.green = g;
|
|
|
|
|
c->common.blue = b;
|
|
|
|
|
}
|
2026-04-28 15:18:09 +09:00
|
|
|
|
|
|
|
|
void MwLLFreeColorImpl(MwLLColor color) {}
|
|
|
|
|
|
|
|
|
|
void MwLLGetXYWHImpl(MwLL handle, int* x, int* y, unsigned int* w, unsigned int* h) {}
|
|
|
|
|
|
|
|
|
|
void MwLLSetXYImpl(MwLL handle, int x, int y) {}
|
|
|
|
|
|
|
|
|
|
void MwLLSetWHImpl(MwLL handle, int w, int h) {}
|
|
|
|
|
|
|
|
|
|
void MwLLSetTitleImpl(MwLL handle, const char* title) {}
|
|
|
|
|
|
2026-04-28 16:30:01 +00:00
|
|
|
int MwLLPendingImpl(MwLL handle) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2026-04-28 15:18:09 +09:00
|
|
|
|
|
|
|
|
void MwLLNextEventImpl(MwLL handle) {}
|
|
|
|
|
|
2026-04-28 16:30:01 +00:00
|
|
|
MwLLPixmap MwLLCreatePixmapImpl(MwLL handle, unsigned char* data, int width, int height) {
|
|
|
|
|
MwLLPixmap r = (MwLLPixmap)malloc(sizeof(*r));
|
|
|
|
|
r->common.raw = (unsigned char*)malloc(4 * width * height);
|
|
|
|
|
memcpy(r->common.raw, data, 4 * width * height);
|
|
|
|
|
|
|
|
|
|
r->common.width = width;
|
|
|
|
|
r->common.height = height;
|
|
|
|
|
|
|
|
|
|
MwLLPixmapUpdate(r);
|
|
|
|
|
return r;
|
|
|
|
|
|
|
|
|
|
return r;
|
|
|
|
|
}
|
2026-04-28 15:18:09 +09:00
|
|
|
|
|
|
|
|
void MwLLPixmapUpdateImpl(MwLLPixmap pixmap) {}
|
|
|
|
|
|
2026-04-28 16:30:01 +00:00
|
|
|
void MwLLDestroyPixmapImpl(MwLLPixmap pixmap) {
|
|
|
|
|
free(pixmap->common.raw);
|
|
|
|
|
|
|
|
|
|
free(pixmap);
|
|
|
|
|
}
|
2026-04-28 15:18:09 +09:00
|
|
|
|
|
|
|
|
void MwLLDrawPixmapImpl(MwLL handle, MwRect* rect, MwLLPixmap pixmap) {}
|
|
|
|
|
|
|
|
|
|
void MwLLSetIconImpl(MwLL handle, MwLLPixmap pixmap) {}
|
|
|
|
|
|
|
|
|
|
void MwLLForceRenderImpl(MwLL handle) {}
|
|
|
|
|
|
|
|
|
|
void MwLLSetCursorImpl(MwLL handle, MwCursor* image, MwCursor* mask) {}
|
|
|
|
|
|
|
|
|
|
void MwLLDetachImpl(MwLL handle, MwPoint* point) {}
|
|
|
|
|
|
|
|
|
|
void MwLLShowImpl(MwLL handle, int show) {}
|
|
|
|
|
|
|
|
|
|
void MwLLSetSizeHintsImpl(MwLL handle, int minx, int miny, int maxx, int maxy) {}
|
|
|
|
|
|
2026-04-28 15:24:45 +09:00
|
|
|
void MwLLMakeBorderlessImpl(MwLL handle, int toggle) {}
|
2026-04-28 15:20:14 +09:00
|
|
|
|
2026-04-28 15:24:45 +09:00
|
|
|
void MwLLMakeToolWindowImpl(MwLL handle) {}
|
2026-04-28 15:20:14 +09:00
|
|
|
|
2026-04-28 15:24:45 +09:00
|
|
|
void MwLLMakePopupImpl(MwLL handle, MwLL parent) {}
|
2026-04-28 15:20:14 +09:00
|
|
|
|
2026-04-28 15:24:45 +09:00
|
|
|
void MwLLBeginStateChangeImpl(MwLL handle) {}
|
2026-04-28 15:20:14 +09:00
|
|
|
|
2026-04-28 15:24:45 +09:00
|
|
|
void MwLLEndStateChangeImpl(MwLL handle) {}
|
2026-04-28 15:20:14 +09:00
|
|
|
|
2026-04-28 15:24:45 +09:00
|
|
|
void MwLLFocusImpl(MwLL handle) {}
|
2026-04-28 15:20:14 +09:00
|
|
|
|
2026-04-28 15:24:45 +09:00
|
|
|
void MwLLGrabPointerImpl(MwLL handle, int toggle) {}
|
2026-04-28 15:20:14 +09:00
|
|
|
|
2026-04-28 15:24:45 +09:00
|
|
|
void MwLLSetClipboardImpl(MwLL handle, const char* text, int clipboard_type) {}
|
2026-04-28 15:20:14 +09:00
|
|
|
|
2026-04-28 15:24:45 +09:00
|
|
|
void MwLLGetClipboardImpl(MwLL handle, int clipboard_type) {}
|
2026-04-28 15:20:14 +09:00
|
|
|
|
2026-04-28 15:24:45 +09:00
|
|
|
void MwLLGetCursorCoordImpl(MwLL handle, MwPoint* point) {}
|
2026-04-28 15:20:14 +09:00
|
|
|
|
2026-04-28 15:24:45 +09:00
|
|
|
void MwLLGetScreenSizeImpl(MwLL handle, MwRect* rect) {}
|
2026-04-28 15:20:14 +09:00
|
|
|
|
2026-04-28 16:30:01 +00:00
|
|
|
void MwLLSetDarkThemeImpl(MwLL handle, int toggle) {
|
|
|
|
|
(void)handle;
|
|
|
|
|
(void)toggle;
|
|
|
|
|
}
|
2026-04-28 15:20:14 +09:00
|
|
|
|
2026-04-28 16:30:01 +00:00
|
|
|
MwBool MwLLDoModernImpl(MwLL handle) {
|
|
|
|
|
(void)handle;
|
|
|
|
|
return MwTRUE;
|
|
|
|
|
}
|
2026-04-28 15:20:14 +09:00
|
|
|
|
2026-04-28 16:30:01 +00:00
|
|
|
int MwLLHaikuCallInitImpl() {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2026-04-28 15:21:11 +09:00
|
|
|
|
2026-04-28 15:06:38 +00:00
|
|
|
#include "call.c"
|
|
|
|
|
CALL(Haiku);
|