/* toolbar.c function for toolbar manual control * Copyright (c) 2004 by SmartLu All Rights Reserved * Distributed under the terms of the GNU General Public License (GPL) * See the GNU Library General Public License for more details. */ #include "srecite.h" GtkWidget *toolbar;// GtkWidget* stop_button; GtkWidget* back_button; GtkWidget* play_button; GtkWidget* next_button; /* show toolbar when click right button */ void toolbar_show() { if (S_state.toolbar_show == FALSE ) { //add heighth // gtk_widget_set_usize(window,WIN_WIDE,0);//S_state.win_h+23); gtk_widget_set_usize(window,0,0);//S_state.win_h+23); gtk_widget_show(toolbar); S_state.toolbar_show = TRUE; } else { // have no tool bar!!! //gtk_widget_set_usize(window,WIN_WIDE,WIN_HEIGHT); // gtk_widget_hide(toolbar); S_state.toolbar_show = FALSE; // because toolbar change window usize // fix fix_window_usize(); } } /* create toolbar as return value */ void create_toolbar(GtkWidget *window) { GtkWidget * icons; toolbar = gtk_toolbar_new(); gtk_toolbar_set_orientation(GTK_TOOLBAR(toolbar), GTK_ORIENTATION_HORIZONTAL); gtk_toolbar_set_style (GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); gtk_container_set_border_width(GTK_CONTAINER(toolbar), 1); gtk_toolbar_append_space(GTK_TOOLBAR (toolbar)); // Stop icons = gtk_image_new_from_file (PRE_DIR"icon/stop.png"); stop_button= gtk_toolbar_append_item (GTK_TOOLBAR(toolbar), "Stop","Stop to show",NULL, icons, (GtkSignalFunc) show_stop, NULL); // Back icons = gtk_image_new_from_file (PRE_DIR"icon/back.png"); back_button= gtk_toolbar_append_item (GTK_TOOLBAR(toolbar), "back","Last Word",NULL, icons, (GtkSignalFunc) show_back, NULL); // Play icons = gtk_image_new_from_file (PRE_DIR"icon/play.png"); play_button= gtk_toolbar_append_item (GTK_TOOLBAR(toolbar), "play","Play word",NULL, icons, (GtkSignalFunc) show_play, NULL); // make it inactive or active gtk_widget_set_sensitive(play_button,0); // Next icons = gtk_image_new_from_file (PRE_DIR"icon/next.png"); next_button= gtk_toolbar_append_item (GTK_TOOLBAR(toolbar), "Next","Next word",NULL, icons, (GtkSignalFunc) show_next, NULL); gtk_toolbar_append_space(GTK_TOOLBAR (toolbar)); // Ignore icons = gtk_image_new_from_file (PRE_DIR"icon/check.png"); gtk_toolbar_append_item (GTK_TOOLBAR(toolbar), "Ignore","Ignore this word",NULL, icons, (GtkSignalFunc) ignore_word, NULL); // Hide icons = gtk_image_new_from_file (PRE_DIR"icon/hide.png"); gtk_toolbar_append_item (GTK_TOOLBAR(toolbar), "Hide","Hide toolbar",NULL, icons, (GtkSignalFunc) toolbar_show, NULL); //gtk_toolbar_append_space(GTK_TOOLBAR (toolbar)); // Quit icons = gtk_image_new_from_file (PRE_DIR"icon/exits.png"); gtk_toolbar_append_item (GTK_TOOLBAR(toolbar), "Quit","Quit toolbar",NULL, icons, (GtkSignalFunc)quit_window , NULL); //gtk_toolbar_append_space(GTK_TOOLBAR (toolbar)); }