//************************************************************************* // Method: GetItemInstance // Description: Gets the SIOptionInstance object for a given SIOption // // Parameters: // item - Item to query // // Return Value: SIOptionInstance object //************************************************************************* SIOptionInstance* SIOptionsListView::GetItemInstance(SIOption* item) { SIOptionInstance* instance = dynamic_cast<SIOptionInstance*>(itemInstance->Item[item]); if (instance) return instance; instance = new SIOptionInstance(); // Create the control for editing the setting ComboBox* comboBox; TextBox* textBox; switch (item->type) { case SIOptionType::BooleanOption: comboBox = new ComboBox(); comboBox->DropDownStyle = ComboBoxStyle::DropDownList; comboBox->Items->Add(S"Disabled"); comboBox->Items->Add(S"Enabled"); comboBox->SelectedIndex = 0; comboBox->SelectedIndexChanged += new EventHandler(this, OnItemTextChanged); instance->control = comboBox; break; case SIOptionType::IntegerOption: textBox = new TextBox(); textBox->Text = "0"; textBox->Select(0, 0); textBox->TextChanged += new EventHandler(this, OnItemTextChanged); instance->control = textBox; break; case SIOptionType::StringOption: textBox = new TextBox(); textBox->Text = ""; textBox->Select(0, 0); textBox->TextChanged += new EventHandler(this, OnItemTextChanged); instance->control = textBox; break; } instance->control->Location = System::Drawing::Point(0, 0); instance->control->Width = controlHeader->Width; itemInstance->Add(item, instance); return instance; }