Beispiel #1
0
MainWindow::MainWindow(std::shared_ptr<ChartModel> chart_model)
	: menu_file(nullptr)
	, menu_view(nullptr)
	, menu_help(nullptr)
	, toolbar(nullptr)
	, action_exit(nullptr)
	, action_toggle_fullscreen(nullptr)
	, action_about(nullptr)
	, action_about_qt(nullptr)
	, action_zoom_in(nullptr)
	, action_zoom_out(nullptr)
	, map_widget(nullptr)
	, chart_model(chart_model)
{
	setWindowTitle(tr("qtnavigator"));

	map_widget = new MapWidget(this);
	map_widget->set(chart_model);

	create_actions();
	create_menus();
	create_statusbar();
	create_toolbar();

	setCentralWidget(map_widget);
}
Beispiel #2
0
int main(int argc, char **argv)
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE);
    glutCreateWindow("feedback");
    glutReshapeWindow(MAXSIZE, MAXSIZE);
    glutDisplayFunc(redraw);
    glutIdleFunc(redraw);
    glutMouseFunc(mouse);
    glutMotionFunc(motion);
  
    create_menus();
    init_colours(100.0);
  
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(-1.0, 1.0, -1.0, 1.0, 0.0, 1.0);
    glViewport(0, 0, MAXSIZE, MAXSIZE);

    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    glutMainLoop();
    return 0;             /* ANSI C requires main to return int. */
}
Beispiel #3
0
GameMenu::GameMenu() :
  m_menusystem()
{
  create_menus();
  if (g_current_game)
    m_menusystem.switch_to_menu("main_ingame");
}
Beispiel #4
0
Astro_MainWindow::Astro_MainWindow()
{
	// resize our window on start-up
	this->resize( 800, 600 );

	mdi_area = new Astro_MdiArea( this );
	setCentralWidget( mdi_area );

	create_actions();
	create_menus();
	create_toolbars();
	create_statusbar();
}
Beispiel #5
0
Main_GUI::Main_GUI(int range_min,
                   int range_max,
                   int limit,
                   bool gray,
                   bool gdi,
                   bool dw,
                   int increase,
                   const char* exceptions,
                   bool ignore,
                   bool wincomp,
                   bool pre,
                   bool components,
                   bool no,
                   int fallback,
                   bool symb)
