Example #1
0
bool TeamBox::Update(const Point2i &mousePosition,
                     const Point2i &lastMousePosition)
{
  UpdatePlayerNameColor();

  Box::Update(mousePosition, lastMousePosition);
  if (need_redrawing) {
    Draw(mousePosition);
  }

  if (associated_team) {
    WidgetList::Update(mousePosition, lastMousePosition);
    if (previous_player_name != player_name->GetText()) {
      previous_player_name = player_name->GetText();
      if (Network::GetInstance()->IsConnected()) {
        ValidOptions();
      }
    }
  } else {
    RedrawBackground(*this);
  }

  //SwapWindowClip(r);
  need_redrawing = false;
  return true;
}
Example #2
0
bool WidgetList::Update(const Point2i& mousePosition,
                        const Point2i& lastMousePosition)
{
  Rectanglei clip;
  Rectanglei wlr = GetClip(clip);
  if (!wlr.GetSizeX() || !wlr.GetSizeY())
      return false;

  // Redraw the background
  bool updated = false;
  if (need_redrawing)
    RedrawBackground(wlr);

  for (std::list<Widget*>::const_iterator w=widget_list.begin();
      w != widget_list.end();
      w++)
  {
    Rectanglei r((*w)->GetPosition(), (*w)->GetSize());
    r.Clip(wlr);

    if (r.GetSizeX() && r.GetSizeY()) {
      SwapWindowClip(r);
      updated |= (*w)->Update(mousePosition, lastMousePosition);
      SwapWindowClip(r);
    }
  }

  if (updated)
    RedrawForeground();

  // Restore initial clip rectangle
  UnsetClip(clip);
  need_redrawing = false;
  return updated;
}
    SelectEnum(const Rect & rt) : Interface::ListBox<int>(rt), area(rt), ok(false)
    {
      RedrawBackground(rt);
      SetScrollButtonUp(ICN::LISTBOX, 3, 4, Point(rt.x + rt.w - 24, rt.y + 25));
      SetScrollButtonDn(ICN::LISTBOX, 5, 6, Point(rt.x + rt.w - 24, rt.y + rt.h - 55));

      SetScrollSplitter(AGG::GetICN(ICN::LISTBOX, 10), Rect(rt.x + rt.w - 19, rt.y + 48, 14, rt.h - 106));
      SetAreaMaxItems(5);
      SetAreaItems(Rect(rt.x + 10, rt.y + 30, rt.w - 30, rt.h - 70));
    };
Example #4
0
void MultiTabs::Update(const Point2i &mousePosition,
                       const Point2i &lastMousePosition)
{
  Rectanglei header(position.x, position.y,
                    next_tab_bt->GetPositionX() + next_tab_bt->GetSizeX() - position.x,
                    prev_tab_bt->GetSizeY());

  if (need_redrawing) {
    Widget::Update(mousePosition, lastMousePosition);
  } else if ((header.Contains(mousePosition) && mousePosition != lastMousePosition) ||
             (header.Contains(lastMousePosition) && !header.Contains(mousePosition))) {
    RedrawBackground(header);

    DrawHeader(mousePosition);
    RedrawForeground();
  }
    if (!tabs.empty())
      tabs[current_tab].box->Update(mousePosition, lastMousePosition);

  need_redrawing = false;
}
void COXScrollTip::Redraw() 
	// --- In  :
	// --- Out : 
	// --- Returns :
	// --- Effect : Redraws the window with the new rect and text contents
	{
	// First adjust the position
	if (m_bRectChanged)
		{
		// First repaint the area we will not use anymore
		CRect oldRect;
		GetWindowRect(oldRect);
		CRect divRect;
		divRect.SubtractRect(oldRect, m_rect);

		// Move scroll tip window
		SetWindowPos(&CWnd::wndTop, m_rect.left, m_rect.top, m_rect.Width(), m_rect.Height(), 
			SWP_NOACTIVATE);

		if (m_bFastBackgroundRepaint)
			RedrawBackground(divRect);
		}

	// Then adjust the text
	if (m_bTextChanged)
		SetWindowText(m_sText);

	// ... If the window is still invisible, show it now
	if (!m_bVisible)
		Show(TRUE);
	ASSERT(m_bVisible);

	// Redraw the window if position or text have changed
	if (m_bRectChanged || m_bTextChanged)
		RedrawWindow(NULL, NULL, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ERASENOW);

	m_bRectChanged = FALSE;
	m_bTextChanged = FALSE;
	}