当前位置: 首页>>代码示例>>C++>>正文


C++ ParagraphStyle::SetBullet方法代码示例

本文整理汇总了C++中ParagraphStyle::SetBullet方法的典型用法代码示例。如果您正苦于以下问题:C++ ParagraphStyle::SetBullet方法的具体用法?C++ ParagraphStyle::SetBullet怎么用?C++ ParagraphStyle::SetBullet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParagraphStyle的用法示例。


在下文中一共展示了ParagraphStyle::SetBullet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: frame


//.........这里部分代码省略.........
		.Add(toolBar)
		.Add(scrollView)
		.SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED))
		.Add(statusBar)

	;

	CharacterStyle regularStyle;

	float fontSize = regularStyle.Font().Size();

	ParagraphStyle paragraphStyle;
	paragraphStyle.SetJustify(true);
	paragraphStyle.SetSpacingTop(ceilf(fontSize * 0.6f));
	paragraphStyle.SetLineSpacing(ceilf(fontSize * 0.2f));

	CharacterStyle boldStyle(regularStyle);
	boldStyle.SetBold(true);

	CharacterStyle italicStyle(regularStyle);
	italicStyle.SetItalic(true);

	CharacterStyle italicAndBoldStyle(boldStyle);
	italicAndBoldStyle.SetItalic(true);

	CharacterStyle bigStyle(regularStyle);
	bigStyle.SetFontSize(24);
	bigStyle.SetBold(true);
	bigStyle.SetForegroundColor(255, 50, 50);

	TextDocumentRef document(new TextDocument(), true);

	Paragraph paragraph(paragraphStyle);
	paragraph.Append(TextSpan("This is a", regularStyle));
	paragraph.Append(TextSpan(" test ", bigStyle));
	paragraph.Append(TextSpan("to see if ", regularStyle));
	paragraph.Append(TextSpan("different", boldStyle));
	paragraph.Append(TextSpan(" character styles already work.", regularStyle));
	document->Append(paragraph);

	paragraphStyle.SetSpacingTop(8.0f);
	paragraphStyle.SetAlignment(ALIGN_CENTER);
	paragraphStyle.SetJustify(false);

	paragraph = Paragraph(paragraphStyle);
	paragraph.Append(TextSpan("Different alignment styles ", regularStyle));
	paragraph.Append(TextSpan("are", boldStyle));
	paragraph.Append(TextSpan(" supported as of now!", regularStyle));
	document->Append(paragraph);

	paragraphStyle.SetAlignment(ALIGN_RIGHT);
	paragraphStyle.SetJustify(true);

	paragraph = Paragraph(paragraphStyle);
	paragraph.Append(TextSpan("I am on the ", regularStyle));
	paragraph.Append(TextSpan("Right", boldStyle));
	paragraph.Append(TextSpan("Side", italicStyle));
	document->Append(paragraph);

	// Test a bullet list
	paragraphStyle.SetSpacingTop(8.0f);
	paragraphStyle.SetAlignment(ALIGN_LEFT);
	paragraphStyle.SetJustify(true);
	paragraphStyle.SetBullet(Bullet("->", 12.0f));
	paragraphStyle.SetLineInset(10.0f);

	paragraph = Paragraph(paragraphStyle);
	paragraph.Append(TextSpan("Even bullet lists are supported.", regularStyle));
	document->Append(paragraph);

	paragraph = Paragraph(paragraphStyle);
	paragraph.Append(TextSpan("The wrapping in ", regularStyle));
	paragraph.Append(TextSpan("this", italicStyle));

	paragraph.Append(TextSpan(" bullet item should look visually "
		"pleasing. And ", regularStyle));
	paragraph.Append(TextSpan("why", italicAndBoldStyle));
	paragraph.Append(TextSpan(" should it not?", regularStyle));
	document->Append(paragraph);

/*	MarkupParser parser(regularStyle, paragraphStyle);

	TextDocumentRef document = parser.CreateDocumentFromMarkup(
		"== Text document test ==\n"
		"This is a test to see if '''different''' "
		"character styles already work.\n"
		"Different alignment styles '''are''' supported as of now!\n"
		" * Even bullet lists are supported.\n"
		" * The wrapping in ''this'' bullet item should look visually "
		"pleasing. And ''why'' should it not?\n"
	);*/

	documentView->SetTextDocument(document);
	documentView->SetTextEditor(TextEditorRef(new TextEditor(), true));
	documentView->MakeFocus();

	window->Show();
	FontPanel *fPanel = new FontPanel();
	fPanel->Show();	
}
开发者ID:Paradoxianer,项目名称:StyledEditPlus,代码行数:101,代码来源:TextDocumentTest.cpp


注:本文中的ParagraphStyle::SetBullet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。