rationalise the RISC OS browser window implementation

This commit is contained in:
Vincent Sanders 2017-06-11 11:46:18 +01:00
parent ee749f2b11
commit 449e760d71
8 changed files with 3351 additions and 3263 deletions

View File

@ -42,6 +42,7 @@
#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/corewindow.h"

View File

@ -47,6 +47,7 @@
#include "riscos/local_history.h"
#include "riscos/global_history.h"
#include "riscos/gui.h"
#include "riscos/window.h"
#include "riscos/hotlist.h"
#include "riscos/menus.h"
#include "riscos/save.h"

View File

@ -139,35 +139,6 @@ void ro_gui_401login_init(void);
void gui_401login_open(struct nsurl *url, const char *realm,
nserror (*cb)(bool proceed, void *pw), void *cbpw);
/* in window.c */
void ro_gui_window_set_scale(struct gui_window *g, float scale);
bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message);
void ro_gui_window_mouse_at(wimp_pointer *pointer, void *data);
void ro_gui_window_iconise(struct gui_window *g,
wimp_full_message_window_info *wi);
bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message);
void ro_gui_window_redraw_all(void);
void ro_gui_window_update_boxes(void);
void ro_gui_window_quit(void);
/* void ro_gui_window_close_all(void); */
#define ro_gui_window_close_all ro_gui_window_quit /* no need for a separate fn */
void ro_gui_throb(void);
void ro_gui_window_default_options(struct gui_window *gui);
struct gui_window *ro_gui_window_lookup(wimp_w window);
struct gui_window *ro_gui_toolbar_lookup(wimp_w window);
bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y,
os_coord *pos);
bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y,
os_coord *pos);
enum browser_mouse_state ro_gui_mouse_click_state(wimp_mouse_state buttons,
wimp_icon_flags type);
enum browser_mouse_state ro_gui_mouse_drag_state(wimp_mouse_state buttons,
wimp_icon_flags type);
bool ro_gui_shift_pressed(void);
bool ro_gui_ctrl_pressed(void);
bool ro_gui_alt_pressed(void);
void gui_window_set_pointer(struct gui_window *g, enum gui_pointer_shape shape);
/* in schedule.c */
extern bool sched_active;
extern os_t sched_time;

View File

@ -56,6 +56,7 @@
#include "riscos/bitmap.h"
#include "riscos/dialog.h"
#include "riscos/gui.h"
#include "riscos/window.h"
#include "riscos/menus.h"
#include "riscos/message.h"
#include "riscos/mouse.h"

View File

@ -36,6 +36,7 @@
#include "netsurf/browser_window.h"
#include "riscos/gui.h"
#include "riscos/window.h"
#include "riscos/menus.h"
#include "riscos/message.h"
#include "riscos/mouse.h"

View File

@ -36,6 +36,7 @@
#include "riscos/global_history.h"
#include "riscos/gui.h"
#include "riscos/window.h"
#include "riscos/mouse.h"
#include "riscos/toolbar.h"
#include "riscos/url_complete.h"

File diff suppressed because it is too large Load Diff

View File

