コード例 #1
0
ファイル: combobox.cpp プロジェクト: strelkovsky/gamegui
	void Combobox::AddItem(const std::string& name)
	{
		if(m_list)
		{
			ListBox* lb = static_cast<ListBox*>(m_list.get());
			if(lb)
			{
				lb->AddItem(name);
			}
		}
	}
コード例 #2
0
void FillMajorTypes(ListBox& listbox)
{
    listbox.ClearItems();

    // Fill the specified list box with major type name/GUID
    for (int i=0; i < NUM_MAJOR_TYPES; i++)
    {
        listbox.AddItem(majortypes[i].szName, (void *) majortypes[i].pGUID);
    }

    listbox.Select(0);
}
コード例 #3
0
void FillSubType(ListBox& listboxMajor, ListBox& listboxMinor)
{
    const GUIDINFO *pSubtype;
    UINT nSelection = 0;
	
	listboxMajor.GetCurrentSelection(&nSelection);
    int nMajorType;

    // First clear the subtype list
    listboxMinor.ClearItems();

    // If the "don't care" item was selected, clear and exit
    if (nSelection == 0)
    {
        listboxMinor.AddString(L"<No subtypes>\0");
        listboxMinor.Select(0);
        return;
    }
    else
	{
        nMajorType = nSelection - 1;
	}

    // Determine how to fill the minor type list, based on the
    // currently selected major type.
    pSubtype = pSubTypes[nMajorType];

    // If there's no associated subtype, just add a default
    if (!pSubtype)
    {
        listboxMinor.AddString(L"<No subtypes>\0");
        listboxMinor.Select(0);
        return;
    }
    else
    {
        // Set a default item for "don't care"
        listboxMinor.AddString(L"<Don't care>\0");

        int i=0;

        // Fill the subtype list box.  Enter N item data to the N+1 list slot.
        while (pSubtype[i].pGUID != NULL)
        {
            listboxMinor.AddItem(pSubtype[i].szName, (void *) pSubtype[i].pGUID);
            i++;
        }

        listboxMinor.Select(0);
    }
}
コード例 #4
0
void UfopaediaCategory::Begin()
{
	Label* infolabel = ((Label*)menuform->FindControl("TEXT_INFO"));
	ListBox* entrylist = ((ListBox*)menuform->FindControl("LISTBOX_SHORTCUTS"));
	entrylist->Clear();
	entrylist->ItemHeight = infolabel->GetFont()->GetFontHeight() + 2;
	int idx = 1;
	for( auto entry = Entries.begin(); entry != Entries.end(); entry++ )
	{
		std::shared_ptr<UfopaediaEntry> e = (std::shared_ptr<UfopaediaEntry>)*entry;
		TextButton* tb = new TextButton( fw, nullptr, fw.gamecore->GetString(e->Title), infolabel->GetFont() );
		tb->Name = "Index" + Strings::FromInteger( idx );
		tb->RenderStyle = TextButton::TextButtonRenderStyles::SolidButtonStyle;
		tb->TextHAlign = HorizontalAlignment::Left;
		tb->TextVAlign = VerticalAlignment::Centre;
		tb->BackgroundColour.a = 0;
		entrylist->AddItem( tb );
		idx++;
	}

	SetupForm();
	SetTopic( 0 );
}
コード例 #5
0
ファイル: main.cpp プロジェクト: kirkbackus/meal-track
void AddCurrentValue() {
    //For temporary strings
    char tmp[128], tmp2[128];
    time_t rwtm;

    //Retrieve the current time
    time(&rwtm);

    //Get the current values from the scale and computer
    fLastWeight = scale->GetWeight();

    MealItem item = MealItem::create(fLastWeight, scale->GetUnit());
    vMealItems.push_back(item);

    //Convert time to string (12/24 hour format)
    if (cComboDate.GetSelectedItem()==0) strftime(tmp2, 128, "%I:%M:%S %p", item.getTime());
    else strftime(tmp2, 128, "%H:%M:%S", item.getTime());

    //Print to the textbox
    sprintf(tmp, "%s: %.2f %s", tmp2, item.getValue(), item.getUnit());

    cListBox.AddItem(tmp);
}
コード例 #6
0
void
FormWindow::CreateDefList(CtrlDef& def)
{
	ListBox* ctrl = CreateListBox(def.GetText(),
	def.GetX(),
	def.GetY(),
	def.GetW(),
	def.GetH(),
	def.GetID(),
	def.GetParentID());

	ctrl->SetAltText(def.GetAltText());
	ctrl->SetEnabled(def.IsEnabled());
	ctrl->SetBackColor(def.GetBackColor());
	ctrl->SetForeColor(def.GetForeColor());
	ctrl->SetStyle(def.GetStyle());
	ctrl->SetTextAlign(def.GetTextAlign());
	ctrl->SetTransparent(def.GetTransparent());
	ctrl->SetHidePartial(def.GetHidePartial());

	ctrl->SetLineHeight(def.GetLineHeight());
	ctrl->SetShowHeadings(def.GetShowHeadings());
	ctrl->SetLeading(def.GetLeading());
	ctrl->SetMultiSelect(def.GetMultiSelect());
	ctrl->SetDragDrop(def.GetDragDrop());
	ctrl->SetScrollBarVisible(def.GetScrollBarVisible());
	ctrl->SetSmoothScroll(def.GetSmoothScroll());
	ctrl->SetItemStyle(def.GetItemStyle());
	ctrl->SetSelectedStyle(def.GetSelectedStyle());

	ctrl->SetMargins(def.GetMargins());
	ctrl->SetTextInsets(def.GetTextInsets());
	ctrl->SetCellInsets(def.GetCellInsets());
	ctrl->SetCells(def.GetCells());
	ctrl->SetFixedWidth(def.GetFixedWidth());
	ctrl->SetFixedHeight(def.GetFixedHeight());

	if (def.GetTexture().length() > 0) {
		Bitmap*     ctrl_tex = 0;
		DataLoader* loader   = DataLoader::GetLoader();
		loader->SetDataPath("Screens/");
		loader->LoadTexture(def.GetTexture(), ctrl_tex);
		loader->SetDataPath("");

		ctrl->SetTexture(ctrl_tex);
	}

	int ncols = def.NumColumns();
	for (int i = 0; i < ncols; i++) {
		ColumnDef* col = def.GetColumn(i);
		ctrl->AddColumn(col->title, col->width, col->align, col->sort);

		if (col->use_color)
		ctrl->SetColumnColor(i, col->color);
	}

	int nitems = def.NumItems();
	for (int i = 0; i < nitems; i++)
	ctrl->AddItem(def.GetItem(i));

	Font* f = FontMgr::Find(def.GetFont());
	if (f) ctrl->SetFont(f);
}