Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

beos/LgiOsDefs.h

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 // Typedefs
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 // Defines
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 // Threads
00054 typedef thread_id                   OsThreadId;
00055 typedef sem_id                      OsSemaphore;
00056 #define LgiGetCurrentThread()       find_thread(0)
00057 
00058 // assert
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 #define K_CHAR                  0x0
00071 #define SND_ASYNC 1
00072 #define DOUBLE_CLICK_THRESHOLD  5
00073 #define LGI_FileDropFormat      "Something?"
00074 #define LGI_WideCharset         "utf-8"
00075 
00076 #define IDOK                    1
00077 #define IDCANCEL                2
00078 #define IDYES                   3
00079 #define IDNO                    4
00080 
00081 #define MB_OK                   5
00082 #define MB_OKCANCEL             6
00083 #define MB_YESNO                7
00084 #define MB_YESNOCANCEL          8
00085 
00086 #define MB_SYSTEMMODAL          0x1000
00087 
00088 #define MK_LEFT                 B_PRIMARY_MOUSE_BUTTON
00089 #define MK_RIGHT                B_SECONDARY_MOUSE_BUTTON
00090 #define MK_MIDDLE               B_TERTIARY_MOUSE_BUTTON
00091 #define MK_CTRL                 0x08
00092 #define MK_ALT                  0x10
00093 #define MK_SHIFT                0x20
00094 
00095 // Window flags
00096 #define GWF_VISIBLE             0x00000001
00097 #define GWF_ENABLED             0x00000002
00098 #define GWF_FOCUS               0x00000004
00099 #define GWF_OVER                0x00000008
00100 #define GWF_DROP_TARGET         0x00000010
00101 #define GWF_SUNKEN              0x00000020
00102 #define GWF_FLAT                0x00000040
00103 #define GWF_RAISED              0x00000080
00104 #define GWF_BORDER              0x00000100
00105 #define GWF_DIALOG              0x00000200
00106 #define GWF_DESTRUCTOR          0x00000400
00107 #define GWF_QUIT_WND            0x00000800
00108 
00109 // Edge types
00110 #define SUNKEN                  1
00111 #define RAISED                  2
00112 #define CHISEL                  3
00113 #define FLAT                    4
00114 
00115 // Widgets
00116 #define CTRL_SUNKEN             0x80000000
00117 #define CTRL_FLAT               0x40000000
00118 #define CTRL_RAISED             0x20000000
00119 
00120 // Directories
00121 #define DIR_CHAR                '/'
00122 #define DIR_STR                 "/"
00123 #define EOL_SEQUENCE            "\n"
00124 #define LGI_PATH_SEPARATOR      ":"
00125 
00126 #define IsSlash(c)              (((c)=='/')OR((c)=='\\'))
00127 #define IsQuote(c)              (((c)=='\"')OR((c)=='\''))
00128 
00129 #define LGI_ALL_FILES           "*"
00130 
00131 // Messages
00132 #define M_USER                  (0xF0000000) // how strange, this isn't defined in BeOS?? :P
00133 
00134 // wParam = bool Inside; // is the mouse inside the client area?
00135 // lParam = MAKELONG(x, y); // mouse location
00136 #define M_MOUSEENTER            (M_USER+0x100)
00137 #define M_MOUSEEXIT             (M_USER+0x101)
00138 
00139 // wParam = (GView*) Wnd;
00140 // lParam = (int) Flags;
00141 #define M_CHANGE                (M_USER+0x102)
00142 
00143 // wParam = (GView*) Wnd;
00144 // lParam = (char*) Text; // description from window
00145 #define M_DESCRIBE              (M_USER+0x103)
00146 
00147 // return (bool)
00148 #define M_WANT_DIALOG_PROC      (M_USER+0x104)
00149 
00150 #define M_MENU                  (M_USER+0x105)
00151 #define M_COMMAND               (M_USER+0x106)
00152 #define M_DRAG_DROP             (M_USER+0x107)
00153 #define M_VSCROLL               (M_USER+0x108)
00154 #define M_HSCROLL               (M_USER+0x109)
00155 #define M_PULSE                 (M_USER+0x10a)
00156 #define M_CLOSE                 (M_USER+0x10b)
00157 #define M_CUT                   B_CUT
00158 #define M_COPY                  B_COPY
00159 #define M_PASTE                 B_PASTE
00160 
00161 // Mouse msgs
00162 #define LGI_MOUSE_CLICK         (M_USER+0x10b)      // BPoint pos;
00163                                                     // int32 flags;
00164 #define LGI_MOUSE_MOVE          (M_USER+0x10c)      // BPoint pos;
00165                                                     // int32 flags;
00166 #define LGI_MOUSE_ENTER         (M_USER+0x10d)
00167 #define LGI_MOUSE_EXIT          (M_USER+0x10e)
00168 
00169 // Dialog stuff
00170 #define IDOK                    1
00171 #define IDCANCEL                2
00172 
00173 // Keys
00174 #define VK_DELETE               B_DELETE
00175 #define VK_SHIFT                B_SHIFT_KEY
00176 #define VK_ESCAPE               B_ESCAPE
00177 #define VK_RETURN               B_ENTER
00178 #define VK_BACK                 B_BACKSPACE
00179 #define VK_RIGHT                B_RIGHT_ARROW
00180 #define VK_LEFT                 B_LEFT_ARROW
00181 #define VK_UP                   B_UP_ARROW
00182 #define VK_DOWN                 B_DOWN_ARROW
00183 #define VK_PRIOR                B_PAGE_UP
00184 #define VK_NEXT                 B_PAGE_DOWN
00185 #define VK_HOME                 B_HOME
00186 #define VK_END                  B_END
00187 #define VK_INSERT               B_INSERT
00188 
00189 // GKey flags
00190 #define LGI_VKEY_CTRL           B_CONTROL_KEY   // 0x0004
00191 #define LGI_VKEY_ALT            B_OPTION_KEY    // 0x0040
00192 #define LGI_VKEY_SHIFT          B_SHIFT_KEY     // 0x0001
00193 
00194 // GMouse flags
00195 #define LGI_VMOUSE_LEFT         B_PRIMARY_MOUSE_BUTTON      // 0x0001
00196 #define LGI_VMOUSE_MIDDLE       B_TERTIARY_MOUSE_BUTTON     // 0x0004
00197 #define LGI_VMOUSE_RIGHT        B_SECONDARY_MOUSE_BUTTON    // 0x0002
00198 
00199 #define LGI_VMOUSE_CTRL         0x08
00200 #define LGI_VMOUSE_ALT          0x10
00201 #define LGI_VMOUSE_SHIFT        0x20
00202 
00203 #define LGI_VMOUSE_DOWN         0x40
00204 #define LGI_VMOUSE_DOUBLE       0x80
00205 
00206 // The BeOS defines actually overlap some other keys
00207 // so I don't use them, instead I just defined my own block
00208 // of codes
00209 #define VK_F1                   0x11
00210 #define VK_F2                   0x12
00211 #define VK_F3                   0x13
00212 #define VK_F4                   0x14
00213 #define VK_F5                   0x15
00214 #define VK_F6                   0x16
00215 #define VK_F7                   0x17
00216 #define VK_F8                   0x18
00217 #define VK_F9                   0x19
00218 #define VK_F10                  0x01
00219 #define VK_F11                  0x02
00220 #define VK_F12                  0x03
00221 
00223 #define MsgCode(m) m->what
00224 extern int MsgA(GMessage *m);
00225 extern int MsgB(GMessage *m);
00226 extern GMessage CreateMsg(int m, int a, int b);
00227 
00229 // BeOS specific
00230 #define LGI_DRAW_VIEW_FLAGS     (B_POINTER_EVENTS | B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS | B_FULL_UPDATE_ON_RESIZE)
00231 #define LGI_NODRAW_VIEW_FLAGS   (B_POINTER_EVENTS | B_NAVIGABLE | B_FRAME_EVENTS)
00232 
00233 extern int stricmp(char *a, char *b);
00234 
00235 #endif

Generated on Tue May 2 10:24:43 2006 for Lgi by  doxygen 1.4.1