2001-11-14 16:04:25 +00:00
|
|
|
|
2007-03-16 00:00:13 +00:00
|
|
|
#include "app.h"
|
|
|
|
#include "config.h"
|
|
|
|
#include "help_mp.h"
|
2001-11-14 16:04:25 +00:00
|
|
|
|
|
|
|
#include "../pixmaps/error.xpm"
|
|
|
|
#include "../pixmaps/warning.xpm"
|
|
|
|
|
|
|
|
#include "../widgets.h"
|
|
|
|
#include "mb.h"
|
2002-11-27 22:48:56 +00:00
|
|
|
#include "common.h"
|
2001-11-14 16:04:25 +00:00
|
|
|
|
|
|
|
GtkWidget * gtkMessageBoxText;
|
2003-03-20 12:42:16 +00:00
|
|
|
GtkWidget * MessageBox = NULL;
|
2001-11-14 16:04:25 +00:00
|
|
|
|
2006-07-14 16:57:24 +00:00
|
|
|
void ShowMessageBox( const char * msg )
|
2002-05-20 13:56:16 +00:00
|
|
|
{
|
2002-11-27 22:48:56 +00:00
|
|
|
if ( MessageBox ) { gtk_widget_hide( MessageBox ); gtk_widget_destroy( MessageBox ); }
|
2002-08-04 17:24:00 +00:00
|
|
|
MessageBox=create_MessageBox( 0 );
|
2002-05-20 13:56:16 +00:00
|
|
|
if ( strlen( msg ) < 20 ) gtk_widget_set_usize( MessageBox,196,-1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void on_Ok_released( GtkButton * button,gpointer user_data )
|
2002-11-27 22:48:56 +00:00
|
|
|
{
|
|
|
|
gtk_widget_hide( MessageBox );
|
|
|
|
gtk_widget_destroy( MessageBox );
|
|
|
|
MessageBox=NULL;
|
|
|
|
}
|
2001-11-14 16:04:25 +00:00
|
|
|
|
|
|
|
GtkWidget * create_MessageBox( int type )
|
|
|
|
{
|
|
|
|
GtkWidget * vbox1;
|
|
|
|
GtkWidget * hbox1;
|
|
|
|
GtkWidget * hbuttonbox1;
|
|
|
|
GtkWidget * Ok;
|
|
|
|
GtkAccelGroup * accel_group;
|
|
|
|
GtkStyle * pixmapstyle;
|
2002-05-23 14:46:08 +00:00
|
|
|
GdkPixmap * pixmapwid;
|
2001-11-14 16:04:25 +00:00
|
|
|
GdkBitmap * mask;
|
|
|
|
|
2002-05-11 16:37:58 +00:00
|
|
|
accel_group=gtk_accel_group_new();
|
|
|
|
|
|
|
|
MessageBox=gtk_window_new( GTK_WINDOW_TOPLEVEL );
|
|
|
|
gtk_widget_set_name( MessageBox,"MessageBox" );
|
|
|
|
gtk_object_set_data( GTK_OBJECT( MessageBox ),"MessageBox",MessageBox );
|
|
|
|
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 ),TRUE,TRUE,FALSE );
|
2002-07-05 23:47:00 +00:00
|
|
|
gtk_window_set_wmclass( GTK_WINDOW( MessageBox ),"Message","MPlayer" );
|
|
|
|
|
|
|
|
gtk_widget_realize( MessageBox );
|
|
|
|
gtkAddIcon( MessageBox );
|
2002-05-11 16:37:58 +00:00
|
|
|
|
2002-11-27 22:48:56 +00:00
|
|
|
vbox1=AddVBox( AddDialogFrame( MessageBox ),0 );
|
|
|
|
hbox1=AddHBox( vbox1,1 );
|
2001-11-14 16:04:25 +00:00
|
|
|
|
|
|
|
pixmapstyle=gtk_widget_get_style( MessageBox );
|
|
|
|
|
2002-05-20 13:56:16 +00:00
|
|
|
pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )warning_xpm );
|
2001-11-14 16:04:25 +00:00
|
|
|
WarningPixmap=gtk_pixmap_new( pixmapwid,mask );
|
2002-05-20 13:56:16 +00:00
|
|
|
pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )error_xpm );
|
2001-11-14 16:04:25 +00:00
|
|
|
ErrorPixmap=gtk_pixmap_new( pixmapwid,mask );
|
|
|
|
|
2002-05-11 16:37:58 +00:00
|
|
|
gtk_widget_set_name( WarningPixmap,"pixmap1" );
|
|
|
|
gtk_widget_hide( WarningPixmap );
|
|
|
|
gtk_box_pack_start( GTK_BOX( hbox1 ),WarningPixmap,FALSE,FALSE,0 );
|
|
|
|
gtk_widget_set_usize( WarningPixmap,55,-2 );
|
|
|
|
|
|
|
|
gtk_widget_set_name( ErrorPixmap,"pixmap1" );
|
|
|
|
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_set_name( gtkMessageBoxText,"gtkMessageBoxText" );
|
|
|
|
gtk_widget_show( gtkMessageBoxText );
|
|
|
|
gtk_box_pack_start( GTK_BOX( hbox1 ),gtkMessageBoxText,TRUE,TRUE,0 );
|
2002-08-14 23:02:45 +00:00
|
|
|
// gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_FILL );
|
|
|
|
gtk_label_set_justify( GTK_LABEL( gtkMessageBoxText ),GTK_JUSTIFY_CENTER );
|
2002-05-20 13:56:16 +00:00
|
|
|
gtk_label_set_line_wrap( GTK_LABEL( gtkMessageBoxText ),FALSE );
|
2002-05-11 16:37:58 +00:00
|
|
|
|
2002-11-27 22:48:56 +00:00
|
|
|
AddHSeparator( vbox1 );
|
|
|
|
hbuttonbox1=AddHButtonBox( vbox1 );
|
|
|
|
Ok=AddButton( 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 );
|
|
|
|
|
2003-01-02 15:48:29 +00:00
|
|
|
gtk_signal_connect( GTK_OBJECT( MessageBox ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&MessageBox );
|
2002-11-27 22:48:56 +00:00
|
|
|
gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( on_Ok_released ),NULL );
|
2002-05-11 16:37:58 +00:00
|
|
|
|
|
|
|
gtk_window_add_accel_group( GTK_WINDOW( MessageBox ),accel_group );
|
2001-11-14 16:04:25 +00:00
|
|
|
|
|
|
|
return MessageBox;
|
|
|
|
}
|