/* ****************************************************** */ GuiCheckbox::GuiCheckbox(Gui& gui, GuiObject *parent) : GuiObject(gui, parent), caption(), state(false), mouse_is_down(false), mouse_is_in_button(false), on_click(0), on_click_data(0), style(CheckBoxStyleQuad) { load_icons(); }
static void on_icon_theme_changed (GtkIconTheme *icon_theme, GdmUserChooserWidget *widget) { g_debug ("GdmUserChooserWidget: icon theme changed"); load_icons (widget); }
GuiCheckbox::GuiCheckbox(Gui& gui, GuiObject *parent, int x, int y, const std::string& caption, bool state, OnClick on_click, void *on_click_data) : GuiObject(gui, parent, x, y, gui.get_font()->get_text_width(caption) + 9 + 5, gui.get_font()->get_font_height()), caption(caption), state(state), mouse_is_down(false), mouse_is_in_button(false), on_click(on_click), on_click_data(on_click_data), style(CheckBoxStyleQuad) { load_icons(); }
QWidget* DisneyMaterialLayerUI::create_expression_button(const string& name) { QToolButton* expression_button = new QToolButton(m_content_widget); expression_button->setIcon(load_icons("disney_expression")); expression_button->setAutoRaise(true); // enable hover state expression_button->setToolTip("Bind Expression..."); connect(expression_button, SIGNAL(clicked()), m_expression_editor_signal_mapper, SLOT(map())); m_expression_editor_signal_mapper->setMapping(expression_button, QString::fromStdString(name)); return expression_button; }
QWidget* DisneyMaterialLayerUI::create_texture_button(const string& name) { QToolButton* texture_button = new QToolButton(m_content_widget); texture_button->setIcon(load_icons("disney_texture")); texture_button->setAutoRaise(true); // enable hover state texture_button->setToolTip("Bind Texture..."); connect(texture_button, SIGNAL(clicked()), m_file_picker_signal_mapper, SLOT(map())); m_file_picker_signal_mapper->setMapping(texture_button, QString::fromStdString(name)); return texture_button; }
void icons_init(void) { load_icons(global_settings.icon_file, Iconset_Mainscreen); if (global_settings.viewers_icon_file[0] && global_settings.viewers_icon_file[0] != '-') { load_icons(global_settings.viewers_icon_file, Iconset_Mainscreen_viewers); read_viewer_theme_file(); } else { load_icons(DEFAULT_VIEWER_BMP, Iconset_Mainscreen_viewers); } #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1) load_icons(global_settings.remote_icon_file, Iconset_Remotescreen); if (global_settings.remote_viewers_icon_file[0] && global_settings.remote_viewers_icon_file[0] != '-') { load_icons(global_settings.remote_viewers_icon_file, Iconset_Remotescreen_viewers); } else { load_icons(DEFAULT_REMOTE_VIEWER_BMP, Iconset_Remotescreen_viewers); } #endif }
int main(int argc, char *argv[]) { if (argc > 2) { print_usage_and_exit(); } difficulty_t level = MEDIUM; if (argc == 2) { if (!strcmp(argv[1], "easy")) { level = EASY; } else if (!strcmp(argv[1], "medium")) { level = MEDIUM; } else if (!strcmp(argv[1], "hard")) { level = HARD; } else { print_usage_and_exit(); } } grid_t* grid = init_game_grid(level); ui_init(grid->tiles_per_row * ICON_SIZE); load_icons(grid); srand(time(0)); int done = 0; waiting = 0; previous_tile = NULL; ui_event_t event; while (!done) { while (ui_poll_event(&event)) { switch (event.type) { case ui_event_quit: done = 1; break; case ui_event_click: if (waiting) { break; } int x = event.click.x; int y = event.click.y; clicked_tile = get_clicked_tile(grid, x, y); on_tile_click(); break; } } ui_draw_grid(grid); ui_render(); } ui_destroy(); return 0; }
static void setup_icons (GdmUserChooserWidget *widget) { if (gtk_widget_has_screen (GTK_WIDGET (widget))) { widget->priv->icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (widget))); } else { widget->priv->icon_theme = gtk_icon_theme_get_default (); } if (widget->priv->icon_theme != NULL) { g_signal_connect (widget->priv->icon_theme, "changed", G_CALLBACK (on_icon_theme_changed), widget); } load_icons (widget); }
bool nk_wnd_file_picker(nk_menu_handle_t *nk, char* title, char* in, char* out, char* filter) { struct nk_panel layout; struct nk_context *ctx = &nk->ctx; const int id = NK_WND_FILE_PICKER; int i = 0; static file_list_t *drives = NULL; static struct string_list *files = NULL; settings_t *settings = config_get_ptr(); bool ret = false; if (!drives) { drives = (file_list_t*)calloc(1, sizeof(file_list_t)); frontend_driver_parse_drive_list(drives, false); } if (!string_is_empty(in) && string_is_empty(path)) { strlcpy(path, in, sizeof(path)); files = dir_list_new(path, filter, true, settings->bools.show_hidden_files, true, false); } if (!assets_loaded) load_icons(nk); if (nk_begin(ctx, title, nk_rect(10, 10, 500, 400), NK_WINDOW_CLOSABLE|NK_WINDOW_MINIMIZABLE|NK_WINDOW_MOVABLE| NK_WINDOW_BORDER)) { nk_layout_row_dynamic(ctx, 30, 4); if (drives->size == 0) { if(nk_button_image_label(ctx, icons.disk, "/", NK_TEXT_CENTERED)) { fill_pathname_join(path, "/", "", sizeof(path)); files = dir_list_new(path, filter, true, settings->bools.show_hidden_files, true, false); } } else { for (i = 0; i < drives->size; i++) { if(nk_button_image_label(ctx, icons.disk, drives->list[i].path, NK_TEXT_CENTERED)) { fill_pathname_join(path, drives->list[i].path, "", sizeof(path)); files = dir_list_new(path, filter, true, settings->bools.show_hidden_files, true, false); } } } nk_layout_row_dynamic(ctx, 30, 1); if (files) { for (i = 0; i < files->size; i++) { if (nk_button_image_label(ctx, path_is_directory(files->elems[i].data) ? icons.folder : icons.file, path_basename(files->elems[i].data), NK_TEXT_RIGHT)) { strlcpy (path, files->elems[i].data, sizeof(path)); if (path_is_directory (path)) files = dir_list_new(path, filter, true, settings->bools.show_hidden_files, true, false); } } } nk_layout_row_dynamic(ctx, 30, 1); { if (nk_button_text(ctx, "OK", 2)) { ret = true; strlcpy(out, path, sizeof(path)); nk->window[NK_WND_FILE_PICKER].open = false; path[0] = '\0'; } } } /* sort the dir list with directories first */ dir_list_sort(files, true); /* copy the path variable to out*/ /* save position and size to restore after context reset */ nk_wnd_set_state(nk, id, nk_window_get_position(ctx), nk_window_get_size(ctx)); nk_end(ctx); return ret; }
// The good old main() int main(int argc, char *argv[]) { // Initialize SDL and OpenGL init_sdl_and_gl(); // Initialize FMOD init_mixer(); // Load fonts build_font_list(); font1 = load_png("fonts.png", true, false, true); // Show the loading screen loading_screen(); // Find the level files find_levels(); // Load textures font_num = load_png("fonts_num.png", true, false, true); load_bgrounds(); load_players(); load_enemies(); load_bonus(); load_maptex(); load_bombs(); load_particles(); load_teleports(); load_traps(); load_wisps(); load_potatoman(); load_icons(); load_menus(); // Add timer to run 60 fps start_timer(60); // Menu logic int ans = show_menu(MENU_ID_MAIN); while(ans != MENU_EXIT) { // Start the game? if(ans == MENU_SINGLEPLAY) // Single player start_game(); else if(ans == MENU_MULTIPLAY) // Two players start_game(true); // Show the menu again ans = show_menu(MENU_ID_MAIN); } // Destroy timer kill_timer(); // Free stuff delete_font_list(); kill_particles(); // Kill SDL SDL_Quit(); // Close the pakfile pakfile.close_mpk(); // Close the FMOD if(music_mod){ Mix_HaltMusic(); Mix_FreeMusic(music_mod); } Mix_CloseAudio(); // Save the config save_config(get_config_location(true), &config); return 0; }
PythonConsoleWidget::PythonConsoleWidget(QWidget* parent) : QWidget(parent) , m_is_file_dirty(false) , m_opened_filepath("") { QSplitter* console_body = new QSplitter(this); console_body->setOrientation(Qt::Vertical); // Output at the top. m_output = new PythonOutput(console_body); console_body->addWidget(m_output); // Input at the bottom. m_input = new PythonEditor(console_body); connect(m_input, SIGNAL(textChanged()), this, SLOT(slot_file_changed())); connect(m_input, SIGNAL(selectionChanged()), this, SLOT(slot_change_exec_selection_button_state())); console_body->addWidget(m_input); m_action_new_file = new QAction(load_icons("project_new"), "New Python Script", this); connect(m_action_new_file, SIGNAL(triggered()), this, SLOT(slot_new_file())); addAction(m_action_new_file); m_action_open_file = new QAction(load_icons("project_open"), "Open Python Script", this); connect(m_action_open_file, SIGNAL(triggered()), this, SLOT(slot_open_file())); addAction(m_action_open_file); m_action_save_file = new QAction(load_icons("project_save"), "Save Python Script", this); connect(m_action_save_file, SIGNAL(triggered()), this, SLOT(slot_save_file())); addAction(m_action_save_file); m_action_save_file_as = new QAction(load_icons("project_reload"), "Save Python Script As...", this); connect(m_action_save_file_as, SIGNAL(triggered()), this, SLOT(slot_save_file_as())); addAction(m_action_save_file_as); const QKeySequence action_execute_all_shortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Return); m_action_execute_all = new QAction( load_icons("python_execute_all"), combine_name_and_shortcut("Execute All Code", action_execute_all_shortcut), this); m_action_execute_all->setShortcut(action_execute_all_shortcut); m_action_execute_all->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(m_action_execute_all, SIGNAL(triggered()), this, SLOT(slot_execute_all())); addAction(m_action_execute_all); const QKeySequence action_execute_selection_shortcut(Qt::CTRL + Qt::Key_Return); m_action_execute_selection = new QAction( load_icons("python_execute_selection"), combine_name_and_shortcut("Execute Selected Code", action_execute_selection_shortcut), this); m_action_execute_selection->setShortcut(action_execute_selection_shortcut); m_action_execute_selection->setShortcutContext(Qt::WidgetWithChildrenShortcut); m_action_execute_selection->setEnabled(false); connect(m_action_execute_selection, SIGNAL(triggered()), this, SLOT(slot_execute_selection())); addAction(m_action_execute_selection); const QKeySequence action_clear_selection_shortcut(Qt::CTRL + Qt::Key_D); m_action_clear_selection = new QAction( load_icons("python_clear_output"), combine_name_and_shortcut("Clear Console Output", action_clear_selection_shortcut), this); m_action_clear_selection->setShortcut(action_clear_selection_shortcut); m_action_clear_selection->setShortcutContext(Qt::WidgetWithChildrenShortcut); connect(m_action_clear_selection, SIGNAL(triggered()), this, SLOT(slot_clear_output())); addAction(m_action_clear_selection); const QKeySequence action_focus_on_input_shortcut(Qt::CTRL + Qt::Key_L); m_action_focus_on_input = new QAction( combine_name_and_shortcut("Focus on Console Input", action_focus_on_input_shortcut), this); m_action_focus_on_input->setShortcut(action_focus_on_input_shortcut); connect(m_action_focus_on_input, SIGNAL(triggered()), m_input, SLOT(setFocus())); addAction(m_action_focus_on_input); QToolBar* toolbar = new QToolBar(this); toolbar->setObjectName("python_console_toolbar"); toolbar->addAction(m_action_new_file); toolbar->addAction(m_action_open_file); toolbar->addAction(m_action_save_file); toolbar->addAction(m_action_save_file_as); toolbar->addSeparator(); toolbar->addAction(m_action_execute_selection); toolbar->addAction(m_action_execute_all); toolbar->addAction(m_action_clear_selection); QVBoxLayout* layout = new QVBoxLayout(); layout->setContentsMargins(0, 0, 0, 0); layout->addWidget(toolbar); layout->addWidget(console_body); setLayout(layout); PythonInterpreter::instance().initialize(OutputRedirector(m_output)); }
void GuiCheckbox::set_style(CheckBoxStyle style) { this->style = style; load_icons(); }
int main(void) { int error; #if _MINT_ /* HR 151102 */ have_ssystem = Ssystem(-1, 0, 0) == 0; /* HR 151102: use Ssystem where possible */ mint = (find_cookie('MiNT') == -1) ? FALSE : TRUE; magx = (find_cookie('MagX') == -1) ? FALSE : TRUE; /* HR 151102 */ geneva = (find_cookie('Gnva') == -1) ? FALSE : TRUE; /* DjV 035 080203 */ mint |= magx; /* Quick & dirty */ if (mint) { Psigsetmask(0x7FFFE14EL); Pdomain(1); } #endif x_init(); if ((ap_id = appl_init()) < 0) return -1; if (_GemParBlk.glob.version >= 0x400) { shel_write(9, 1, 0, NULL, NULL); menu_register(ap_id, " Tera Desktop"); } if (rsrc_load(RSRCNAME) == 0) form_alert(1, msg_resnfnd); else { if ((error = init_xdialog(&vdi_handle, malloc, free, "Tera Desktop", 1, &nfonts)) < 0) xform_error(error); else { init_vdi(); rsc_init(); if (((max_w / screen_info.fnt_w) < 40) || ((max_h / screen_info.fnt_h) < 25)) alert_printf(1, MRESTLOW); else { if ((error = alloc_global_memory()) == 0) { if (exec_deskbat() == FALSE) { if (load_icons() == FALSE) { if (init() == FALSE) { graf_mouse(ARROW, NULL); evntloop(); wd_del_all(); menu_bar(menu, 0); xw_close_desk(); } free_icons(); /* HR 151102 */ wind_set(0, WF_NEWDESK, NULL, 0); dsk_draw(); } } Mfree(global_memory); } else xform_error(error); } if (vq_gdos() != 0) vst_unload_fonts(vdi_handle, 0); exit_xdialog(); } rsrc_free(); } /* DjV 013 030103 100203 ---vvv--- */ /* * The following section handles system shutdown and resolution change * If a resolution change is required, shutdown is performed first * If only shutdown s required, system will reset at the end. */ /* appl_exit(); */ if ( chrez || shutdown ) /* If change resolution or shutdown ... */ { /* Tell all applications which would understand it to end */ quit = shel_write ( 4, 2, 0, NULL, NULL ); /* complete shutdown */ evnt_timer( 3000, 0 ); /* Wait a bit? */ /* /* * In Mint, must tell all proceseses to terminate nicely ? * but this is only in this group ? What to do? */ Pkill(0, SIGTERM); evnt_timer(3000, 0); /* Wait a bit? */ */ /* * After all applications have hopefully been closed, * change the screen resolution if needed; * else- reset the computer */ if ( chrez ) get_set_video(2); #if 1 else #if _MINT_ if (!mint) /* HR 230203: Dont reset under MiNT or MagiC !!!!! */ #endif { /* Perform a reset here */ #if 0 /* with warnings */ long *m; /* to memory locations */ long rv; /* reset vector */ Super ( 0L ); /* Supervisor; old stack won't be needed again */ *(m = 0x420L) = 0L; /* memctrl */ *(m = 0x43aL) = 0L; /* memval2 */ *(m = 0x426L) = 0L; /* resvalid */ m = *( m = 0x4f2 ); /* to start of OS */ rv = *(m + 4); /* to routine that handles the reset */ Supexec(rv); /* execute it */ #else /* HR: without warnings */ long (*rv)(); /* reset vector */ Super ( 0L ); /* Supervisor; old stack won't be needed again */ memctrl = 0L; memval2 = 0L; resvalid = 0L; (long)rv = *((long *)os_start + 4); /* routine that handles the reset */ Supexec(rv); /* execute it */ #endif } #endif }
void LightPathsTab::create_toolbar() { // Create the render toolbar. m_toolbar = new QToolBar(); m_toolbar->setObjectName("render_toolbar"); m_toolbar->setIconSize(QSize(18, 18)); // Save Light Paths button. QToolButton* save_light_paths_button = new QToolButton(); save_light_paths_button->setIcon(load_icons("lightpathstab_save_light_paths")); const auto light_path_count = m_project.get_light_path_recorder().get_light_path_count(); save_light_paths_button->setToolTip( QString("Save %1 Light Path%2...") .arg(QString::fromStdString(pretty_uint(light_path_count))) .arg(light_path_count > 1 ? "s" : "")); connect( save_light_paths_button , SIGNAL(clicked()), SLOT(slot_save_light_paths())); m_toolbar->addWidget(save_light_paths_button); m_toolbar->addSeparator(); // Previous Light Path button. m_prev_path_button = new QToolButton(); m_prev_path_button->setIcon(load_icons("lightpathstab_prev_light_path")); m_prev_path_button->setToolTip("Display previous light path"); m_prev_path_button->setEnabled(false); connect( m_prev_path_button, SIGNAL(clicked()), m_light_paths_widget, SLOT(slot_display_previous_light_path())); m_toolbar->addWidget(m_prev_path_button); // Next Light Path button. m_next_path_button = new QToolButton(); m_next_path_button->setIcon(load_icons("lightpathstab_next_light_path")); m_next_path_button->setToolTip("Display next light path"); m_next_path_button->setEnabled(false); connect( m_next_path_button, SIGNAL(clicked()), m_light_paths_widget, SLOT(slot_display_next_light_path())); m_toolbar->addWidget(m_next_path_button); m_toolbar->addSeparator(); // Toggle Backface Culling button. QToolButton* backface_culling_button = new QToolButton(); backface_culling_button->setIcon(load_icons("lightpathstab_toggle_backface_culling")); backface_culling_button->setToolTip("Show/hide backfacing surfaces"); backface_culling_button->setCheckable(true); backface_culling_button->setChecked(false); connect( backface_culling_button, SIGNAL(toggled(bool)), m_light_paths_widget, SLOT(slot_toggle_backface_culling(const bool))); m_toolbar->addWidget(backface_culling_button); // Synchronize Camera button. QToolButton* sync_camera_button = new QToolButton(); sync_camera_button->setIcon(load_icons("lightpathstab_synchronize_camera")); sync_camera_button->setToolTip("Synchronize the rendering camera with this camera"); connect( sync_camera_button, SIGNAL(clicked()), m_light_paths_widget, SLOT(slot_synchronize_camera())); m_toolbar->addWidget(sync_camera_button); // Add stretchy spacer. // This places interactive widgets on the left and info on the right. QWidget* spacer = new QWidget(); spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); m_toolbar->addWidget(spacer); // Create a label to display various information such as mouse coordinates, etc. m_info_label = new QLabel(); m_info_label->setObjectName("info_label"); m_toolbar->addWidget(m_info_label); }