Mercurial > mplayer.hg
annotate Gui/mplayer/gtk/mb.c @ 22138:9fadbbd19a04
r22129: Link to the mencoder-users list for mencoder stuff
r22140: vp6vfw.dll appears to no longer crash under Linux.
r22141: Move all "Encoding with the XXX codec family" sections together.
author | voroshil |
---|---|
date | Mon, 05 Feb 2007 18:38:25 +0000 |
parents | 273bdef43012 |
children | 8e6182a75006 |
rev | line source |
---|---|
2901 | 1 |
17144 | 2 #include "../app.h" |
3 #include "../../config.h" | |
4 #include "../../help_mp.h" | |
2901 | 5 |
6 #include "../pixmaps/error.xpm" | |
7 #include "../pixmaps/warning.xpm" | |
8 | |
9 #include "../widgets.h" | |
10 #include "mb.h" | |
8299 | 11 #include "common.h" |
2901 | 12 |
13 GtkWidget * gtkMessageBoxText; | |
9625 | 14 GtkWidget * MessageBox = NULL; |
2901 | 15 |
19081
273bdef43012
Mark several string parameters that are not modified in the function as const.
diego
parents:
17144
diff
changeset
|
16 void ShowMessageBox( const char * msg ) |
6146 | 17 { |
8299 | 18 if ( MessageBox ) { gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); } |
6898 | 19 MessageBox=create_MessageBox( 0 ); |
6146 | 20 if ( strlen( msg ) < 20 ) gtk_widget_set_usize( MessageBox,196,-1 ); |
21 } | |
22 | |
23 static void on_Ok_released( GtkButton * button,gpointer user_data ) | |
8299 | 24 { |
25 gtk_widget_hide( MessageBox ); | |
26 gtk_widget_destroy( MessageBox ); | |
27 MessageBox=NULL; | |
28 } | |
2901 | 29 |
30 GtkWidget * create_MessageBox( int type ) | |
31 { | |
32 GtkWidget * vbox1; | |
33 GtkWidget * hbox1; | |
34 GtkWidget * hbuttonbox1; | |
35 GtkWidget * Ok; | |
36 GtkAccelGroup * accel_group; | |
37 GtkStyle * pixmapstyle; | |
6159
dcf195b784bf
applied 64bit patch from Ulrich Hecht <uli@suse.de>
pontscho
parents:
6146
diff
changeset
|
38 GdkPixmap * pixmapwid; |
2901 | 39 GdkBitmap * mask; |
40 | |
6044 | 41 accel_group=gtk_accel_group_new(); |
2901 | 42 |
6044 | 43 MessageBox=gtk_window_new( GTK_WINDOW_TOPLEVEL ); |
44 gtk_widget_set_name( MessageBox,"MessageBox" ); | |
45 gtk_object_set_data( GTK_OBJECT( MessageBox ),"MessageBox",MessageBox ); | |
46 gtk_widget_set_events( MessageBox,GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_VISIBILITY_NOTIFY_MASK ); | |
47 gtk_window_set_title( GTK_WINDOW( MessageBox ),"MPlayer ..." ); | |
48 gtk_window_set_position( GTK_WINDOW( MessageBox ),GTK_WIN_POS_CENTER ); | |
49 gtk_window_set_modal( GTK_WINDOW( MessageBox ),TRUE ); | |
50 gtk_window_set_policy( GTK_WINDOW( MessageBox ),TRUE,TRUE,FALSE ); | |
6651 | 51 gtk_window_set_wmclass( GTK_WINDOW( MessageBox ),"Message","MPlayer" ); |
52 | |
53 gtk_widget_realize( MessageBox ); | |
54 gtkAddIcon( MessageBox ); | |
2901 | 55 |
8299 | 56 vbox1=AddVBox( AddDialogFrame( MessageBox ),0 ); |
57 hbox1=AddHBox( vbox1,1 ); | |
2901 | 58 |
59 pixmapstyle=gtk_widget_get_style( MessageBox ); | |
60 | |
6146 | 61 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )warning_xpm ); |
2901 | 62 WarningPixmap=gtk_pixmap_new( pixmapwid,mask ); |
6146 | 63 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )error_xpm ); |
2901 | 64 ErrorPixmap=gtk_pixmap_new( pixmapwid,mask ); |
65 | |
6044 | 66 gtk_widget_set_name( WarningPixmap,"pixmap1" ); |
67 gtk_widget_hide( WarningPixmap ); | |
68 gtk_box_pack_start( GTK_BOX( hbox1 ),WarningPixmap,FALSE,FALSE,0 ); | |
69 gtk_widget_set_usize( WarningPixmap,55,-2 ); | |
2901 | 70 |
6044 | 71 gtk_widget_set_name( ErrorPixmap,"pixmap1" ); |
72 gtk_widget_hide( ErrorPixmap ); | |
73 gtk_box_pack_start( GTK_BOX( hbox1 ),ErrorPixmap,FALSE,FALSE,0 ); | |
74 gtk_widget_set_usize( ErrorPixmap,55,-2 ); | |
2901 | 75 |
6044 | 76 gtkMessageBoxText=gtk_label_new( "Text jol. Ha ezt megerted,akkor neked nagyon jo a magyar tudasod,te." ); |
77 gtk_widget_set_name( gtkMessageBoxText,"gtkMessageBoxText" ); | |
78 gtk_widget_show( gtkMessageBoxText ); | |
79 gtk_box_pack_start( GTK_BOX( hbox1 ),gtkMessageBoxText,TRUE,TRUE,0 ); | |
7009 | 80 // gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_FILL ); |
81 gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_CENTER ); | |
6146 | 82 gtk_label_set_line_wrap( GTK_LABEL( gtkMessageBoxText ),FALSE ); |
2901 | 83 |
8299 | 84 AddHSeparator( vbox1 ); |
85 hbuttonbox1=AddHButtonBox( vbox1 ); | |
86 Ok=AddButton( MSGTR_Ok,hbuttonbox1 ); | |
2901 | 87 |
8299 | 88 gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE ); |
89 gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE ); | |
2901 | 90 |
8719
dc27303ae528
correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents:
8299
diff
changeset
|
91 gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&MessageBox ); |
8299 | 92 gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Ok_released ),NULL ); |
2901 | 93 |
6044 | 94 gtk_window_add_accel_group( GTK_WINDOW( MessageBox ),accel_group ); |
2901 | 95 |
96 return MessageBox; | |
97 } |