verbs:: verbs(QWidget* p) : QWidget(p) , m_words(0) , m_random(0) , m_vbox(0) { srand(time(0)); initialize_menu(); }
int initialize_window(Gui *gui){ //making the window gui->window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_title(GTK_WINDOW(gui->window), "Crayon Physics A++"); gtk_window_set_default_size(GTK_WINDOW(gui->window), WINDOW_WIDTH, WINDOW_HEIGHT); gtk_window_set_position(GTK_WINDOW(gui->window), GTK_WIN_POS_CENTER); //making the grid to go in the window GtkWidget *grid; grid = gtk_grid_new(); gtk_container_add(GTK_CONTAINER(gui->window), grid); //make the menu if (!initialize_menu(grid, gui)){ return -1; } //initializing the draw area gui->draw_area = gtk_drawing_area_new(); initialize_draw_area(grid, gui->draw_area); //initialize the text entry box gui->entry = gtk_entry_new(); initialize_text_entry(grid, gui); //initialize the text view gui->text_view = gtk_text_view_new(); initialize_text_view(grid, gui); //shapes and bodies for testing gtk_widget_show_all(gui->window); cpShape *ground = cpSpaceAddStaticShape(gui->space, cpSegmentShapeNew(gui->space->staticBody, cpv(0, 1), cpv(10, 1), CRAYON_RADIUS * 2)); cpShapeSetFriction(ground, 1.0); cpSpaceAddStaticShape(gui->space, cpSegmentShapeNew(gui->space->staticBody, cpv(3, -100), cpv(3, 100), CRAYON_RADIUS * 2)); //add events and connect signals gtk_widget_add_events(gui->draw_area, GDK_BUTTON_PRESS_MASK); connect_signals(gui); return 1; }