| 657 | } |
| 658 | |
| 659 | void ConfigItem::Add(int count, ...) { |
| 660 | if (!m_bAlive) |
| 661 | return; |
| 662 | |
| 663 | ASSERT(m_tiCount == 0); |
| 664 | |
| 665 | va_list marker; |
| 666 | va_start(marker, count); |
| 667 | int i; |
| 668 | UITextItem *uitemp; |
| 669 | |
| 670 | switch (m_iType) { |
| 671 | case CIT_HOTSPOTLIST: |
| 672 | ASSERT(count > 0); |
| 673 | ASSERT(m_rbCount == 0); |
| 674 | // we need count text items |
| 675 | // we need count radiobuttons |
| 676 | // we need count IDs |
| 677 | m_tiCount = count; |
| 678 | m_tiList = (UITextItem **)mem_malloc(sizeof(UITextItem *) * m_tiCount); |
| 679 | m_rbCount = count; |
| 680 | m_rbList = (UIRadioButton **)mem_malloc(sizeof(UIRadioButton *) * m_rbCount); |
| 681 | m_iNumIDs = count; |
| 682 | m_iID = (int *)mem_malloc(sizeof(int) * m_iNumIDs); |
| 683 | // make sure mallocs are ok |
| 684 | ASSERT((m_tiList) && (m_rbList) && (m_iID)); |
| 685 | // initialize variables |
| 686 | // adjust the curr x/y for the list |
| 687 | curr_x = 0; |
| 688 | curr_y = 0; |
| 689 | for (i = 0; i < m_iNumIDs; i++) { |
| 690 | // get unique ID |
| 691 | m_iID[i] = GetUniqueID(); |
| 692 | // allocate text item |
| 693 | m_tiList[i] = new UITextItem; |
| 694 | // make sure allocation ok |
| 695 | ASSERT(m_tiList[i]); |
| 696 | uitemp = va_arg(marker, UITextItem *); |
| 697 | (*m_tiList[i]) = *uitemp; |
| 698 | (*m_tiList[i]).set_alpha(255); |
| 699 | // allocate radio button |
| 700 | m_rbList[i] = new UIRadioButton; |
| 701 | // make sure allocation ok |
| 702 | ASSERT(m_rbList[i]); |
| 703 | if (i) |
| 704 | m_rbList[i]->Create(m_hWnd, m_rbList[i - 1], m_iID[i], m_tiList[i], m_X + curr_x, m_Y + curr_y, |
| 705 | m_tiList[i]->width(), m_tiList[i]->height(), UIF_FIT | UIRB_NOBUTTON); |
| 706 | else |
| 707 | m_rbList[i]->Create(m_hWnd, NULL, m_iID[i], m_tiList[i], m_X + curr_x, m_Y + curr_y, m_tiList[i]->width(), |
| 708 | m_tiList[i]->height(), UIF_FIT | UIRB_NOBUTTON); |
| 709 | |
| 710 | (*m_tiList[i]).set_color(UICOL_HOTSPOT_HI); |
| 711 | m_rbList[i]->SetStateItem(UI_BTS_ACTIVATED, m_tiList[i]); |
| 712 | (*m_tiList[i]).set_color(UICOL_HOTSPOT_LO); |
| 713 | m_rbList[i]->SetStateItem(UI_BTS_INACTIVE, m_tiList[i]); |
| 714 | (*m_tiList[i]).set_color(UICOL_HOTSPOT_HI); |
| 715 | m_rbList[i]->SetStateItem(UI_BTS_HILITE, m_tiList[i]); |
| 716 |
nothing calls this directly
no test coverage detected