21#define __STDBOOL_H__ 1
28#include <InterfaceDefs.h>
120 : BView(frame,
"NSBrowserFrameView", B_FOLLOW_ALL_SIDES,
121 B_WILL_DRAW | B_NAVIGABLE | B_FRAME_EVENTS ),
135 switch (message->what) {
137 case B_ARGV_RECEIVED:
138 case B_REFS_RECEIVED:
146 case B_NETPOSITIVE_OPEN_URL:
147 case B_NETPOSITIVE_BACK:
148 case B_NETPOSITIVE_FORWARD:
149 case B_NETPOSITIVE_HOME:
150 case B_NETPOSITIVE_RELOAD:
151 case B_NETPOSITIVE_STOP:
152 case B_NETPOSITIVE_DOWN:
153 case B_NETPOSITIVE_UP:
237 Window()->DetachCurrentMessage();
242 BView::MessageReceived(message);
250 BMessage *message = NULL;
254 message =
new BMessage(_UPDATE_);
255 message->AddRect(
"rect", updateRect);
264 BMessage *message = Window()->DetachCurrentMessage();
269 BView::FrameResized(new_width, new_height);
276 BMessage *message = Window()->DetachCurrentMessage();
284 BMessage *message = Window()->DetachCurrentMessage();
286 if (message->FindPoint(
"screen_where", &screenWhere) < B_OK) {
287 screenWhere = ConvertToScreen(where);
288 message->AddPoint(
"screen_where", screenWhere);
299 BMessage *message = Window()->DetachCurrentMessage();
301 if (message->FindPoint(
"screen_where", &screenWhere) < B_OK) {
302 screenWhere = ConvertToScreen(where);
303 message->AddPoint(
"screen_where", screenWhere);
312 if (transit != B_INSIDE_VIEW) {
313 BView::MouseMoved(where, transit, msg);
316 BMessage *message = Window()->DetachCurrentMessage();
351 NSLOG(netsurf, INFO,
"Creating gui window %p for browser window %p",
374 BRect frame(0,0,-1,-1);
382 g->
view->SetViewColor(B_TRANSPARENT_COLOR);
385#ifdef B_BEOS_VERSION_DANO
415 if (message->FindPointer(
"View", (
void **)&
view) < B_OK)
417 if (message->FindPointer(
"gui_window", (
void **)&gui) < B_OK)
419 if (message->FindPointer(
"Window", (
void **)&
window) < B_OK)
421 if (message->FindPointer(
"scaffolding", (
void **)&scaffold) < B_OK)
434 "discarding event for destroyed gui_window");
440 "discarding event for destroyed scaffolding");
447 NSLOG(netsurf, INFO,
"dispatching to top-level");
453 NSLOG(netsurf, DEEPDEBUG,
"processing message");
454 switch (message->what) {
455 case B_QUIT_REQUESTED:
459 case B_ABOUT_REQUESTED:
479 if (message->FindPoint(
"be:view_where", &where) < B_OK) {
480 if (message->FindPoint(
"where", &where) < B_OK)
483 if (message->FindInt32(
"modifiers", &mods) < B_OK)
505 bool shift = mods & B_SHIFT_KEY;
506 bool ctrl = mods & B_CONTROL_KEY;
532 if (message->FindPoint(
"be:view_where", &where) < B_OK) {
533 if (message->FindPoint(
"where", &where) < B_OK)
536 if (message->FindInt32(
"buttons", &buttons) < B_OK)
538 if (message->FindPoint(
"screen_where", &screenWhere) < B_OK)
540 if (message->FindInt32(
"modifiers", &mods) < B_OK)
543 if (buttons & B_SECONDARY_MOUSE_BUTTON) {
551 if (buttons & B_TERTIARY_MOUSE_BUTTON)
554 if (mods & B_SHIFT_KEY)
556 if (mods & B_CONTROL_KEY)
564 if (!
view->IsFocus())
566 view->UnlockLooper();
584 if (message->FindPoint(
"be:view_where", &where) < B_OK) {
585 if (message->FindPoint(
"where", &where) < B_OK)
588 if (message->FindInt32(
"buttons", &buttons) < B_OK)
590 if (message->FindPoint(
"screen_where", &screenWhere) < B_OK)
592 if (message->FindInt32(
"modifiers", &mods) < B_OK)
602 bool shift = mods & B_SHIFT_KEY;
603 bool ctrl = mods & B_CONTROL_KEY;
643 case B_MOUSE_WHEEL_CHANGED:
655 nserror (*cb)(
const char *username,
656 const char *password,
659 if (message->FindPointer(
"URL", (
void**)&
url) < B_OK)
661 if (message->FindString(
"Realm", &realm) < B_OK)
663 if (message->FindString(
"User", &username) < B_OK)
665 if (message->FindString(
"Pass", &password) < B_OK)
667 if (message->FindPointer(
"callback", (
void**)&cb) < B_OK)
669 if (message->FindPointer(
"callback_pw", (
void**)&cbpw) < B_OK)
671 cb(username.String(), password.String(), cbpw);
700 if (message->FindRect(
"rect", &updateRect) < B_OK)
706 if (!
view->LockLooper())
711 view->Window()->BeginViewTransaction();
713 clip.x0 = (int)updateRect.left;
714 clip.y0 = (
int)updateRect.top;
715 clip.x1 = (int)updateRect.right + 1;
716 clip.y1 = (
int)updateRect.bottom + 1;
724 view->Window()->EndViewTransaction();
727 view->ConstrainClippingRegion(NULL);
729 view->UnlockLooper();
743 if (event->FindInt32(
"modifiers", (
int32 *)&mods) < B_OK)
745 if (event->FindInt32(
"key", (
int32 *)&key) < B_OK)
747 if (event->FindInt32(
"raw_char", (
int32 *)&raw_char) < B_OK)
750 for (i = 0; i < 5; i++) {
752 if (event->FindInt8(
"byte", i, (
int8 *)&buff[i]) < B_OK)
759 }
else if (event->FindString(
"bytes", &bytes) < B_OK)
763 numbytes = strlen(bytes);
766 "mods 0x%08" PRIx32
" key %" PRIu32
" raw %" PRIu32
" byte[0] %d",
767 mods, key, raw_char, buff[0]);
772 if (mods & B_CONTROL_KEY)
773 byte = (char)raw_char;
774 if (
byte >=
'!' &&
byte <=
'~')
775 nskey = (uint32_t)
byte;
781 case B_ENTER: nskey = (uint32_t)10;
break;
782 case B_ESCAPE: nskey = (uint32_t)
'\033';
break;
783 case B_SPACE: nskey = (uint32_t)
' ';
break;
794 case B_UP_ARROW: nskey =
NS_KEY_UP;
break;
820 nskey = (uint32_t)raw_char;
834 float hdelta = 0.0f, vdelta = 0.0f;
835 g->
view->LockLooper();
836 BRect size = g->
view->Bounds();
839 g->
view->ScrollTo(0.0f, 0.0f);
847 vdelta = -size.Height();
850 vdelta = size.Height();
866 g->
view->ScrollBy(hdelta, vdelta);
867 g->
view->UnlockLooper();
881 if (event->FindInt32(
"width", &
width) < B_OK)
883 if (event->FindInt32(
"height", &
height) < B_OK)
898#warning XXX: Invalidate ?
902 view->UnlockLooper();
935 NSLOG(netsurf, INFO,
"Destroying gui_window %p", g);
937 assert(g->
bw != NULL);
942 if (!g->
view->LockLooper())
945 BLooper *looper = g->
view->Looper();
948 g->
view->RemoveSelf();
952 g->
view->RemoveSelf();
971 if (!g->
view->LockLooper())
980 g->
view->UnlockLooper();
997 if (g->
view == NULL) {
1001 if (!g->
view->LockLooper()) {
1010 g->
view->Invalidate();
1013 g->
view->UnlockLooper();
1021 if (g->
view == NULL)
1023 if (!g->
view->LockLooper())
1026#warning XXX: report to view frame ?
1027 if (g->
view->ScrollBar(B_HORIZONTAL))
1028 *sx = (int)g->
view->ScrollBar(B_HORIZONTAL)->Value();
1029 if (g->
view->ScrollBar(B_VERTICAL))
1030 *sy = (
int)g->
view->ScrollBar(B_VERTICAL)->Value();
1032 g->
view->UnlockLooper();
1051 if (g->
view == NULL) {
1054 if (!g->
view->LockLooper()) {
1058#warning XXX: report to view frame ?
1059 if (g->
view->ScrollBar(B_HORIZONTAL)) {
1060 g->
view->ScrollBar(B_HORIZONTAL)->SetValue(
rect->
x0);
1062 if (g->
view->ScrollBar(B_VERTICAL)) {
1063 g->
view->ScrollBar(B_VERTICAL)->SetValue(
rect->
y0);
1066 g->
view->UnlockLooper();
1079 if (g->
view == NULL)
1081 if (!g->
view->LockLooper())
1090 float x_prop = g->
view->Bounds().Width() / x_max;
1091 float y_prop = g->
view->Bounds().Height() / y_max;
1092 x_max -= g->
view->Bounds().Width() + 1;
1093 y_max -= g->
view->Bounds().Height() + 1;
1095 NSLOG(netsurf, INFO,
1096 "x_max = %d y_max = %d x_prop = %f y_prop = %f\n", x_max,
1097 y_max, x_prop, y_prop);
1099 if (g->
view->ScrollBar(B_HORIZONTAL)) {
1100 g->
view->ScrollBar(B_HORIZONTAL)->SetRange(0, x_max);
1101 g->
view->ScrollBar(B_HORIZONTAL)->SetProportion(x_prop);
1102 g->
view->ScrollBar(B_HORIZONTAL)->SetSteps(10, 50);
1104 if (g->
view->ScrollBar(B_VERTICAL)) {
1105 g->
view->ScrollBar(B_VERTICAL)->SetRange(0, y_max);
1106 g->
view->ScrollBar(B_VERTICAL)->SetProportion(y_prop);
1107 g->
view->ScrollBar(B_VERTICAL)->SetSteps(10, 50);
1111 g->
view->UnlockLooper();
1118 return B_CURSOR_ID_FOLLOW_LINK;
1121 return B_CURSOR_ID_I_BEAM;
1124 return B_CURSOR_ID_CONTEXT_MENU;
1127 return B_CURSOR_ID_RESIZE_NORTH;
1130 return B_CURSOR_ID_RESIZE_SOUTH;
1133 return B_CURSOR_ID_RESIZE_WEST;
1136 return B_CURSOR_ID_RESIZE_EAST;
1139 return B_CURSOR_ID_RESIZE_NORTH_EAST;
1142 return B_CURSOR_ID_RESIZE_SOUTH_WEST;
1145 return B_CURSOR_ID_RESIZE_NORTH_WEST;
1148 return B_CURSOR_ID_RESIZE_SOUTH_EAST;
1151 return B_CURSOR_ID_CROSS_HAIR;
1154 return B_CURSOR_ID_MOVE;
1158 return B_CURSOR_ID_PROGRESS;
1162 return B_CURSOR_ID_NOT_ALLOWED;
1165 return B_CURSOR_ID_HELP;
1171 return B_CURSOR_ID_SYSTEM_DEFAULT;
1183 if (g->
view && g->
view->LockLooper()) {
1185 g->
view->UnlockLooper();
1193 if (g->
view == NULL)
1195 if (!g->
view->LockLooper())
1205 g->
view->MakeFocus();
1207 g->
view->UnlockLooper();
1219 if (g->
view == NULL)
1221 if (!g->
view->LockLooper())
1229 g->
view->UnlockLooper();
1237 if (g->
view == NULL)
1239 if (!g->
view->LockLooper())
1243 g->
view->ScrollTo(0,0);
1245 g->
view->UnlockLooper();
1250 if (!g->
view->LockLooper())
1253 g->
view->MakeFocus();
1255 g->
view->UnlockLooper();
1264 if (be_clipboard->Lock()) {
1265 clip = be_clipboard->Data();
1269 if (
clip->FindData(
"text/plain", B_MIME_TYPE,
1270 (
const void **)&
text, &textlen) >= B_OK) {
1271 *
buffer = (
char *)malloc(textlen);
1276 be_clipboard->Unlock();
1285 if (be_clipboard->Lock()) {
1286 be_clipboard->Clear();
1287 clip = be_clipboard->Data();
1289 clip->AddData(
"text/plain", B_MIME_TYPE,
buffer, length);
1291 int arraySize =
sizeof(text_run_array) +
1292 n_styles *
sizeof(text_run);
1293 text_run_array *array = (text_run_array *)malloc(arraySize);
1294 array->count = n_styles;
1295 for (
int i = 0; i < n_styles; i++) {
1298 array->runs[i].offset = styles[i].
start;
1299 array->runs[i].font = font;
1300 array->runs[i].color =
1303 clip->AddData(
"application/x-vnd.Be-text_run_array", B_MIME_TYPE,
1306 be_clipboard->Commit();
1308 be_clipboard->Unlock();
1332 g->
view->LockLooper()) {
1335 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: 1 is primary mouse button.
@ BROWSER_MOUSE_PRESS_1
primary button pressed
@ BROWSER_MOUSE_CLICK_2
button 2 clicked.
@ BROWSER_MOUSE_PRESS_2
auxillary button 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.
Netsurf additional integer type formatting macros.
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.