static GtkWidget *CreateURLDialog(void) { GtkWidget *vbox1; GtkWidget *hbox1; GtkWidget *hbuttonbox1; GtkWidget *Ok; GtkWidget *Cancel; GtkAccelGroup *accel_group; GdkGeometry geometry; accel_group = gtk_accel_group_new(); URLDialog = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_widget_set_usize(URLDialog, 384, -1); gtk_window_set_title(GTK_WINDOW(URLDialog), MSGTR_Network); gtk_window_set_position(GTK_WINDOW(URLDialog), GTK_WIN_POS_CENTER); gtk_window_set_wmclass(GTK_WINDOW(URLDialog), "Network", MPlayer); gtk_widget_realize(URLDialog); gtkAddIcon(URLDialog); vbox1 = gtkAddVBox(gtkAddDialogFrame(URLDialog), 0); hbox1 = gtkAddHBox(vbox1, 1); gtkAddLabel("URL: ", hbox1); urlCombo = gtkAddCombo(hbox1); /* * gtk_combo_new(); * gtk_widget_show( urlCombo ); * gtk_box_pack_start( GTK_BOX( hbox1 ),urlCombo,TRUE,TRUE,0 ); */ urlEntry = GTK_COMBO(urlCombo)->entry; gtk_widget_show(urlEntry); gtkAddHSeparator(vbox1); hbuttonbox1 = gtkAddHButtonBox(vbox1); gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox1), GTK_BUTTONBOX_END); gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbuttonbox1), 10); Ok = gtkAddButton(MSGTR_Ok, hbuttonbox1); Cancel = gtkAddButton(MSGTR_Cancel, hbuttonbox1); geometry.max_width = gdk_screen_get_width(gtk_widget_get_screen(URLDialog)); geometry.max_height = -1; gtk_window_set_geometry_hints(GTK_WINDOW(URLDialog), NULL, &geometry, GDK_HINT_MAX_SIZE); gtk_widget_add_accelerator(Ok, "clicked", accel_group, GDK_Return, 0, GTK_ACCEL_VISIBLE); gtk_widget_add_accelerator(Cancel, "clicked", accel_group, GDK_Escape, 0, GTK_ACCEL_VISIBLE); gtk_signal_connect(GTK_OBJECT(URLDialog), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &URLDialog); gtk_signal_connect(GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(button_clicked), Ok); gtk_signal_connect(GTK_OBJECT(Cancel), "clicked", GTK_SIGNAL_FUNC(button_clicked), NULL); gtk_widget_grab_focus(urlEntry); gtk_window_add_accel_group(GTK_WINDOW(URLDialog), accel_group); return URLDialog; }
EXPORT wText_p wTextCreate( wWin_p parent, wPos_t x, wPos_t y, const char * helpStr, const char * labelStr, long option, wPos_t width, wPos_t height ) { wText_p bt; #ifdef USE_TEXTVIEW GtkTextBuffer * tb; #else GtkRequisition requisition; #endif bt = gtkAlloc( parent, B_MULTITEXT, x, y, labelStr, sizeof *bt, NULL ); gtkComputePos( (wControl_p)bt ); bt->width = width; bt->height = height; bt->option = option; gtkComputePos( (wControl_p)bt ); #ifdef USE_TEXTVIEW bt->widget = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (bt->widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); bt->text = gtk_text_view_new(); if (bt->text == 0) abort(); gtk_container_add (GTK_CONTAINER (bt->widget), bt->text); tb = gtk_text_view_get_buffer( GTK_TEXT_VIEW(bt->text) ); gtk_text_buffer_create_tag( tb, "bold", "weight", PANGO_WEIGHT_BOLD, NULL); /* gtk_text_buffer_create_tag( tb, "italic", "style", PANGO_STYLE_ITALIC, NULL); */ /* gtk_text_buffer_create_tag( tb, "bolditalic", "weight", PANGO_WEIGHT_BOLD, "style", PANGO_STYLE_ITALIC, NULL); */ bt->vscroll = gtk_vscrollbar_new( GTK_TEXT_VIEW(bt->text)->vadjustment ); if (bt->vscroll == 0) abort(); #else bt->widget = gtk_hbox_new( FALSE, 0 ); bt->text = gtk_text_new( NULL, NULL ); if (bt->text == 0) abort(); gtk_box_pack_start( GTK_BOX(bt->widget), bt->text, FALSE, FALSE, 0 ); bt->vscroll = gtk_vscrollbar_new( GTK_TEXT(bt->text)->vadj ); if (bt->vscroll == 0) abort(); gtk_box_pack_start( GTK_BOX(bt->widget), bt->vscroll, FALSE, FALSE, 0 ); #endif if (option&BT_CHARUNITS) { width *= 7; height *= 14; } gtk_widget_show( bt->text ); gtk_widget_show( bt->vscroll ); gtk_widget_show( bt->widget ); #ifdef USE_TEXTVIEW // gtk_widget_set_size_request( GTK_WIDGET(bt->text), width, height ); // gtk_widget_set_size_request( GTK_WIDGET(bt->vscroll), -1, height ); gtk_widget_set_size_request( GTK_WIDGET(bt->widget), width+15/*requisition.width*/, height ); #else gtk_widget_set_usize( GTK_WIDGET(bt->text), width, height ); gtk_widget_set_usize( GTK_WIDGET(bt->vscroll), -1, height ); gtk_widget_size_request( GTK_WIDGET(bt->vscroll), &requisition ); gtk_widget_set_usize( GTK_WIDGET(bt->widget), width+15/*requisition.width*/, height ); #endif if (bt->option&BO_READONLY) { #ifdef USE_TEXTVIEW gtk_text_view_set_editable( GTK_TEXT_VIEW(bt->text), FALSE ); gtk_text_view_set_cursor_visible(GTK_TEXT_VIEW(bt->text), FALSE); #else gtk_text_set_editable( GTK_TEXT(bt->text), FALSE ); #endif } #ifdef USE_TEXTVIEW gtk_fixed_put( GTK_FIXED(parent->widget), bt->widget, bt->realX, bt->realY ); #else gtk_container_add( GTK_CONTAINER(parent->widget), bt->widget ); gtk_widget_set_uposition( bt->widget, bt->realX, bt->realY ); #endif gtkControlGetSize( (wControl_p)bt ); if (labelStr) bt->labelW = gtkAddLabel( (wControl_p)bt, labelStr ); #ifdef USE_TEXTVIEW gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW(bt->text), GTK_WRAP_WORD ); #else gtk_text_set_word_wrap( GTK_TEXT(bt->text), TRUE ); #endif gtk_widget_realize( bt->text ); gtkAddButton( (wControl_p)bt ); gtkAddHelpString( bt->widget, helpStr ); #ifdef USE_TEXTVIEW g_signal_connect( G_OBJECT(tb), "changed", GTK_SIGNAL_FUNC(textChanged), bt ); #else gtk_signal_connect( GTK_OBJECT(bt->text), "changed", GTK_SIGNAL_FUNC(textChanged), bt ); #endif return bt; }
static GtkWidget * CreateMessageBox( void ) { GtkWidget * vbox1; GtkWidget * hbox1; GtkWidget * hbuttonbox1; GtkWidget * Ok; GtkAccelGroup * accel_group; GtkStyle * pixmapstyle; GdkPixmap * pixmapwid; GdkBitmap * mask; accel_group=gtk_accel_group_new(); MessageBox=gtk_window_new( GTK_WINDOW_TOPLEVEL ); gtk_widget_set_events( MessageBox,GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); gtk_window_set_title( GTK_WINDOW( MessageBox ),"MPlayer ..." ); gtk_window_set_position( GTK_WINDOW( MessageBox ),GTK_WIN_POS_CENTER ); gtk_window_set_modal( GTK_WINDOW( MessageBox ),TRUE ); gtk_window_set_policy( GTK_WINDOW( MessageBox ),FALSE,FALSE,TRUE ); gtk_window_set_wmclass( GTK_WINDOW( MessageBox ),"Message",MPlayer ); gtk_widget_realize( MessageBox ); gtkAddIcon( MessageBox ); vbox1=gtkAddVBox( gtkAddDialogFrame( MessageBox ),0 ); hbox1=gtkAddHBox( vbox1,1 ); pixmapstyle=gtk_widget_get_style( MessageBox ); pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )warning_xpm ); WarningPixmap=gtk_pixmap_new( pixmapwid,mask ); pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )error_xpm ); ErrorPixmap=gtk_pixmap_new( pixmapwid,mask ); gtk_widget_hide( WarningPixmap ); gtk_box_pack_start( GTK_BOX( hbox1 ),WarningPixmap,FALSE,FALSE,0 ); gtk_widget_set_usize( WarningPixmap,55,-2 ); gtk_widget_hide( ErrorPixmap ); gtk_box_pack_start( GTK_BOX( hbox1 ),ErrorPixmap,FALSE,FALSE,0 ); gtk_widget_set_usize( ErrorPixmap,55,-2 ); gtkMessageBoxText=gtk_label_new( "Text jol. Ha ezt megerted,akkor neked nagyon jo a magyar tudasod,te." ); gtk_widget_show( gtkMessageBoxText ); gtk_box_pack_start( GTK_BOX( hbox1 ),gtkMessageBoxText,TRUE,TRUE,0 ); // gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_FILL ); gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_CENTER ); gtk_label_set_line_wrap( GTK_LABEL( gtkMessageBoxText ),FALSE ); gtkAddHSeparator( vbox1 ); hbuttonbox1=gtkAddHButtonBox( vbox1 ); Ok=gtkAddButton( MSGTR_Ok,hbuttonbox1 ); gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( gtk_widget_destroyed ),&MessageBox ); gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Ok_released ),NULL ); gtk_window_add_accel_group( GTK_WINDOW( MessageBox ),accel_group ); return MessageBox; }