Mercurial > mplayer.hg
annotate Gui/mplayer/gtk/common.c @ 20240:9b809e2ef375
Support new realaudio codec names
author | rtogni |
---|---|
date | Sun, 15 Oct 2006 17:19:13 +0000 |
parents | 273bdef43012 |
children | 945fa0eb37c0 |
rev | line source |
---|---|
8172 | 1 |
2 #include <gdk/gdkkeysyms.h> | |
3 #include <gtk/gtk.h> | |
4 | |
8299 | 5 #include "common.h" |
6 | |
8719
dc27303ae528
correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents:
8299
diff
changeset
|
7 void WidgetDestroy( GtkWidget * widget,GtkWidget ** widget_pointer ) |
dc27303ae528
correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents:
8299
diff
changeset
|
8 { |
dc27303ae528
correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents:
8299
diff
changeset
|
9 if ( !widget_pointer ) return; |
dc27303ae528
correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents:
8299
diff
changeset
|
10 gtk_widget_hide( *widget_pointer ); |
dc27303ae528
correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents:
8299
diff
changeset
|
11 gtk_widget_destroy( *widget_pointer ); |
dc27303ae528
correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents:
8299
diff
changeset
|
12 *widget_pointer=NULL; |
dc27303ae528
correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents:
8299
diff
changeset
|
13 } |
dc27303ae528
correct widget destroy event handler (thank for D J Hawkey Jr <hawkeyd@visi.com>)
pontscho
parents:
8299
diff
changeset
|
14 |
8299 | 15 GtkWidget * AddDialogFrame( GtkWidget * parent ) |
16 { | |
17 GtkWidget * frame; | |
18 frame=AddFrame( NULL,GTK_SHADOW_IN,parent,1 ); | |
19 gtk_container_set_border_width( GTK_CONTAINER( frame ),1 ); | |
20 frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 ); | |
21 frame=AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,frame,1 ); | |
22 frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 ); | |
23 return frame; | |
24 } | |
25 | |
19081
273bdef43012
Mark several string parameters that are not modified in the function as const.
diego
parents:
9055
diff
changeset
|
26 GtkWidget * AddFrame( const char * title,int type,GtkWidget * parent,int add ) |
8172 | 27 { |
28 GtkWidget * frame = NULL; | |
29 frame=gtk_frame_new( title ); | |
30 gtk_widget_set_name( frame,"frame" ); | |
31 gtk_widget_show( frame ); | |
9055 | 32 gtk_frame_set_shadow_type( GTK_FRAME( frame ),type ); |
33 if ( !parent ) return frame; | |
8172 | 34 if ( add ) gtk_container_add( GTK_CONTAINER( parent ),frame ); |
35 else gtk_box_pack_start( GTK_BOX( parent ),frame,FALSE,FALSE,0 ); | |
36 return frame; | |
37 } | |
38 | |
19081
273bdef43012
Mark several string parameters that are not modified in the function as const.
diego
parents:
9055
diff
changeset
|
39 GtkWidget * AddLabel( const char * title,GtkWidget * parent ) |
8172 | 40 { |
41 GtkWidget * label; | |
42 label=gtk_label_new( title ); | |
43 gtk_widget_set_name( label,"label" ); | |
44 gtk_widget_show( label ); | |
45 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 ); | |
46 gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 ); | |
47 gtk_misc_set_padding( GTK_MISC( label ),4,0 ); | |
48 return label; | |
49 } | |
50 | |
8299 | 51 GtkWidget * AddVBox( GtkWidget * parent,int type ) |
8172 | 52 { |
53 GtkWidget * vbox; | |
54 vbox=gtk_vbox_new( FALSE,0 ); | |
55 gtk_widget_set_name( vbox,"vbox" ); | |
56 gtk_widget_show( vbox ); | |
8299 | 57 if ( parent ) |
58 { | |
59 if ( type ) gtk_box_pack_start( GTK_BOX( parent ),vbox,FALSE,FALSE,0 ); | |
60 else gtk_container_add( GTK_CONTAINER( parent ),vbox ); | |
61 } | |
8172 | 62 return vbox; |
63 } | |
64 | |
65 GtkWidget * AddHBox( GtkWidget * parent,int type ) | |
66 { | |
67 GtkWidget * hbox; | |
68 hbox=gtk_hbox_new( FALSE,0 ); | |
69 gtk_widget_set_name( hbox,"hbox" ); | |
70 gtk_widget_show( hbox ); | |
8299 | 71 if ( parent ) |
72 { | |
73 if ( type ) gtk_box_pack_start( GTK_BOX( parent ),hbox,FALSE,FALSE,0 ); | |
74 else gtk_container_add( GTK_CONTAINER( parent ),hbox ); | |
75 } | |
8172 | 76 return hbox; |
77 } | |
78 | |
19081
273bdef43012
Mark several string parameters that are not modified in the function as const.
diego
parents:
9055
diff
changeset
|
79 GtkWidget * AddCheckButton( const char * title, GtkWidget * parent ) |
8172 | 80 { |
81 GtkWidget * CB; | |
82 CB=gtk_check_button_new_with_label( title ); | |
83 gtk_widget_set_name( CB,"CB" ); | |
84 gtk_widget_show( CB ); | |
85 gtk_box_pack_start( GTK_BOX( parent ),CB,FALSE,FALSE,0 ); | |
86 return CB; | |
87 } | |
88 | |
19081
273bdef43012
Mark several string parameters that are not modified in the function as const.
diego
parents:
9055
diff
changeset
|
89 GtkWidget * AddRadioButton( const char * title,GSList ** group,GtkWidget * parent ) |
8172 | 90 { |
91 GtkWidget * RB; | |
92 RB=gtk_radio_button_new_with_label( *group,title ); | |
93 *group=gtk_radio_button_group( GTK_RADIO_BUTTON( RB ) ); | |
94 gtk_widget_set_name( RB,"RB" ); | |
95 gtk_widget_show( RB ); | |
96 gtk_box_pack_start( GTK_BOX( parent ),RB,FALSE,FALSE,0 ); | |
97 return RB; | |
98 } | |
99 | |
19081
273bdef43012
Mark several string parameters that are not modified in the function as const.
diego
parents:
9055
diff
changeset
|
100 GtkWidget * AddButton( const char * title,GtkWidget * parent ) |
8172 | 101 { |
102 GtkWidget * B; | |
103 B=gtk_button_new_with_label( title ); | |
104 gtk_widget_set_name( B,"B" ); | |
105 gtk_widget_show( B ); | |
106 gtk_container_add( GTK_CONTAINER( parent ),B ); | |
107 return B; | |
108 } | |
109 | |
110 GtkWidget * AddHSeparator( GtkWidget * parent ) | |
111 { | |
112 GtkWidget * hseparator; | |
113 hseparator=gtk_hseparator_new(); | |
114 gtk_widget_set_name( hseparator,"hseparator1" ); | |
115 gtk_widget_show( hseparator ); | |
116 gtk_box_pack_start( GTK_BOX( parent ),hseparator,FALSE,FALSE,0 ); | |
117 gtk_widget_set_usize( hseparator,-2,6 ); | |
118 return hseparator; | |
119 } | |
120 | |
121 GtkWidget * AddHButtonBox( GtkWidget * parent ) | |
122 { | |
123 GtkWidget * hbuttonbox; | |
124 hbuttonbox=gtk_hbutton_box_new(); | |
125 gtk_widget_set_name( hbuttonbox,"hbuttonbox" ); | |
126 gtk_widget_show( hbuttonbox ); | |
127 gtk_box_pack_start( GTK_BOX( parent ),hbuttonbox,FALSE,FALSE,0 ); | |
128 gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox ),85,20 ); | |
129 return hbuttonbox; | |
130 } | |
131 | |
132 GtkWidget * AddHScaler( GtkAdjustment * adj,GtkWidget * parent,int digit ) | |
133 { | |
134 GtkWidget * HS; | |
135 HS=gtk_hscale_new( adj ); | |
136 gtk_widget_set_name( HS,"HS" ); | |
137 gtk_widget_show( HS ); | |
138 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),HS,TRUE,TRUE,0 ); | |
139 gtk_scale_set_value_pos( GTK_SCALE( HS ),GTK_POS_RIGHT ); | |
140 gtk_scale_set_digits( GTK_SCALE( HS ),digit ); | |
141 return HS; | |
142 } | |
8299 | 143 |
144 GtkWidget * AddVScaler( GtkAdjustment * adj,GtkWidget * parent,int digit ) | |
145 { | |
146 GtkWidget * VS; | |
147 VS=gtk_vscale_new( adj ); | |
148 gtk_widget_set_name( VS,"VS" ); | |
149 gtk_widget_show( VS ); | |
150 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),VS,TRUE,TRUE,0 ); | |
151 // gtk_scale_set_value_pos( GTK_SCALE( VS ),GTK_POS_RIGHT ); | |
152 if ( digit == -1 ) gtk_scale_set_draw_value( GTK_SCALE( VS ),FALSE ); | |
153 else gtk_scale_set_digits( GTK_SCALE( VS ),digit ); | |
154 return VS; | |
155 } | |
156 | |
157 GtkWidget * AddComboBox( GtkWidget * parent ) | |
158 { | |
159 GtkWidget * CB; | |
160 CB=gtk_combo_new(); | |
161 gtk_widget_set_name( CB,"CB" ); | |
162 gtk_widget_show( CB ); | |
163 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),CB,TRUE,TRUE,0 ); | |
164 return CB; | |
165 } |