本文整理汇总了C++中Label::attachToComponent方法的典型用法代码示例。如果您正苦于以下问题:C++ Label::attachToComponent方法的具体用法?C++ Label::attachToComponent怎么用?C++ Label::attachToComponent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Label
的用法示例。
在下文中一共展示了Label::attachToComponent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createFileCreationOptionComboBox
static void createFileCreationOptionComboBox (Component& setupComp,
OwnedArray<Component>& itemsCreated,
const char** fileOptions)
{
ComboBox* c = new ComboBox();
itemsCreated.add (c);
setupComp.addChildAndSetID (c, "filesToCreate");
c->addItemList (StringArray (fileOptions), 1);
c->setSelectedId (1, false);
Label* l = new Label (String::empty, "Files to Auto-Generate:");
l->attachToComponent (c, true);
itemsCreated.add (l);
c->setBounds ("parent.width / 2 + 160, 10, parent.width - 10, top + 22");
}
示例2: if
BEGIN_JUCE_NAMESPACE
#include "juce_FileBrowserComponent.h"
#include "../lookandfeel/juce_LookAndFeel.h"
#include "../../graphics/drawables/juce_DrawablePath.h"
#include "../../../text/juce_LocalisedStrings.h"
#include "../../../core/juce_SystemStats.h"
#include "juce_FileListComponent.h"
#include "juce_FileTreeComponent.h"
//==============================================================================
FileBrowserComponent::FileBrowserComponent (int flags_,
const File& initialFileOrDirectory,
const FileFilter* fileFilter_,
FilePreviewComponent* previewComp_)
: FileFilter (String::empty),
fileFilter (fileFilter_),
flags (flags_),
previewComp (previewComp_),
thread ("Juce FileBrowser")
{
// You need to specify one or other of the open/save flags..
jassert ((flags & (saveMode | openMode)) != 0);
jassert ((flags & (saveMode | openMode)) != (saveMode | openMode));
// You need to specify at least one of these flags..
jassert ((flags & (canSelectFiles | canSelectDirectories)) != 0);
String filename;
if (initialFileOrDirectory == File::nonexistent)
{
currentRoot = File::getCurrentWorkingDirectory();
}
else if (initialFileOrDirectory.isDirectory())
{
currentRoot = initialFileOrDirectory;
}
else
{
chosenFiles.add (new File (initialFileOrDirectory));
currentRoot = initialFileOrDirectory.getParentDirectory();
filename = initialFileOrDirectory.getFileName();
}
fileList = new DirectoryContentsList (this, thread);
if ((flags & useTreeView) != 0)
{
FileTreeComponent* const tree = new FileTreeComponent (*fileList);
if ((flags & canSelectMultipleItems) != 0)
tree->setMultiSelectEnabled (true);
addAndMakeVisible (tree);
fileListComponent = tree;
}
else
{
FileListComponent* const list = new FileListComponent (*fileList);
list->setOutlineThickness (1);
if ((flags & canSelectMultipleItems) != 0)
list->setMultipleSelectionEnabled (true);
addAndMakeVisible (list);
fileListComponent = list;
}
fileListComponent->addListener (this);
addAndMakeVisible (currentPathBox = new ComboBox ("path"));
currentPathBox->setEditableText (true);
StringArray rootNames, rootPaths;
const BitArray separators (getRoots (rootNames, rootPaths));
for (int i = 0; i < rootNames.size(); ++i)
{
if (separators [i])
currentPathBox->addSeparator();
currentPathBox->addItem (rootNames[i], i + 1);
}
currentPathBox->addSeparator();
currentPathBox->addListener (this);
addAndMakeVisible (filenameBox = new TextEditor());
filenameBox->setMultiLine (false);
filenameBox->setSelectAllWhenFocused (true);
filenameBox->setText (filename, false);
filenameBox->addListener (this);
filenameBox->setReadOnly ((flags & (filenameBoxIsReadOnly | canSelectMultipleItems)) != 0);
Label* label = new Label ("f", TRANS("file:"));
addAndMakeVisible (label);
label->attachToComponent (filenameBox, true);
//.........这里部分代码省略.........
示例3: InitializeParams
uint32_t TmpSndDawAudioProcessorEditor::InitializeParams()
{
Array<Parameter*, CriticalSection>* p = mProcessor->GetParametersArray();
String currentInstName;
mInstLabels.clear();
mParamLabels.clear();
mSliders.clear();
mInstructions = nullptr;
mLogoComponent = new ImageComponent();
mLogoComponent->setImage(mLogo);
addAndMakeVisible(mLogoComponent);
uint32_t currentParamCount = 0;
uint32_t maxParams = 0;
// params are ordered by instruments in the array, because they come form the
// json. we keep the current instrument index, so we can then map params to
// instrument to do the layout properly.
uint32_t currentInstIndex = -1;
for (uint32_t i = 0; i < p->size(); i++) {
// sliders
Slider* s = new Slider();
s->setSliderStyle(Slider::LinearHorizontal);
s->setRange((*p)[i]->mMin,(*p)[i]->mMax, (*p)[i]->mStep);
// text size: letter width * log(max) + log(1/step) ?
s->setTextBoxStyle (Slider::TextBoxRight, false, 30, 20);
s->setValue((*p)[i]->mDefault);
s->addListener(new SliderValueListener(this));
s->setLookAndFeel(mLookAndFeel);
// instrument label
uint32_t index_param = (*p)[i]->mName.indexOfChar(' ');
String instName = (*p)[i]->mName.substring(0, index_param);
if (instName != currentInstName) {
currentInstIndex++;
Label* l = new Label();
currentInstName = instName;
l->setText(currentInstName, dontSendNotification);
addAndMakeVisible(l);
mInstLabels.add(l);
if (currentParamCount > maxParams) {
maxParams = currentParamCount;
currentParamCount = 0;
}
}
// parameters label
String paramName = (*p)[i]->mName.substring(index_param);
Label* l = new Label();
l->setText(paramName, dontSendNotification);
l->attachToComponent(s, false);
mInstMapping.add(currentInstIndex);
addAndMakeVisible(l);
addAndMakeVisible(s);
mSliders.add(s);
mParamLabels.add(l);
currentParamCount++;
}
// we haven't received configuration data now, display a friendly message
// with instructions
if (maxParams == 0 && p->size() == 0) {
mInstructions = new Label();
mInstructions->setText(INSTRUCTIONS, dontSendNotification);
addAndMakeVisible(mInstructions);
}
return maxParams;
}