本文整理汇总了C++中CheckBox类的典型用法代码示例。如果您正苦于以下问题:C++ CheckBox类的具体用法?C++ CheckBox怎么用?C++ CheckBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CheckBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CheckBox
CheckBox* CheckBox::Create(Window *parent, float x, float y, const string_t &text)
{
CheckBox *res = new CheckBox(parent);
res->Move(x, y);
res->SetText(text);
return res;
}
示例2: setupControls
//-----------------------------------------------------------------------------------
void Sample_Compositor::setupControls(void)
{
mTrayMgr->createButton(TL_TOPLEFT, "PageButton", "Compositors", 175);
for (size_t i=0; i < COMPOSITORS_PER_PAGE; i++)
{
String checkBoxName = "Compositor_" + Ogre::StringConverter::toString(i);
CheckBox* cb = mTrayMgr->createCheckBox(TL_TOPLEFT, checkBoxName, "Compositor", 175);
cb->hide();
}
changePage(0);
mDebugTextureSelectMenu = mTrayMgr->createThickSelectMenu(TL_TOPRIGHT, "DebugRTTSelectMenu", "Debug RTT", 180, 5);
mDebugTextureSelectMenu->addItem("None");
mTrayMgr->createSeparator(TL_TOPRIGHT, "DebugRTTSep1"); // this is a hack to give the debug RTT a bit more room
DecorWidget* debugRTTPanel = mTrayMgr->createDecorWidget(TL_NONE, "DebugRTTPanel", "SdkTrays/Picture");
OverlayContainer* debugRTTContainer = (OverlayContainer*)debugRTTPanel->getOverlayElement();
mDebugTextureTUS = debugRTTContainer->getMaterial()->getBestTechnique()->getPass(0)->getTextureUnitState(0);
//mDebugTextureTUS->setTextureName("CompositorDemo/DebugView");
debugRTTContainer->setDimensions(128, 128);
debugRTTContainer->getChild("DebugRTTPanel/PictureFrame")->setDimensions(144, 144);
debugRTTPanel->hide();
mTrayMgr->createSeparator(TL_TOPRIGHT, "DebugRTTSep2"); // this is a hack to give the debug RTT a bit more room
mTrayMgr->showCursor();
mTrayMgr->showLogo(TL_BOTTOMLEFT);
mTrayMgr->toggleAdvancedFrameStats();
}
示例3: showEvent
void ProjectCreatePopup::showEvent(QShowEvent *) {
int i;
QString fldName;
for (i = 0; i < m_folderFlds.size(); i++) {
fldName = QString::fromStdString(m_folderFlds[i].first);
m_folderFlds[i].second->setPath(fldName);
}
for (i = 0; i < m_useScenePathCbs.size(); i++) {
CheckBox *cb = m_useScenePathCbs[i].second;
bool signalesAlreadyBlocked = cb->blockSignals(true);
cb->setChecked(false);
cb->blockSignals(signalesAlreadyBlocked);
}
m_nameFld->setText("");
// Must refresh the tree.
DvDirModelNode *rootNode = m_model->getNode(QModelIndex());
QModelIndex index = m_model->getIndexByNode(rootNode);
m_model->refreshFolderChild(index);
// Select the first Item in the treeView
QItemSelectionModel *selection = new QItemSelectionModel(m_model);
index = m_model->index(0, 0, QModelIndex());
selection->select(index, QItemSelectionModel::Select);
m_treeView->setSelectionModel(selection);
}
示例4: file
void ZipViewer::show()
{
ViewRender *renderer(m_view.renderer());
renderer->doTitle(nds::File::base(m_view.document().uri().c_str()));
ZipFile file(this);
file.open(m_filename.c_str());
vector<string> contents;
file.list(contents);
m_fileCount = contents.size();
if (not contents.empty())
{
// add an "unzip" button!
Button * unzipButton = new Button(T("unzip"));
unzipButton->setListener(this);
renderer->add(unzipButton);
m_unzip = unzipButton;
renderer->textArea()->appendText(T(" "));
renderer->insertNewline();
}
for (vector<string>::const_iterator it(contents.begin()); it != contents.end(); ++it)
{
const string & u(*it);
CheckBox * cb = new CheckBox;
cb->setSelected();
renderer->add(cb);
m_checkboxes.push_back(cb);
renderer->textArea()->appendText(u);
renderer->insertNewline();
}
}
示例5: lprintfln
void SaveScreen::keyPressEvent(int keyCode, int nativeCode) {
#if DEBUG >= 1
lprintfln("Index: %d (%d / %d)", listBox->getSelectedIndex(), keyCode, nativeCode);
#endif
switch(keyCode) {
case MAK_HASH:
// Hash (#) key - ask the moblet to close the application
maExit(0);
break;
case MAK_LEFT:
case MAK_SOFTRIGHT:
ScreenTransition::makeTransition(this, previous, -1, 400);
break;
case MAK_RIGHT:
case MAK_FIRE:
CheckBox * cb = (CheckBox *)((Label*)listBox->getChildren()[listBox->getSelectedIndex()])->getChildren()[0];
cb->flip();
break;
case MAK_DOWN:
listBox->selectNextItem();
break;
case MAK_UP:
listBox->selectPreviousItem();
break;
}
}
示例6: PrepareConfigurationDialog
static void
PrepareConfigurationDialog()
{
gcc_unused ScopeBusyIndicator busy;
wf = LoadDialog(CallBackTable, XCSoarInterface::main_window,
Layout::landscape ? _T("IDR_XML_CONFIGURATION_L") :
_T("IDR_XML_CONFIGURATION"));
if (wf == NULL)
return;
wf->SetKeyDownNotify(FormKeyDown);
bool expert_mode = false;
Profile::Get(szProfileUserLevel, expert_mode);
CheckBox *cb = (CheckBox *)wf->FindByName(_T("Expert"));
cb->set_checked(expert_mode);
wf->FilterAdvanced(expert_mode);
((WndButton *)wf->FindByName(_T("cmdClose")))->SetOnClickNotify(OnCloseClicked);
configuration_tabbed = ((TabbedControl *)wf->FindByName(_T("tabbed")));
assert(configuration_tabbed != NULL);
setVariables();
/* restore previous page */
configuration_tabbed->SetCurrentPage((unsigned)current_page);
PageSwitched();
}
示例7: CheckBox
void UI::build(const Settings& settings)
{
_checkboxes.push_back(new CheckBox(settings.drawShapes, "Draw shapes"));
/*
_checkboxes.push_back(new CheckBox());
_checkboxes.push_back(new CheckBox());
_checkboxes.push_back(new CheckBox());
_checkboxes.push_back(new CheckBox());
_checkboxes.push_back(new CheckBox());
//*/
/*
sf::Vector2f windowSize(window->getSize());
float xRatio = 0.5 * getSize().x / (float)windowSize.x;
float yRatio = 0.5 * getSize().y / (float)windowSize.y;
text.setScale(sf::Vector2f(xRatio, yRatio));
std::vector<CheckBox*>::iterator it;
for (it=_checkboxes.begin(); it!=_checkboxes.end(); it++)
(*it)->setScale(sf::Vector2f(xRatio, yRatio));
*/
const unsigned int start = 5, step = 15;
for (unsigned int i=0; i<_checkboxes.size(); i++)
{
CheckBox* cb = _checkboxes[i];
cb->setPosition(5, start + i*step);
cb->setPosition(0, 0);
cb->setScale(100, 100);
}
}
示例8: CheckBox
void HelloGUI::InitControls()
{
// Create a CheckBox
CheckBox* checkBox = new CheckBox(context_);
checkBox->SetName("CheckBox");
// Create a Button
Button* button = new Button(context_);
button->SetName("Button");
button->SetMinHeight(24);
// Create a LineEdit
LineEdit* lineEdit = new LineEdit(context_);
lineEdit->SetName("LineEdit");
lineEdit->SetMinHeight(24);
// Add controls to Window
window_->AddChild(checkBox);
window_->AddChild(button);
window_->AddChild(lineEdit);
// Apply previously set default style
checkBox->SetStyleAuto();
button->SetStyleAuto();
lineEdit->SetStyleAuto();
}
示例9: init
bool UICheckBoxCopyTest::init()
{
if (UIScene::init())
{
Size widgetSize = _widget->getContentSize();;
// Add a label in which the checkbox events will be displayed
_displayValueLabel = Text::create("No Event", "fonts/Marker Felt.ttf", 32);
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1));
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
_uiLayer->addChild(_displayValueLabel);
// Add the alert
Text* alert = Text::create("Two checkbox are identical.","fonts/Marker Felt.ttf",20 );
alert->setColor(Color3B(159, 168, 176));
alert->setPosition(Vec2(widgetSize.width / 2.0f,
widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f));
_uiLayer->addChild(alert);
// Create the checkbox
CheckBox* checkBox = CheckBox::create("cocosui/check_box_normal.png",
"cocosui/check_box_active.png");
checkBox->setPosition(Vec2(widgetSize.width / 2.0f - 50, widgetSize.height / 2.0f));
_uiLayer->addChild(checkBox);
auto checkboxCopy = checkBox->clone();
checkboxCopy->setPosition(checkBox->getPosition() + Vec2(50,0));
_uiLayer->addChild(checkboxCopy);
return true;
}
return false;
}
示例10: PrepareConfigurationDialog
static void
PrepareConfigurationDialog()
{
gcc_unused ScopeBusyIndicator busy;
wf = LoadDialog(CallBackTable, UIGlobals::GetMainWindow(),
Layout::landscape ? _T("IDR_XML_CONFIGURATION_L") :
_T("IDR_XML_CONFIGURATION"));
if (wf == NULL)
return;
wf->SetKeyDownNotify(FormKeyDown);
bool expert_mode = CommonInterface::GetUISettings().dialog.expert;
CheckBox *cb = (CheckBox *)wf->FindByName(_T("Expert"));
cb->SetState(expert_mode);
wf->FilterAdvanced(expert_mode);
PrepareConfigurationMenu();
wTabMenu->GotoMenuPage();
/* restore last selected menu item */
static bool Initialized = false;
if (!Initialized)
Initialized = true;
else
wTabMenu->SetLastContentPage(current_page);
}
示例11: init
bool UICheckBoxTest::init()
{
if (UIScene::init())
{
Size widgetSize = _widget->getContentSize();;
// Add a label in which the checkbox events will be displayed
_displayValueLabel = Text::create("No Event", "fonts/Marker Felt.ttf", 32);
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1));
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
_uiLayer->addChild(_displayValueLabel);
// Add the alert
Text* alert = Text::create("CheckBox","fonts/Marker Felt.ttf",30 );
alert->setColor(Color3B(159, 168, 176));
alert->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f));
_uiLayer->addChild(alert);
// Create the checkbox
CheckBox* checkBox = CheckBox::create("cocosui/check_box_normal.png",
"cocosui/check_box_normal_press.png",
"cocosui/check_box_active.png",
"cocosui/check_box_normal_disable.png",
"cocosui/check_box_active_disable.png");
checkBox->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
checkBox->addEventListener(CC_CALLBACK_2(UICheckBoxTest::selectedEvent, this));
_uiLayer->addChild(checkBox);
return true;
}
return false;
}
示例12: CheckBox
CheckBox* CheckBox::create(const char* id, Theme::Style* style)
{
CheckBox* cb = new CheckBox();
cb->_id = id ? id : "";
cb->initialize("CheckBox", style, NULL);
return cb;
}
示例13: CustomControl
ImageRecipe::ImageRecipe(Container *parent) :
CustomControl(parent) {
// Get the UIConfig object in order to use resolution independent sizes.
UIConfig *ui = this->ui();
// Create the ImageView with an image in the assets folder as imageSource.
Container *recipeContainer = Container::create().top(ui->du(2)).left(
ui->du(2)).right(ui->du(2));
DockLayout *recipeContainerLayout = new DockLayout();
recipeContainer->setLayout(recipeContainerLayout);
mImage = ImageView::create("asset:///images/peach_big.png").scalingMethod(
ScalingMethod::AspectFit);
mImage->setHorizontalAlignment(HorizontalAlignment::Center);
mImage->setVerticalAlignment(VerticalAlignment::Center);
// A checkbox so that we can turn on and off the filterColor property
CheckBox *filterColorCheckBox = CheckBox::create().text("filterColor");
filterColorCheckBox->setVerticalAlignment(VerticalAlignment::Bottom);
connect(filterColorCheckBox, SIGNAL(checkedChanged(bool)), this,
SLOT(onCheckedChanged(bool)));
recipeContainer->add(mImage);
recipeContainer->add(filterColorCheckBox);
setRoot(recipeContainer);
}
示例14: Property
PropertyBool::PropertyBool( QString name, bool value ) :
Property( name, value )
{
CheckBox* widget = new CheckBox( m_name );
widget->setChecked( value );
connect( widget, SIGNAL( stateChanged( int, int ) ), this, SLOT( widgetChanged( int, int ) ) );
m_widget = widget;
}
示例15: CheckBox
CheckBox *Options::create_checkbox(int xpos, int ypos, const char *name, bool state)
{
CheckBox *checkbox = new CheckBox(this);
checkbox->set_geometry(Rect(xpos, ypos , Size(300, 16)));
checkbox->set_text(name);
checkbox->set_checked(state);
return checkbox;
}