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     WNDPROC ParentProc;
00095 
00096 #ifdef __GNUC__
00097 public:
00098 #endif
00099     static LRESULT CALLBACK Redir(OsView hWnd, UINT m, WPARAM a, LPARAM b);
00100     static LRESULT CALLBACK SubClassRedir(OsView hWnd, UINT m, WPARAM a, LPARAM b);
00101 
00102 public:
00103     union
00104     {
00105         WNDCLASSA a;
00106         WNDCLASSW w;
00107     } Class;
00108 
00109     GWin32Class(char *Name);
00110     ~GWin32Class();
00111 
00112     bool Register();
00113     bool SubClass(char *Parent);
00114     LRESULT CALLBACK CallParent(OsView hWnd, UINT m, WPARAM a, LPARAM b);
00115 
00116     static GWin32Class *Create(char *ClassName);
00117 };
00118 
00120 #include "GContainers.h"
00121 class LgiClass GRegKey
00122 {
00123     HKEY k, Root;
00124     char s[256];
00125     char *KeyName;
00126 
00127 public:
00129     GRegKey
00130     (
00132         char *Key,
00133         ...
00134     );
00135     ~GRegKey();
00136 
00138     bool IsOk();
00140     bool Create();
00142     char *Name();
00143 
00145     char *GetStr
00146     (
00148         char *Name = 0
00149     );
00151     bool SetStr(char *Name, char *Value);
00153     int GetInt(char *Name = 0);
00155     bool SetInt(char *Name, int Value);
00157     bool GetBinary(char *Name, void *&Ptr, int &Len);
00159     bool SetBinary(char *Name, void *Ptr, int Len);
00161     bool DeleteValue(char *Name = 0);
00163     bool DeleteKey();
00164 
00166     bool GetKeyNames(List<char> &n);
00168     bool GetValueNames(List<char> &n);
00169 };
00170 
00171 #endif

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