當前位置: 首頁>>代碼示例>>C++>>正文


C++ AddDialogItem函數代碼示例

本文整理匯總了C++中AddDialogItem函數的典型用法代碼示例。如果您正苦於以下問題:C++ AddDialogItem函數的具體用法?C++ AddDialogItem怎麽用?C++ AddDialogItem使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了AddDialogItem函數的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: AddDialogItem

DialogItemEx *DialogBuilder::AddListControl(FARDIALOGITEMTYPES Type, IntOption& Value, string *Text, int Width, int Height, const std::vector<FarDialogBuilderListItem2> &Items, FARDIALOGITEMFLAGS Flags)
{
	const auto Item = AddDialogItem(Type, Text ? Text->c_str() : L"");
	SetNextY(Item);
	Item->X2 = Item->X1 + Width;
	Item->Y2 = Item->Y1 + Height;
	Item->Flags |= DIF_DROPDOWNLIST|Flags;

	m_NextY += Height;

	const auto ListItems = new FarListItem[Items.size()];
	std::transform(ALL_CONST_RANGE(Items), ListItems, [&Value](const auto& i)
	{
		FarListItem NewItem = {};
		NewItem.Text = i.Text.c_str();
		NewItem.Flags = i.Flags | ((Value == i.ItemValue)? LIF_SELECTED : 0);
		NewItem.UserData = i.ItemValue;
		return NewItem;
	});
	const auto List = new FarList;
	List->StructSize = sizeof(FarList);
	List->Items = ListItems;
	List->ItemsNumber = Items.size();
	Item->ListItems = List;

	SetLastItemBinding(new FarListControlBinding<IntOption>(Value, Text, List));
	return Item;
}
開發者ID:FarGroup,項目名稱:FarManager,代碼行數:28,代碼來源:FarDlgBuilder.cpp

示例2: AddSeparator

		void AddSeparator(const wchar_t* Text)
		{
			T *Separator = AddDialogItem(DI_TEXT, Text);
			Separator->Flags = DIF_SEPARATOR;
			Separator->X1 = -1;
			Separator->Y1 = Separator->Y2 = m_NextY++;
		}
開發者ID:brucewu16899,項目名稱:cmder-1,代碼行數:7,代碼來源:DlgBuilder.hpp

示例3: AddDialogItem

DialogItemEx *DialogBuilder::AddListControl(FARDIALOGITEMTYPES Type, int& Value, string *Text, int Width, int Height, const DialogBuilderListItem *Items, size_t ItemCount, FARDIALOGITEMFLAGS Flags)
{
	const auto Item = AddDialogItem(Type, Text ? Text->data() : L"");
	SetNextY(Item);
	Item->X2 = Item->X1 + Width;
	Item->Y2 = Item->Y1 + Height;
	Item->Flags |= Flags;

	m_NextY += Height;

	const auto ListItems = Items? new FarListItem[ItemCount] : nullptr;
	if (Items)
	{
		std::transform(Items, Items + ItemCount, ListItems, [&Value](const DialogBuilderListItem& Item) -> FarListItem
		{
			FarListItem NewItem = {};
			NewItem.Text = MSG(static_cast<LNGID>(Item.MessageId));
			NewItem.Flags = (Value == Item.ItemValue)? LIF_SELECTED : 0;
			NewItem.Reserved[0] = Item.ItemValue;
			return NewItem;
		});
	}
	const auto List = new FarList;
	List->StructSize = sizeof(FarList);
	List->Items = ListItems;
	List->ItemsNumber = ItemCount;
	Item->ListItems = List;

	SetLastItemBinding(new ListControlBinding<DialogItemEx>(Value, Text, List));
	return Item;
}
開發者ID:Maximus5,項目名稱:Far3bis,代碼行數:31,代碼來源:FarDlgBuilder.cpp

示例4: AddButtons

		// Добавляет линейку кнопок.
		void AddButtons(int ButtonCount, const int* MessageIDs, int defaultButtonIndex = 0, int cancelButtonIndex = -1)
		{
			int LineY = m_NextY++;
			T *PrevButton = nullptr;

			for (int i = 0; i < ButtonCount; i++)
			{
				T *NewButton = AddDialogItem(DI_BUTTON, GetLangString(MessageIDs[i]));
				NewButton->Flags = DIF_CENTERGROUP;
				NewButton->Y1 = NewButton->Y2 = LineY;
				if (PrevButton)
				{
					NewButton->X1 = PrevButton->X2 + 1;
				}
				else
				{
					NewButton->X1 = 2 + m_Indent;
					m_FirstButtonID = m_DialogItemsCount - 1;
				}
				NewButton->X2 = NewButton->X1 + ItemWidth(*NewButton);

				if (defaultButtonIndex == i)
				{
					NewButton->Flags |= DIF_DEFAULTBUTTON;
				}
				if (cancelButtonIndex == i)
					m_CancelButtonID = m_DialogItemsCount - 1;

				PrevButton = NewButton;
			}
		}