@ -30,10 +30,21 @@ struct nsurl;
extern struct gui_window_table *riscos_window_table;
/**
* Initialise the browser window module and its menus.
*/
void ro_gui_window_initialise(void);
/**
* Check if a particular menu handle is a browser window menu
*
* \param menu The menu in question.
* \return true if this menu is a browser window menu
*/
bool ro_gui_window_check_menu(wimp_menu *menu);
/**
* Set the contents of a window's address bar.
*
@ -42,6 +53,7 @@ bool ro_gui_window_check_menu(wimp_menu *menu);
*/
nserror ro_gui_window_set_url(struct gui_window *g, struct nsurl *url);
/**
* Cause an area of a window to be invalidated
*
@ -56,5 +68,186 @@ nserror ro_gui_window_set_url(struct gui_window *g, struct nsurl *url);
*/
nserror ro_gui_window_invalidate_area(struct gui_window *g, const struct rect *rect);
/**
* Set a gui_window's scale
*/
void ro_gui_window_set_scale(struct gui_window *g, float scale);
/**
* Handle Message_DataLoad (file dragged in) for a window.
*
* If the file was dragged into a form file input, it is used as the value.
*
* \param g window
* \param message Message_DataLoad block
* \return true if the load was processed
*/
bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message);
/**
* Handle pointer movements in a browser window.
*
* \param pointer new mouse position
* \param data browser window that the pointer is in
*/
void ro_gui_window_mouse_at(wimp_pointer *pointer, void *data);
/**
* Window is being iconised.
*
* Create a suitable thumbnail sprite (which, sadly, must be in the
* Wimp sprite pool), and return the sprite name and truncated title
* to the iconiser
*
* \param g the gui window being iconised
* \param wi the WindowInfo message from the iconiser
*/
void ro_gui_window_iconise(struct gui_window *g, wimp_full_message_window_info *wi);
/**
* Handle Message_DataLoad (file dragged in) for a toolbar
*
* @todo This belongs in the toolbar module, and should be moved there
* once the module is able to usefully handle its own events.
*
* \param g window
* \param message Message_DataLoad block
* \return true if the load was processed
*/
bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message);
/**
* Redraws the content for all windows.
*/
void ro_gui_window_redraw_all(void);
/**
* Redraw any pending update boxes.
*/
void ro_gui_window_update_boxes(void);
/**
* Destroy all browser windows.
*/
void ro_gui_window_quit(void);
/**
* Close all browser windows
*
* no need for a separate fn same operation as quit
*/
#define ro_gui_window_close_all ro_gui_window_quit
/**
* Animate the "throbbers" of all browser windows.
*/
void ro_gui_throb(void);
/**
* Makes a browser window's options the default.
*
* \param gui The riscos gui window to set default options in.
*/
void ro_gui_window_default_options(struct gui_window *gui);
/**
* Convert a RISC OS window handle to a gui_window.
*
* \param window RISC OS window handle.
* \return A pointer to a riscos gui window if found or NULL.
*/
struct gui_window *ro_gui_window_lookup(wimp_w window);
/**
* Convert a toolbar RISC OS window handle to a gui_window.
*
* \param window RISC OS window handle of a toolbar
* \return pointer to a structure if found, NULL otherwise
*/
struct gui_window *ro_gui_toolbar_lookup(wimp_w window);
/**
* Convert x,y screen co-ordinates into window co-ordinates.
*
* \param g gui window
* \param x x ordinate
* \param y y ordinate
* \param pos receives position in window co-ordinatates
* \return true iff conversion successful
*/
bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y, os_coord *pos);
/**
* Convert x,y window co-ordinates into screen co-ordinates.
*
* \param g gui window
* \param x x ordinate
* \param y y ordinate
* \param pos receives position in screen co-ordinatates
* \return true iff conversion successful
*/
bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y, os_coord *pos);
/**
* Returns the state of the mouse buttons and modifiers keys for a
* mouse action, suitable for passing to the OS-independent
* browser window/ treeview/ etc code.
*
* \param buttons Wimp button state.
* \param type Wimp work-area/icon type for decoding.
* \return NetSurf core button state.
*/
enum browser_mouse_state ro_gui_mouse_click_state(wimp_mouse_state buttons, wimp_icon_flags type);
/**
* Returns the state of the mouse buttons and modifiers keys whilst
* dragging, for passing to the OS-independent browser window/ treeview/
* etc code
*
* \param buttons Wimp button state.
* \param type Wimp work-area/icon type for decoding.
* \return NetSurf core button state.
*/
enum browser_mouse_state ro_gui_mouse_drag_state(wimp_mouse_state buttons, wimp_icon_flags type);
/**
* Returns true iff one or more Shift keys is held down
*/
bool ro_gui_shift_pressed(void);
/**
* Returns true iff one or more Ctrl keys is held down
*/
bool ro_gui_ctrl_pressed(void);
/**
* Returns true iff one or more Alt keys is held down
*/
bool ro_gui_alt_pressed(void);
/**
* Change mouse pointer shape
*/
void gui_window_set_pointer(struct gui_window *g, enum gui_pointer_shape shape);
#endif