本文整理汇总了C++中TabWidget::setActiveTab方法的典型用法代码示例。如果您正苦于以下问题:C++ TabWidget::setActiveTab方法的具体用法?C++ TabWidget::setActiveTab怎么用?C++ TabWidget::setActiveTab使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TabWidget
的用法示例。
在下文中一共展示了TabWidget::setActiveTab方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ButtonWidget
GlobalOptionsDialog::GlobalOptionsDialog()
: OptionsDialog(Common::ConfigManager::kApplicationDomain, "globaloptions") {
// The tab widget
TabWidget *tab = new TabWidget(this, "globaloptions_tabwidget");
tab->setHints(THEME_HINT_FIRST_DRAW | THEME_HINT_SAVE_BACKGROUND);
//
// 1) The graphics tab
//
tab->addTab("Graphics");
addGraphicControls(tab, "globaloptions_");
//
// 2) The audio tab
//
tab->addTab("Audio");
addAudioControls(tab, "globaloptions_");
int volControlPos = g_gui.evaluator()->getVar("volumeControlsInAudio", true);
if (volControlPos)
addVolumeControls(tab, "globaloptions_");
addSubtitleControls(tab, "globaloptions_");
if (!volControlPos) {
tab->addTab("Volume");
addVolumeControls(tab, "globaloptions_");
}
// TODO: cd drive setting
//
// 3) The MIDI tab
//
tab->addTab("MIDI");
addMIDIControls(tab, "globaloptions_");
//
// 4) The miscellaneous tab
//
tab->addTab("Paths");
#if !( defined(__DC__) || defined(__GP32__) )
// These two buttons have to be extra wide, or the text will be
// truncated in the small version of the GUI.
// Save game path
new ButtonWidget(tab, "globaloptions_savebutton", "Save Path: ", kChooseSaveDirCmd, 0);
_savePath = new StaticTextWidget(tab, "globaloptions_savepath", "/foo/bar");
new ButtonWidget(tab, "globaloptions_themebutton", "Theme Path:", kChooseThemeDirCmd, 0);
_themePath = new StaticTextWidget(tab, "globaloptions_themepath", "None");
new ButtonWidget(tab, "globaloptions_extrabutton", "Extra Path:", kChooseExtraDirCmd, 0);
_extraPath = new StaticTextWidget(tab, "globaloptions_extrapath", "None");
#endif
#ifdef SMALL_SCREEN_DEVICE
new ButtonWidget(tab, "globaloptions_keysbutton", "Keys", kChooseKeyMappingCmd, 0);
#endif
// TODO: joystick setting
// Activate the first tab
tab->setActiveTab(0);
// Add OK & Cancel buttons
new ButtonWidget(this, "globaloptions_cancel", "Cancel", kCloseCmd, 0);
new ButtonWidget(this, "globaloptions_ok", "OK", kOKCmd, 0);
#ifdef SMALL_SCREEN_DEVICE
_keysDialog = new KeysDialog();
#endif
}
示例2: Label
//.........这里部分代码省略.........
0.5f * std::cos(i / 23.f) + 1);
// Dummy tab used to represent the last tab button.
tabWidget->createTab("+");
// A simple counter.
int counter = 1;
tabWidget->setCallback([tabWidget, this, counter] (int index) mutable {
if (index == (tabWidget->tabCount()-1)) {
// When the "+" tab has been clicked, simply add a new tab.
string tabName = "Dynamic " + to_string(counter);
Widget* layerDyn = tabWidget->createTab(index, tabName);
layerDyn->setLayout(new GroupLayout());
layerDyn->add<Label>("Function graph widget", "sans-bold");
Graph *graphDyn = layerDyn->add<Graph>("Dynamic function");
graphDyn->setHeader("E = 2.35e-3");
graphDyn->setFooter("Iteration " + to_string(index*counter));
VectorXf &funcDyn = graphDyn->values();
funcDyn.resize(100);
for (int i = 0; i < 100; ++i)
funcDyn[i] = 0.5f *
std::abs((0.5f * std::sin(i / 10.f + counter) +
0.5f * std::cos(i / 23.f + 1 + counter)));
++counter;
// We must invoke perform layout from the screen instance to keep everything in order.
// This is essential when creating tabs dynamically.
performLayout();
// Ensure that the newly added header is visible on screen
tabWidget->ensureTabVisible(index);
}
});
tabWidget->setActiveTab(0);
// A button to go back to the first tab and scroll the window.
panel = window->add<Widget>();
panel->add<Label>("Jump to tab: ");
panel->setLayout(new BoxLayout(Orientation::Horizontal,
Alignment::Middle, 0, 6));
auto ib = panel->add<IntBox<int>>();
ib->setEditable(true);
b = panel->add<Button>("", ENTYPO_ICON_FORWARD);
b->setFixedSize(Vector2i(22, 22));
ib->setFixedHeight(22);
b->setCallback([tabWidget, ib] {
int value = ib->value();
if (value >= 0 && value < tabWidget->tabCount()) {
tabWidget->setActiveTab(value);
tabWidget->ensureTabVisible(value);
}
});
window = new Window(this, "Grid of small widgets");
window->setPosition(Vector2i(425, 300));
GridLayout *layout =
new GridLayout(Orientation::Horizontal, 2,
Alignment::Middle, 15, 5);
layout->setColAlignment(
{ Alignment::Maximum, Alignment::Fill });
layout->setSpacing(0, 10);
window->setLayout(layout);
{
示例3: gameId
//.........这里部分代码省略.........
//
tab->addTab(_("Audio"));
if (g_system->getOverlayWidth() > 320)
_globalAudioOverride = new CheckboxWidget(tab, "GameOptions_Audio.EnableTabCheckbox", _("Override global audio settings"), 0, kCmdGlobalAudioOverride);
else
_globalAudioOverride = new CheckboxWidget(tab, "GameOptions_Audio.EnableTabCheckbox", _c("Override global audio settings", "lowres"), 0, kCmdGlobalAudioOverride);
addAudioControls(tab, "GameOptions_Audio.");
addSubtitleControls(tab, "GameOptions_Audio.");
//
// 5) The volume tab
//
if (g_system->getOverlayWidth() > 320)
tab->addTab(_("Volume"));
else
tab->addTab(_c("Volume", "lowres"));
if (g_system->getOverlayWidth() > 320)
_globalVolumeOverride = new CheckboxWidget(tab, "GameOptions_Volume.EnableTabCheckbox", _("Override global volume settings"), 0, kCmdGlobalVolumeOverride);
else
_globalVolumeOverride = new CheckboxWidget(tab, "GameOptions_Volume.EnableTabCheckbox", _c("Override global volume settings", "lowres"), 0, kCmdGlobalVolumeOverride);
addVolumeControls(tab, "GameOptions_Volume.");
//
// 6) The MIDI tab
//
_globalMIDIOverride = NULL;
if (!_guioptions.contains(GUIO_NOMIDI)) {
tab->addTab(_("MIDI"));
if (g_system->getOverlayWidth() > 320)
_globalMIDIOverride = new CheckboxWidget(tab, "GameOptions_MIDI.EnableTabCheckbox", _("Override global MIDI settings"), 0, kCmdGlobalMIDIOverride);
else
_globalMIDIOverride = new CheckboxWidget(tab, "GameOptions_MIDI.EnableTabCheckbox", _c("Override global MIDI settings", "lowres"), 0, kCmdGlobalMIDIOverride);
addMIDIControls(tab, "GameOptions_MIDI.");
}
//
// 7) The MT-32 tab
//
_globalMT32Override = NULL;
if (!_guioptions.contains(GUIO_NOMIDI)) {
tab->addTab(_("MT-32"));
if (g_system->getOverlayWidth() > 320)
_globalMT32Override = new CheckboxWidget(tab, "GameOptions_MT32.EnableTabCheckbox", _("Override global MT-32 settings"), 0, kCmdGlobalMT32Override);
else
_globalMT32Override = new CheckboxWidget(tab, "GameOptions_MT32.EnableTabCheckbox", _c("Override global MT-32 settings", "lowres"), 0, kCmdGlobalMT32Override);
addMT32Controls(tab, "GameOptions_MT32.");
}
//
// 8) The Paths tab
//
if (g_system->getOverlayWidth() > 320)
tab->addTab(_("Paths"));
else
tab->addTab(_c("Paths", "lowres"));
// These buttons have to be extra wide, or the text will be truncated
// in the small version of the GUI.
// GUI: Button + Label for the game path
if (g_system->getOverlayWidth() > 320)
new ButtonWidget(tab, "GameOptions_Paths.Gamepath", _("Game Path:"), 0, kCmdGameBrowser);
else
new ButtonWidget(tab, "GameOptions_Paths.Gamepath", _c("Game Path:", "lowres"), 0, kCmdGameBrowser);
_gamePathWidget = new StaticTextWidget(tab, "GameOptions_Paths.GamepathText", gamePath);
// GUI: Button + Label for the additional path
if (g_system->getOverlayWidth() > 320)
new ButtonWidget(tab, "GameOptions_Paths.Extrapath", _("Extra Path:"), _("Specifies path to additional data used by the game"), kCmdExtraBrowser);
else
new ButtonWidget(tab, "GameOptions_Paths.Extrapath", _c("Extra Path:", "lowres"), _("Specifies path to additional data used by the game"), kCmdExtraBrowser);
_extraPathWidget = new StaticTextWidget(tab, "GameOptions_Paths.ExtrapathText", extraPath, _("Specifies path to additional data used by the game"));
_extraPathClearButton = addClearButton(tab, "GameOptions_Paths.ExtraPathClearButton", kCmdExtraPathClear);
// GUI: Button + Label for the save path
if (g_system->getOverlayWidth() > 320)
new ButtonWidget(tab, "GameOptions_Paths.Savepath", _("Save Path:"), _("Specifies where your saved games are put"), kCmdSaveBrowser);
else
new ButtonWidget(tab, "GameOptions_Paths.Savepath", _c("Save Path:", "lowres"), _("Specifies where your saved games are put"), kCmdSaveBrowser);
_savePathWidget = new StaticTextWidget(tab, "GameOptions_Paths.SavepathText", savePath, _("Specifies where your saved games are put"));
_savePathClearButton = addClearButton(tab, "GameOptions_Paths.SavePathClearButton", kCmdSavePathClear);
// Activate the first tab
tab->setActiveTab(0);
_tabWidget = tab;
// Add OK & Cancel buttons
new ButtonWidget(this, "GameOptions.Cancel", _("Cancel"), 0, kCloseCmd);
new ButtonWidget(this, "GameOptions.Ok", _("OK"), 0, kOKCmd);
}