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

win32/LgiOsDefs.h

00001 //
00002 //      FILE:           LgiOsDefs.h (Win32)
00003 //      AUTHOR:         Matthew Allen
00004 //      DATE:           24/9/99
00005 //      DESCRIPTION:    Lgi Win32 OS defines
00006 //
00007 //      Copyright (C) 1999, Matthew Allen
00008 //              fret@memecode.com
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 // Includes
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 // Typedefs
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 // Defines
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 // Sleep the current thread
00094 LgiFunc void LgiSleep(DWORD i);
00095 
00096 // Process
00097 typedef DWORD                       OsProcessId;
00098 #define LgiProcessInst()            (LgiApp->GetInstance())
00099 extern p_vscprintf                  lgi_vscprintf;
00100 
00101 // Threads
00102 typedef DWORD                       OsThreadId;
00103 typedef HANDLE                      OsSemaphore;
00104 #define LgiGetCurrentThread()       GetCurrentThreadId()
00105 
00106 // Socket/Network
00107 #define ValidSocket(s)              ((s) != INVALID_SOCKET)
00108 typedef SOCKET                      OsSocket;
00109 
00110 // Run the message loop to process any pending messages
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 // Edge types
00133 #define SUNKEN                      1
00134 #define RAISED                      2
00135 #define CHISEL                      3
00136 #define FLAT                        4
00137 
00138 // Stupid mouse wheel defines don't work. hmmm
00139 #define WM_MOUSEWHEEL               0x020A
00140 #define WHEEL_DELTA                 120
00141 #ifndef SPI_GETWHEELSCROLLLINES
00142 #define SPI_GETWHEELSCROLLLINES     104
00143 #endif
00144 
00145 // Window flags
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 // Widgets
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 // Messages
00171 
00172 // Quite a lot of windows stuff uses WM_USER+n where
00173 // n < 0x1A0 or so... so stay out of their way.
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     // wParam = bool Inside; // is the mouse inside the client area?
00182     // lParam = MAKELONG(x, y); // mouse location
00183     #define M_MOUSEENTER                (M_USER+0x1000)
00184     #define M_MOUSEEXIT                 (M_USER+0x1001)
00185 
00186     // wParam = (GView*) Wnd;
00187     // lParam = (int) Flags;
00188     #define M_CHANGE                    (M_USER+0x1002)
00189 
00190     // wParam = (GView*) Wnd;
00191     // lParam = (char*) Text; // description from window
00192     #define M_DESCRIBE                  (M_USER+0x1003)
00193 
00194     // return (bool)
00195     #define M_WANT_DIALOG_PROC          (M_USER+0x1004)
00196 
00197     // wParam = void
00198     // lParam = (MSG*) Msg;
00199     #define M_TRANSLATE_ACCELERATOR     (M_USER+0x1005)
00200 
00201     // None
00202     #define M_TRAY_NOTIFY               (M_USER+0x1006)
00203 
00204     // lParam = Style
00205     #define M_SET_WND_STYLE             (M_USER+0x1007)
00206 
00207     // lParam = GScrollBar *Obj
00208     #define M_SCROLL_BAR_CHANGED        (M_USER+0x1008)
00209 
00210     // lParam = HWND of window under mouse
00211     // This is only sent for non-LGI window in our process
00212     // because we'd get WM_MOUSEMOVE's for our own windows
00213     #define M_HANDLEMOUSEMOVE           (M_USER+0x1009)
00214 
00215 // Directories
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 // Typedefs
00229 typedef HWND OsView;
00230 
00232 // Externs
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

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