: hinting_range_min(range_min),
  hinting_range_max(range_max),
  hinting_limit(limit),
  gray_strong_stem_width(gray),
  gdi_cleartype_strong_stem_width(gdi),
  dw_cleartype_strong_stem_width(dw),
  increase_x_height(increase),
  x_height_snapping_exceptions_string(exceptions),
  ignore_restrictions(ignore),
  windows_compatibility(wincomp),
  pre_hinting(pre),
  hint_with_components(components),
  no_info(no),
  latin_fallback(fallback),
  symbol(symb)
{
  x_height_snapping_exceptions = NULL;

  create_layout();
  create_connections();
  create_actions();
  create_menus();
  create_status_bar();

  set_defaults();
  read_settings();

  setUnifiedTitleAndToolBarOnMac(true);

  // XXX register translations somewhere and loop over them
  if (QLocale::system().name() == "en_US")
    locale = new QLocale;
  else
    locale = new QLocale(QLocale::C);
}
Beispiel #6
0
int main (int argc, char *argv[])
{    
    GtkWidget *window_main;
    GtkWidget *vbox_layout_main;
    GtkWidget *notebook_main;
    GtkWidget *page_delay, *page_timer, *page_pin_diagrams;

    gtk_init (&argc, &argv);
    
    /* Arrange the global widgets */
    
    global_widgets = g_malloc (sizeof (GlobalWidgets));

    window_main = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    vbox_layout_main = gtk_vbox_new (FALSE, 0);
    notebook_main = gtk_notebook_new ();
    
    global_widgets->window_main = window_main;
    global_widgets->vbox_layout_main = vbox_layout_main;
    global_widgets->notebook_main = notebook_main;

    gtk_window_set_title (GTK_WINDOW (window_main), "Pikomatik");
    g_signal_connect (G_OBJECT (window_main), "destroy", G_CALLBACK (quit), NULL);
    gtk_widget_set_size_request (window_main, -1, 400);
    gtk_window_set_position (GTK_WINDOW (window_main), GTK_WIN_POS_CENTER);
    
    gtk_container_add (GTK_CONTAINER (window_main), vbox_layout_main);

    create_menus ();
    
    gtk_box_pack_start_defaults (GTK_BOX (vbox_layout_main), notebook_main);
    
    gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook_main), FALSE);
    
    page_delay = create_page_delay ();
    page_timer = gtk_label_new ("Geri Sayım");
    page_pin_diagrams = create_page_pin_diagrams ();

    gtk_notebook_append_page (GTK_NOTEBOOK (notebook_main), page_delay, gtk_label_new ("Gecikme"));
    gtk_notebook_append_page (GTK_NOTEBOOK (notebook_main), page_timer, gtk_label_new ("Geri Sayım"));
    gtk_notebook_append_page(GTK_NOTEBOOK (notebook_main), page_pin_diagrams, gtk_label_new ("Bacak Şemaları"));

    gtk_widget_show_all (window_main);

    gtk_main ();

    return 0;
}
Beispiel #7
0
MainWindow::MainWindow(QWidget * parent)
: QMainWindow(parent)
{
    gl_format = QGLFormat::defaultFormat();
    gl_format.setSampleBuffers(true);
    gl_format.setSamples(4);

    shared_gl = new QGLWidget(gl_format, this);

    mdi = new QMdiArea(this);
    mdi->setViewMode(QMdiArea::TabbedView);
    mdi->setTabsClosable(true);
    mdi->setTabsMovable(true);
    setCentralWidget(mdi);
    connect(mdi, SIGNAL(subWindowActivated(QMdiSubWindow*)), 
        SLOT(on_window_change(QMdiSubWindow*)));

    create_actions();
    create_menus();

    QToolBar * tool = new QToolBar("Tools", this);
    tool_group = new QActionGroup(this);
    tool->addAction(create_tool_icon("Pointer", "editor/pointer_tool.png",
        tool_group, POINTER_EDIT_TOOL));
    tool->addAction(create_tool_icon("Block", "editor/block_tool.png",
        tool_group, BLOCK_EDIT_TOOL));
    tool->addAction(create_tool_icon("Pencil", "editor/pencil_tool.png",
        tool_group, PENCIL_EDIT_TOOL));
    tool->addAction(create_tool_icon("Bucket", "editor/bucket_tool.png",
        tool_group, BUCKET_EDIT_TOOL));
    addToolBar(Qt::LeftToolBarArea, tool);

    model_dock = new QDockWidget("Model");
    model_properties = new ModelProperties(this);
    model_dock->setWidget(model_properties);
    addDockWidget(Qt::RightDockWidgetArea, model_dock);

    palette_dock = new QDockWidget("Palette");
    palette_editor = new PaletteEditor(this);
    palette_dock->setWidget(palette_editor);
    addDockWidget(Qt::RightDockWidgetArea, palette_dock);

    on_window_change(0);

    set_status("Ready...");
}
Beispiel #8
0
MainWindow::MainWindow()
	: menu_file(nullptr)
	, menu_help(nullptr)
	, action_exit(nullptr)
	, action_about(nullptr)
	, action_about_qt(nullptr)
	, btn_open(nullptr)
	, btn_close(nullptr)
	, port_name(nullptr)
	, cb_baudrate(nullptr)
	, text(nullptr)
	, port(nullptr)
{
	setWindowTitle(tr("qtnmeadiag"));

	create_actions();
	create_menus();
	setup_ui();

	port = new QSerialPort(this);
}
Beispiel #9
0
Window::Window(QMainWindow *parent) :
    QMainWindow(parent),
    image(NULL),
    last_filename(NULL)
{
    image_label = new QLabel;
    image_label->setBackgroundRole(QPalette::Base);
    image_label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
    image_label->setScaledContents(true);

    scroll_area = new QScrollArea;
    scroll_area->setBackgroundRole(QPalette::Dark);
    scroll_area->setWidget(image_label);
    setCentralWidget(scroll_area);


    create_actions();
    create_menus();
    create_toolbars();

    setWindowTitle("Simple QT");
}
Beispiel #10
0
/**
 *程序入口
 */
