21#define __STDBOOL_H__ 1
28#include <InterfaceDefs.h>
119 : BView(frame,
"NSBrowserFrameView", B_FOLLOW_ALL_SIDES,
120 B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS ),
134 switch (message->what) {
136 case B_ARGV_RECEIVED:
137 case B_REFS_RECEIVED:
145 case B_NETPOSITIVE_OPEN_URL:
146 case B_NETPOSITIVE_BACK:
147 case B_NETPOSITIVE_FORWARD:
148 case B_NETPOSITIVE_HOME:
149 case B_NETPOSITIVE_RELOAD:
150 case B_NETPOSITIVE_STOP:
151 case B_NETPOSITIVE_DOWN:
152 case B_NETPOSITIVE_UP:
236 Window()->DetachCurrentMessage();
241 BView::MessageReceived(message);
249 BMessage *message = NULL;
253 message =
new BMessage(_UPDATE_);
254 message->AddRect(
"rect", updateRect);
263 BMessage *message = Window()->DetachCurrentMessage();
268 BView::FrameResized(new_width, new_height);
275 BMessage *message = Window()->DetachCurrentMessage();
283 BMessage *message = Window()->DetachCurrentMessage();
285 if (message->FindPoint(
"screen_where", &screenWhere) < B_OK) {
286 screenWhere = ConvertToScreen(where);
287 message->AddPoint(
"screen_where", screenWhere);
298 BMessage *message = Window()->DetachCurrentMessage();
300 if (message->FindPoint(
"screen_where", &screenWhere) < B_OK) {
301 screenWhere = ConvertToScreen(where);
302 message->AddPoint(
"screen_where", screenWhere);
311 if (transit != B_INSIDE_VIEW) {
312 BView::MouseMoved(where, transit, msg);
315 BMessage *message = Window()->DetachCurrentMessage();
350 NSLOG(netsurf, INFO,
"Creating gui window %p for browser window %p",
373 BRect frame(0,0,-1,-1);
381 g->
view->SetViewColor(B_TRANSPARENT_COLOR);
384#ifdef B_BEOS_VERSION_DANO
414 if (message->FindPointer(
"View", (
void **)&
view) < B_OK)
416 if (message->FindPointer(
"gui_window", (
void **)&gui) < B_OK)
418 if (message->FindPointer(
"Window", (
void **)&
window) < B_OK)
420 if (message->FindPointer(
"scaffolding", (
void **)&scaffold) < B_OK)
433 "discarding event for destroyed gui_window");
439 "discarding event for destroyed scaffolding");
446 NSLOG(netsurf, INFO,
"dispatching to top-level");
452 NSLOG(netsurf, DEEPDEBUG,
"processing message");
453 switch (message->what) {
454 case B_QUIT_REQUESTED:
458 case B_ABOUT_REQUESTED:
478 if (message->FindPoint(
"be:view_where", &where) < B_OK) {
479 if (message->FindPoint(
"where", &where) < B_OK)
482 if (message->FindInt32(
"modifiers", &mods) < B_OK)
504 bool shift = mods & B_SHIFT_KEY;
505 bool ctrl = mods & B_CONTROL_KEY;
531 if (message->FindPoint(
"be:view_where", &where) < B_OK) {
532 if (message->FindPoint(
"where", &where) < B_OK)
535 if (message->FindInt32(
"buttons", &buttons) < B_OK)
537 if (message->FindPoint(
"screen_where", &screenWhere) < B_OK)
539 if (message->FindInt32(
"modifiers", &mods) < B_OK)
542 if (buttons & B_SECONDARY_MOUSE_BUTTON) {
550 if (buttons & B_TERTIARY_MOUSE_BUTTON)
553 if (mods & B_SHIFT_KEY)
555 if (mods & B_CONTROL_KEY)
563 if (!
view->IsFocus())
565 view->UnlockLooper();
583 if (message->FindPoint(
"be:view_where", &where) < B_OK) {
584 if (message->FindPoint(
"where", &where) < B_OK)
587 if (message->FindInt32(
"buttons", &buttons) < B_OK)
589 if (message->FindPoint(
"screen_where", &screenWhere) < B_OK)
591 if (message->FindInt32(
"modifiers", &mods) < B_OK)
601 bool shift = mods & B_SHIFT_KEY;
602 bool ctrl = mods & B_CONTROL_KEY;
642 case B_MOUSE_WHEEL_CHANGED:
654 nserror (*cb)(
const char *username,
655 const char *password,
658 if (message->FindPointer(
"URL", (
void**)&
url) < B_OK)
660 if (message->FindString(
"Realm", &realm) < B_OK)
662 if (message->FindString(
"User", &username) < B_OK)
664 if (message->FindString(
"Pass", &password) < B_OK)
666 if (message->FindPointer(
"callback", (
void**)&cb) < B_OK)
668 if (message->FindPointer(
"callback_pw", (
void**)&cbpw) < B_OK)
670 cb(username.String(), password.String(), cbpw);
699 if (message->FindRect(
"rect", &updateRect) < B_OK)
705 if (!
view->LockLooper())
710 view->Window()->BeginViewTransaction();
712 clip.x0 = (int)updateRect.left;
713 clip.y0 = (
int)updateRect.top;
714 clip.x1 = (int)updateRect.right + 1;
715 clip.y1 = (
int)updateRect.bottom + 1;
723 view->Window()->EndViewTransaction();
726 view->ConstrainClippingRegion(NULL);
728 view->UnlockLooper();
742 if (event->FindInt32(
"modifiers", (
int32 *)&mods) < B_OK)
744 if (event->FindInt32(
"key", (
int32 *)&key) < B_OK)
746 if (event->FindInt32(
"raw_char", (
int32 *)&raw_char) < B_OK)
749 for (i = 0; i < 5; i++) {
751 if (event->FindInt8(
"byte", i, (
int8 *)&buff[i]) < B_OK)
758 }
else if (event->FindString(
"bytes", &bytes) < B_OK)
762 numbytes = strlen(bytes);
764 NSLOG(netsurf, INFO,
"mods 0x%08lx key %ld raw %ld byte[0] %d", mods,
765 key, raw_char, buff[0]);
770 if (mods & B_CONTROL_KEY)
771 byte = (char)raw_char;
772 if (
byte >=
'!' &&
byte <=
'~')
773 nskey = (uint32_t)
byte;
779 case B_ENTER: nskey = (uint32_t)10;
break;
780 case B_ESCAPE: nskey = (uint32_t)
'\033';
break;
781 case B_SPACE: nskey = (uint32_t)
' ';
break;
792 case B_UP_ARROW: nskey =
NS_KEY_UP;
break;
817 nskey = (uint32_t)raw_char;
831 float hdelta = 0.0f, vdelta = 0.0f;
832 g->
view->LockLooper();
833 BRect size = g->
view->Bounds();
836 g->
view->ScrollTo(0.0f, 0.0f);
844 vdelta = -size.Height();
847 vdelta = size.Height();
863 g->
view->ScrollBy(hdelta, vdelta);
864 g->
view->UnlockLooper();
878 if (event->FindInt32(
"width", &
width) < B_OK)
880 if (event->FindInt32(
"height", &
height) < B_OK)
895#warning XXX: Invalidate ?
899 view->UnlockLooper();
932 NSLOG(netsurf, INFO,
"Destroying gui_window %p", g);
934 assert(g->
bw != NULL);
939 if (!g->
view->LockLooper())
942 BLooper *looper = g->
view->Looper();
945 g->
view->RemoveSelf();
949 g->
view->RemoveSelf();
968 if (!g->
view->LockLooper())
977 g->
view->UnlockLooper();
994 if (g->
view == NULL) {
998 if (!g->
view->LockLooper()) {
1007 g->
view->Invalidate();
1010 g->
view->UnlockLooper();
1018 if (g->
view == NULL)
1020 if (!g->
view->LockLooper())
1023#warning XXX: report to view frame ?
1024 if (g->
view->ScrollBar(B_HORIZONTAL))
1025 *sx = (int)g->
view->ScrollBar(B_HORIZONTAL)->Value();
1026 if (g->
view->ScrollBar(B_VERTICAL))
1027 *sy = (
int)g->
view->ScrollBar(B_VERTICAL)->Value();
1029 g->
view->UnlockLooper();
1048 if (g->
view == NULL) {
1051 if (!g->
view->LockLooper()) {
1055#warning XXX: report to view frame ?
1056 if (g->
view->ScrollBar(B_HORIZONTAL)) {
1057 g->
view->ScrollBar(B_HORIZONTAL)->SetValue(
rect->
x0);
1059 if (g->
view->ScrollBar(B_VERTICAL)) {
1060 g->
view->ScrollBar(B_VERTICAL)->SetValue(
rect->
y0);
1063 g->
view->UnlockLooper();
1076 if (g->
view == NULL)
1078 if (!g->
view->LockLooper())
1087 float x_prop = g->
view->Bounds().Width() / x_max;
1088 float y_prop = g->
view->Bounds().Height() / y_max;
1089 x_max -= g->
view->Bounds().Width() + 1;
1090 y_max -= g->
view->Bounds().Height() + 1;
1092 NSLOG(netsurf, INFO,
1093 "x_max = %d y_max = %d x_prop = %f y_prop = %f\n", x_max,
1094 y_max, x_prop, y_prop);
1096 if (g->
view->ScrollBar(B_HORIZONTAL)) {
1097 g->
view->ScrollBar(B_HORIZONTAL)->SetRange(0, x_max);
1098 g->
view->ScrollBar(B_HORIZONTAL)->SetProportion(x_prop);
1099 g->
view->ScrollBar(B_HORIZONTAL)->SetSteps(10, 50);
1101 if (g->
view->ScrollBar(B_VERTICAL)) {
1102 g->
view->ScrollBar(B_VERTICAL)->SetRange(0, y_max);
1103 g->
view->ScrollBar(B_VERTICAL)->SetProportion(y_prop);
1104 g->
view->ScrollBar(B_VERTICAL)->SetSteps(10, 50);
1108 g->
view->UnlockLooper();
1115 return B_CURSOR_ID_FOLLOW_LINK;
1118 return B_CURSOR_ID_I_BEAM;
1121 return B_CURSOR_ID_CONTEXT_MENU;
1124 return B_CURSOR_ID_RESIZE_NORTH;
1127 return B_CURSOR_ID_RESIZE_SOUTH;
1130 return B_CURSOR_ID_RESIZE_WEST;
1133 return B_CURSOR_ID_RESIZE_EAST;
1136 return B_CURSOR_ID_RESIZE_NORTH_EAST;
1139 return B_CURSOR_ID_RESIZE_SOUTH_WEST;
1142 return B_CURSOR_ID_RESIZE_NORTH_WEST;
1145 return B_CURSOR_ID_RESIZE_SOUTH_EAST;
1148 return B_CURSOR_ID_CROSS_HAIR;
1151 return B_CURSOR_ID_MOVE;
1155 return B_CURSOR_ID_PROGRESS;
1159 return B_CURSOR_ID_NOT_ALLOWED;
1162 return B_CURSOR_ID_HELP;
1168 return B_CURSOR_ID_SYSTEM_DEFAULT;
1180 if (g->
view && g->
view->LockLooper()) {
1182 g->
view->UnlockLooper();
1190 if (g->
view == NULL)
1192 if (!g->
view->LockLooper())
1202 g->
view->MakeFocus();
1204 g->
view->UnlockLooper();
1216 if (g->
view == NULL)
1218 if (!g->
view->LockLooper())
1226 g->
view->UnlockLooper();
1234 if (g->
view == NULL)
1236 if (!g->
view->LockLooper())
1240 g->
view->ScrollTo(0,0);
1242 g->
view->UnlockLooper();
1247 if (!g->
view->LockLooper())
1250 g->
view->MakeFocus();
1252 g->
view->UnlockLooper();
1261 if (be_clipboard->Lock()) {
1262 clip = be_clipboard->Data();
1266 if (
clip->FindData(
"text/plain", B_MIME_TYPE,
1267 (
const void **)&
text, &textlen) >= B_OK) {
1268 *
buffer = (
char *)malloc(textlen);
1273 be_clipboard->Unlock();
1282 if (be_clipboard->Lock()) {
1283 be_clipboard->Clear();
1284 clip = be_clipboard->Data();
1286 clip->AddData(
"text/plain", B_MIME_TYPE,
buffer, length);
1288 int arraySize =
sizeof(text_run_array) +
1289 n_styles *
sizeof(text_run);
1290 text_run_array *array = (text_run_array *)malloc(arraySize);
1291 array->count = n_styles;
1292 for (
int i = 0; i < n_styles; i++) {
1295 array->runs[i].offset = styles[i].
start;
1296 array->runs[i].font = font;
1297 array->runs[i].color =
1300 clip->AddData(
"application/x-vnd.Be-text_run_array", B_MIME_TYPE,
1303 be_clipboard->Commit();
1305 be_clipboard->Unlock();
1329 g->
view->LockLooper()) {
1332 g->
view->UnlockLooper();
void nsbeos_about(struct gui_window *gui)
Creates the about alert.
static void gui_window_set_status(struct gui_window *g, const char *text)
static nserror gui_window_set_url(struct gui_window *g, nsurl *url)
static void gui_window_set_title(struct gui_window *g, const char *restrict title)
static void gui_window_set_icon(struct gui_window *g, struct hlcache_handle *icon)
function to add retrieved favicon to gui
void gui_window_stop_throbber(struct gui_window *g)
void gui_window_start_throbber(struct gui_window *g)
static struct s_view view
#define B_UI_SETTINGS_CHANGED
@ BROWSER_NAVIGATE_FORWARD
@ BROWSER_OBJECT_EXPORT_SPRITE
@ BROWSER_OBJECT_SAVE_URL_URI
@ BROWSER_IMAGES_BACKGROUND
@ BROWSER_NAVIGATE_RELOAD
@ BROWSER_OBJECT_SAVE_URL_URL
@ BROWSER_NAVIGATE_RELOAD_ALL
@ BROWSER_IMAGES_FOREGROUND
@ BROWSER_OBJECT_SAVE_URL_TEXT
@ HELP_LAUNCH_INTERACTIVE
Browser window creation and manipulation interface.
nserror browser_window_schedule_reformat(struct browser_window *bw)
Reformat the browser window contents in a safe context.
bool browser_window_redraw(struct browser_window *bw, int x, int y, const struct rect *clip, const struct redraw_context *ctx)
Redraw an area of a window.
bool browser_window_has_content(struct browser_window *bw)
Find out if a browser window is currently showing a content.
void browser_window_mouse_click(struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle mouse clicks in a browser window.
void browser_window_destroy(struct browser_window *bw)
Close and destroy a browser window.
nserror browser_window_get_extents(struct browser_window *bw, bool scaled, int *width, int *height)
Get a browser window's content extents.
void browser_window_mouse_track(struct browser_window *bw, browser_mouse_state mouse, int x, int y)
Handle non-click mouse action in a browser window.
static osspriteop_area * buffer
The buffer characteristics.
virtual void FrameResized(float new_width, float new_height)
virtual ~NSBrowserFrameView()
virtual void MouseDown(BPoint where)
virtual void KeyDown(const char *bytes, int32 numBytes)
struct gui_window * fGuiWindow
virtual void MouseUp(BPoint where)
virtual void Draw(BRect updateRect)
NSBrowserFrameView(BRect frame, struct gui_window *gui)
virtual void MessageReceived(BMessage *message)
virtual void MouseMoved(BPoint where, uint32 transit, const BMessage *msg)
Declaration of content enumerations.
nserror
Enumeration of error codes.
@ NSERROR_BAD_PARAMETER
Bad Parameter.
void nsbeos_style_to_font(BFont &font, const struct plot_font_style *fstyle)
Convert a font style to a PangoFontDescription.
Beos font layout handling interface.
Target independent plotting (BeOS interface).
void nsbeos_pipe_message_top(BMessage *message, BWindow *_this, struct beos_scaffolding *scaffold)
void nsbeos_pipe_message(BMessage *message, BView *_this, struct gui_window *gui)
nserror beos_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
void nsbeos_update_system_ui_colors(void)
Interface to platform-specific clipboard operations.
Core mouse and pointer states.
browser_mouse_state
Mouse state.
@ BROWSER_MOUSE_PRESS_1
button 1 pressed
@ BROWSER_MOUSE_CLICK_2
button 2 clicked.
@ BROWSER_MOUSE_PRESS_2
button 2 pressed
@ BROWSER_MOUSE_CLICK_1
button 1 clicked.
@ BROWSER_MOUSE_MOD_2
2nd modifier key pressed (eg.
@ BROWSER_MOUSE_MOD_1
1st modifier key pressed (eg.
@ BROWSER_MOUSE_DRAG_1
start of button 1 drag
@ BROWSER_MOUSE_HOLDING_2
during button 2 drag
@ BROWSER_MOUSE_HOLDING_1
during button 1 drag
@ BROWSER_MOUSE_DRAG_ON
a drag operation was started and a mouse button is still pressed
@ BROWSER_MOUSE_DRAG_2
start of button 2 drag
@ GUI_POINTER_NOT_ALLOWED
Target independent plotting interface.
Interface to platform-specific graphical user interface window operations.
gui_window_create_flags
Window creation control flags.
gui_window_event
Window events.
@ GW_EVENT_REMOVE_CARET
Remove the caret, if present.
@ GW_EVENT_NEW_CONTENT
Called when the gui_window has new content.
@ GW_EVENT_STOP_THROBBER
stop the navigation throbber.
@ GW_EVENT_UPDATE_EXTENT
Update the extent of the inside of a browser window to that of the current content.
@ GW_EVENT_START_SELECTION
selection started
@ GW_EVENT_START_THROBBER
start the navigation throbber.
Interface to key press operations.
bool browser_window_key_press(struct browser_window *bw, uint32_t key)
Handle key presses in a browser window.
#define NSLOG(catname, level, logmsg, args...)
NetSurf URL handling (interface).
struct nsurl nsurl
NetSurf URL object.
const struct plotter_table nsbeos_plotters
beos plotter operation table
rgb_color nsbeos_rgb_colour(colour c)
void nsbeos_current_gc_set(BView *view)
void nsbeos_plot_caret(int x, int y, int h)
Plot a caret.
void nsbeos_scaffolding_popup_menu(nsbeos_scaffolding *scaffold, struct browser_window *bw, BPoint where, BPoint screenWhere)
nsbeos_scaffolding * nsbeos_new_scaffolding(struct gui_window *toplevel)
void nsbeos_scaffolding_destroy(nsbeos_scaffolding *scaffold)
void nsbeos_scaffolding_dispatch_event(nsbeos_scaffolding *scaffold, BMessage *message)
void nsbeos_attach_toplevel_view(nsbeos_scaffolding *g, BView *view)
function table for clipboard operations.
Graphical user interface window function table.
first entry in window list
struct gui_window * prev
Previous in linked list.
NSBrowserFrameView * view
struct gui_window * next
list for cleanup
gui_pointer_shape current_pointer
caret shape for rendering
nsbeos_scaffolding * scaffold
int last_x
previous event location
int caretx
caret dimension and location for rendering
struct gui_window::@32 mouse
struct browser_window * bw
The 'content' window that is rendered in the gui_window.
size_t start
Start of run.
Unified URL information database public interface.
Option reading and saving interface.
uint32_t utf8_to_ucs4(const char *s_in, size_t l)
Convert a UTF-8 multibyte sequence into a single UCS4 character.
UTF-8 manipulation functions (interface).
Interface to a number of general purpose functionality.
static void gui_set_clipboard(const char *buffer, size_t length, nsclipboard_styles styles[], int n_styles)
void nsbeos_dispatch_event(BMessage *message)
Process beos messages into browser operations.
nsbeos_scaffolding * nsbeos_get_scaffold(struct gui_window *g)
Get containing scaffold of a beos gui window.
static nserror gui_window_event(struct gui_window *gw, enum gui_window_event event)
process miscellaneous window events
static void gui_window_destroy(struct gui_window *g)
static void gui_window_set_pointer(struct gui_window *g, gui_pointer_shape shape)
static void gui_window_remove_caret(struct gui_window *g)
static void nsbeos_window_resize_event(BView *view, gui_window *g, BMessage *event)
static void gui_window_update_extent(struct gui_window *g)
static BCursorID gui_haiku_pointer(gui_pointer_shape shape)
static void gui_get_clipboard(char **buffer, size_t *length)
static struct gui_window * gui_window_create(struct browser_window *bw, struct gui_window *existing, gui_window_create_flags flags)
struct gui_clipboard_table * beos_clipboard_table
static struct gui_window_table window_table
struct browser_window * nsbeos_get_browser_window(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.
static BList current_selection_textruns
struct gui_window_table * beos_window_table
static struct gui_clipboard_table clipboard_table
static void gui_window_place_caret(struct gui_window *g, int x, int y, int height, const struct rect *clip)
static void nsbeos_window_expose_event(BView *view, gui_window *g, BMessage *message)
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
static const rgb_color kWhiteColor
static nserror gui_window_set_scroll(struct gui_window *g, const struct rect *rect)
Set the scroll position of a beos browser window.
void nsbeos_window_destroy_browser(struct gui_window *g)
static void nsbeos_window_keypress_event(BView *view, gui_window *g, BMessage *event)
static struct gui_window * window_list
first entry in win list
static void gui_window_new_content(struct gui_window *g)
static void gui_start_selection(struct gui_window *g)
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.
void nsbeos_reflow_all_windows(void)
Cause all windows to be reflowed.
static void nsbeos_window_moved_event(BView *view, gui_window *g, BMessage *event)
struct browser_window * nsbeos_get_browser_for_gui(struct gui_window *g)
static BString current_selection
static void nsbeos_redraw_caret(struct gui_window *g)
static nserror text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.