NetSurf
Data Structures | Macros | Functions | Variables
window.cpp File Reference
#include <stdlib.h>
#include <assert.h>
#include <AppDefs.h>
#include <BeBuild.h>
#include <Clipboard.h>
#include <Cursor.h>
#include <InterfaceDefs.h>
#include <Message.h>
#include <ScrollBar.h>
#include <String.h>
#include <TextView.h>
#include <View.h>
#include <Window.h>
#include "utils/nsoption.h"
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
#include "utils/nsurl.h"
#include "netsurf/content_type.h"
#include "netsurf/browser_window.h"
#include "netsurf/mouse.h"
#include "netsurf/plotters.h"
#include "netsurf/window.h"
#include "netsurf/clipboard.h"
#include "netsurf/url_db.h"
#include "netsurf/keypress.h"
#include "beos/about.h"
#include "beos/window.h"
#include "beos/font.h"
#include "beos/gui.h"
#include "beos/scaffolding.h"
#include "beos/plotters.h"
Include dependency graph for window.cpp:

Go to the source code of this file.

Data Structures

struct  gui_window
 first entry in window list More...
 

Macros

#define __STDBOOL_H__   1
 

Functions

static void nsbeos_window_expose_event (BView *view, gui_window *g, BMessage *message)
 
static void nsbeos_window_keypress_event (BView *view, gui_window *g, BMessage *event)
 
static void nsbeos_window_resize_event (BView *view, gui_window *g, BMessage *event)
 
static void nsbeos_window_moved_event (BView *view, gui_window *g, BMessage *event)
 
static void nsbeos_redraw_caret (struct gui_window *g)
 
struct browser_windownsbeos_get_browser_window (struct gui_window *g)
 
nsbeos_scaffoldingnsbeos_get_scaffold (struct gui_window *g)
 Get containing scaffold of a beos gui window. More...
 
struct browser_windownsbeos_get_browser_for_gui (struct gui_window *g)
 
