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 #define WIN32GTK 0
00017 #define WIN32NATIVE 1
00018
00019 #include <string.h>
00020 #include "LgiInc.h"
00021 #include "LgiDefs.h"
00022 #include "LgiClass.h"
00023
00025
00026 #define WIN32_LEAN_AND_MEAN
00027 #include "winsock2.h"
00028 #include "windows.h"
00029 #include "SHELLAPI.H"
00030 #include "COMMDLG.H"
00031 #include "LgiInc.h"
00032
00034
00035 typedef __int64 quad;
00036 typedef int int32;
00037 typedef unsigned int uint32;
00038
00039 typedef HWND OsWindow;
00040 typedef HWND OsView;
00041 typedef HANDLE OsThread;
00042 typedef HANDLE OsProcess;
00043 typedef char16 OsChar;
00044 typedef HBITMAP OsBitmap;
00045 typedef HDC OsPainter;
00046
00047 typedef BOOL (__stdcall *pSHGetSpecialFolderPathA)(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
00048 typedef BOOL (__stdcall *pSHGetSpecialFolderPathW)(HWND hwndOwner, LPWSTR lpszPath, int nFolder, BOOL fCreate);
00049 typedef int (__stdcall *pSHFileOperationA)(LPSHFILEOPSTRUCTA lpFileOp);
00050 typedef int (__stdcall *pSHFileOperationW)(LPSHFILEOPSTRUCTW lpFileOp);
00051 typedef int (__stdcall *p_vscprintf)(const char *format, va_list argptr);
00052
00053 class LgiClass GMessage
00054 {
00055 public:
00056 int Msg;
00057 WPARAM a;
00058 LPARAM b;
00059
00060 typedef LPARAM Param;
00061
00062 GMessage()
00063 {
00064 Msg = a = b = 0;
00065 }
00066
00067 GMessage(int M, WPARAM A = 0, LPARAM B = 0)
00068 {
00069 Msg = M;
00070 a = A;
00071 b = B;
00072 }
00073 };
00074
00075 class LgiClass OsAppArguments
00076 {
00077 GAutoWString CmdLine;
00078
00079 void _Default();
00080
00081 public:
00082 HINSTANCE hInstance;
00083 DWORD Pid;
00084 char16 *lpCmdLine;
00085 int nCmdShow;
00086
00087 OsAppArguments();
00088 OsAppArguments(int Args, char **Arg);
00089
00090 OsAppArguments &operator =(OsAppArguments &p);
00091
00092 void Set(char *Utf);
00093 void Set(int Args, char **Arg);
00094 };
00095
00097
00098 #define MsgCode(m) (m->Msg)
00099 #define MsgA(m) (m->a)
00100 #define MsgB(m) (m->b)
00101 #define CreateMsg(m, a, b) GMessage(m, a, b)
00102 #define IsWin9x (GApp::Win9x)
00103 #define DefaultOsView(t) NULL
00104
00105 #if defined(__GNUC__)
00106 #define stricmp strcasecmp
00107 #define strnicmp strncasecmp
00108 #endif
00109
00110
00111 #define VK_PAGEUP VK_PRIOR
00112 #define VK_PAGEDOWN VK_NEXT
00113 #define VK_BACKSPACE VK_BACK
00114
00115
00116 LgiFunc void LgiSleep(DWORD i);
00117
00118
00119 typedef DWORD OsProcessId;
00120 LgiExtern HINSTANCE _lgi_app_instance;
00121 #define LgiProcessInst() _lgi_app_instance
00122 extern p_vscprintf lgi_vscprintf;
00123
00124
00125 typedef DWORD OsThreadId;
00126 typedef CRITICAL_SECTION OsSemaphore;
00127 #define LgiGetCurrentThread() GetCurrentThreadId()
00128
00129
00130 #define ValidSocket(s) ((s) != INVALID_SOCKET)
00131 typedef SOCKET OsSocket;
00132
00133
00134 #define LgiYield() GApp::ObjInstance()->Run(false)
00135
00136 #ifdef _MSC_VER
00137 #define snprintf _snprintf
00138 #define atoi64 _atoi64
00139
00140 #define vsnwprintf _vsnwprintf
00141 #endif
00142
00143 #define K_CHAR 0x0
00144
00145 #define LGI_GViewMagic 0x14412662
00146 #define LGI_FileDropFormat "CF_HDROP"
00147 #define LGI_WideCharset "ucs-2"
00148 #define LGI_PrintfInt64 "%I64i"
00149 #define LGI_IllegalFileNameChars "\t\r\n/\\:*?\"<>|"
00150
00151 #define MK_LEFT MK_LBUTTON
00152 #define MK_RIGHT MK_RBUTTON
00153 #define MK_MIDDLE MK_MBUTTON
00154 #define MK_CTRL MK_CONTROL
00155
00156
00157 #define SUNKEN 1
00158 #define RAISED 2
00159 #define CHISEL 3
00160 #define FLAT 4
00161
00162
00163 #define WM_MOUSEWHEEL 0x020A
00164 #define WHEEL_DELTA 120
00165 #ifndef SPI_GETWHEELSCROLLLINES
00166 #define SPI_GETWHEELSCROLLLINES 104
00167 #endif
00168
00169
00170 #define GWF_VISIBLE WS_VISIBLE
00171 #define GWF_DISABLED WS_DISABLED
00172 #define GWF_BORDER WS_BORDER
00173 #define GWF_TABSTOP WS_TABSTOP
00174 #define GWF_FOCUS 0x00000001
00175 #define GWF_OVER 0x00000002
00176 #define GWF_DROP_TARGET 0x00000004
00177 #define GWF_SUNKEN 0x00000008
00178 #define GWF_FLAT 0x00000010
00179 #define GWF_RAISED 0x00000020
00180 #define GWF_DIALOG 0x00000040
00181 #define GWF_DESTRUCTOR 0x00000080
00182 #define GWF_QUIT_WND 0x00000100
00183
00184
00185 #define DialogToPixelX(i) (((i)*Bx)/4)
00186 #define DialogToPixelY(i) (((i)*By)/8)
00187 #define PixelToDialogX(i) (((i)*4)/Bx)
00188 #define PixelToDialogY(i) (((i)*8)/By)
00189
00190 #define DIALOG_X 1.56
00191 #define DIALOG_Y 1.85
00192 #define CTRL_X 1.50
00193 #define CTRL_Y 1.64
00194
00195
00196
00197
00198
00199 #define M_USER WM_USER
00200 #define M_CUT WM_CUT
00201 #define M_COPY WM_COPY
00202 #define M_PASTE WM_PASTE
00203 #define M_COMMAND WM_COMMAND
00204 #define M_CLOSE WM_CLOSE
00205
00206
00207
00208 #define M_MOUSEENTER (M_USER+0x1000)
00209 #define M_MOUSEEXIT (M_USER+0x1001)
00210
00211
00212
00213 #define M_CHANGE (M_USER+0x1002)
00214
00215
00216
00217 #define M_DESCRIBE (M_USER+0x1003)
00218
00219
00220 #define M_WANT_DIALOG_PROC (M_USER+0x1004)
00221
00222
00223
00224 #define M_TRANSLATE_ACCELERATOR (M_USER+0x1005)
00225
00226
00227 #define M_TRAY_NOTIFY (M_USER+0x1006)
00228
00229
00230 #define M_SET_WND_STYLE (M_USER+0x1007)
00231
00232
00233 #define M_SCROLL_BAR_CHANGED (M_USER+0x1008)
00234
00235
00236
00237
00238 #define M_HANDLEMOUSEMOVE (M_USER+0x1009)
00239
00240
00241 #define M_SET_WINDOW_PLACEMENT (M_USER+0x100a)
00242
00243
00244 #define M_DELETE (M_USER+0x100b)
00245
00250
00251
00252
00253 #define DIR_CHAR '\\'
00254 #define DIR_STR "\\"
00255 #define EOL_SEQUENCE "\r\n"
00256
00257 #define IsSlash(c) (((c)=='/')OR((c)=='\\'))
00258 #define IsQuote(c) (((c)=='\"')OR((c)=='\''))
00259
00260 #define LGI_PATH_SEPARATOR ";"
00261 #define LGI_ALL_FILES "*.*"
00262 #define LGI_LIBRARY_EXT "dll"
00263
00265
00266 typedef HWND OsView;
00267
00269
00270 LgiFunc class GViewI *GWindowFromHandle(OsView hWnd);
00271 LgiFunc int GetMouseWheelLines();
00272 LgiFunc int WinPointToHeight(int Pt);
00273 LgiFunc int WinHeightToPoint(int Ht);
00274 LgiFunc char *GetWin32Folder(int Id);
00275
00277 LgiFunc int FormatToInt(char *s);
00279 LgiFunc char *FormatToStr(int f);
00280
00281
00282 #endif