2011-01-06 00:02:22 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2010 Ole Loots <ole@monochrom.net>
|
|
|
|
*
|
|
|
|
* This file is part of NetSurf, http://www.netsurf-browser.org/
|
|
|
|
*
|
|
|
|
* NetSurf is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; version 2 of the License.
|
|
|
|
*
|
|
|
|
* NetSurf is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef NS_ATARI_BROWSER_H
|
2011-11-29 03:23:28 +04:00
|
|
|
#define NS_ATARI_BROWSER_H
|
|
|
|
|
|
|
|
#include "atari/redrawslots.h"
|
2011-01-06 00:02:22 +03:00
|
|
|
|
2011-07-01 00:20:27 +04:00
|
|
|
/*
|
2011-01-06 00:02:22 +03:00
|
|
|
Each browser_window in the Atari Port is represented by an struct s_browser,
|
2011-11-05 05:47:23 +04:00
|
|
|
which consist mainly of an WinDom COMPONENT.
|
2011-07-01 00:20:27 +04:00
|
|
|
*/
|
2011-01-06 00:02:22 +03:00
|
|
|
|
2011-07-01 00:20:27 +04:00
|
|
|
/*
|
2011-05-10 02:10:02 +04:00
|
|
|
BROWSER_SCROLL_SVAL
|
2011-07-01 00:20:27 +04:00
|
|
|
The small scroll inc. value (used by scroll-wheel, arrow click):
|
2011-05-10 02:10:02 +04:00
|
|
|
*/
|
2011-07-01 00:20:27 +04:00
|
|
|
#define BROWSER_SCROLL_SVAL 64
|
2011-05-10 02:10:02 +04:00
|
|
|
|
2011-01-06 00:02:22 +03:00
|
|
|
|
|
|
|
enum browser_rect
|
|
|
|
{
|
2012-11-27 05:12:09 +04:00
|
|
|
BR_CONTENT = 1,
|
|
|
|
BR_URL_INPUT,
|
|
|
|
BR_THROBBER
|
2011-01-06 00:02:22 +03:00
|
|
|
};
|
|
|
|
|
2011-05-10 02:10:02 +04:00
|
|
|
|
2011-07-01 00:20:27 +04:00
|
|
|
/*
|
|
|
|
This struct contains info of current browser viewport scroll
|
|
|
|
and the scroll which is requested. If a scroll is requested,
|
|
|
|
the field required is set to true.
|
2011-05-10 02:10:02 +04:00
|
|
|
*/
|
|
|
|
struct s_scroll_info
|
|
|
|
{
|
|
|
|
POINT requested;
|
|
|
|
POINT current;
|
|
|
|
bool required;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
This struct holds information of the cursor within the browser
|
2011-11-05 05:47:23 +04:00
|
|
|
viewport.
|
2011-05-10 02:10:02 +04:00
|
|
|
*/
|
|
|
|
struct s_caret
|
|
|
|
{
|
2012-11-27 05:12:09 +04:00
|
|
|
GRECT requested;
|
|
|
|
GRECT current;
|
2011-11-29 03:23:28 +04:00
|
|
|
bool redraw;
|
|
|
|
MFDB background;
|
2011-05-10 02:10:02 +04:00
|
|
|
};
|
|
|
|
|
2011-07-01 00:20:27 +04:00
|
|
|
/*
|
2011-11-05 05:47:23 +04:00
|
|
|
This is the browser content area (viewport).
|
|
|
|
It is redrawable and scrollable. It is based on the WinDOM
|
|
|
|
Component window (undocumented feature).
|
|
|
|
|
|
|
|
It's an windom component containing it's own Window controls,
|
|
|
|
like scrollbars, resizer, etc.
|
|
|
|
|
|
|
|
Now that the NetSurf core handles frames, the advantages of this
|
|
|
|
choice have probably vanished.
|
2011-05-10 02:10:02 +04:00
|
|
|
*/
|
|
|
|
struct s_browser
|
|
|
|
{
|
|
|
|
int type;
|
|
|
|
COMPONENT * comp;
|
|
|
|
struct browser_window * bw;
|
|
|
|
struct s_scroll_info scroll;
|
2011-11-29 03:23:28 +04:00
|
|
|
struct s_redrw_slots redraw;
|
2011-05-10 02:10:02 +04:00
|
|
|
struct s_caret caret;
|
2011-11-29 03:23:28 +04:00
|
|
|
bool attached;
|
|
|
|
bool reformat_pending;
|
2011-05-10 02:10:02 +04:00
|
|
|
};
|
|
|
|
|
2012-11-27 05:12:09 +04:00
|
|
|
struct s_browser * browser_create( struct gui_window * gw,
|
|
|
|
struct browser_window * clone,
|
|
|
|
struct browser_window *bw, int lt, int w,
|
|
|
|
int flex );
|
2011-01-06 00:02:22 +03:00
|
|
|
bool browser_destroy( struct s_browser * b );
|
2012-11-27 05:12:09 +04:00
|
|
|
void browser_get_rect( struct gui_window * gw, enum browser_rect type,
|
|
|
|
GRECT * out);
|
2011-01-06 00:02:22 +03:00
|
|
|
bool browser_input( struct gui_window * gw, unsigned short nkc ) ;
|
|
|
|
void browser_redraw( struct gui_window * gw );
|
|
|
|
void browser_set_content_size(struct gui_window * gw, int w, int h);
|
|
|
|
void browser_scroll( struct gui_window * gw, short MODE, int value, bool abs );
|
|
|
|
struct gui_window * browser_find_root( struct gui_window * gw );
|
|
|
|
bool browser_redraw_required( struct gui_window * gw);
|
2012-11-27 05:12:09 +04:00
|
|
|
void browser_redraw_caret( struct gui_window * gw, GRECT * area);
|
|
|
|
void browser_restore_caret_background(struct gui_window * gw, GRECT * area);
|
2011-11-29 03:23:28 +04:00
|
|
|
/* update loc / size of the browser widgets: */
|
|
|
|
void browser_update_rects(struct gui_window * gw );
|
2011-05-10 02:10:02 +04:00
|
|
|
/*
|
|
|
|
This queues an redraw to one of the slots.
|
2011-07-01 00:20:27 +04:00
|
|
|
The following strategy is used:
|
2011-05-10 02:10:02 +04:00
|
|
|
1. It checks if the rectangle to be scheduled is within one of the
|
2011-07-01 00:20:27 +04:00
|
|
|
already queued bboxes. If yes, it will return.
|
|
|
|
2. It checks for an intersection, and it will merge the rectangle to
|
2011-05-10 02:10:02 +04:00
|
|
|
already queued rectangle where it fits best.
|
2011-07-01 00:20:27 +04:00
|
|
|
3. it tries to put the rectangle into one available slot.
|
|
|
|
4. if no slot is available, it will simply merge the new rectangle with
|
|
|
|
the last available slot.
|
2011-05-10 02:10:02 +04:00
|
|
|
*/
|
2011-02-12 22:41:50 +03:00
|
|
|
void browser_schedule_redraw_rect(struct gui_window * gw, short x, short y, short w, short h);
|
2011-01-06 00:02:22 +03:00
|
|
|
void browser_schedule_redraw(struct gui_window * gw, short x, short y, short w, short h );
|
|
|
|
|
|
|
|
#endif
|