33572
|
1 /*
|
|
2 * This file is part of MPlayer.
|
|
3 *
|
|
4 * MPlayer is free software; you can redistribute it and/or modify
|
|
5 * it under the terms of the GNU General Public License as published by
|
|
6 * the Free Software Foundation; either version 2 of the License, or
|
|
7 * (at your option) any later version.
|
|
8 *
|
|
9 * MPlayer is distributed in the hope that it will be useful,
|
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
12 * GNU General Public License for more details.
|
|
13 *
|
|
14 * You should have received a copy of the GNU General Public License along
|
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
|
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
17 */
|
|
18
|
33738
|
19 #include <string.h>
|
|
20
|
33572
|
21 #include "config.h"
|
|
22 #include "gui/app.h"
|
|
23 #include "help_mp.h"
|
|
24
|
|
25 #include "gui/ui/pixmaps/error.xpm"
|
|
26 #include "gui/ui/pixmaps/warning.xpm"
|
|
27
|
|
28 #include "gui/ui/widgets.h"
|
|
29 #include "msgbox.h"
|
|
30 #include "tools.h"
|
|
31
|
|
32 GtkWidget * gtkMessageBoxText;
|
|
33 GtkWidget * MessageBox = NULL;
|
|
34
|
|
35 void ShowMessageBox( const char * msg )
|
|
36 {
|
|
37 if ( MessageBox ) { gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); }
|
34467
|
38 MessageBox=create_MessageBox();
|
33572
|
39 if ( strlen( msg ) < 20 ) gtk_widget_set_usize( MessageBox,196,-1 );
|
|
40 }
|
|
41
|
|
42 static void on_Ok_released( GtkButton * button,gpointer user_data )
|
|
43 {
|
|
44 gtk_widget_hide( MessageBox );
|
|
45 gtk_widget_destroy( MessageBox );
|
|
46 MessageBox=NULL;
|
|
47 }
|
|
48
|
34467
|
49 GtkWidget * create_MessageBox( void )
|
33572
|
50 {
|
|
51 GtkWidget * vbox1;
|
|
52 GtkWidget * hbox1;
|
|
53 GtkWidget * hbuttonbox1;
|
|
54 GtkWidget * Ok;
|
|
55 GtkAccelGroup * accel_group;
|
|
56 GtkStyle * pixmapstyle;
|
|
57 GdkPixmap * pixmapwid;
|
|
58 GdkBitmap * mask;
|
|
59
|
|
60 accel_group=gtk_accel_group_new();
|
|
61
|
|
62 MessageBox=gtk_window_new( GTK_WINDOW_TOPLEVEL );
|
|
63 gtk_widget_set_name( MessageBox,"MessageBox" );
|
|
64 gtk_object_set_data( GTK_OBJECT( MessageBox ),"MessageBox",MessageBox );
|
|
65 gtk_widget_set_events( MessageBox,GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_VISIBILITY_NOTIFY_MASK );
|
|
66 gtk_window_set_title( GTK_WINDOW( MessageBox ),"MPlayer ..." );
|
|
67 gtk_window_set_position( GTK_WINDOW( MessageBox ),GTK_WIN_POS_CENTER );
|
|
68 gtk_window_set_modal( GTK_WINDOW( MessageBox ),TRUE );
|
|
69 gtk_window_set_policy( GTK_WINDOW( MessageBox ),TRUE,TRUE,FALSE );
|
|
70 gtk_window_set_wmclass( GTK_WINDOW( MessageBox ),"Message","MPlayer" );
|
|
71
|
|
72 gtk_widget_realize( MessageBox );
|
|
73 gtkAddIcon( MessageBox );
|
|
74
|
|
75 vbox1=AddVBox( AddDialogFrame( MessageBox ),0 );
|
|
76 hbox1=AddHBox( vbox1,1 );
|
|
77
|
|
78 pixmapstyle=gtk_widget_get_style( MessageBox );
|
|
79
|
|
80 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )warning_xpm );
|
|
81 WarningPixmap=gtk_pixmap_new( pixmapwid,mask );
|
|
82 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )error_xpm );
|
|
83 ErrorPixmap=gtk_pixmap_new( pixmapwid,mask );
|
|
84
|
|
85 gtk_widget_set_name( WarningPixmap,"pixmap1" );
|
|
86 gtk_widget_hide( WarningPixmap );
|
|
87 gtk_box_pack_start( GTK_BOX( hbox1 ),WarningPixmap,FALSE,FALSE,0 );
|
|
88 gtk_widget_set_usize( WarningPixmap,55,-2 );
|
|
89
|
|
90 gtk_widget_set_name( ErrorPixmap,"pixmap1" );
|
|
91 gtk_widget_hide( ErrorPixmap );
|
|
92 gtk_box_pack_start( GTK_BOX( hbox1 ),ErrorPixmap,FALSE,FALSE,0 );
|
|
93 gtk_widget_set_usize( ErrorPixmap,55,-2 );
|
|
94
|
|
95 gtkMessageBoxText=gtk_label_new( "Text jol. Ha ezt megerted,akkor neked nagyon jo a magyar tudasod,te." );
|
|
96 gtk_widget_set_name( gtkMessageBoxText,"gtkMessageBoxText" );
|
|
97 gtk_widget_show( gtkMessageBoxText );
|
|
98 gtk_box_pack_start( GTK_BOX( hbox1 ),gtkMessageBoxText,TRUE,TRUE,0 );
|
|
99 // gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_FILL );
|
|
100 gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_CENTER );
|
|
101 gtk_label_set_line_wrap( GTK_LABEL( gtkMessageBoxText ),FALSE );
|
|
102
|
|
103 AddHSeparator( vbox1 );
|
|
104 hbuttonbox1=AddHButtonBox( vbox1 );
|
|
105 Ok=AddButton( MSGTR_Ok,hbuttonbox1 );
|
|
106
|
|
107 gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
|
|
108 gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
|
|
109
|
|
110 gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&MessageBox );
|
|
111 gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Ok_released ),NULL );
|
|
112
|
|
113 gtk_window_add_accel_group( GTK_WINDOW( MessageBox ),accel_group );
|
|
114
|
|
115 return MessageBox;
|
|
116 }
|