示例#1
0
FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value,
                                      FX_BOOL bDefault,
                                      FX_BOOL bNotify) {
  ASSERT(GetType() == CheckBox || GetType() == RadioButton);
  int iCount = CountControls();
  for (int i = 0; i < iCount; i++) {
    CPDF_FormControl* pControl = GetControl(i);
    CFX_WideString csExport = pControl->GetExportValue();
    if (csExport == value) {
      if (bDefault) {
      } else {
        CheckControl(GetControlIndex(pControl), TRUE);
      }
      break;
    } else {
      if (bDefault) {
      } else {
        CheckControl(GetControlIndex(pControl), FALSE);
      }
    }
  }
  if (bNotify && m_pForm->m_pFormNotify) {
    m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
  }
  m_pForm->m_bUpdated = TRUE;
  return TRUE;
}
示例#2
0
// Sets the control state according to the custom ped state.  Use for peds.
bool CClientPad::SetControlState ( const char * szName, float fState )
{
    fState = Clamp < float > ( 0, fState, 1 );
    unsigned int uiIndex;
    if ( GetAnalogControlIndex ( szName, uiIndex ) && GetControlIndex ( szName, uiIndex ) )
    {
        m_fStates [ uiIndex ] = fState;
        // Clear out any opposing states
        switch ( uiIndex )
        {
            case 3: m_fStates [ 4 ] = 0; break;
            case 4: m_fStates [ 3 ] = 0; break;
            case 5: m_fStates [ 6 ] = 0; break;
            case 6: m_fStates [ 5 ] = 0; break;
            case 19: m_fStates [ 20 ] = 0; break;
            case 20: m_fStates [ 19 ] = 0; break;
            case 21: m_fStates [ 22 ] = 0; break;
            case 22: m_fStates [ 21 ] = 0; break;
            case 35: m_fStates [ 36 ] = 0; break;
            case 36: m_fStates [ 35 ] = 0; break;
            case 37: m_fStates [ 38 ] = 0; break;
            case 38: m_fStates [ 37 ] = 0; break;
            default: break;
        }
        return true;
    }
    return false;
}
示例#3
0
VOID CDUIListBox::OnItemClick(const DUIEvent& info)
{
	SendNotify(WM_NOTIFY_LISTBOX_NOTIFY, LBN_WPARAM_CLCIK, (LPARAM)info.pSender);

	IDUIListItem* pListItem = (IDUIListItem*)info.pSender->GetInterface(IListItem);
	if(pListItem != NULL)
	{
		if(!pListItem->GetGroup())
		{
			INT nClickIndex = GetVisibleItemIndex(info.pSender);
			if(nClickIndex != -1)
			{
				SetCurSel(nClickIndex);
			}
		}
		else
		{
			INT nIndex = GetControlIndex(info.pSender);
			if(nIndex != -1)
			{
				ExpandGroup(nIndex, !pListItem->GetExpand());
			}
		}
	}
}
示例#4
0
// Gets the analog control state according to custom pad state.  Use for peds.
bool CClientPad::GetControlState ( const char * szName, float & fState )
{
    unsigned int uiIndex;
    if ( GetControlIndex ( szName, uiIndex ) )
    {
        fState = m_fStates [ uiIndex ];
        return true;
    }
    return false;
}
示例#5
0
// Sets the control state according to the custom ped state.  Use for peds.
bool CClientPad::SetControlState ( const char * szName, bool bState )
{
    unsigned int uiIndex;
    if ( GetControlIndex ( szName, uiIndex ) )
    {
        m_fStates [ uiIndex ] = bState ? 1.0f : 0.0f;
        return true;
    }
    return false;
}
FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value,
                                      FX_BOOL bDefault,
                                      FX_BOOL bNotify) {
  ASSERT(GetType() == CheckBox || GetType() == RadioButton);
  int iCount = CountControls();
  for (int i = 0; i < iCount; i++) {
    CPDF_FormControl* pControl = GetControl(i);
    CFX_WideString csExport = pControl->GetExportValue();
    bool val = csExport == value;
    if (!bDefault)
      CheckControl(GetControlIndex(pControl), val);
    if (val)
      break;
  }
  if (bNotify && m_pForm->m_pFormNotify)
    m_pForm->m_pFormNotify->AfterCheckedStatusChange(this);
  return TRUE;
}
示例#7
0
// Get the control state directly from a pad state.  Use for players.
bool CClientPad::GetControlState ( const char * szName, CControllerState & State, bool bOnFoot )
{
    unsigned int uiIndex;
    if ( GetControlIndex ( szName, uiIndex ) )
    {
        if ( bOnFoot )
        {
            switch ( uiIndex )
            {
                case 0: return State.ButtonCircle == 255; break;        // fire
                case 1: return State.RightShoulder2 == 255; break;      // next wep
                case 2: return State.LeftShoulder2 == 255; break;       // previous wep
                case 3: return State.LeftStickY == -128; break;         // forwards
                case 4: return State.LeftStickY == 128; break;          // backwards
                case 5: return State.LeftStickX == -128; break;         // left
                case 6: return State.LeftStickX == 128; break;          // right
                case 7: return State.RightShoulder2 == 255; break;      // zoom in
                case 8: return State.LeftShoulder2 == 255; break;       // zoom out
                case 9: return false; break;                            // enter_exit
                case 10: return false; break;                           // change_cam
                case 11: return State.ButtonSquare == 255; break;       // jump
                case 12: return State.ButtonCross == 255; break;        // sprint
                case 13: return State.ShockButtonR == 255; break;       // look behind
                case 14: return State.ShockButtonL == 255; break;       // crouch
                case 15: return State.LeftShoulder1 == 255; break;      // action
                case 16: return State.m_bPedWalk > 0; break;            // walk
                // vehicle keys
                case 39: return State.RightShoulder1 == 255; break;     // aim
                case 40: return State.DPadRight == 255; break;          // conv yes
                case 41: return State.DPadLeft == 255; break;           // conv no
                case 42: return State.DPadUp == 255; break;             // group forward
                case 43: return State.DPadDown == 255; break;           // group backward
                default: break;
            }
        }
        else
        {
            switch ( uiIndex )
            {
                case 17: return State.ButtonCircle == 255; break;       // fire
                case 18: return State.LeftShoulder1 == 255; break;      // secondary fire
                case 19: return State.LeftStickX == -128; break;        // left
                case 20: return State.LeftStickX == 128; break;         // right
                case 21: return State.LeftStickY == -128; break;        // forward
                case 22: return State.LeftStickY == 128; break;         // backward
                case 23: return State.ButtonCross == 255; break;        // accel
                case 24: return State.ButtonSquare == 255; break;       // reverse
                case 25: return State.DPadUp == 255; break;             // radio next
                case 26: return State.DPadDown == 255; break;           // radio prev
                case 27: return State.m_bRadioTrackSkip == 255; break;  // track skip
                case 28: return State.ShockButtonL == 255; break;       // horn
                case 29: return State.ShockButtonR == 255; break;       // sub-mission
                case 30: return State.RightShoulder1 == 255; break;     // handbrake
                case 31: return State.LeftShoulder2 == 255; break;      // look left
                case 32: return State.RightShoulder2 == 255; break;     // look right
                case 33: return false; break;                           // look behind
                case 34: return false; break;                           // mouse look
                case 35: return State.RightStickX == 128; break;        // control left
                case 36: return State.RightStickX == -128; break;       // control right
                case 37: return State.RightStickY == 128; break;        // control down
                case 38: return State.RightStickY == -128; break;       // control up
                default: break;
            }
        }
    }

    return false;
}