static struct gui_windowgui_window_create (struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
 
void nsbeos_dispatch_event (BMessage *message)
 Process beos messages into browser operations. More...
 
void nsbeos_reflow_all_windows (void)
 Cause all windows to be reflowed. More...
 
void nsbeos_window_destroy_browser (struct gui_window *g)
 
static void gui_window_destroy (struct gui_window *g)
 
static nserror beos_window_invalidate_area (struct gui_window *g, const struct rect *rect)
 Invalidate an area of a beos browser window. More...
 
static bool gui_window_get_scroll (struct gui_window *g, int *sx, int *sy)
 
static nserror gui_window_set_scroll (struct gui_window *g, const struct rect *rect)
 Set the scroll position of a beos browser window. More...
 
static void gui_window_update_extent (struct gui_window *g)
 
static BCursorID gui_haiku_pointer (gui_pointer_shape shape)
 
static void gui_window_set_pointer (struct gui_window *g, gui_pointer_shape shape)
 
static void gui_window_place_caret (struct gui_window *g, int x, int y, int height, const struct rect *clip)
 
static void gui_window_remove_caret (struct gui_window *g)
 
static void gui_window_new_content (struct gui_window *g)
 
static void gui_start_selection (struct gui_window *g)
 
static void gui_get_clipboard (char **buffer, size_t *length)
 
static void gui_set_clipboard (const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles)
 
static nserror gui_window_get_dimensions (struct gui_window *g, int *width, int *height)
 Find the current dimensions of a beos browser window content area. More...
 
static nserror gui_window_event (struct gui_window *gw, enum gui_window_event event)
 process miscellaneous window events More...
 

Variables

static const rgb_color kWhiteColor = {255, 255, 255, 255}
 
static struct gui_windowwindow_list = 0
 first entry in win list More...
 
static BString current_selection
 
static BList current_selection_textruns
 
static struct gui_clipboard_table clipboard_table
 
struct gui_clipboard_tablebeos_clipboard_table = &clipboard_table
 
static struct gui_window_table window_table
 
struct gui_window_tablebeos_window_table = &window_table
 

Macro Definition Documentation

◆ __STDBOOL_H__

#define __STDBOOL_H__   1

Definition at line 21 of file window.cpp.

Function Documentation

◆ beos_window_invalidate_area()

static nserror beos_window_invalidate_area ( struct gui_window g,
const struct rect rect 
)
static

Invalidate an area of a beos browser window.

Parameters
gThe netsurf window being invalidated.
rectarea to redraw or NULL for entrire window area.
Returns
NSERROR_OK or appropriate error code.

Definition at line 988 of file window.cpp.

References browser_window_has_content(), gui_window::bw, NSERROR_OK, gui_window::view, rect::x0, rect::x1, rect::y0, and rect::y1.

Here is the call graph for this function:

◆ gui_get_clipboard()

static void gui_get_clipboard ( char **  buffer,
size_t *  length 
)
static

Definition at line 1255 of file window.cpp.

References buffer, clip(), and text().

Here is the call graph for this function:

◆ gui_haiku_pointer()

static BCursorID gui_haiku_pointer ( gui_pointer_shape  shape)
static

Definition at line 1111 of file window.cpp.

References GUI_POINTER_CARET, GUI_POINTER_CROSS, GUI_POINTER_DEFAULT, GUI_POINTER_DOWN, GUI_POINTER_HELP, GUI_POINTER_LD, GUI_POINTER_LEFT, GUI_POINTER_LU, GUI_POINTER_MENU, GUI_POINTER_MOVE, GUI_POINTER_NO_DROP, GUI_POINTER_NOT_ALLOWED, GUI_POINTER_POINT, GUI_POINTER_PROGRESS, GUI_POINTER_RD, GUI_POINTER_RIGHT, GUI_POINTER_RU, GUI_POINTER_UP, and GUI_POINTER_WAIT.

Referenced by gui_window_set_pointer().

Here is the caller graph for this function:

◆ gui_set_clipboard()

static void gui_set_clipboard ( const char *  buffer,
size_t  length,
nsclipboard_styles  styles[],
int  n_styles 
)
static

Definition at line 1277 of file window.cpp.

References buffer, clip(), nsbeos_rgb_colour(), nsbeos_style_to_font(), and nsnsclipboard_styles::start.

Here is the call graph for this function:

◆ gui_start_selection()

static void gui_start_selection ( struct gui_window g)
static

Definition at line 1245 of file window.cpp.

References gui_window::view.

Referenced by gui_window_event().

Here is the caller graph for this function:

◆ gui_window_create()

static struct gui_window * gui_window_create ( struct browser_window bw,
struct gui_window existing,
gui_window_create_flags  flags 
)
static

< what we're creating to return

Definition at line 338 of file window.cpp.

References beos_warn_user(), gui_window::bw, gui_window::careth, gui_window::current_pointer, GUI_POINTER_DEFAULT, kWhiteColor, gui_window::mouse, gui_window::next, nsbeos_attach_toplevel_view(), nsbeos_new_scaffolding(), NSLOG, gui_window::pending_resizes, gui_window::prev, gui_window::scaffold, gui_window::state, gui_window::toplevel, gui_window::view, and window_list.

Here is the call graph for this function:

◆ gui_window_destroy()

static void gui_window_destroy ( struct gui_window g)
static

Definition at line 918 of file window.cpp.

References gui_window::bw, gui_window::next, nsbeos_scaffolding_destroy(), NSLOG, gui_window::prev, gui_window::scaffold, gui_window::toplevel, gui_window::view, and window_list.

Here is the call graph for this function:

◆ gui_window_event()

static nserror gui_window_event ( struct gui_window gw,
enum gui_window_event  event 
)
static

process miscellaneous window events

Parameters
gwThe window receiving the event.
eventThe event code.
Returns
NSERROR_OK when processed ok

Definition at line 1346 of file window.cpp.

References gui_start_selection(), gui_window_new_content(), gui_window_remove_caret(), gui_window_start_throbber(), gui_window_stop_throbber(), gui_window_update_extent(), GW_EVENT_NEW_CONTENT, GW_EVENT_REMOVE_CARET, GW_EVENT_START_SELECTION, GW_EVENT_START_THROBBER, GW_EVENT_STOP_THROBBER, GW_EVENT_UPDATE_EXTENT, and NSERROR_OK.

Here is the call graph for this function:

◆ gui_window_get_dimensions()

static nserror gui_window_get_dimensions ( struct gui_window g,
int *  width,
int *  height 
)
static

Find the current dimensions of a beos browser window content area.

Parameters
gThe gui window to measure content area of.
widthreceives width of window
heightreceives height of window
Returns
NSERROR_OK on sucess and width and height updated else error code.

Definition at line 1326 of file window.cpp.

References height, NSERROR_OK, gui_window::view, and width.

◆ gui_window_get_scroll()

static bool gui_window_get_scroll ( struct gui_window g,
int *  sx,
int *  sy 
)
static

Definition at line 1015 of file window.cpp.

References gui_window::view.

◆ gui_window_new_content()

static void gui_window_new_content ( struct gui_window g)
static

Definition at line 1229 of file window.cpp.

References gui_window::toplevel, and gui_window::view.

Referenced by gui_window_event().

Here is the caller graph for this function:

◆ gui_window_place_caret()

static void gui_window_place_caret ( struct gui_window g,
int  x,
int  y,
int  height,
const struct rect clip 
)
static

Definition at line 1186 of file window.cpp.

References gui_window::careth, gui_window::caretx, gui_window::carety, height, nsbeos_redraw_caret(), and gui_window::view.

Here is the call graph for this function:

◆ gui_window_remove_caret()

static void gui_window_remove_caret ( struct gui_window g)
static

Definition at line 1207 of file window.cpp.

References gui_window::careth, gui_window::caretx, gui_window::carety, nsbeos_current_gc_set(), and gui_window::view.

Referenced by gui_window_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ gui_window_set_pointer()

static void gui_window_set_pointer ( struct gui_window g,
gui_pointer_shape  shape 
)
static

Definition at line 1171 of file window.cpp.

References gui_window::current_pointer, gui_window::cursor, gui_haiku_pointer(), and gui_window::view.

Here is the call graph for this function:

◆ gui_window_set_scroll()

static nserror gui_window_set_scroll ( struct gui_window g,
const struct rect rect 
)
static

Set the scroll position of a beos browser window.

Scrolls the viewport to ensure the specified rectangle of the content is shown. The beos implementation scrolls the contents so the specified point in the content is at the top of the viewport.

Parameters
ggui window to scroll
rectThe rectangle to ensure is shown.
Returns
NSERROR_OK on success or apropriate error code.

Definition at line 1045 of file window.cpp.

References NSERROR_BAD_PARAMETER, NSERROR_OK, gui_window::view, rect::x0, and rect::y0.

◆ gui_window_update_extent()

static void gui_window_update_extent ( struct gui_window g)
static

Definition at line 1069 of file window.cpp.

References browser_window_get_extents(), browser_window_has_content(), gui_window::bw, NSERROR_OK, NSLOG, and gui_window::view.

Referenced by gui_window_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsbeos_dispatch_event()

void nsbeos_dispatch_event ( BMessage *  message)

◆ nsbeos_get_browser_for_gui()

struct browser_window * nsbeos_get_browser_for_gui ( struct gui_window g)

Definition at line 332 of file window.cpp.

References gui_window::bw.

Referenced by nsbeos_scaffolding_dispatch_event(), and nsbeos_window_update_back_forward().

Here is the caller graph for this function:

◆ nsbeos_get_browser_window()

struct browser_window * nsbeos_get_browser_window ( struct gui_window g)

Definition at line 322 of file window.cpp.

References gui_window::bw.

◆ nsbeos_get_scaffold()

nsbeos_scaffolding * nsbeos_get_scaffold ( struct gui_window g)

Get containing scaffold of a beos gui window.

Parameters
ggui window to find scaffold of.
Returns
The containing scaffold.

Definition at line 327 of file window.cpp.

References gui_window::scaffold.

Referenced by gui_window_set_icon(), gui_window_set_status(), gui_window_set_title(), gui_window_set_url(), gui_window_start_throbber(), and gui_window_stop_throbber().

Here is the caller graph for this function:

◆ nsbeos_redraw_caret()

void nsbeos_redraw_caret ( struct gui_window g)
static

Definition at line 961 of file window.cpp.

References gui_window::careth, gui_window::caretx, gui_window::carety, nsbeos_current_gc_set(), and gui_window::view.

Referenced by gui_window_place_caret().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsbeos_reflow_all_windows()

void nsbeos_reflow_all_windows ( void  )

Cause all windows to be reflowed.

Definition at line 905 of file window.cpp.

References browser_window_schedule_reformat(), gui_window::next, and window_list.

Here is the call graph for this function:

◆ nsbeos_window_destroy_browser()

void nsbeos_window_destroy_browser ( struct gui_window g)

Definition at line 913 of file window.cpp.

References browser_window_destroy(), and gui_window::bw.

Referenced by nsbeos_window_destroy_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsbeos_window_expose_event()

void nsbeos_window_expose_event ( BView *  view,
gui_window g,
BMessage *  message 
)
static

Definition at line 679 of file window.cpp.

References browser_window_has_content(), browser_window_redraw(), gui_window::bw, gui_window::careth, gui_window::caretx, gui_window::carety, clip(), gui_window::next, nsbeos_current_gc_set(), nsbeos_plot_caret(), nsbeos_plotters, gui_window::pending_resizes, view, gui_window::view, and window_list.

Referenced by nsbeos_dispatch_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsbeos_window_keypress_event()

void nsbeos_window_keypress_event ( BView *  view,
gui_window g,
BMessage *  event 
)
static

Definition at line 731 of file window.cpp.

References browser_window_key_press(), gui_window::bw, NS_KEY_DELETE_LEFT, NS_KEY_DELETE_RIGHT, NS_KEY_DOWN, NS_KEY_LEFT, NS_KEY_LINE_END, NS_KEY_LINE_START, NS_KEY_PAGE_DOWN, NS_KEY_PAGE_UP, NS_KEY_RIGHT, NS_KEY_TAB, NS_KEY_UP, NSLOG, utf8_to_ucs4(), and gui_window::view.

Referenced by nsbeos_dispatch_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ nsbeos_window_moved_event()

void nsbeos_window_moved_event ( BView *  view,
gui_window g,
BMessage *  event 
)
static

Definition at line 891 of file window.cpp.

References view.

Referenced by nsbeos_dispatch_event().

Here is the caller graph for this function:

◆ nsbeos_window_resize_event()

void nsbeos_window_resize_event ( BView *  view,
gui_window g,
BMessage *  event 
)
static

Definition at line 868 of file window.cpp.

References browser_window_schedule_reformat(), gui_window::bw, height, gui_window::pending_resizes, and width.

Referenced by nsbeos_dispatch_event().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ beos_clipboard_table

struct gui_clipboard_table* beos_clipboard_table = &clipboard_table

Definition at line 1314 of file window.cpp.

Referenced by gui_init_replicant(), and main().

◆ beos_window_table

struct gui_window_table* beos_window_table = &window_table

Definition at line 1405 of file window.cpp.

Referenced by gui_init_replicant(), and main().

◆ clipboard_table

struct gui_clipboard_table clipboard_table
static
Initial value:
= {
}
static void gui_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles)
Definition: window.cpp:1277
static void gui_get_clipboard(char **buffer, size_t *length)
Definition: window.cpp:1255

