milsko/include/Mw/LowLevel/Haiku.h

173 lines
3 KiB
C
Raw Normal View History

2026-04-28 18:46:51 +00:00
/*!
* @file Mw/LowLevel/Haiku.h
* @brief Haiku Backend
* @warning This is used internally
*/
#ifndef __MW_LOWLEVEL_HAIKU_H__
#define __MW_LOWLEVEL_HAIKU_H__
#include <Mw/MachDep.h>
#include <Mw/TypeDefs.h>
#include <Mw/LowLevel.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
2026-04-28 23:21:32 +09:00
class MwApplication;
class MwView;
class MwWindow;
2026-04-28 18:46:51 +00:00
class MwApplication : public BApplication {
2026-04-28 12:59:25 +00:00
public:
2026-04-29 05:20:06 +09:00
MwApplication(MwRect rc, MwLL handle);
2026-04-28 12:59:25 +00:00
~MwApplication();
2026-04-28 18:46:51 +00:00
2026-04-28 12:59:25 +00:00
void MessageReceived(BMessage* message);
2026-04-28 18:46:51 +00:00
};
class MwView : public BView {
2026-04-28 12:59:25 +00:00
public:
2026-04-28 23:21:32 +09:00
MwLL handle;
BLocker* locker;
2026-04-29 03:41:00 +09:00
uint32 buttons;
2026-04-29 04:24:01 +09:00
BBitmap* bitmap;
2026-04-28 23:21:32 +09:00
MwView(MwLL handle, BRect rc, uint32 resizingMode, uint32 flags);
~MwView();
2026-05-04 19:24:09 +09:00
void MessageReceived(BMessage* message);
void PostMessage(BMessage* message);
void PostMessage(uint32 command);
2026-05-04 00:01:17 +09:00
status_t SendMessage(BMessage* message);
status_t SendMessage(uint32 command);
2026-05-04 19:24:09 +09:00
void Invalidate();
2026-04-28 23:21:32 +09:00
2026-04-29 03:41:00 +09:00
void AttachedToWindow();
2026-04-28 23:21:32 +09:00
void Draw(BRect updateRect);
2026-04-29 05:53:22 +09:00
void FrameResized(float width, float height);
2026-04-29 03:41:00 +09:00
void MouseDown(BPoint point);
void MouseUp(BPoint point);
void MouseMoved(BPoint point, uint32 transit, const BMessage* message);
2026-04-29 01:03:50 +09:00
void SetColor(MwLLColor color);
2026-04-28 23:21:32 +09:00
};
class MwWindow : public BWindow {
public:
MwWindow(BRect rc, window_type type, uint32 flags);
void MessageReceived(BMessage* message);
2026-04-29 05:39:47 +09:00
2026-04-29 05:53:22 +09:00
void FrameMoved(BPoint newLocation);
2026-04-29 05:39:47 +09:00
bool QuitRequested();
2026-04-28 18:46:51 +00:00
};
2026-04-29 03:41:00 +09:00
typedef BBitmap MwBBitmap;
2026-04-28 18:46:51 +00:00
#else
typedef void MwApplication;
typedef void MwView;
2026-05-06 03:36:57 +09:00
typedef void MwWindow;
2026-04-29 03:41:00 +09:00
typedef void MwBBitmap;
2026-04-28 18:46:51 +00:00
#endif
2026-04-28 23:21:32 +09:00
typedef union _MwLLHaikuEvent MwLLHaikuEvent;
enum BAPP_MW_WHAT {
BAPP_MW_DESTROY = 0
};
enum BVIEW_MW_WHAT {
2026-04-29 03:41:00 +09:00
BVIEW_MW_DESTROY = 0,
BVIEW_MW_DETACH,
BVIEW_MW_RESIZE,
2026-04-28 23:21:32 +09:00
BVIEW_MW_MOVE,
2026-04-29 03:41:00 +09:00
BVIEW_MW_SHOW,
BVIEW_MW_HIDE,
2026-04-29 01:03:50 +09:00
BVIEW_MW_SET_COLOR,
BVIEW_MW_POLYGON,
2026-04-29 03:41:00 +09:00
BVIEW_MW_LINE,
BVIEW_MW_BITMAP,
2026-05-04 00:01:17 +09:00
BVIEW_MW_RENDER,
2026-05-06 03:36:57 +09:00
BVIEW_MW_RAISE,
2026-05-04 00:01:17 +09:00
BVIEW_MW_GET_MOUSE
2026-04-28 23:21:32 +09:00
};
enum BWIN_MW_WHAT {
2026-05-06 03:36:57 +09:00
BWIN_MW_DESTROY = 0,
BWIN_MW_SET_TITLE,
BWIN_MW_SET_TYPE
2026-04-28 23:21:32 +09:00
};
enum MwLLHAIKU_EVENT {
2026-04-29 03:41:00 +09:00
MwLLHAIKU_EVENT_DRAW = 0,
2026-04-29 05:39:47 +09:00
MwLLHAIKU_EVENT_CLOSE,
2026-04-29 05:53:22 +09:00
MwLLHAIKU_EVENT_FRAMERESIZED,
MwLLHAIKU_EVENT_FRAMEMOVED,
2026-04-29 03:41:00 +09:00
MwLLHAIKU_EVENT_MOUSEDOWN,
MwLLHAIKU_EVENT_MOUSEUP,
MwLLHAIKU_EVENT_MOUSEMOVED
};
struct _MwLLHaikuEventMouse {
int type;
MwPoint point;
int button;
2026-04-28 23:21:32 +09:00
};
2026-04-29 05:53:22 +09:00
struct _MwLLHaikuEventFrameResized {
int type;
float width;
float height;
};
struct _MwLLHaikuEventFrameMoved {
int type;
MwPoint point;
};
2026-04-28 23:21:32 +09:00
union _MwLLHaikuEvent {
2026-04-29 05:53:22 +09:00
int type;
struct _MwLLHaikuEventMouse mouse;
struct _MwLLHaikuEventFrameResized frame_resized;
struct _MwLLHaikuEventFrameMoved frame_moved;
2026-04-28 12:59:25 +00:00
};
2026-04-28 18:46:51 +00:00
struct _MwLLHaiku {
struct _MwLLCommon common;
2026-05-06 03:36:57 +09:00
int type;
2026-04-28 23:21:32 +09:00
int x;
int y;
int width;
int height;
2026-04-28 12:59:25 +00:00
MwLL parent;
2026-04-28 18:46:51 +00:00
MwApplication* app;
2026-05-06 03:36:57 +09:00
MwWindow* window;
2026-04-28 12:59:25 +00:00
MwView* view;
thread_id app_thread;
2026-04-29 15:14:38 +09:00
int force_render;
2026-04-28 23:21:32 +09:00
MwLLHaikuEvent* events;
2026-04-28 18:46:51 +00:00
};
struct _MwLLHaikuColor {
struct _MwLLCommonColor common;
};
struct _MwLLHaikuPixmap {
struct _MwLLCommonPixmap common;
2026-04-29 01:03:50 +09:00
2026-04-29 03:41:00 +09:00
MwBBitmap* bitmap;
2026-04-28 18:46:51 +00:00
};
2026-04-28 12:59:25 +00:00
MWDECL int MwLLHaikuCallInit(void);
2026-04-28 18:46:51 +00:00
#ifdef __cplusplus
}
#endif
#endif