FarDialogItem *AddListControl(FARDIALOGITEMTYPES Type, int *SelectedItem, wchar_t *Text, int Width, int Height, const int MessageIDs [], size_t ItemCount, FARDIALOGITEMFLAGS ItemFlags) { const wchar_t** ItemsText = nullptr; if (MessageIDs) { ItemsText = new const wchar_t*[ItemCount]; for (size_t i = 0; i < ItemCount; i++) { ItemsText[i] = GetLangString(MessageIDs[i]); } } FarDialogItem* result = AddListControl(Type, SelectedItem, Text, Width, Height, ItemsText, ItemCount, ItemFlags); delete [] ItemsText; return result; }
FarDialogItem *AddListBox(int *SelectedItem, int Width, int Height, const int MessageIDs[], size_t ItemCount, FARDIALOGITEMFLAGS ItemFlags) { return AddListControl(DI_LISTBOX, SelectedItem, nullptr, Width, Height, MessageIDs, ItemCount, ItemFlags); }
FarDialogItem *AddComboBox(int *SelectedItem, wchar_t *Text, int Width, const int MessageIDs[], size_t ItemCount, FARDIALOGITEMFLAGS ItemFlags) { return AddListControl(DI_COMBOBOX, SelectedItem, Text, Width, 0, MessageIDs, ItemCount, ItemFlags); }
DialogItemEx *DialogBuilder::AddListBox(IntOption& Value, int Width, int Height, const std::vector<FarDialogBuilderListItem2> &Items, FARDIALOGITEMFLAGS Flags) { return AddListControl(DI_LISTBOX, Value, nullptr, Width, Height, Items, Flags); }
DialogItemEx *DialogBuilder::AddListBox(IntOption& Value, int Width, int Height, const FarDialogBuilderListItem *Items, size_t ItemCount, FARDIALOGITEMFLAGS Flags) { return AddListControl(DI_LISTBOX, Value, nullptr, Width, Height, Items, ItemCount, Flags); }
DialogItemEx *DialogBuilder::AddComboBox(IntOption& Value, string *Text, int Width, const std::vector<FarDialogBuilderListItem2> &Items, FARDIALOGITEMFLAGS Flags) { return AddListControl(DI_COMBOBOX, Value, Text, Width, 0, Items, Flags); }
DialogItemEx *DialogBuilder::AddComboBox(IntOption& Value, string *Text, int Width, const FarDialogBuilderListItem *Items, size_t ItemCount, FARDIALOGITEMFLAGS Flags) { return AddListControl(DI_COMBOBOX, Value, Text, Width, 0, Items, ItemCount, Flags); }