NetSurf
|
RISC OS generic core window implementation. More...
#include <stdint.h>
#include <oslib/wimp.h>
#include "utils/log.h"
#include "netsurf/types.h"
#include "netsurf/mouse.h"
#include "netsurf/keypress.h"
#include "riscos/wimp_event.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
#include "riscos/window.h"
#include "riscos/toolbar.h"
#include "riscos/mouse.h"
#include "riscos/wimputils.h"
#include "riscos/corewindow.h"
Go to the source code of this file.
Macros | |
#define | wimp_KEY_END wimp_KEY_COPY |
Functions | |
static void | update_scrollbars (struct ro_corewindow *ro_cw, wimp_open *open) |
Update a windows scrollbars. More... | |
static void | ro_cw_redraw (wimp_draw *redraw) |
wimp callback on redraw event More... | |
static void | ro_cw_scroll (wimp_scroll *scroll) |
static void | ro_cw_mouse_at (wimp_pointer *pointer, void *data) |
Track the mouse under Null Polls from the wimp, to support dragging. More... | |
static void | ro_cw_drag_end (wimp_dragged *drag, void *data) |
Process RISC OS User Drag Box events which relate to us: in effect, drags started by ro_cw_drag_start(). More... | |
static void | ro_cw_drag_start (struct ro_corewindow *ro_cw, wimp_pointer *pointer, wimp_window_state *state) |
Start a RISC OS drag event to reflect on screen what is happening during the core tree drag. More... | |
static void | ro_cw_pointer_leaving (wimp_leaving *leaving, void *data) |
Handle Pointer Leaving Window events. More... | |
static void | ro_cw_pointer_entering (wimp_entering *entering) |
Wimp callback on pointer entering window. More... | |
static void | ro_cw_open (wimp_open *open) |
Wimp callback on window open event. More... | |
static bool | ro_cw_mouse_click (wimp_pointer *pointer) |
static bool | ro_cw_keypress (wimp_key *key) |
static void | cw_tb_size (void *ctx) |
Update a corewindow toolbar to a new size. More... | |
static void | cw_tb_theme (void *ctx, bool exists) |
Update a corewindow toolbar to use a new theme. More... | |
static void | cw_tb_update (void *ctx) |
Allow a corewindow toolbar button state to be updated. More... | |
static void | cw_tb_click (void *ctx, toolbar_action_type action_type, union toolbar_action action) |
Respond to user actions (click) in a corewindow. More... | |
static void | cw_tb_save (void *ctx, char *config) |
Save positions of core window toolbar buttons. More... | |
static nserror | ro_cw_invalidate (struct core_window *cw, const struct rect *r) |
callback from core to request an invalidation of a window area. More... | |
static nserror | ro_cw_update_size (struct core_window *cw, int width, int height) |
Callback from the core to update the content area size. More... | |
static nserror | ro_cw_get_scroll (const struct core_window *cw, int *x, int *y) |
Callback from the core to scroll the visible content. More... | |
static nserror | ro_cw_set_scroll (struct core_window *cw, int x, int y) |
Callback from the core to scroll the visible content. More... | |
static nserror | ro_cw_get_window_dimensions (const struct core_window *cw, int *width, int *height) |
Callback from the core to obtain the window viewport dimensions. More... | |
static nserror | ro_cw_drag_status (struct core_window *cw, core_window_drag_status ds) |
Callback from the core to update the drag status. More... | |
static nserror | dummy_toolbar_click (struct ro_corewindow *ro_cw, button_bar_action action) |
dummy toolbar click callback More... | |
static nserror | dummy_toolbar_update (struct ro_corewindow *ro_cw) |
dummy toolbar update callback More... | |
static nserror | dummy_toolbar_save (struct ro_corewindow *ro_cw, char *config) |
dummy toolbar save callback More... | |
nserror | ro_corewindow_init (struct ro_corewindow *ro_cw, const struct button_bar_buttons *tb_buttons, char *tb_order, theme_style tb_style, const char *tb_help) |
initialise elements of riscos core window. More... | |
nserror | ro_corewindow_fini (struct ro_corewindow *ro_cw) |
finalise elements of ro core window. More... | |
Variables | |
static struct ro_corewindow * | ro_cw_drag_cw |
static const struct toolbar_callbacks | corewindow_toolbar_callbacks |
riscos core window toolbar callbacks More... | |
struct core_window_table | ro_cw_cb_table |
struct core_window_table * | riscos_core_window_table = &ro_cw_cb_table |
RISC OS generic core window implementation.
Provides interface for core renderers to a risc os drawing area.
This module is an object that must be encapsulated. Client users should embed a struct ro_corewindow at the beginning of their context for this display surface, fill in relevant data and then call ro_corewindow_init()
The ro core window structure requires the callback for draw, key and mouse operations.
Definition in file corewindow.c.
#define wimp_KEY_END wimp_KEY_COPY |
Definition at line 52 of file corewindow.c.
|
static |
Respond to user actions (click) in a corewindow.
ctx | Context as passed to toolbar creation. |
action_type | type of action on toolbar |
action | data for action. |
Definition at line 727 of file corewindow.c.
References toolbar_action::button, TOOLBAR_ACTION_BUTTON, ro_corewindow::toolbar_click, and ro_corewindow::toolbar_update.
|
static |
Save positions of core window toolbar buttons.
ctx | Context as passed to toolbar creation. |
config | The new button config string. |
Definition at line 748 of file corewindow.c.
References ro_corewindow::toolbar_save.
|
static |
Update a corewindow toolbar to a new size.
ctx | Context as passed to toolbar creation. |
Definition at line 661 of file corewindow.c.
References NSLOG, ro_corewindow::origin_y, ro_toolbar_height(), ro_corewindow::toolbar, and ro_corewindow::wh.
Referenced by cw_tb_theme().
|
static |
Update a corewindow toolbar to use a new theme.
ctx | Context as passed to toolbar creation. |
exists | true if the bar still exists; else false. |
Definition at line 696 of file corewindow.c.
References cw_tb_size().
|
static |
Allow a corewindow toolbar button state to be updated.
ctx | Context as passed to toolbar creation. |
Definition at line 709 of file corewindow.c.
References ro_corewindow::toolbar_update.
|
static |
dummy toolbar click callback
Definition at line 980 of file corewindow.c.
References NSERROR_OK.
Referenced by ro_corewindow_init().
|
static |
dummy toolbar save callback
Definition at line 996 of file corewindow.c.
References NSERROR_OK.
Referenced by ro_corewindow_init().
|
static |
dummy toolbar update callback
Definition at line 988 of file corewindow.c.
References NSERROR_OK.
Referenced by ro_corewindow_init().
nserror ro_corewindow_fini | ( | struct ro_corewindow * | ro_cw | ) |
finalise elements of ro core window.
ro_cw | A riscos core window structure to initialise |
Definition at line 1078 of file corewindow.c.
References NSERROR_OK, ro_gui_wimp_event_finalise(), and ro_corewindow::wh.
Referenced by ro_gui_cookies_finalise(), ro_gui_global_history_finalise(), ro_gui_hotlist_finalise(), ro_gui_local_history_finalise(), and ro_gui_pageinfo_finalise().
nserror ro_corewindow_init | ( | struct ro_corewindow * | ro_cw, |
const struct button_bar_buttons * | tb_buttons, | ||
char * | tb_order, | ||
theme_style | tb_style, | ||
const char * | tb_help | ||
) |
initialise elements of riscos core window.
As a pre-requisite the draw, key and mouse callbacks must be defined
ro_cw | A riscos core window structure to initialise |
tb_buttons | toolbar button bar context |
tb_order | The order of toolbar buttons |
tb_style | The style of toolbar buttons |
tb_help | Thh toolbar help text |
Definition at line 1003 of file corewindow.c.
References ro_corewindow::content_height, ro_corewindow::content_width, CORE_WINDOW_DRAG_NONE, corewindow_toolbar_callbacks, ro_corewindow::drag_status, dummy_toolbar_click(), dummy_toolbar_save(), dummy_toolbar_update(), NSERROR_INIT_FAILED, NSERROR_OK, NSLOG, ro_corewindow::origin_y, ro_cw_keypress(), ro_cw_mouse_click(), ro_cw_open(), ro_cw_pointer_entering(), ro_cw_redraw(), ro_cw_scroll(), ro_gui_wimp_event_register_keypress(), ro_gui_wimp_event_register_mouse_click(), ro_gui_wimp_event_register_open_window(), ro_gui_wimp_event_register_pointer_entering_window(), ro_gui_wimp_event_register_redraw_window(), ro_gui_wimp_event_register_scroll_window(), ro_gui_wimp_event_set_user_data(), ro_toolbar_add_buttons(), ro_toolbar_create(), ro_toolbar_height(), ro_toolbar_rebuild(), tb_buttons, ro_corewindow::toolbar, ro_corewindow::toolbar_click, TOOLBAR_FLAGS_NONE, ro_corewindow::toolbar_save, ro_corewindow::toolbar_update, and ro_corewindow::wh.
Referenced by ro_cookie_init(), ro_global_history_init(), ro_hotlist_init(), ro_local_history_init(), and ro_pageinfo_init().
|
static |
Process RISC OS User Drag Box events which relate to us: in effect, drags started by ro_cw_drag_start().
drag | Pointer to the User Drag Box Event block. |
data | NULL to allow use as a ro_mouse callback. |
Definition at line 309 of file corewindow.c.
References NSLOG, and ro_warn_user().
Referenced by ro_cw_drag_start().
|
static |
Start a RISC OS drag event to reflect on screen what is happening during the core tree drag.
ro_cw | The RO corewindow to which the drag is attached. |
pointer | The RO pointer event data block starting the drag. |
state | The RO window state block for the treeview window. |
Definition at line 338 of file corewindow.c.
References CORE_WINDOW_DRAG_MOVE, CORE_WINDOW_DRAG_SELECTION, ro_corewindow::drag_status, NSLOG, ro_cw_drag_cw, ro_cw_drag_end(), ro_cw_mouse_at(), ro_mouse_drag_start(), ro_toolbar_height(), ro_warn_user(), ro_corewindow::toolbar, and ro_corewindow::wh.
Referenced by ro_cw_mouse_click().
|
static |
Callback from the core to update the drag status.
Definition at line 956 of file corewindow.c.
References ro_corewindow::drag_status, and NSERROR_OK.
|
static |
Callback from the core to scroll the visible content.
Definition at line 862 of file corewindow.c.
References NSERROR_INVALID, NSERROR_OK, NSLOG, and ro_corewindow::wh.
|
static |
Callback from the core to obtain the window viewport dimensions.
[in] | cw | the core window object |
[out] | width | to be set to viewport width in px |
[out] | height | to be set to viewport height in px |
Definition at line 922 of file corewindow.c.
References height, NSERROR_INVALID, NSERROR_OK, NSLOG, ro_toolbar_full_height(), ro_corewindow::toolbar, ro_corewindow::wh, and width.
callback from core to request an invalidation of a window area.
The specified area of the window should now be considered out of date. If the area is NULL the entire window must be invalidated.
[in] | cw | The core window to invalidate. |
[in] | r | area to redraw or NULL for the entire window area. |
Definition at line 783 of file corewindow.c.
References NSERROR_INVALID, NSERROR_OK, NSLOG, ro_corewindow::origin_y, ro_corewindow::wh, rect::x0, rect::x1, rect::y0, and rect::y1.
|
static |
Definition at line 544 of file corewindow.c.
References IS_WIMP_KEY, ro_corewindow::key, NS_KEY_DELETE_LEFT, NS_KEY_DELETE_LINE_END, NS_KEY_DELETE_LINE_START, 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_TEXT_END, NS_KEY_TEXT_START, NS_KEY_UP, NS_KEY_WORD_LEFT, NS_KEY_WORD_RIGHT, NSERROR_OK, NSLOG, os_version, RISCOS5, ro_gui_ctrl_pressed(), ro_gui_wimp_event_get_user_data(), ro_corewindow::toolbar_update, and wimp_KEY_END.
Referenced by ro_corewindow_init().
|
static |
Track the mouse under Null Polls from the wimp, to support dragging.
pointer | Pointer to a Wimp Pointer block. |
data | NULL to allow use as a ro_mouse callback. |
Definition at line 241 of file corewindow.c.
References BROWSER_MOUSE_DRAG_ON, BROWSER_MOUSE_HOVER, CORE_WINDOW_DRAG_NONE, ro_corewindow::drag_status, ro_corewindow::mouse, NSLOG, ro_corewindow::origin_y, ro_cw_drag_cw, ro_gui_mouse_drag_state(), ro_gui_wimp_event_get_user_data(), and ro_corewindow::toolbar_update.
Referenced by ro_cw_drag_start(), and ro_cw_pointer_entering().
|
static |
Definition at line 463 of file corewindow.c.
References BROWSER_MOUSE_CLICK_1, CORE_WINDOW_DRAG_MOVE, CORE_WINDOW_DRAG_SELECTION, ro_corewindow::drag_status, ro_corewindow::mouse, NSLOG, ro_corewindow::origin_y, ro_cw_drag_start(), ro_gui_dialog_close(), ro_gui_mouse_click_state(), ro_gui_wimp_event_get_user_data(), ro_gui_wimp_event_process_window_menu_click(), ro_corewindow::toolbar_update, and ro_corewindow::wh.
Referenced by ro_corewindow_init().
|
static |
Wimp callback on window open event.
The wimp has issued an event to the window because an attempt has been made to open or resize it. This requires the new dimensions to be calculated and set within the wimp.
open | The open event to be processed |
Definition at line 454 of file corewindow.c.
References ro_gui_wimp_event_get_user_data(), and update_scrollbars().
Referenced by ro_corewindow_init().
|
static |
Wimp callback on pointer entering window.
The wimp has issued an event to the window because the pointer has entered it.
entering | The entering event to be processed |
Definition at line 439 of file corewindow.c.
References ro_cw_mouse_at(), ro_cw_pointer_leaving(), and ro_mouse_track_start().
Referenced by ro_corewindow_init().
|
static |
Handle Pointer Leaving Window events.
These events are delivered as the termination callback handler from ro_mouse's mouse tracking.
leaving | The Wimp_PointerLeavingWindow block. |
data | NULL data pointer. |
Definition at line 416 of file corewindow.c.
References BROWSER_MOUSE_LEAVE, ro_corewindow::mouse, NSLOG, and ro_gui_wimp_event_get_user_data().
Referenced by ro_cw_pointer_entering().
|
static |
wimp callback on redraw event
Definition at line 108 of file corewindow.c.
References ro_corewindow::draw, NSLOG, ro_corewindow::origin_y, ro_gui_wimp_event_get_user_data(), ro_plot_clip_rect, rect::x0, rect::x1, rect::y0, and rect::y1.
Referenced by ro_corewindow_init().
|
static |
Definition at line 147 of file corewindow.c.
References NSLOG, ro_corewindow::origin_y, ro_gui_wimp_event_get_user_data(), and ro_corewindow::wh.
Referenced by ro_corewindow_init().
|
static |
Callback from the core to scroll the visible content.
Definition at line 887 of file corewindow.c.
References NSERROR_INVALID, NSERROR_OK, NSLOG, PTR_WIMP_OPEN, update_scrollbars(), and ro_corewindow::wh.
|
static |
Callback from the core to update the content area size.
Definition at line 823 of file corewindow.c.
References ro_corewindow::content_height, ro_corewindow::content_width, height, NSERROR_INVALID, NSERROR_OK, NSLOG, update_scrollbars(), ro_corewindow::wh, and width.
|
static |
Update a windows scrollbars.
in the wimp this is done by setting the extent and calling window open
Definition at line 62 of file corewindow.c.
References ro_corewindow::content_height, ro_corewindow::content_width, NSLOG, ro_corewindow::origin_y, and ro_corewindow::wh.
Referenced by ro_cw_open(), ro_cw_set_scroll(), and ro_cw_update_size().
|
static |
riscos core window toolbar callbacks
Definition at line 762 of file corewindow.c.
Referenced by ro_corewindow_init().
struct core_window_table* riscos_core_window_table = &ro_cw_cb_table |
Definition at line 974 of file corewindow.c.
Referenced by main().
struct core_window_table ro_cw_cb_table |
Definition at line 965 of file corewindow.c.
|
static |
Definition at line 55 of file corewindow.c.
Referenced by ro_cw_drag_start(), and ro_cw_mouse_at().