開發者ID:brucewu16899,項目名稱:cmder-1,代碼行數:32,代碼來源:DlgBuilder.hpp

示例5: AddSeparator

		// Добавляет сепаратор.
		void AddSeparator(int MessageId=-1)
		{
			T *Separator = AddDialogItem(DI_TEXT, MessageId == -1 ? L"" : GetLangString(MessageId));
			Separator->Flags = DIF_SEPARATOR;
			Separator->X1 = 3;
			Separator->Y1 = Separator->Y2 = NextY++;
		}
開發者ID:landswellsong,項目名稱:FAR,代碼行數:8,代碼來源:DlgBuilder.hpp

示例6: AddDialogItem

		FarDialogItem *AddListControl(FARDIALOGITEMTYPES Type, int *SelectedItem, wchar_t *Text, int Width, int Height, const wchar_t* ItemsText [], size_t ItemCount, FARDIALOGITEMFLAGS ItemFlags)
		{
			FarDialogItem *Item = AddDialogItem(Type, Text ? Text : L"");
			SetNextY(Item);
			Item->X2 = Item->X1 + Width;
			Item->Y2 = Item->Y2 + Height;
			Item->Flags |= ItemFlags;

			m_NextY += Height;

			FarListItem *ListItems = nullptr;
			if (ItemsText)
			{
				ListItems = new FarListItem[ItemCount];
				for(size_t i=0; i<ItemCount; i++)
				{
					ListItems[i].Text = ItemsText[i];
					ListItems[i].Flags = SelectedItem && (*SelectedItem == static_cast<int>(i)) ? LIF_SELECTED : 0;
				}
			}
			FarList *List = new FarList;
			List->StructSize = sizeof(FarList);
			List->Items = ListItems;
			List->ItemsNumber = ListItems ? ItemCount : 0;
			Item->ListItems = List;

			SetLastItemBinding(new PluginListControlBinding(Info, &DialogHandle, m_DialogItemsCount - 1, SelectedItem, Text, List));
			return Item;
		}
開發者ID:brucewu16899,項目名稱:cmder-1,代碼行數:29,代碼來源:DlgBuilder.hpp

示例7: AddOKCancel

		// Добавляет сепаратор, кнопки OK и Cancel.
		void AddOKCancel(int OKMessageId, int CancelMessageId, bool Separator=true)
		{
			if (Separator)
				AddSeparator();

			T *OKButton = AddDialogItem(DI_BUTTON, GetLangString(OKMessageId));
			OKButton->Flags = DIF_CENTERGROUP|DIF_DEFAULTBUTTON;
			OKButton->Y1 = OKButton->Y2 = NextY++;
			OKButtonID = DialogItemsCount-1;

			if(CancelMessageId != -1)
			{
				T *CancelButton = AddDialogItem(DI_BUTTON, GetLangString(CancelMessageId));
				CancelButton->Flags = DIF_CENTERGROUP;
				CancelButton->Y1 = CancelButton->Y2 = OKButton->Y1;
			}
		}
開發者ID:landswellsong,項目名稱:FAR,代碼行數:18,代碼來源:DlgBuilder.hpp

示例8: StartSingleBox

		// Начинает располагать поля диалога внутри single box
		void StartSingleBox(int MessageId=-1, bool LeftAlign=false)
		{
			T *SingleBox = AddDialogItem(DI_SINGLEBOX, MessageId == -1 ? L"" : GetLangString(MessageId));
			SingleBox->Flags = LeftAlign ? DIF_LEFTTEXT : DIF_NONE;
			SingleBox->X1 = 5;
			SingleBox->Y1 = m_NextY++;
			m_Indent = 2;
			m_SingleBoxIndex = m_DialogItemsCount - 1;
		}
開發者ID:brucewu16899,項目名稱:cmder-1,代碼行數:10,代碼來源:DlgBuilder.hpp

示例9: AddDialogItem

DialogItemEx *DialogBuilder::AddEditField(string *Value, int Width, const wchar_t *HistoryID, int Flags)
{
	DialogItemEx *Item = AddDialogItem(DI_EDIT, *Value);
	SetNextY(Item);
	Item->X2 = Item->X1 + Width;
	if (HistoryID)
	{
		Item->strHistory = HistoryID;
		Item->Flags |= DIF_HISTORY;
	}
	Item->Flags |= Flags;

	SetLastItemBinding(new EditFieldBinding(Value));
	return Item;
}
開發者ID:alexlav,項目名稱:conemu,代碼行數:15,代碼來源:DlgBuilder.cpp


注:本文中的AddDialogItem函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。