/* * Change font used to display log text, NULL means reset to default */ void GTK_change_log_font(gchar *fontname) { #if 0 // old GTK GtkRcStyle *rcstyle = gtk_rc_style_new(); #else GtkStyle *rcstyle = gtk_style_new(); #endif // if (GTK_OBJECT(v9t9_command_log)->flags & GTK_DESTROYED) {//2.0 if (!v9t9_command_log) { g_free(rcstyle); return; } if (fontname && *fontname) { #if 0 // old GTK rcstyle->font_name = fontname; gtk_widget_modify_style(v9t9_command_log, rcstyle); #else gtk_style_set_font(rcstyle, gdk_font_load(fontname)); gtk_widget_set_style(v9t9_command_log, rcstyle); #endif } else { // this is probably too harsh for a cancel gtk_widget_restore_default_style(v9t9_command_log); } // g_free(rcstyle); }
/** * TBD */ void create_hist_list( void ) { static char *title[1] = { "History" }; GtkStyle *style, *new_style; gint sz, max_sz; int n; char tmp[80]; GtkWidget *scrolled_win; GdkFont *private_font; hist_list = gtk_clist_new_with_titles( 1, title ); /* * When a selection is made, we want to know about it. The callback * * used is selection_made, and its code can be found further down */ select_hist_handler_id = gtk_signal_connect( GTK_OBJECT( hist_list ), "select_row", GTK_SIGNAL_FUNC( hist_list_selected ), NULL ); /* * It isn't necessary to shadow the border, but it looks nice :) */ gtk_clist_set_shadow_type( GTK_CLIST( hist_list ), GTK_SHADOW_OUT ); /* * Make sure titles are being shown */ gtk_clist_column_titles_show( GTK_CLIST( hist_list ) ); /* * What however is important, is that we set the column widths as * they * will never be right otherwise. Note that the columns are * numbered * from 0 and up. */ style = gtk_widget_get_style( hist_list ); new_style = gtk_style_copy( style ); if ( ( private_font = gdk_font_load( "*courier-*-r*140*" ) ) == NULL ) if ( ( private_font = gdk_font_load( "*courier-*-r*120*" ) ) == NULL ) private_font = gtk_style_get_font( style ); gtk_style_set_font( style, private_font ); gtk_widget_set_style( hist_list, new_style ); for ( max_sz = 0, n = 0; n < 10; n++ ) { sprintf( tmp, "%d: %s: %c%d", RANDOM( 1, 60 ), ( rand( ) % 2 ) ? "Black" : "White", RANDOM( 0, 7 ) + 'A', RANDOM( 1, 8 ) ); sz = gdk_string_width( private_font, tmp ); if ( sz > max_sz ) max_sz = sz; } gtk_clist_set_column_width( GTK_CLIST( hist_list ), 0, max_sz ); /* * --- Set the column justifications --- */ gtk_clist_set_column_justification( GTK_CLIST( hist_list ), 0, GTK_JUSTIFY_LEFT ); gtk_clist_column_titles_passive( GTK_CLIST( hist_list ) ); /* * --- Selection mode --- */ gtk_clist_set_selection_mode( GTK_CLIST( hist_list ), GTK_SELECTION_BROWSE ); /* * Add the GtkCList widget to the vertical box and show it. */ gtk_widget_show( hist_list ); scrolled_win = gtk_scrolled_window_new( NULL, NULL ); gtk_container_add( GTK_CONTAINER( scrolled_win ), hist_list ); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled_win ), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS ); gtk_box_pack_start( GTK_BOX( main_hbox ), scrolled_win, FALSE, FALSE, 0 ); gtk_widget_show( scrolled_win ); } // create_hist_list