GtkWidget * appwindow_new (void) { GtkWidget *window; GtkUIManager *ui; GtkWidget *vbox; GtkWidget *widget; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "Main window"); g_signal_connect (window, "delete-event", G_CALLBACK (delete_event_cb), NULL); ui = uimanager_new (); g_signal_connect_swapped (window, "destroy", G_CALLBACK (g_object_unref), ui); vbox = gtk_vbox_new (FALSE, 0); gtk_container_add (GTK_CONTAINER (window), vbox); widget = menubar_new (ui); gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); widget = toolbar_new (ui); gtk_box_pack_start (GTK_BOX (vbox), widget, FALSE, FALSE, 0); widget = content_area_new (); gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0); widget = status_bar_new (); gtk_box_pack_end (GTK_BOX (vbox), widget, FALSE, FALSE, 0); return window; }
GtkWidget * uim_toolbar_trayicon_new(void) { #if !GTK_CHECK_VERSION(2, 90, 0) gtk_rc_parse_string("\n" " style \"uim-systray-button-style\"\n" " {\n" " GtkWidget::focus-line-width=0\n" " GtkWidget::focus-padding=0\n" " ythickness=0\n" " }\n" "\n" " widget \"*.uim-systray-button\" style \"uim-systray-button-style\"\n" "\n"); #endif return toolbar_new(TYPE_ICON); }
GtkWidget * uim_toolbar_applet_new(void) { return toolbar_new(TYPE_APPLET); }
GtkWidget * uim_toolbar_standalone_new(void) { return toolbar_new(TYPE_STANDALONE); }
int App::run() { #ifdef ENABLE_UPDATER app::CheckUpdateThreadLauncher checkUpdate; #endif // Initialize GUI interface if (isGui()) { View* view; Editor* editor; PRINTF("GUI mode\n"); // Setup the GUI screen jmouse_set_cursor(JI_CURSOR_NORMAL); gui::Manager::getDefault()->invalidate(); // Load main window top_window = static_cast<Frame*>(load_widget("main_window.xml", "main_window")); box_menubar = top_window->findChild("menubar"); box_editors = top_window->findChild("editor"); box_colorbar = top_window->findChild("colorbar"); box_toolbar = top_window->findChild("toolbar"); box_statusbar = top_window->findChild("statusbar"); box_tabsbar = top_window->findChild("tabsbar"); menubar = new MenuBar(); statusbar = new StatusBar(); colorbar = new ColorBar(box_colorbar->getAlign()); toolbar = toolbar_new(); tabsbar = new Tabs(m_tabsDelegate = new AppTabsDelegate()); view = new EditorView(EditorView::CurrentEditorMode); editor = create_new_editor(); // configure all widgets to expansives menubar->setExpansive(true); statusbar->setExpansive(true); colorbar->setExpansive(true); toolbar->setExpansive(true); tabsbar->setExpansive(true); view->setExpansive(true); /* prepare the first editor */ view->attachToView(editor); /* setup the menus */ menubar->setMenu(get_root_menu()); /* start text of status bar */ app_default_statusbar_message(); /* add the widgets in the boxes */ if (box_menubar) box_menubar->addChild(menubar); if (box_editors) box_editors->addChild(view); if (box_colorbar) box_colorbar->addChild(colorbar); if (box_toolbar) box_toolbar->addChild(toolbar); if (box_statusbar) box_statusbar->addChild(statusbar); if (box_tabsbar) box_tabsbar->addChild(tabsbar); /* prepare the window */ top_window->remap_window(); // Create the list of tabs app_rebuild_documents_tabs(); app_rebuild_recent_list(); // Set current editor set_current_editor(editor); // Open the window top_window->open_window(); // Redraw the whole screen. gui::Manager::getDefault()->invalidate(); } /* set background mode for non-GUI modes */ /* if (!(ase_mode & MODE_GUI)) */ /* set_display_switch_mode(SWITCH_BACKAMNESIA); */ set_display_switch_mode(SWITCH_BACKGROUND); // procress options PRINTF("Processing options...\n"); ASSERT(m_checkArgs != NULL); { Console console; for (CheckArgs::iterator it = m_checkArgs->begin(); it != m_checkArgs->end(); ++it) { CheckArgs::Option* option = *it; switch (option->type()) { case CheckArgs::Option::OpenSprite: { // Load the sprite Document* document = load_document(option->data().c_str()); if (!document) { if (!isGui()) console.printf("Error loading file \"%s\"\n", option->data().c_str()); } else { // Mount and select the sprite UIContext* context = UIContext::instance(); context->addDocument(document); context->setActiveDocument(document); if (isGui()) { // Show it set_document_in_more_reliable_editor(context->getFirstDocument()); // Recent file getRecentFiles()->addRecentFile(option->data().c_str()); } } break; } } } delete m_checkArgs; m_checkArgs = NULL; } // Run the GUI if (isGui()) { // Support to drop files from Windows explorer install_drop_files(); #ifdef ENABLE_UPDATER // Launch the thread to check for updates. checkUpdate.launch(); #endif // Run the GUI main message loop gui_run(); // Uninstall support to drop files uninstall_drop_files(); // Remove the root-menu from the menu-bar (because the rootmenu // module should destroy it). menubar->setMenu(NULL); // Delete all editors first because they used signals from other // widgets (e.g. color bar). delete box_editors; // Destroy mini-editor. exit_module_editors(); // Destroy the top-window delete top_window; top_window = NULL; } return 0; }
void main_window_create(char **argv, gint argc) { main_window.is_app_closing = FALSE; main_window.prefmg = preferences_manager_new(); main_window.tempmg = templates_manager_new(); create_app_main_window(&main_window, _("gPHPEdit")); main_window.pbuilder = gtk_builder_new (); GError *error = NULL; guint res = gtk_builder_add_from_file (main_window.pbuilder, GPHPEDIT_UI_DIR "/gphpedit.ui", &error); if (!res) { g_critical ("Unable to load the UI file!"); g_error_free(error); return ; } GtkWidget *prinbox = get_widget_from_builder(&main_window, "prinbox"); gtk_widget_reparent (prinbox, GTK_WIDGET(main_window.window)); /* add menu bar to main window */ GtkWidget *menubox = get_widget_from_builder(&main_window, "menubox"); gtk_widget_show (menubox); main_window.pmenu_hints = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, NULL); main_window.pmenu = menubar_new (&main_window); gtk_box_pack_start (GTK_BOX (menubox), main_window.pmenu, FALSE, FALSE, 0); gtk_widget_show_all (main_window.pmenu); GtkWidget *toolbox = get_widget_from_builder(&main_window, "toolbox"); gtk_widget_show (toolbox); main_window.toolbar_main = toolbar_new (&main_window); gtk_box_pack_start (GTK_BOX (toolbox), main_window.toolbar_main, FALSE, FALSE, 0); if (get_preferences_manager_show_maintoolbar(main_window.prefmg)) gtk_widget_show (main_window.toolbar_main); main_window.symbolmg = symbol_manager_new(); main_window_create_panes(&main_window); main_window_fill_panes(&main_window); main_window_create_appbar(&main_window); g_signal_connect (G_OBJECT (main_window.window), "delete_event", G_CALLBACK(main_window_delete_event), &main_window); g_signal_connect (G_OBJECT (main_window.window), "destroy", G_CALLBACK (main_window_destroy_event), &main_window); g_signal_connect (G_OBJECT (main_window.window), "key_press_event", G_CALLBACK (main_window_key_press_event), &main_window); g_signal_connect (G_OBJECT (main_window.window), "size_allocate", G_CALLBACK (main_window_resize), &main_window); g_signal_connect (G_OBJECT (main_window.window), "window-state-event", G_CALLBACK (main_window_state_changed), &main_window); g_signal_connect (G_OBJECT (main_window.window), "focus-in-event", G_CALLBACK (main_window_activate_focus), &main_window); main_window.stylemg = gtk_source_style_scheme_manager_new (); gchar *theme_dir = g_build_path (G_DIR_SEPARATOR_S, API_DIR, "themes", NULL); gtk_source_style_scheme_manager_prepend_search_path (main_window.stylemg, theme_dir); g_free(theme_dir); main_window.docmg = document_manager_new_full(argv, argc, &main_window); g_signal_connect (G_OBJECT (main_window.docmg), "new_document", G_CALLBACK(document_manager_new_document_cb), &main_window); g_signal_connect (G_OBJECT (main_window.docmg), "change_document", G_CALLBACK(document_manager_change_document_cb), &main_window); g_signal_connect (G_OBJECT (main_window.docmg), "close_document", G_CALLBACK(document_manager_close_document_cb), &main_window); g_signal_connect (G_OBJECT (main_window.docmg), "zoom_change", G_CALLBACK(document_manager_zoom_change_cb), &main_window); /* create side panel */ create_side_panel(&main_window); update_app_title(&main_window, document_manager_get_current_documentable(main_window.docmg)); gtk_widget_show(main_window.window); }