Mercurial > mplayer.hg
annotate gui/dialog/tools.c @ 36045:a6f9525929a4
Remove unnecessary initialization.
author | ib |
---|---|
date | Wed, 03 Apr 2013 16:25:33 +0000 |
parents | a9e5f317d6e4 |
children | caf1f563e0ee |
rev | line source |
---|---|
35526 | 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 | |
19 #include <gdk/gdkkeysyms.h> | |
20 #include <gtk/gtk.h> | |
36024 | 21 #include <string.h> |
35526 | 22 |
23 #include "tools.h" | |
24 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
25 GtkWidget * gtkAddDialogFrame( GtkWidget * parent ) |
35526 | 26 { |
27 GtkWidget * frame; | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
28 frame=gtkAddFrame( NULL,GTK_SHADOW_IN,parent,1 ); |
35526 | 29 gtk_container_set_border_width( GTK_CONTAINER( frame ),1 ); |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
30 frame=gtkAddFrame( NULL,GTK_SHADOW_NONE,frame,1 ); |
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
31 frame=gtkAddFrame( NULL,GTK_SHADOW_ETCHED_OUT,frame,1 ); |
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
32 frame=gtkAddFrame( NULL,GTK_SHADOW_NONE,frame,1 ); |
35526 | 33 return frame; |
34 } | |
35 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
36 GtkWidget * gtkAddFrame( const char * title,int type,GtkWidget * parent,int add ) |
35526 | 37 { |
38 GtkWidget * frame = NULL; | |
39 frame=gtk_frame_new( title ); | |
40 gtk_widget_set_name( frame,"frame" ); | |
41 gtk_widget_show( frame ); | |
42 gtk_frame_set_shadow_type( GTK_FRAME( frame ),type ); | |
43 if ( !parent ) return frame; | |
44 if ( add ) gtk_container_add( GTK_CONTAINER( parent ),frame ); | |
45 else gtk_box_pack_start( GTK_BOX( parent ),frame,FALSE,FALSE,0 ); | |
46 return frame; | |
47 } | |
48 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
49 GtkWidget * gtkAddLabel( const char * title,GtkWidget * parent ) |
35526 | 50 { |
51 GtkWidget * label; | |
52 label=gtk_label_new( title ); | |
53 gtk_widget_set_name( label,"label" ); | |
54 gtk_widget_show( label ); | |
55 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 ); | |
56 gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 ); | |
57 gtk_misc_set_padding( GTK_MISC( label ),4,0 ); | |
58 return label; | |
59 } | |
60 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
61 GtkWidget * gtkAddVBox( GtkWidget * parent,int type ) |
35526 | 62 { |
63 GtkWidget * vbox; | |
64 vbox=gtk_vbox_new( FALSE,0 ); | |
65 gtk_widget_set_name( vbox,"vbox" ); | |
66 gtk_widget_show( vbox ); | |
67 if ( parent ) | |
68 { | |
69 if ( type ) gtk_box_pack_start( GTK_BOX( parent ),vbox,FALSE,FALSE,0 ); | |
70 else gtk_container_add( GTK_CONTAINER( parent ),vbox ); | |
71 } | |
72 return vbox; | |
73 } | |
74 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
75 GtkWidget * gtkAddHBox( GtkWidget * parent,int type ) |
35526 | 76 { |
77 GtkWidget * hbox; | |
78 hbox=gtk_hbox_new( FALSE,0 ); | |
79 gtk_widget_set_name( hbox,"hbox" ); | |
80 gtk_widget_show( hbox ); | |
81 if ( parent ) | |
82 { | |
83 if ( type ) gtk_box_pack_start( GTK_BOX( parent ),hbox,FALSE,FALSE,0 ); | |
84 else gtk_container_add( GTK_CONTAINER( parent ),hbox ); | |
85 } | |
86 return hbox; | |
87 } | |
88 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
89 GtkWidget * gtkAddCheckButton( const char * title, GtkWidget * parent ) |
35526 | 90 { |
91 GtkWidget * CB; | |
92 CB=gtk_check_button_new_with_label( title ); | |
93 gtk_widget_set_name( CB,"CB" ); | |
94 gtk_widget_show( CB ); | |
95 gtk_box_pack_start( GTK_BOX( parent ),CB,FALSE,FALSE,0 ); | |
96 return CB; | |
97 } | |
98 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
99 GtkWidget * gtkAddRadioButton( const char * title,GSList ** group,GtkWidget * parent ) |
35526 | 100 { |
101 GtkWidget * RB; | |
102 RB=gtk_radio_button_new_with_label( *group,title ); | |
103 *group=gtk_radio_button_group( GTK_RADIO_BUTTON( RB ) ); | |
104 gtk_widget_set_name( RB,"RB" ); | |
105 gtk_widget_show( RB ); | |
106 gtk_box_pack_start( GTK_BOX( parent ),RB,FALSE,FALSE,0 ); | |
107 return RB; | |
108 } | |
109 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
110 GtkWidget * gtkAddSpinButton( const char * title,GtkAdjustment * adj,GtkWidget * parent ) |
35526 | 111 { |
112 GtkWidget * SB; | |
113 GtkWidget * label; | |
114 label=gtk_label_new( title ); | |
115 gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 ); | |
116 gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 ); | |
117 gtk_widget_show( label ); | |
118 SB=gtk_spin_button_new( adj,0,0 ); | |
119 gtk_widget_set_name( SB,"SB" ); | |
120 gtk_box_pack_start( GTK_BOX( parent ),SB,FALSE,FALSE,0 ); | |
121 gtk_widget_show( SB ); | |
122 return SB; | |
123 } | |
124 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
125 GtkWidget * gtkAddButton( const char * title,GtkWidget * parent ) |
35526 | 126 { |
127 GtkWidget * B; | |
128 B=gtk_button_new_with_label( title ); | |
129 gtk_widget_set_name( B,"B" ); | |
130 gtk_widget_show( B ); | |
131 gtk_container_add( GTK_CONTAINER( parent ),B ); | |
132 return B; | |
133 } | |
134 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
135 GtkWidget * gtkAddHSeparator( GtkWidget * parent ) |
35526 | 136 { |
137 GtkWidget * hseparator; | |
138 hseparator=gtk_hseparator_new(); | |
139 gtk_widget_set_name( hseparator,"hseparator1" ); | |
140 gtk_widget_show( hseparator ); | |
141 gtk_box_pack_start( GTK_BOX( parent ),hseparator,FALSE,FALSE,0 ); | |
142 gtk_widget_set_usize( hseparator,-2,6 ); | |
143 return hseparator; | |
144 } | |
145 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
146 GtkWidget * gtkAddHButtonBox( GtkWidget * parent ) |
35526 | 147 { |
148 GtkWidget * hbuttonbox; | |
149 hbuttonbox=gtk_hbutton_box_new(); | |
150 gtk_widget_set_name( hbuttonbox,"hbuttonbox" ); | |
151 gtk_widget_show( hbuttonbox ); | |
152 gtk_box_pack_start( GTK_BOX( parent ),hbuttonbox,FALSE,FALSE,0 ); | |
153 gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox ),85,20 ); | |
154 return hbuttonbox; | |
155 } | |
156 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
157 GtkWidget * gtkAddHScale( GtkAdjustment * adj,GtkWidget * parent,int digit ) |
35526 | 158 { |
159 GtkWidget * HS; | |
160 HS=gtk_hscale_new( adj ); | |
161 gtk_widget_set_name( HS,"HS" ); | |
162 gtk_widget_show( HS ); | |
163 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),HS,TRUE,TRUE,0 ); | |
164 gtk_scale_set_value_pos( GTK_SCALE( HS ),GTK_POS_RIGHT ); | |
165 gtk_scale_set_digits( GTK_SCALE( HS ),digit ); | |
166 return HS; | |
167 } | |
168 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
169 GtkWidget * gtkAddVScale( GtkAdjustment * adj,GtkWidget * parent,int digit ) |
35526 | 170 { |
171 GtkWidget * VS; | |
172 VS=gtk_vscale_new( adj ); | |
173 gtk_widget_set_name( VS,"VS" ); | |
174 gtk_widget_show( VS ); | |
175 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),VS,TRUE,TRUE,0 ); | |
176 // gtk_scale_set_value_pos( GTK_SCALE( VS ),GTK_POS_RIGHT ); | |
177 if ( digit == -1 ) gtk_scale_set_draw_value( GTK_SCALE( VS ),FALSE ); | |
178 else gtk_scale_set_digits( GTK_SCALE( VS ),digit ); | |
179 return VS; | |
180 } | |
181 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
182 GtkWidget * gtkAddCombo( GtkWidget * parent ) |
35526 | 183 { |
184 GtkWidget * CB; | |
185 CB=gtk_combo_new(); | |
186 gtk_widget_set_name( CB,"CB" ); | |
187 gtk_widget_show( CB ); | |
188 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),CB,TRUE,TRUE,0 ); | |
189 return CB; | |
190 } | |
36024 | 191 |
192 int gtkFindInCList (GtkWidget *list, char *item) | |
193 { | |
194 gint j; | |
195 gchar *tmpstr; | |
196 | |
197 for (j = 0; j < GTK_CLIST(list)->rows; j++) | |
198 { | |
199 gtk_clist_get_text(GTK_CLIST(list), j, 0, &tmpstr); | |
200 | |
201 if (!strcmp(tmpstr, item)) return j; | |
202 } | |
203 | |
204 return -1; | |
205 } |