annotate gui/dialog/tools.c @ 36022:bf5690e00dc6

Cosmetic: Relocate gtkSelectInCList().
author ib
date Sun, 31 Mar 2013 17:41:18 +0000
parents e7bc0058139a
children a04e8798227b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
35526
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
1 /*
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
2 * This file is part of MPlayer.
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
3 *
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
7 * (at your option) any later version.
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
8 *
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
12 * GNU General Public License for more details.
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
13 *
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License along
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
17 */
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
18
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
19 #include <gdk/gdkkeysyms.h>
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
20 #include <gtk/gtk.h>
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
21
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
22 #include "tools.h"
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
23
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
24 GtkWidget * AddDialogFrame( GtkWidget * parent )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
25 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
26 GtkWidget * frame;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
27 frame=AddFrame( NULL,GTK_SHADOW_IN,parent,1 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
28 gtk_container_set_border_width( GTK_CONTAINER( frame ),1 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
29 frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
30 frame=AddFrame( NULL,GTK_SHADOW_ETCHED_OUT,frame,1 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
31 frame=AddFrame( NULL,GTK_SHADOW_NONE,frame,1 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
32 return frame;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
33 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
34
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
35 GtkWidget * AddFrame( const char * title,int type,GtkWidget * parent,int add )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
36 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
37 GtkWidget * frame = NULL;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
38 frame=gtk_frame_new( title );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
39 gtk_widget_set_name( frame,"frame" );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
40 gtk_widget_show( frame );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
41 gtk_frame_set_shadow_type( GTK_FRAME( frame ),type );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
42 if ( !parent ) return frame;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
43 if ( add ) gtk_container_add( GTK_CONTAINER( parent ),frame );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
44 else gtk_box_pack_start( GTK_BOX( parent ),frame,FALSE,FALSE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
45 return frame;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
46 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
47
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
48 GtkWidget * AddLabel( const char * title,GtkWidget * parent )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
49 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
50 GtkWidget * label;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
51 label=gtk_label_new( title );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
52 gtk_widget_set_name( label,"label" );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
53 gtk_widget_show( label );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
54 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
55 gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
56 gtk_misc_set_padding( GTK_MISC( label ),4,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
57 return label;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
58 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
59
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
60 GtkWidget * AddVBox( GtkWidget * parent,int type )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
61 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
62 GtkWidget * vbox;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
63 vbox=gtk_vbox_new( FALSE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
64 gtk_widget_set_name( vbox,"vbox" );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
65 gtk_widget_show( vbox );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
66 if ( parent )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
67 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
68 if ( type ) gtk_box_pack_start( GTK_BOX( parent ),vbox,FALSE,FALSE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
69 else gtk_container_add( GTK_CONTAINER( parent ),vbox );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
70 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
71 return vbox;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
72 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
73
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
74 GtkWidget * AddHBox( GtkWidget * parent,int type )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
75 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
76 GtkWidget * hbox;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
77 hbox=gtk_hbox_new( FALSE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
78 gtk_widget_set_name( hbox,"hbox" );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
79 gtk_widget_show( hbox );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
80 if ( parent )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
81 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
82 if ( type ) gtk_box_pack_start( GTK_BOX( parent ),hbox,FALSE,FALSE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
83 else gtk_container_add( GTK_CONTAINER( parent ),hbox );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
84 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
85 return hbox;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
86 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
87
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
88 GtkWidget * AddCheckButton( const char * title, GtkWidget * parent )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
89 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
90 GtkWidget * CB;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
91 CB=gtk_check_button_new_with_label( title );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
92 gtk_widget_set_name( CB,"CB" );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
93 gtk_widget_show( CB );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
94 gtk_box_pack_start( GTK_BOX( parent ),CB,FALSE,FALSE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
95 return CB;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
96 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
97
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
98 GtkWidget * AddRadioButton( const char * title,GSList ** group,GtkWidget * parent )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
99 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
100 GtkWidget * RB;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
101 RB=gtk_radio_button_new_with_label( *group,title );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
102 *group=gtk_radio_button_group( GTK_RADIO_BUTTON( RB ) );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
103 gtk_widget_set_name( RB,"RB" );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
104 gtk_widget_show( RB );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
105 gtk_box_pack_start( GTK_BOX( parent ),RB,FALSE,FALSE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
106 return RB;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
107 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
108
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
109 GtkWidget * AddSpinButton( const char * title,GtkAdjustment * adj,GtkWidget * parent )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
110 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
111 GtkWidget * SB;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
112 GtkWidget * label;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
113 label=gtk_label_new( title );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
114 gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
115 gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
116 gtk_widget_show( label );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
117 SB=gtk_spin_button_new( adj,0,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
118 gtk_widget_set_name( SB,"SB" );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
119 gtk_box_pack_start( GTK_BOX( parent ),SB,FALSE,FALSE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
120 gtk_widget_show( SB );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
121 return SB;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
122 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
123
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
124 GtkWidget * AddButton( const char * title,GtkWidget * parent )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
125 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
126 GtkWidget * B;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
127 B=gtk_button_new_with_label( title );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
128 gtk_widget_set_name( B,"B" );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
129 gtk_widget_show( B );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
130 gtk_container_add( GTK_CONTAINER( parent ),B );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
131 return B;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
132 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
133
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
134 GtkWidget * AddHSeparator( GtkWidget * parent )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
135 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
136 GtkWidget * hseparator;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
137 hseparator=gtk_hseparator_new();
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
138 gtk_widget_set_name( hseparator,"hseparator1" );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
139 gtk_widget_show( hseparator );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
140 gtk_box_pack_start( GTK_BOX( parent ),hseparator,FALSE,FALSE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
141 gtk_widget_set_usize( hseparator,-2,6 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
142 return hseparator;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
143 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
144
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
145 GtkWidget * AddHButtonBox( GtkWidget * parent )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
146 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
147 GtkWidget * hbuttonbox;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
148 hbuttonbox=gtk_hbutton_box_new();
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
149 gtk_widget_set_name( hbuttonbox,"hbuttonbox" );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
150 gtk_widget_show( hbuttonbox );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
151 gtk_box_pack_start( GTK_BOX( parent ),hbuttonbox,FALSE,FALSE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
152 gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox ),85,20 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
153 return hbuttonbox;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
154 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
155
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
156 GtkWidget * AddHScaler( GtkAdjustment * adj,GtkWidget * parent,int digit )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
157 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
158 GtkWidget * HS;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
159 HS=gtk_hscale_new( adj );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
160 gtk_widget_set_name( HS,"HS" );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
161 gtk_widget_show( HS );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
162 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),HS,TRUE,TRUE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
163 gtk_scale_set_value_pos( GTK_SCALE( HS ),GTK_POS_RIGHT );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
164 gtk_scale_set_digits( GTK_SCALE( HS ),digit );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
165 return HS;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
166 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
167
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
168 GtkWidget * AddVScaler( GtkAdjustment * adj,GtkWidget * parent,int digit )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
169 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
170 GtkWidget * VS;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
171 VS=gtk_vscale_new( adj );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
172 gtk_widget_set_name( VS,"VS" );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
173 gtk_widget_show( VS );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
174 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),VS,TRUE,TRUE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
175 // gtk_scale_set_value_pos( GTK_SCALE( VS ),GTK_POS_RIGHT );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
176 if ( digit == -1 ) gtk_scale_set_draw_value( GTK_SCALE( VS ),FALSE );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
177 else gtk_scale_set_digits( GTK_SCALE( VS ),digit );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
178 return VS;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
179 }
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
180
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
181 GtkWidget * AddComboBox( GtkWidget * parent )
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
182 {
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
183 GtkWidget * CB;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
184 CB=gtk_combo_new();
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
185 gtk_widget_set_name( CB,"CB" );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
186 gtk_widget_show( CB );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
187 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),CB,TRUE,TRUE,0 );
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
188 return CB;
3c901704a27c Rebuild GUI directory structure.
ib
parents:
diff changeset
189 }