Exemple #1
0
EDIT_Handle EDIT_CreateAsChild     (int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int Id, int Flags, int MaxLen) {
    EDIT_Handle hObj;
    if (MaxLen == 0) {
        MaxLen = 8;
    }
    /* Alloc memory for obj */
    WM_LOCK();
    hObj = WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent,
                                  WM_CF_SHOW | Flags, EDIT__Callback,
                                  sizeof(EDIT_Obj)-sizeof(WM_Obj));
    if (hObj) {
        EDIT_Obj* pObj = (EDIT_Obj*)WM_HMEM2Ptr(hObj);
        /* init widget specific variables */
        WIDGET__Init(&pObj->Widget, WIDGET_STATE_FOCUSSABLE  | WIDGET_STATE_ENABLED);
        pObj->Widget.Id     = Id;
        /* init member variables */
        INIT_ID(pObj);
        pObj->pFont         = _pDefaultFont;
        pObj->aBkColor[0]   = EDIT_BKCOLOR0_DEFAULT;
        pObj->aBkColor[1]   = EDIT_BKCOLOR1_DEFAULT;
        pObj->aTextColor[0] = EDIT_TEXTCOLOR0_DEFAULT;
        pObj->aTextColor[1] = EDIT_TEXTCOLOR1_DEFAULT;
        pObj->Align         = _DefaultAlign;
        pObj->Border        = _DefaultBorder;
        pObj->XSizeCursor   = 1;
        pObj->MaxLen        = MaxLen;
        if ((pObj->hpText = WM_ALLOC(MaxLen+1)) ==0) {
            GUI_DEBUG_ERROROUT("EDIT_Create failed to alloc buffer");
            EDIT_Delete(hObj);
            hObj =0;
        }
    }
    WM_UNLOCK();
    return hObj;
}
static void _UpdateBuffer(EDIT_Obj* pObj) {
  char * s = (char*) WM_HMEM2Ptr(pObj->hpText);
  if (pObj->Flags == GUI_EDIT_SIGNED) {
    I32 Result = GUI_AddSign(pObj->CurrentValue, &s);
    GUI_AddDecShift(Result, pObj->MaxLen - 1, pObj->NumDecs, &s);
  } else {
    GUI_AddDecShift(pObj->CurrentValue, pObj->MaxLen, pObj->NumDecs, &s);
  }
}
Exemple #3
0
 PROGBAR_Obj* PROGBAR_h2p(PROGBAR_Handle h) {
   PROGBAR_Obj* p = (PROGBAR_Obj*)WM_HMEM2Ptr(h);
   if (p) {
     if (p->DebugId != OBJECT_ID) {
       GUI_DEBUG_ERROROUT("PROGBAR.C: Wrong handle type or Object not init'ed");
       return 0;
     }
   }
   return p;
 }
