1 /*
2  * @file browser_tabs.h  internal browsing using multiple tabs
3  *
4  * Copyright (C) 2004-2008 Lars Windolf <lars.windolf@gmx.de>
5  * Copyright (C) 2006 Nathan Conrad <conrad@bungled.net>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20  */
21 
22 #ifndef _BROWSER_TABS_H
23 #define _BROWSER_TABS_H
24 
25 #include <gtk/gtk.h>
26 
27 #include "liferea_htmlview.h"
28 
29 G_BEGIN_DECLS
30 
31 #define BROWSER_TABS_TYPE		(browser_tabs_get_type ())
32 #define BROWSER_TABS(obj)		(G_TYPE_CHECK_INSTANCE_CAST ((obj), BROWSER_TABS_TYPE, BrowserTabs))
33 #define BROWSER_TABS_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST ((klass), BROWSER_TABS_TYPE, BrowserTabsClass))
34 #define IS_BROWSER_TABS(obj)		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), BROWSER_TABS_TYPE))
35 #define IS_BROWSER_TABS_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE ((klass), BROWSER_TABS_TYPE))
36 
37 typedef struct BrowserTabs		BrowserTabs;
38 typedef struct BrowserTabsClass		BrowserTabsClass;
39 typedef struct BrowserTabsPrivate	BrowserTabsPrivate;
40 
41 extern BrowserTabs *browser_tabs;
42 
43 struct BrowserTabs
44 {
45 	GObject		parent;
46 
47 	/*< private >*/
48 	BrowserTabsPrivate	*priv;
49 };
50 
51 struct BrowserTabsClass
52 {
53 	GObjectClass parent_class;
54 };
55 
56 GType browser_tabs_get_type (void);
57 
58 /**
59  * browser_tabs_create: (skip)
60  * @notebook:	GtkNotebook widget to use
61  *
62  * Returns: the singleton browser tabs instance.
63  *
64  */
65 BrowserTabs * browser_tabs_create (GtkNotebook *notebook);
66 
67 /**
68  * browser_tabs_add_new:
69  * @url:	URL to be loaded in new tab (can be NULL to do nothing)
70  * @title:	title of the tab to be created
71  * @activate:   Should the new tab be put in the foreground?
72  *
73  * Adds a new tab with the specified URL and title.
74  *
75  * Returns: the newly created HTML view
76  */
77 LifereaHtmlView * browser_tabs_add_new (const gchar *url, const gchar *title, gboolean activate);
78 
79 /**
80  * browser_tabs_show_headlines:
81  *
82  * makes the headline tab visible
83  */
84 void browser_tabs_show_headlines (void);
85 
86 /**
87  * browser_tabs_get_active_htmlview:
88  *
89  * Used to determine which HTML view (a tab or the headlines view)
90  * is currently visible and can be used to display HTML that
91  * is to be loaded
92  *
93  * Returns: (transfer none) (nullable): HTML view widget
94  */
95 LifereaHtmlView * browser_tabs_get_active_htmlview (void);
96 
97 /**
98  * browser_tabs_do_zoom:
99  * @in:	TRUE if zooming in, FALSE for zooming out
100  *
101  * Requests the tab to change zoom level.
102  */
103 void browser_tabs_do_zoom (gboolean in);
104 
105 /* All widget elements and state of a tab */
106 typedef struct _tabInfo tabInfo;
107 struct _tabInfo {
108 	GtkWidget	*label;		/*<< the tab label */
109 	GtkWidget	*widget;	/*<< the embedded child widget */
110 	LifereaHtmlView	*htmlview;	/*<< the tabs HTML view widget */
111 };
112 
113 G_END_DECLS
114 
115 #endif
116