void gimp_dialog_factory_add_dialog (GimpDialogFactory *factory, GtkWidget *dialog) { GimpDialogFactory *dialog_factory; GimpDialogFactoryEntry *entry; GList *list; gboolean toplevel; g_return_if_fail (GIMP_IS_DIALOG_FACTORY (factory)); g_return_if_fail (GTK_IS_WIDGET (dialog)); if (g_list_find (factory->open_dialogs, dialog)) { g_warning ("%s: dialog already registered", G_STRFUNC); return; } dialog_factory = gimp_dialog_factory_from_widget (dialog, &entry); if (! (dialog_factory && (entry || GIMP_IS_DOCK (dialog)))) { g_warning ("%s: dialog was not created by a GimpDialogFactory", G_STRFUNC); return; } if (dialog_factory != factory) { g_warning ("%s: dialog was created by a different GimpDialogFactory", G_STRFUNC); return; } toplevel = GTK_WIDGET_TOPLEVEL (dialog); if (entry) /* dialog is a toplevel (but not a GimpDock) or a GimpDockable */ { GIMP_LOG (DIALOG_FACTORY, "adding %s \"%s\"", toplevel ? "toplevel" : "dockable", entry->identifier); for (list = factory->session_infos; list; list = g_list_next (list)) { GimpSessionInfo *info = list->data; if ((info->toplevel_entry == entry) || (info->dockable_entry == entry)) { if (info->widget) { if (entry->singleton) { g_warning ("%s: singleton dialog \"%s\" created twice", G_STRFUNC, entry->identifier); GIMP_LOG (DIALOG_FACTORY, "corrupt session info: %p (widget %p)", info, info->widget); return; } continue; } info->widget = dialog; GIMP_LOG (DIALOG_FACTORY, "updating session info %p (widget %p) for %s \"%s\"", info, info->widget, toplevel ? "toplevel" : "dockable", entry->identifier); if (toplevel && entry->session_managed && ! GTK_WIDGET_VISIBLE (dialog)) { gimp_session_info_set_geometry (info); } break; } } if (! list) /* didn't find a session info */ { GimpSessionInfo *info = gimp_session_info_new (); info->widget = dialog; GIMP_LOG (DIALOG_FACTORY, "creating session info %p (widget %p) for %s \"%s\"", info, info->widget, toplevel ? "toplevel" : "dockable", entry->identifier); if (toplevel) { info->toplevel_entry = entry; /* if we create a new session info, we never call * gimp_session_info_set_geometry(), but still the * dialog needs GDK_HINT_USER_POS so it keeps its * position when hidden/shown within this(!) session. */ if (entry->session_managed) g_signal_connect (dialog, "configure-event", G_CALLBACK (gimp_dialog_factory_set_user_pos), NULL); } else { info->dockable_entry = entry; } factory->session_infos = g_list_append (factory->session_infos, info); } } else /* dialog is a GimpDock */ { GIMP_LOG (DIALOG_FACTORY, "adding dock"); for (list = factory->session_infos; list; list = g_list_next (list)) { GimpSessionInfo *info = list->data; /* take the first empty slot */ if (! info->toplevel_entry && ! info->dockable_entry && ! info->widget) { info->widget = dialog; GIMP_LOG (DIALOG_FACTORY, "updating session info %p (widget %p) for dock", info, info->widget); gimp_session_info_set_geometry (info); break; } } if (! list) /* didn't find a session info */ { GimpSessionInfo *info = gimp_session_info_new (); info->widget = dialog; GIMP_LOG (DIALOG_FACTORY, "creating session info %p (widget %p) for dock", info, info->widget); /* let new docks appear at the pointer position */ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE); /* if we create a new session info, we never call * gimp_session_info_set_geometry(), but still the * dialog needs GDK_HINT_USER_POS so it keeps its * position when hidden/shown within this(!) session. */ g_signal_connect (dialog, "configure-event", G_CALLBACK (gimp_dialog_factory_set_user_pos), NULL); factory->session_infos = g_list_append (factory->session_infos, info); } g_signal_emit (factory, factory_signals[DOCK_ADDED], 0, dialog); } factory->open_dialogs = g_list_prepend (factory->open_dialogs, dialog); g_signal_connect_object (dialog, "destroy", G_CALLBACK (gimp_dialog_factory_remove_dialog), factory, G_CONNECT_SWAPPED); if ((entry && entry->session_managed && toplevel) || GIMP_IS_DOCK (dialog)) g_signal_connect_object (dialog, "configure-event", G_CALLBACK (gimp_dialog_factory_dialog_configure), factory, 0); }
GtkWidget * gw_text_box_create ( GtkWindow *window, gchar *title, gchar *subject, gchar *text, GtkSignalFunc ok) { /* This is a single window, this properties may be changed */ static GtkWidget *w = NULL; GtkWidget *frame = NULL; GtkWidget *vbox = NULL; GtkWidget *hbox = NULL; GtkWidget *scroll_zone = NULL; GtkWidget *txt_area = NULL; GtkWidget *button = NULL; guint button_key; GtkAccelGroup *accel = NULL; gchar *text_utf8 = NULL; #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif /* Inits an accel group for keystroke shortcuts */ accel = gtk_accel_group_new ( ); if ( !w ) { w = gtk_window_new ( GTK_WINDOW_TOPLEVEL); gtk_window_set_policy ( GTK_WINDOW ( w), FALSE, FALSE, TRUE); g_strdup_to_gtk_text ( title, text_utf8); gtk_window_set_title ( GTK_WINDOW ( w), text_utf8); g_free ( text_utf8); gtk_window_set_modal ( GTK_WINDOW ( w),TRUE); gtk_window_set_transient_for ( GTK_WINDOW ( w), window); gtk_window_set_position ( GTK_WINDOW ( w), GTK_WIN_POS_CENTER); gtk_container_border_width ( GTK_CONTAINER ( w), 5); gtk_signal_connect ( GTK_OBJECT ( w), "destroy", GTK_SIGNAL_FUNC ( gtk_widget_destroyed), &w); /* Store parent window reference */ gtk_widget_ref ( GTK_WIDGET ( window)); gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_TEXT_BOX_PARENT_WINDOW, window, (GtkDestroyNotify) gtk_widget_unref); frame = gtk_frame_new ( subject); gtk_container_add ( GTK_CONTAINER ( w), frame); vbox = gtk_vbox_new ( FALSE, 0); gtk_container_add ( GTK_CONTAINER ( frame), vbox); gtk_container_set_border_width ( GTK_CONTAINER ( vbox), 10); /* Creates the text srollbar */ scroll_zone = gtk_scrolled_window_new ( NULL, NULL); gtk_box_pack_start ( GTK_BOX ( vbox), scroll_zone, TRUE, TRUE, 0); gtk_container_set_border_width ( GTK_CONTAINER ( scroll_zone), 5); gtk_scrolled_window_set_policy ( GTK_SCROLLED_WINDOW ( scroll_zone), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); /* Creates text area */ txt_area = gtk_text_area_new ( ); gtk_text_area_set_editable ( GTK_TEXT_AREA ( txt_area), TRUE); /* Sets default text value */ if ( text != NULL ) { gtk_text_area_insert ( GTK_TEXT_AREA ( txt_area), text); } gtk_widget_set_usize ( txt_area, 400, 300); gtk_widget_ref ( txt_area); /* Store data text reference */ gtk_object_set_data_full ( GTK_OBJECT ( w), GW_REF_TEXT_DATA_TEXT, txt_area, (GtkDestroyNotify) gtk_widget_unref); gtk_container_add ( GTK_CONTAINER ( scroll_zone), txt_area); gtk_widget_grab_focus ( txt_area); hbox = gtk_hbox_new ( TRUE, 10); gtk_container_add ( GTK_CONTAINER ( vbox), hbox); gtk_container_set_border_width ( GTK_CONTAINER ( hbox), 5); button = gtk_button_new_with_label ( ""); g_strdup_to_gtk_text ( _( "_OK"), text_utf8); button_key = gtk_label_parse_uline ( GTK_LABEL ( GTK_BIN ( button)->child), text_utf8); g_free ( text_utf8); gtk_widget_add_accelerator ( button, "clicked", accel, button_key, GDK_MOD1_MASK, 0); gtk_object_set_user_data ( GTK_OBJECT ( button), w); gtk_box_pack_start ( GTK_BOX ( hbox), button, TRUE, TRUE, 0); if ( ok != NULL ) { gtk_signal_connect ( GTK_OBJECT ( button), "clicked", GTK_SIGNAL_FUNC ( ok), w); } else { gtk_signal_connect_object ( GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC ( gtk_widget_destroy), GTK_OBJECT ( w)); } button = gtk_button_new_with_label ( ""); g_strdup_to_gtk_text ( _( "_Cancel"), text_utf8); button_key = gtk_label_parse_uline ( GTK_LABEL ( GTK_BIN ( button)->child), text_utf8); g_free ( text_utf8); gtk_widget_add_accelerator ( button, "clicked", accel, button_key, GDK_MOD1_MASK, 0); gtk_object_set_user_data ( GTK_OBJECT ( button), w); gtk_box_pack_start ( GTK_BOX ( hbox), button, TRUE, TRUE, 0); gtk_signal_connect_object ( GTK_OBJECT (button), "clicked", GTK_SIGNAL_FUNC ( gtk_widget_destroy), GTK_OBJECT ( w)); gtk_window_add_accel_group ( GTK_WINDOW ( w), accel); } if ( !GTK_WIDGET_VISIBLE ( w) ) { #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s() : show the window\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif gtk_widget_show_all ( w); } else { #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s() : destroy the window\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif gtk_widget_destroy ( w); } return w; }
BOOL xwt_gtk_base_getprop( PXWT_WIDGET widget, char *prop, PHB_ITEM pValue ) { BOOL ret = TRUE; XWT_GTK_BASE *wSelf = (PXWT_GTK_BASE) widget->widget_data; GtkWidget *wTop = wSelf->top_widget( widget ); if ( strcmp( prop, "x" ) == 0 ) { hb_itemPutNI( pValue, wSelf->x ); } else if ( strcmp( prop, "x" ) == 0 ) { hb_itemPutNI( pValue, wSelf->y ); } else if ( strcmp( prop, "width" ) == 0 ) { hb_itemPutNI( pValue, wSelf->width ); } else if ( strcmp( prop, "height" ) == 0 ) { hb_itemPutNI( pValue, wSelf->height ); } else if ( strcmp( prop, "id" ) == 0 ) { hb_itemPutNI(pValue, wSelf->nId ); } else if ( strcmp( prop, "visibility" ) == 0 ) { if ( GTK_WIDGET_VISIBLE(wTop) ) { hb_itemPutCRawStatic( pValue, "visible", 7 ); } else { hb_itemPutCRawStatic( pValue, "hidden", 6 ); } } else if ( strcmp( prop, "focus" ) == 0 ) { hb_itemPutL( pValue, (BOOL) gtk_widget_is_focus( wTop ) ); } else if ( strcmp( prop, "broadcast" ) == 0 ) { hb_itemPutL( pValue, wSelf->bBroadcast ); } else if ( strcmp( prop, "fgcolor" ) == 0 ) { if ( !wSelf->fgColor ) hb_itemPutC( pValue, "" ) ; else hb_itemPutCPtr( pValue, wSelf->fgColor, 7); } else if ( strcmp( prop, "bgcolor" ) == 0 ) { if ( wSelf->bgColor) hb_itemPutCPtr( pValue, wSelf->bgColor, 7 ); else hb_itemPutC( pValue, "" ); } else if ( strcmp( prop, "textcolor" ) == 0 ) { if ( wSelf->textColor ) hb_itemPutCPtr( pValue, wSelf->textColor, 7 ); else hb_itemPutC( pValue, "" ); } else if ( strcmp( prop, "basecolor" ) == 0 ) { if ( wSelf->baseColor ) hb_itemPutCPtr( pValue, wSelf->baseColor, 7 ); else hb_itemPutC( pValue, "" ); } else { ret = FALSE; } return ret; }
/* Add notification action */ void add_notification_action(GtkWindow *nw, const char *text, const char *key, ActionInvokedCb cb) { WindowData *windata = g_object_get_data(G_OBJECT(nw), "windata"); GtkWidget *label; GtkWidget *button; GtkWidget *hbox; GdkPixbuf *pixbuf; char *buf; g_assert(windata != NULL); if (!GTK_WIDGET_VISIBLE(windata->actions_box)) { GtkWidget *alignment; gtk_widget_show(windata->actions_box); alignment = gtk_alignment_new(1, 0.5, 0, 0); gtk_widget_show(alignment); gtk_box_pack_end(GTK_BOX(windata->actions_box), alignment, FALSE, TRUE, 0); windata->pie_countdown = gtk_drawing_area_new(); gtk_widget_show(windata->pie_countdown); gtk_container_add(GTK_CONTAINER(alignment), windata->pie_countdown); gtk_widget_set_size_request(windata->pie_countdown, PIE_WIDTH, PIE_HEIGHT); g_signal_connect(G_OBJECT(windata->pie_countdown), "expose_event", G_CALLBACK(countdown_expose_cb), windata); } button = gtk_button_new(); gtk_widget_show(button); gtk_box_pack_start(GTK_BOX(windata->actions_box), button, FALSE, FALSE, 0); hbox = gtk_hbox_new(FALSE, 6); gtk_widget_show(hbox); gtk_container_add(GTK_CONTAINER(button), hbox); /* Try to be smart and find a suitable icon. */ buf = g_strdup_printf("stock_%s", key); pixbuf = gtk_icon_theme_load_icon( gtk_icon_theme_get_for_screen( gdk_drawable_get_screen(GTK_WIDGET(nw)->window)), buf, 16, GTK_ICON_LOOKUP_USE_BUILTIN, NULL); g_free(buf); if (pixbuf != NULL) { GtkWidget *image = gtk_image_new_from_pixbuf(pixbuf); gtk_widget_show(image); gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0); gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5); } label = gtk_label_new(NULL); gtk_widget_show(label); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); buf = g_strdup_printf("<small>%s</small>", text); gtk_label_set_markup(GTK_LABEL(label), buf); g_free(buf); g_object_set_data(G_OBJECT(button), "_nw", nw); g_object_set_data_full(G_OBJECT(button), "_action_key", g_strdup(key), g_free); g_signal_connect(G_OBJECT(button), "button-release-event", G_CALLBACK(action_clicked_cb), cb); }
int module_win_visible() { return GTK_WIDGET_VISIBLE(gwin_int); }
// reflects window state in menu void update_submenu(GtkWidget *widget, gpointer user_data) { GtkMenuShell *shell = GTK_MENU_SHELL(widget); GList *list = shell->children; GList *elt; GtkCheckMenuItem *item; // regs elt = g_list_nth(list, 0); item = GTK_CHECK_MENU_ITEM(elt->data); g_signal_handlers_block_by_func(GTK_OBJECT(item), on_registers1_activate, NULL); gtk_check_menu_item_set_active(item, GTK_WIDGET_VISIBLE(dbgw.regs)); g_signal_handlers_unblock_by_func(GTK_OBJECT(item), on_registers1_activate, NULL); // bkpts elt = g_list_nth(list, 1); item = GTK_CHECK_MENU_ITEM(elt->data); g_signal_handlers_block_by_func(GTK_OBJECT(item), on_breakpoints1_activate, NULL); gtk_check_menu_item_set_active(item, GTK_WIDGET_VISIBLE(dbgw.bkpts)); g_signal_handlers_unblock_by_func(GTK_OBJECT(item), on_breakpoints1_activate, NULL); // mem elt = g_list_nth(list, 2); item = GTK_CHECK_MENU_ITEM(elt->data); g_signal_handlers_block_by_func(GTK_OBJECT(item), on_memory1_activate, NULL); gtk_check_menu_item_set_active(item, GTK_WIDGET_VISIBLE(dbgw.mem)); g_signal_handlers_unblock_by_func(GTK_OBJECT(item), on_memory1_activate, NULL); // pclog elt = g_list_nth(list, 3); item = GTK_CHECK_MENU_ITEM(elt->data); g_signal_handlers_block_by_func(GTK_OBJECT(item), on_pc_log1_activate, NULL); gtk_check_menu_item_set_active(item, GTK_WIDGET_VISIBLE(dbgw.pclog)); g_signal_handlers_unblock_by_func(GTK_OBJECT(item), on_pc_log1_activate, NULL); // stack elt = g_list_nth(list, 4); item = GTK_CHECK_MENU_ITEM(elt->data); g_signal_handlers_block_by_func(GTK_OBJECT(item), on_stack_frame1_activate, NULL); gtk_check_menu_item_set_active(item, GTK_WIDGET_VISIBLE(dbgw.stack)); g_signal_handlers_unblock_by_func(GTK_OBJECT(item), on_stack_frame1_activate, NULL); // heap elt = g_list_nth(list, 5); item = GTK_CHECK_MENU_ITEM(elt->data); g_signal_handlers_block_by_func(GTK_OBJECT(item), on_heap_frame1_activate, NULL); gtk_check_menu_item_set_active(item, GTK_WIDGET_VISIBLE(dbgw.heap)); g_signal_handlers_unblock_by_func(GTK_OBJECT(item), on_heap_frame1_activate, NULL); // ioports elt = g_list_nth(list, 6); item = GTK_CHECK_MENU_ITEM(elt->data); g_signal_handlers_block_by_func(GTK_OBJECT(item), on_ioports_frame1_activate, NULL); gtk_check_menu_item_set_active(item, GTK_WIDGET_VISIBLE(dbgw.iop)); g_signal_handlers_unblock_by_func(GTK_OBJECT(item), on_ioports_frame1_activate, NULL); // transient mode elt = g_list_nth(list, 8); item = GTK_CHECK_MENU_ITEM(elt->data); g_signal_handlers_block_by_func(GTK_OBJECT(item), on_transient1_activate, NULL); gtk_check_menu_item_set_active(item, options3.transient); g_signal_handlers_unblock_by_func(GTK_OBJECT(item), on_transient1_activate, NULL); }
GtkWidget * do_drawingarea (GtkWidget *do_widget) { GtkWidget *frame; GtkWidget *vbox; GtkWidget *da; GtkWidget *label; if (!window) { window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); gtk_window_set_title (GTK_WINDOW (window), "Drawing Area"); g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL); gtk_container_set_border_width (GTK_CONTAINER (window), 8); vbox = gtk_vbox_new (FALSE, 8); gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); gtk_container_add (GTK_CONTAINER (window), vbox); /* * Create the checkerboard area */ label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "<u>Checkerboard pattern</u>"); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); da = gtk_drawing_area_new (); /* set a minimum size */ gtk_widget_set_size_request (da, 100, 100); gtk_container_add (GTK_CONTAINER (frame), da); g_signal_connect (da, "expose_event", G_CALLBACK (checkerboard_expose), NULL); /* * Create the scribble area */ label = gtk_label_new (NULL); gtk_label_set_markup (GTK_LABEL (label), "<u>Scribble area</u>"); gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); frame = gtk_frame_new (NULL); gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN); gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0); da = gtk_drawing_area_new (); /* set a minimum size */ gtk_widget_set_size_request (da, 100, 100); gtk_container_add (GTK_CONTAINER (frame), da); /* Signals used to handle backing pixmap */ g_signal_connect (da, "expose_event", G_CALLBACK (scribble_expose_event), NULL); g_signal_connect (da,"configure_event", G_CALLBACK (scribble_configure_event), NULL); /* Event signals */ g_signal_connect (da, "motion_notify_event", G_CALLBACK (scribble_motion_notify_event), NULL); g_signal_connect (da, "button_press_event", G_CALLBACK (scribble_button_press_event), NULL); /* Ask to receive events the drawing area doesn't normally * subscribe to */ gtk_widget_set_events (da, gtk_widget_get_events (da) | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK); } if (!GTK_WIDGET_VISIBLE (window)) gtk_widget_show_all (window); else gtk_widget_destroy (window); return window; }
int philips_configure () { struct P_CONFIG_CONTROLS controls; PhilipsCfgInfo *pcfginfo; int error; GtkWidget *dialog; GtkWidget *notebook; GtkWidget *button; char *info, title[128]; /* initialize camera and grab configuration information */ if (philips_open_camera() == 0) { error_dialog ( "Could not open camera." ); return 0; } if ( (pcfginfo = philips_getcfginfo ( &error )) == NULL ) { error_dialog ( "Can't get camera configuration." ); philips_close_camera(); return ( 0 ); } philips_close_camera(); update_progress(12); sprintf ( title, "Configure Camera %s", philips_model(cameraid) ); info = (char *)malloc(2048); /* create a new dialog box */ dialog = gtk_dialog_new(); gtk_window_set_title (GTK_WINDOW(dialog), title); gtk_container_border_width(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), 10); /* create a new notebook, place the position of the tabs */ notebook = gtk_notebook_new (); gtk_notebook_set_tab_pos ( GTK_NOTEBOOK(notebook), GTK_POS_TOP ); gtk_widget_show ( notebook ); gtk_container_add ( GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), notebook ); /* add a page to the notebook */ philips_cfg_page1 ( notebook, &controls, pcfginfo ); update_progress(25); philips_cfg_page2 ( notebook, &controls, pcfginfo ); update_progress(50); philips_cfg_page3 ( notebook, &controls, pcfginfo ); update_progress(75); philips_cfg_page4 ( notebook, &controls, pcfginfo ); /* create an OK button */ button = gtk_button_new_with_label ( " OK " ); gtk_signal_connect_object ( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(dialog) ); gtk_box_pack_end ( GTK_BOX(GTK_DIALOG(dialog)->action_area), button, TRUE, FALSE, 0 ); gtk_widget_show ( button ); /* create a Cancel button */ button = gtk_button_new_with_label ( " Cancel " ); gtk_signal_connect_object ( GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_hide), GTK_OBJECT(dialog) ); gtk_box_pack_end ( GTK_BOX(GTK_DIALOG(dialog)->action_area), button, TRUE, FALSE, 0 ); gtk_widget_show ( button ); update_progress(100); gtk_widget_show ( dialog ); update_status ( "Done." ); update_progress ( 0 ); while (GTK_WIDGET_VISIBLE(dialog)) gtk_main_iteration(); /* if (strcmp("Cancel", (char*)gtk_object_get_data(GTK_OBJECT(dialog), "button"))==0) { printf ( "Cancel button pressed, return 1\n" ); return 1; } */ printf ( "Done with config, return 1\n" ); return 1; }
// FIXME: chk int module_win_visible (void) { return GTK_WIDGET_VISIBLE (g_pWinChewing); }
//----------------------------------------------------------------------------- void rebuild_sensors_tree(gboolean force_rebuild) { if (force_rebuild || (GTK_WIDGET_VISIBLE((GtkWidget*)settings_dialog) && gtk_notebook_get_current_page(settings_notebook) == 1)) // FIXME: uwazac na numerki { //printf("Przebudowa wyswietlacza listy czujnikow\n") ; // usun istniejace kolumny GList *columns = gtk_tree_view_get_columns(sensors_manage_display_tree) ; GList *col = g_list_last(columns) ; while (col != NULL) { gtk_tree_view_remove_column(sensors_manage_display_tree, col->data) ; col = g_list_previous(col) ; } ; g_list_free(columns) ; gtk_tree_view_set_model(sensors_manage_display_tree, NULL) ; // chyba nadmiar // utworz model GtkListStore *store ; store = t_sensor_list_new_store(sensors) ; gtk_tree_view_set_model(sensors_manage_display_tree, GTK_TREE_MODEL(store)) ; /////////////////////////////////// GtkCellRenderer *renderer ; GtkTreeViewColumn *column ; renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Identyfikator", renderer, "text", ID, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (sensors_manage_display_tree), column); renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Nazwa", renderer, "text", NAME, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (sensors_manage_display_tree), column); renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Rozdzielczość", renderer, "text", RESOLUTION, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (sensors_manage_display_tree), column); renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Odświeżanie", renderer, "text", REFRESH_TIME, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (sensors_manage_display_tree), column); renderer = gtk_cell_renderer_toggle_new (); column = gtk_tree_view_column_new_with_attributes ("Buforowany", renderer, "active", CACHED, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (sensors_manage_display_tree), column); renderer = gtk_cell_renderer_text_new (); column = gtk_tree_view_column_new_with_attributes ("Liczba punktów", renderer, "text", N_POINTS_BUFFERED, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (sensors_manage_display_tree), column); renderer = gtk_cell_renderer_toggle_new (); column = gtk_tree_view_column_new_with_attributes ("Dostępny", renderer, "active", SENSOR_PRESENT, NULL); gtk_tree_view_append_column (GTK_TREE_VIEW (sensors_manage_display_tree), column); // usuniecie selekcji GtkTreeSelection *selection; selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(sensors_manage_display_tree)); gtk_tree_selection_unselect_all (selection) ; gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE) ; //g_object_unref(renderer) ; // chyba nie mozna, doczytac !!! g_object_unref(store) ; } ; } ;
GtkWidget * do_hypertext (GtkWidget *do_widget) { static GtkWidget *window = NULL; if (!window) { GtkWidget *view; GtkWidget *sw; GtkTextBuffer *buffer; hand_cursor = gdk_cursor_new (GDK_HAND2); regular_cursor = gdk_cursor_new (GDK_XTERM); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_screen (GTK_WINDOW (window), gtk_widget_get_screen (do_widget)); gtk_window_set_default_size (GTK_WINDOW (window), 450, 450); g_signal_connect (window, "destroy", G_CALLBACK (gtk_widget_destroyed), &window); gtk_window_set_title (GTK_WINDOW (window), "Hypertext"); gtk_container_set_border_width (GTK_CONTAINER (window), 0); view = gtk_text_view_new (); gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD); g_signal_connect (view, "key-press-event", G_CALLBACK (key_press_event), NULL); g_signal_connect (view, "event-after", G_CALLBACK (event_after), NULL); g_signal_connect (view, "motion-notify-event", G_CALLBACK (motion_notify_event), NULL); g_signal_connect (view, "visibility-notify-event", G_CALLBACK (visibility_notify_event), NULL); buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)); sw = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); gtk_container_add (GTK_CONTAINER (window), sw); gtk_container_add (GTK_CONTAINER (sw), view); show_page (buffer, 1); gtk_widget_show_all (sw); } if (!GTK_WIDGET_VISIBLE (window)) { gtk_widget_show (window); } else { gtk_widget_destroy (window); window = NULL; } return window; }
/* create and display the dialog box */ void makeWidget(PluginInstance *This) { GtkWidget *dialogWindow; GtkWidget *dialogMessage; GtkWidget *okButton; GtkWidget *cancelButton; char message[1024]; MimeTypeElement *ele; if (!This) return; /* need to check whether we already pop up a dialog box for previous minetype in the same web page. It's require otherwise there will be 2 dialog boxes pop if there are 2 plugin in the same web page */ if ((ele = isExist(&head, This->type))) { if (ele->pinst && ele->pinst->dialogBox) { GtkWidget *top_window = gtk_widget_get_toplevel(ele->pinst->dialogBox); if (top_window && GTK_WIDGET_VISIBLE(top_window)) { /* this will raise the toplevel window */ gdk_window_show(top_window->window); } } return; } dialogWindow = gtk_dialog_new(); This->dialogBox = dialogWindow; This->exists = TRUE; This->dialogBox = dialogWindow; addToList(&head, This); gtk_window_set_title(GTK_WINDOW(dialogWindow), PLUGIN_NAME); gtk_window_set_position(GTK_WINDOW(dialogWindow), GTK_WIN_POS_CENTER); gtk_window_set_modal(GTK_WINDOW(dialogWindow), FALSE); gtk_container_set_border_width(GTK_CONTAINER(dialogWindow), 20); gtk_window_set_policy(GTK_WINDOW(dialogWindow), FALSE, FALSE, TRUE); PR_snprintf(message, sizeof(message) - 1, MESSAGE, This->type); dialogMessage = AddWidget(gtk_label_new (message), GTK_DIALOG(dialogWindow)->vbox); okButton= AddWidget(gtk_button_new_with_label (OK_BUTTON), GTK_DIALOG(dialogWindow)->action_area); gtk_object_set_data(GTK_OBJECT(okButton), DIALOGID, dialogWindow); GTK_WIDGET_SET_FLAGS (okButton, GTK_CAN_DEFAULT); gtk_widget_grab_default(okButton); cancelButton= AddWidget(gtk_button_new_with_label (CANCEL_BUTTON), GTK_DIALOG(dialogWindow)->action_area); gtk_signal_connect (GTK_OBJECT(okButton), "clicked", GTK_SIGNAL_FUNC(DialogOKClicked), This); gtk_signal_connect (GTK_OBJECT(cancelButton), "clicked", GTK_SIGNAL_FUNC(DialogCancelClicked), This); gtk_signal_connect(GTK_OBJECT(dialogWindow), "key_press_event", GTK_SIGNAL_FUNC (DialogEscapePressed), NULL); /* hookup to when the dialog is destroyed */ gtk_signal_connect(GTK_OBJECT(dialogWindow), "destroy", GTK_SIGNAL_FUNC(onDestroyWidget), This); gtk_widget_show_all(dialogWindow); }
//********************************************************************************* void guiControl::guiControl(void *button, void* data) { if (pos_winPid != NULL) { gtk_window_set_keep_above (GTK_WINDOW(pos_winPid),true); return; } gtkClassData* currentClassData = (gtkClassData*) data; partMover *currentPart = currentClassData->partPointer; joint = currentClassData->indexPointer; icntrl = currentPart->get_IControlMode(); ipid = currentPart->get_IPidControl(); iamp = currentPart->get_IAmplifierControl(); //GtkWidget *winPid = NULL; GtkWidget *inv = NULL; //adding a popup window pos_winPid = gtk_window_new (GTK_WINDOW_TOPLEVEL); char title[255]; sprintf(title,"Control mode JNT:%d",*joint); gtk_window_set_title (GTK_WINDOW (pos_winPid), title); //adding a set of display inv = gtk_fixed_new (); gtk_container_add (GTK_CONTAINER (pos_winPid), inv); label_title = gtk_label_new (title); radiobutton_mode_idl = gtk_radio_button_new_with_label (NULL, "idle"); radiobutton_mode_pos = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radiobutton_mode_idl), "position"); radiobutton_mode_vel = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radiobutton_mode_idl), "velocity"); radiobutton_mode_trq = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radiobutton_mode_idl), "torque"); radiobutton_mode_imp_pos = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radiobutton_mode_idl), "impedance position"); radiobutton_mode_imp_vel = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radiobutton_mode_idl), "impedance velocity"); radiobutton_mode_open = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radiobutton_mode_idl), "openloop"); radiobutton_mode_pos_direct = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radiobutton_mode_idl), "position direct"); radiobutton_mode_mixed = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON (radiobutton_mode_idl), "mixed"); gtk_fixed_put (GTK_FIXED(inv), label_title, 10, 10 ); gtk_fixed_put (GTK_FIXED(inv), radiobutton_mode_idl, 10, 30 ); gtk_fixed_put (GTK_FIXED(inv), radiobutton_mode_pos, 10, 50 ); gtk_fixed_put (GTK_FIXED(inv), radiobutton_mode_pos_direct, 10, 70 ); gtk_fixed_put (GTK_FIXED(inv), radiobutton_mode_mixed, 10, 90 ); gtk_fixed_put (GTK_FIXED(inv), radiobutton_mode_vel, 10, 110 ); gtk_fixed_put (GTK_FIXED(inv), radiobutton_mode_trq, 10, 130 ); gtk_fixed_put (GTK_FIXED(inv), radiobutton_mode_imp_pos, 10, 150 ); gtk_fixed_put (GTK_FIXED(inv), radiobutton_mode_imp_vel, 10, 170 ); gtk_fixed_put (GTK_FIXED(inv), radiobutton_mode_open, 10, 190 ); int control_mode=VOCAB_CM_UNKNOWN; bool ret = icntrl->getControlMode(*joint, &control_mode); update_menu(control_mode); //Rememeber: these signal_connect MUST be placed after the update_menu! g_signal_connect (radiobutton_mode_idl, "clicked",G_CALLBACK (radio_click_idl), &radiobutton_mode_idl); g_signal_connect (radiobutton_mode_pos, "clicked",G_CALLBACK (radio_click_pos), &radiobutton_mode_pos); g_signal_connect (radiobutton_mode_pos_direct, "clicked",G_CALLBACK (radio_click_pos_direct), &radiobutton_mode_pos_direct); g_signal_connect (radiobutton_mode_mixed, "clicked",G_CALLBACK (radio_click_mode_mixed), &radiobutton_mode_mixed); g_signal_connect (radiobutton_mode_vel, "clicked",G_CALLBACK (radio_click_vel), &radiobutton_mode_vel); g_signal_connect (radiobutton_mode_trq, "clicked",G_CALLBACK (radio_click_trq), &radiobutton_mode_trq); g_signal_connect (radiobutton_mode_imp_pos, "clicked",G_CALLBACK (radio_click_imp_pos), &radiobutton_mode_imp_pos); g_signal_connect (radiobutton_mode_imp_vel, "clicked",G_CALLBACK (radio_click_imp_vel), &radiobutton_mode_imp_vel); g_signal_connect (radiobutton_mode_open, "clicked",G_CALLBACK (radio_click_open), &radiobutton_mode_open); //connection to the destroyer g_signal_connect (pos_winPid, "destroy",G_CALLBACK (destroy_main), &pos_winPid); //make it visible if (!GTK_WIDGET_VISIBLE (pos_winPid)) gtk_widget_show_all (pos_winPid); else { gtk_widget_destroy (pos_winPid); pos_winPid = NULL; } gtk_window_set_keep_above (GTK_WINDOW(pos_winPid),true); gtk_main (); return; }
static void toggle_fullscreen() { static gboolean full_screen = FALSE; static GtkWidget *fullscreen_win = NULL; static GtkWidget *window_bc; #if 0 static gint w=0,h=0,x=0,y=0; GdkGeometry geom; #endif if (!window) return; if (!GTK_WIDGET_VISIBLE(tv)) return; full_screen = full_screen?FALSE:TRUE; if (full_screen) { /* go fullscreen */ if (verbose) g_print("Going to full-screen mode (%dx%d)\n", gdk_screen_width(), gdk_screen_height()); /* create new window, attach tvplug to it and show */ fullscreen_win = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_signal_connect(GTK_OBJECT(fullscreen_win), "key_press_event", GTK_SIGNAL_FUNC(tv_typed), NULL); gtk_signal_connect(GTK_OBJECT(fullscreen_win), "focus_in_event", GTK_SIGNAL_FUNC(focus_in_event), NULL); gtk_signal_connect(GTK_OBJECT(fullscreen_win), "focus_out_event", GTK_SIGNAL_FUNC(focus_out_event), NULL); gtk_widget_ref(tv); gtk_widget_hide(tv); gtk_container_remove (GTK_CONTAINER (window), tv); gtk_container_add (GTK_CONTAINER (fullscreen_win), tv); gtk_widget_show(tv); gtk_widget_set_usize(fullscreen_win, gdk_screen_width(), gdk_screen_height()); gtk_widget_set_uposition(fullscreen_win, 0, 0); gtk_widget_realize(fullscreen_win); gdk_window_set_decorations(fullscreen_win->window, 0); gtk_widget_show(fullscreen_win); /* TODO: * gtk_window_set_transient_for(GTK_WINDOW(fullscreen_win), GTK_WINDOW(window)); * Make the settings/options windows transient for both them * and make this fullscreen window appear *in front of* the Gnome panel and such */ window_bc = window; window = fullscreen_win; } else { window = window_bc; /* go back to windowed mode */ if (verbose) g_print("Going to windowed mode\n"); /* attach tvplug back to old window and delete fullscreen window */ gtk_widget_ref(tv); gtk_widget_hide(tv); gtk_container_remove (GTK_CONTAINER (fullscreen_win), tv); gtk_container_add (GTK_CONTAINER (window), tv); gtk_widget_show(tv); gtk_widget_destroy(fullscreen_win); fullscreen_win = NULL; } }
GtkWidget * gw_file_selection_box_create ( gchar *title, gchar *filename, GtkSignalFunc ok, GtkSignalFunc cancel) { static GtkWidget *w = NULL; GtkWidget *button; GtkWindow *window = NULL; gchar *text_utf8 = NULL; #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif if ( !w ) { window = gw_gui_manager_main_interface_get_main_window ( ); g_strdup_to_gtk_text ( title, text_utf8); w = gtk_file_selection_new ( text_utf8); g_free ( text_utf8); if ( filename != NULL ) { g_strdup_to_gtk_text ( filename, text_utf8); gtk_file_selection_set_filename ( GTK_FILE_SELECTION ( w), text_utf8); g_free ( text_utf8); } gtk_window_set_policy ( GTK_WINDOW ( w), FALSE, FALSE, TRUE); gtk_file_selection_hide_fileop_buttons ( GTK_FILE_SELECTION ( w)); gtk_window_set_modal ( GTK_WINDOW ( w), TRUE); gtk_window_set_transient_for ( GTK_WINDOW ( w), GTK_WINDOW ( window)); gtk_window_set_position ( GTK_WINDOW ( w), GTK_WIN_POS_CENTER); gtk_signal_connect ( GTK_OBJECT ( w), "destroy", GTK_SIGNAL_FUNC ( gtk_widget_destroyed), &w); gtk_button_set_relief ( GTK_BUTTON ( GTK_FILE_SELECTION ( w)->ok_button), GTK_RELIEF_HALF); if ( ok != NULL ) { gtk_signal_connect ( GTK_OBJECT ( GTK_FILE_SELECTION ( w)->ok_button), "clicked", GTK_SIGNAL_FUNC ( ok), w); } if ( cancel != NULL ) { gtk_signal_connect ( GTK_OBJECT ( GTK_FILE_SELECTION ( w)->cancel_button), "clicked", GTK_SIGNAL_FUNC ( cancel), w); } else { gtk_signal_connect_object ( GTK_OBJECT ( GTK_FILE_SELECTION ( w)->cancel_button), "clicked", GTK_SIGNAL_FUNC ( gtk_widget_destroy), GTK_OBJECT ( w)); } g_strdup_to_gtk_text ( _( "Hide file operations"), text_utf8); button = gtk_button_new_with_label ( text_utf8); g_free ( text_utf8); gtk_signal_connect ( GTK_OBJECT ( button), "clicked", (GtkSignalFunc) gw_file_selection_box_hide_fileops, (gpointer) w); gtk_box_pack_start ( GTK_BOX ( GTK_FILE_SELECTION ( w)->action_area), button, FALSE, FALSE, 0); g_strdup_to_gtk_text ( _( "Show file operation"), text_utf8); button = gtk_button_new_with_label ( text_utf8); g_free ( text_utf8); gtk_signal_connect_object ( GTK_OBJECT ( button), "clicked", (GtkSignalFunc) gtk_file_selection_show_fileop_buttons, (gpointer) w); gtk_box_pack_start ( GTK_BOX ( GTK_FILE_SELECTION ( w)->action_area), button, FALSE, FALSE, 0); } if ( !GTK_WIDGET_VISIBLE ( w) ) { gtk_widget_show_all ( w); } else { gtk_widget_destroy ( w); } return w; }
static void gtk_plot_polar_real_paint (GtkWidget *widget) { GtkPlot *plot; GtkPlotText *child_text; GtkStyle *style; GdkPixmap *pixmap; GList *dataset; GList *text; gint width, height; gint xoffset, yoffset ; gdouble min; if(!GTK_WIDGET_VISIBLE(widget)) return; plot = GTK_PLOT(widget); xoffset = plot->internal_allocation.x; yoffset = plot->internal_allocation.y; width = plot->internal_allocation.width; height = plot->internal_allocation.height; style = gtk_widget_get_style(widget); pixmap = plot->drawable; gtk_plot_pc_gsave(plot->pc); gtk_plot_pc_set_color(plot->pc, &plot->background); if(!gtk_plot_is_transparent(GTK_PLOT(plot))) gtk_plot_pc_draw_rectangle (plot->pc, TRUE, xoffset, yoffset, width , height); /* draw frame to guide the eyes*/ /* gdk_draw_rectangle (pixmap, gc, FALSE, xoffset, yoffset, width , height); */ /* draw the ticks & grid lines */ min = plot->left->ticks.min; plot->left->ticks.min = 0.0; gtk_plot_axis_ticks_recalc(plot->left); gtk_plot_axis_ticks_recalc(plot->bottom); plot->left->ticks.min = min; if(plot->left->is_visible) { GtkPlotVector tick_direction; tick_direction.x = 1.; tick_direction.y = 0.; plot->left->origin.x = (gfloat)width*plot->left_align; plot->left->origin.y = height; gtk_plot_polar_draw_axis(GTK_PLOT_POLAR(plot), plot->left, tick_direction); gtk_plot_polar_draw_labels(GTK_PLOT_POLAR(plot), plot->left, tick_direction); } if(plot->top->is_visible) { GtkPlotVector tick_direction; tick_direction.x = 0.; tick_direction.y = 1.; plot->left->direction.x = 1; plot->left->direction.y = 0; plot->left->origin.x = 0; plot->left->origin.y = (gfloat)height*plot->left_align; gtk_plot_polar_draw_axis(GTK_PLOT_POLAR(plot), plot->left, tick_direction); gtk_plot_polar_draw_labels(GTK_PLOT_POLAR(plot), plot->left, tick_direction); plot->left->direction.x = 0; plot->left->direction.y = -1; } if(plot->bottom->is_visible) { gtk_plot_polar_draw_circle(GTK_PLOT_POLAR(plot)); } gtk_plot_polar_draw_grids(GTK_PLOT_POLAR(plot)); dataset = plot->data_sets; while(dataset) { GTK_PLOT_DATA_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(dataset->data)))->draw_data(GTK_PLOT_DATA(dataset->data)); dataset = dataset->next; } text = plot->text; while(text) { child_text = (GtkPlotText *) text->data; gtk_plot_draw_text(plot, *child_text); text = text->next; } GTK_PLOT_CLASS(GTK_OBJECT_GET_CLASS(GTK_OBJECT(plot)))->draw_legends(widget); gtk_plot_pc_grestore(plot->pc); }
static void set_itip_view (SunOneInvitationList *list, int row) { SunOneInvitationListPrivate *priv = list->priv; ECalComponent *comp; ECalComponentText text; const char *string; ECalComponentDateTime datetime; GString *gstring = NULL; GSList *description_list, *l; SunOneItipView *itip_view; ECalComponentOrganizer organizer; if (row == -1) { if (GTK_WIDGET_VISIBLE (priv->control)) gtk_widget_hide (priv->control); return; } comp = sunone_invitation_list_model_get_comp (priv->model, row); if (!comp) return; itip_view = (SunOneItipView *)priv->control; sunone_itip_view_set_mode (itip_view, SUNONE_ITIP_VIEW_MODE_REQUEST); sunone_itip_view_set_item_type (itip_view, E_CAL_SOURCE_TYPE_EVENT); e_cal_component_get_organizer (comp, &organizer); sunone_itip_view_set_organizer (itip_view, organizer.cn ? organizer.cn : itip_strip_mailto (organizer.value)); sunone_itip_view_set_sentby (itip_view, organizer.sentby); e_cal_component_get_summary (comp, &text); sunone_itip_view_set_summary (itip_view, text.value ? text.value : _("None")); e_cal_component_get_location (comp, &string); sunone_itip_view_set_location (itip_view, string); e_cal_component_get_description_list (comp, &description_list); for (l = description_list; l; l = l->next) { ECalComponentText *text = l->data; if (!gstring && text->value) gstring = g_string_new (text->value); else if (text->value) g_string_append_printf (gstring, "\n\n%s", text->value); } e_cal_component_free_text_list (description_list); if (gstring) { sunone_itip_view_set_description (itip_view, gstring->str); g_string_free (gstring, TRUE); } else sunone_itip_view_set_description (itip_view, NULL); e_cal_component_get_dtstart (comp, &datetime); if (datetime.value) { struct tm start_tm; start_tm = icaltimetype_to_tm_with_zone (datetime.value, icaltimezone_get_utc_timezone (), priv->model->zone); sunone_itip_view_set_start (itip_view, &start_tm); } e_cal_component_free_datetime (&datetime); e_cal_component_get_dtend (comp, &datetime); if (datetime.value) { struct tm end_tm; end_tm = icaltimetype_to_tm_with_zone (datetime.value, icaltimezone_get_utc_timezone (), priv->model->zone); sunone_itip_view_set_end (itip_view, &end_tm); } e_cal_component_free_datetime (&datetime); /* Recurrence info */ sunone_itip_view_clear_upper_info_items (itip_view); if (e_cal_component_has_recurrences (comp)) { sunone_itip_view_add_upper_info_item (itip_view, SUNONE_ITIP_VIEW_INFO_ITEM_TYPE_INFO, "This meeting recurs"); } sunone_itip_view_set_status (itip_view, NULL); sunone_itip_view_set_comment (itip_view, NULL); sunone_itip_view_set_show_rsvp (itip_view, FALSE); if (!GTK_WIDGET_VISIBLE (priv->control)) gtk_widget_show (priv->control); }
static void bar_exif_update(ExifBar *eb) { ExifData *exif; gint len, i; exif = exif_read(eb->path, FALSE); if (!exif) { bar_exif_sensitive(eb, FALSE); return; } bar_exif_sensitive(eb, TRUE); if (GTK_WIDGET_VISIBLE(eb->scrolled)) { GList *list; len = bar_exif_key_count; for (i = 0; i < len; i++) { gchar *text; text = exif_get_data_as_text(exif, bar_exif_key_list[i]); text = bar_exif_validate_text(text); gtk_label_set_text(GTK_LABEL(eb->labels[i]), text); g_free(text); } list = g_list_last(history_list_get_by_key("exif_extras")); if (list) { gtk_widget_show(eb->custom_sep); } else { gtk_widget_hide(eb->custom_sep); } i = 0; while (list && i < EXIF_BAR_CUSTOM_COUNT) { gchar *text; gchar *name; gchar *buf; name = list->data; list = list->prev; text = exif_get_data_as_text(exif, name); text = bar_exif_validate_text(text); buf = g_strconcat(name, ":", NULL); gtk_label_set_text(GTK_LABEL(eb->custom_name[i]), buf); g_free(buf); gtk_label_set_text(GTK_LABEL(eb->custom_value[i]), text); g_free(text); gtk_widget_show(eb->custom_name[i]); gtk_widget_show(eb->custom_value[i]); i++; } while (i < EXIF_BAR_CUSTOM_COUNT) { gtk_widget_hide(eb->custom_name[i]); gtk_widget_hide(eb->custom_value[i]); i++; } } if (eb->advanced_scrolled && GTK_WIDGET_VISIBLE(eb->advanced_scrolled)) { GtkListStore *store; GtkTreeIter iter; GList *work; store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(eb->listview))); gtk_list_store_clear(store); work = exif->items; while (work) { ExifItem *item; gchar *tag; const gchar *tag_name; gchar *text; const gchar *format; gchar *elements; const gchar *description; item = work->data; work = work->next; tag = g_strdup_printf("0x%04x", item->tag); tag_name = exif_item_get_tag_name(item); format = exif_item_get_format_name(item, TRUE); text = exif_item_get_data_as_text(item); text = bar_exif_validate_text(text); elements = g_strdup_printf("%d", item->elements); description = exif_item_get_description(item); if (!description) description = ""; gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, EXIF_ADVCOL_ENABLED, bar_exif_row_enabled(tag_name), EXIF_ADVCOL_TAG, tag, EXIF_ADVCOL_NAME, tag_name, EXIF_ADVCOL_VALUE, text, EXIF_ADVCOL_FORMAT, format, EXIF_ADVCOL_ELEMENTS, elements, EXIF_ADVCOL_DESCRIPTION, description, -1); g_free(tag); g_free(text); g_free(elements); } } exif_free(exif); }
// show previously created window int gtk_debugger_enter(int context) { #ifndef NO_GDB gint type, id, mode; if (!dbg_on) gdbtk_show_insight(); #endif // debugger is open dbg_on = !0; // show breakpoint source (modal) switch(context) { case DBG_TRACE: break; case DBG_BREAK: break; } // display debugger windows (if not) gtk_debugger_display(); gtk_debugger_refresh(); // enable the debugger if GDB disabled it if (!options3.dbg_dock && !GTK_WIDGET_SENSITIVE(dbgw.regs)) gtk_debugger_enable(); // handle automatic debugging requests #ifndef NO_GDB if (symfile) { // get context ti68k_bkpt_get_cause(&type, &mode, &id); if(type == BK_TYPE_PGMENTRY) { uint16_t handle, offset; uint32_t pc; ti68k_bkpt_get_pgmentry_offset(id, &handle, &offset); ti68k_bkpt_del_pgmentry(handle); if(options3.dbg_dock || GTK_WIDGET_VISIBLE(dbgw.bkpts)) dbgbkpts_refresh_window(); delete_command(NULL, 0); symbol_file_clear(0); gdbtk_clear_file (); ti68k_register_get_pc(&pc); pc -= offset-2; gdb_add_symbol_file(symfile, pc); g_free (symfile); symfile = NULL; exec_build_section_table(); ti68k_unprotect_64KB_range(pc); gdb_hbreak("__main"); } } #endif return 0; }
static void gtk_hbox_layoutable_size_allocate (GtkLayoutable *layoutable, GtkAllocation *allocation) { GtkBox *box = GTK_BOX (layoutable); guint pack = GTK_PACK_START; GList *list; gint i; gint border_width; gint row_height, row_width; gint available_width; GtkAllocation child_allocation; if (box->homogeneous) { (gtk_hbox_parent_layoutable_iface->size_allocate) (layoutable, allocation); return; } border_width = GTK_CONTAINER (box)->border_width; row_height = 0; row_width = border_width; available_width = allocation->width - border_width; allocation->width = 0; for (i = 0; i < 2; i++, pack = GTK_PACK_END) { list = pack == GTK_PACK_END ? g_list_last (box->children) : box->children; while (list) { GtkBoxChild *child_info = list->data; GtkLayoutable *child; GtkRequisition child_requisition; if (child_info->pack == pack && GTK_WIDGET_VISIBLE (child_info->widget)) { child = GTK_LAYOUTABLE (child_info->widget); gtk_widget_get_child_requisition (child_info->widget, &child_requisition); if (row_width + child_requisition.width > available_width) { /* Tell the parent about our actual allocation. */ allocation->width = MAX (allocation->width, row_width + border_width); allocation->height += row_height + box->spacing; row_width = border_width; row_height = 0; } child_allocation.x = allocation->x + row_width + child_info->padding; child_allocation.y = allocation->y + allocation->height; child_allocation.width = available_width; child_allocation.height = 0; gtk_layoutable_size_allocate (child, &child_allocation); row_width += child_allocation.width + box->spacing + child_info->padding * 2; row_height = MAX (row_height, child_allocation.height); } list = pack == GTK_PACK_END ? list->prev : list->next; } } allocation->width = MAX (allocation->width, row_width + border_width); if (row_height == 0) allocation->height += border_width - box->spacing; else allocation->height += row_height + border_width; }
void ags_mixer_set_audio_channels(AgsAudio *audio, guint audio_channels, guint audio_channels_old, gpointer data) { AgsMixer *mixer; GtkVScale *scale; GList *list_input_pad; guint i; mixer = AGS_MIXER(audio->machine); if(audio_channels_old < audio_channels){ AgsMixerInputPad *mixer_input_pad; AgsChannel *channel; /* AgsInput */ channel = audio->input; list_input_pad = gtk_container_get_children((GtkContainer *) mixer->input_pad); for(i = 0; i < audio->input_pads; i++){ if(audio_channels_old == 0){ /* create AgsPad's if necessary */ mixer_input_pad = g_object_new(AGS_TYPE_MIXER_INPUT_PAD, "channel\0", channel, NULL); gtk_box_pack_start((GtkBox *) mixer->input_pad, (GtkWidget *) mixer_input_pad, FALSE, FALSE, 0); ags_pad_resize_lines((AgsPad *) mixer_input_pad, AGS_TYPE_MIXER_INPUT_LINE, AGS_AUDIO(channel->audio)->audio_channels, 0); if(GTK_WIDGET_VISIBLE((GtkWidget *) mixer)){ ags_connectable_connect(AGS_CONNECTABLE(mixer_input_pad)); ags_pad_find_port(AGS_PAD(mixer_input_pad)); gtk_widget_show_all((GtkWidget *) mixer_input_pad); } }else{ mixer_input_pad = AGS_MIXER_INPUT_PAD(list_input_pad->data); ags_pad_resize_lines((AgsPad *) mixer_input_pad, AGS_TYPE_MIXER_INPUT_LINE, audio_channels, audio_channels_old); } channel = channel->next_pad; if(audio_channels_old != 0) list_input_pad = list_input_pad->next; } }else{ GList *list_input_pad_next; list_input_pad = gtk_container_get_children((GtkContainer *) mixer->input_pad); if(audio_channels == 0){ /* AgsInput */ while(list_input_pad != NULL){ list_input_pad_next = list_input_pad->next; gtk_widget_destroy(GTK_WIDGET(list_input_pad->data)); list_input_pad->next = list_input_pad_next; } }else{ /* AgsInput */ for(i = 0; list_input_pad != NULL; i++){ ags_pad_resize_lines(AGS_PAD(list_input_pad->data), AGS_TYPE_MIXER_INPUT_PAD, audio_channels, audio_channels_old); list_input_pad = list_input_pad->next; } } } }
void about_dialog_show(GtkWidget *aboutdialog) { if (!GTK_WIDGET_VISIBLE(aboutdialog)) gtk_widget_show(aboutdialog); }
void raise_tsin_selection_win() { if (gwin1 && GTK_WIDGET_VISIBLE(gwin1)) gtk_window_present(GTK_WINDOW(gwin1)); }
static void columns_size_request(GtkWidget *widget, GtkRequisition *req) { Columns *cols; ColumnsChild *child; GList *children; gint i, ncols, colspan, *colypos; const gint *percentages; static const gint onecol[] = { 100 }; g_return_if_fail(widget != NULL); g_return_if_fail(IS_COLUMNS(widget)); g_return_if_fail(req != NULL); cols = COLUMNS(widget); req->width = 0; req->height = cols->spacing; ncols = 1; colypos = g_new(gint, 1); colypos[0] = 0; percentages = onecol; for (children = cols->children; children && (child = children->data); children = children->next) { GtkRequisition creq; if (!child->widget) { /* Column reconfiguration. */ for (i = 1; i < ncols; i++) { if (colypos[0] < colypos[i]) colypos[0] = colypos[i]; } ncols = child->ncols; percentages = child->percentages; colypos = g_renew(gint, colypos, ncols); for (i = 1; i < ncols; i++) colypos[i] = colypos[0]; continue; } /* Only take visible widgets into account. */ if (!GTK_WIDGET_VISIBLE(child->widget)) continue; gtk_widget_size_request(child->widget, &creq); colspan = child->colspan ? child->colspan : ncols-child->colstart; /* * To compute width: we know that creq.width plus * cols->spacing needs to equal a certain percentage of the * full width of the container. So we work this value out, * figure out how wide the container will need to be to * make that percentage of it equal to that width, and * ensure our returned width is at least that much. Very * simple really. */ { int percent, thiswid, fullwid; percent = 0; for (i = 0; i < colspan; i++) percent += percentages[child->colstart+i]; thiswid = creq.width + cols->spacing; /* * Since creq is the _minimum_ size the child needs, we * must ensure that it gets _at least_ that size. * Hence, when scaling thiswid up to fullwid, we must * round up, which means adding percent-1 before * dividing by percent. */ fullwid = (thiswid * 100 + percent - 1) / percent; /* * The above calculation assumes every widget gets * cols->spacing on the right. So we subtract * cols->spacing here to account for the extra load of * spacing on the right. */ if (req->width < fullwid - cols->spacing) req->width = fullwid - cols->spacing; } /* * To compute height: the widget's top will be positioned * at the largest y value so far reached in any of the * columns it crosses. Then it will go down by creq.height * plus padding; and the point it reaches at the bottom is * the new y value in all those columns, and minus the * padding it is also a lower bound on our own size * request. */ { int topy, boty; topy = 0; for (i = 0; i < colspan; i++) { if (topy < colypos[child->colstart+i]) topy = colypos[child->colstart+i]; } boty = topy + creq.height + cols->spacing; for (i = 0; i < colspan; i++) { colypos[child->colstart+i] = boty; } if (req->height < boty - cols->spacing) req->height = boty - cols->spacing; } } req->width += 2*GTK_CONTAINER(cols)->border_width; req->height += 2*GTK_CONTAINER(cols)->border_width; g_free(colypos); }
static void gtk_image_menu_item_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { GtkImageMenuItem *image_menu_item; GtkPackDirection pack_dir; if (GTK_IS_MENU_BAR (widget->parent)) pack_dir = gtk_menu_bar_get_child_pack_direction (GTK_MENU_BAR (widget->parent)); else pack_dir = GTK_PACK_DIRECTION_LTR; image_menu_item = GTK_IMAGE_MENU_ITEM (widget); GTK_WIDGET_CLASS (gtk_image_menu_item_parent_class)->size_allocate (widget, allocation); if (image_menu_item->image && GTK_WIDGET_VISIBLE (image_menu_item->image)) { gint x, y, offset; GtkRequisition child_requisition; GtkAllocation child_allocation; guint horizontal_padding, toggle_spacing; gtk_widget_style_get (widget, "horizontal-padding", &horizontal_padding, "toggle-spacing", &toggle_spacing, NULL); /* Man this is lame hardcoding action, but I can't * come up with a solution that's really better. */ gtk_widget_get_child_requisition (image_menu_item->image, &child_requisition); if (pack_dir == GTK_PACK_DIRECTION_LTR || pack_dir == GTK_PACK_DIRECTION_RTL) { offset = GTK_CONTAINER (image_menu_item)->border_width + widget->style->xthickness; if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) == (pack_dir == GTK_PACK_DIRECTION_LTR)) x = offset + horizontal_padding + (GTK_MENU_ITEM (image_menu_item)->toggle_size - toggle_spacing - child_requisition.width) / 2; else x = widget->allocation.width - offset - horizontal_padding - GTK_MENU_ITEM (image_menu_item)->toggle_size + toggle_spacing + (GTK_MENU_ITEM (image_menu_item)->toggle_size - toggle_spacing - child_requisition.width) / 2; y = (widget->allocation.height - child_requisition.height) / 2; } else { offset = GTK_CONTAINER (image_menu_item)->border_width + widget->style->ythickness; if ((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) == (pack_dir == GTK_PACK_DIRECTION_TTB)) y = offset + horizontal_padding + (GTK_MENU_ITEM (image_menu_item)->toggle_size - toggle_spacing - child_requisition.height) / 2; else y = widget->allocation.height - offset - horizontal_padding - GTK_MENU_ITEM (image_menu_item)->toggle_size + toggle_spacing + (GTK_MENU_ITEM (image_menu_item)->toggle_size - toggle_spacing - child_requisition.height) / 2; x = (widget->allocation.width - child_requisition.width) / 2; } child_allocation.width = child_requisition.width; child_allocation.height = child_requisition.height; child_allocation.x = widget->allocation.x + MAX (x, 0); child_allocation.y = widget->allocation.y + MAX (y, 0); gtk_widget_size_allocate (image_menu_item->image, &child_allocation); } }
static void columns_size_allocate(GtkWidget *widget, GtkAllocation *alloc) { Columns *cols; ColumnsChild *child; GList *children; gint i, ncols, colspan, border, *colxpos, *colypos; const gint *percentages; static const gint onecol[] = { 100 }; g_return_if_fail(widget != NULL); g_return_if_fail(IS_COLUMNS(widget)); g_return_if_fail(alloc != NULL); cols = COLUMNS(widget); widget->allocation = *alloc; border = GTK_CONTAINER(cols)->border_width; ncols = 1; percentages = onecol; /* colxpos gives the starting x position of each column. * We supply n+1 of them, so that we can find the RH edge easily. * All ending x positions are expected to be adjusted afterwards by * subtracting the spacing. */ colxpos = g_new(gint, 2); colxpos[0] = 0; colxpos[1] = alloc->width - 2*border + cols->spacing; /* As in size_request, colypos is the lowest y reached in each column. */ colypos = g_new(gint, 1); colypos[0] = 0; for (children = cols->children; children && (child = children->data); children = children->next) { GtkRequisition creq; GtkAllocation call; if (!child->widget) { gint percent; /* Column reconfiguration. */ for (i = 1; i < ncols; i++) { if (colypos[0] < colypos[i]) colypos[0] = colypos[i]; } ncols = child->ncols; percentages = child->percentages; colypos = g_renew(gint, colypos, ncols); for (i = 1; i < ncols; i++) colypos[i] = colypos[0]; colxpos = g_renew(gint, colxpos, ncols + 1); colxpos[0] = 0; percent = 0; for (i = 0; i < ncols; i++) { percent += percentages[i]; colxpos[i+1] = (((alloc->width - 2*border) + cols->spacing) * percent / 100); } continue; } /* Only take visible widgets into account. */ if (!GTK_WIDGET_VISIBLE(child->widget)) continue; gtk_widget_get_child_requisition(child->widget, &creq); colspan = child->colspan ? child->colspan : ncols-child->colstart; /* * Starting x position is cols[colstart]. * Ending x position is cols[colstart+colspan] - spacing. * * Unless we're forcing left, in which case the width is * exactly the requisition width. */ call.x = alloc->x + border + colxpos[child->colstart]; if (child->force_left) call.width = creq.width; else call.width = (colxpos[child->colstart+colspan] - colxpos[child->colstart] - cols->spacing); /* * To compute height: the widget's top will be positioned * at the largest y value so far reached in any of the * columns it crosses. Then it will go down by creq.height * plus padding; and the point it reaches at the bottom is * the new y value in all those columns. */ { int topy, boty; topy = 0; for (i = 0; i < colspan; i++) { if (topy < colypos[child->colstart+i]) topy = colypos[child->colstart+i]; } call.y = alloc->y + border + topy; call.height = creq.height; boty = topy + creq.height + cols->spacing; for (i = 0; i < colspan; i++) { colypos[child->colstart+i] = boty; } } gtk_widget_size_allocate(child->widget, &call); } g_free(colxpos); g_free(colypos); }
static void * pidgin_notify_emails(PurpleConnection *gc, size_t count, gboolean detailed, const char **subjects, const char **froms, const char **tos, const char **urls) { GtkWidget *dialog = NULL; char *notification; PurpleAccount *account; PidginNotifyMailData *data = NULL, *data2; gboolean new_data; /* Don't bother updating if there aren't new emails and we don't have any displayed currently */ if (count == 0 && mail_dialog == NULL) return NULL; account = purple_connection_get_account(gc); dialog = pidgin_get_mail_dialog(); /* This creates mail_dialog if necessary */ mail_dialog->total_count += count; if (detailed) { while (count--) { char *to_text = NULL; char *from_text = NULL; char *subject_text = NULL; char *tmp; gboolean first = TRUE; if (tos != NULL) { tmp = g_markup_escape_text(*tos, -1); to_text = g_strdup_printf("<b>%s</b>: %s\n", _("Account"), tmp); g_free(tmp); first = FALSE; tos++; } if (froms != NULL) { tmp = g_markup_escape_text(*froms, -1); from_text = g_strdup_printf("%s<b>%s</b>: %s\n", first ? "<br>" : "", _("Sender"), tmp); g_free(tmp); first = FALSE; froms++; } if (subjects != NULL) { tmp = g_markup_escape_text(*subjects, -1); subject_text = g_strdup_printf("%s<b>%s</b>: %s", first ? "<br>" : "", _("Subject"), tmp); g_free(tmp); first = FALSE; subjects++; } #define SAFE(x) ((x) ? (x) : "") notification = g_strdup_printf("%s%s%s", SAFE(to_text), SAFE(from_text), SAFE(subject_text)); #undef SAFE g_free(to_text); g_free(from_text); g_free(subject_text); /* If we don't keep track of this, will leak "data" for each of the notifications except the last */ data2 = pidgin_notify_add_mail(mail_dialog->treemodel, account, notification, urls ? *urls : NULL, 0, FALSE, &new_data); if (new_data) { if (data) data->purple_has_handle = FALSE; data = data2; } g_free(notification); if (urls != NULL) urls++; } } else { if (count > 0) { notification = g_strdup_printf(ngettext("%s has %d new message.", "%s has %d new messages.", (int)count), *tos, (int)count); data2 = pidgin_notify_add_mail(mail_dialog->treemodel, account, notification, urls ? *urls : NULL, count, FALSE, &new_data); if (new_data) { if (data) data->purple_has_handle = FALSE; data = data2; } g_free(notification); } else { GtkTreeIter iter; /* Clear out all mails for the account */ pidgin_notify_add_mail(mail_dialog->treemodel, account, NULL, NULL, 0, TRUE, NULL); if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(mail_dialog->treemodel), &iter)) { /* There is no API to clear the headline specifically */ /* This will trigger reset_mail_dialog() */ pidgin_blist_set_headline(NULL, NULL, NULL, NULL, NULL); return NULL; } } } if (!GTK_WIDGET_VISIBLE(dialog)) { GdkPixbuf *pixbuf = gtk_widget_render_icon(dialog, PIDGIN_STOCK_DIALOG_MAIL, gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), NULL); char *label_text = g_strdup_printf(ngettext("<b>%d new email.</b>", "<b>%d new emails.</b>", mail_dialog->total_count), mail_dialog->total_count); mail_dialog->in_use = TRUE; /* So that _set_headline doesn't accidentally remove the notifications when replacing an old notification. */ pidgin_blist_set_headline(label_text, pixbuf, G_CALLBACK(gtk_widget_show_all), dialog, (GDestroyNotify)reset_mail_dialog); mail_dialog->in_use = FALSE; g_free(label_text); if (pixbuf) g_object_unref(pixbuf); } else if (!GTK_WIDGET_HAS_FOCUS(dialog)) pidgin_set_urgent(GTK_WINDOW(dialog), TRUE); return data; }
GtkWindow * gw_msg_box_create ( GtkWindow *window, gchar *title, gchar *subject) { /*static */GtkWidget *w = NULL; GtkWidget *vbox,*label,*button,*hbox; GtkAccelGroup *accel; guint button_key; gchar *text_utf8 = NULL; #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s() : title=%s subject=%s\n", __FILE__, __LINE__, __PRETTY_FUNCTION__, title, subject); #endif if ( !w ) { #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s() new dialog window\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif accel = gtk_accel_group_new ( ); w = gtk_window_new ( GTK_WINDOW_DIALOG); gtk_window_set_policy ( GTK_WINDOW ( w), FALSE, FALSE, TRUE); g_strdup_to_gtk_text ( title, text_utf8); gtk_window_set_title ( GTK_WINDOW ( w), text_utf8); g_free ( text_utf8); gtk_container_border_width ( GTK_CONTAINER ( w), 10); gtk_window_set_modal ( GTK_WINDOW ( w),TRUE); gtk_window_set_transient_for ( GTK_WINDOW ( w), window); gtk_window_set_position ( GTK_WINDOW ( w), GTK_WIN_POS_CENTER); #ifdef HAVE_GTK12 gtk_signal_connect ( GTK_OBJECT ( w), "destroy", GTK_SIGNAL_FUNC ( gtk_widget_destroyed), &w); #endif vbox = gtk_vbox_new ( TRUE, 10); gtk_container_add ( GTK_CONTAINER ( w), vbox); gtk_container_set_border_width ( GTK_CONTAINER ( vbox), 10); g_strdup_to_gtk_text ( subject, text_utf8); label = gtk_label_new ( text_utf8); gtk_label_set_text ( GTK_LABEL ( label), text_utf8); g_free ( text_utf8); gtk_box_pack_start ( GTK_BOX ( vbox), label, FALSE, FALSE, 0); /* The Ok button area */ hbox = gtk_hbutton_box_new ( ); gtk_button_box_set_layout ( GTK_BUTTON_BOX ( hbox), GTK_BUTTONBOX_EDGE); gtk_button_box_set_spacing ( GTK_BUTTON_BOX ( hbox), 5); gtk_box_pack_end ( GTK_BOX ( vbox), hbox, FALSE, FALSE, 0); button = gtk_button_new_with_label ( ""); g_strdup_to_gtk_text ( _( "_OK"), text_utf8); button_key = gtk_label_parse_uline ( GTK_LABEL ( GTK_BIN ( button)->child), text_utf8); g_free ( text_utf8); gtk_widget_add_accelerator ( button, "clicked", accel, button_key, GDK_MOD1_MASK, 0); gtk_object_set_user_data ( GTK_OBJECT ( button), w); gtk_box_pack_start ( GTK_BOX ( hbox), button, TRUE, FALSE, 0); gtk_signal_connect_object ( GTK_OBJECT ( button), "clicked", GTK_SIGNAL_FUNC ( gtk_widget_destroy), GTK_OBJECT ( w)); GTK_WIDGET_SET_FLAGS ( button, GTK_CAN_FOCUS); gtk_widget_grab_focus ( button); gtk_window_add_accel_group ( GTK_WINDOW ( w), accel); } if ( !GTK_WIDGET_VISIBLE ( w)) { gtk_widget_show_all ( w); } else { gtk_widget_destroy ( w); } return GTK_WINDOW ( w); }
BOOL xwt_gtk_base_getall( PXWT_WIDGET widget, PHB_ITEM pRet ) { HB_ITEM hbValue; XWT_GTK_BASE *wSelf = (PXWT_GTK_BASE) widget->widget_data; GtkWidget *wTop = wSelf->top_widget( widget ); hbValue.type = HB_IT_NIL; hb_hashAddChar( pRet, "x", hb_itemPutNI( &hbValue, wSelf->x ) ); hb_hashAddChar( pRet, "y", hb_itemPutNI( &hbValue, wSelf->y ) ); hb_hashAddChar( pRet, "width", hb_itemPutNI( &hbValue, wSelf->width ) ); hb_hashAddChar( pRet, "height", hb_itemPutNI( &hbValue, wSelf->height ) ); hb_hashAddChar( pRet, "id", hb_itemPutNI( &hbValue, wSelf->nId ) ); hb_hashAddChar( pRet, "broadcast", hb_itemPutL( &hbValue, wSelf->bBroadcast ) ); if (!wSelf->fgColor ) { hb_hashAddChar( pRet, "fgcolor", hb_itemPutC( &hbValue, "" ) ) ; } else { hb_hashAddChar( pRet, "fgcolor", hb_itemPutCPtr( &hbValue, wSelf->fgColor, 7 ) ); } if(wSelf->baseColor != NULL ) { hb_hashAddChar( pRet, "basecolor", hb_itemPutCPtr( &hbValue, wSelf->baseColor, 7) ); } else { hb_hashAddChar( pRet, "basecolor", hb_itemPutC( &hbValue, "" ) ); } if( wSelf->textColor != NULL ) { hb_hashAddChar( pRet, "textcolor", hb_itemPutCPtr( &hbValue, wSelf->textColor, 7 ) ); } else { hb_hashAddChar( pRet, "textcolor", hb_itemPutC( &hbValue, "" ) ); } if( wSelf->bgColor ) { hb_hashAddChar( pRet, "bgcolor", hb_itemPutCPtr( &hbValue, wSelf->bgColor, 7 ) ); } else { hb_hashAddChar( pRet, "bgcolor", hb_itemPutC( &hbValue, "" ) ); } if ( GTK_WIDGET_VISIBLE(wTop) ) { hb_itemPutCRawStatic( &hbValue, "visible", 7 ); } else { hb_itemPutCRawStatic( &hbValue, "hidden", 6 ); } hb_hashAddChar( pRet, "visibility", &hbValue ); hb_hashAddChar( pRet, "focus", hb_itemPutL( &hbValue, gtk_widget_is_focus( wTop )) ); hb_itemClear( &hbValue ); return TRUE; }
static void gdl_dock_dock (GdlDockObject *object, GdlDockObject *requestor, GdlDockPlacement position, GValue *user_data) { GdlDock *dock; g_return_if_fail (GDL_IS_DOCK (object)); /* only dock items allowed at this time */ g_return_if_fail (GDL_IS_DOCK_ITEM (requestor)); dock = GDL_DOCK (object); if (position == GDL_DOCK_FLOATING) { GdlDockItem *item = GDL_DOCK_ITEM (requestor); gint x, y, width, height; if (user_data && G_VALUE_HOLDS (user_data, GDK_TYPE_RECTANGLE)) { GdkRectangle *rect; rect = g_value_get_boxed (user_data); x = rect->x; y = rect->y; width = rect->width; height = rect->height; } else { x = y = 0; width = height = -1; } gdl_dock_add_floating_item (dock, item, x, y, width, height); } else if (dock->root) { /* This is somewhat a special case since we know which item to pass the request on because we only have on child */ gdl_dock_object_dock (dock->root, requestor, position, NULL); gdl_dock_set_title (dock); } else { /* Item about to be added is root item. */ GtkWidget *widget = GTK_WIDGET (requestor); dock->root = requestor; GDL_DOCK_OBJECT_SET_FLAGS (requestor, GDL_DOCK_ATTACHED); gtk_widget_set_parent (widget, GTK_WIDGET (dock)); gdl_dock_item_show_grip (GDL_DOCK_ITEM (requestor)); /* Realize the item (create its corresponding GdkWindow) when GdlDock has been realized. */ if (GTK_WIDGET_REALIZED (dock)) gtk_widget_realize (widget); /* Map the widget if it's visible and the parent is visible and has been mapped. This is done to make sure that the GdkWindow is visible. */ if (GTK_WIDGET_VISIBLE (dock) && GTK_WIDGET_VISIBLE (widget)) { if (GTK_WIDGET_MAPPED (dock)) gtk_widget_map (widget); /* Make the widget resize. */ gtk_widget_queue_resize (widget); } gdl_dock_set_title (dock); } }