23077
|
1
|
|
2 #include "app.h"
|
|
3 #include "config.h"
|
|
4 #include "help_mp.h"
|
|
5
|
|
6 #include "../pixmaps/error.xpm"
|
|
7 #include "../pixmaps/warning.xpm"
|
|
8
|
|
9 #include "../widgets.h"
|
|
10 #include "mb.h"
|
|
11 #include "common.h"
|
|
12
|
|
13 GtkWidget * gtkMessageBoxText;
|
|
14 GtkWidget * MessageBox = NULL;
|
|
15
|
|
16 void ShowMessageBox( const char * msg )
|
|
17 {
|
|
18 if ( MessageBox ) { gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); }
|
|
19 MessageBox=create_MessageBox( 0 );
|
|
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 )
|
|
24 {
|
|
25 gtk_widget_hide( MessageBox );
|
|
26 gtk_widget_destroy( MessageBox );
|
|
27 MessageBox=NULL;
|
|
28 }
|
|
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;
|
|
38 GdkPixmap * pixmapwid;
|
|
39 GdkBitmap * mask;
|
|
40
|
|
41 accel_group=gtk_accel_group_new();
|
|
42
|
|
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 );
|
|
51 gtk_window_set_wmclass( GTK_WINDOW( MessageBox ),"Message","MPlayer" );
|
|
52
|
|
53 gtk_widget_realize( MessageBox );
|
|
54 gtkAddIcon( MessageBox );
|
|
55
|
|
56 vbox1=AddVBox( AddDialogFrame( MessageBox ),0 );
|
|
57 hbox1=AddHBox( vbox1,1 );
|
|
58
|
|
59 pixmapstyle=gtk_widget_get_style( MessageBox );
|
|
60
|
|
61 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )warning_xpm );
|
|
62 WarningPixmap=gtk_pixmap_new( pixmapwid,mask );
|
|
63 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )error_xpm );
|
|
64 ErrorPixmap=gtk_pixmap_new( pixmapwid,mask );
|
|
65
|
|
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 );
|
|
70
|
|
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 );
|
|
75
|
|
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 );
|
|
80 // gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_FILL );
|
|
81 gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_CENTER );
|
|
82 gtk_label_set_line_wrap( GTK_LABEL( gtkMessageBoxText ),FALSE );
|
|
83
|
|
84 AddHSeparator( vbox1 );
|
|
85 hbuttonbox1=AddHButtonBox( vbox1 );
|
|
86 Ok=AddButton( MSGTR_Ok,hbuttonbox1 );
|
|
87
|
|
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 );
|
|
90
|
|
91 gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&MessageBox );
|
|
92 gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Ok_released ),NULL );
|
|
93
|
|
94 gtk_window_add_accel_group( GTK_WINDOW( MessageBox ),accel_group );
|
|
95
|
|
96 return MessageBox;
|
|
97 }
|