2015-11-17 10:49:23 -06:00
|
|
|
// 17 november 2015
|
|
|
|
#include "uipriv_haiku.hpp"
|
|
|
|
|
|
|
|
static BApplication *app;
|
|
|
|
|
|
|
|
uiInitOptions options;
|
|
|
|
|
|
|
|
const char *uiInit(uiInitOptions *o)
|
|
|
|
{
|
|
|
|
status_t err;
|
|
|
|
|
|
|
|
options = *o;
|
|
|
|
// TODO properly set the MIME type
|
2015-11-20 10:45:04 -06:00
|
|
|
// TODO andlabs-libui?
|
2015-11-17 10:49:23 -06:00
|
|
|
app = new BApplication("application/x-vnd.andlabs.libui", &err);
|
|
|
|
if (err != B_NO_ERROR) {
|
|
|
|
delete app;
|
|
|
|
// TODO
|
|
|
|
return "fail";
|
|
|
|
}
|
2015-11-17 11:51:51 -06:00
|
|
|
initAlloc();
|
2015-11-17 10:49:23 -06:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
void uiUninit(void)
|
|
|
|
{
|
|
|
|
delete app;
|
2015-11-17 11:51:51 -06:00
|
|
|
uninitAlloc();
|
2015-11-17 10:49:23 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
void uiFreeInitError(const char *err)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
|
|
|
void uiMain(void)
|
|
|
|
{
|
|
|
|
app->Run();
|
|
|
|
}
|
|
|
|
|
|
|
|
void uiQuit(void)
|
|
|
|
{
|
2015-11-20 09:32:26 -06:00
|
|
|
// TODO app->PostMessage(B_QUIT_REQUESTED);?
|
2015-11-23 00:03:40 -06:00
|
|
|
// TODO see window.cpp for why that alone won't work
|
2015-11-17 10:49:23 -06:00
|
|
|
app->Quit();
|
|
|
|
}
|