Exemple #1
0
void TextControl::MarqueeText(void)
{
    Canvas *pCanvas;
    int    iRet;

    m_oMutex.Acquire();
	m_iMarqueePos += m_iMarqueeScrollIncrement;
    m_oMutex.Release();
    
    pCanvas = m_pParent->GetCanvas();
    pCanvas->Erase(m_oRect);
    iRet = pCanvas->RenderOffsetText(m_oRect.Height(), m_oRect, 
                                     m_oValue, m_iMarqueePos, 
                                     m_pFont, m_oColor, m_bBold, 
                                     m_bItalic, m_bUnderline); 
    if (iRet < 0)
    {
       m_oMutex.Acquire();
       m_iMarqueePos = -iRet;                           
       m_oMutex.Release();
       pCanvas->RenderOffsetText(m_oRect.Height(), m_oRect, 
                                 m_oValue, m_iMarqueePos, 
                                 m_pFont, m_oColor, m_bBold, 
                                 m_bItalic, m_bUnderline); 
    }                             
}
Exemple #2
0
void TextControl::TextChanged(void)
{
    Canvas *pCanvas;
    int    iRet;

    if (m_pPanel->IsHidden())
        return;

    m_oMutex.Acquire();
    
    m_iMarqueePos = 0;
    pCanvas = m_pParent->GetCanvas();
    m_oMutex.Release();

    pCanvas->SetNoScreenUpdate(true);
    pCanvas->Erase(m_oRect);
    iRet = pCanvas->RenderText(m_oRect.Height(), m_oRect, 
                               m_oValue, m_eAlign, 
                               m_pFont, m_oColor, m_bBold, 
                               m_bItalic, m_bUnderline); 

    // If this is the time display, don't marquee it
    if (iRet > 0 && m_oName == string("Time") || 
                    m_oName == string("TimeRemaining"))
    {
       pCanvas->Erase(m_oRect);
       pCanvas->RenderText(m_oRect.Height(), m_oRect, 
                           m_oValue, eRight, 
                           m_pFont, m_oColor, m_bBold, 
                           m_bItalic, m_bUnderline); 
       iRet = 0;
    }
    pCanvas->SetNoScreenUpdate(false);
    pCanvas->Invalidate(m_oRect);
    pCanvas->Update();

    m_oMutex.Acquire();
    m_bWantsTimingMessages = (iRet > 0);
    m_oMutex.Release();
}
void MultiStateControl::Transition(ControlTransitionEnum  eTrans,
                                   Pos                   *pMousePos)
{
    Canvas *pCanvas;
    
    switch(eTrans)
    {
       case CT_MouseEnter:
          m_pParent->SendControlMessage(this, CM_MouseEnter);
          break;
       case CT_MouseLeave:
          m_pParent->SendControlMessage(this, CM_MouseLeave);
          break;
       case CT_SetValue:
       	  m_iState = min(max(m_iValue, 0), m_iNumStates - 1);
          break;
       case CT_Hide:
       {
       	  Rect oRect = m_oRect;

           if (m_pPanel->IsHidden())
               return;

           pCanvas = m_pParent->GetCanvas();
           pCanvas->Erase(oRect);
           pCanvas->Invalidate(oRect);
       	  break;
       }   

       default:
          break;
    }

    if (m_pPanel->IsHidden())
        return;

    if (m_eCurrentState == CS_MouseOver && 
        eTrans == CT_MouseLButtonUp)
        m_pParent->SendControlMessage(this, CM_Pressed);

    BlitFrame(m_eCurrentState, m_iState);
}
Exemple #4
0
void VSliderControl::MoveThumb(int iNewPos)
{
    Canvas *pCanvas;
    Rect    oRect;

    pCanvas = m_pParent->GetCanvas();
    pCanvas->Erase(m_oRect);

    oRect.y1 = m_oRect.y1 + iNewPos;
    oRect.y2 = oRect.y1 + m_iThumbHeight;
    oRect.x1 = m_oRect.x1;
    oRect.x2 = m_oRect.x2;
    
    int iThumbNumber = m_iNumThumbStates * (1 - iNewPos / m_iRange);
    iThumbNumber = min(m_iNumThumbStates - 1, iThumbNumber);

    BlitTrough(iNewPos);

    switch(m_eCurrentState)
    {
       case CS_Normal:
          BlitFrame(CS_Normal, iThumbNumber, &oRect, false);
          break;

       case CS_Dragging:
       case CS_MouseOver:
          BlitFrame(CS_MouseOver, iThumbNumber, &oRect, false);
          break;

       case CS_Disabled:
       case CS_DisabledMO:
          BlitFrame(CS_Disabled, iThumbNumber, &oRect, false);
          break;

       default:
          break;
    }
    pCanvas->Invalidate(m_oRect);
}
void PixSliderControl::Transition(ControlTransitionEnum  eTrans,
                                  Pos                   *pMousePos)
{
    Canvas *pCanvas;
    
    if (m_eCurrentState == CS_Pressed && eTrans == CT_SetValue)
        return;

    switch(eTrans)
    {
       case CT_MouseEnter:
          m_pParent->SendControlMessage(this, CM_MouseEnter);
          return;
       case CT_MouseLeave:
          m_pParent->SendControlMessage(this, CM_MouseLeave);
          return;
       case CT_SetValue: {
          if (m_iValue < 0 || m_iValue > 100)
              return;
         
          int temp = m_iValue * m_iNumStates / 100; 
          m_iState = min(temp, m_iNumStates - 1);

         if (!m_bActivationReveal) 
             BlitFrame(CS_Normal, m_iState);
         else
             DrawReveal((float)m_iValue * 2.55);

         return; }
       case CT_Hide:
       {
       	  Rect oRect = m_oRect;

           if (m_pPanel->IsHidden())
               return;

           pCanvas = m_pParent->GetCanvas();
           pCanvas->Erase(oRect);
           pCanvas->Invalidate(oRect);
       	   return;
       }   

       default:
          break;
    }

    if (m_pPanel->IsHidden())
        return;
    
    if (m_bHasActivationBitmap && pMousePos)
        m_iState = GetStateNum(*pMousePos);

    if (m_eCurrentState == CS_MouseOver && 
        eTrans == CT_MouseLButtonUp)
        m_pParent->SendControlMessage(this, CM_Pressed);

    if (m_eCurrentState == CS_MouseOver &&
        eTrans == CT_MouseLButtonUp) {
        if (!m_bActivationReveal)
            m_iValue = (int)((float)(m_iState * 100) / m_iNumStates);
        else
            m_iValue = (int)((float)(m_iState * 100) / 255); 
        m_pParent->SendControlMessage(this, CM_ValueChanged);
    }

    if (!m_bActivationReveal)
        BlitFrame(CS_Normal, m_iState);
    else if (pMousePos)
        DrawReveal(*pMousePos);
    else
        DrawReveal((float)m_iValue * 2.55);
}
Exemple #6
0
void ButtonControl::Transition(ControlTransitionEnum  eTrans,
                               Pos                   *pMousePos)
{
    Canvas *pCanvas;

    if (m_pPanel->IsHidden())
       return;

    switch(eTrans)
    {
       case CT_MouseEnter:
          m_pParent->SendControlMessage(this, CM_MouseEnter);
          break;
       case CT_MouseLeave:
          m_pParent->SendControlMessage(this, CM_MouseLeave);
          break;
       case CT_Hide:
       {
          Rect oRect = m_oRect;
          pCanvas = m_pParent->GetCanvas();
          pCanvas->Erase(oRect);
          pCanvas->Invalidate(oRect);
          break;
       }   

       default:
          break;
    }

    if (m_eCurrentState == CS_MouseOver && 
        eTrans == CT_MouseLButtonUp)
    {    
       if (m_oTargetWindow.length() > 0)
       {   
           m_oMutex.Acquire();
           m_oValue = m_oTargetWindow;
           m_oMutex.Release();
           
           m_pParent->SendControlMessage(this, CM_ChangeWindow);
           return;
       }
       if (m_pPanelToToggle)
       {
           m_pPanelToToggle->TogglePanelPos();
           m_pParent->SendControlMessage(this, CM_TogglePanel);
           m_eCurrentState = CS_MouseOver;
           BlitFrame(m_eCurrentState);
           return;
       }
       if (m_oName == string("ReloadTheme"))
       {
          m_pParent->SendControlMessage(this, CM_Pressed);
          return;
       }   
       m_pParent->SendControlMessage(this, CM_Pressed);
    }       

    pCanvas = m_pParent->GetCanvas();
    pCanvas->Erase(m_oRect);
    pCanvas->Invalidate(m_oRect);

    BlitFrame(m_eCurrentState);
}