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); }
/* * draw_scroll_button: * * This function draw scroll button of propsheet control . * * Author: Peng LIU * Date: 2007-12-05 */ static void draw_scroll_button (HWND hWnd, HDC hdc, RECT *title_rc, PPROPSHEETDATA propsheet, DWORD style) { RECT btn_rect = {0, 0, 0, 0}; WINDOWINFO *info; DWORD color; info = (WINDOWINFO*)GetWindowInfo (hWnd); color = GetWindowElementAttr (hWnd, WE_FGC_WINDOW); /* draw left arrow */ btn_rect.top = ((style & 0xf0L) == PSS_BOTTOM) ? title_rc->top + 1 + 2 : title_rc->top + 1; btn_rect.right = get_metrics (MWM_SB_WIDTH); btn_rect.bottom = ((style & 0xf0L) == PSS_BOTTOM) ? title_rc->bottom + 2 - 2 : title_rc->bottom - 2 - 1; //SelectClipRect (hdc, &btn_rect); info->we_rdr->draw_arrow (hWnd, hdc, &btn_rect, color , LFRDR_ARROW_LEFT); /* draw right arrow */ btn_rect.left = propsheet->head_rc.right - get_metrics(MWM_SB_WIDTH); btn_rect.right = propsheet->head_rc.right; //SelectClipRect (hdc, &btn_rect); info->we_rdr->draw_arrow (hWnd, hdc, &btn_rect, color , LFRDR_ARROW_RIGHT); }
/* * * * ¨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 }
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); }
/* * draw_propsheet: * * This function draw nonclilent area of propsheet control . * * Author: Peng LIU * Date: 2007-12-03 */ static void draw_propsheet (HWND hwnd, HDC hdc, PCONTROL ctrl, PPROPSHEETDATA propsheet, PPROPPAGE page) { RECT title_rc = {0, 0, 1, 0}, rc; int flag = 0; DWORD main_c, old_brush_c; int scrollbtn_left = 0; title_rc.bottom = propsheet->head_rc.bottom; if ((ctrl->dwStyle & 0xf0L) == PSS_BOTTOM) { title_rc.top = propsheet->head_rc.top; } main_c = GetWindowElementAttr (hwnd, WE_MAINC_THREED_BODY); /* Draw the content window border*/ if ((ctrl->dwStyle & 0xf0L) == PSS_BOTTOM) { SetRect(&rc, 0, 0, propsheet->head_rc.right, ctrl->bottom - ctrl->top - RECTH(propsheet->head_rc) + 1); /* rc.left = 0; rc.right = propsheet->head_rc.right; rc.top = 0; rc.bottom = rc.top + ctrl->bottom - ctrl->top - RECTH(propsheet->head_rc) + 1; */ } else { SetRect(&rc, 0, propsheet->head_rc.bottom - 1, propsheet->head_rc.right, propsheet->head_rc.bottom + ctrl->bottom - ctrl->top - RECTH(propsheet->head_rc)); /* rc.left = 0; rc.top = propsheet->head_rc.bottom - 1; rc.right = propsheet->head_rc.right; rc.bottom = rc.top + ctrl->bottom - ctrl->top - RECTH(propsheet->head_rc) + 1; */ } ((WINDOWINFO*)GetWindowInfo (hwnd))->we_rdr->draw_3dbox(hdc, &rc, main_c, LFRDR_BTN_STATUS_NORMAL); /* Just for PSS_SCROLLABLE style if title is overload (too many titles for the propsheet) we should move-right the leftmot title some pixel and we should draw a small icon (left arrow) for the sheet */ if ((ctrl->dwStyle & 0x0fL) == PSS_SCROLLABLE) { title_rc.right = (propsheet->overload == TRUE) ? title_rc.right + get_metrics (MWM_SB_WIDTH) : title_rc.right; if (propsheet->overload == TRUE) scrollbtn_left = propsheet->head_rc.right - get_metrics (MWM_SB_WIDTH); } old_brush_c = SetBrushColor (hdc, DWORD2PIXEL (hdc, main_c)); while (page) { if (((ctrl->dwStyle & 0x0fL) == PSS_SCROLLABLE) && propsheet->overload == TRUE) if (((title_rc.right + page->width > scrollbtn_left) || (page->width == 0)) && !(propsheet->first_display_page == page)) break; if ((ctrl->dwStyle & 0x0fL) == PSS_COMPACTTAB) { if (((title_rc.right + page->width > propsheet->head_rc.right) || (page->width == 0)) && !(propsheet->first_display_page == page)) break; } /* draw some box for title */ if (title_rc.right == 1) title_rc.left = title_rc.right - 1; else title_rc.left = title_rc.right; title_rc.right = title_rc.left + page->width; flag = 0; if (page == propsheet->active) flag = flag | LFRDR_TAB_ACTIVE; if ((ctrl->dwStyle & 0xf0L) == PSS_BOTTOM) flag = flag | LFRDR_TAB_BOTTOM; if (page->icon) { flag = flag | LFRDR_TAB_ICON; ((WINDOWINFO*)GetWindowInfo (hwnd))->we_rdr->draw_tab (hwnd, hdc, &title_rc, page->title,main_c, flag, page->icon); } else ((WINDOWINFO*)GetWindowInfo (hwnd))->we_rdr->draw_tab (hwnd, hdc, &title_rc, page->title, main_c, flag, 0); page = page->next; } /* draw scroll button , just for PSS_SCROLLABLE style */ if ((ctrl->dwStyle & 0x0fL) == PSS_SCROLLABLE && propsheet->overload == TRUE) draw_scroll_button (hwnd, hdc, &title_rc, propsheet, ctrl->dwStyle); SetBrushColor (hdc, DWORD2PIXEL(hdc, old_brush_c)); }