mcommon.h

00001 
00002 #ifndef MINICOMMON_H
00003 #define MINICOMMON_H
00004 
00005 #if defined (WIN32) 
00006 
00007 #ifdef __MGNCS_LIB__
00008         #define MGNCS_EXPORT       __declspec(dllexport)
00009 #else
00010         #define MGNCS_EXPORT       __declspec(dllimport)
00011 #endif
00012 #else
00013         #define MGNCS_EXPORT       
00014 #endif
00015 
00016 typedef struct Allocator{
00017         void *(*alloc)(void* pold, size_t new_size);
00018         size_t (*getsize)(void* p);
00019         void (*free)(void* p);
00020 }Allocator;
00021 
00022 Allocator * ncsGetDefaultAllocator(void);
00023 
00024 
00028 enum enumNCSAlign{
00029         NCS_ALIGN_LEFT = 0,
00030         NCS_ALIGN_RIGHT,
00031         NCS_ALIGN_CENTER
00032 };
00033 
00037 enum enumNCSVAlign{
00038         NCS_VALIGN_TOP = 0,
00039         NCS_VALIGN_BOTTOM,
00040         NCS_VALIGN_CENTER
00041 };
00042 
00046 enum enumNCSImageDrawMode{
00047         NCS_DM_NORMAL = 0,
00048         NCS_DM_SCALED,
00049         NCS_DM_TILED
00050 };
00051 
00052 //support alloca
00053 #ifdef HAVE_ALLOCA
00054 #define ALLOCA(size)  alloca(size)
00055 #define FREEA(p)
00056 #else
00057 #define ALLOCA(size) malloc(size)
00058 #define FREEA(p) free(p)
00059 #endif
00060 
00061 MGNCS_EXPORT void ncsDrawImage(HDC hdc, PBITMAP pbmp, const RECT * rc, int mode, int align, int valign);
00062 
00063 #define IMG_TYPE_UNKNOWN  0
00064 #define IMG_TYPE_BITMAP   1
00065 #define IMG_TYPE_ICON     2
00066 #define IMG_TYPE_MYBITMAP 4
00067 
00068 #define IMG_FLAG_IGNORE   0
00069 #define IMG_FLAG_UNLOAD   1
00070 #define IMG_FLAG_RELEASE_RES  2
00071 typedef struct _ImageDrawInfo{
00072         unsigned char img_type;
00073         unsigned char flag;
00074         unsigned char drawMode;
00075         unsigned char revert;
00076         union{
00077                 PBITMAP pbmp;
00078                 HICON hIcon;
00079                 PMYBITMAP pmybmp;
00080                 RES_KEY key;
00081         }img;
00082 }ImageDrawInfo;
00083 
00084 MGNCS_EXPORT void ncsInitDrawInfo(ImageDrawInfo *idi);
00085 
00086 MGNCS_EXPORT void ncsCleanImageDrawInfo(ImageDrawInfo * idi);
00087 
00088 MGNCS_EXPORT BOOL ncsSetImageDrawInfoByFile(ImageDrawInfo *idi, const char* image_file, int drawMode, BOOL bas_mybitmp);
00089 
00090 MGNCS_EXPORT BOOL ncsSetImageDrawInfoByRes(ImageDrawInfo *idi, RES_KEY key, int drawMode, int res_type);
00091 
00092 MGNCS_EXPORT BOOL ncsSetImageDrawInfo(ImageDrawInfo *idi, void* pimg, int drawMode, int img_type);
00093 
00094 
00095 MGNCS_EXPORT void ncsImageDrawInfoDraw(ImageDrawInfo *idi, HDC hdc, const RECT* prc, int align, int valign);
00096 
00097 MGNCS_EXPORT BOOL ncsImageDrawInfoGetImageSize(ImageDrawInfo *idi, int *px, int *py);
00098 
00099 #endif
00100 
Generated on Fri Jun 10 11:18:06 2011 for New Control Set V1.0.0 API Reference by  doxygen 1.6.3