Changeset 70

Show
Ignore:
Timestamp:
04/15/06 11:20:14 (3 years ago)
Author:
jordi
Message:

The tool and status bar can now be shown and hidden.

Location:
trunk/src/gtk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/gtk/MainView.cxx

    r69 r70  
    4747static void main_window_quit_cb (GtkWidget *, gpointer); 
    4848static void main_window_show_sidebar_cb (GtkToggleAction *, gpointer); 
     49static void main_window_show_statusbar_cb (GtkToggleAction *, gpointer); 
     50static void main_window_show_toolbar_cb (GtkToggleAction *, gpointer); 
    4951static void main_window_zoom_fit_cb (GtkWidget *, gpointer); 
    5052static void main_window_zoom_in_cb (GtkWidget *, gpointer); 
     
    121123    { "ShowToolBar", NULL, N_("Show _Toolbar"), NULL, 
    122124      N_("Show or hidde the toolbar"), 
    123       NULL, TRUE }, 
     125      G_CALLBACK (main_window_show_toolbar_cb), TRUE }, 
    124126    { "ShowStatusBar", NULL, N_("Show _Statusbar"), NULL, 
    125127      N_("Show or hidde the statusbar"), 
    126       NULL, TRUE }, 
     128      G_CALLBACK (main_window_show_statusbar_cb), TRUE }, 
    127129    { "ShowSideBar", NULL, N_("Show O_utline"), NULL, 
    128130      N_("Show or hidde the document's outline"), 
     
    175177    // The status bar don't do anything, yet. But without the application 
    176178    // look weird. 
    177     GtkWidget *statusBar = gtk_statusbar_new (); 
    178     gtk_box_pack_start (GTK_BOX (m_MainBox), statusBar, FALSE, FALSE, 0); 
    179     gtk_widget_show (statusBar); 
     179    m_StatusBar = gtk_statusbar_new (); 
     180    gtk_box_pack_start (GTK_BOX (m_MainBox), m_StatusBar, FALSE, FALSE, 0); 
     181    gtk_widget_show (m_StatusBar); 
    180182} 
    181183 
     
    665667            child = outline->getNextChild (); 
    666668        } 
     669    } 
     670} 
     671 
     672/// 
     673/// @brief Shows or hiddes the status bar. 
     674/// 
     675/// @param show Set to TRUE to show the status bar. FALSE otherwise. 
     676/// 
     677void 
     678MainView::showStatusbar (gboolean show) 
     679{ 
     680    if ( show )  
     681    { 
     682        gtk_widget_show (m_StatusBar); 
     683    } 
     684    else 
     685    { 
     686        gtk_widget_hide (m_StatusBar); 
     687    } 
     688} 
     689 
     690/// 
     691/// @brief Shows or hiddes the tool bar. 
     692/// 
     693/// @param show Set to TRUE to show the tool bar. FALSE otherwise. 
     694/// 
     695void 
     696MainView::showToolbar (gboolean show) 
     697{ 
     698    GtkWidget *toolBar = gtk_ui_manager_get_widget (m_UIManager, "/ToolBar"); 
     699    if ( show )  
     700    { 
     701        gtk_widget_show (toolBar); 
     702    } 
     703    else 
     704    { 
     705        gtk_widget_hide (toolBar); 
    667706    } 
    668707} 
     
    865904 
    866905/// 
     906/// @brief Called when the user clicks on the "Show Statusbar" action. 
     907/// 
     908void 
     909main_window_show_statusbar_cb (GtkToggleAction *action, gpointer data) 
     910{ 
     911    g_assert ( NULL != data && "The data parameter is NULL."); 
     912 
     913    MainView *view = (MainView *)data; 
     914    view->showStatusbar (gtk_toggle_action_get_active (action)); 
     915} 
     916 
     917/// 
     918/// @brief Called when the user clicks on the "Show Toolbar" action. 
     919/// 
     920void 
     921main_window_show_toolbar_cb (GtkToggleAction *action, gpointer data) 
     922{ 
     923    g_assert ( NULL != data && "The data parameter is NULL."); 
     924 
     925    MainView *view = (MainView *)data; 
     926    view->showToolbar (gtk_toggle_action_get_active (action)); 
     927} 
     928 
     929/// 
    867930/// @brief The user tries to fit the document into the window. 
    868931/// 
  • trunk/src/gtk/MainView.h

    r67 r70  
    5757            void setOutline (DocumentOutline *outline); 
    5858 
     59            void showToolbar (gboolean show); 
     60            void showStatusbar (gboolean show); 
     61 
    5962        protected: 
    6063            GtkWidget *m_CurrentPage; 
     
    6669            GtkWidget *m_PageViewScroll; 
    6770            GtkWidget *m_Sidebar; 
     71            GtkWidget *m_StatusBar; 
    6872            gint m_TotalPages; 
    6973            GtkUIManager *m_UIManager;