mrdr.h

Go to the documentation of this file.
00001 
00021 #ifndef _MGNCS_RENDER_H
00022 #define _MGNCS_RENDER_H
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 
00038 #define NCS_TYPE_MASK               WE_ATTR_TYPE_MASK
00039 #define NCS_TYPE_COLOR_MASK         WE_ATTR_TYPE_COLOR_MASK
00040 #define NCS_TYPE_INDEX_MASK         WE_ATTR_TYPE_INDEX_MASK
00041 
00042 #define NCS_TYPE_METRICS            0x6000
00043 #define NCS_TYPE_COLOR              0x7000
00044 #define NCS_TYPE_IMAGE              0x8000
00045 #define NCS_TYPE_INT                0x9000
00046 #define NCS_TYPE_FGC                NCS_TYPE_COLOR
00047 #define NCS_TYPE_BGC                (NCS_TYPE_COLOR | 0x0100) 
00048 
00049 #define NCS_TYPE_IS_IMAGE(id)       (((id) & NCS_TYPE_MASK) == NCS_TYPE_IMAGE)
00050 
00051 #define NCS_METRICS_BASEID          (NCS_TYPE_METRICS | 0)
00052 #define NCS_FGC_BASEID              (NCS_TYPE_FGC | 0)
00053 #define NCS_BGC_BASEID              (NCS_TYPE_BGC | 0)
00054 #define NCS_INT_BASEID              (NCS_TYPE_INT | 0)
00055 #define NCS_IMAGE_BASEID            (NCS_TYPE_IMAGE | 0)
00056 
00057 #define NCS_FONT_NUMBER             0
00058 #define NCS_METRICS_NUMBER          2 
00059 #define NCS_COLORS_NUMBER           9
00060 #define NCS_IMAGE_NUMBER            17 
00061 #define NCS_INT_NUMBER              5
00062 
00063 //common for all renderer
00064 #define NCS_FGC_3DBODY              NCS_FGC_BASEID
00065 #define NCS_BGC_3DBODY              NCS_BGC_BASEID 
00066 
00067 #define NCS_FGC_WINDOW              NCS_FGC_BASEID  + 1
00068 #define NCS_BGC_WINDOW              NCS_BGC_BASEID  + 1 
00069 
00070 #define NCS_FGC_SELECTED_ITEM       NCS_FGC_BASEID  + 2
00071 #define NCS_BGC_SELECTED_ITEM       NCS_BGC_BASEID  + 2 
00072 
00073 #define NCS_FGC_HILIGHT_ITEM        NCS_FGC_BASEID  + 3
00074 #define NCS_BGC_HILIGHT_ITEM        NCS_BGC_BASEID  + 3 
00075 
00076 #define NCS_FGC_DISABLED_ITEM       NCS_FGC_BASEID  + 4
00077 #define NCS_BGC_DISABLED_ITEM       NCS_BGC_BASEID  + 4 
00078 
00079 #define NCS_BGC_SELITEM_NOFOCUS     NCS_BGC_BASEID  + 5 
00080 
00081 #define NCS_IMAGE_BKGND             NCS_IMAGE_BASEID
00082 #define NCS_MODE_BKIMAGE            NCS_INT_BASEID
00083 
00084 #define NCS_METRICS_3DBODY_ROUND_RADIUS (NCS_METRICS_BASEID)
00085 
00086 //fashion
00087 #define NCS_METRICS_3DBODY_ROUNDX   (NCS_METRICS_BASEID)
00088 #define NCS_METRICS_3DBODY_ROUNDY   (NCS_METRICS_BASEID + 1)
00089 #define NCS_MODE_BGC                NCS_INT_BASEID  + 1
00090 #define NCS_MODE_FGC                NCS_INT_BASEID  + 2
00091 #define NCS_MODE_ITEM               NCS_INT_BASEID  + 3
00092 #define NCS_MODE_USEFLAT            NCS_INT_BASEID  + 4
00093 
00094 //fashion.ProgressBar
00095 #define NCS_BGC_PRGBAR_CHUNK        NCS_BGC_BASEID  + 6
00096 //fashion.TrackBar
00097 #define NCS_BGC_TRKBAR_SLIDER       NCS_BGC_BASEID  + 7
00098 #define NCS_BGC_TRKBAR_THUMB        NCS_BGC_BASEID  + 8
00099 
00100 //flat
00101 #define NCS_BGC_PRPSHT_NMLTAB       NCS_BGC_BASEID  + 9
00102 
00103 //skin
00104 #define NCS_IMAGE_ARROWS            NCS_IMAGE_BASEID + 1
00105 #define NCS_IMAGE_ARROWSHELL        NCS_IMAGE_BASEID + 2
00106 //skin.Button
00107 #define NCS_IMAGE_BUTTON            NCS_IMAGE_BASEID + 3
00108 //skin.CheckButton
00109 #define NCS_IMAGE_CHKBTN            NCS_IMAGE_BASEID + 4
00110 //skin.RadioButton
00111 #define NCS_IMAGE_RDOBTN            NCS_IMAGE_BASEID + 5
00112 //skin.ListView
00113 #define NCS_IMAGE_LISTV_TREE        NCS_IMAGE_BASEID + 6
00114 #define NCS_IMAGE_LISTV_HDR         NCS_IMAGE_BASEID + 7
00115 //skin.PropSheet
00116 #define NCS_IMAGE_PRPSHT_TAB        NCS_IMAGE_BASEID + 8
00117 //skin.ProgressBar
00118 #define NCS_IMAGE_PRGBAR_HCHUNK     NCS_IMAGE_BASEID + 9
00119 #define NCS_IMAGE_PRGBAR_VCHUNK     NCS_IMAGE_BASEID + 10
00120 #define NCS_IMAGE_PRGBAR_HSLIDER    NCS_IMAGE_BASEID + 11
00121 #define NCS_IMAGE_PRGBAR_VSLIDER    NCS_IMAGE_BASEID + 12
00122 //skin.TrackBar
00123 #define NCS_IMAGE_TRKBAR_HSLIDER    NCS_IMAGE_BASEID + 13
00124 #define NCS_IMAGE_TRKBAR_VSLIDER    NCS_IMAGE_BASEID + 14
00125 #define NCS_IMAGE_TRKBAR_HTHUMB     NCS_IMAGE_BASEID + 15
00126 #define NCS_IMAGE_TRKBAR_VTHUMB     NCS_IMAGE_BASEID + 16
00127 
00182 MGNCS_EXPORT DWORD ncsGetElementEx (mWidget *self, const char* rdrName, int id);
00183 
00199 MGNCS_EXPORT DWORD ncsSetElementEx (mWidget* self, const char* rdrName, int id, DWORD value);
00200 
00201 MGNCS_EXPORT BOOL ncsLoadRdrElementsFromEtcFile(const char* etcfile, const char** rdrNames, int count);
00202 
00203 MGNCS_EXPORT BOOL ncsLoadRdrElementsFromEtcHandle(GHANDLE hEtc, const char** rdrNames, int count);
00204 
00213 MGNCS_EXPORT GHANDLE ncsLoadRdrEtcFile (const char* etcfile, const char** rdrName, int count);
00214 
00221 MGNCS_EXPORT int ncsUnloadRdrEtcFile(GHANDLE hEtcFile);
00222 
00223 /*
00224  * \def var g_ncsEtcHandle
00225  * \breif the MGNCS configuration handle
00226  */
00227 MGNCS_EXPORT extern GHANDLE g_ncsEtcHandle;
00228 
00229 /*
00230  * \fn ncsSetEtcHandler(GHANDLE hEtc);
00231  * \brief set the outside of etc handler of mgnc.cfg. 
00232  * can used for incore resource
00233  *
00234  * \sa g_ncsEtcHandler
00235  */
00236 static inline void ncsSetEtcHandle(GHANDLE hEtc)
00237 {
00238     g_ncsEtcHandle = hEtc;
00239 }
00240 
00241 
00242 
00247 #define ncsGetElement(self, id) \
00248     ncsGetElementEx((mWidget*)self, NULL, id)
00249 
00254 #define ncsSetElement(self, id, value) \
00255     ncsSetElementEx((mWidget*)self, NULL, id, value)
00256 
00268 MGNCS_EXPORT mWidgetRenderer *ncsRetriveCtrlRDR (const char *rendererName, const char *className);
00269 
00285 MGNCS_EXPORT BOOL ncsRegisterCtrlRDR (const char *rendererName, const char *className,
00286                           mWidgetRenderer *renderer);
00287 
00297 MGNCS_EXPORT void ncsUnregisterCtrlRDRs(const char* rdrName/*=NULL*/, const char* className/*=NULL*/);
00298 
00304 typedef struct _NCS_RDR_ENTRY
00305 {
00309   const char *className;
00313   mWidgetRenderer *renderer;
00314 } NCS_RDR_ENTRY;
00315 
00329 MGNCS_EXPORT BOOL ncsRegisterCtrlRDRs (const char *rendererName, NCS_RDR_ENTRY * entries,
00330                            int count);
00331 
00349 MGNCS_EXPORT BOOL ncsSetSystemRenderer(const char* name);
00350 
00358 MGNCS_EXPORT const char* ncsGetSystemRenderer(void);
00359 
00379 #define INVALID_RDR_VALUE  ((DWORD)-1)
00380 
00381 static inline gal_pixel ncsColor2Pixel(HDC hdc, DWORD color)
00382 {
00383         return RGBA2Pixel(hdc,GetRValue(color),
00384                 GetGValue(color),
00385                 GetBValue(color),
00386                 GetAValue(color));
00387 }
00388 
00389 MGNCS_EXPORT void ncsCommRDRDrawFocusFrame(HWND hWnd, HDC hdc, const RECT *rc);
00390 MGNCS_EXPORT BOOL ncsCommRDRDrawBkgnd(HWND hWnd, HDC hdc, const RECT* inv_rc);
00391 
00392 MGNCS_EXPORT void ncsCommRDRDraw3dbox(HDC hdc, const RECT* rc,  DWORD color, DWORD flag);
00393 MGNCS_EXPORT void ncsCommRDRDraw3DRoundBox(HDC hdc, const RECT *rc, int rx, int ry, DWORD color, DWORD flag);
00394 
00395 #define NCS_ROUND_CORNER_LEFT_TOP                       (0x1)
00396 #define NCS_ROUND_CORNER_LEFT_BOTTOM            (0x2)
00397 #define NCS_ROUND_CORNER_RIGHT_TOP          (0x4)
00398 #define NCS_ROUND_CORNER_RIGHT_BOTTOM       (0x8)
00399 #define NCS_ROUND_CORNER_LEFTS              (NCS_ROUND_CORNER_LEFT_TOP|NCS_ROUND_CORNER_LEFT_BOTTOM)
00400 #define NCS_ROUND_CORNER_RIGHTS             (NCS_ROUND_CORNER_RIGHT_TOP|NCS_ROUND_CORNER_RIGHT_BOTTOM)
00401 #define NCS_ROUND_CORNER_TOPS               (NCS_ROUND_CORNER_LEFT_TOP|NCS_ROUND_CORNER_RIGHT_TOP)
00402 #define NCS_ROUND_CORNER_BOTTOMS            (NCS_ROUND_CORNER_LEFT_BOTTOM|NCS_ROUND_CORNER_RIGHT_BOTTOM)
00403 #define NCS_ROUND_CORNER_ALL                (NCS_ROUND_CORNER_LEFT_TOP|NCS_ROUND_CORNER_LEFT_BOTTOM| \
00404                                                                                                 NCS_ROUND_CORNER_RIGHT_TOP|NCS_ROUND_CORNER_RIGHT_BOTTOM)
00405 #define NCS_BORDER_LEFT                     0x1000
00406 #define NCS_BORDER_RIGHT                    0x2000
00407 #define NCS_BORDER_TOP                      0x4000
00408 #define NCS_BORDER_BOTTOM                   0x8000
00409 #define NCS_BORDER_ALL                      (NCS_BORDER_LEFT|NCS_BORDER_RIGHT|NCS_BORDER_TOP|NCS_BORDER_BOTTOM)
00410 
00411 MGNCS_EXPORT void ncsCommRDRDraw3DHalfRoundBox(HDC hdc, const RECT *rc, int rx, int ry, DWORD color, DWORD flag, DWORD part_flag);
00412 MGNCS_EXPORT void ncsCommRDRDrawHalfRoundRect(HDC hdc, const RECT *rc, int rx, int ry, DWORD color, DWORD part_flag);
00413 
00414 MGNCS_EXPORT void ncsCommRDRFillHalfRoundRect(HDC hdc, const RECT *rc, int rx, int ry, DWORD color, DWORD part_flag);
00415 
00416 MGNCS_EXPORT void ncsCommRDRDraw3DEllipse(HDC hdc, const RECT *rc, DWORD color1, DWORD color2, DWORD flag);
00417 
00418 MGNCS_EXPORT void ncsCommRDRDrawCheckbox(HDC hdc, const RECT* rc, DWORD fgcolor, DWORD bgcolor, DWORD discolor, DWORD flag);
00419 
00420 MGNCS_EXPORT void ncsCommRDRDrawRadio(HDC hdc, const RECT* rc,  DWORD fgcolor, DWORD bgcolor, DWORD discolor,DWORD flag);
00421 
00422 MGNCS_EXPORT void ncsCommRDRDrawArrow(HDC hdc, const RECT* rc, int arrow,DWORD color, BOOL bFill);
00423 
00424 MGNCS_EXPORT void ncsCommRDRDrawItem(HDC hdc, const RECT* rc, DWORD color);
00425 
00426 MGNCS_EXPORT void ncsCommRDRDrawSmallHalfRoundBox(HDC hdc, const RECT *rc, DWORD flags, BOOL bFill);
00427 
00428 enum ncsCommRDRColorCalc {
00429         NCSR_COLOR_DARKER = -100,
00430         NCSR_COLOR_DARKEST = -200 ,
00431         NCSR_COLOR_LIGHTER = 100 ,
00432         NCSR_COLOR_LIGHTEST = 200
00433 };
00434 
00435 MGNCS_EXPORT DWORD ncsCommRDRCalc3dboxColor(DWORD color, int degree);
00436 
00437 //skin
00438 
00439 #define DI_FILL_TILE    0x01
00440 #define DI_FILL_STRETCH 0x02
00441 
00442 /* Draw info */
00443 typedef struct _DRAWINFO
00444 {
00445     /* The pointer to the whole bitmap. */
00446     const BITMAP* bmp;
00447 
00448     /* The number of line in this bitmap. */
00449     unsigned int nr_line;
00450 
00451     /* The number of colume in this bitmap. */
00452     unsigned int nr_col;
00453 
00454     /* The index of line to current sub bitmap. */
00455     unsigned int idx_line;
00456 
00457     /* The index of colume to current sub bitmap. */
00458     unsigned int idx_col;
00459 
00460     /* The left/top margin value of current sub bitmap. */
00461     unsigned int margin1;
00462 
00463     /* The right/bottom margin value of current sub bitmap. */
00464     unsigned int margin2;
00465 
00466     /* The margin direct. FALSE for left-to-right (default), 
00467      * TRUE for top-to-bottom. */
00468     BOOL direct;
00469 
00470     /* The flip flag. FALSE for not flip sub bitmap (default), 
00471      * TRUE for flip. It can be used by draw_tab function.*/
00472     BOOL flip;
00473 
00474     /* The style of drawing bitmap. It can be one of the 
00475      * following value:
00476      *  - DI_FILL_TILE
00477      *  - DI_FILL_STRETCH
00478      */
00479     unsigned int style;
00480 
00481 } DRAWINFO;
00482 
00483 MGNCS_EXPORT void ncsSkinDraw(HDC hdc, const RECT* rc, const DRAWINFO *di);
00484 
00488 #ifdef __cplusplus
00489 }
00490 #endif
00491 
00492 #endif
Generated on Fri Jun 10 11:18:06 2011 for New Control Set V1.0.0 API Reference by  doxygen 1.6.3