Mercurial > mplayer.hg
annotate gui/dialog/tools.c @ 36440:019636d54771
Add support for Nios-II architecture.
Patch by Ezequiel Garc«ża [ezequiel vanguardiasur com.ar].
author | reimar |
---|---|
date | Fri, 06 Dec 2013 19:37:07 +0000 |
parents | caf1f563e0ee |
children | 92159376ad91 |
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_show( frame ); | |
41 gtk_frame_set_shadow_type( GTK_FRAME( frame ),type ); | |
42 if ( !parent ) return frame; | |
43 if ( add ) gtk_container_add( GTK_CONTAINER( parent ),frame ); | |
44 else gtk_box_pack_start( GTK_BOX( parent ),frame,FALSE,FALSE,0 ); | |
45 return frame; | |
46 } | |
47 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
48 GtkWidget * gtkAddLabel( const char * title,GtkWidget * parent ) |
35526 | 49 { |
50 GtkWidget * label; | |
51 label=gtk_label_new( title ); | |
52 gtk_widget_show( label ); | |
53 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 ); | |
54 gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 ); | |
55 gtk_misc_set_padding( GTK_MISC( label ),4,0 ); | |
56 return label; | |
57 } | |
58 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
59 GtkWidget * gtkAddVBox( GtkWidget * parent,int type ) |
35526 | 60 { |
61 GtkWidget * vbox; | |
62 vbox=gtk_vbox_new( FALSE,0 ); | |
63 gtk_widget_show( vbox ); | |
64 if ( parent ) | |
65 { | |
66 if ( type ) gtk_box_pack_start( GTK_BOX( parent ),vbox,FALSE,FALSE,0 ); | |
67 else gtk_container_add( GTK_CONTAINER( parent ),vbox ); | |
68 } | |
69 return vbox; | |
70 } | |
71 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
72 GtkWidget * gtkAddHBox( GtkWidget * parent,int type ) |
35526 | 73 { |
74 GtkWidget * hbox; | |
75 hbox=gtk_hbox_new( FALSE,0 ); | |
76 gtk_widget_show( hbox ); | |
77 if ( parent ) | |
78 { | |
79 if ( type ) gtk_box_pack_start( GTK_BOX( parent ),hbox,FALSE,FALSE,0 ); | |
80 else gtk_container_add( GTK_CONTAINER( parent ),hbox ); | |
81 } | |
82 return hbox; | |
83 } | |
84 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
85 GtkWidget * gtkAddCheckButton( const char * title, GtkWidget * parent ) |
35526 | 86 { |
87 GtkWidget * CB; | |
88 CB=gtk_check_button_new_with_label( title ); | |
89 gtk_widget_show( CB ); | |
90 gtk_box_pack_start( GTK_BOX( parent ),CB,FALSE,FALSE,0 ); | |
91 return CB; | |
92 } | |
93 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
94 GtkWidget * gtkAddRadioButton( const char * title,GSList ** group,GtkWidget * parent ) |
35526 | 95 { |
96 GtkWidget * RB; | |
97 RB=gtk_radio_button_new_with_label( *group,title ); | |
98 *group=gtk_radio_button_group( GTK_RADIO_BUTTON( RB ) ); | |
99 gtk_widget_show( RB ); | |
100 gtk_box_pack_start( GTK_BOX( parent ),RB,FALSE,FALSE,0 ); | |
101 return RB; | |
102 } | |
103 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
104 GtkWidget * gtkAddSpinButton( const char * title,GtkAdjustment * adj,GtkWidget * parent ) |
35526 | 105 { |
106 GtkWidget * SB; | |
107 GtkWidget * label; | |
108 label=gtk_label_new( title ); | |
109 gtk_misc_set_alignment( GTK_MISC( label ),0,0.5 ); | |
110 gtk_box_pack_start( GTK_BOX( parent ),label,FALSE,FALSE,0 ); | |
111 gtk_widget_show( label ); | |
112 SB=gtk_spin_button_new( adj,0,0 ); | |
113 gtk_box_pack_start( GTK_BOX( parent ),SB,FALSE,FALSE,0 ); | |
114 gtk_widget_show( SB ); | |
115 return SB; | |
116 } | |
117 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
118 GtkWidget * gtkAddButton( const char * title,GtkWidget * parent ) |
35526 | 119 { |
120 GtkWidget * B; | |
121 B=gtk_button_new_with_label( title ); | |
122 gtk_widget_show( B ); | |
123 gtk_container_add( GTK_CONTAINER( parent ),B ); | |
124 return B; | |
125 } | |
126 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
127 GtkWidget * gtkAddHSeparator( GtkWidget * parent ) |
35526 | 128 { |
129 GtkWidget * hseparator; | |
130 hseparator=gtk_hseparator_new(); | |
131 gtk_widget_show( hseparator ); | |
132 gtk_box_pack_start( GTK_BOX( parent ),hseparator,FALSE,FALSE,0 ); | |
133 gtk_widget_set_usize( hseparator,-2,6 ); | |
134 return hseparator; | |
135 } | |
136 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
137 GtkWidget * gtkAddHButtonBox( GtkWidget * parent ) |
35526 | 138 { |
139 GtkWidget * hbuttonbox; | |
140 hbuttonbox=gtk_hbutton_box_new(); | |
141 gtk_widget_show( hbuttonbox ); | |
142 gtk_box_pack_start( GTK_BOX( parent ),hbuttonbox,FALSE,FALSE,0 ); | |
143 gtk_button_box_set_child_size( GTK_BUTTON_BOX( hbuttonbox ),85,20 ); | |
144 return hbuttonbox; | |
145 } | |
146 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
147 GtkWidget * gtkAddHScale( GtkAdjustment * adj,GtkWidget * parent,int digit ) |
35526 | 148 { |
149 GtkWidget * HS; | |
150 HS=gtk_hscale_new( adj ); | |
151 gtk_widget_show( HS ); | |
152 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),HS,TRUE,TRUE,0 ); | |
153 gtk_scale_set_value_pos( GTK_SCALE( HS ),GTK_POS_RIGHT ); | |
154 gtk_scale_set_digits( GTK_SCALE( HS ),digit ); | |
155 return HS; | |
156 } | |
157 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
158 GtkWidget * gtkAddVScale( GtkAdjustment * adj,GtkWidget * parent,int digit ) |
35526 | 159 { |
160 GtkWidget * VS; | |
161 VS=gtk_vscale_new( adj ); | |
162 gtk_widget_show( VS ); | |
163 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),VS,TRUE,TRUE,0 ); | |
164 // gtk_scale_set_value_pos( GTK_SCALE( VS ),GTK_POS_RIGHT ); | |
165 if ( digit == -1 ) gtk_scale_set_draw_value( GTK_SCALE( VS ),FALSE ); | |
166 else gtk_scale_set_digits( GTK_SCALE( VS ),digit ); | |
167 return VS; | |
168 } | |
169 | |
36023
a04e8798227b
Cosmetic: Prefix all functions in dialog/tools.c with gtk.
ib
parents:
36009
diff
changeset
|
170 GtkWidget * gtkAddCombo( GtkWidget * parent ) |
35526 | 171 { |
172 GtkWidget * CB; | |
173 CB=gtk_combo_new(); | |
174 gtk_widget_show( CB ); | |
175 if ( parent ) gtk_box_pack_start( GTK_BOX( parent ),CB,TRUE,TRUE,0 ); | |
176 return CB; | |
177 } | |
36024 | 178 |
179 int gtkFindInCList (GtkWidget *list, char *item) | |
180 { | |
181 gint j; | |
182 gchar *tmpstr; | |
183 | |
184 for (j = 0; j < GTK_CLIST(list)->rows; j++) | |
185 { | |
186 gtk_clist_get_text(GTK_CLIST(list), j, 0, &tmpstr); | |
187 | |
188 if (!strcmp(tmpstr, item)) return j; | |
189 } | |
190 | |
191 return -1; | |
192 } |