Ejemplo n.º 1
0
/**
 * AdvanceSelection in the list of text items - simple!
 */
int16_t ListWidget::advanceSelection(int16_t iAdv /*= 1*/)
{
  //DEBUG_PRINT("ListWidget::advanceSelection "); DEBUG_PRINTDEC(iAdv); DEBUG_PRINTLN();
  if(m_selectionMode != smSingleSelection)
    return LB_ERR;
  setCurSel(sanitize(getCurSel() + iAdv));
  return 0;
}
Ejemplo n.º 2
0
shared_ptr<HtmlTabPage> HtmlTabCtrl::addPage(const String &caption, shared_ptr<HtmlImage> icon)
{
	int32 page_index = getPagesCount();
	shared_ptr<HtmlTabPage> page = createPage(page_index);
	page->setCss(page_index == getCurSel() ? OS_CSS_TABCTRL_ACTIVEPAGE : OS_CSS_TABCTRL_PAGE);

	m_pages->getControls()->add(page);

	if(icon != nullptr)
		page->getControls()->add(icon);

	if(caption.empty() == false)
	{
		shared_ptr<HtmlLink> link(OS_NEW HtmlLink(caption, getPageLink(page_index)));
		page->getControls()->add(link);
	}

	return page;
}
Ejemplo n.º 3
0
uint32 ReplayWindow::onMessage(uint32 message, uint32 wParam, uint32 lParam)
{
  if (message == WM_COMMAND && LOWORD(wParam) == ID_PLAYERBOX && HIWORD(wParam) == CBN_SELCHANGE)
  {
    ComboFrameEx* box = dynamic_cast<ComboFrameEx*>(Window::fromHandle((HWND) lParam));
    if (box)
    {
      W3GPlayer* player = (W3GPlayer*) box->getItemData(box->getCurSel());
      for (int i = 0; i < numTabs(); i++)
        ((ReplayTab*) getTab(i))->setPlayer(player);
      if (player && viewItem)
        viewItem->setPlayer(player->player_id);
    }
    return TRUE;
  }
  else if (message == WM_SETPLAYER)
  {
    W3GPlayer* player = (W3GPlayer*) wParam;
    for (int i = 0; i < numTabs(); i++)
      ((ReplayTab*) getTab(i))->setPlayer(player);
    if (player && viewItem)
      viewItem->setPlayer(player->player_id);
    return 0;
  }
  else if (message == WM_SETTAB)
  {
    setTab(wParam);
    return 0;
  }
  else if (message == WM_NOTIFY && viewItem)
  {
    NMHDR* hdr = (NMHDR*) lParam;
    if (hdr->hwndFrom == hWnd && hdr->code == TCN_SELCHANGE)
    {
      if (viewItem)
        viewItem->setTab(getCurSel());
    }
  }
  return TabFrame::onMessage(message, wParam, lParam);
}
Ejemplo n.º 4
0
void KeyValueListWidget::drawItem(size_t i, RECT rLoc)
{
  i = (size_t)sanitize((int16_t)i);
  if(m_values[i].getSelectionMode() == smNoSelection)
  {
    // the only reason NullSpinnerWidget exists
    ListWidget::drawItem(i, rLoc);
    return;
  }
  uint16_t x = (2 * m_rectClient.width()) / 3;             // position of the ':'

  RECT rLocation = rLoc;
  rLocation.right = x;
  m_lcd.printText(m_items[i].c_str(), ILI9341_DARKGREY, ILI9341_BLACK, rLocation, Display::haRight, Display::vaCenter);

  rLocation.left = rLocation.right;
  rLocation.right += m_lcd.measureTextWidth(szSeparator);
  m_lcd.printText(szSeparator, ILI9341_DARKGREY, ILI9341_BLACK, rLocation, Display::haLeft, Display::vaCenter); 
  rLocation.left = rLocation.right;
  rLocation.right = m_rectClient.right;
  m_values[i].setPosition(rLocation);
  m_values[i].hasFocus(i == (size_t)getCurSel());
  m_values[i].draw();
}