00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #ifndef __LGI_OS_DEFS_H
00012 #define __LGI_OS_DEFS_H
00013
00014 #pragma warning(disable : 4251 4275)
00015
00016 #include <string.h>
00017 #include "LgiInc.h"
00018 #include "LgiDefs.h"
00019 #include "LgiClass.h"
00020
00022
00023 #define WIN32_LEAN_AND_MEAN
00024 #include "windows.h"
00025 #include "winsock2.h"
00026 #include "SHELLAPI.H"
00027 #include "COMMDLG.H"
00028 #include "LgiInc.h"
00029
00031
00032 typedef __int64 quad;
00033 typedef int int32;
00034 typedef unsigned int uint32;
00035
00036 typedef HWND OsWindow;
00037 typedef HWND OsView;
00038 typedef HANDLE OsThread;
00039 typedef HANDLE OsProcess;
00040 typedef char16 OsChar;
00041
00042 typedef BOOL (__stdcall *pSHGetSpecialFolderPathA)(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
00043 typedef BOOL (__stdcall *pSHGetSpecialFolderPathW)(HWND hwndOwner, LPWSTR lpszPath, int nFolder, BOOL fCreate);
00044 typedef int (__stdcall *pSHFileOperationA)(LPSHFILEOPSTRUCTA lpFileOp);
00045 typedef int (__stdcall *pSHFileOperationW)(LPSHFILEOPSTRUCTW lpFileOp);
00046 typedef int (__stdcall *p_vscprintf)(const char *format, va_list argptr);
00047
00048 class LgiClass GMessage
00049 {
00050 public:
00051 int Msg;
00052 int a;
00053 int b;
00054
00055 GMessage()
00056 {
00057 Msg = a = b = 0;
00058 }
00059
00060 GMessage(int M, int A = 0, int B = 0)
00061 {
00062 Msg = M;
00063 a = A;
00064 b = B;
00065 }
00066 };
00067
00068 class LgiClass OsAppArguments
00069 {
00070 public:
00071 HINSTANCE hInstance;
00072 DWORD Pid;
00073 char16 *lpCmdLine;
00074 int nCmdShow;
00075
00076 OsAppArguments()
00077 {
00078 hInstance = 0;
00079 lpCmdLine = 0;
00080 nCmdShow = SW_RESTORE;
00081 }
00082 };
00083
00085
00086 #define MsgCode(m) (m->Msg)
00087 #define MsgA(m) (m->a)
00088 #define MsgB(m) (m->b)
00089 #define CreateMsg(m, a, b) GMessage(m, a, b)
00090 #define IsWin9x (GApp::Win9x)
00091 #define DefaultOsView(t) NULL
00092
00093
00094 LgiFunc void LgiSleep(DWORD i);
00095
00096
00097 typedef DWORD OsProcessId;
00098 #define LgiProcessInst() (LgiApp->GetInstance())
00099 extern p_vscprintf lgi_vscprintf;
00100
00101
00102 typedef DWORD OsThreadId;
00103 typedef HANDLE OsSemaphore;
00104 #define LgiGetCurrentThread() GetCurrentThreadId()
00105
00106
00107 #define ValidSocket(s) ((s) != INVALID_SOCKET)
00108 typedef SOCKET OsSocket;
00109
00110
00111 #define LgiYield() GApp::ObjInstance()->Run(false)
00112
00113 #ifdef _MSC_VER
00114 #define snprintf _snprintf
00115 #define atoi64 _atoi64
00116 #define vsnprintf _vsnprintf
00117 #define vsnwprintf _vsnwprintf
00118 #endif
00119
00120 #define K_CHAR 0x0
00121
00122 #define LGI_GViewMagic 0x14412662
00123
00124 #define LGI_FileDropFormat "CF_HDROP"
00125 #define LGI_WideCharset "ucs-2"
00126
00127 #define MK_LEFT MK_LBUTTON
00128 #define MK_RIGHT MK_RBUTTON
00129 #define MK_MIDDLE MK_MBUTTON
00130 #define MK_CTRL MK_CONTROL
00131
00132
00133 #define SUNKEN 1
00134 #define RAISED 2
00135 #define CHISEL 3
00136 #define FLAT 4
00137
00138
00139 #define WM_MOUSEWHEEL 0x020A
00140 #define WHEEL_DELTA 120
00141 #ifndef SPI_GETWHEELSCROLLLINES
00142 #define SPI_GETWHEELSCROLLLINES 104
00143 #endif
00144
00145
00146 #define GWF_VISIBLE 0x00000001
00147 #define GWF_ENABLED 0x00000002
00148 #define GWF_FOCUS 0x00000004
00149 #define GWF_OVER 0x00000008
00150 #define GWF_DROP_TARGET 0x00000010
00151 #define GWF_SUNKEN 0x00000020
00152 #define GWF_FLAT 0x00000040
00153 #define GWF_RAISED 0x00000080
00154 #define GWF_BORDER 0x00000100
00155 #define GWF_DIALOG 0x00000200
00156 #define GWF_DESTRUCTOR 0x00000400
00157 #define GWF_QUIT_WND 0x00000800
00158
00159
00160 #define DialogToPixelX(i) (((i)*Bx)/4)
00161 #define DialogToPixelY(i) (((i)*By)/8)
00162 #define PixelToDialogX(i) (((i)*4)/Bx)
00163 #define PixelToDialogY(i) (((i)*8)/By)
00164
00165 #define DIALOG_X 1.56
00166 #define DIALOG_Y 1.85
00167 #define CTRL_X 1.50
00168 #define CTRL_Y 1.64
00169
00170
00171
00172
00173
00174 #define M_USER WM_USER
00175 #define M_CUT WM_CUT
00176 #define M_COPY WM_COPY
00177 #define M_PASTE WM_PASTE
00178 #define M_COMMAND WM_COMMAND
00179 #define M_CLOSE WM_CLOSE
00180
00181
00182
00183 #define M_MOUSEENTER (M_USER+0x1000)
00184 #define M_MOUSEEXIT (M_USER+0x1001)
00185
00186
00187
00188 #define M_CHANGE (M_USER+0x1002)
00189
00190
00191
00192 #define M_DESCRIBE (M_USER+0x1003)
00193
00194
00195 #define M_WANT_DIALOG_PROC (M_USER+0x1004)
00196
00197
00198
00199 #define M_TRANSLATE_ACCELERATOR (M_USER+0x1005)
00200
00201
00202 #define M_TRAY_NOTIFY (M_USER+0x1006)
00203
00204
00205 #define M_SET_WND_STYLE (M_USER+0x1007)
00206
00207
00208 #define M_SCROLL_BAR_CHANGED (M_USER+0x1008)
00209
00210
00211
00212
00213 #define M_HANDLEMOUSEMOVE (M_USER+0x1009)
00214
00215
00216 #define DIR_CHAR '\\'
00217 #define DIR_STR "\\"
00218 #define EOL_SEQUENCE "\r\n"
00219
00220 #define IsSlash(c) (((c)=='/')OR((c)=='\\'))
00221 #define IsQuote(c) (((c)=='\"')OR((c)=='\''))
00222
00223 #define LGI_PATH_SEPARATOR ";"
00224 #define LGI_ALL_FILES "*.*"
00225 #define LGI_LIBRARY_EXT "dll"
00226
00228
00229 typedef HWND OsView;
00230
00232
00233 LgiFunc class GViewI *GWindowFromHandle(OsView hWnd);
00234 LgiFunc int GetMouseWheelLines();
00235 LgiFunc int WinPointToHeight(int Pt);
00236 LgiFunc int WinHeightToPoint(int Ht);
00237 LgiFunc char *GetWin32Folder(int Id);
00238
00240 LgiFunc int FormatToInt(char *s);
00242 LgiFunc char *FormatToStr(int f);
00243
00244
00245 #endif