示例#1
0
CGUIListItem& CGUIListItem::operator =(const CGUIListItem& item)
{
  if (&item == this) return * this;
  m_strLabel2 = item.m_strLabel2;
  m_strLabel = item.m_strLabel;
  m_sortLabel = item.m_sortLabel;
  FreeMemory();
  m_bSelected = item.m_bSelected;
  m_strIcon = item.m_strIcon;
  m_overlayIcon = item.m_overlayIcon;
  m_bIsFolder = item.m_bIsFolder;
  m_mapProperties = item.m_mapProperties;
  m_art = item.m_art;
  m_artFallbacks = item.m_artFallbacks;
  SetInvalid();
  return *this;
}
示例#2
0
void CGUIEditControl::ValidateInput()
{
  // validate the input
  bool invalid = !ValidateInput(m_text2);
  // nothing to do if still valid/invalid
  if (invalid != m_invalidInput)
  {
    // the validity state has changed so we need to update the control
    m_invalidInput = invalid;

    // let the window/dialog know that the validity has changed
    CGUIMessage msg(GUI_MSG_VALIDITY_CHANGED, GetID(), GetID(), m_invalidInput ? 0 : 1);
    SendWindowMessage(msg);

    SetInvalid();
  }
}
示例#3
0
EVENT_RESULT CGUIControlGroupList::OnMouseEvent(const CPoint &point, const CMouseEvent &event)
{
  if (event.m_id == ACTION_MOUSE_WHEEL_UP || event.m_id == ACTION_MOUSE_WHEEL_DOWN)
  {
    // find the current control and move to the next or previous
    float offset = 0;
    for (ciControls it = m_children.begin(); it != m_children.end(); ++it)
    {
      CGUIControl *control = *it;
      if (!control->IsVisible()) continue;
      float nextOffset = offset + Size(control) + m_itemGap;
      if (event.m_id == ACTION_MOUSE_WHEEL_DOWN && nextOffset > m_scroller.GetValue() && m_scroller.GetValue() < m_totalSize - Size()) // past our current offset
      {
        ScrollTo(nextOffset);
        return EVENT_RESULT_HANDLED;
      }
      else if (event.m_id == ACTION_MOUSE_WHEEL_UP && nextOffset >= m_scroller.GetValue() && m_scroller.GetValue() > 0) // at least at our current offset
      {
        ScrollTo(offset);
        return EVENT_RESULT_HANDLED;
      }
      offset = nextOffset;
    }
  }
  else if (event.m_id == ACTION_GESTURE_BEGIN)
  { // grab exclusive access
    CGUIMessage msg(GUI_MSG_EXCLUSIVE_MOUSE, GetID(), GetParentID());
    SendWindowMessage(msg);
    return EVENT_RESULT_HANDLED;
  }
  else if (event.m_id == ACTION_GESTURE_END)
  { // release exclusive access
    CGUIMessage msg(GUI_MSG_EXCLUSIVE_MOUSE, 0, GetParentID());
    SendWindowMessage(msg);
    return EVENT_RESULT_HANDLED;
  }
  else if (event.m_id == ACTION_GESTURE_PAN)
  { // do the drag and validate our offset (corrects for end of scroll)
    m_scroller.SetValue(CLAMP(m_scroller.GetValue() - ((m_orientation == HORIZONTAL) ? event.m_offsetX : event.m_offsetY), 0, m_totalSize - Size()));
    SetInvalid();
    return EVENT_RESULT_HANDLED;
  }

  return EVENT_RESULT_UNHANDLED;
}
示例#4
0
void CGUIButtonControl::ProcessText(unsigned int currentTime)
{
  CRect labelRenderRect = m_label.GetRenderRect();
  CRect label2RenderRect = m_label2.GetRenderRect();

  float renderWidth = GetWidth();
  bool changed = m_label.SetMaxRect(m_posX, m_posY, renderWidth, m_height);
  changed |= m_label.SetText(m_info.GetLabel(m_parentID));
  changed |= m_label.SetScrolling(HasFocus());
  changed |= m_label2.SetMaxRect(m_posX, m_posY, renderWidth, m_height);
  changed |= m_label2.SetText(m_info2.GetLabel(m_parentID));

  // text changed - images need resizing
  if (m_minWidth && (m_label.GetRenderRect() != labelRenderRect))
    SetInvalid();

  // auto-width - adjust hitrect
  if (m_minWidth && m_width != renderWidth)
  {
    CRect rect(m_posX, m_posY, renderWidth, m_height);
    SetHitRect(rect, m_hitColor);
  }

  // render the second label if it exists
  if (!m_info2.GetLabel(m_parentID).empty())
  {
    changed |= m_label2.SetAlign(XBFONT_RIGHT | (m_label.GetLabelInfo().align & XBFONT_CENTER_Y) | XBFONT_TRUNCATED);
    changed |= m_label2.SetScrolling(HasFocus());

    // If overlapping was corrected - compare render rects to determine
    // if they changed since last frame.
    if (CGUILabel::CheckAndCorrectOverlap(m_label, m_label2))
      changed |= (m_label.GetRenderRect()  != labelRenderRect ||
                  m_label2.GetRenderRect() != label2RenderRect);

    changed |= m_label2.SetColor(GetTextColor());
    changed |= m_label2.Process(currentTime);
  }
  changed |= m_label.SetColor(GetTextColor());
  changed |= m_label.Process(currentTime);
  if (changed)
    MarkDirtyRegion();
}
示例#5
0
void CGUIControlGroup::ClearAll()
{
  // first remove from the lookup table
  if (m_parentControl)
  {
    for (iControls it = m_children.begin(); it != m_children.end(); ++it)
      ((CGUIControlGroup *)m_parentControl)->RemoveLookup(*it);
  }
  // and delete all our children
  for (iControls it = m_children.begin(); it != m_children.end(); ++it)
  {
    CGUIControl *control = *it;
    delete control;
  }
  m_focusedControl = 0;
  m_children.clear();
  m_lookup.clear();
  SetInvalid();
}
示例#6
0
void CGUIScrollBar::SetFromPosition(const CPoint &point)
{
  float fPercent;
  if (m_orientation == VERTICAL)
    fPercent = (point.y - m_guiBackground.GetYPosition() - 0.5f*m_guiBarFocus.GetHeight()) / (m_guiBackground.GetHeight() - m_guiBarFocus.GetHeight());
  else
    fPercent = (point.x - m_guiBackground.GetXPosition() - 0.5f*m_guiBarFocus.GetWidth()) / (m_guiBackground.GetWidth() - m_guiBarFocus.GetWidth());
  if (fPercent < 0) fPercent = 0;
  if (fPercent > 1) fPercent = 1;

  int offset = (int)(floor(fPercent * (m_numItems - m_pageSize) + 0.5f));

  if (m_offset != offset)
  {
    m_offset = offset;
    CGUIMessage message(GUI_MSG_NOTIFY_ALL, GetParentID(), GetID(), GUI_MSG_PAGE_CHANGE, m_offset);
    SendWindowMessage(message);
    SetInvalid();
  }
}
示例#7
0
文件: GUITextBox.cpp 项目: has12/xbmc
void CGUITextBox::UpdateInfo(const CGUIListItem *item)
{
  m_textColor = m_label.textColor;
  if (!CGUITextLayout::Update(item ? m_info.GetItemLabel(item) : m_info.GetLabel(m_parentID), m_width))
    return; // nothing changed

  // needed update, so reset to the top of the textbox and update our sizing/page control
  SetInvalid();
  m_offset = 0;
  m_scrollOffset = 0;
  ResetAutoScrolling();

  m_itemHeight = m_font ? m_font->GetLineHeight() : 10;
  float textHeight = m_font ? m_font->GetTextHeight(m_lines.size()) : m_itemHeight * m_lines.size();
  float maxHeight = m_height ? m_height : textHeight;
  m_renderHeight = m_minHeight ? CLAMP(textHeight, m_minHeight, maxHeight) : m_height;
  m_itemsPerPage = (unsigned int)(m_renderHeight / m_itemHeight);

  UpdatePageControl();
}
示例#8
0
void CGUIListGroup::EnlargeHeight(float difference)
{
  // Alters the width of the controls that have an ID of 1
  for (iControls it = m_children.begin(); it != m_children.end(); it++)
  {
    CGUIControl *child = *it;
    if (child->GetID() >= 1 && child->GetID() <= 14)
    {
      if (child->GetID() == 1) // label
      {
        child->SetHeight(child->GetHeight() + difference);
        child->SetVisible(child->GetHeight() > 10); ///
      }
      else
      {
        child->SetHeight(child->GetHeight() + difference);
      }
    }
  }
  SetInvalid();
}
示例#9
0
// PURPOSE:
//   Subarray class constructor with total cells and array index argument
//
// PRE:
//   size_t NumArgs	: The totla number of cells in the subarray
//   size_t ThisIndex	: The initial subarray index
//
// POST:
//   Calls PtrVector constructor to create the null pointer vector and
//   validity state bit array
//   If number of arguments exceeds or equals the maximum value of unsigned
//   short type then length exception is thrown otherwise the subarray index
//   is validated and all elements in pointer vector is set to invalid state.
//
SubArray::SubArray(size_t NumArgs_, size_t ThisIndex_):
    PtrVector(NumArgs_),
    _ArrayBase(NULL),
    _Index(ThisIndex_),
    _BackPtr(NULL),
    _Extension(NULL)
{
    ARXMARKER("Start: SubArray::SubArray(size_t, size_t)", ARRAY_ERRSTREAM)

    // Throw exception if specified total array cells is greater than or equal
    // to maximum of counter type.
    if (NumArgs_ >= ArrayClass::MaxSize())
        Xlen();

    // Validate specified index
    ValidateIndex();

    // Initialize all array elements to invalid state.
    for (size_t Index_ = 0, Max_ = GetIndex(); Index_ < Max_; Index_++)
        SetInvalid(Index_);

    ARXMARKER("End: SubArray::SubArray(size_t, size_t)", ARRAY_ERRSTREAM)
}
示例#10
0
void CFileItem::Reset()
{
  // CGUIListItem members...
  m_strLabel2.clear();
  SetLabel("");
//  FreeIcons();
//  m_overlayIcon = ICON_OVERLAY_NONE;
  m_bSelected = false;
  m_bIsFolder = false;

  m_strDVDLabel.clear();
  m_strTitle.clear();
  m_strPath.clear();
  m_dateTime.Reset();
  m_strLockCode.clear();
  m_mimetype.clear();

  m_extrainfo.clear();
  ClearProperties();

  Initialize();
  SetInvalid();
}
示例#11
0
void CGUIDialogProgress::ShowProgressBar(bool bOnOff)
{
  CSingleLock lock(m_section);
  m_showProgress = bOnOff;
  SetInvalid();
}
示例#12
0
bool CGUIControl::OnMessage(CGUIMessage& message)
{
  if ( message.GetControlId() == GetID() )
  {
    switch (message.GetMessage() )
    {
    case GUI_MSG_SETFOCUS:
      // if control is disabled then move 2 the next control
      if ( !CanFocus() )
      {
        CLog::Log(LOGERROR, "Control %u in window %u has been asked to focus, "
                            "but it can't",
                  GetID(), GetParentID());
        return false;
      }
      SetFocus(true);
      {
        // inform our parent window that this has happened
        CGUIMessage message(GUI_MSG_FOCUSED, GetParentID(), GetID());
        if (m_parentControl)
          m_parentControl->OnMessage(message);
      }
      return true;
      break;

    case GUI_MSG_LOSTFOCUS:
      {
        SetFocus(false);
        // and tell our parent so it can unfocus
        if (m_parentControl)
          m_parentControl->OnMessage(message);
        return true;
      }
      break;

    case GUI_MSG_VISIBLE:
      SetVisible(true, true);
      return true;
      break;

    case GUI_MSG_HIDDEN:
      SetVisible(false);
      return true;

      // Note that the skin <enable> tag will override these messages
    case GUI_MSG_ENABLED:
      SetEnabled(true);
      return true;

    case GUI_MSG_DISABLED:
      SetEnabled(false);
      return true;

    case GUI_MSG_WINDOW_RESIZE:
      // invalidate controls to get them to recalculate sizing information
      SetInvalid();
      return true;
    }
  }
  return false;
}
示例#13
0
void SZYamlDocument::SetEmpty()
{
    m_YamlItemList.RemoveAll();

    SetInvalid();
}
示例#14
0
文件: Data.cpp 项目: StefanL74/XCSoar
void
InfoBoxData::Clear()
{
  title.clear();
  SetInvalid();
}
示例#15
0
void CGUIListLabel::SetSelected(bool selected)
{
  if(m_label.SetColor(selected ? CGUILabel::COLOR_SELECTED : CGUILabel::COLOR_TEXT))
    SetInvalid();
}
示例#16
0
void CGUIScrollBar::SetValue(int value)
{
  m_offset = value;
  SetInvalid();
}
示例#17
0
void CGUIEditControl::SetLabel(const std::string &text)
{
  CGUIButtonControl::SetLabel(text);
  SetInvalid();
}
示例#18
0
void CGUIProgressControl::SetPercentage(float fPercent)
{
    if (m_fPercent != fPercent)
        SetInvalid();
    m_fPercent = fPercent;
}
示例#19
0
void SDeferredLinetestReceiver::OnDataReceived( const QueuedRayID& rayID, const RayCastResult& result )
{
	CRY_ASSERT(rayID == queuedRayID);

	CPlayerVisTable * visTable = g_pGame->GetPlayerVisTable();

	//This may be receiving results from the previous frame's physics, when
	//	 the game has just been reset and the vis table with it
	if(!IsFree())
	{
		SDeferredLinetestBuffer& visBuffer = visTable->GetDeferredLinetestBuffer(visBufferIndex);

		if(IsValid())
		{
			SVisTableEntry& visEntry = visTable->GetNthVisTableEntry(visTableIndex);
			const bool obstructed = (result.hitCount > 0);

			if(obstructed)
			{
				//The linetest hit something en route to the target
				visEntry.flags &= ~(eVF_Visible|eVF_VisibleThroughGlass|eVF_Requested|eVF_Pending|eVF_CheckAgainstCenter);

				bool isGlass = true;
				int i = 0;
				
				while(i < result.hitCount && isGlass)
				{
					float bouncy, friction;
					uint32	pierceabilityMat;
					gEnv->pPhysicalWorld->GetSurfaceParameters(result.hits[i].surface_idx, bouncy, friction, pierceabilityMat);
					pierceabilityMat &= sf_pierceable_mask;

					if(pierceabilityMat <= PIERCE_GLASS)
					{
						isGlass = false;
					}

					i++;
				}
				
				if(isGlass)
				{
					visEntry.flags |= eVF_VisibleThroughGlass;
				}
				else if (result->pCollider->GetType() == PE_ARTICULATED)
				{
					visEntry.flags |= eVF_Visible;
				}
				else if(IEntity* pTarget = gEnv->pEntitySystem->GetEntityFromPhysics(result->pCollider))
				{
					// Test if this is an environmental weapon. If so, get its OWNER (the owner is still visible). 
					CEnvironmentalWeapon *pEnvWeapon = static_cast<CEnvironmentalWeapon*>(g_pGame->GetIGameFramework()->QueryGameObjectExtension(pTarget->GetId(), "EnvironmentalWeapon"));
					if(pEnvWeapon && pEnvWeapon->GetOwner() == visEntry.entityId)
					{
						visEntry.flags |= eVF_Visible | eVF_VisibleThroughGlass;
					}
				}
			}
			else
			{
				visEntry.flags |= eVF_Visible | eVF_VisibleThroughGlass;
				visEntry.flags &= ~(eVF_Requested|eVF_Pending|eVF_CheckAgainstCenter);
			}

#if ALLOW_VISTABLE_DEBUGGING
			visTable->GetDebugDraw().UpdateDebugTarget(visEntry.entityId, ZERO, !obstructed);
#endif
			queuedRayID = 0;	//Pending ray processed

			SetInvalid();
			visEntry.framesSinceLastCheck = 0;
		}

		//Mark this SVisTableEntry_Processing as available
		SetFree();
		visBuffer.m_numLinetestsCurrentlyProcessing--;
	}
}
示例#20
0
void CGUIControlGroupList::ScrollTo(float offset)
{
  m_scroller.ScrollTo(offset);
  if (m_scroller.IsScrolling())
    SetInvalid();
}
示例#21
0
void CGUIDialogProgress::SetCanCancel(bool bCanCancel)
{
  CSingleLock lock(m_section);
  m_bCanCancel = bCanCancel;
  SetInvalid();
}
示例#22
0
CGUIListItem::CGUIListItem(const CGUIListItem& item)
{
  *this = item;
  SetInvalid();
}
示例#23
0
void CGUIListItem::Archive(CArchive &ar)
{
  if (ar.IsStoring())
  {
    ar << m_bIsFolder;
    ar << m_strLabel;
    ar << m_strLabel2;
    ar << m_sortLabel;
    ar << m_strIcon;
    ar << m_bSelected;
    ar << m_overlayIcon;
    ar << (int)m_mapProperties.size();
    for (PropertyMap::const_iterator it = m_mapProperties.begin(); it != m_mapProperties.end(); ++it)
    {
      ar << it->first;
      ar << it->second;
    }
    ar << (int)m_art.size();
    for (ArtMap::const_iterator i = m_art.begin(); i != m_art.end(); ++i)
    {
      ar << i->first;
      ar << i->second;
    }
    ar << (int)m_artFallbacks.size();
    for (ArtMap::const_iterator i = m_artFallbacks.begin(); i != m_artFallbacks.end(); ++i)
    {
      ar << i->first;
      ar << i->second;
    }
  }
  else
  {
    ar >> m_bIsFolder;
    ar >> m_strLabel;
    ar >> m_strLabel2;
    ar >> m_sortLabel;
    ar >> m_strIcon;
    ar >> m_bSelected;

    int overlayIcon;
    ar >> overlayIcon;
    m_overlayIcon = GUIIconOverlay(overlayIcon);

    int mapSize;
    ar >> mapSize;
    for (int i = 0; i < mapSize; i++)
    {
      std::string key;
      CVariant value;
      ar >> key;
      ar >> value;
      SetProperty(key, value);
    }
    ar >> mapSize;
    for (int i = 0; i < mapSize; i++)
    {
      std::string key, value;
      ar >> key;
      ar >> value;
      m_art.insert(make_pair(key, value));
    }
    ar >> mapSize;
    for (int i = 0; i < mapSize; i++)
    {
      std::string key, value;
      ar >> key;
      ar >> value;
      m_artFallbacks.insert(make_pair(key, value));
    }
    SetInvalid();
  }
}
示例#24
0
void CGUIListItem::SetArt(const ArtMap &art)
{
  m_art = art;
  SetInvalid();
}