static void draw_hilight_box (HWND hWnd, HDC hdc, COOLBARITEMDATA* item) { int l,r,t,b; WINDOWINFO *info = (WINDOWINFO*)GetWindowInfo (hWnd); DWORD color; DWORD mainc = GetWindowElementAttr (hWnd, WE_MAINC_THREED_BODY); l = item->RcTitle.left; t = item->RcTitle.top; r = item->RcTitle.right - 1; b = item->RcTitle.bottom - 1; color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_DARKER); SetPenColor (hdc, RGBA2Pixel (hdc, GetRValue (color), GetGValue (color), GetBValue (color), GetAValue (color))); MoveTo (hdc, l, t); LineTo (hdc, l, b); MoveTo (hdc, r - 1, t); LineTo (hdc, r - 1, b); color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_LIGHTER); SetPenColor (hdc, RGBA2Pixel (hdc, GetRValue (color), GetGValue (color), GetBValue (color), GetAValue (color))); MoveTo (hdc, l + 1, t); LineTo (hdc, l + 1, b); MoveTo (hdc, r, t); LineTo (hdc, r, b); }
void CPalGroup::SetAddRGBA(COLORREF crSrc, COLORREF * crTarget, int uAddR, int uAddG, int uAddB, int uAddA) { *crTarget = RGB( ROUND_R(LimitRGB(GetRValue(crSrc) + uAddR)), ROUND_G(LimitRGB(GetGValue(crSrc) + uAddG)), ROUND_B(LimitRGB(GetBValue(crSrc) + uAddB)) ); *crTarget = RGB(ROUND_R(GetRValue(*crTarget)), ROUND_G(GetGValue(*crTarget)), ROUND_B(GetBValue(*crTarget))); *crTarget |= (UINT32)ROUND(LimitRGB(GetAValue(crSrc) + uAddA)) << 24; }
// --------------------------------------------------------------------------- // // ----------- void bDBQuestionElement::init(void* ctx){ //_bTrace_("bDBQuestionElement::init",true); bStdXMLConstant::init(ctx); bStdSolver* solver=(bStdSolver*)ctx; bGenericType* tp=solver->get_type(); if(!tp){ return; } char vl[_values_length_max_]; strcpy(vl,_cfvalue); char* adr1=strchr(vl,':'); char* adr2=NULL; if(adr1){ adr1[0]=0; adr1++; adr2=strchr(adr1,':'); } int idx=0; if(adr1&&adr2){// 2 séparateurs = type+champ/calc+prompt //_tm_("adr1&&adr2"); adr2[0]=0; adr2++; tp=_gapp->typesMgr()->get(_gapp->typesMgr()->index(vl)); if(tp==NULL){ tp=solver->get_type(); } idx=tp->fields()->get_index(adr1); // sprintf(vl,adr2); strcpy(vl,adr2); //_tm_(adr1+"->"+adr1+"->"+vl); //_tm_("idx="+idx); } else if(adr1){// 1 séparateur = champ/calc+prompt //_tm_("adr1"); idx=tp->fields()->get_index(vl); //_tm_(adr1+"->"+vl); //_tm_("idx="+idx); // sprintf(vl,adr1); strcpy(vl,adr1); } else{// Houla ! Bon ben on va considérer que c'est le prompt //_tm_("!adr1&&!adr2"); //_tm_(vl); // Du coup, rien à faire } char value[_values_length_max_]=""; GetAValue(tp,idx,vl,value); _dbval->put(value); }
void CPalGroup::SetAddHLSA(COLORREF crSrc, COLORREF * crTarget, double fpAddH, double fpAddL, double fpAddS, int uAddA) { double modH, modL, modS; RGBtoHLS(crSrc, &modH, &modL, &modS); *crTarget = HLStoRGB( SubHLS(modH + fpAddH), LimitHLS(modL + fpAddL), LimitHLS(modS + fpAddS) ); *crTarget = RGB(ROUND_R(GetRValue(*crTarget)), ROUND_G(GetGValue(*crTarget)), ROUND_B(GetBValue(*crTarget))); *crTarget |= (UINT32)ROUND(LimitRGB(GetAValue(crSrc) + uAddA)) << 24; }
static void DrawCoolBox (HWND hWnd, HDC hdc, PCOOLBARCTRL pdata) { COOLBARITEMDATA* tmpdata; RECT rc; int l,t; WINDOWINFO *info = (WINDOWINFO*)GetWindowInfo (hWnd); DWORD color; DWORD mainc = GetWindowElementAttr (hWnd, WE_MAINC_THREED_BODY); GetClientRect (hWnd, &rc); if (pdata->BackBmp) { FillBoxWithBitmap (hdc, 0, 0, rc.right, rc.bottom, pdata->BackBmp); } color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_DARKEST); SetPenColor (hdc, RGBA2Pixel (hdc, GetRValue (color), GetGValue (color), GetBValue (color), GetAValue (color))); MoveTo (hdc, 0, 0); LineTo (hdc, rc.right, 0); MoveTo (hdc, 0, rc.bottom - 2); LineTo (hdc, rc.right, rc.bottom - 2); color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_LIGHTEST); SetPenColor (hdc, RGBA2Pixel (hdc, GetRValue (color), GetGValue (color), GetBValue (color), GetAValue (color))); MoveTo (hdc, 0, 1); LineTo (hdc, rc.right, 1); MoveTo (hdc, 0, rc.bottom - 1); LineTo (hdc, rc.right, rc.bottom - 1); tmpdata = pdata->head; while (tmpdata) { l = tmpdata->RcTitle.left; t = tmpdata->RcTitle.top; switch (tmpdata->ItemType) { case TYPE_BARITEM: { WINDOWINFO *info = (WINDOWINFO*)GetWindowInfo (hWnd); RECT rcTmp; rcTmp.left = l + 2; rcTmp.top = 4; rcTmp.right = l + 4; rcTmp.bottom = rc.bottom - 4; info->we_rdr->draw_3dbox (hdc, &rcTmp, GetWindowElementAttr (hWnd, WE_MAINC_THREED_BODY), LFRDR_BTN_STATUS_PRESSED); } break; case TYPE_BMPITEM: FillBoxWithBitmap (hdc, l + 2, t + 2, pdata->ItemWidth, pdata->ItemHeight, tmpdata->Bmp); break; case TYPE_TEXTITEM: { SIZE size; int h; WINDOWINFO *info; RECT rc; if (tmpdata->Caption == NULL || tmpdata->Caption [0] == '\0') break; GetTextExtent (hdc, tmpdata->Caption, -1, &size); h = (pdata->ItemHeight - size.cy) / 2; SetBkMode (hdc, BM_TRANSPARENT); if (tmpdata->Disable) { info = (WINDOWINFO*)GetWindowInfo (hWnd); rc.left = l + 2; rc.top = t + h + 2; rc.right = rc.left + size.cx; rc.bottom = rc.top + size.cy; info->we_rdr->disabled_text_out (hWnd, hdc, tmpdata->Caption, &rc, DT_SINGLELINE); } else { SetBkColor (hdc, GetWindowBkColor (hWnd)); SetTextColor (hdc, PIXEL_black); TextOut (hdc, l+2, t + h + 2, tmpdata->Caption); } break; } default: break; } tmpdata = tmpdata->next; } if ((tmpdata = GetCurSel (pdata)) == NULL) return; draw_hilight_box (hWnd, hdc, tmpdata); }
SStringW Color2Hex(COLORREF cr) { SStringW str; str.Format(L"#%02x%02x%02x%02x",GetRValue(cr),GetGValue(cr),GetBValue(cr),GetAValue(cr)); return str; }
/* * * * ¨x¨x¨x¨x¨x¨x¨xtop_line(dark) * ---------top_line(light) * ¨† ¨‡ ¨‡¨† * left_line(dark+light) ¨† ¨‡ ¨‡¨†right_line(light+dark) * ¨† ¨‡ ¨‡¨† * base_line_left ¨{¨{¨{¨{¨{¨{¨{ ¨{¨{¨{¨{¨{¨{¨{ base_line_right */ static void draw_hilight_box (HWND hWnd, HDC hdc, COOL_INDICATOR_ITEMDATA* item) { int l,r,t,b; WINDOWINFO *info = (WINDOWINFO*)GetWindowInfo (hWnd); DWORD color; DWORD mainc = GetWindowElementAttr (hWnd, WE_FGC_THREED_BODY); //UI@hilight_box_color if(item == NULL) return; l = item->RcTitle.left; t = item->RcTitle.top + 2; r = item->RcTitle.right + 1; b = item->RcTitle.bottom + 1; color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_DARKER); SetPenColor (hdc, RGBA2Pixel (hdc, GetRValue (color), GetGValue (color), GetBValue (color), GetAValue (color))); MoveTo (hdc, l, t); LineTo (hdc, l, b); //left_line_dark MoveTo (hdc, r, t); LineTo (hdc, r, b); //right_line_dark MoveTo (hdc, l, t); LineTo (hdc, r, t); //top_line_dark color = info->we_rdr->calc_3dbox_color (mainc, LFRDR_3DBOX_COLOR_LIGHTER); SetPenColor (hdc, RGBA2Pixel (hdc, GetRValue (color), GetGValue (color), GetBValue (color), GetAValue (color))); MoveTo (hdc, l + 1, t); LineTo (hdc, l + 1, b); //left_line_light MoveTo (hdc, r - 1, t); LineTo (hdc, r - 1, b); //right_line_light MoveTo (hdc, l, t+1); LineTo (hdc, r, t+1); //top_line_light mainc = GetWindowElementPixelEx(hWnd, hdc, WE_FGC_THREED_BODY); //to avoid hdc use the color as ARGB SetBrushColor(hdc, mainc); //base line color RECT rP; GetWindowRect(GetParent(hWnd), &rP); int x, y, w, h; x = 0; y = item->RcTitle.bottom + 2; w = item->RcTitle.left + 2; h = 4; FillBox(hdc, x, y, w, h); //base_line_left x = item->RcTitle.right + 1; y = item->RcTitle.bottom + 2; w = RECTW(rP) - x; h = 4; FillBox(hdc, x, y, w, h); //base_line_right }