Mercurial > mplayer.hg
comparison Gui/mplayer/gtk/mb.c @ 2901:f77f8379f28f
rewrite ...
author | pontscho |
---|---|
date | Wed, 14 Nov 2001 16:04:25 +0000 |
parents | |
children | fe1283137353 |
comparison
equal
deleted
inserted
replaced
2900:7345a10e6012 | 2901:f77f8379f28f |
---|---|
1 | |
2 #include "../../events.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 | |
12 GtkWidget * gtkMessageBoxText; | |
13 | |
14 void on_MessageBox_destroy( GtkObject * object,gpointer user_data ) | |
15 { | |
16 /* | |
17 switch( (int)user_data ) | |
18 { | |
19 case GTK_MB_ERROR: gtk_widget_hide( ErrorMessageBox ); break; | |
20 case GTK_MB_WARNING: gtk_widget_hide( WarningMessageBox ); break; | |
21 } | |
22 */ | |
23 gtk_widget_hide( MessageBox ); | |
24 gtkVisibleMessageBox=0; | |
25 } | |
26 | |
27 void on_Ok_released( GtkButton * button,gpointer user_data ) | |
28 { | |
29 gtk_widget_hide( MessageBox ); | |
30 gtkVisibleMessageBox=0; | |
31 gtkSendMessage( evMessageBox ); | |
32 } | |
33 | |
34 GtkWidget * create_MessageBox( int type ) | |
35 { | |
36 GtkWidget * MessageBox; | |
37 GtkWidget * frame1; | |
38 GtkWidget * frame2; | |
39 GtkWidget * frame3; | |
40 GtkWidget * frame4; | |
41 GtkWidget * vbox1; | |
42 GtkWidget * hbox1; | |
43 GtkWidget * pixmap1; | |
44 GtkWidget * hseparator1; | |
45 GtkWidget * hbuttonbox1; | |
46 GtkWidget * Ok; | |
47 GtkAccelGroup * accel_group; | |
48 GtkStyle * pixmapstyle; | |
49 GtkPixmap * pixmapwid; | |
50 GdkBitmap * mask; | |
51 | |
52 accel_group = gtk_accel_group_new (); | |
53 | |
54 MessageBox = gtk_window_new (GTK_WINDOW_TOPLEVEL); | |
55 gtk_widget_set_name (MessageBox, "MessageBox"); | |
56 gtk_object_set_data (GTK_OBJECT (MessageBox), "MessageBox", MessageBox); | |
57 gtk_widget_set_events (MessageBox, GDK_EXPOSURE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_VISIBILITY_NOTIFY_MASK); | |
58 gtk_window_set_title (GTK_WINDOW (MessageBox), "MPlayer ..."); | |
59 gtk_window_set_position (GTK_WINDOW (MessageBox), GTK_WIN_POS_CENTER); | |
60 gtk_window_set_modal (GTK_WINDOW (MessageBox), TRUE); | |
61 gtk_window_set_policy (GTK_WINDOW (MessageBox), TRUE, TRUE, FALSE); | |
62 | |
63 frame1 = gtk_frame_new (NULL); | |
64 gtk_widget_set_name (frame1, "frame1"); | |
65 gtk_widget_ref (frame1); | |
66 gtk_object_set_data_full (GTK_OBJECT (MessageBox), "frame1", frame1, | |
67 (GtkDestroyNotify) gtk_widget_unref); | |
68 gtk_widget_show (frame1); | |
69 gtk_container_add (GTK_CONTAINER (MessageBox), frame1); | |
70 gtk_container_set_border_width (GTK_CONTAINER (frame1), 1); | |
71 gtk_frame_set_shadow_type (GTK_FRAME (frame1), GTK_SHADOW_IN); | |
72 | |
73 frame2 = gtk_frame_new (NULL); | |
74 gtk_widget_set_name (frame2, "frame2"); | |
75 gtk_widget_ref (frame2); | |
76 gtk_object_set_data_full (GTK_OBJECT (MessageBox), "frame2", frame2, | |
77 (GtkDestroyNotify) gtk_widget_unref); | |
78 gtk_widget_show (frame2); | |
79 gtk_container_add (GTK_CONTAINER (frame1), frame2); | |
80 gtk_frame_set_shadow_type (GTK_FRAME (frame2), GTK_SHADOW_NONE); | |
81 | |
82 frame3 = gtk_frame_new (NULL); | |
83 gtk_widget_set_name (frame3, "frame3"); | |
84 gtk_widget_ref (frame3); | |
85 gtk_object_set_data_full (GTK_OBJECT (MessageBox), "frame3", frame3, | |
86 (GtkDestroyNotify) gtk_widget_unref); | |
87 gtk_widget_show (frame3); | |
88 gtk_container_add (GTK_CONTAINER (frame2), frame3); | |
89 gtk_frame_set_shadow_type (GTK_FRAME (frame3), GTK_SHADOW_ETCHED_OUT); | |
90 | |
91 frame4 = gtk_frame_new (NULL); | |
92 gtk_widget_set_name (frame4, "frame4"); | |
93 gtk_widget_ref (frame4); | |
94 gtk_object_set_data_full (GTK_OBJECT (MessageBox), "frame4", frame4, | |
95 (GtkDestroyNotify) gtk_widget_unref); | |
96 gtk_widget_show (frame4); | |
97 gtk_container_add (GTK_CONTAINER (frame3), frame4); | |
98 gtk_frame_set_shadow_type (GTK_FRAME (frame4), GTK_SHADOW_NONE); | |
99 | |
100 vbox1 = gtk_vbox_new (FALSE, 0); | |
101 gtk_widget_set_name (vbox1, "vbox1"); | |
102 gtk_widget_ref (vbox1); | |
103 gtk_object_set_data_full (GTK_OBJECT (MessageBox), "vbox1", vbox1, | |
104 (GtkDestroyNotify) gtk_widget_unref); | |
105 gtk_widget_show (vbox1); | |
106 gtk_container_add (GTK_CONTAINER (frame4), vbox1); | |
107 | |
108 hbox1 = gtk_hbox_new (FALSE, 0); | |
109 gtk_widget_set_name (hbox1, "hbox1"); | |
110 gtk_widget_ref (hbox1); | |
111 gtk_object_set_data_full (GTK_OBJECT (MessageBox), "hbox1", hbox1, | |
112 (GtkDestroyNotify) gtk_widget_unref); | |
113 gtk_widget_show (hbox1); | |
114 gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0); | |
115 | |
116 pixmapstyle=gtk_widget_get_style( MessageBox ); | |
117 | |
118 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )warning_xpm ); | |
119 WarningPixmap=gtk_pixmap_new( pixmapwid,mask ); | |
120 pixmapwid=gdk_pixmap_colormap_create_from_xpm_d( MessageBox->window,gdk_colormap_get_system(),&mask,&pixmapstyle->bg[GTK_STATE_NORMAL],(gchar ** )error_xpm ); | |
121 ErrorPixmap=gtk_pixmap_new( pixmapwid,mask ); | |
122 | |
123 gtk_widget_set_name (WarningPixmap, "pixmap1"); | |
124 gtk_widget_ref (WarningPixmap); | |
125 gtk_object_set_data_full (GTK_OBJECT (MessageBox), "pixmap1", WarningPixmap,(GtkDestroyNotify)gtk_widget_unref); | |
126 gtk_widget_hide (WarningPixmap); | |
127 gtk_box_pack_start (GTK_BOX (hbox1), WarningPixmap, FALSE, FALSE, 0); | |
128 gtk_widget_set_usize (WarningPixmap, 55, -2); | |
129 | |
130 gtk_widget_set_name (ErrorPixmap, "pixmap1"); | |
131 gtk_widget_ref (ErrorPixmap); | |
132 gtk_object_set_data_full (GTK_OBJECT (MessageBox), "pixmap1", ErrorPixmap,(GtkDestroyNotify)gtk_widget_unref); | |
133 gtk_widget_hide (ErrorPixmap); | |
134 gtk_box_pack_start (GTK_BOX (hbox1), ErrorPixmap, FALSE, FALSE, 0); | |
135 gtk_widget_set_usize (ErrorPixmap, 55, -2); | |
136 | |
137 gtkMessageBoxText = gtk_label_new ( "Text jol. Ha ezt megerted, akkor neked nagyon jo a magyar tudasod, te."); | |
138 gtk_widget_set_name (gtkMessageBoxText, "gtkMessageBoxText"); | |
139 gtk_widget_ref (gtkMessageBoxText); | |
140 gtk_object_set_data_full (GTK_OBJECT (MessageBox), "gtkMessageBoxText", gtkMessageBoxText, | |
141 (GtkDestroyNotify) gtk_widget_unref); | |
142 gtk_widget_show (gtkMessageBoxText); | |
143 gtk_box_pack_start (GTK_BOX (hbox1), gtkMessageBoxText, TRUE, TRUE, 0); | |
144 gtk_label_set_justify (GTK_LABEL (gtkMessageBoxText), GTK_JUSTIFY_FILL); | |
145 gtk_label_set_line_wrap (GTK_LABEL (gtkMessageBoxText), TRUE); | |
146 | |
147 hseparator1 = gtk_hseparator_new (); | |
148 gtk_widget_set_name (hseparator1, "hseparator1"); | |
149 gtk_widget_ref (hseparator1); | |
150 gtk_object_set_data_full (GTK_OBJECT (MessageBox), "hseparator1", hseparator1, | |
151 (GtkDestroyNotify) gtk_widget_unref); | |
152 gtk_widget_show (hseparator1); | |
153 gtk_box_pack_start (GTK_BOX (vbox1), hseparator1, FALSE, FALSE, 0); | |
154 gtk_widget_set_usize (hseparator1, -2, 9); | |
155 | |
156 hbuttonbox1 = gtk_hbutton_box_new (); | |
157 gtk_widget_set_name (hbuttonbox1, "hbuttonbox1"); | |
158 gtk_widget_ref (hbuttonbox1); | |
159 gtk_object_set_data_full (GTK_OBJECT (MessageBox), "hbuttonbox1", hbuttonbox1, | |
160 (GtkDestroyNotify) gtk_widget_unref); | |
161 gtk_widget_show (hbuttonbox1); | |
162 gtk_box_pack_start (GTK_BOX (vbox1), hbuttonbox1, FALSE, FALSE, 0); | |
163 | |
164 Ok = gtk_button_new_with_label (MSGTR_Ok); | |
165 gtk_widget_set_name (Ok, MSGTR_Ok); | |
166 gtk_widget_ref (Ok); | |
167 gtk_object_set_data_full (GTK_OBJECT (MessageBox),MSGTR_Ok, Ok, | |
168 (GtkDestroyNotify) gtk_widget_unref); | |
169 gtk_widget_show (Ok); | |
170 gtk_container_add (GTK_CONTAINER (hbuttonbox1), Ok); | |
171 GTK_WIDGET_SET_FLAGS (Ok, GTK_CAN_DEFAULT); | |
172 gtk_widget_add_accelerator (Ok, "released", accel_group, | |
173 GDK_Return, 0, | |
174 GTK_ACCEL_VISIBLE); | |
175 gtk_widget_add_accelerator (Ok, "released", accel_group, | |
176 GDK_Escape, 0, | |
177 GTK_ACCEL_VISIBLE); | |
178 | |
179 gtk_signal_connect (GTK_OBJECT (MessageBox), "destroy_event", | |
180 GTK_SIGNAL_FUNC (on_MessageBox_destroy), | |
181 NULL); | |
182 gtk_signal_connect (GTK_OBJECT (Ok), "released",GTK_SIGNAL_FUNC (on_Ok_released),NULL); | |
183 | |
184 gtk_window_add_accel_group (GTK_WINDOW (MessageBox), accel_group); | |
185 | |
186 return MessageBox; | |
187 } |