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

win32/LgiOsClasses.h

Go to the documentation of this file.
00001 
00002 
00003 
00004 #ifndef __OS_CLASS_H
00005 #define __OS_CLASS_H
00006 
00007 class LgiClass OsApplication
00008 {
00009 protected:
00010     HCURSOR hNormalCursor;
00011 
00012 public:
00013     OsApplication()
00014     {
00015         hNormalCursor = 0;
00016     }
00017 };
00018 
00019 // Win32 Memory Handler
00020 class LgiClass GMem {
00021 
00022     int64 Size;
00023     HGLOBAL hMem;
00024     void *pMem;
00025 
00026 public:
00027     GMem(int64 size)
00028     {
00029         Size = size;
00030         hMem = GlobalAlloc(GMEM_FIXED, (DWORD)Size);
00031         pMem = 0;
00032     }
00033 
00034     GMem(HGLOBAL hmem)
00035     {
00036         hMem = hmem;
00037         Size = GlobalSize(hMem);
00038         pMem = 0;
00039     }
00040 
00041     ~GMem()
00042     {
00043         if (pMem)
00044         {
00045             GlobalUnlock(hMem);
00046             pMem = 0;
00047         }
00048         if (hMem)
00049         {
00050             GlobalFree(hMem);
00051             hMem = 0;
00052         }
00053     }
00054 
00055     void *Lock()
00056     {
00057         return pMem = GlobalLock(hMem);
00058     }
00059 
00060     void UnLock()
00061     {
00062         if (pMem)
00063         {
00064             GlobalUnlock(hMem);
00065             pMem = 0;
00066         }
00067     }
00068 
00069     int64 GetSize()
00070     {
00071         return Size;
00072     }
00073 
00074     void Detach()
00075     {
00076         if (pMem)
00077         {
00078             GlobalUnlock(hMem);
00079             pMem = 0;
00080         }
00081         hMem = 0;
00082         Size = 0;
00083     }
00084 
00085     HGLOBAL Handle() { return hMem; }
00086 };
00087 
00088 // Win32 window class
00089 class LgiClass GWin32Class : public GObject
00090 {
00091     friend class GControl;
00092     friend class GApp;
00093 
00094     static LRESULT CALLBACK Redir(OsView hWnd, UINT m, WPARAM a, LPARAM b);
00095     static LRESULT CALLBACK SubClassRedir(OsView hWnd, UINT m, WPARAM a, LPARAM b);
00096 
00097     WNDPROC ParentProc;
00098 
00099 public:
00100     union
00101     {
00102         WNDCLASSA a;
00103         WNDCLASSW w;
00104     } Class;
00105 
00106     GWin32Class(char *Name);
00107     ~GWin32Class();
00108 
00109     bool Register();
00110     bool SubClass(char *Parent);
00111     LRESULT CALLBACK CallParent(OsView hWnd, UINT m, WPARAM a, LPARAM b);
00112 
00113     static GWin32Class *Create(char *ClassName);
00114 };
00115 
00117 #include "GContainers.h"
00118 class LgiClass GRegKey
00119 {
00120     HKEY k, Root;
00121     char s[256];
00122     char *KeyName;
00123 
00124 public:
00126     GRegKey
00127     (
00129         char *Key,
00130         ...
00131     );
00132     ~GRegKey();
00133 
00135     bool IsOk();
00137     bool Create();
00139     char *Name();
00140 
00142     char *GetStr
00143     (
00145         char *Name = 0
00146     );
00148     bool SetStr(char *Name, char *Value);
00150     int GetInt(char *Name = 0);
00152     bool SetInt(char *Name, int Value);
00154     bool GetBinary(char *Name, void *&Ptr, int &Len);
00156     bool SetBinary(char *Name, void *Ptr, int Len);
00158     bool DeleteValue(char *Name = 0);
00160     bool DeleteKey();
00161 
00163     bool GetKeyNames(List<char> &n);
00165     bool GetValueNames(List<char> &n);
00166 };
00167 
00168 #endif

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