MCPcopy Create free account
hub / github.com/SpartanJ/eepp / getCheckBoxFn

Method getCheckBoxFn

src/tools/ecode/plugins/pluginmanager.cpp:425–450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

423 std::function<void( const std::string&, bool )> onModelEnabledChange;
424
425 std::function<UITextView*( UIPushButton* )> getCheckBoxFn( const ModelIndex& index,
426 const PluginsModel* model ) {
427 return [index, model, this]( UIPushButton* ) -> UITextView* {
428 UICheckBox* chk = UICheckBox::New();
429 chk->setChecked(
430 model->data( model->index( index.row(), PluginsModel::Enabled ) ).asBool() );
431 chk->setCheckMode( UICheckBox::Button );
432 chk->on( Event::OnValueChange, [this, chk]( const Event* ) {
433 if ( mUpdatingEnabled )
434 return;
435 BoolScopedOp op( mUpdatingEnabled, true );
436 UITableCell* parent = chk->getParent()->asType<UITableCell>();
437 auto index = parent->getCurIndex();
438 UIPluginManagerTable* tableView =
439 parent->getParent()->getParent()->asType<UIPluginManagerTable>();
440 auto model = static_cast<PluginsModel*>( tableView->getModel() );
441 bool checked = chk->isChecked();
442 std::string id(
443 model->data( model->index( index.row(), PluginsModel::Id ) ).asCStr() );
444 model->getManager()->setEnabled( id, checked );
445 if ( onModelEnabledChange )
446 onModelEnabledChange( id, checked );
447 } );
448 return chk;
449 };
450 }
451
452 UIWidget* createCell( UIWidget* rowWidget, const ModelIndex& index ) {
453 if ( index.column() == PluginsModel::Title ) {

Callers

nothing calls this directly

Calls 12

setCheckedMethod · 0.80
asBoolMethod · 0.80
rowMethod · 0.80
setCheckModeMethod · 0.80
NewFunction · 0.50
dataMethod · 0.45
indexMethod · 0.45
onMethod · 0.45
getParentMethod · 0.45
getModelMethod · 0.45
setEnabledMethod · 0.45
getManagerMethod · 0.45

Tested by

no test coverage detected