2 * ui_buttons.h -- GTK+ 2 omnplay
3 * Copyright (C) 2011 Maksym Veremeyenko <verem@m1stereo.tv>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software Foundation,
17 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #include <sys/types.h>
33 #include <gdk/gdkkeysyms.h>
38 #include "ui_buttons.h"
41 typedef struct button_desc
51 static const button_desc_t buttons
[] =
54 BUTTON_PLAYLIST_ITEM_ADD
,
55 "Add item to playlist",
58 "button_playlist_add",
59 "Axialis_Team_item_add_16x116.png"
62 BUTTON_PLAYLIST_ITEM_EDIT
,
63 "Edit item in playlist",
66 "button_playlist_edit",
67 "Axialis_Team_item_edit_16x116.png"
70 BUTTON_PLAYLIST_ITEM_DEL
,
71 "Delete item from playlist",
74 "button_playlist_del",
75 "Axialis_Team_item_delete_16x116.png"
78 BUTTON_PLAYLIST_ITEM_UP
,
83 "Axialis_Team_item_move_up_16x116.png"
86 BUTTON_PLAYLIST_ITEM_DOWN
,
90 "button_playlist_down",
91 "Axialis_Team_item_move_down_16x116.png"
98 "button_playlist_load",
99 "Axialis_Team_playlist_open_16x16.png"
102 BUTTON_PLAYLIST_SAVE
,
106 "button_playlist_load",
107 "Axialis_Team_playlist_save_16x16.png"
110 BUTTON_PLAYLIST_BLOCK_LOOP
,
114 "button_playlist_block_loop",
115 "Axialis_Team_item_loop_16x116.png"
118 BUTTON_PLAYLIST_BLOCK_SINGLE
,
119 "Make a single block",
122 "button_playlist_block_single",
123 "Axialis_Team_item_block_16x116.png"
130 "button_playlist_cue",
131 "Axialis_Team_player_cue_32x32.png"
138 "button_playlist_play",
139 "Axialis_Team_player_play_64x32.png"
146 "button_playlist_pause",
147 "Axialis_Team_player_pause_32x32.png"
154 "button_playlist_stop",
155 "Axialis_Team_player_stop_32x32.png"
162 "button_library_add",
163 "Axialis_Team_item_add_from_library_16x16.png"
166 BUTTON_LIBRARY_REFRESH
,
170 "button_library_refresh",
171 "Axialis_Team_library_refresh_16x16.png"
180 GtkWidget
* ui_create_button(GtkWidget
* top
, omnplay_instance_t
* app
, control_buttons_t id
)
183 GtkWidget
*button
, *alignment
, *hbox
, *image
= NULL
, *label
;
184 const button_desc_t
* info
= NULL
;
186 for(idx
= 0; !info
&& buttons
[idx
].id
!= BUTTON_LAST
; idx
++)
187 if(buttons
[idx
].id
== id
)
188 info
= &buttons
[idx
];
193 button
= gtk_button_new();
194 gtk_widget_show(button
);
195 GTK_WIDGET_UNSET_FLAGS(button
, GTK_CAN_FOCUS
);
196 GTK_WIDGET_SET_FLAGS(button
, GTK_CAN_DEFAULT
);
197 gtk_button_set_relief(GTK_BUTTON (button
), GTK_RELIEF_NONE
);
199 gtk_widget_set_tooltip_text(button
, info
->tooltip
);
201 alignment
= gtk_alignment_new(0, 0.5, 0, 0);
202 gtk_widget_show(alignment
);
203 gtk_container_add(GTK_CONTAINER (button
), alignment
);
205 hbox
= gtk_hbox_new(FALSE
, 2);
206 gtk_widget_show(hbox
);
207 gtk_container_add(GTK_CONTAINER(alignment
), hbox
);
210 image
= gtk_image_new_from_stock(info
->stock
, GTK_ICON_SIZE_MENU
);
211 else if(info
->filename
)
212 image
= gtk_image_new_from_pixbuf(create_pixbuf(info
->filename
));
215 gtk_widget_show(image
);
216 gtk_box_pack_start(GTK_BOX (hbox
), image
, FALSE
, FALSE
, 0);
219 label
= gtk_label_new_with_mnemonic("");
221 gtk_label_set_text(GTK_LABEL (label
), info
->label
);
222 gtk_widget_show(label
);
223 gtk_box_pack_start(GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
224 gtk_label_set_justify(GTK_LABEL (label
), GTK_JUSTIFY_LEFT
);
227 GLADE_HOOKUP_OBJECT (top
, button
, info
->hookup
);
229 app
->buttons
[id
] = button
;
235 #endif /* UI_BUTTONS_H */