NetSurf
|
#include <stdint.h>
#include <string.h>
#include "utils/nsoption.h"
#include "utils/log.h"
#include "netsurf/browser_window.h"
#include "desktop/search.h"
#include "gtk/compat.h"
#include "gtk/toolbar_items.h"
#include "gtk/scaffolding.h"
#include "gtk/window.h"
#include "gtk/search.h"
#include "gtk/tabs.h"
Go to the source code of this file.
Macros | |
#define | TAB_WIDTH_N_CHARS 15 |
Functions | |
static void | nsgtk_tab_update_size (GtkWidget *hbox, GtkStyle *previous_style, GtkWidget *close_button) |
callback to update sizes when style-set gtk signal More... | |
static gboolean | nsgtk_tab_button_release (GtkWidget *widget, GdkEventButton *event, gpointer user_data) |
gtk event handler for button release on tab hbox More... | |
static GtkWidget * | nsgtk_tab_label_setup (GtkWidget *page, const char *title, GdkPixbuf *icon_pixbuf) |
Create a notebook tab label. More... | |
static void | nsgtk_tab_switch_page (GtkNotebook *notebook, GtkWidget *page, guint selpagenum, gpointer user_data) |
The before switch-page gtk signal handler. More... | |
static void | nsgtk_tab_switch_page_after (GtkNotebook *notebook, GtkWidget *selpage, guint selpagenum, gpointer user_data) |
The after switch-page gtk signal handler. More... | |
static void | nsgtk_tab_page_reordered (GtkNotebook *notebook, GtkWidget *child, guint page_num, gpointer user_data) |
The tab reordered gtk signal handler. More... | |
static void | nsgtk_tab_orientation (GtkNotebook *notebook) |
The tab orientation signal handler. More... | |
static GtkWidget * | nsgtk_tab_add_newtab (GtkNotebook *notebook) |
adds a "new tab" tab More... | |
static void | nsgtk_tab_visibility_update (GtkNotebook *notebook, GtkWidget *child, guint page) |
callback to alter tab visibility when pages are added or removed More... | |
void | nsgtk_tab_options_changed (GtkNotebook *notebook) |
nserror | nsgtk_notebook_create (GtkBuilder *builder, GtkNotebook **notebook_out) |
create notebook More... | |
nserror | nsgtk_tab_add_page (GtkNotebook *notebook, GtkWidget *tab_contents, bool background, const char *title, GdkPixbuf *icon_pixbuf) |
Add new page to a notebook. More... | |
void | nsgtk_tab_add (struct gui_window *gw, GtkWidget *tab_contents, bool background, const char *title, GdkPixbuf *icon_pixbuf) |
Add new gui window page to notebook. More... | |
nserror | nsgtk_tab_set_icon (GtkWidget *page, GdkPixbuf *pixbuf) |
set the tab icon More... | |
nserror | nsgtk_tab_set_title (GtkWidget *page, const char *title) |
set the tab title More... | |
nserror | nsgtk_tab_close_current (GtkNotebook *notebook) |
nserror | nsgtk_tab_prev (GtkNotebook *notebook) |
nserror | nsgtk_tab_next (GtkNotebook *notebook) |
Variables | |
static gint | srcpagenum |
nserror nsgtk_notebook_create | ( | GtkBuilder * | builder, |
GtkNotebook ** | notebook_out | ||
) |
create notebook
creates a notebook for use inside a window, creates the special add page(tab) and attaches all signals.
builder | the gtk builder object to create notbook from |
notebook_out | reciveds the created notebook |
Definition at line 380 of file tabs.c.
References NSERROR_OK, nsgtk_tab_add_newtab(), nsgtk_tab_options_changed(), nsgtk_tab_page_reordered(), nsgtk_tab_switch_page(), nsgtk_tab_switch_page_after(), and nsgtk_tab_visibility_update().
Referenced by nsgtk_new_scaffolding().
void nsgtk_tab_add | ( | struct gui_window * | gw, |
GtkWidget * | tab_contents, | ||
bool | background, | ||
const char * | title, | ||
GdkPixbuf * | icon_pixbuf | ||
) |
Add new gui window page to notebook.
Definition at line 452 of file tabs.c.
References nsgtk_get_scaffold(), nsgtk_scaffolding_notebook(), nsgtk_tab_add_page(), and gui_window::title.
Referenced by gui_window_create().
|
static |
adds a "new tab" tab
Definition at line 312 of file tabs.c.
References nsgtk_hbox_new(), and NSGTK_STOCK_ADD.
Referenced by nsgtk_notebook_create().
nserror nsgtk_tab_add_page | ( | GtkNotebook * | notebook, |
GtkWidget * | tab_contents, | ||
bool | background, | ||
const char * | title, | ||
GdkPixbuf * | icon_pixbuf | ||
) |
Add new page to a notebook.
Definition at line 418 of file tabs.c.
References NSERROR_OK, nsgtk_tab_label_setup(), and gui_window::title.
Referenced by cutomize_button_clicked_cb(), and nsgtk_tab_add().
|
static |
gtk event handler for button release on tab hbox
Definition at line 78 of file tabs.c.
Referenced by nsgtk_tab_label_setup().
nserror nsgtk_tab_close_current | ( | GtkNotebook * | notebook | ) |
Definition at line 527 of file tabs.c.
References NSERROR_OK, and nsgtk_window_destroy_browser().
Referenced by nsgtk_on_closetab_activate_menu().
|
static |
Create a notebook tab label.
page | The page content widget |
title | The title of the page |
icon_pixbuf | The icon of the page |
Definition at line 101 of file tabs.c.
References GTK_ALIGN_CENTER, GTK_ALIGN_START, nsgtk_button_set_focus_on_click(), nsgtk_hbox_new(), nsgtk_image_new_from_stock(), NSGTK_STOCK_CLOSE, nsgtk_tab_button_release(), nsgtk_tab_update_size(), nsgtk_widget_set_alignment(), and nsgtk_widget_set_margins().
Referenced by nsgtk_tab_add_page().
nserror nsgtk_tab_next | ( | GtkNotebook * | notebook | ) |
Definition at line 568 of file tabs.c.
References NSERROR_OK.
Referenced by nsgtk_on_nexttab_activate_menu().
void nsgtk_tab_options_changed | ( | GtkNotebook * | notebook | ) |
Definition at line 372 of file tabs.c.
References nsgtk_tab_orientation(), and nsgtk_tab_visibility_update().
Referenced by nsgtk_notebook_create(), and nsgtk_window_update_all().
|
static |
The tab orientation signal handler.
notebook | The notebook being changed |
page_num | The currently selected page number |
user_data | Unused |
Definition at line 286 of file tabs.c.
References nsoption_int.
Referenced by nsgtk_tab_options_changed().
|
static |
The tab reordered gtk signal handler.
notebook | The notebook being changed |
page_num | The currently selected page number |
user_data | Unused |
Definition at line 260 of file tabs.c.
Referenced by nsgtk_notebook_create().
nserror nsgtk_tab_prev | ( | GtkNotebook * | notebook | ) |
Definition at line 560 of file tabs.c.
References NSERROR_OK.
Referenced by nsgtk_on_prevtab_activate_menu().
nserror nsgtk_tab_set_icon | ( | GtkWidget * | page, |
GdkPixbuf * | pixbuf | ||
) |
set the tab icon
The tab icon will be set to the pixbuf parameter
page | The page widget that was added to the notebook |
pixbuf | The pixbuf to set the icon to. |
Definition at line 470 of file tabs.c.
References gui_window::favicon, NSERROR_BAD_PARAMETER, NSERROR_INVALID, and NSERROR_OK.
Referenced by gui_window_set_icon(), next_throbber_frame(), and throbber().
nserror nsgtk_tab_set_title | ( | GtkWidget * | page, |
const char * | title | ||
) |
set the tab title
The tab title will be set to the parameter
page | The page widget that was added to the notebook |
title | The title text which may not be NULL. |
Definition at line 498 of file tabs.c.
References NSERROR_BAD_PARAMETER, NSERROR_INVALID, NSERROR_OK, and gui_window::title.
Referenced by gui_window_set_title().
|
static |
The before switch-page gtk signal handler.
This signal is handled both before and after delivery to work round issue that setting the selected tab during the switch-page signal fails
notebook | The notebook being changed |
page | The notebook page being switched to |
selpagenum | The currently selected page number |
user_data | Unused |
Definition at line 183 of file tabs.c.
References srcpagenum.
Referenced by nsgtk_notebook_create().
|
static |
The after switch-page gtk signal handler.
notebook | The notebook being changed |
selpage | The notebook page selected |
selpagenum | The currently selected page number |
user_data | Unused |
Definition at line 201 of file tabs.c.
References NEWTAB_BUTTON, NSERROR_INVALID, NSERROR_OK, nsgtk_scaffolding_from_notebook(), nsgtk_scaffolding_menu_bar(), nsgtk_scaffolding_set_top_level(), nsgtk_window_item_activate(), NSLOG, and srcpagenum.
Referenced by nsgtk_notebook_create().
|
static |
callback to update sizes when style-set gtk signal
Definition at line 42 of file tabs.c.
References nsgtk_icon_size_lookup_for_settings(), nsgtk_style_context_get_font(), nsgtk_widget_get_state_flags(), nsgtk_widget_get_style_context(), and TAB_WIDTH_N_CHARS.
Referenced by nsgtk_tab_label_setup().
|
static |
callback to alter tab visibility when pages are added or removed
Definition at line 345 of file tabs.c.
References nsoption_bool.
Referenced by nsgtk_notebook_create(), and nsgtk_tab_options_changed().
|
static |
Definition at line 36 of file tabs.c.
Referenced by nsgtk_tab_switch_page(), and nsgtk_tab_switch_page_after().