Exemple #4
0
EDIT_Obj* EDIT_h2p(EDIT_Handle h) {
    EDIT_Obj* p = (EDIT_Obj*)WM_HMEM2Ptr(h);
    if (p) {
        if (p->DebugId != OBJECT_ID) {
            GUI_DEBUG_ERROROUT("EDIT.C: Wrong handle type or Object not init'ed");
            return 0;
        }
    }
    return p;
}
Exemple #5
0
/*********************************************************************
*
*       _Paint
*/
static void _Paint(PROGBAR_Handle hObj) {
  PROGBAR_Obj* pObj = PROGBAR_H2P(hObj);
  WM_HWIN hWin = hObj;
  int xsize = WM_GetWindowSizeX(hWin);
  int ysize = WM_GetWindowSizeY(hWin);
  int tm;
  GUI_SetFont(pObj->pFont);
  {
    int x1;
    int FontSizeY = GUI_GetFontSizeY();
    int xText = 0;
    int yText = (ysize-FontSizeY)/2;
    GUI_RECT r;
    int XSizeChar;
    char ac[5];   /* Just enough for the percentage */
    char*s = ac;
    const char* pText;
    if (pObj->hpText != WM_HMEM_NULL) {
      pText = (const char*) WM_HMEM2Ptr(pObj->hpText);
    } else {
      GUI_AddDecMin((100*(I32)(pObj->v-pObj->Min))/(pObj->Max-pObj->Min), &s);
      *s = '%';
			*(s+1) =0;
			pText = &ac[0];
		}
/* Calculate text positions */
    XSizeChar = GUI_GetStringDistX(pText);
    x1 = _Value2X(hObj, pObj->v);
    switch (pObj->TextAlign &GUI_TA_HORIZONTAL) {
    case GUI_TA_CENTER:
      xText  = (xsize-XSizeChar)/2;
			break;
    case GUI_TA_LEFT:
      xText  = 0;
			break;
    case GUI_TA_RIGHT:
      xText  = xsize-XSizeChar-1;
			break;
		}
    xText += pObj->XOff;
    yText += pObj->YOff;
    tm = GUI_SetTextMode(GUI_TM_TRANS);
/* Draw left bar */
    r.x0=0; r.x1=x1-1; r.y0=0; r.y1 = GUI_YMAX;
    WM_SetUserClipArea(&r);
    _DrawPart(pObj, 0, xText, yText, pText);
/* Draw right bar */
    r.x0=r.x1+1; r.x1=GUI_XMAX;
    WM_SetUserClipArea(&r);
    _DrawPart(pObj, 1, xText, yText, pText);
  }
  WM_SetUserClipArea(NULL);
  GUI_SetTextMode(tm);
}
Exemple #6
0
void TERMINAL_GetText(TERMINAL_Handle hObj, char* sDest, int MaxLen) {
  TERMINAL_Obj* pObj = TERMINAL_H2P(hObj);
  if (pObj) {
    char * sSource = (char*) WM_HMEM2Ptr(pObj->hpText);
    int Len = strlen(sSource);
    if (Len > (MaxLen - 1))
      Len = MaxLen - 1;
    memcpy((void *)sDest, (const void *)sSource, Len);
    *(sDest+Len) = 0;
  }
}
Exemple #7
0
void PROGBAR_SetText(PROGBAR_Handle hObj, const char* s) {
  PROGBAR_Obj* pObj;
  WM_HMEM hMem;
  if (hObj) {
    WM_LOCK();
    pObj = PROGBAR_H2P(hObj);
    _FreeText(hObj);
    hMem = WM_ALLOC((int)strlen(s)+1);
    strcpy((char *) WM_HMEM2Ptr(hMem), s);
    pObj->hpText = hMem;
    Invalidate(hObj);
    WM_UNLOCK();
  }
}
Exemple #8
0
void EDIT_GetText(EDIT_Handle hObj, char* sDest, int MaxLen) {
    EDIT_Obj* pObj;
    if (hObj == 0)
        return;
    WM_LOCK();
    pObj = EDIT_H2P(hObj);
    if (pObj) {
        char * sSource = (char*) WM_HMEM2Ptr(pObj->hpText);
        int Len = (int)strlen(sSource);
        if (Len > (MaxLen - 1))
            Len = MaxLen - 1;
        memcpy((void *)sDest, (const void *)sSource, Len);
        *(sDest+Len) = 0;
    }
    WM_UNLOCK();
}
Exemple #9
0
static void Paint(TERMINAL_Obj* pObj/*, GUI_RECT*pRect*/) {
  char*s = (char*) WM_HMEM2Ptr(pObj->hpText);
  GUI_RECT rClient;
  GUI_DEBUG_LOG("TERMINAL: Paint(..)\n");
  GUI_GetClientRect(&rClient);
/* Draw background */
  GUI_SetBkColor (GUI_WHITE/*pObj->aBkColor[0]*/);
  GUI_SetColor   (GUI_BLACK /*pObj->aTextColor[0]*/);
  GUI_Clear();
/* Draw the text */  
  {
    GUI_RECT rText = rClient;
    rText.x0 +=3;
//    GUI_SetFont    (pObj->pFont);
    GUI_DispStringInRect(s, &rText, GUI_TA_LEFT);
  }
}
Exemple #10
0
void BUTTON_SetText(BUTTON_Handle hObj, const char* s) {
  WM_LOCK();
  if (hObj) {
    BUTTON_Obj* pObj = BUTTON_H2P(hObj);
    BUTTON_ASSERT_IS_VALID_PTR(pObj);
    WM_FREEPTR(&pObj->hpText);
    {
      WM_HMEM hMem = WM_ALLOC(strlen(s)+1);
      if (hMem) {
        strcpy((char *) WM_HMEM2Ptr(hMem), s);
      }
      pObj->hpText = hMem;
    }
    BUTTON_Invalidate(hObj);
  } else {
    GUI_DEBUG_WARN("BUTTON_SetText: Invalid handle");
  }
  WM_UNLOCK();
}
Exemple #11
0
void EDIT_SetText     (EDIT_Handle hObj, const char* sNew) {
    EDIT_Obj* pObj;
    if (hObj == 0)
        return;
    WM_LOCK();
    pObj = EDIT_H2P(hObj);
    if (pObj) {
        char*sDest = (char*) WM_HMEM2Ptr(pObj->hpText);
        int Len = sNew ? (int)strlen(sNew) : 0;
        if (Len > pObj->MaxLen)
            Len = pObj->MaxLen;
        memcpy(sDest, sNew, Len);
        *(sDest+Len) = 0;
        pObj->CursorPos = Len;
        if (pObj->CursorPos == pObj->MaxLen)
            pObj->CursorPos--;
        EDIT_Invalidate(hObj);
    }
    WM_UNLOCK();
}
Exemple #12
0
PROGBAR_Handle PROGBAR_CreateEx(int x0, int y0, int xsize, int ysize, WM_HWIN hParent, int Id, int Flags) {
  /* Create the window */
  PROGBAR_Handle hObj =WM_CreateWindowAsChild(x0, y0, xsize, ysize, hParent, 
                                              Flags, _Callback, sizeof(PROGBAR_Obj) - sizeof(WM_Obj));
  if (hObj) {
    PROGBAR_Obj* pObj = (PROGBAR_Obj*) WM_HMEM2Ptr(hObj);
    INIT_ID(pObj);
    pObj->Widget.Id       = Id;
    /* init member variables */
    pObj->pFont =GUI_DEFAULT_FONT;
    pObj->BarColor[0] = 0x555555;
    pObj->BarColor[1] = 0xaaaaaa;
    pObj->TextColor[0] = 0xffffff;
    pObj->TextColor[1] = 0x000000;
    pObj->TextAlign    = GUI_TA_CENTER;
    pObj->Max =100;
    pObj->Min =0;
  }
  return hObj;
}
static void _EditDec(int Digit, EDIT_Obj* pObj, EDIT_Handle hObj) {
  I32 Result = 0;
  int i, Pos = 0;
  char * s = (char*) WM_HMEM2Ptr(pObj->hpText);
  for (i = 0; i < pObj->MaxLen; i++) {
    int Index = pObj->MaxLen - i - 1;
    if (Index == pObj->CursorPos) {
      Result += GUI_Pow10[Pos++] * Digit;
    } else {
      char c = *(s + Index);
      int Value = _DecChar2Int(c);
      if (Value >= 0) {
        Result += GUI_Pow10[Pos++] * Value;
      }
      if (c == '-') {
        Result *= -1;
      }
    }
  }
  EDIT_SetValue(hObj, Result);
}
Exemple #14
0
/*********************************************************************
*
*       Callback
*/
static void EDIT__Callback (WM_MESSAGE * pMsg) {
    int IsEnabled;
    EDIT_Handle hObj = (EDIT_Handle)pMsg->hWin;
    EDIT_Obj* pObj = (EDIT_Obj*)WM_HMEM2Ptr(hObj);
    IsEnabled = WIDGET__IsEnabled(&pObj->Widget);
    /* Let widget handle the standard messages */
    if (WIDGET_HandleActive(hObj, pMsg) == 0) {
        return;
    }
    switch (pMsg->MsgId) {
    case WM_TOUCH:
        if (IsEnabled) {
            _OnTouch(hObj, pObj, pMsg);
        }
        break;
    case WM_PAINT:
        GUI_DEBUG_LOG("EDIT: _Callback(WM_PAINT)\n");
        _Paint(pObj);
        return;
    case WM_DELETE:
        GUI_DEBUG_LOG("EDIT: _Callback(WM_DELETE)\n");
        _Delete(pObj);
        break;       /* No return here ... WM_DefaultProc needs to be called */
    case WM_KEY:
        if (IsEnabled) {
            if ( ((WM_KEY_INFO*)(pMsg->Data.p))->PressedCnt >0) {
                int Key = ((WM_KEY_INFO*)(pMsg->Data.p))->Key;
                switch (Key) {
                case GUI_KEY_TAB:
                    break;                    /* Send to parent by not doing anything */
                default:
                    EDIT_AddKey(hObj, Key);
                    return;
                }
            }
        }
        break;
    }
    WM_DefaultProc(pMsg);
}
Exemple #15
0
/*********************************************************************
*
*       _SetCursor
*/
static void _SetCursor(EDIT_Handle hObj, EDIT_Obj* pObj, int x) {
    int xPos, xSize, PixelLen, Len;
    char * s = (char*) WM_HMEM2Ptr(pObj->hpText);
    const GUI_FONT *pOldFont = GUI_SetFont(pObj->pFont);
    xSize = WM_GetWindowSizeX(hObj);
    PixelLen = GUI_GetStringDistX(s);
    xPos = x;
    switch (pObj->Align & GUI_TA_HORIZONTAL) {
    case GUI_TA_CENTER:
        xPos -= (xSize - PixelLen + 1) / 2;
        break;
    case GUI_TA_LEFT:
        xPos -= (pObj->Border + EDIT_XOFF);
        break;
    case GUI_TA_RIGHT:
        xPos -= xSize - PixelLen - (pObj->Border + EDIT_XOFF);
        break;
    }
    Len = (int)strlen(s);
    if (xPos < 0) {
        pObj->CursorPos = 0;
    } else if (xPos > PixelLen) {
        pObj->CursorPos = Len;
    } else {
        int i, x;
        for (i = 0, x = 0; (i < Len) && (x < xPos); i++) {
            int xLenChar = GUI_GetCharDistX(*(s + i));
            if (xPos < (x + xLenChar))
                break;
            x += xLenChar;
        }
        pObj->CursorPos = i;
        EDIT_Invalidate(hObj);
    }
    GUI_SetFont(pOldFont);
}
Exemple #16
0
void TERMINAL_Add(TERMINAL_Handle hObj, const char* sAdd) {
  if (!sAdd) {
    GUI_DEBUG_WARN("TERMINAL_Add: NULL pointer passed");
    return;
  }
  if (hObj) {
    TERMINAL_Obj* pObj = TERMINAL_H2P(hObj);
    char* sBuffer = (char*) WM_HMEM2Ptr(pObj->hpText);
    int AddLen = strlen(sAdd);
    int NewLen = AddLen+strlen(sBuffer);
    if (AddLen > pObj->MaxLen) {
      GUI_DEBUG_WARN("TERMINAL_Add: String longer than buffer !");
      return;
    }
    /* Make space in buffer if necessary */
    if (NewLen > pObj->MaxLen) {
      *sBuffer =0;
    }
    sBuffer+= strlen(sBuffer); 
    memcpy(sBuffer, sAdd, AddLen);
    *(sBuffer+AddLen) = 0;
    Invalidate(hObj);
  }
}
Exemple #17
0
/*********************************************************************
*
*       _Paint
*/
static void _Paint(BUTTON_Obj* pObj) {
  const char*s =NULL;
  int State = pObj->Widget.State;
  int PressedState = (State & BUTTON_STATE_PRESSED) ? 1:0;
  GUI_RECT rClient;
  GUI_RECT r;
  GUI_SetFont(pObj->pFont);
  GUI_DEBUG_LOG("BUTTON: Paint(..)\n");
  if (pObj->hpText) {
    s = (const char*) WM_HMEM2Ptr(pObj->hpText);
  }
  GUI_GetClientRect(&rClient);
  r = rClient;
/* Draw background */
  GUI_SetBkColor (pObj->aBkColor[PressedState]);
  GUI_SetColor   (pObj->aTextColor[PressedState]);
  GUI_Clear();
/* Draw bitmap.
   If we have only one, we will use it.
   If we have to we will use the second one (Index 1) for the pressed state
*/
  {
    int Index =0;
    if (pObj->apBitmap[1] && PressedState) {
      Index =1;   
    }
    if (pObj->apBitmap[Index]) {
      #if BUTTON_SUPPORT_STREAMED_BITMAP
        if(pObj->aBitmapIsStreamed[Index]) {
        #if BUTTON_SUPPORT_BITMAP_OFFSET
          GUI_DrawStreamedBitmap((const GUI_BITMAP_STREAM*)(pObj->apBitmap[Index]), pObj->xOffBitmap, pObj->yOffBitmap);
        #else
          GUI_DrawBitmapStreamed((const GUI_BITMAP_STREAM*)(pObj->apBitmap[Index]), 0,0);
        #endif
        } else
      #endif
      {
        #if BUTTON_SUPPORT_BITMAP_OFFSET
          GUI_DrawBitmap(pObj->apBitmap[Index], pObj->xOffBitmap[Index], pObj->yOffBitmap[Index]);
        #else
          GUI_DrawBitmap(pObj->apBitmap[Index], 0,0);
        #endif
      }
    }
  }
/* Draw the actual button (background and text) */  
  #if BUTTON_USE_3D
    if (pObj->Widget.State & BUTTON_STATE_PRESSED) {
      GUI_MoveRect(&r, BUTTON_3D_MOVE_X,BUTTON_3D_MOVE_Y);
    }
  #endif
  GUI_SetTextMode(GUI_TM_TRANS);
  GUI_DispStringInRect(s, &r, GUI_TA_HCENTER | GUI_TA_VCENTER);
/* Draw the 3D effect (if configured) */
  #if BUTTON_USE_3D
  if ((State & BUTTON_STATE_PRESSED) == 0) {
    WIDGET_EFFECT_3D_DrawUp();
  } else {
    GUI_SetColor(0x000000);  /// TBD: Use halftone
    GUI_DrawRect(rClient.y0, rClient.x0, rClient.x1, rClient.y1);
  }
  #endif
  /* Draw focus */
  if (State & BUTTON_STATE_FOCUS) {
    GUI_SetColor(GUI_BLACK);
    GUI_DrawFocusRect(&rClient, 2);
  }
}
Exemple #18
0
static void _UpdateBuffer(EDIT_Obj* pObj) {
  char * s = (char*) WM_HMEM2Ptr(pObj->hpText);
  GUI_AddBin(pObj->CurrentValue, pObj->MaxLen, &s);
}
Exemple #19
0
void EDIT_AddKey(EDIT_Handle hObj, int Key) {
    EDIT_Obj* pObj;
    if (hObj == 0)
        return;
    WM_LOCK();
    pObj = EDIT_H2P(hObj);
    if (pObj) {
        if (pObj->pfAddKeyEx) {
            pObj->pfAddKeyEx(pObj, hObj, Key);
        } else {
            char*s = (char*) WM_HMEM2Ptr(pObj->hpText);
            int len = (int)strlen(s);
            switch (Key) {
            case GUI_KEY_UP:
            {
                char c = *(s + pObj->CursorPos);
                if (c < 0x7f) {
                    *(s + pObj->CursorPos) = c + 1;
                    WM_NotifyParent(hObj, WM_NOTIFICATION_VALUE_CHANGED);
                }
            }
            break;
            case GUI_KEY_DOWN:
            {
                char c = *(s + pObj->CursorPos);
                if (c > 0x20) {
                    *(s + pObj->CursorPos) = c - 1;
                    WM_NotifyParent(hObj, WM_NOTIFICATION_VALUE_CHANGED);
                }
            }
            break;
            case GUI_KEY_RIGHT:
                if (pObj->CursorPos < (pObj->MaxLen - 1))
                    if (pObj->CursorPos < len)
                        pObj->CursorPos++;
                break;
            case GUI_KEY_LEFT:
                if (pObj->CursorPos > 0)
                    pObj->CursorPos--;
                break;
            case GUI_KEY_BACKSPACE:
                if ((len > 0) && (pObj->CursorPos > 0)) {
                    int CopyLength = pObj->MaxLen - pObj->CursorPos;
                    strncpy(s + pObj->CursorPos - 1, s + pObj->CursorPos, CopyLength);
                    *(s + len - 1) = 0;
                    WM_NotifyParent(hObj, WM_NOTIFICATION_VALUE_CHANGED);
                    pObj->CursorPos--;
                }
                break;
            case GUI_KEY_DELETE:
                if ((len > 0) && (pObj->CursorPos < len)) {
                    if (len > 1) {
                        int CopyLength = pObj->MaxLen - pObj->CursorPos - 1;
                        strncpy(s + pObj->CursorPos, s + pObj->CursorPos + 1, CopyLength);
                    }
                    *(s + len - 1) = 0;
                    WM_NotifyParent(hObj, WM_NOTIFICATION_VALUE_CHANGED);
                }
                break;
            case GUI_KEY_INSERT:
                if (pObj->EditMode == GUI_EDIT_MODE_OVERWRITE)
                    pObj->EditMode = GUI_EDIT_MODE_INSERT;
                else
                    pObj->EditMode = GUI_EDIT_MODE_OVERWRITE;
                break;
            case GUI_KEY_ENTER:
            case GUI_KEY_ESCAPE:
                break;
            default:
                if ((Key >= 0x20) && (Key <= 0x7f)) {
                    if (pObj->EditMode == GUI_EDIT_MODE_INSERT) {
                        if (len < pObj->MaxLen) {
                            int CopyLength = pObj->MaxLen - pObj->CursorPos - 1;
                            memmove(s + pObj->CursorPos + 1, s + pObj->CursorPos, CopyLength);
                            *(s + pObj->CursorPos) = Key;
                            WM_NotifyParent(hObj, WM_NOTIFICATION_VALUE_CHANGED);
                            if (pObj->CursorPos < (pObj->MaxLen - 1))
                                pObj->CursorPos++;
                        }
                    } else {
                        *(s + pObj->CursorPos) = Key;
                        WM_NotifyParent(hObj, WM_NOTIFICATION_VALUE_CHANGED);
                        if (pObj->CursorPos < (pObj->MaxLen - 1))
                            pObj->CursorPos++;
                    }
                }
                break;
            }
        }
        EDIT_Invalidate(hObj);
    }
    WM_UNLOCK();
}
Exemple #20
0
/*********************************************************************
*
*       _Paint
*/
static void _Paint(EDIT_Obj* pObj) {
    int PixelLen, xSize, ySize, xPosText = 0,
                                xPosCursor = 0, yPosText = 0, yPosCursor = 0, XSizeCursor, YSizeCursor;
    int IsEnabled;
    GUI_RECT rClient, rWindow;
    char * s;
    s = (char*) WM_HMEM2Ptr(pObj->hpText);
    GUI_DEBUG_LOG("BUTTON: _Paint(..)\n");
    if (pObj->Border) {
        GUI_SetBkColor(pObj->aBkColor[0]);
        GUI_Clear();
    }
    IsEnabled = WIDGET__IsEnabled(&pObj->Widget);
    /* Set clipping rectangle */
    WIDGET__GetInsideRect(&pObj->Widget, &rWindow);
    WM_SetUserClipRect(&rWindow);
    /* Calculate size */
    GUI_GetClientRect(&rClient);
    xSize = rClient.x1 - rClient.x0 + 1;
    ySize = rClient.y1 - rClient.y0 + 1;
    /* Draw background */
    GUI_SetBkColor (pObj->aBkColor[IsEnabled]);
    GUI_SetColor   (pObj->aTextColor[0]);
    GUI_Clear();
    /* Calculate length */
    GUI_SetFont    (pObj->pFont);
    PixelLen = GUI_GetStringDistX(s);
    /* Calculate size of cursor */
    YSizeCursor = GUI_GetFontDistY();
    if (pObj->EditMode == GUI_EDIT_MODE_INSERT) {
        if (pObj->XSizeCursor != 0) {
            XSizeCursor = pObj->XSizeCursor;
        } else {
            XSizeCursor = GUI_GetCharDistX(' ');
        }
    } else {
        if (pObj->CursorPos < (int)strlen(s))  {
            XSizeCursor = GUI_GetCharDistX(*(s + pObj->CursorPos));
        } else {
            XSizeCursor = pObj->XSizeCursor;
        }
    }
    /* Calculate X-pos */
    switch (pObj->Align & GUI_TA_HORIZONTAL) {
    case GUI_TA_CENTER:
        xPosCursor = (xSize - PixelLen + 1) / 2;
        xPosText = xSize / 2;
        break;
    case GUI_TA_LEFT:
        xPosCursor = pObj->Border + EDIT_XOFF;
        xPosText   = pObj->Border + EDIT_XOFF;
        break;
    case GUI_TA_RIGHT:
        xPosCursor = xSize - (pObj->Border + EDIT_XOFF) - PixelLen;
        xPosText   = xSize - (pObj->Border + EDIT_XOFF);
        break;
    }
    /* Calculate Y-pos */
    switch (pObj->Align & GUI_TA_VERTICAL) {
    case GUI_TA_TOP:
        yPosCursor = 0;
        yPosText = 0;
        break;
    case GUI_TA_BOTTOM:
        yPosCursor = ySize - YSizeCursor;
        yPosText = ySize;
        break;
    case GUI_TA_VCENTER:
        yPosCursor = (ySize - YSizeCursor + 1) / 2;
        yPosText = ySize / 2;
        break;
    }
    /* Display text */
    GUI_SetTextAlign(pObj->Align);
    GUI_DispStringAt(s, xPosText, yPosText);
    /* Display cursor */
    if (pObj->Widget.State & WIDGET_STATE_FOCUS) {
        int i;
        for (i = 0; i != pObj->CursorPos; i++) {
            xPosCursor += GUI_GetCharDistX(*(s + i));
        }
        GUI_InvertRect(xPosCursor,
                       yPosCursor,
                       xPosCursor + XSizeCursor - 1,
                       yPosCursor + YSizeCursor - 1);
    }
    WM_SetUserClipRect(NULL);
    /* Draw the 3D effect (if configured) */
    WIDGET__EFFECT_DrawDown(&pObj->Widget);
}
static char _GetCurrentChar(EDIT_Obj* pObj) {
  return *((char*) WM_HMEM2Ptr(pObj->hpText) + pObj->CursorPos);
}