00001 #ifndef __LGI_OS_DEFS_H
00002 #define __LGI_OS_DEFS_H
00003
00004 #include <AppKit.h>
00005 #include <InterfaceKit.h>
00006 #include <GameKit.h>
00007
00008 #include <assert.h>
00009 #include <stdlib.h>
00010 #include <stdarg.h>
00011 #include <stdio.h>
00012
00013 #include "LgiInc.h"
00014
00016
00017 typedef signed long long int int64;
00018 typedef unsigned long long int uint64;
00019
00020 typedef BWindow *OsWindow;
00021 typedef BView *OsView;
00022 typedef BBitmap *OsBitmap;
00023 typedef thread_id OsThread;
00024 typedef BMessage GMessage;
00025 typedef team_id OsProcess;
00026 typedef char OsChar;
00027 typedef BView *OsPainter;
00028 typedef int OsProcessId;
00029
00030 class LgiClass OsAppArguments
00031 {
00032 public:
00033 int Args;
00034 char **Arg;
00035
00036 OsAppArguments()
00037 {
00038 Args = 0;
00039 Arg = 0;
00040 }
00041 };
00042
00044
00045 #define _DEBUG 1
00046 #define XP_CTRLS 1
00047
00048 #ifndef BEOS
00049 #error "BEOS must be defined in your project, use -DBEOS."
00050 #endif
00051 #define MAKEINTRESOURCE(i) ((char*)(i))
00052
00053
00054 typedef thread_id OsThreadId;
00055 typedef sem_id OsSemaphore;
00056 #define LgiGetCurrentThread() find_thread(0)
00057
00058
00059 #ifdef _DEBUG
00060 extern void _lgi_assert(bool b, char *test, char *file, int line);
00061 #define LgiAssert(b) _lgi_assert(b, #b, __FILE__, __LINE__)
00062 #else
00063 #define LgiAssert(b)
00064 #endif
00065
00066 #define LgiSleep(i) snooze(i*1000)
00067 extern void _lgi_yield();
00068 #define LgiYield() _lgi_yield()
00069
00070
00071 #include "NetworkKit.h"
00072 #define ValidSocket(s) ((s)>=0)
00073 #define INVALID_SOCKET -1
00074 typedef int OsSocket;
00075
00076 #define K_CHAR 0x0
00077 #define SND_ASYNC 1
00078 #define DOUBLE_CLICK_THRESHOLD 5
00079 #define LGI_FileDropFormat "Something?"
00080 #define LGI_WideCharset "utf-8"
00081
00082 #define IDOK 1
00083 #define IDCANCEL 2
00084 #define IDYES 3
00085 #define IDNO 4
00086
00087 #define MB_OK 5
00088 #define MB_OKCANCEL 6
00089 #define MB_YESNO 7
00090 #define MB_YESNOCANCEL 8
00091
00092 #define MB_SYSTEMMODAL 0x1000
00093
00094 #define MK_LEFT B_PRIMARY_MOUSE_BUTTON
00095 #define MK_RIGHT B_SECONDARY_MOUSE_BUTTON
00096 #define MK_MIDDLE B_TERTIARY_MOUSE_BUTTON
00097 #define MK_CTRL 0x08
00098 #define MK_ALT 0x10
00099 #define MK_SHIFT 0x20
00100
00101
00102 #define GWF_VISIBLE 0x00000001
00103 #define GWF_ENABLED 0x00000002
00104 #define GWF_FOCUS 0x00000004
00105 #define GWF_OVER 0x00000008
00106 #define GWF_DROP_TARGET 0x00000010
00107 #define GWF_SUNKEN 0x00000020
00108 #define GWF_FLAT 0x00000040
00109 #define GWF_RAISED 0x00000080
00110 #define GWF_BORDER 0x00000100
00111 #define GWF_DIALOG 0x00000200
00112 #define GWF_DESTRUCTOR 0x00000400
00113 #define GWF_QUIT_WND 0x00000800
00114
00115
00116 #define SUNKEN 1
00117 #define RAISED 2
00118 #define CHISEL 3
00119 #define FLAT 4
00120
00121
00122 #define CTRL_SUNKEN 0x80000000
00123 #define CTRL_FLAT 0x40000000
00124 #define CTRL_RAISED 0x20000000
00125
00126
00127 #define DIR_CHAR '/'
00128 #define DIR_STR "/"
00129 #define EOL_SEQUENCE "\n"
00130 #define LGI_PATH_SEPARATOR ":"
00131
00132 #define IsSlash(c) (((c)=='/')OR((c)=='\\'))
00133 #define IsQuote(c) (((c)=='\"')OR((c)=='\''))
00134
00135 #define LGI_ALL_FILES "*"
00136
00137
00138 #define M_USER (0xF0000000) // how strange, this isn't defined in BeOS?? :P
00139
00140
00141
00142 #define M_MOUSEENTER (M_USER+0x100)
00143 #define M_MOUSEEXIT (M_USER+0x101)
00144
00145
00146
00147 #define M_CHANGE (M_USER+0x102)
00148
00149
00150
00151 #define M_DESCRIBE (M_USER+0x103)
00152
00153
00154 #define M_WANT_DIALOG_PROC (M_USER+0x104)
00155
00156 #define M_MENU (M_USER+0x105)
00157 #define M_COMMAND (M_USER+0x106)
00158 #define M_DRAG_DROP (M_USER+0x107)
00159 #define M_VSCROLL (M_USER+0x108)
00160 #define M_HSCROLL (M_USER+0x109)
00161 #define M_PULSE (M_USER+0x10a)
00162 #define M_CLOSE (M_USER+0x10b)
00163 #define M_CUT B_CUT
00164 #define M_COPY B_COPY
00165 #define M_PASTE B_PASTE
00166
00167
00168 #define LGI_MOUSE_CLICK (M_USER+0x10b) // BPoint pos;
00169
00170 #define LGI_MOUSE_MOVE (M_USER+0x10c) // BPoint pos;
00171
00172 #define LGI_MOUSE_ENTER (M_USER+0x10d)
00173 #define LGI_MOUSE_EXIT (M_USER+0x10e)
00174
00175
00176 #define IDOK 1
00177 #define IDCANCEL 2
00178
00179
00180 #define VK_DELETE B_DELETE
00181 #define VK_SHIFT B_SHIFT_KEY
00182 #define VK_ESCAPE B_ESCAPE
00183 #define VK_RETURN B_ENTER
00184 #define VK_BACKSPACE B_BACKSPACE
00185 #define VK_RIGHT B_RIGHT_ARROW
00186 #define VK_LEFT B_LEFT_ARROW
00187 #define VK_UP B_UP_ARROW
00188 #define VK_DOWN B_DOWN_ARROW
00189 #define VK_PAGEUP B_PAGE_UP
00190 #define VK_PAGEDOWN B_PAGE_DOWN
00191 #define VK_HOME B_HOME
00192 #define VK_END B_END
00193 #define VK_INSERT B_INSERT
00194
00195
00196 #define LGI_VKEY_CTRL B_CONTROL_KEY // 0x0004
00197 #define LGI_VKEY_ALT B_OPTION_KEY // 0x0040
00198 #define LGI_VKEY_SHIFT B_SHIFT_KEY // 0x0001
00199
00200
00201 #define LGI_VMOUSE_LEFT B_PRIMARY_MOUSE_BUTTON // 0x0001
00202 #define LGI_VMOUSE_MIDDLE B_TERTIARY_MOUSE_BUTTON // 0x0004
00203 #define LGI_VMOUSE_RIGHT B_SECONDARY_MOUSE_BUTTON // 0x0002
00204
00205 #define LGI_VMOUSE_CTRL 0x08
00206 #define LGI_VMOUSE_ALT 0x10
00207 #define LGI_VMOUSE_SHIFT 0x20
00208
00209 #define LGI_VMOUSE_DOWN 0x40
00210 #define LGI_VMOUSE_DOUBLE 0x80
00211
00212
00213
00214
00215 #define VK_F1 0x11
00216 #define VK_F2 0x12
00217 #define VK_F3 0x13
00218 #define VK_F4 0x14
00219 #define VK_F5 0x15
00220 #define VK_F6 0x16
00221 #define VK_F7 0x17
00222 #define VK_F8 0x18
00223 #define VK_F9 0x19
00224 #define VK_F10 0x01
00225 #define VK_F11 0x02
00226 #define VK_F12 0x03
00227
00229 #define MsgCode(m) m->what
00230 extern int MsgA(GMessage *m);
00231 extern int MsgB(GMessage *m);
00232 extern GMessage CreateMsg(int m, int a, int b);
00233
00235
00236 #define LGI_DRAW_VIEW_FLAGS (B_POINTER_EVENTS | B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE)
00237 #define LGI_NODRAW_VIEW_FLAGS (B_POINTER_EVENTS | B_NAVIGABLE | B_FRAME_EVENTS)
00238
00239 extern int stricmp(char *a, char *b);
00240
00241 #endif