本文整理汇总了C++中TextEditor::setReturnKeyStartsNewLine方法的典型用法代码示例。如果您正苦于以下问题:C++ TextEditor::setReturnKeyStartsNewLine方法的具体用法?C++ TextEditor::setReturnKeyStartsNewLine怎么用?C++ TextEditor::setReturnKeyStartsNewLine使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextEditor
的用法示例。
在下文中一共展示了TextEditor::setReturnKeyStartsNewLine方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FontsAndTextDemo
//==============================================================================
FontsAndTextDemo()
{
setName (T("Fonts"));
Font::findFonts (fonts);
addAndMakeVisible (listBox = new ListBox (T("fonts"), this));
listBox->setRowHeight (28);
addAndMakeVisible (textBox = new TextEditor());
textBox->setColour (TextEditor::backgroundColourId, Colours::white);
textBox->setColour (TextEditor::outlineColourId, Colours::black.withAlpha (0.5f));
textBox->setMultiLine (true, true);
textBox->setReturnKeyStartsNewLine (true);
textBox->setText (T("The Quick Brown Fox Jumps Over The Lazy Dog\n\nAa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz 0123456789"));
addAndMakeVisible (boldButton = new ToggleButton (T("bold")));
boldButton->addButtonListener (this);
addAndMakeVisible (italicButton = new ToggleButton (T("italic")));
italicButton->addButtonListener (this);
addAndMakeVisible (sizeSlider = new Slider ("Size"));
sizeSlider->setRange (3.0, 150.0, 0.1);
sizeSlider->setValue (20.0);
sizeSlider->addListener (this);
(new Label (String::empty, sizeSlider->getName()))->attachToComponent (sizeSlider, true);
addAndMakeVisible (kerningSlider = new Slider ("Kerning"));
kerningSlider->setRange (-1.0, 1.0, 0.01);
kerningSlider->setValue (0.0);
kerningSlider->addListener (this);
(new Label (String::empty, kerningSlider->getName()))->attachToComponent (kerningSlider, true);
addAndMakeVisible (horizontalScaleSlider = new Slider ("Stretch"));
horizontalScaleSlider->setRange (0.1, 4.0, 0.01);
horizontalScaleSlider->setValue (1.0);
horizontalScaleSlider->addListener (this);
(new Label (String::empty, horizontalScaleSlider->getName()))->attachToComponent (horizontalScaleSlider, true);
for (int i = 0; i < fonts.size(); ++i)
{
if (fonts[i]->getTypefaceName().startsWithIgnoreCase (T("Arial")))
{
listBox->selectRow (i);
break;
}
}
listBox->setColour (ListBox::outlineColourId, Colours::black.withAlpha (0.5f));
listBox->setOutlineThickness (1);
// set up the layout and resizer bars..
verticalLayout.setItemLayout (0, -0.2, -0.8, -0.5); // width of the font list must be
// between 20% and 80%, preferably 50%
verticalLayout.setItemLayout (1, 8, 8, 8); // the vertical divider drag-bar thing is always 8 pixels wide
verticalLayout.setItemLayout (2, 150, -1.0, -0.5); // the components on the right must be
// at least 150 pixels wide, preferably 50% of the total width
verticalDividerBar = new StretchableLayoutResizerBar (&verticalLayout, 1, true);
addAndMakeVisible (verticalDividerBar);
horizontalLayout.setItemLayout (0, -0.2, -1.0, -0.4); // height of the font text box must be
// between 20% and 100%, preferably 40%
horizontalLayout.setItemLayout (1, 8, 8, 8); // the horizontal divider drag-bar thing is always 8 pixels high
horizontalLayout.setItemLayout (2, 2, 5, 5); // a gap between the controls
horizontalLayout.setItemLayout (3, 15, 20, 20); // the italic button would like to be 20 pixels high
horizontalLayout.setItemLayout (4, 2, 5, 5); // a gap between the controls
horizontalLayout.setItemLayout (5, 15, 20, 20); // the bold button would like to be 20 pixels high
horizontalLayout.setItemLayout (6, 2, 5, 5); // a gap between the controls
horizontalLayout.setItemLayout (7, 15, 20, 20); // the italic button would like to be 20 pixels high
horizontalLayout.setItemLayout (8, 2, 5, 5); // a gap between the controls
horizontalLayout.setItemLayout (9, 15, 20, 20); // the copy code button would like to be 20 pixels high
horizontalLayout.setItemLayout (10, 5, -1.0, 5); // add a gap at the bottom that will fill up any
// space left over - this will stop the
// sliders from always sticking to the
// bottom of the window
}