Exemple #1
0
void D4D_MenuScrollBarsFeedBack(D4D_OBJECT* pThis, D4D_INDEX old_position, D4D_INDEX new_position)
{
  D4D_MENU* pMenu = D4D_GET_MENU(D4D_GetParentObject(pThis));

  D4D_UNUSED(old_position);
  pMenu->pData->page_ix = (D4D_MENU_INDEX)new_position;

  D4D_InvalidateObject(D4D_GetParentObject(pThis), D4D_FALSE);
}
Exemple #2
0
void D4D_CnslScrollBarsFeedBack(D4D_OBJECT* pThis, D4D_INDEX old_position, D4D_INDEX new_position)
{
    D4D_UNUSED(old_position);
    D4D_UNUSED(new_position);

    D4D_InvalidateObject(D4D_GetParentObject(pThis), D4D_FALSE);

    D4D_GET_CONSOLE_DATA(D4D_GetParentObject(pThis))->flags |= (D4D_CNSL_FLAGS_REDRAWALL);
}
Exemple #3
0
void D4D_TextBoxScrollBarsFeedBack(D4D_OBJECT* pThis, D4D_INDEX old_position, D4D_INDEX new_position)
{
  D4D_TXTBX_DATA* pData = D4D_GET_TEXTBOX_DATA(D4D_GetParentObject(pThis));

  D4D_UNUSED(old_position);

  // compute the start char of current screen
  pData->firstShowedCharIx = D4D_TextBoxFindLineStartChar(D4D_GetParentObject(pThis), new_position);

  // set flag to redraw screen
  D4D_InvalidateObject(D4D_GetParentObject(pThis), D4D_FALSE);
  pData->redrawText = D4D_TRUE;
}
Exemple #4
0
void D4D_ComboBoxListFeedBack(D4D_OBJECT* pThis, D4D_EVENTID eventId)
{
  D4D_OBJECT* pParent = D4D_GetParentObject(pThis);

  if(eventId == D4D_EVENT_ONCLICK)
  {
    D4D_OBJECT* pListBoxObject = D4D_GET_COMBO_BOX_LIST_BOX(pParent);
    D4D_OBJECT* pEditBoxObject = D4D_GET_COMBO_BOX_EDIT_BOX(pParent);

    D4D_GET_COMBO_BOX_DATA(pParent)->real_ix = D4D_ListBoxGetIndex(pListBoxObject);

    if(D4D_GET_COMBO_BOX(pParent)->OnEvent)
      D4D_GET_COMBO_BOX(pParent)->OnEvent(pParent, D4D_EVENT_ONCLICK);

    D4D_EditBoxClearAll(pEditBoxObject);
    D4D_EditBoxPutString(pEditBoxObject, D4D_ListBoxGetItemText(pListBoxObject));

    D4D_ShowObject(pListBoxObject, D4D_FALSE);
    D4D_InvalidateScreen(pParent->pData->pScreen, D4D_TRUE);
  }

  if(eventId == D4D_EVENT_ONCHANGE)
  {
    //D4D_InvalidateObject(pParent, D4D_FALSE);

    if(D4D_GET_COMBO_BOX(pParent)->OnEvent)
      D4D_GET_COMBO_BOX(pParent)->OnEvent(pParent, D4D_EVENT_ONCHANGE);
  }
}
Exemple #5
0
/**************************************************************************/ /*!
* @brief   Function control visibility of object on screen.
* @param   pObject - pointer to the object.
* @param   bShow - <D4D_TRUE - visible, D4D_FALSE - hidden>
* @return  none.
* @note    This function control the visibility of object on screen. The hide action
*          force invalidate of whole screen.
*******************************************************************************/
void D4D_ShowObject(D4D_OBJECT_PTR pObject, D4D_BOOL bShow)
{
    if(bShow)
    {
        pObject->pData->flags |= D4D_OBJECT_F_VISIBLE;
        D4D_InvalidateObject(pObject, D4D_FALSE);
    }
    else
    {
        pObject->pData->flags &= ~D4D_OBJECT_F_VISIBLE;

        if(d4d_pKeysCapturer == pObject)
            D4D_CaptureKeys(NULL);


        if((D4D_OBJECT*)pObject == D4D_GetFocusedObject(pObject->pData->pScreen))
            D4D_FocusNextObject(pObject->pData->pScreen, D4D_FALSE);

        if(pObject->pRelations)
        {
            D4D_OBJECT* pParent = D4D_GetParentObject((D4D_OBJECT*)pObject);

            if(pParent)
                D4D_InvalidateObject(pParent, D4D_TRUE);
            else
                D4D_InvalidateScreen(pObject->pData->pScreen, D4D_TRUE);

        } else
            D4D_InvalidateScreen(pObject->pData->pScreen, D4D_TRUE);
    }
}
Exemple #6
0
/**************************************************************//*!
*
* Function returns the next object (looking for any object in object tree)
*
******************************************************************/
D4D_OBJECT* D4D_FindNextObject(D4D_OBJECT* pObject, D4D_BOOL childrenAlso)
{
    D4D_OBJECT* pLocObject;


    // Compatible mode - just only screen top level objects
    if(pObject->pRelations == NULL)
        return D4D_FindNextObjectOnScreen(pObject);

    if(childrenAlso)
        if(pObject->pRelations[D4D_OBJECT_USR_DATA_CHILD_IX])    // Does I have childrens?
            return (D4D_OBJECT*)pObject->pRelations[D4D_OBJECT_USR_DATA_CHILD_IX];

    // Does I have siblings?
    pLocObject = D4D_FindNextSiblingObject(pObject);
    if(pLocObject)
        return pLocObject;

    // So my parent has to have siblings
    do
    {
        pLocObject = D4D_FindNextParentSiblingObject(pObject);
        if(pLocObject)
            return pLocObject;

        pObject = D4D_GetParentObject(pObject);

    } while(1);
}
Exemple #7
0
/**************************************************************************/ /*!
* @brief   Function find out if the object (including compounded objects) is focused
* @param   pObject - pointer to the object
* @return  <D4D_TRUE - object has focus, D4D_FALSE - object hasn't focus>.
* @note    This function gets the focused object and check if it belong this object or any other
*               object in compounded set.
*******************************************************************************/
D4D_BOOL D4D_IsMineFocus(D4D_OBJECT* pObject)
{
    D4D_OBJECT * pFocused;

    if(pObject == NULL)
        return D4D_FALSE;

    if((D4D_SCREEN*)(pObject->pData->pScreen) != D4D_GetActiveScreen())
        return D4D_FALSE;

    pFocused = (D4D_OBJECT*)D4D_GetFocusedObject((D4D_SCREEN*)(pObject->pData->pScreen));

    if(pFocused == pObject)
        return D4D_TRUE;

    if((pObject->pRelations) && (pFocused->pRelations))
    {
        // Lok for all parents - step by step
        while((pFocused = D4D_GetParentObject(pFocused)))
        {
            if(pObject == pFocused)
                return D4D_TRUE;
        }
    }

    return D4D_FALSE;
}
Exemple #8
0
/*******************************************************
*
* COMBO_BOX Child Object CallBack function from list box
*
*******************************************************/
Byte D4D_ComboBoxListBoxMsgFeedBack(D4D_MESSAGE* pMsg)
{
  D4D_OBJECT *pParent = D4D_GetParentObject(pMsg->pObject);
  if((((pMsg->nMsgId == D4D_MSG_KILLFOCUS) || (pMsg->nMsgId == D4D_MSG_MOUSE_LEAVE)) && !D4D_IsMineFocus(pParent)))
  {
    D4D_ComboBoxStornoSelection(pParent);
  }

  return D4D_MSG_NOSKIP;
}
Exemple #9
0
/**************************************************************//*!
*
* Function returns the previous parent sibling object
*
******************************************************************/
D4D_OBJECT* D4D_FindPreviousParentSiblingObject(D4D_OBJECT* pObject)
{
    D4D_OBJECT* pParent;
// D4D_OBJECT* pSibling;

    pParent = D4D_GetParentObject(pObject);

    if(!pParent)
        return  D4D_FindPreviousObjectOnScreen(pObject);

    // return pointer on parent sibling object or null if there is no parent previous sibling
    return D4D_FindPreviousSiblingObject(pParent);
}
Exemple #10
0
/**************************************************************************/ /*!
* @brief   Function find out if the object is visible or not
* @param   pObject - pointer to the object
* @return  <D4D_TRUE - object is visible, D4D_FALSE - object is invisible>.
* @note    This function gets the current status of object visible / invisible. The function control the
*               object itself and also all parents objects..
*******************************************************************************/
D4D_BOOL D4D_IsVisible(D4D_OBJECT* pObject)
{
    if(!(pObject->pData->flags & D4D_OBJECT_F_VISIBLE))
        return D4D_FALSE;

    if(pObject->pRelations)
    {
        D4D_OBJECT* pParent = D4D_GetParentObject(pObject);
        if(pParent)
            return D4D_IsVisible(pParent);
    }

    return D4D_TRUE;
}
Exemple #11
0
/**************************************************************************/ /*!
* @brief   Function find out if the object is enabled or not
* @param   pObject - pointer to the object
* @return  <D4D_TRUE - object is enabled, D4D_FALSE - object is disabled>.
* @note    This function gets the current status of object enabled / disabled. The function control the
*               object itself and also all parents objects..
*******************************************************************************/
D4D_BOOL D4D_IsEnabled(D4D_OBJECT* pObject)
{
    if(!(pObject->pData->flags & D4D_OBJECT_F_ENABLED))
        return D4D_FALSE;

    if(pObject->pRelations)
    {
        D4D_OBJECT* pParent = D4D_GetParentObject(pObject);
        if(pParent)
            return D4D_IsEnabled(pParent);
    }

    return D4D_TRUE;
}
Exemple #12
0
void D4D_ComboBoxButtonFeedBack(D4D_OBJECT* pThis)
{
  D4D_OBJECT* pParent = D4D_GetParentObject(pThis);
  D4D_OBJECT* pListBoxObject = D4D_GET_COMBO_BOX_LIST_BOX(pParent);

  if(D4D_IsVisible(pListBoxObject))
  {
    D4D_ComboBoxStornoSelection(pParent);
  }else
  {
    D4D_ShowObject(pListBoxObject, D4D_TRUE);
    D4D_CaptureKeys(pListBoxObject);
    D4D_InvalidateObject(pParent, D4D_TRUE);
  }
}
Exemple #13
0
/**************************************************************//*!
*
* Function returns the next object (looking for any object in object tree)
*
******************************************************************/
D4D_OBJECT* D4D_FindPreviousObject(D4D_OBJECT* pObject, D4D_BOOL childrenAlso)
{
    D4D_OBJECT* pLocObject;


    // Compatible mode - just only screen top level objects
    if(pObject->pRelations  == NULL)
    {
        pLocObject = D4D_FindPreviousObjectOnScreen(pObject);

        if(pLocObject->pRelations  == NULL)
            return pLocObject;

    } else
    {
        // find out the "latest child" of my previous sibling

        // Does I have siblings?
        pLocObject = D4D_FindPreviousSiblingObject(pObject);
    }

    if(childrenAlso)
    {
        while(pLocObject && pLocObject->pRelations)
        {
            D4D_OBJECT** pChild = (D4D_OBJECT**)&pLocObject->pRelations[D4D_OBJECT_USR_DATA_CHILD_IX];
            //Check the children
            if(*pChild)
            {   while(*(pChild + 1)) //Find out the last child
                {
                    pChild++;
                }
                pLocObject = *pChild;
            } else
                return pLocObject;
        }
    } else if(pLocObject)
        return pLocObject;

    pLocObject = D4D_GetParentObject(pObject);

    if(pLocObject)
        return pLocObject;

    return D4D_FindPreviousObjectOnScreen(pObject);
}
Exemple #14
0
/*******************************************************
*
* COMBO_BOX Child Object CallBack function from edit box
*
*******************************************************/
void D4D_ComboBoxEditFeedBack(D4D_OBJECT* pThis, D4D_EVENTID eventId)
{
  D4D_OBJECT* pParent = D4D_GetParentObject(pThis);

  D4D_GET_COMBO_BOX(pParent)->pData->real_ix = -1;

  if(eventId == D4D_EVENT_ONCHANGEDONE)
  {
    D4D_COMBO_BOX_INDEX i = D4D_ComboBoxGetItemCount(pParent);
    D4D_COMBO_BOX_INDEX j;

    for(j=0; j<i;j++)
    {
      if(D4D_CompareStringsUniversal(D4D_ComboBoxGetItemTextIx(pParent, j), D4D_EditBoxGetText(D4D_GET_COMBO_BOX_EDIT_BOX(pParent))) == 0)
      {
        //hit - the edit box text is same as in list of items
        D4D_GET_COMBO_BOX(pParent)->pData->real_ix = j;
        break;
      }
    }
  }
}
Exemple #15
0
/**************************************************************//*!
*
* Function returns the next sibling object
*
******************************************************************/
D4D_OBJECT* D4D_FindPreviousSiblingObject(D4D_OBJECT* pObject)
{
    D4D_OBJECT* pParent;
    LWord i = D4D_OBJECT_USR_DATA_CHILD_IX;
    pParent = D4D_GetParentObject(pObject);

    if(!pParent)
        return D4D_FindPreviousObjectOnScreen(pObject);

    while(pParent->pRelations[i])
    {
        if(pParent->pRelations[i] == pObject)
        {
            if(i>D4D_OBJECT_USR_DATA_CHILD_IX)
                return (D4D_OBJECT*)pParent->pRelations[i-1];
            else
                return NULL;
        }
        i++;
    }

    return NULL;
}
Exemple #16
0
/**************************************************************************/ /*!
* @brief   The function change focus to the previous object in the given screen
* @param   pScreen - the pointer to screen
* @return  None
* @note    In case that there is no other usable object (visible, enable ...) the focus is not changed
*******************************************************************************/
void D4D_FocusPrevObject(D4D_SCREEN* pScreen)
{
    D4D_SCREEN_DATA* pData = pScreen->pData;
    const D4D_OBJECT* const* pObjects = pScreen->pObjects;
    D4D_OBJECT* pFocusedObj = pData->focusedObject;
    
    if(!pScreen)
      return;
    
    // sanity check of list of objects - contains Screen any object?
    if(*pObjects == NULL)
      return;
    
    do
    {
        
        // just get previous object
        pFocusedObj = D4D_FindPreviousObject(pFocusedObj, (((pFocusedObj->pData->flags) & (D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_VISIBLE)) == (D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_VISIBLE)));
        
        // object with focus enabled?
        if((pFocusedObj->pData->flags & (D4D_OBJECT_F_TABSTOP | D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_VISIBLE)) == (D4D_OBJECT_F_TABSTOP | D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_VISIBLE))
        {
          D4D_OBJECT * pParent = pFocusedObj;
          D4D_BOOL couldBeFocused = D4D_TRUE;
          
          // Take care that the parents objects are also visible and enabled
          while(pParent = D4D_GetParentObject(pParent))
          {
            if((pParent->pData->flags & (D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_VISIBLE)) != (D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_VISIBLE))
            {
              couldBeFocused = D4D_FALSE;
              break;
            }
          }
          
          if(couldBeFocused)
            break;
        }
        
      // avoid endless loop if no focused object can be found
    }while(pFocusedObj != pData->focusedObject);
    
    if(pFocusedObj != pData->focusedObject)
    {        
      // invalidate object which is loosing focus
      D4D_SetObjectFlags(pData->focusedObject, D4D_OBJECT_F_REDRAWSTATE, D4D_FALSE);
      
      // prepare message KILLFOCUS
      d4d_msg.pScreen = pScreen;
      d4d_msg.nMsgId = D4D_MSG_KILLFOCUS;
      d4d_msg.pObject = pData->focusedObject;
      D4D_SendMessage(&d4d_msg);
      
      // invalidate object which is getting focus
      D4D_SetObjectFlags((D4D_OBJECT*)pFocusedObj, D4D_OBJECT_F_REDRAWSTATE, D4D_FALSE);
      
      // move the focus
      pData->focusedObject = pFocusedObj;
      
      // prepare message
      d4d_msg.pScreen = pScreen;
      d4d_msg.nMsgId = D4D_MSG_SETFOCUS;
      d4d_msg.pObject = pFocusedObj;
      D4D_SendMessage(&d4d_msg);
    }
}