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 "SHELLAPI.H"
00026 #include "COMMDLG.H"
00027 #include "LgiInc.h"
00028 
00030 // Typedefs
00031 typedef __int64             quad;
00032 typedef int                 int32;
00033 typedef unsigned int        uint32;
00034 
00035 typedef HWND                OsWindow;
00036 typedef HWND                OsView;
00037 typedef HANDLE              OsThread;
00038 typedef HANDLE              OsProcess;
00039 typedef char16              OsChar;
00040 
00041 typedef BOOL (__stdcall *pSHGetSpecialFolderPathA)(HWND hwndOwner, LPSTR lpszPath, int nFolder, BOOL fCreate);
00042 typedef BOOL (__stdcall *pSHGetSpecialFolderPathW)(HWND hwndOwner, LPWSTR lpszPath, int nFolder, BOOL fCreate);
00043 typedef int (__stdcall *pSHFileOperationA)(LPSHFILEOPSTRUCTA lpFileOp);
00044 typedef int (__stdcall *pSHFileOperationW)(LPSHFILEOPSTRUCTW lpFileOp);
00045 typedef int (__stdcall *p_vscprintf)(const char *format, va_list argptr);
00046 
00047 class LgiClass GMessage
00048 {
00049 public:
00050     int Msg;
00051     int a;
00052     int b;
00053 
00054     GMessage()
00055     {
00056         Msg = a = b = 0;
00057     }
00058 
00059     GMessage(int M, int A = 0, int B = 0)
00060     {
00061         Msg = M;
00062         a = A;
00063         b = B;
00064     }
00065 };
00066 
00067 class LgiClass OsAppArguments
00068 {
00069 public:
00070     HINSTANCE hInstance;
00071     DWORD Pid;
00072     char16 *lpCmdLine;
00073     int nCmdShow;
00074 
00075     OsAppArguments()
00076     {
00077         hInstance = 0;
00078         lpCmdLine = 0;
00079         nCmdShow = SW_RESTORE;
00080     }
00081 };
00082 
00084 // Defines
00085 #define MsgCode(m)                  (m->Msg)
00086 #define MsgA(m)                     (m->a)
00087 #define MsgB(m)                     (m->b)
00088 #define CreateMsg(m, a, b)          GMessage(m, a, b)
00089 #define IsWin9x                     (GApp::Win9x)
00090 
00091 // Sleep the current thread
00092 LgiFunc void LgiSleep(DWORD i);
00093 
00094 // Run the message loop to process any pending messages
00095 #define LgiYield()                  GApp::ObjInstance()->Run(false)
00096 
00097 #define snprintf                    _snprintf
00098 #define atoi64                      _atoi64
00099 
00100 #define K_CHAR                      0x0
00101 
00102 #define LGI_GViewMagic              0x14412662
00103 
00104 #define LGI_FileDropFormat          "CF_HDROP"
00105 #define LGI_WideCharset             "ucs-2"
00106 
00107 #define MK_LEFT                     MK_LBUTTON
00108 #define MK_RIGHT                    MK_RBUTTON
00109 #define MK_MIDDLE                   MK_MBUTTON
00110 #define MK_CTRL                     MK_CONTROL
00111     
00112 // Edge types
00113 #define SUNKEN                      1
00114 #define RAISED                      2
00115 #define CHISEL                      3
00116 #define FLAT                        4
00117 
00118 // Stupid mouse wheel defines don't work. hmmm
00119 #define WM_MOUSEWHEEL               0x020A
00120 #define WHEEL_DELTA                 120
00121 #ifndef SPI_GETWHEELSCROLLLINES
00122 #define SPI_GETWHEELSCROLLLINES     104
00123 #endif
00124 
00125 // Window flags
00126 #define GWF_VISIBLE                 0x00000001
00127 #define GWF_ENABLED                 0x00000002
00128 #define GWF_FOCUS                   0x00000004
00129 #define GWF_OVER                    0x00000008
00130 #define GWF_DROP_TARGET             0x00000010
00131 #define GWF_SUNKEN                  0x00000020
00132 #define GWF_FLAT                    0x00000040
00133 #define GWF_RAISED                  0x00000080
00134 #define GWF_BORDER                  0x00000100
00135 #define GWF_DIALOG                  0x00000200
00136 #define GWF_DESTRUCTOR              0x00000400
00137 #define GWF_QUIT_WND                0x00000800
00138 
00139 // Widgets
00140 #define DialogToPixelX(i)           (((i)*Bx)/4)
00141 #define DialogToPixelY(i)           (((i)*By)/8)
00142 #define PixelToDialogX(i)           (((i)*4)/Bx)
00143 #define PixelToDialogY(i)           (((i)*8)/By)
00144 
00145 #define DIALOG_X                    1.56
00146 #define DIALOG_Y                    1.85
00147 #define CTRL_X                      1.50
00148 #define CTRL_Y                      1.64
00149 
00150 // Messages
00151 
00152 // Quite a lot of windows stuff uses WM_USER+n where
00153 // n < 0x1A0 or so... so stay out of their way.
00154     #define M_USER                      WM_USER
00155     #define M_CUT                       WM_CUT
00156     #define M_COPY                      WM_COPY
00157     #define M_PASTE                     WM_PASTE
00158     #define M_COMMAND                   WM_COMMAND
00159     #define M_CLOSE                     WM_CLOSE
00160 
00161     // wParam = bool Inside; // is the mouse inside the client area?
00162     // lParam = MAKELONG(x, y); // mouse location
00163     #define M_MOUSEENTER                (M_USER+0x1000)
00164     #define M_MOUSEEXIT                 (M_USER+0x1001)
00165 
00166     // wParam = (GView*) Wnd;
00167     // lParam = (int) Flags;
00168     #define M_CHANGE                    (M_USER+0x1002)
00169 
00170     // wParam = (GView*) Wnd;
00171     // lParam = (char*) Text; // description from window
00172     #define M_DESCRIBE                  (M_USER+0x1003)
00173 
00174     // return (bool)
00175     #define M_WANT_DIALOG_PROC          (M_USER+0x1004)
00176 
00177     // wParam = void
00178     // lParam = (MSG*) Msg;
00179     #define M_TRANSLATE_ACCELERATOR     (M_USER+0x1005)
00180 
00181     // None
00182     #define M_TRAY_NOTIFY               (M_USER+0x1006)
00183 
00184     // lParam = Style
00185     #define M_SET_WND_STYLE             (M_USER+0x1007)
00186 
00187     // lParam = GScrollBar *Obj
00188     #define M_SCROLL_BAR_CHANGED        (M_USER+0x1008)
00189 
00190 // Directories
00191 #define DIR_CHAR                    '\\'
00192 #define DIR_STR                     "\\"
00193 #define EOL_SEQUENCE                "\r\n"
00194 
00195 #define IsSlash(c)                  (((c)=='/')OR((c)=='\\'))
00196 #define IsQuote(c)                  (((c)=='\"')OR((c)=='\''))
00197 
00198 #define LGI_PATH_SEPARATOR          ";"
00199 #define LGI_ALL_FILES               "*.*"
00200 #define LGI_LIBRARY_EXT             "dll"
00201 
00203 // Typedefs
00204 typedef HWND OsView;
00205 
00207 // Externs
00208 LgiFunc GView *GWindowFromHandle(OsView hWnd);
00209 LgiFunc int GetMouseWheelLines();
00210 LgiFunc int WinPointToHeight(int Pt);
00211 LgiFunc int WinHeightToPoint(int Ht);
00212 LgiFunc char *GetWin32Folder(int Id);
00213 
00214 #endif

Generated on Wed Oct 26 14:46:50 2005 for Lgi by  doxygen 1.4.1