/********************************************************************* * * _Paint */ static void _Paint(DROPDOWN_Handle hObj) { int Border; GUI_RECT r; const char* s; int InnerSize, ColorIndex; DROPDOWN_Obj* pObj; int TextBorderSize; /* Do some initial calculations */ pObj = DROPDOWN_H2P(hObj); Border = pObj->Widget.pEffect->EffectSize; TextBorderSize = pObj->Props.TextBorderSize; GUI_SetFont(pObj->Props.pFont); ColorIndex = (pObj->Widget.State & WIDGET_STATE_FOCUS) ? 2 : 1; s = _GetpItem(pObj, pObj->Sel); WM_GetClientRect(&r); GUI__ReduceRect(&r, &r, Border); InnerSize = r.y1 - r.y0 + 1; /* Draw the 3D effect (if configured) */ WIDGET__EFFECT_DrawDown(&pObj->Widget); /* Draw the outer text frames */ r.x1 -= InnerSize; /* Spare square area to the right */ LCD_SetColor(pObj->Props.aBackColor[ColorIndex]); /* Draw the text */ LCD_SetBkColor(pObj->Props.aBackColor[ColorIndex]); GUI_FillRectEx(&r); r.x0 += TextBorderSize; r.x1 -= TextBorderSize; LCD_SetColor (pObj->Props.aTextColor[ColorIndex]); GUI_DispStringInRect(s, &r, pObj->Props.Align);/**/ /* Draw arrow */ WM_GetClientRect(&r); GUI__ReduceRect(&r, &r, Border); r.x0 = r.x1 + 1 - InnerSize; LCD_SetColor(0xc0c0c0); GUI_FillRectEx(&r); LCD_SetColor(GUI_BLACK); _DrawTriangleDown((r.x1 + r.x0) / 2, r.y0 + 5, (r.y1 - r.y0 - 8) / 2); WIDGET__EFFECT_DrawUpRect(&pObj->Widget, &r); }
/********************************************************************* * * _Paint */ static void _Paint(SLIDER_Obj* pObj/*, GUI_RECT*pRect*/) { int i; int xsize; int x0; GUI_RECT r, rFocus, rSlider, rSlot; WIDGET__GetClientRect(&pObj->Widget, &rFocus); GUI__ReduceRect(&r, &rFocus, 1); xsize = r.x1 - r.x0 + 1 - pObj->Width /*- 2*xSizeEffect*/; x0 = r.x0 + pObj->Width / 2; GUI_SetBkColor(pObj->aBkColor[0]); GUI_Clear(); /* Calculate Slider position */ rSlider = r; rSlider.y0 = 5; rSlider.x0 = x0 + xsize * (pObj->v - pObj->Min) / (pObj->Max - pObj->Min) - pObj->Width/2; rSlider.x1 = rSlider.x0 + pObj->Width; /* Calculate Slot position */ rSlot.x0 = x0; rSlot.x1 = x0 + xsize; rSlot.y0 = (rSlider.y0 + rSlider.y1) /2 -1; rSlot.y1 = rSlot.y0 +3; WIDGET__EFFECT_DrawDownRect(&pObj->Widget, &rSlot); /* Draw slot */ /* Draw the ticks */ GUI_SetColor(GUI_BLACK); for (i = 0; i <= pObj->NumSections; i++) { int x = x0 + xsize * i / pObj->NumSections; WIDGET__DrawVLine(&pObj->Widget, x, 1, 3); } /* Draw the slider itself */ GUI_SetColor(pObj->aColor[0]); WIDGET__FillRectEx(&pObj->Widget, &rSlider); GUI_SetColor(GUI_BLACK); WIDGET__EFFECT_DrawUpRect(&pObj->Widget, &rSlider); /* Draw focus */ if (pObj->Widget.State & WIDGET_STATE_FOCUS) { GUI_SetColor(GUI_BLACK); WIDGET__DrawFocusRect(&pObj->Widget, &rFocus, 0); } }
/********************************************************************* * * _Paint */ static void _Paint(SLIDER_Obj* pObj, WM_HWIN hObj) { GUI_RECT r, rFocus, rSlider, rSlot; int x0, xsize, i, Range, NumTicks; WIDGET__GetClientRect(&pObj->Widget, &rFocus); GUI__ReduceRect(&r, &rFocus, 1); NumTicks = pObj->NumTicks; xsize = r.x1 - r.x0 + 1 - pObj->Width; x0 = r.x0 + pObj->Width / 2; Range = pObj->Max - pObj->Min; if (Range == 0) { Range = 1; } /* Fill with parents background color */ #if !SLIDER_SUPPORT_TRANSPARENCY /* Not needed any more, since window is transparent*/ if (pObj->Props.BkColor == GUI_INVALID_COLOR) { LCD_SetBkColor(WIDGET__GetBkColor(hObj)); } else { LCD_SetBkColor(pObj->Props.BkColor); } GUI_Clear(); #else if (!WM_GetHasTrans(hObj)) { LCD_SetBkColor(pObj->Props.BkColor); GUI_Clear(); } #endif /* Calculate Slider position */ rSlider = r; rSlider.y0 = 5; rSlider.x0 = x0 + (U32)xsize * (U32)(pObj->v - pObj->Min) / Range - pObj->Width / 2; rSlider.x1 = rSlider.x0 + pObj->Width; /* Calculate Slot position */ rSlot.x0 = x0; rSlot.x1 = x0 + xsize; rSlot.y0 = (rSlider.y0 + rSlider.y1) / 2 - 1; rSlot.y1 = rSlot.y0 + 3; WIDGET__EFFECT_DrawDownRect(&pObj->Widget, &rSlot); /* Draw slot */ /* Draw the ticks */ if (NumTicks < 0) { NumTicks = Range + 1; if (NumTicks > (xsize / 5)) { NumTicks = 11; } } if (NumTicks > 1) { LCD_SetColor(GUI_BLACK); for (i = 0; i < NumTicks; i++) { int x = x0 + xsize * i / (NumTicks - 1); WIDGET__DrawVLine(&pObj->Widget, x, 1, 3); } } /* Draw the slider itself */ LCD_SetColor(pObj->Props.Color); WIDGET__FillRectEx(&pObj->Widget, &rSlider); LCD_SetColor(GUI_BLACK); WIDGET__EFFECT_DrawUpRect(&pObj->Widget, &rSlider); /* Draw focus */ if (pObj->Widget.State & WIDGET_STATE_FOCUS) { LCD_SetColor(pObj->Props.FocusColor); WIDGET__DrawFocusRect(&pObj->Widget, &rFocus, 0); } }
/********************************************************************* * * _Paint */ static void _Paint(SCROLLBAR_Obj* pObj) { int ArrowSize, ArrowOff; SCROLLBAR_POSITIONS Pos; GUI_RECT r, rClient; /* Get / calc position info */ _CalcPositions(pObj, &Pos); WIDGET__GetClientRect(&pObj->Widget, &rClient); r = rClient; ArrowSize = ((r.y1 - r.y0) /3) - 1; ArrowOff = 3 + ArrowSize+ ArrowSize/3; /* Draw left Arrow */ LCD_SetColor(pObj->aColor[0]); r = rClient; r.x0 = Pos.x0_LeftArrow; r.x1 = Pos.x1_LeftArrow; WIDGET__FillRectEx(&pObj->Widget, &r); LCD_SetColor(pObj->aBkColor[1]); _DrawTriangle(&pObj->Widget, r.x0 + ArrowOff, (r.y1 - r.y0) >> 1, ArrowSize, -1); WIDGET__EFFECT_DrawUpRect(&pObj->Widget, &r); /* Draw the thumb area which is not covered by the thumb */ LCD_SetColor(pObj->aBkColor[0]); r.x0 = Pos.x1_LeftArrow + 1; r.x1 = Pos.x0_Thumb - 1; WIDGET__FillRectEx(&pObj->Widget, &r); r = rClient; r.x0 = Pos.x1_Thumb + 1; r.x1 = Pos.x0_RightArrow - 1; WIDGET__FillRectEx(&pObj->Widget, &r); /* Draw Thumb */ r = rClient; r.x0 = Pos.x0_Thumb; r.x1 = Pos.x1_Thumb; LCD_SetColor(pObj->aColor[0]); WIDGET__FillRectEx(&pObj->Widget, &r); WIDGET__EFFECT_DrawUpRect(&pObj->Widget, &r); /* Draw right Arrow */ LCD_SetColor(pObj->aColor[0]); r.x0 = Pos.x0_RightArrow; r.x1 = Pos.x1_RightArrow; WIDGET__FillRectEx(&pObj->Widget, &r); LCD_SetColor(pObj->aBkColor[1]); _DrawTriangle(&pObj->Widget, r.x1 - ArrowOff, (r.y1 - r.y0) >> 1, ArrowSize, 1); WIDGET__EFFECT_DrawUpRect(&pObj->Widget, &r); /* Draw overlap area (if any ...) */ if (Pos.x1_RightArrow != Pos.x1) { r.x0 = Pos.x1_RightArrow + 1; r.x1 = Pos.x1; LCD_SetColor(pObj->aColor[0]); WIDGET__FillRectEx(&pObj->Widget, &r); } }