int main(int argc,char *argv[]){
   GtkWidget *vBox = NULL;//主布局
   GtkWidget *hPanel = NULL; //操作主布局
   GtkWidget *rightMainVBox = NULL; //右边主布局
   
   gtk_init(&argc,&argv);
   
   g_print("检查目录%d\n",check_dir());
   
   
   window = create_main_window();//创建主窗口
   set_main_window(window);//同步ui.c的window
   hPanel = gtk_hpaned_new(); //创建操作主布局
   leftCatalogVBox = gtk_vbox_new(FALSE,0);  //新建竖向布局
   rightMainVBox = gtk_vbox_new(FALSE,0);  //新建竖向布局
   
   //设置主布局
   vBox = gtk_vbox_new(FALSE,0);  //新建竖向布局
   gtk_container_add(GTK_CONTAINER(window),vBox);//向窗口加入主布局--不可视
   
   gtk_box_pack_start(GTK_BOX(vBox),create_menus(),FALSE,FALSE,0);  //添加菜单
   gtk_box_pack_start(GTK_BOX(vBox),hPanel,TRUE,TRUE,10);  //添加面板
   
   gtk_paned_add1(GTK_PANED(hPanel),leftCatalogVBox);// 添加布局
   gtk_paned_add2(GTK_PANED(hPanel),rightMainVBox);// 添加布局
   
   gtk_widget_set_size_request(leftCatalogVBox,150,300); //设置左边大小
   
   init_tree_view_catalog();
   gtk_box_pack_start(GTK_BOX(rightMainVBox),init_right_main_view(),TRUE,TRUE,0); //显示左边主要内容
   
   
   gtk_widget_show_all(window);  //显示所有组件
   
   init_right_main_view_hide_all(NULL);
   gtk_main();
   return 0;
}
Beispiel #11
0
ImagesDisplay::ImagesDisplay(QWidget *parent,QApplication *App) :
    QGLWidget(parent = 0)
{
  main_app = App;
  panel = new controlPanel(0,&ima_info);
  visible_control_panel = true;
  full_screen_on        = false;

  threshold_val = 0.5;

  //reload_file_action = new QAction(tr("display load new file"), this);
  connect(panel, SIGNAL(display_new_file()), this, SLOT(load_new_file()));

  connect(panel->hor_slider, SIGNAL(valueChanged(int)), this, SLOT(change_threshold_val(int)));
  connect(panel, SIGNAL(closing_panel()), this, SLOT(toggle_panel()));

  explorer = new scannerFileDialog(0, &ima_info);
  connect(explorer, SIGNAL(load_new_project(int,int,QString*)), this, SLOT(load_new_project(int,int,QString*)));
  visible_explorer_panel = true;
  connect(explorer, SIGNAL(closing_panel()), this, SLOT(toggle_explorer()));

  create_menus();
  ima_info.update_screen = 1;
}
Beispiel #12
0
static void
setup_window (void)
{
  GtkWidget *vbox;
  GtkWidget *packing;
  GtkWidget *menubar;

  GtkUIManager *ui_manager;
  GtkAccelGroup *accel_group;
  ClutterColor stage_color = {0x00,0x00,0x00,0xff};

  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  clutter_widget = gtk_clutter_embed_new ();
  stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (clutter_widget));

  clutter_stage_set_color (CLUTTER_STAGE(stage), &stage_color);

  clutter_actor_set_size (CLUTTER_ACTOR (stage),
                          properties->tilesize * BOARDWIDTH,
                          properties->tilesize * BOARDHEIGHT);
  clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), FALSE);

  board = gnibbles_board_new ();

  gtk_window_set_title (GTK_WINDOW (window), _("Nibbles"));

  gtk_window_set_default_size (GTK_WINDOW (window),
                               DEFAULT_WIDTH, DEFAULT_HEIGHT);
  games_conf_add_window (GTK_WINDOW (window), KEY_PREFERENCES_GROUP);

  g_signal_connect (G_OBJECT (window), "destroy",
                    G_CALLBACK (gtk_main_quit), NULL);
  g_signal_connect (G_OBJECT (window), "delete_event",
                    G_CALLBACK (delete_cb), NULL);
  g_signal_connect (G_OBJECT (window), "window_state_event",
                    G_CALLBACK (window_state_cb), NULL);

  gtk_widget_realize (window);

  vbox = gtk_vbox_new (FALSE, 0);

  games_stock_init ();
  ui_manager = gtk_ui_manager_new ();
  create_menus (ui_manager);
  set_fullscreen_actions (FALSE);
  notebook = gtk_notebook_new ();
  gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), FALSE);

  accel_group = gtk_ui_manager_get_accel_group (ui_manager);
  gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);

  menubar = gtk_ui_manager_get_widget (ui_manager, "/MainMenu");

  gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE, 0);

  packing = games_grid_frame_new (BOARDWIDTH, BOARDHEIGHT);
  gtk_widget_show (packing);

  gtk_container_add (GTK_CONTAINER (packing), clutter_widget);

