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 (Insert)",
58 "button_playlist_add",
59 "Axialis_Team_item_add_16x116.png"
62 BUTTON_PLAYLIST_RELINK
,
63 "Relink items in playlist",
66 "button_playlist_relink",
67 "Axialis_Team_playlist_relink_16x16.png"
70 BUTTON_PLAYLIST_ITEM_EDIT
,
71 "Edit item in playlist (E)",
74 "button_playlist_edit",
75 "Axialis_Team_item_edit_16x116.png"
78 BUTTON_PLAYLIST_ITEM_DEL
,
79 "Delete item from playlist (Del)",
82 "button_playlist_del",
83 "Axialis_Team_item_delete_16x116.png"
86 BUTTON_PLAYLIST_ITEM_UP
,
87 "Move item above (Ctrl-UP)",
91 "Axialis_Team_item_move_up_16x116.png"
94 BUTTON_PLAYLIST_ITEM_DOWN
,
95 "Move item below (Ctrl-DOWN)",
98 "button_playlist_down",
99 "Axialis_Team_item_move_down_16x116.png"
102 BUTTON_PLAYLIST_LOAD
,
103 "Load playlist (Ctrl-O)",
106 "button_playlist_load",
107 "Axialis_Team_playlist_open_16x16.png"
110 BUTTON_PLAYLIST_SAVE
,
111 "Save playlist (Ctrl-S)",
114 "button_playlist_load",
115 "Axialis_Team_playlist_save_16x16.png"
118 BUTTON_PLAYLIST_BLOCK_LOOP
,
122 "button_playlist_block_loop",
123 "Axialis_Team_item_loop_16x116.png"
126 BUTTON_PLAYLIST_BLOCK_SINGLE
,
127 "Make a single block",
130 "button_playlist_block_single",
131 "Axialis_Team_item_block_16x116.png"
138 "button_playlist_cue",
139 "Axialis_Team_player_cue_32x32.png"
146 "button_playlist_play",
147 "Axialis_Team_player_play_64x32.png"
154 "button_playlist_pause",
155 "Axialis_Team_player_pause_32x32.png"
162 "button_playlist_stop",
163 "Axialis_Team_player_stop_32x32.png"
167 "Add to playlist (Enter)",
170 "button_library_add",
171 "Axialis_Team_item_add_from_library_16x16.png"
174 BUTTON_LIBRARY_REFRESH
,
175 "Refresh library (F5)",
178 "button_library_refresh",
179 "Axialis_Team_library_refresh_16x16.png"
186 "button_library_find",
187 "Axialis_Team_search_in_library_16x16.png"
190 BUTTON_LIBRARY_FIND_NEXT
,
194 "button_library_find_next",
195 "Axialis_Team_search_next_16x16.png"
203 GtkWidget
* ui_create_button(GtkWidget
* top
, instance_t
* app
, control_buttons_t id
)
206 GtkWidget
*button
, *alignment
, *hbox
, *image
= NULL
, *label
;
207 const button_desc_t
* info
= NULL
;
209 for(idx
= 0; !info
&& buttons
[idx
].id
!= BUTTON_LAST
; idx
++)
210 if(buttons
[idx
].id
== id
)
211 info
= &buttons
[idx
];
216 button
= gtk_button_new();
217 gtk_widget_show(button
);
218 GTK_WIDGET_UNSET_FLAGS(button
, GTK_CAN_FOCUS
);
219 GTK_WIDGET_SET_FLAGS(button
, GTK_CAN_DEFAULT
);
220 gtk_button_set_relief(GTK_BUTTON (button
), GTK_RELIEF_NONE
);
222 gtk_widget_set_tooltip_text(button
, info
->tooltip
);
224 alignment
= gtk_alignment_new(0, 0.5, 0, 0);
225 gtk_widget_show(alignment
);
226 gtk_container_add(GTK_CONTAINER (button
), alignment
);
228 hbox
= gtk_hbox_new(FALSE
, 2);
229 gtk_widget_show(hbox
);
230 gtk_container_add(GTK_CONTAINER(alignment
), hbox
);
233 image
= gtk_image_new_from_stock(info
->stock
, GTK_ICON_SIZE_MENU
);
234 else if(info
->filename
)
235 image
= gtk_image_new_from_pixbuf(create_pixbuf(info
->filename
));
238 gtk_widget_show(image
);
239 gtk_box_pack_start(GTK_BOX (hbox
), image
, FALSE
, FALSE
, 0);
242 label
= gtk_label_new_with_mnemonic("");
244 gtk_label_set_text(GTK_LABEL (label
), info
->label
);
245 gtk_widget_show(label
);
246 gtk_box_pack_start(GTK_BOX (hbox
), label
, FALSE
, FALSE
, 0);
247 gtk_label_set_justify(GTK_LABEL (label
), GTK_JUSTIFY_LEFT
);
250 GLADE_HOOKUP_OBJECT (top
, button
, info
->hookup
);
252 app
->buttons
[id
] = button
;
258 #endif /* UI_BUTTONS_H */