void FloatingWindow::focus_set(bool active) // Sets the focus of the window. { // Bail out if there's no focus change. if (active == focused) { return; } // Store whether focused. focused = active; // If we focus, then grab the widget that was focused last. if (active) { if (last_focused_widget) { gtk_widget_grab_focus (last_focused_widget); } } // Update title bar. title_set (focused); // Set the window on top of any others that share same intersection. // It has been observed that widgets that are last added to the layout are shown on top of any others. // Therefore remove the window from the layout, and add it again so that it becomes the last one added. if (active) { // The following works to set the window above others, but the by-effects are undesirable, // therefore it is better at this stage to not do that. // One of the by-effects is that the selection in the editor gets lost. // Another one is that the comboboxes get greyed out. // g_object_ref (G_OBJECT (vbox_window)); // gtk_container_remove (GTK_CONTAINER (layout), vbox_window); // gtk_layout_put (GTK_LAYOUT (layout), vbox_window, my_gdk_rectangle.x, my_gdk_rectangle.y); // g_object_unref (G_OBJECT (vbox_window)); } // If we got focus, then alert the other windows. if (active) { gtk_button_clicked(GTK_BUTTON(focus_in_signal_button)); } }
static void on_progress(void *user_data, Evas_Object *webview, void *event_info) { MiniBrowser *app = (MiniBrowser *)user_data; double progress = *(double *)event_info; title_set(app->ee, ewk_view_title_get(app->browser), progress * 100); }
static void on_title_changed(void *user_data, Evas_Object *webview, void *event_info) { MiniBrowser *app = (MiniBrowser *)user_data; const char *title = (const char *)event_info; title_set(app->ee, title, 100); }
FloatingWindow::FloatingWindow(GtkWidget * layout_in, WindowID window_id_in, ustring title_in, bool startup) // Base class for each floating window. { // If there's no title the configuration file would get inconsistent. // Put something there. if (title_in.empty()) { title_in.append(_("Untitled")); } // Initialize variables. layout = layout_in; title = title_in; window_id = window_id_in; dragging_window = false; resizing_window = false; my_shutdown = false; clear_previous_root_coordinates (); last_focused_widget = NULL; focused = false; resize_event_id = 0; // Signalling buttons. focus_in_signal_button = gtk_button_new(); delete_signal_button = gtk_button_new(); gtkbuilder = gtk_builder_new (); gtk_builder_add_from_file (gtkbuilder, gw_build_filename (Directories->get_package_data(), "gtkbuilder.floatingwindow.xml").c_str(), NULL); vbox_window = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "vbox_window")); GtkWidget *eventbox_title; eventbox_title = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "eventbox_title")); label_title = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_title")); title_set (focused); g_signal_connect ((gpointer) eventbox_title, "button_press_event", G_CALLBACK (on_widget_button_press_event), gpointer (this)); g_signal_connect ((gpointer) eventbox_title, "button_press_event", G_CALLBACK (on_title_bar_button_press_event), gpointer (this)); g_signal_connect ((gpointer) eventbox_title, "button_release_event", G_CALLBACK (on_title_bar_button_release_event), gpointer (this)); g_signal_connect ((gpointer) eventbox_title, "motion_notify_event", G_CALLBACK (on_title_bar_motion_notify_event), gpointer (this)); g_signal_connect ((gpointer) eventbox_title, "enter_notify_event", G_CALLBACK (on_titlebar_enter_notify_event), gpointer (this)); g_signal_connect ((gpointer) eventbox_title, "leave_notify_event", G_CALLBACK (on_titlebar_leave_notify_event), gpointer (this)); GtkWidget *eventbox_close; eventbox_close = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "eventbox_close")); label_close = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_close")); g_signal_connect ((gpointer) eventbox_close, "button_press_event", G_CALLBACK (on_widget_button_press_event), gpointer (this)); g_signal_connect ((gpointer) eventbox_close, "enter_notify_event", G_CALLBACK (on_label_close_enter_notify_event), gpointer (this)); g_signal_connect ((gpointer) eventbox_close, "leave_notify_event", G_CALLBACK (on_label_close_leave_notify_event), gpointer (this)); g_signal_connect ((gpointer) eventbox_close, "button_press_event", G_CALLBACK (on_label_close_button_press_event), gpointer (this)); GtkWidget *eventbox_client; eventbox_client = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "eventbox_client")); vbox_client = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "vbox_client")); g_signal_connect ((gpointer) eventbox_client, "button_press_event", G_CALLBACK (on_widget_button_press_event), gpointer (this)); GtkWidget *eventbox_status1; eventbox_status1 = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "eventbox_status1")); label_status1 = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_status1")); g_signal_connect ((gpointer) eventbox_status1, "button_press_event", G_CALLBACK (on_widget_button_press_event), gpointer (this)); GtkWidget *eventbox_status2; eventbox_status2 = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "eventbox_status2")); label_status2 = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "label_status2")); g_signal_connect ((gpointer) eventbox_status2, "button_press_event", G_CALLBACK (on_widget_button_press_event), gpointer (this)); widget_resizer = GTK_WIDGET (gtk_builder_get_object (gtkbuilder, "widget_resizer")); g_signal_connect ((gpointer) widget_resizer, "button_press_event", G_CALLBACK (on_widget_button_press_event), gpointer (this)); g_signal_connect ((gpointer) widget_resizer, "button_press_event", G_CALLBACK (on_status_bar_button_press_event), gpointer (this)); g_signal_connect ((gpointer) widget_resizer, "button_release_event", G_CALLBACK (on_status_bar_button_release_event), gpointer (this)); g_signal_connect ((gpointer) widget_resizer, "motion_notify_event", G_CALLBACK (on_status_bar_motion_notify_event), gpointer (this)); g_signal_connect ((gpointer) widget_resizer, "enter_notify_event", G_CALLBACK (on_statusbar_enter_notify_event), gpointer (this)); g_signal_connect ((gpointer) widget_resizer, "leave_notify_event", G_CALLBACK (on_statusbar_leave_notify_event), gpointer (this)); // Do the display handling. display(startup); }
void LoadTitlesFromXML(char *langtxt, bool forcejptoen) /* langtxt: set to "English","French","German", to force language for all titles, or "" to load title depending on each game's setting */ /* forcejptoen: set to true to load English title instead of Japanese title when game is set to Japanese */ { if (nodedata == NULL) return; bool forcelang = false; if (strcmp(langtxt,"")) forcelang = true; char langcode[10] = ""; if (forcelang) strcpy(langcode,ConvertLangTextToCode(langtxt)); /* convert language text into ISO 639 two-letter language code */ /* create index of <id> elements */ nodeindex = mxmlIndexNew(nodedata,"id", NULL); nodeid = mxmlIndexReset(nodeindex); *element_text = 0; char id_text[10]; char title_text[200] = ""; char title_text_EN[200] = ""; /* search index of id elements, load all id/titles text */ while (nodeid != NULL) { nodeid = mxmlIndexFind(nodeindex,"id", NULL); if (nodeid != NULL) { strcpy(title_text,""); strcpy(title_text_EN,""); get_nodetext(nodeid, element_text, sizeof(element_text)); snprintf(id_text, 7, "%s",element_text); // if language is not forced, use game language setting from config if (!forcelang) { langtxt = GetLangSettingFromGame(id_text); strcpy(langcode,ConvertLangTextToCode(langtxt)); } /* if enabled, force English title for all games set to Japanese */ if (forcejptoen && (!strcmp(langcode,"JA"))) strcpy(langcode,"EN"); /* load title from nodes */ nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", "EN", MXML_NO_DESCEND); if (nodefound != NULL) { GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, title_text_EN,sizeof(title_text_EN)); } nodefound = mxmlFindElement(nodeid, nodedata, "locale", "lang", langcode, MXML_NO_DESCEND); if (nodefound != NULL) { GetTextFromNode(nodefound, nodedata, "title", NULL, NULL, MXML_DESCEND, title_text,sizeof(title_text)); } /* fall back to English title if prefered language was not found */ if (!strcmp(title_text,"")) { strcpy(title_text,title_text_EN); } snprintf(id_text, 7, "%s",id_text); title_set(id_text, title_text); } } // free memory mxmlIndexDelete(nodeindex); //if (xmldebug) xmlloadtime = dbg_time2(NULL); }