本文整理汇总了C++中ToggleButton::setBounds方法的典型用法代码示例。如果您正苦于以下问题:C++ ToggleButton::setBounds方法的具体用法?C++ ToggleButton::setBounds怎么用?C++ ToggleButton::setBounds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ToggleButton
的用法示例。
在下文中一共展示了ToggleButton::setBounds方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resized
void resized()
{
// lay out the list box and vertical divider..
Component* vcomps[] = { listBox, verticalDividerBar, 0 };
verticalLayout.layOutComponents (vcomps, 3,
4, 4, getWidth() - 8, getHeight() - 8,
false, // lay out side-by-side
true); // resize the components' heights as well as widths
// now lay out the text box and the controls below it..
int x = verticalLayout.getItemCurrentPosition (2) + 4;
textBox->setBounds (x, 0, getWidth() - x, getHeight() - 110);
x += 70;
sizeSlider->setBounds (x, getHeight() - 106, getWidth() - x, 22);
kerningSlider->setBounds (x, getHeight() - 82, getWidth() - x, 22);
horizontalScaleSlider->setBounds (x, getHeight() - 58, getWidth() - x, 22);
boldButton->setBounds (x, getHeight() - 34, (getWidth() - x) / 2, 22);
italicButton->setBounds (x + (getWidth() - x) / 2, getHeight() - 34, (getWidth() - x) / 2, 22);
}
示例2: Component
EngineParameterComponent::EngineParameterComponent(EngineParameter ¶m)
: Component(param.name), type(param.type), parameter(param)
{
if (param.type == EngineParameter::BOOL)
{
ToggleButton* but = new ToggleButton();
but->setToggleState(param.boolParam.value,dontSendNotification);
but->setBounds(120,0,20,20);
addAndMakeVisible(but);
control = but;
}
else
{
Label* lab = new Label();
lab->setFont(Font("Small Text",10,Font::plain));
switch (param.type)
{
case EngineParameter::INT:
lab->setText(String(param.intParam.value),dontSendNotification);
lab->setBounds(120,0,50,20);
break;
case EngineParameter::FLOAT:
lab->setText(String(param.floatParam.value),dontSendNotification);
lab->setBounds(120,0,50,20);
break;
case EngineParameter::STR:
lab->setText(String(param.strParam.value),dontSendNotification);
lab->setBounds(120,0,150,20);
}
lab->setEditable(true);
lab->setColour(Label::ColourIds::backgroundColourId,Colours::lightgrey);
lab->setColour(Label::ColourIds::outlineColourId,Colours::black);
lab->addListener(this);
addAndMakeVisible(lab);
control = lab;
}
}
示例3: TextValidator
void
SettingsWindow::setUpStandardFields(int & widthSoFar,
int & heightSoFar)
{
ODL_OBJENTER(); //####
ODL_P2("widthSoFar = ", &widthSoFar, "heightSoFar = ", &heightSoFar); //####
Component * content = getContentComponent();
int buttonHeight = GetButtonHeight();
Point<int> dimensions;
size_t numDescriptors = _descriptors.size();
widthSoFar = heightSoFar = 0;
_topText.setFont(_regularFont);
if ((0 < numDescriptors) || _canSetEndpoint || _canSetPort || _canSetTag || _canUseModifier)
{
_topText.setText(String("The ") + _execType + " has one or more arguments, that need to be "
"provided before it can be launched.", dontSendNotification);
}
else
{
_topText.setText(String("The ") + _execType + " has no arguments or options, so it can be "
"launched right now.", dontSendNotification);
}
CommonVisuals::CalculateTextArea(dimensions, _regularFont, _topText.getText());
_topText.setBounds(FormField::kButtonGap, FormField::kButtonGap + getTitleBarHeight(),
dimensions.getX() + FormField::kButtonGap, dimensions.getY());
content->addAndMakeVisible(&_topText, 0);
heightSoFar = _topText.getY() + _topText.getHeight() + FormField::kButtonGap;
widthSoFar = jmax(widthSoFar, _topText.getX() + _topText.getWidth());
if (_canSetEndpoint)
{
_endpointField = new CaptionedTextField(*this, _regularFont, _errorFont, 0,
"(Optional) Endpoint to use", heightSoFar, false,
false, NULL,
new TextValidator(*_endpointDescriptor),
kEndpointFieldName);
_endpointField->addToComponent(content);
widthSoFar = jmax(widthSoFar, _endpointField->getMinimumWidth());
heightSoFar = (_endpointField->getY() + _endpointField->getHeight() +
(FormField::kButtonGap / 2));
}
if (_canSetPort)
{
_portField = new CaptionedTextField(*this, _regularFont, _errorFont, 0,
"(Optional) Network port to use", heightSoFar, false,
false, NULL, new TextValidator(*_portDescriptor),
kPortFieldName);
_portField->addToComponent(content);
widthSoFar = jmax(widthSoFar, _portField->getMinimumWidth());
heightSoFar = _portField->getY() + _portField->getHeight() + (FormField::kButtonGap / 2);
}
if (_canSetTag)
{
_tagField = new CaptionedTextField(*this, _regularFont, _errorFont, 0,
String("(Optional) Tag for the ") + _execType,
heightSoFar, false, false, NULL, NULL, kTagFieldName);
_tagField->addToComponent(content);
widthSoFar = jmax(widthSoFar, _tagField->getMinimumWidth());
heightSoFar = _tagField->getY() + _tagField->getHeight() + (FormField::kButtonGap / 2);
}
if (_canUseModifier)
{
_tagModifierGroup = new GroupComponent("", "(Optional) Tag modifier");
_tagModifierGroup->setBounds(FormField::kFieldInset, heightSoFar,
widthSoFar - (FormField::kButtonGap +
FormField::kFieldInset),
static_cast<int>(2 * _regularFont.getHeight()) +
FormField::kButtonGap);
for (int ii = 0; 4 >= ii; ++ii)
{
ToggleButton * tb = new ToggleButton(String(ii) + ((1 == ii) ? " byte" : " bytes"));
_tagModifierGroup->addAndMakeVisible(tb);
_tagModifierButtons.add(tb);
tb->setComponentID(String(ii));
tb->setRadioGroupId(kTagModifierGroupId);
tb->setBounds(FormField::kFieldInset + (kTagModifierButtonWidth * ii),
FormField::kButtonGap + static_cast<int>(_regularFont.getHeight() / 2),
kTagModifierButtonWidth, static_cast<int>(_regularFont.getHeight()));
tb->setTooltip("Modify tag with " + String(ii) + ((1 == ii) ?
" byte of the IP address" :
" bytes of the IP address"));
if (0 == ii)
{
tb->setToggleState(true, dontSendNotification);
}
}
content->addAndMakeVisible(_tagModifierGroup);
heightSoFar = (_tagModifierGroup->getY() + _tagModifierGroup->getHeight() +
(FormField::kButtonGap / 2));
widthSoFar = jmax(widthSoFar, _tagModifierGroup->getX() +
_tagModifierGroup->getWidth());
}
// Check for one or more file descriptors.
for (size_t ii = 0; numDescriptors > ii; ++ii)
{
bool forOutput;
//.........这里部分代码省略.........
示例4: CContourCurveEditor
CContourCurveEditor ()
{
m_presetCombo = new ComboBox;
m_presetCombo->setBounds (73, 10, 217, 22);
addAndMakeVisible (m_presetCombo);
m_curveEditor = new CContourEditor;
m_curveEditor->setBounds (20, 62, 260, 260);
addAndMakeVisible (m_curveEditor);
{
Label* c = new Label (String::empty, "In:");
c->setBounds (20, 332, 48, 20);
c->setJustificationType (Justification::right);
addAndMakeVisible (c);
}
m_inEdit = new TextEditor;
m_inEdit->setBounds (73, 332, 67, 20);
addAndMakeVisible (m_inEdit);
{
Label* c = new Label (String::empty, "Out:");
c->setBounds (20, 364, 48, 20);
c->setJustificationType (Justification::right);
addAndMakeVisible (c);
}
m_outEdit = new TextEditor;
m_outEdit->setBounds (73, 364, 67, 20);
addAndMakeVisible (m_outEdit);
m_cornerCheck = new ToggleButton ("Corner");
m_cornerCheck->setBounds (166, 347, 120, 24);
addAndMakeVisible (m_cornerCheck);
m_btnOK = new TextButton ("OK");
m_btnOK->setBounds (306, 11, 76, 18);
m_btnOK->addListener (this);
addAndMakeVisible (m_btnOK);
m_btnReset = new TextButton ("Reset");
m_btnReset->setBounds (306, 39, 76, 18);
m_btnReset->addListener (this);
addAndMakeVisible (m_btnReset);
m_btnLoad = new TextButton ("Load...");
m_btnLoad->setBounds (306, 67, 76, 18);
m_btnLoad->addListener (this);
addAndMakeVisible (m_btnLoad);
m_btnSave = new TextButton ("Save...");
m_btnSave->setBounds (306, 105, 76, 18);
m_btnSave->addListener (this);
addAndMakeVisible (m_btnSave);
m_btnNew = new TextButton ("New...");
m_btnNew->setBounds (306, 133, 76, 18);
m_btnNew->addListener (this);
addAndMakeVisible (m_btnNew);
setSize (393, 406);
}