#ifdef GGZ_CLIENT
  chat = create_chat_widget ();
  gtk_box_pack_start (GTK_BOX (vbox), chat, FALSE, TRUE, 0);
#endif

  g_signal_connect (G_OBJECT (clutter_widget), "configure_event",
                    G_CALLBACK (configure_event_cb), NULL);

  g_signal_connect (G_OBJECT (window), "focus_out_event",
                    G_CALLBACK (show_cursor_cb), NULL);

  gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0);
  gtk_notebook_append_page (GTK_NOTEBOOK (notebook), packing, NULL);
  gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), MAIN_PAGE);

  statusbar = gtk_statusbar_new ();
  gtk_box_pack_start (GTK_BOX (vbox), statusbar, FALSE, FALSE, 0);

  gtk_container_add (GTK_CONTAINER (window), vbox);

  gtk_widget_show_all (window);
#ifdef GGZ_CLIENT
  gtk_widget_hide (chat);
#endif

  scoreboard = gnibbles_scoreboard_new (statusbar);
}
Beispiel #13
0
static void
GyahtzeeCreateMainWindow (void)
{
  GtkWidget *hbox, *vbox;
  GtkWidget *toolbar;
  GtkWidget *tmp;
  GtkWidget *dicebox;
  GtkAccelGroup *accel_group;
  GtkBuilder *builder;
  GtkUIManager *ui_manager;
  int i, j;

  window = gtk_application_window_new (application);
  gtk_window_set_application (GTK_WINDOW (window), application);
  gtk_window_set_title (GTK_WINDOW (window), _(appName));
  gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (window), TRUE);

  //games_conf_add_window (GTK_WINDOW (window), NULL);

  g_signal_connect (G_OBJECT (window), "delete_event",
		    G_CALLBACK (quit_game), NULL);
  g_signal_connect (G_OBJECT (window), "key_press_event",
		    G_CALLBACK (key_press), NULL);

  statusbar = gtk_statusbar_new ();
  ui_manager = gtk_ui_manager_new ();
  builder = gtk_builder_new ();
  gtk_builder_add_from_string (builder, builder_description, -1, NULL);

  games_stock_prepare_for_statusbar_tooltips (ui_manager, statusbar);

	/*---- Menus ----*/
  create_menus (ui_manager);
  accel_group = gtk_ui_manager_get_accel_group (ui_manager);
  gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
  g_action_map_add_action_entries (G_ACTION_MAP (application), app_entries, G_N_ELEMENTS (app_entries), application);
  gtk_application_set_app_menu (GTK_APPLICATION (application), G_MENU_MODEL (gtk_builder_get_object (builder, "app-menu")));

	/*---- Content ----*/

  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
  vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);

  gtk_container_add (GTK_CONTAINER (window), vbox);

  gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
  gtk_box_pack_start (GTK_BOX (vbox), statusbar, FALSE, FALSE, 0);

  gtk_widget_show (statusbar);
  /* Retreive dice pixmaps from memory or files */
  LoadDicePixmaps ();

  /* Put all the dice in a vertical column */
  dicebox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
  gtk_box_pack_start (GTK_BOX (hbox), dicebox, FALSE, TRUE, 0);
  gtk_widget_show (dicebox);

  rollLabel = gtk_label_new (NULL);
  gtk_label_set_use_markup (GTK_LABEL (rollLabel), TRUE);
  gtk_widget_show (rollLabel);
  gtk_box_pack_start (GTK_BOX (dicebox), rollLabel, FALSE, TRUE, 5);

  mbutton = gtk_button_new_with_label (_("Roll!"));
  gtk_box_pack_end (GTK_BOX (dicebox), mbutton, FALSE, FALSE, 5);
  g_signal_connect (G_OBJECT (mbutton), "clicked",
		    G_CALLBACK (roll_dice), NULL);
  gtk_widget_show (GTK_WIDGET (mbutton));

  toolbar = gtk_toolbar_new ();
  gtk_orientable_set_orientation (GTK_ORIENTABLE (toolbar),
			       GTK_ORIENTATION_VERTICAL);
  gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
  gtk_toolbar_set_show_arrow (GTK_TOOLBAR (toolbar), FALSE);
  gtk_box_pack_end (GTK_BOX (dicebox), toolbar, TRUE, TRUE, 0);

  for (i = 0; i < NUMBER_OF_DICE; i++) {
    tmp = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);

    for (j = 0; j < NUMBER_OF_PIXMAPS; j++) {
      gtk_box_pack_start (GTK_BOX (tmp), dicePixmaps[i][j][GAME_YAHTZEE], FALSE, FALSE, 0);
      gtk_box_pack_start (GTK_BOX (tmp), dicePixmaps[i][j][GAME_KISMET], FALSE, FALSE, 0);
    }

    diceBox[i] = gtk_toggle_tool_button_new ();
    gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (diceBox[i]), tmp);
    g_signal_connect (G_OBJECT (diceBox[i]), "clicked",
		      G_CALLBACK (modify_dice), &DiceValues[i]);

    gtk_toolbar_insert (GTK_TOOLBAR (toolbar),
			GTK_TOOL_ITEM (diceBox[i]), -1);

    gtk_widget_show (GTK_WIDGET (diceBox[i]));
    gtk_widget_show (tmp);
  /*gtk_widget_show (dicePixmaps[i][0][game_type]);*/
  }
  gtk_widget_show (toolbar);

  /* Scores displayed in score list */
  ScoreList = create_score_list ();
  gtk_box_pack_end (GTK_BOX (hbox), ScoreList, TRUE, TRUE, 0);
  setup_score_list (ScoreList);
  gtk_widget_show (ScoreList);

  gtk_widget_show (hbox);
  gtk_widget_show (vbox);

  gtk_widget_show (window);

  GyahtzeeNewGame ();
}
Beispiel #14
0
GtkWidget *create_main_win(void)
{
	GtkWidget *win_main;
	GtkWidget *main_box;
	GtkWidget *menubar;
	GtkWidget *black_label;
	GtkWidget *black_label_frame;
	GtkWidget *white_label;
	GtkWidget *white_label_frame;
	GtkWidget *label_box;
	GtkWidget *again_button;
	GtkWidget *drawingarea;
	GtkWidget *statusbar;
	GtkAccelGroup *accel_group;

	accel_group = gtk_accel_group_new();

	win_main = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	g_object_set_data(G_OBJECT(win_main), "main_win", win_main);
	gtk_window_set_title(GTK_WINDOW(win_main), _("Reversi"));

	main_box = gtk_vbox_new(FALSE, 0);
	gtk_widget_ref(main_box);
	g_object_set_data_full(G_OBJECT(win_main), "main_box", main_box,
			       (GtkDestroyNotify) gtk_widget_unref);
	gtk_widget_show(main_box);
	gtk_container_add(GTK_CONTAINER(win_main), main_box);

	menubar = create_menus(win_main);
	gtk_widget_ref(menubar);
	g_object_set_data_full(G_OBJECT(win_main), "menubar", menubar,
			       (GtkDestroyNotify) gtk_widget_unref);
	gtk_widget_show(menubar);
	gtk_box_pack_start(GTK_BOX(main_box), menubar, FALSE, FALSE, 0);

	// Create labels frames
	white_label_frame = gtk_frame_new(NULL);
	gtk_widget_ref(white_label_frame);
	g_object_set_data_full(G_OBJECT(win_main), "white_label_frame",
			       white_label_frame,
			       (GtkDestroyNotify) gtk_widget_unref);
	gtk_widget_show(white_label_frame);

	black_label_frame = gtk_frame_new(NULL);
	gtk_widget_ref(black_label_frame);
	g_object_set_data_full(G_OBJECT(win_main), "black_label_frame",
			       black_label_frame,
			       (GtkDestroyNotify) gtk_widget_unref);
	gtk_widget_show(black_label_frame);

	// Create labels
	white_label = gtk_label_new("White: 0");
	// Why is that? Really don't know, but all the other scripts have it!
	gtk_widget_ref(white_label);
	g_object_set_data_full(G_OBJECT(win_main), "white_label",
			       white_label,
			       (GtkDestroyNotify) gtk_widget_unref);

	black_label = gtk_label_new("Black: 0");
	gtk_widget_ref(black_label);
	g_object_set_data_full(G_OBJECT(win_main), "black_label",
			       black_label,
			       (GtkDestroyNotify) gtk_widget_unref);

	gtk_container_add(GTK_CONTAINER(white_label_frame), white_label);
	gtk_container_add(GTK_CONTAINER(black_label_frame), black_label);
	gtk_widget_show(white_label);
	gtk_widget_show(black_label);

	// Play again button
	again_button = gtk_button_new_with_label("Play again");
	gtk_widget_ref(again_button);
	g_object_set_data_full(G_OBJECT(win_main), "again_button",
			       again_button,
			       (GtkDestroyNotify) gtk_widget_unref);
	//gtk_container_add(GTK_CONTAINER(win_main), again_button);


	// Label box
	label_box = gtk_hbox_new(TRUE, 5);
	gtk_widget_ref(label_box);
	g_object_set_data_full(G_OBJECT(win_main), "label_box", label_box,
			       (GtkDestroyNotify) gtk_widget_unref);

	gtk_box_pack_start(GTK_BOX(label_box), black_label_frame, FALSE,
			   TRUE, 0);
	gtk_box_pack_start(GTK_BOX(label_box), again_button, TRUE, TRUE,
			   0);
	gtk_box_pack_end(GTK_BOX(label_box), white_label_frame, FALSE,
			 TRUE, 0);
	gtk_widget_show(label_box);
	gtk_box_pack_start(GTK_BOX(main_box), label_box, FALSE, TRUE, 0);

	// Drawing area
	drawingarea = gtk_drawing_area_new();
	gtk_widget_ref(drawingarea);
	g_object_set_data_full(G_OBJECT(win_main), "drawingarea",
			       drawingarea,
			       (GtkDestroyNotify) gtk_widget_unref);
	gtk_widget_show(drawingarea);
	gtk_box_pack_start(GTK_BOX(main_box), drawingarea, TRUE, TRUE, 0);
	gtk_widget_set_size_request(drawingarea, 48 * 8, 48 * 8);
	gtk_widget_set_events(drawingarea,
			      GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK);

	// Status bar
	statusbar = gtk_statusbar_new();
	gtk_widget_ref(statusbar);
	g_object_set_data_full(G_OBJECT(win_main), "statusbar", statusbar,
			       (GtkDestroyNotify) gtk_widget_unref);
	gtk_widget_show(statusbar);
	gtk_box_pack_start(GTK_BOX(main_box), statusbar, FALSE, FALSE, 0);

	g_signal_connect(GTK_OBJECT(win_main), "delete_event",
			 GTK_SIGNAL_FUNC(main_exit), NULL);
	g_signal_connect(GTK_OBJECT(win_main), "realize",
			 GTK_SIGNAL_FUNC(on_main_win_realize), NULL);
	g_signal_connect(GTK_OBJECT(drawingarea), "configure_event",
			 GTK_SIGNAL_FUNC(configure_handle), NULL);
	g_signal_connect(GTK_OBJECT(drawingarea), "expose_event",
			 GTK_SIGNAL_FUNC(expose_handle), NULL);
	g_signal_connect(GTK_OBJECT(drawingarea), "button_press_event",
			 GTK_SIGNAL_FUNC(handle_move), NULL);
	g_signal_connect(GTK_OBJECT(again_button), "clicked",
			 GTK_SIGNAL_FUNC(play_again), NULL);

	gtk_window_add_accel_group(GTK_WINDOW(win_main), accel_group);

	return win_main;
}
Beispiel #15
0
int main(int argc, char *argv[]) {
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH |
		GLUT_STENCIL);
	if((argc > 1) && (strcmpi(argv[1], "--helmet") == 0)) {
		/*left eye*/
		glutInitWindowPosition(0,0);
		glutInitWindowSize(640, 480);
		left_eye = glutCreateWindow("Escher World - Left Eye");

		glutSetWindow(left_eye);
		set_window_size(640, 480);
		glutDisplayFunc(displayleft);
		glutKeyboardFunc(keyfunc);
		glutMouseFunc(mouse_button);
		glutPassiveMotionFunc(passive_mouse_motion);
		glutMotionFunc(passive_mouse_motion);
		glutReshapeFunc(set_window_size);
/*		glutTimerFunc(10,child,1);*/

		/* right eye */
		glutInitWindowPosition(641,0);
		glutInitWindowSize(640, 480);
		right_eye = glutCreateWindow("Escher World - Right Eye");

		glutSetWindow(right_eye);
		set_window_size(640, 480);
		glutDisplayFunc(displayright);
		glutKeyboardFunc(keyfunc);
		glutMouseFunc(mouse_button);
		glutPassiveMotionFunc(passive_mouse_motion);
		glutMotionFunc(passive_mouse_motion);
		glutReshapeFunc(set_window_size);

		glutSetWindow(left_eye);
		create_menus();
		init();
		/* Initialize the scene */
		init_scene(FILENAME);

		glutSetWindow(right_eye);
		create_menus();
		create_menus();
		init();
		/* Initialize the scene */
		init_scene(FILENAME);

#ifdef USE_HELMET
/*		main_helmet();
		signal(SIGUSR1, cleanup);
*/		birdinit();
/*		glutTimerFunc(10,child,1);*/
#endif

	} else {
		glutInitWindowPosition(64,64);

		glutInitWindowSize(768, 832);
		glut_window = glutCreateWindow("Escher World");

		glutSetWindow(glut_window);
		set_window_size(768, 832);
		helmet = !helmet;
		glutDisplayFunc(displaymid);
		glutKeyboardFunc(keyfunc);
		glutMouseFunc(mouse_button);
		glutPassiveMotionFunc(passive_mouse_motion);
		glutMotionFunc(passive_mouse_motion);
		glutReshapeFunc(set_window_size);
		create_menus();
		init();
		/* Initialize the scene */
		init_scene(FILENAME);
	}

	glutMainLoop();

	return 0;
}