Definition at line 1309 of file window.cpp.

◆ current_selection

BString current_selection
static

Definition at line 103 of file window.cpp.

◆ current_selection_textruns

BList current_selection_textruns
static

Definition at line 104 of file window.cpp.

◆ kWhiteColor

const rgb_color kWhiteColor = {255, 255, 255, 255}
static

Definition at line 99 of file window.cpp.

Referenced by gui_window_create().

◆ window_list

struct gui_window* window_list = 0
static

◆ window_table

struct gui_window_table window_table
static
Initial value:
= {
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL
}
static void gui_window_set_status(struct gui_window *g, const char *text)
Definition: gui.c:5937
static nserror gui_window_set_url(struct gui_window *g, nsurl *url)
Definition: gui.c:5971
static void gui_window_set_title(struct gui_window *g, const char *restrict title)
Definition: gui.c:3622
static void gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
function to add retrieved favicon to gui
Definition: gui.c:2464
static nserror gui_window_event(struct gui_window *gw, enum gui_window_event event)
process miscellaneous window events
Definition: window.cpp:1346
static void gui_window_destroy(struct gui_window *g)
Definition: window.cpp:918
static void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
Definition: window.cpp:1171
static struct gui_window * gui_window_create(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
Definition: window.cpp:338
static nserror beos_window_invalidate_area(struct gui_window *g, const struct rect *rect)
Invalidate an area of a beos browser window.
Definition: window.cpp:988
static void gui_window_place_caret(struct gui_window *g, int x, int y, int height, const struct rect *clip)
Definition: window.cpp:1186
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
Definition: window.cpp:1015
static nserror gui_window_set_scroll(struct gui_window *g, const struct rect *rect)
Set the scroll position of a beos browser window.
Definition: window.cpp:1045
static nserror gui_window_get_dimensions(struct gui_window *g, int *width, int *height)
Find the current dimensions of a beos browser window content area.
Definition: window.cpp:1326

Definition at line 1380 of file window.cpp.