您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ ui函数代码示例

51自学网 2021-06-03 09:06:46
  C++
这篇教程C++ ui函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中ui函数的典型用法代码示例。如果您正苦于以下问题:C++ ui函数的具体用法?C++ ui怎么用?C++ ui使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了ui函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: item_append

void menu_main::populate(){	/* add input menu items */	item_append(_("Input (general)"), "", 0, (void *)INPUT_GROUPS);	item_append(_("Input (this Machine)"), "", 0, (void *)INPUT_SPECIFIC);	/* add optional input-related menus */	if (ui().machine_info().has_analog())		item_append(_("Analog Controls"), "", 0, (void *)ANALOG);	if (ui().machine_info().has_dips())		item_append(_("Dip Switches"), "", 0, (void *)SETTINGS_DIP_SWITCHES);	if (ui().machine_info().has_configs())	{		item_append(_("Machine Configuration"), "", 0, (void *)SETTINGS_DRIVER_CONFIG);	}	/* add bookkeeping menu */	item_append(_("Bookkeeping Info"), "", 0, (void *)BOOKKEEPING);	/* add game info menu */	item_append(_("Machine Information"), "", 0, (void *)GAME_INFO);	for (device_image_interface &image : image_interface_iterator(machine().root_device()))	{		if (image.user_loadable())		{			/* add image info menu */			item_append(_("Image Information"), "", 0, (void *)IMAGE_MENU_IMAGE_INFO);			/* add file manager menu */			item_append(_("File Manager"), "", 0, (void *)IMAGE_MENU_FILE_MANAGER);			break;		}	}	/* add tape control menu */	if (cassette_device_iterator(machine().root_device()).first() != nullptr)		item_append(_("Tape Control"), "", 0, (void *)TAPE_CONTROL);	if (pty_interface_iterator(machine().root_device()).first() != nullptr)		item_append(_("Pseudo terminals"), "", 0, (void *)PTY_INFO);	if (ui().machine_info().has_bioses())		item_append(_("Bios Selection"), "", 0, (void *)BIOS_SELECTION);	/* add slot info menu */	if (slot_interface_iterator(machine().root_device()).first() != nullptr)		item_append(_("Slot Devices"), "", 0, (void *)SLOT_DEVICES);	/* add Barcode reader menu */	if (barcode_reader_device_iterator(machine().root_device()).first() != nullptr)		item_append(_("Barcode Reader"), "", 0, (void *)BARCODE_READ);	/* add network info menu */	if (network_interface_iterator(machine().root_device()).first() != nullptr)		item_append(_("Network Devices"), "", 0, (void*)NETWORK_DEVICES);	/* add keyboard mode menu */	if (ui().machine_info().has_keyboard() && machine().ioport().natkeyboard().can_post())		item_append(_("Keyboard Mode"), "", 0, (void *)KEYBOARD_MODE);	/* add sliders menu */	item_append(_("Slider Controls"), "", 0, (void *)SLIDERS);	/* add video options menu */	item_append(_("Video Options"), "", 0, (machine().render().target_by_index(1) != nullptr) ? (void *)VIDEO_TARGETS : (void *)VIDEO_OPTIONS);	/* add crosshair options menu */	if (machine().crosshair().get_usage())		item_append(_("Crosshair Options"), "", 0, (void *)CROSSHAIR);	/* add cheat menu */	if (machine().options().cheat())		item_append(_("Cheat"), "", 0, (void *)CHEAT);	if (machine().options().plugins())		item_append(_("Plugin Options"), "", 0, (void *)PLUGINS);	// add dats menu	if (mame_machine_manager::instance()->lua()->call_plugin("", "data_list"))		item_append(_("External DAT View"), "", 0, (void *)EXTERNAL_DATS);	item_append(menu_item_type::SEPARATOR);	/* add favorite menu */	if (!mame_machine_manager::instance()->favorite().isgame_favorite())		item_append(_("Add To Favorites"), "", 0, (void *)ADD_FAVORITE);	else		item_append(_("Remove From Favorites"), "", 0, (void *)REMOVE_FAVORITE);	item_append(menu_item_type::SEPARATOR);//  item_append(_("Quit from Machine"), nullptr, 0, (void *)QUIT_GAME);	/* add reset and exit menus */	item_append(_("Select New Machine"), "", 0, (void *)SELECT_GAME);}
开发者ID:RalfVB,项目名称:mame,代码行数:99,


示例2: wxScrolledWindow

LobbyOptionsTab::LobbyOptionsTab(wxWindow* parent)    : wxScrolledWindow(parent, -1)    , m_show_tooltips_label(0){	GetAui().manager->AddPane(this, wxLEFT, _T("lobbyoptionstab"));	wxBoxSizer* m_main_sizer = new wxBoxSizer(wxVERTICAL);	/* ================================   * Web browser   */	wxStaticBox* m_web_box = new wxStaticBox(this, -1, _("Web Browser"));	m_web_loc_text = new wxStaticText(this, -1, _("Web Browser"));	m_web_def_radio = new wxRadioButton(this, SPRING_DEFWEB, _("Default Browser."),					    wxDefaultPosition, wxDefaultSize, wxRB_GROUP);	m_web_def_radio->SetToolTip(_("Use your system-wide browser preference"));	m_web_spec_radio = new wxRadioButton(this, SPRING_DEFWEB, _("Specify:"));	m_web_spec_radio->SetToolTip(_("Specify the web browser you want to use"));	m_web_edit = new wxTextCtrl(this, -1, sett().GetWebBrowserPath());	m_web_browse_btn = new wxButton(this, SPRING_WEBBROWSE, _("Browse"));	m_web_browse_btn->SetToolTip(_("Use a file dialog to find the web browser"));	if (sett().GetWebBrowserUseDefault())		m_web_def_radio->SetValue(true);	else		m_web_spec_radio->SetValue(true);	m_web_loc_sizer = new wxBoxSizer(wxHORIZONTAL);	m_web_loc_sizer->Add(m_web_loc_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);	m_web_loc_sizer->Add(m_web_edit, 1, wxEXPAND);	m_web_loc_sizer->Add(m_web_browse_btn);	m_web_box_sizer = new wxStaticBoxSizer(m_web_box, wxVERTICAL);	m_web_box_sizer->Add(m_web_def_radio, 0, wxALL, 2);	m_web_box_sizer->Add(m_web_spec_radio, 0, wxALL, 2);	m_web_box_sizer->Add(m_web_loc_sizer, 0, wxEXPAND | wxALL, 2);	/////	wxStaticBox* m_editor_box = new wxStaticBox(this, -1, _("External text editor"));	m_editor_loc_text = new wxStaticText(this, -1, _("Path"));	m_editor_edit = new wxTextCtrl(this, -1, TowxString(SlPaths::GetEditorPath()));	m_editor_browse_btn = new wxButton(this, ID_BUT_EDITOR, _("Browse"));	m_editor_browse_btn->SetToolTip(_("Use a file dialog to find the editor binary"));	m_editor_loc_sizer = new wxBoxSizer(wxHORIZONTAL);	m_editor_loc_sizer->Add(m_editor_loc_text, 0, wxALL | wxALIGN_CENTER_VERTICAL, 2);	m_editor_loc_sizer->Add(m_editor_edit, 1, wxEXPAND);	m_editor_loc_sizer->Add(m_editor_browse_btn);	m_editor_box_sizer = new wxStaticBoxSizer(m_editor_box, wxVERTICAL);	m_editor_box_sizer->Add(m_editor_loc_sizer, 0, wxEXPAND | wxALL, 2);	////////	wxStaticBoxSizer* m_autojoin_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Autoconnect"));	m_autoconnect_label = new wxStaticText(this, -1, wxString::Format(_("If checked, %s will automatically log on to the last used server"), GetSpringlobbyName()));	m_autojoin = new wxCheckBox(this, -1, _("Autoconnect on lobby start"), wxDefaultPosition, wxDefaultSize, 0);	m_autojoin->SetValue(cfg().ReadBool(_T( "/Server/Autoconnect")));	m_autojoin_sizer->Add(m_autoconnect_label, 1, wxEXPAND | wxALL, 5);	m_autojoin_sizer->Add(m_autojoin, 0, wxEXPAND | wxALL, 5);	m_main_sizer->Add(m_web_box_sizer, 0, wxEXPAND | wxALL, 5);	m_main_sizer->Add(m_editor_box_sizer, 0, wxEXPAND | wxALL, 5);	wxStaticBoxSizer* m_updater_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Automatic updates"));	m_updater_label = new wxStaticText(this, -1, wxString::Format(_("%s can check at startup if a newer version is available and automatically download it for you."), GetSpringlobbyName()));	m_updater = new wxCheckBox(this, -1, _("automatically check for updates"), wxDefaultPosition, wxDefaultSize, 0);	m_updater->SetValue(cfg().ReadBool(_T("/General/AutoUpdate")));	m_updater_sizer->Add(m_updater_label, 1, wxEXPAND | wxALL, 5);	m_updater_sizer->Add(m_updater, 0, wxEXPAND | wxALL, 5);	m_main_sizer->Add(m_autojoin_sizer, 0, wxEXPAND | wxALL, 5);	m_main_sizer->Add(m_updater_sizer, 0, wxEXPAND | wxALL, 5);	wxStaticBoxSizer* m_show_tooltips_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Tooltips"));	m_show_tooltips = new wxCheckBox(this, -1, _("Show Tooltips?"), wxDefaultPosition, wxDefaultSize, 0);	m_show_tooltips->SetValue(sett().GetShowTooltips());#ifndef __WXMSW__ // on windows this change is immediate	m_show_tooltips_label = new wxStaticText(this, -1, wxString::Format(_("Requires %s restart to take effect."), GetSpringlobbyName()));	m_show_tooltips_sizer->Add(m_show_tooltips_label, 1, wxEXPAND | wxALL, 5);#endif	m_show_tooltips_sizer->Add(m_show_tooltips, 0, wxEXPAND | wxALL, 5);	wxStaticBoxSizer* m_show_promotions_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Battle Promotion"));	m_show_promotions = new wxCheckBox(this, -1, _("Show notifications when someone promotes battle?"), wxDefaultPosition, wxDefaultSize, 0);	m_show_promotions->SetValue(cfg().ReadBool("/GUI/ShowPromotions"));	m_show_promotions_sizer->Add(m_show_promotions, 0, wxEXPAND | wxALL, 5);	wxStaticBoxSizer* m_complete_method_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _("Tab completion method"));	m_complete_method_label = new wxStaticText(this, -1, _("/"Match exact/" will complete a word if there is one and only one match./n"							       "/"Match nearest/" will select the (first) match that has closest Levenshtein distance"));	m_complete_method_old = new wxRadioButton(this, -1, _("Match exact"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP);	m_complete_method_new = new wxRadioButton(this, -1, _("Match nearest"), wxDefaultPosition, wxDefaultSize);	m_complete_method_old->SetValue(sett().GetCompletionMethod() == Settings::MatchExact);	m_complete_method_new->SetValue(sett().GetCompletionMethod() == Settings::MatchNearest);//.........这里部分代码省略.........
开发者ID:springlobby,项目名称:springlobby,代码行数:101,


示例3: main

int main(int argc, char** argv) {  glfwSetErrorCallback(glfwError);  if (!glfwInit()) return 1;  glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);  glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);  glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);  GLFWmonitor* monitor = glfwGetPrimaryMonitor();  const GLFWvidmode* mode = glfwGetVideoMode(monitor);  GLFWwindow* window =      glfwCreateWindow(mode->width, mode->height, "HumanDetection", NULL, NULL);  glfwMakeContextCurrent(window);  glewExperimental = GL_TRUE;  glewInit();  fhd_context detector;  fhd_context_init(&detector, 512, 424, 8, 8);  ImGui_ImplGlfwGL3_Init(window, true);  ImGui::GetStyle().WindowRounding = 0.f;  bool show_window = true;  fhd_ui ui(&detector);  if (argc > 1) {    const char* train_database = argv[1];    ui.train_mode = true;    fhd_candidate_db_init(&ui.candidate_db, train_database);  }  ImVec4 clear_color = ImColor(218, 223, 225);  while (!glfwWindowShouldClose(window)) {    glfwPollEvents();    if (ImGui::IsKeyPressed(GLFW_KEY_ESCAPE)) break;    if (ui.train_mode) {      if (ImGui::IsKeyPressed(GLFW_KEY_X)) {        fhd_ui_clear_candidate_selection(&ui);        ui.depth_frame = ui.frame_source->get_frame();      }      if (ImGui::IsKeyPressed(GLFW_KEY_SPACE)) {        fhd_ui_commit_candidates(&ui);      }    } else {      if (ui.update_enabled) {        ui.depth_frame = ui.frame_source->get_frame();      }    }    if (ui.depth_frame) {      auto t1 = std::chrono::high_resolution_clock::now();      fhd_run_pass(&detector, ui.depth_frame);      auto t2 = std::chrono::high_resolution_clock::now();      auto duration =          std::chrono::duration_cast<std::chrono::microseconds>(t2 - t1);      ui.detection_pass_time_ms = double(duration.count()) / 1000.0;      fhd_ui_update(&ui, ui.depth_frame);    }    ImGui_ImplGlfwGL3_NewFrame();    int display_w, display_h;    glfwGetFramebufferSize(window, &display_w, &display_h);    ImGui::SetNextWindowPos(ImVec2(0, 0));    ImGuiWindowFlags flags = ImGuiWindowFlags_NoMove |                             ImGuiWindowFlags_NoResize |                             ImGuiWindowFlags_NoTitleBar;    ImGui::Begin("foo", &show_window,                 ImVec2(float(display_w), float(display_h)), -1.f, flags);    ImGui::BeginChild("toolbar", ImVec2(300.f, float(display_h)));    render_db_selection(&ui);    render_classifier_selection(&ui);    if (ui.train_mode) {      ImGui::Text("*** TRAINING DB: %s ***", argv[1]);    }    ImGui::Text("detection pass time %.3f ms", ui.detection_pass_time_ms);    ImGui::Text("frame source: %s", ui.database_name.c_str());    ImGui::Text("frame %d/%d", ui.frame_source->current_frame(),                ui.frame_source->total_frames());    ImGui::Text("classifier: %s", ui.classifier_name.c_str());    ImGui::Checkbox("update enabled", &ui.update_enabled);    ImGui::SliderFloat("##det_thresh", &ui.detection_threshold, 0.f, 1.f,                       "detection threshold %.3f");    ImGui::InputFloat("seg k depth", &ui.fhd->depth_segmentation_threshold);    ImGui::InputFloat("seg k normals", &ui.fhd->normal_segmentation_threshold);    ImGui::SliderFloat("##min_reg_dim", &ui.fhd->min_region_size, 8.f, 100.f,                       "min region dimension %.1f");    ImGui::SliderFloat("##merge_dist_x", &ui.fhd->max_merge_distance, 0.1f, 2.f,                       "max h merge dist (m) %.2f");    ImGui::SliderFloat("##merge_dist_y", &ui.fhd->max_vertical_merge_distance,//.........这里部分代码省略.........
开发者ID:RemyYang,项目名称:FastHumanDetection,代码行数:101,


示例4: _

void PlaybackTab<PlaybackTraits>::OnWatch( wxCommandEvent& /*unused*/ ){	if ( m_replay_listctrl->GetSelectedIndex() != -1 ) {		int m_sel_replay_id = m_replay_listctrl->GetSelectedData()->id;		wxString type = PlaybackTraits::IsReplayType ? _( "replay" ) : _( "savegame" ) ;		wxLogMessage( _T( "Watching %s %d " ), type.c_str(), m_sel_replay_id );		try {			PlaybackType& rep = playbacklist<ListType>().GetPlaybackById( m_sel_replay_id );			std::map<wxString, wxString> versionlist = sett().GetSpringVersionList();			if ( versionlist.size() == 0 ) {				wxLogWarning( _T( "can't get spring version from any unitsync" ) );				customMessageBox( SL_MAIN_ICON,  _( "Couldn't get your spring versions from any unitsync library." ), _( "Spring error" ), wxICON_EXCLAMATION | wxOK );				AskForceWatch( rep );				return;			}			bool versionfound = false;			for ( std::map<wxString, wxString>::const_iterator itor = versionlist.begin(); itor != versionlist.end(); itor++ ) {				if ( itor->second == rep.SpringVersion ) {					if ( sett().GetCurrentUsedSpringIndex() != itor->first ) {						wxLogMessage( _T( "%s requires version: %s, switching to profile: %s" ), type.c_str(), rep.SpringVersion.c_str(), itor->first.c_str() );						sett().SetUsedSpringIndex( itor->first );						usync().AddReloadEvent(); // request an unitsync reload					}					versionfound = true;				}			}			if ( !ReplayTraits::IsReplayType )                versionfound = true; // quick hack to bypass spring version check			if ( !versionfound ) {				wxString message = wxString::Format( _( "No compatible installed spring version has been found, this %s requires version: %s/n" ), type.c_str(), rep.SpringVersion.c_str() );				message << _( "Your current installed versions are:" );				for ( std::map<wxString, wxString>::const_iterator itor = versionlist.begin(); itor != versionlist.end(); itor++ ) message << _T( " " ) << itor->second;				customMessageBox( SL_MAIN_ICON, message, _( "Spring error" ), wxICON_EXCLAMATION | wxOK );				wxLogWarning ( _T( "no spring version supported by this replay found" ) );				AskForceWatch( rep );				return;			}			rep.battle.GetMe().SetNick( usync().GetDefaultNick() );			bool watchable = rep.battle.MapExists() && rep.battle.ModExists();			if ( watchable )				rep.battle.StartSpring();			else {#ifdef NO_TORRENT_SYSTEM				wxString downloadProc = _( "Do you want me to take you to the download page?" );#else				wxString downloadProc = _( "Should i try to download it for you?/nYou can see the progress in the /"Download Manager/" tab." );#endif				OfflineBattle& battle = rep.battle;				if ( !battle.ModExists() ) {					if ( customMessageBox( SL_MAIN_ICON, _( "You need to download the game before you can watch this replay./n/n" ) + downloadProc, _( "Game not available" ), wxYES_NO | wxICON_QUESTION ) == wxYES ) {						wxString modhash = battle.GetHostModHash();						wxString modname = battle.GetHostModName();						ui().DownloadMod ( modhash, modname );					}					else {						AskForceWatch( rep );					}					return;				}				if ( !battle.MapExists() ) {					if ( customMessageBox( SL_MAIN_ICON, _( " I couldn't find the map to be able to watch this replay/nThis can be caused by tasclient writing broken map hash value/nIf you're sure you have the map, press no/nYou need to download the map to be able to watch this replay./n/n" ) + downloadProc, _( "Map not available" ), wxYES_NO | wxICON_QUESTION ) == wxYES ) {						wxString maphash = battle.GetHostMapHash();						wxString mapname = battle.GetHostMapName();						ui().DownloadMap ( maphash, mapname );					}					else {						AskForceWatch( rep );					}				}			}		} catch ( std::runtime_error ) {			return;		}	} else {		Deselected();	}}
开发者ID:SpliFF,项目名称:springlobby,代码行数:82,


示例5: Stage

BuildingScreen::BuildingScreen(sp<Building> building)    : Stage(), menuform(ui().GetForm("FORM_BUILDING_SCREEN")), building(building){	auto nameLabel = menuform->FindControlTyped<Label>("LABEL_BUILDING_NAME");	nameLabel->SetText(tr(building->name));}
开发者ID:idshibanov,项目名称:OpenApoc,代码行数:6,


示例6: ui

void ServerEvents::OnChannelMessage(const std::string& channel, const std::string& msg){	ui().OnChannelMessage(m_serv.GetChannel(channel), msg);}
开发者ID:OursDesCavernes,项目名称:springlobby,代码行数:4,


示例7: ui

void MainJoinBattleTab::PreSwitchBattlePerspective( ){    ui().mw().SavePerspectives(  );}
开发者ID:N2maniac,项目名称:springlobby-join-fork,代码行数:4,


示例8: process

void menu_software_list::handle(){	const entry_info *selected_entry = nullptr;	int bestmatch = 0;	// process the menu	const event *event = process(0);	if (event && event->itemref)	{		if ((uintptr_t)event->itemref == 1 && event->iptkey == IPT_UI_SELECT)		{			m_ordered_by_shortname = !m_ordered_by_shortname;			// reset the char buffer if we change ordering criterion			m_filename_buffer.clear();			// reload the menu with the new order			reset(reset_options::REMEMBER_REF);			machine().popmessage(_("Switched Order: entries now ordered by %s"), m_ordered_by_shortname ? _("shortname") : _("description"));		}		// handle selections		else if (event->iptkey == IPT_UI_SELECT)		{			entry_info *info = (entry_info *) event->itemref;			m_result = info->short_name;			stack_pop();		}		else if (event->iptkey == IPT_SPECIAL)		{			if (input_character(m_filename_buffer, event->unichar, &is_valid_softlist_part_char))			{				// display the popup				ui().popup_time(ERROR_MESSAGE_TIME, "%s", m_filename_buffer);				// identify the selected entry				entry_info const *const cur_selected = (uintptr_t(event->itemref) != 1)						? reinterpret_cast<entry_info const *>(get_selection_ref())						: nullptr;				// loop through all entries				for (auto &entry : m_entrylist)				{					// is this entry the selected entry?					if (cur_selected != &entry)					{						auto &compare_name = m_ordered_by_shortname ? entry.short_name : entry.long_name;						int match = 0;						for (int i = 0; i < m_filename_buffer.size() + 1; i++)						{							if (core_strnicmp(compare_name.c_str(), m_filename_buffer.c_str(), i) == 0)								match = i;						}						if (match > bestmatch)						{							bestmatch = match;							selected_entry = &entry;						}					}				}				if (selected_entry != nullptr && selected_entry != cur_selected)				{					set_selection((void *)selected_entry);					centre_selection();				}			}		}		else if (event->iptkey == IPT_UI_CANCEL)		{			// reset the char buffer also in this case			m_filename_buffer.clear();			m_result = m_filename_buffer;			stack_pop();		}	}}
开发者ID:goofwear,项目名称:mame,代码行数:79,


示例9: wxGetNumberFromUser

void BattleRoomTab::OnAutoSpec( wxCommandEvent& /*unused*/ ){	if ( !m_battle ) return;	int trigger = wxGetNumberFromUser( _( "Enter timeout before autospeccing a player in minutes" ), _( "Set Timeout" ), _T( "" ), sett().GetBattleLastAutoSpectTime() / 60, 1, 60, ( wxWindow* ) & ui().mw(), wxDefaultPosition );	if ( trigger < 0 ) trigger = 0;	trigger = trigger * 60;	m_autospec_mnu->Check( trigger > 0 );	sett().SetBattleLastAutoSpectTime( trigger );}
开发者ID:SpliFF,项目名称:springlobby,代码行数:9,


示例10: wxGetTextFromUser

void BattleRoomTab::OnAutoPaste( wxCommandEvent& /*unused*/ ){	if ( !m_battle ) return;	wxString description = wxGetTextFromUser( _( "Enter a battle description" ), _( "Set description" ), m_battle->GetDescription(), ( wxWindow* ) & ui().mw() );	m_autopaste_mnu->Check( !description.IsEmpty() );	if ( !description.IsEmpty() ) m_battle->SetDescription( description );	sett().SetBattleLastAutoAnnounceDescription( m_autopaste_mnu->IsChecked() );}
开发者ID:SpliFF,项目名称:springlobby,代码行数:8,


示例11: process

void menu_file_selector::handle(){	osd_file::error err;	const file_selector_entry *selected_entry = nullptr;	int bestmatch = 0;	// process the menu	const event *event = process(0);	if (event != nullptr && event->itemref != nullptr)	{		// handle selections		if (event->iptkey == IPT_UI_SELECT)		{			auto entry = (const file_selector_entry *) event->itemref;			switch (entry->type)			{			case SELECTOR_ENTRY_TYPE_EMPTY:				// empty slot - unload				m_result = result::EMPTY;				stack_pop();				break;			case SELECTOR_ENTRY_TYPE_CREATE:				// create				m_result = result::CREATE;				stack_pop();				break;			case SELECTOR_ENTRY_TYPE_SOFTWARE_LIST:				m_result = result::SOFTLIST;				stack_pop();				break;			case SELECTOR_ENTRY_TYPE_DRIVE:			case SELECTOR_ENTRY_TYPE_DIRECTORY:				// drive/directory - first check the path				err = util::zippath_opendir(entry->fullpath, nullptr);				if (err != osd_file::error::NONE)				{					// this path is problematic; present the user with an error and bail					ui().popup_time(1, "Error accessing %s", entry->fullpath);					break;				}				m_current_directory.assign(entry->fullpath);				reset(reset_options::SELECT_FIRST);				break;			case SELECTOR_ENTRY_TYPE_FILE:				// file				m_current_file.assign(entry->fullpath);				m_result = result::FILE;				stack_pop();				break;			}			// reset the char buffer when pressing IPT_UI_SELECT			m_filename.clear();		}		else if (event->iptkey == IPT_SPECIAL)		{			// if it's any other key and we're not maxed out, update			if (input_character(m_filename, event->unichar, uchar_is_printable))			{				ui().popup_time(ERROR_MESSAGE_TIME, "%s", m_filename.c_str());				file_selector_entry const *const cur_selected(reinterpret_cast<file_selector_entry const *>(get_selection_ref()));				// check for entries which matches our m_filename_buffer:				for (auto &entry : m_entrylist)				{					if (cur_selected != &entry)					{						int match = 0;						for (int i = 0; i < m_filename.size() + 1; i++)						{							if (core_strnicmp(entry.basename.c_str(), m_filename.c_str(), i) == 0)								match = i;						}						if (match > bestmatch)						{							bestmatch = match;							selected_entry = &entry;						}					}				}				if (selected_entry != nullptr && selected_entry != cur_selected)				{					set_selection((void *)selected_entry);					centre_selection();				}			}		}		else if (event->iptkey == IPT_UI_CANCEL)		{			// reset the char buffer also in this case			m_filename.clear();		}	}//.........这里部分代码省略.........
开发者ID:RalfVB,项目名称:mame,代码行数:101,


示例12: append_entry

void menu_file_selector::populate(){	util::zippath_directory *directory = nullptr;	osd_file::error err;	const osd::directory::entry *dirent;	const file_selector_entry *entry;	const file_selector_entry *selected_entry = nullptr;	int i;	const char *volume_name;	// open the directory	err = util::zippath_opendir(m_current_directory, &directory);	// clear out the menu entries	m_entrylist.clear();	if (m_has_empty)	{		// add the "[empty slot]" entry		append_entry(SELECTOR_ENTRY_TYPE_EMPTY, "", "");	}	if (m_has_create && !util::zippath_is_zip(directory))	{		// add the "[create]" entry		append_entry(SELECTOR_ENTRY_TYPE_CREATE, "", "");	}	if (m_has_softlist)	{		// add the "[software list]" entry		entry = &append_entry(SELECTOR_ENTRY_TYPE_SOFTWARE_LIST, "", "");		selected_entry = entry;	}	// add the drives	i = 0;	while((volume_name = osd_get_volume_name(i))!=nullptr)	{		append_entry(SELECTOR_ENTRY_TYPE_DRIVE,			volume_name, volume_name);		i++;	}	// build the menu for each item	if (err == osd_file::error::NONE)	{		while((dirent = util::zippath_readdir(directory)) != nullptr)		{			// append a dirent entry			entry = append_dirent_entry(dirent);			if (entry != nullptr)			{				// set the selected item to be the first non-parent directory or file				if ((selected_entry == nullptr) && strcmp(dirent->name, ".."))					selected_entry = entry;				// do we have to select this file?				if (!core_stricmp(m_current_file.c_str(), dirent->name))					selected_entry = entry;			}		}	}	// append all of the menu entries	for (auto &entry : m_entrylist)		append_entry_menu_item(&entry);	// set the selection (if we have one)	if (selected_entry != nullptr)		set_selection((void *) selected_entry);	// set up custom render proc	customtop = ui().get_line_height() + 3.0f * UI_BOX_TB_BORDER;	if (directory != nullptr)		util::zippath_closedir(directory);}
开发者ID:RalfVB,项目名称:mame,代码行数:79,


示例13: wxLogWarning

void ServerEvents::OnServerMessage(const std::string& message){	wxLogWarning("%s", message);	ui().OnServerMessage(m_serv, TowxString(message));}
开发者ID:OursDesCavernes,项目名称:springlobby,代码行数:5,


示例14: slLogDebugFunc

void ServerEvents::OnUnknownCommand(const std::string& command, const std::string& params){	slLogDebugFunc("");	ui().OnUnknownCommand(m_serv, TowxString(command), TowxString(params));}
开发者ID:OursDesCavernes,项目名称:springlobby,代码行数:5,


示例15: m_battle

SingleOptionDialog::SingleOptionDialog(IBattle& battle, const wxString& optiontag)    : m_battle(battle)    , m_tag(optiontag)    , m_checkbox(NULL)    , m_combobox(NULL)    , m_spinctrl(NULL)    , m_textctrl(NULL)    , m_cancel_button(NULL)    , m_ok_button(NULL){	LSL::OptionsWrapper& optWrap = m_battle.CustomBattleOptions();	LSL::Enum::GameOption optFlag = (LSL::Enum::GameOption)FromwxString(optiontag.BeforeFirst('_'));	const auto key = STD_STRING(optiontag.AfterFirst('_'));	LSL::Enum::OptionType type = optWrap.GetSingleOptionType(key);	Create((wxWindow*)&ui().mw(), wxID_ANY, _("Change option"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T( "OptionDialog" ));	if (!optWrap.keyExists(key, optFlag, false, type)) {		EndModal(wxID_CANCEL);		return;	}	wxBoxSizer* m_main_sizer = new wxBoxSizer(wxVERTICAL);	// wxStaticText* m_labelctrl = wxStaticText();	switch (type) {		case LSL::Enum::opt_bool: {			const auto opt = optWrap.m_opts[optFlag].bool_map[key];			m_checkbox = new wxCheckBox(this, wxID_ANY, TowxString(opt.name));			m_checkbox->SetToolTip(opt.description);			m_checkbox->SetValue(opt.value);			m_main_sizer->Add(m_checkbox, 0, wxEXPAND);			break;		}		case LSL::Enum::opt_float: {			const auto opt = optWrap.m_opts[optFlag].float_map[key];			m_spinctrl = new wxSpinCtrlDouble(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,							  wxSP_ARROW_KEYS, double(opt.min), double(opt.max),							  double(opt.value), double(opt.stepping), TowxString(opt.key));			m_spinctrl->SetToolTip(opt.description);			m_main_sizer->Add(m_spinctrl, 0, wxEXPAND);			break;		}		case LSL::Enum::opt_string: {			const auto opt = optWrap.m_opts[optFlag].string_map[key];			m_textctrl = new wxTextCtrl(this, wxID_ANY, TowxString(opt.value), wxDefaultPosition,						    wxDefaultSize, 0, wxDefaultValidator, TowxString(opt.key));			m_textctrl->SetToolTip(opt.description);			m_main_sizer->Add(m_textctrl, 0, wxEXPAND);			break;		}		case LSL::Enum::opt_list: {			const auto opt = optWrap.m_opts[optFlag].list_map[key];			const int temp = int(opt.cbx_choices.size() - 1);			const int index = LSL::Util::Clamp(opt.cur_choice_index, 0, temp);			m_combobox = new wxComboBox(this, wxID_ANY, TowxString(opt.cbx_choices[index]), wxDefaultPosition, wxDefaultSize,						    lslTowxArrayString(opt.cbx_choices), wxCB_READONLY, wxDefaultValidator);			std::string tooltip = opt.description + "/n";			for (const auto itor : opt.listitems) {				tooltip += "/n" + itor.name + ": " + itor.desc;			}			m_combobox->SetToolTip(tooltip);			m_main_sizer->Add(m_combobox, 0, wxEXPAND);			break;		}		default: {			EndModal(wxID_CANCEL);			return;		}	}	wxSize __SpacerSize_1 = wxDLG_UNIT(this, wxSize(0, 0));	m_main_sizer->Add(__SpacerSize_1.GetWidth(), __SpacerSize_1.GetHeight(), 0, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);	wxStaticLine* m_separator1 = new wxStaticLine(this, wxID_ANY, wxDefaultPosition, wxSize(10, -1), wxLI_HORIZONTAL, _T( "ID_STATICLINE1" ));	m_main_sizer->Add(m_separator1, 0, wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);	wxBoxSizer* m_buttons_sizer = new wxBoxSizer(wxHORIZONTAL);	m_cancel_button = new wxButton(this, ID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_CANCEL" ));	m_buttons_sizer->Add(m_cancel_button, 0, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);	m_buttons_sizer->Add(0, 0, 1, wxALL | wxEXPAND | wxSHAPED | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 0);	m_ok_button = new wxButton(this, ID_OK, _("Ok"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T( "ID_OK" ));	m_buttons_sizer->Add(m_ok_button, 0, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);	m_main_sizer->Add(m_buttons_sizer, 0, wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 0);	m_main_sizer->Fit(this);	m_main_sizer->SetSizeHints(this);	SetSizer(m_main_sizer);	Layout();	Connect(ID_CANCEL, wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&SingleOptionDialog::OnCancel);	Connect(ID_OK, wxEVT_COMMAND_BUTTON_CLICKED, (wxObjectEventFunction)&SingleOptionDialog::OnOk);}
开发者ID:springlobby,项目名称:springlobby,代码行数:92,


示例16: FUNC

static int FUNC(picture_coding_extension)(CodedBitstreamContext *ctx, RWContext *rw,                                          MPEG2RawPictureCodingExtension *current){    CodedBitstreamMPEG2Context *mpeg2 = ctx->priv_data;    int err;    HEADER("Picture Coding Extension");    ui(4, f_code[0][0]);    ui(4, f_code[0][1]);    ui(4, f_code[1][0]);    ui(4, f_code[1][1]);    ui(2, intra_dc_precision);    ui(2, picture_structure);    ui(1, top_field_first);    ui(1, frame_pred_frame_dct);    ui(1, concealment_motion_vectors);    ui(1, q_scale_type);    ui(1, intra_vlc_format);    ui(1, alternate_scan);    ui(1, repeat_first_field);    ui(1, chroma_420_type);    ui(1, progressive_frame);    if (mpeg2->progressive_sequence) {        if (current->repeat_first_field) {            if (current->top_field_first)                mpeg2->number_of_frame_centre_offsets = 3;            else                mpeg2->number_of_frame_centre_offsets = 2;        } else {            mpeg2->number_of_frame_centre_offsets = 1;        }    } else {        if (current->picture_structure == 1 || // Top field.            current->picture_structure == 2) { // Bottom field.            mpeg2->number_of_frame_centre_offsets = 1;        } else {            if (current->repeat_first_field)                mpeg2->number_of_frame_centre_offsets = 3;            else                mpeg2->number_of_frame_centre_offsets = 2;        }    }    ui(1, composite_display_flag);    if (current->composite_display_flag) {        ui(1, v_axis);        ui(3, field_sequence);        ui(1, sub_carrier);        ui(7, burst_amplitude);        ui(8, sub_carrier_phase);    }    return 0;}
开发者ID:Innovattic,项目名称:FFmpeg,代码行数:57,


示例17: switch

void menu_control_device_image::handle(){	switch(m_state)	{	case START_FILE:		m_submenu_result.filesel = menu_file_selector::result::INVALID;		menu::stack_push<menu_file_selector>(ui(), container(), &m_image, m_current_directory, m_current_file, true, m_image.image_interface()!=nullptr, m_image.is_creatable(), m_submenu_result.filesel);		m_state = SELECT_FILE;		break;	case START_SOFTLIST:		m_sld = nullptr;		menu::stack_push<menu_software>(ui(), container(), m_image.image_interface(), &m_sld);		m_state = SELECT_SOFTLIST;		break;	case START_OTHER_PART:		m_submenu_result.swparts = menu_software_parts::result::INVALID;		menu::stack_push<menu_software_parts>(ui(), container(), m_swi, m_swp->interface().c_str(), &m_swp, true, m_submenu_result.swparts);		m_state = SELECT_OTHER_PART;		break;	case SELECT_SOFTLIST:		if (!m_sld)		{			stack_pop();			break;		}		m_software_info_name.clear();		menu::stack_push<menu_software_list>(ui(), container(), m_sld, m_image.image_interface(), m_software_info_name);		m_state = SELECT_PARTLIST;		break;	case SELECT_PARTLIST:		m_swi = m_sld->find(m_software_info_name.c_str());		if (!m_swi)			m_state = START_SOFTLIST;		else if (m_swi->has_multiple_parts(m_image.image_interface()))		{			m_submenu_result.swparts = menu_software_parts::result::INVALID;			m_swp = nullptr;			menu::stack_push<menu_software_parts>(ui(), container(), m_swi, m_image.image_interface(), &m_swp, false, m_submenu_result.swparts);			m_state = SELECT_ONE_PART;		}		else		{			m_swp = m_swi->find_part("", m_image.image_interface());			load_software_part();		}		break;	case SELECT_ONE_PART:		switch(m_submenu_result.swparts) {		case menu_software_parts::result::ENTRY: {			load_software_part();			break;		}		default: // return to list			m_state = SELECT_SOFTLIST;			break;		}		break;	case SELECT_OTHER_PART:		switch(m_submenu_result.swparts) {		case menu_software_parts::result::ENTRY:			load_software_part();			break;		case menu_software_parts::result::FMGR:			m_state = START_FILE;			handle();			break;		case menu_software_parts::result::EMPTY:			m_image.unload();			stack_pop();			break;		case menu_software_parts::result::SWLIST:			m_state = START_SOFTLIST;			handle();			break;		case menu_software_parts::result::INVALID: // return to system			stack_pop();			break;		}		break;	case SELECT_FILE:		switch(m_submenu_result.filesel)		{		case menu_file_selector::result::EMPTY:			m_image.unload();			stack_pop();			break;//.........这里部分代码省略.........
开发者ID:RafTacker,项目名称:mame,代码行数:101,


示例18: enter_lobby_mode

static void enter_lobby_mode(game_display& disp, const config& game_config,	game_state& state){	DBG_MP << "entering lobby mode" << std::endl;	mp::ui::result res;	while (true) {		const config &cfg = game_config.child("lobby_music");		if (cfg) {			BOOST_FOREACH(const config &i, cfg.child_range("music")) {				sound::play_music_config(i);			}			sound::commit_music_changes();		} else {			sound::empty_playlist();			sound::stop_music();		}		lobby_info li(game_config);		// Force a black background		const Uint32 color = SDL_MapRGBA(disp.video().getSurface()->format				, 0				, 0				, 0				, 255);		sdl_fill_rect(disp.video().getSurface(), NULL, color);		if(preferences::new_lobby()) {			gui2::tlobby_main dlg(game_config, li, disp);			dlg.set_preferences_callback(				boost::bind(do_preferences_dialog,					boost::ref(disp), boost::ref(game_config)));			dlg.show(disp.video());			//ugly kludge for launching other dialogs like the old lobby			switch (dlg.get_legacy_result()) {				case gui2::tlobby_main::CREATE:					res = mp::ui::CREATE;					break;				case gui2::tlobby_main::JOIN:					res = mp::ui::JOIN;					break;				case gui2::tlobby_main::OBSERVE:					res = mp::ui::OBSERVE;					break;				default:					res = mp::ui::QUIT;			}		} else {			mp::lobby ui(disp, game_config, gamechat, gamelist);			run_lobby_loop(disp, ui);			res = ui.get_result();		}		switch (res) {		case mp::ui::JOIN:			try {				enter_wait_mode(disp, game_config, state, false);			} catch(config::error& error) {				if(!error.message.empty()) {					gui2::show_error_message(disp.video(), error.message);				}				//update lobby content				network::send_data(config("refresh_lobby"), 0);			}			break;		case mp::ui::OBSERVE:			try {				enter_wait_mode(disp, game_config, state, true);			} catch(config::error& error) {				if(!error.message.empty()) {					gui2::show_error_message(disp.video(), error.message);				}			}			// update lobby content unconditionally because we might have left only after the			// game ended in which case we ignored the gamelist and need to request it again			network::send_data(config("refresh_lobby"), 0);			break;		case mp::ui::CREATE:			try {				enter_create_mode(disp, game_config, state, false);			} catch(config::error& error) {				if (!error.message.empty())					gui2::show_error_message(disp.video(), error.message);				//update lobby content				network::send_data(config("refresh_lobby"), 0);			}			break;		case mp::ui::QUIT:			return;		case mp::ui::PREFERENCES:			{				do_preferences_dialog(disp, game_config);				//update lobby content				network::send_data(config("refresh_lobby"), 0);			}			break;		default:			return;//.........这里部分代码省略.........
开发者ID:Jackirson,项目名称:wesnoth-old,代码行数:101,


示例19: process

void menu_main::handle(){	/* process the menu */	const event *menu_event = process(0);	if (menu_event != nullptr && menu_event->iptkey == IPT_UI_SELECT) {		switch((long long)(menu_event->itemref)) {		case INPUT_GROUPS:			menu::stack_push<menu_input_groups>(ui(), container());			break;		case INPUT_SPECIFIC:			menu::stack_push<menu_input_specific>(ui(), container());			break;		case SETTINGS_DIP_SWITCHES:			menu::stack_push<menu_settings_dip_switches>(ui(), container());			break;		case SETTINGS_DRIVER_CONFIG:			menu::stack_push<menu_settings_driver_config>(ui(), container());			break;		case ANALOG:			menu::stack_push<menu_analog>(ui(), container());			break;		case BOOKKEEPING:			menu::stack_push<menu_bookkeeping>(ui(), container());			break;		case GAME_INFO:			menu::stack_push<menu_game_info>(ui(), container());			break;		case IMAGE_MENU_IMAGE_INFO:			menu::stack_push<menu_image_info>(ui(), container());			break;		case IMAGE_MENU_FILE_MANAGER:			menu::stack_push<menu_file_manager>(ui(), container(), nullptr);			break;		case TAPE_CONTROL:			menu::stack_push<menu_tape_control>(ui(), container(), nullptr);			break;		case PTY_INFO:			menu::stack_push<menu_pty_info>(ui(), container());			break;		case SLOT_DEVICES:			menu::stack_push<menu_slot_devices>(ui(), container());			break;		case NETWORK_DEVICES:			menu::stack_push<menu_network_devices>(ui(), container());			break;		case KEYBOARD_MODE:			menu::stack_push<menu_keyboard_mode>(ui(), container());			break;		case SLIDERS:			menu::stack_push<menu_sliders>(ui(), container(), false);			break;		case VIDEO_TARGETS:			menu::stack_push<menu_video_targets>(ui(), container());			break;		case VIDEO_OPTIONS:			menu::stack_push<menu_video_options>(ui(), container(), machine().render().first_target());			break;		case CROSSHAIR:			menu::stack_push<menu_crosshair>(ui(), container());			break;		case CHEAT:			menu::stack_push<menu_cheat>(ui(), container());			break;		case PLUGINS:			menu::stack_push<menu_plugin>(ui(), container());			break;		case SELECT_GAME:			if (machine().options().ui() == emu_options::UI_SIMPLE)				menu::stack_push<simple_menu_select_game>(ui(), container(), nullptr);			else				menu::stack_push<menu_select_game>(ui(), container(), nullptr);			break;		case BIOS_SELECTION:			menu::stack_push<menu_bios_selection>(ui(), container());			break;		case BARCODE_READ:			menu::stack_push<menu_barcode_reader>(ui(), container(), nullptr);			break;//.........这里部分代码省略.........
开发者ID:RalfVB,项目名称:mame,代码行数:101,



注:本文中的ui函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ uiItemL函数代码示例
C++ uhash_put函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。