本文整理汇总了C++中NavigationView::pop方法的典型用法代码示例。如果您正苦于以下问题:C++ NavigationView::pop方法的具体用法?C++ NavigationView::pop怎么用?C++ NavigationView::pop使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NavigationView
的用法示例。
在下文中一共展示了NavigationView::pop方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
PlayDeadView::PlayDeadView(NavigationView& nav, bool booting) {
_booting = booting;
persistent_memory::set_playing_dead(0x59);
add_children({ {
&text_playdead1,
&text_playdead2,
&button_done,
} });
button_done.on_dir = [this,&nav](Button&, KeyEvent key){
sequence = (sequence<<3) | static_cast<std::underlying_type<KeyEvent>::type>(key);
};
button_done.on_select = [this,&nav](Button&){
if (sequence == persistent_memory::playdead_sequence()) {
persistent_memory::set_playing_dead(0);
if (_booting) {
nav.pop();
nav.push(new SystemMenuView { nav });
} else {
nav.pop();
}
} else {
sequence = 0;
}
};
}
示例2: rtcSetTime
SetDateTimeView::SetDateTimeView(
NavigationView& nav
) {
button_ok.on_select = [&nav, this](Button&) {
const auto model = this->form_collect();
const rtc::RTC new_datetime {
model.year, model.month, model.day,
model.hour, model.minute, model.second
};
rtcSetTime(&RTCD1, &new_datetime);
nav.pop();
},
button_cancel.on_select = [&nav](Button&) {
nav.pop();
},
add_children({ {
&text_title,
&field_year,
&text_slash1,
&field_month,
&text_slash2,
&field_day,
&field_hour,
&text_colon1,
&field_minute,
&text_colon2,
&field_second,
&text_format,
&button_ok,
&button_cancel,
}
});
rtc::RTC datetime;
rtcGetTime(&RTCD1, &datetime);
SetDateTimeModel model {
datetime.year(),
datetime.month(),
datetime.day(),
datetime.hour(),
datetime.minute(),
datetime.second()
};
form_init(model);
}
示例3:
FreqManView::FreqManView(
NavigationView& nav
) {
add_children({ {
&button_exit
} });
size_t n = 0;
for(auto& text : text_list) {
add_child(&text);
text.set_parent_rect({
static_cast<Coord>(0),
static_cast<Coord>(16 + (n * 16)),
240, 16
});
const std::string label {
(char)(n + 0x30)
};
text.set(label);
n++;
}
button_exit.on_select = [this, &nav](Button&) {
nav.pop();
};
}
示例4:
LoadModuleView::LoadModuleView(
NavigationView& nav,
const char * hash,
ViewID viewid
)
{
add_children({ {
&text_info,
&text_infob,
&button_ok
} });
_hash = hash;
button_ok.on_select = [this, &nav, viewid](Button&){
nav.pop();
if (_mod_loaded == true) {
if (viewid == AudioTX) nav.push<AudioTXView>();
if (viewid == Xylos) nav.push<XylosView>();
if (viewid == EPAR) nav.push<EPARView>();
if (viewid == LCR) nav.push<LCRView>();
if (viewid == SoundBoard) nav.push<SoundBoardView>();
if (viewid == AnalogAudio) nav.push<AnalogAudioView>();
if (viewid == RDS) nav.push<RDSView>();
if (viewid == CloseCall) nav.push<CloseCallView>();
if (viewid == Receiver) nav.push<ReceiverMenuView>();
}
};
}
示例5:
RegistersView::RegistersView(
NavigationView& nav,
const std::string& title,
RegistersWidgetConfig&& config,
std::function<uint32_t(const size_t register_number)>&& reader
) : registers_widget { std::move(config), std::move(reader) }
{
add_children({ {
&text_title,
®isters_widget,
&button_update,
&button_done,
} });
button_update.on_select = [this](Button&){
this->registers_widget.update();
};
button_done.on_select = [&nav](Button&){ nav.pop(); };
registers_widget.set_parent_rect({ 0, 48, 240, 192 });
text_title.set_parent_rect({
(240 - static_cast<int>(title.size()) * 8) / 2, 16,
static_cast<int>(title.size()) * 8, 16
});
text_title.set(title);
}
示例6:
NumbersStationView::NumbersStationView(
NavigationView& nav,
TransmitterModel& transmitter_model
) : transmitter_model(transmitter_model)
{
uint8_t m, d, dayofweek;
uint16_t y;
add_children({ {
&text_title,
&button_exit
} });
rtc::RTC datetime;
rtcGetTime(&RTCD1, &datetime);
// Thanks, Sakamoto-sama !
y = datetime.year();
m = datetime.month();
d = datetime.day();
y -= m < 3;
dayofweek = (y + y/4 - y/100 + y/400 + month_table[m-1] + d) % 7;
text_title.set(day_of_week[dayofweek]);
button_exit.on_select = [&nav](Button&){
nav.pop();
};
}
示例7:
SetupMenuView::SetupMenuView(NavigationView& nav) {
add_items({
{ "Date/Time", [&nav](){ nav.push<SetDateTimeView>(); } },
{ "Frequency Correction", [&nav](){ nav.push<SetFrequencyCorrectionView>(); } },
{ "Antenna Bias Voltage", [&nav](){ nav.push<AntennaBiasSetupView>(); } },
{ "Touch", [&nav](){ nav.push<TouchCalibrationView>(); } },
});
on_left = [&nav](){ nav.pop(); };
}
示例8:
DebugMenuView::DebugMenuView(NavigationView& nav) {
add_items<7>({ {
{ "Memory", [&nav](){ nav.push(new DebugMemoryView { nav }); } },
{ "Radio State", [&nav](){ nav.push(new NotImplementedView { nav }); } },
{ "SD Card", [&nav](){ nav.push(new NotImplementedView { nav }); } },
{ "RFFC5072", [&nav](){ nav.push(new DebugRFFC5072View { nav }); } },
{ "MAX2837", [&nav](){ nav.push(new NotImplementedView { nav }); } },
{ "Si5351C", [&nav](){ nav.push(new NotImplementedView { nav }); } },
{ "WM8731", [&nav](){ nav.push(new NotImplementedView { nav }); } },
} });
on_left = [&nav](){ nav.pop(); };
}
示例9:
SetupMenuView::SetupMenuView(NavigationView& nav) {
add_items<3>({ {
{ "Date/Time", [&nav]() {
nav.push(new SetDateTimeView { nav });
}
},
{ "Frequency Correction", [&nav]() {
nav.push(new SetFrequencyCorrectionView { nav });
}
},
{ "Touch", [&nav]() {
nav.push(new NotImplementedView { nav });
}
},
}
});
on_left = [&nav]() {
nav.pop();
};
}
示例10: chCoreStatus
DebugMemoryView::DebugMemoryView(NavigationView& nav) {
add_children({ {
&text_title,
&text_label_m0_free,
&text_label_m0_free_value,
&text_label_m0_heap_fragmented_free,
&text_label_m0_heap_fragmented_free_value,
&text_label_m0_heap_fragments,
&text_label_m0_heap_fragments_value,
&button_done
} });
const auto m0_free = chCoreStatus();
text_label_m0_free_value.set(to_string_dec_uint(m0_free, 5));
size_t m0_fragmented_free_space = 0;
const auto m0_fragments = chHeapStatus(NULL, &m0_fragmented_free_space);
text_label_m0_heap_fragmented_free_value.set(to_string_dec_uint(m0_fragmented_free_space, 5));
text_label_m0_heap_fragments_value.set(to_string_dec_uint(m0_fragments, 5));
button_done.on_select = [&nav](Button&){ nav.pop(); };
}
示例11:
WhipCalcView::WhipCalcView(
NavigationView& nav
) {
add_children({ {
&text_frequency,
&field_frequency,
&text_type,
&options_type,
&text_result_metric,
&text_result_imperial,
&text_result_ant500,
&button_exit
} });
options_type.on_change = [this](size_t, OptionsField::value_t) {
this->update_result();
};
options_type.set_selected_index(2); // Quarter wave
field_frequency.set_value(transmitter_model.tuning_frequency());
field_frequency.set_step(500000); // 500kHz step
field_frequency.on_change = [this](rf::Frequency) {
this->update_result();
};
field_frequency.on_edit = [this, &nav]() {
// TODO: Provide separate modal method/scheme?
auto new_view = nav.push<FrequencyKeypadView>(transmitter_model.tuning_frequency());
new_view->on_changed = [this](rf::Frequency f) {
this->update_result();
this->field_frequency.set_value(f);
};
};
button_exit.on_select = [this, &nav](Button&) {
nav.pop();
};
}
示例12:
FrequencyKeypadView::FrequencyKeypadView(
NavigationView& nav,
const rf::Frequency value
) {
add_child(&text_value);
const auto button_fn = [this](Button& button) {
this->on_button(button);
};
const char* const key_caps = "123456789<0.";
size_t n = 0;
for(auto& button : buttons) {
add_child(&button);
const std::string label {
key_caps[n]
};
button.on_select = button_fn;
button.set_parent_rect({
static_cast<Coord>((n % 3) * button_w),
static_cast<Coord>((n / 3) * button_h + button_h),
button_w, button_h
});
button.set_text(label);
n++;
}
add_child(&button_close);
button_close.on_select = [this, &nav](Button&) {
if( on_changed ) {
on_changed(this->value());
}
nav.pop();
};
set_value(value);
}
示例13:
AFSKSetupView::AFSKSetupView(
NavigationView& nav
)
{
using name_t = std::string;
using value_t = int32_t;
using option_t = std::pair<name_t, value_t>;
using options_t = std::vector<option_t>;
options_t format_options;
uint8_t rpt;
size_t i;
add_children({ {
&text_setfreq,
&button_setfreq,
&text_bps,
&options_bps,
&text_mark,
&field_mark,
&text_space,
&field_space,
&text_bw,
&field_bw,
&text_repeat,
&field_repeat,
&text_format,
&options_format,
&button_save
} });
for (i = 0; i < AFSK_MODES_COUNT; i++)
format_options.emplace_back(std::make_pair(afsk_formats[i].fullname, i));
options_format.set_options(format_options);
options_format.set_selected_index(portapack::persistent_memory::afsk_format());
update_freq(portapack::persistent_memory::tuned_frequency());
field_mark.set_value(portapack::persistent_memory::afsk_mark_freq() * 25);
field_space.set_value(portapack::persistent_memory::afsk_space_freq() * 25);
field_bw.set_value(portapack::persistent_memory::afsk_bw());
rpt = portapack::persistent_memory::afsk_repeats();
if ((rpt > 99) || (!rpt)) rpt = 5;
field_repeat.set_value(rpt);
button_setfreq.on_select = [this,&nav](Button&) {
auto new_view = nav.push<FrequencyKeypadView>(portapack::persistent_memory::tuned_frequency());
new_view->on_changed = [this](rf::Frequency f) {
update_freq(f);
};
};
options_bps.set_by_value(portapack::persistent_memory::afsk_bitrate());
button_save.on_select = [this,&nav](Button&) {
uint32_t afsk_config = 0;
portapack::persistent_memory::set_afsk_bitrate(options_bps.selected_index_value());
portapack::persistent_memory::set_afsk_mark(field_mark.value() / 25);
portapack::persistent_memory::set_afsk_space(field_space.value() / 25);
portapack::persistent_memory::set_afsk_bw(field_bw.value());
afsk_config |= (options_format.selected_index() << 16);
afsk_config |= (field_repeat.value() << 24);
portapack::persistent_memory::set_afsk_config(afsk_config);
nav.pop();
};
}