Esempio n. 1
0
int main(int argc, char *argv[])
{
	GUIElement *menuBar, *menu;
	gui_init_debug();

	gui_init();
	gui_set_cmd_hander(do_command);
	gui_set_evt_hander(handle_event);
	
	menuBar = gui_new_menubar();
	menu = gui_new_menu("File", file_menu_items, NUM_FILE_MENU_ITEMS);
	gui_add_menu_to_menubar(menuBar, menu);
	menu = gui_new_menu("Edit", edit_menu_items, NUM_EDIT_MENU_ITEMS);
	gui_add_menu_to_menubar(menuBar, menu);
	gMenuBar = menuBar;
	
	gui_add_rect_to_region(&gBottomElement->r);
	gui_start_redraw();
	gui_redraw_all();
	gui_fninish_redraw();
	
	gui_main_loop();
	
	gui_dispose_all_elements();

	gui_end_debug();
	
	color(15, 4, 4);
	totext();
	return 0;
}
Esempio n. 2
0
int
main (int argc, char *argv[])
{
    weechat_init (argc, argv, &gui_main_init);
    gui_main_loop ();
    weechat_end (&gui_main_end);

    return EXIT_SUCCESS;
}
Esempio n. 3
0
SDL_bool main_gngeo_gui(void) {
    if (desktop==NULL)
	init_gngeo_gui();
    if (conf.sound) SDL_PauseAudio(1);

    /* disable interpolation */
    interpolation=SDL_FALSE;

    //SDL_ShowCursor(1);
    gui_main_loop(desktop/*,conf.res_x,conf.res_y*/);
    //SDL_ShowCursor(0);

    /* reinit interpolation */
    interpolation=CF_BOOL(cf_get_item_by_name("interpolation"));

    if (conf.sound) SDL_PauseAudio(0);
    reset_frame_skip();
//    printf("Quitemu=%d\n",quit_emu);
    return quit_emu;
}
Esempio n. 4
0
/* show a dialog boy (the message MUST end with a \n) */
void gui_error_box(int x,int y,int w,int h,char *title,char *format, ...) {
    char *buf=alloca(512*sizeof(char));
    WIDGET *dialog,*label,*title_label,*button,*frame;
    char *t,*ot;
    int ypos=3;
    va_list pvar;
    va_start(pvar,format);

    vsnprintf(buf,511,format,pvar);
    dialog=(WIDGET*)gui_frame_create(NULL,x,y,w,h,FRAME_SHADOW_OUT,NULL);
    title_label=(WIDGET*)gui_label_create(NULL,3,3,1,1,title);
    gui_container_add(GUI_CONTAINER(dialog),title_label);

    frame=(WIDGET*)gui_frame_create(NULL,2,4+style_get_font_h(),
				    w-4,h-31,FRAME_SHADOW_ETCHED_IN,NULL);
    gui_container_add(GUI_CONTAINER(dialog),frame);

    ot=buf;
    while((t=strchr(ot,'\n'))!=NULL) {
	t[0]=0;t++;
	if (style_strlen(ot)>w-5) {
	    int pos=(w-5)/(float)style_get_font_w()-4;
	    ot[pos]='.';ot[pos+1]='.';ot[pos+2]='.';ot[pos+3]=0;
	}
	label=(WIDGET*)gui_label_create(NULL,3,ypos,1,1,ot);
	gui_container_add(GUI_CONTAINER(frame),label);
	ot=t;
	ypos+=style_get_font_h()+1;
    }
    button=(WIDGET*)gui_button_label_create(NULL,w-42,h-15,40,12,"Ok");
    button->click=quit_dialog;
    gui_container_add(GUI_CONTAINER(dialog),button);
    dialog->map(dialog);
    gui_main_loop(dialog);

    /* clean up */
    gui_widget_destroy_all(dialog);
}
Esempio n. 5
0
int
main (int argc, char *argv[])
{
    weechat_first_start_time = time (NULL); /* initialize start time        */
    gettimeofday (&weechat_current_start_timeval, NULL);

    setlocale (LC_ALL, "");             /* initialize gettext               */
#ifdef ENABLE_NLS
    bindtextdomain (PACKAGE, LOCALEDIR);
    bind_textdomain_codeset (PACKAGE, "UTF-8");
    textdomain (PACKAGE);
#endif

#ifdef HAVE_LANGINFO_CODESET
    weechat_local_charset = strdup (nl_langinfo (CODESET));
#else
    weechat_local_charset = strdup ("");
#endif
    utf8_init ();

    util_catch_signal (SIGINT, SIG_IGN);  /* ignore SIGINT signal           */
    util_catch_signal (SIGQUIT, SIG_IGN); /* ignore SIGQUIT signal          */
    util_catch_signal (SIGPIPE, SIG_IGN); /* ignore SIGPIPE signal          */
    util_catch_signal (SIGSEGV,
                       &debug_sigsegv); /* crash dump for SIGSEGV signal    */
    hdata_init ();                      /* initialize hdata                 */
    hook_init ();                       /* initialize hooks                 */
    debug_init ();                      /* hook signals for debug           */
    gui_main_pre_init (&argc, &argv);   /* pre-initialize interface         */
    command_init ();                    /* initialize WeeChat commands      */
    completion_init ();                 /* add core completion hooks        */
    gui_key_init ();                    /* init keys                        */
    network_init_gcrypt ();             /* init gcrypt                      */
    if (!secure_init ())                /* init secured data options (sec.*)*/
        weechat_shutdown (EXIT_FAILURE, 0);
    if (!config_weechat_init ())        /* init WeeChat options (weechat.*) */
        weechat_shutdown (EXIT_FAILURE, 0);
    weechat_parse_args (argc, argv);    /* parse command line args          */
    weechat_create_home_dir ();         /* create WeeChat home directory    */
    log_init ();                        /* init log file                    */
    plugin_api_init ();                 /* create some hooks (info,hdata,..)*/
    secure_read ();                     /* read secured data options        */
    config_weechat_read ();             /* read WeeChat options             */
    network_init_gnutls ();             /* init GnuTLS                      */
    gui_main_init ();                   /* init WeeChat interface           */
    if (weechat_upgrading)
    {
        upgrade_weechat_load ();        /* upgrade with session file        */
        weechat_upgrade_count++;        /* increase /upgrade count          */
    }
    weechat_welcome_message ();         /* display WeeChat welcome message  */
    gui_chat_print_lines_waiting_buffer (NULL); /* display lines waiting    */
    command_startup (0);                /* command executed before plugins  */
    plugin_init (weechat_auto_load_plugins, /* init plugin interface(s)     */
                 argc, argv);
    command_startup (1);                /* commands executed after plugins  */
    if (!weechat_upgrading)
        gui_layout_window_apply (gui_layout_current, -1);
    if (weechat_upgrading)
        upgrade_weechat_end ();         /* remove .upgrade files + signal   */

    gui_main_loop ();                   /* WeeChat main loop                */

    gui_layout_store_on_exit ();        /* store layout                     */
    plugin_end ();                      /* end plugin interface(s)          */
    if (CONFIG_BOOLEAN(config_look_save_config_on_exit))
        (void) config_weechat_write (); /* save WeeChat config file         */
    (void) secure_write ();             /* save secured data                */
    gui_main_end (1);                   /* shut down WeeChat GUI            */
    proxy_free_all ();                  /* free all proxies                 */
    config_weechat_free ();             /* free WeeChat options             */
    secure_free ();                     /* free secured data options        */
    config_file_free_all ();            /* free all configuration files     */
    gui_key_end ();                     /* remove all keys                  */
    unhook_all ();                      /* remove all hooks                 */
    hdata_end ();                       /* end hdata                        */
    secure_end ();                      /* end secured data                 */
    string_end ();                      /* end string                       */
    weechat_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?)       */

    return EXIT_SUCCESS;                /* make C compiler happy            */
}