move window scroll getter and setter into operations table
This commit is contained in:
parent
5a962586fb
commit
7227c29bba
|
@ -200,6 +200,9 @@ static void ami_gui_window_update_box_deferred(struct gui_window *g, bool draw);
|
|||
static void ami_do_redraw(struct gui_window_2 *g);
|
||||
static void ami_schedule_redraw_remove(struct gui_window_2 *gwin);
|
||||
|
||||
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy);
|
||||
static void gui_window_set_scroll(struct gui_window *g, int sx, int sy);
|
||||
|
||||
/* accessors for default options - user option is updated if it is set as per default */
|
||||
#define nsoption_default_set_int(OPTION, VALUE) \
|
||||
if (nsoptions_default[NSOPTION_##OPTION].value.i == nsoptions[NSOPTION_##OPTION].value.i) \
|
||||
|
@ -4480,13 +4483,13 @@ void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys)
|
|||
*ys /= gwin->bw->scale;
|
||||
}
|
||||
|
||||
bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
||||
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
||||
{
|
||||
ami_get_hscroll_pos(g->shared, (ULONG *)sx);
|
||||
ami_get_vscroll_pos(g->shared, (ULONG *)sy);
|
||||
}
|
||||
|
||||
void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
|
||||
static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
|
||||
{
|
||||
struct IBox *bbox;
|
||||
ULONG cur_tab = 0;
|
||||
|
@ -5087,6 +5090,8 @@ static struct gui_window_table ami_window_table = {
|
|||
.destroy = gui_window_destroy,
|
||||
.redraw = gui_window_redraw_window,
|
||||
.update = gui_window_update_box,
|
||||
.get_scroll = gui_window_get_scroll,
|
||||
.set_scroll = gui_window_set_scroll,
|
||||
|
||||
.set_icon = gui_window_set_icon,
|
||||
.set_title = gui_window_set_title,
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
#define CNT_INTERACTIVE 512
|
||||
#define CNT_IMG 1024
|
||||
|
||||
bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy);
|
||||
|
||||
struct s_context_info {
|
||||
unsigned long flags;
|
||||
|
|
|
@ -113,6 +113,7 @@ EVMULT_IN aes_event_in = {
|
|||
EVMULT_OUT aes_event_out;
|
||||
short aes_msg_out[8];
|
||||
|
||||
bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy);
|
||||
|
||||
|
||||
static void gui_poll(bool active)
|
||||
|
@ -404,7 +405,7 @@ bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy)
|
|||
return( true );
|
||||
}
|
||||
|
||||
void gui_window_set_scroll(struct gui_window *w, int sx, int sy)
|
||||
static void gui_window_set_scroll(struct gui_window *w, int sx, int sy)
|
||||
{
|
||||
int units = 0;
|
||||
if ((w == NULL)
|
||||
|
@ -1072,6 +1073,8 @@ static struct gui_window_table atari_window_table = {
|
|||
.destroy = gui_window_destroy,
|
||||
.redraw = gui_window_redraw_window,
|
||||
.update = gui_window_update_box,
|
||||
.get_scroll = gui_window_get_scroll,
|
||||
.set_scroll = gui_window_set_scroll,
|
||||
|
||||
.set_title = gui_window_set_title,
|
||||
.set_url = gui_window_set_url,
|
||||
|
|
|
@ -85,6 +85,8 @@ static bool on_content_mouse_click(ROOTWIN *rootwin);
|
|||
static bool on_content_mouse_move(ROOTWIN *rootwin, GRECT *content_area);
|
||||
static void toolbar_redraw_cb(GUIWIN *win, uint16_t msg, GRECT *clip);
|
||||
|
||||
bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy);
|
||||
|
||||
static bool redraw_active = false;
|
||||
|
||||
static const struct redraw_context rootwin_rdrw_ctx = {
|
||||
|
|
|
@ -1051,7 +1051,7 @@ static void gui_window_update_box(struct gui_window *g, const struct rect *rect)
|
|||
g->view->UnlockLooper();
|
||||
}
|
||||
|
||||
bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
||||
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
||||
{
|
||||
//CALLED();
|
||||
if (g->view == NULL)
|
||||
|
@ -1069,7 +1069,7 @@ bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
|||
return true;
|
||||
}
|
||||
|
||||
void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
|
||||
static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
|
||||
{
|
||||
//CALLED();
|
||||
if (g->view == NULL)
|
||||
|
@ -1367,6 +1367,8 @@ static struct gui_window_table gui_window_table = {
|
|||
.destroy = gui_window_destroy,
|
||||
.redraw = gui_window_redraw_window,
|
||||
.update = gui_window_update_box,
|
||||
.get_scroll = gui_window_get_scroll,
|
||||
.set_scroll = gui_window_set_scroll,
|
||||
|
||||
.new_content = gui_window_new_content,
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ static void gui_window_update_box(struct gui_window *g, const struct rect *rect)
|
|||
[[(BrowserViewController *)g browserView] setNeedsDisplayInRect: nsrect];
|
||||
}
|
||||
|
||||
bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
||||
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
||||
{
|
||||
NSCParameterAssert( g != NULL && sx != NULL && sy != NULL );
|
||||
|
||||
|
@ -130,7 +130,7 @@ bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
|||
return true;
|
||||
}
|
||||
|
||||
void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
|
||||
static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
|
||||
{
|
||||
[[(BrowserViewController *)g browserView] scrollPoint: cocoa_point( sx, sy )];
|
||||
}
|
||||
|
@ -301,6 +301,8 @@ static struct gui_window_table cocoa_window_table = {
|
|||
.destroy = gui_window_destroy,
|
||||
.redraw = gui_window_redraw_window,
|
||||
.update = gui_window_update_box,
|
||||
.get_scroll = gui_window_get_scroll,
|
||||
.set_scroll = gui_window_set_scroll,
|
||||
|
||||
.set_title = gui_window_set_title,
|
||||
.set_url = gui_window_set_url,
|
||||
|
|
|
@ -499,7 +499,7 @@ void browser_window_scroll_visible(struct browser_window *bw,
|
|||
void browser_window_set_scroll(struct browser_window *bw, int x, int y)
|
||||
{
|
||||
if (bw->window != NULL) {
|
||||
gui_window_set_scroll(bw->window, x, y);
|
||||
guit->window->set_scroll(bw->window, x, y);
|
||||
} else {
|
||||
if (bw->scroll_x != NULL)
|
||||
scrollbar_set(bw->scroll_x, x, false);
|
||||
|
@ -2946,7 +2946,7 @@ void browser_window_page_drag_start(struct browser_window *bw, int x, int y)
|
|||
|
||||
if (bw->window != NULL) {
|
||||
/* Front end window */
|
||||
gui_window_get_scroll(bw->window, &bw->drag_start_scroll_x,
|
||||
guit->window->get_scroll(bw->window, &bw->drag_start_scroll_x,
|
||||
&bw->drag_start_scroll_y);
|
||||
|
||||
guit->window->scroll_start(bw->window);
|
||||
|
|
|
@ -94,6 +94,25 @@ struct gui_window_table {
|
|||
*/
|
||||
void (*update)(struct gui_window *g, const struct rect *rect);
|
||||
|
||||
/**
|
||||
* Get the scroll position of a browser window.
|
||||
*
|
||||
* \param g gui_window
|
||||
* \param sx receives x ordinate of point at top-left of window
|
||||
* \param sy receives y ordinate of point at top-left of window
|
||||
* \return true iff successful
|
||||
*/
|
||||
bool (*get_scroll)(struct gui_window *g, int *sx, int *sy);
|
||||
|
||||
/**
|
||||
* Set the scroll position of a browser window.
|
||||
*
|
||||
* \param g gui_window to scroll
|
||||
* \param sx point to place at top-left of window
|
||||
* \param sy point to place at top-left of window
|
||||
*/
|
||||
void (*set_scroll)(struct gui_window *g, int sx, int sy);
|
||||
|
||||
|
||||
/* Optional entries */
|
||||
|
||||
|
@ -179,8 +198,6 @@ struct gui_table {
|
|||
|
||||
extern struct gui_table *guit; /* the gui vtable */
|
||||
|
||||
bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy);
|
||||
void gui_window_set_scroll(struct gui_window *g, int sx, int sy);
|
||||
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
|
||||
bool scaled);
|
||||
void gui_window_update_extent(struct gui_window *g);
|
||||
|
|
|
@ -52,7 +52,7 @@ static void gui_default_window_scroll_visible(struct gui_window *g,
|
|||
int x0, int y0,
|
||||
int x1, int y1)
|
||||
{
|
||||
gui_window_set_scroll(g, x0, y0);
|
||||
guit->window->set_scroll(g, x0, y0);
|
||||
}
|
||||
|
||||
static void gui_default_window_new_content(struct gui_window *g)
|
||||
|
@ -86,6 +86,12 @@ static nserror verify_window_register(struct gui_window_table *gwt)
|
|||
if (gwt->update == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
if (gwt->get_scroll == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
if (gwt->set_scroll == NULL) {
|
||||
return NSERROR_BAD_PARAMETER;
|
||||
}
|
||||
|
||||
/* fill in the optional entries with defaults */
|
||||
if (gwt->set_title == NULL) {
|
||||
|
|
|
@ -1552,7 +1552,7 @@ gui_window_update_box(struct gui_window *g, const struct rect *rect)
|
|||
rect->y1 - bwidget->scrolly);
|
||||
}
|
||||
|
||||
bool
|
||||
static bool
|
||||
gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
||||
{
|
||||
struct browser_widget_s *bwidget = fbtk_get_userpw(g->browser);
|
||||
|
@ -1563,7 +1563,7 @@ gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
|||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gui_window_set_scroll(struct gui_window *gw, int sx, int sy)
|
||||
{
|
||||
struct browser_widget_s *bwidget = fbtk_get_userpw(gw->browser);
|
||||
|
@ -1846,6 +1846,8 @@ static struct gui_window_table framebuffer_gui_window_table = {
|
|||
.destroy = gui_window_destroy,
|
||||
.redraw = gui_window_redraw_window,
|
||||
.update = gui_window_update_box,
|
||||
.get_scroll = gui_window_get_scroll,
|
||||
.set_scroll = gui_window_set_scroll,
|
||||
|
||||
.set_url = gui_window_set_url,
|
||||
.start_throbber = gui_window_start_throbber,
|
||||
|
|
31
gtk/window.c
31
gtk/window.c
|
@ -888,6 +888,20 @@ static void gui_window_set_icon(struct gui_window *gw, hlcache_handle *icon)
|
|||
nsgtk_scaffolding_set_icon(gw);
|
||||
}
|
||||
|
||||
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
||||
{
|
||||
GtkAdjustment *vadj = nsgtk_layout_get_vadjustment(g->layout);
|
||||
GtkAdjustment *hadj = nsgtk_layout_get_hadjustment(g->layout);
|
||||
|
||||
assert(vadj);
|
||||
assert(hadj);
|
||||
|
||||
*sy = (int)(gtk_adjustment_get_value(vadj));
|
||||
*sx = (int)(gtk_adjustment_get_value(hadj));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void nsgtk_redraw_caret(struct gui_window *g)
|
||||
{
|
||||
int sx, sy;
|
||||
|
@ -948,21 +962,8 @@ void gui_window_set_status(struct gui_window *g, const char *text)
|
|||
gtk_label_set_text(g->status_bar, text);
|
||||
}
|
||||
|
||||
bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
||||
{
|
||||
GtkAdjustment *vadj = nsgtk_layout_get_vadjustment(g->layout);
|
||||
GtkAdjustment *hadj = nsgtk_layout_get_hadjustment(g->layout);
|
||||
|
||||
assert(vadj);
|
||||
assert(hadj);
|
||||
|
||||
*sy = (int)(gtk_adjustment_get_value(vadj));
|
||||
*sx = (int)(gtk_adjustment_get_value(hadj));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
|
||||
static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
|
||||
{
|
||||
GtkAdjustment *vadj = nsgtk_layout_get_vadjustment(g->layout);
|
||||
GtkAdjustment *hadj = nsgtk_layout_get_hadjustment(g->layout);
|
||||
|
@ -1176,6 +1177,8 @@ static struct gui_window_table gui_window_table = {
|
|||
.destroy = gui_window_destroy,
|
||||
.redraw = gui_window_redraw_window,
|
||||
.update = gui_window_update_box,
|
||||
.get_scroll = gui_window_get_scroll,
|
||||
.set_scroll = gui_window_set_scroll,
|
||||
|
||||
.set_icon = gui_window_set_icon,
|
||||
|
||||
|
|
|
@ -166,7 +166,7 @@ gui_window_stop_throbber(struct gui_window *g)
|
|||
fprintf(stdout, "WINDOW STOP_THROBBER WIN %u\n", g->win_num);
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
gui_window_set_scroll(struct gui_window *g, int sx, int sy)
|
||||
{
|
||||
g->scrollx = sx;
|
||||
|
@ -283,7 +283,7 @@ gui_drag_save_object(gui_save_type type, hlcache_handle *c,
|
|||
/* Ignore? */
|
||||
}
|
||||
|
||||
bool
|
||||
static bool
|
||||
gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
||||
{
|
||||
fprintf(stdout, "WINDOW GET_SCROLL WIN %u X %d Y %d\n",
|
||||
|
@ -568,6 +568,8 @@ static struct gui_window_table gui_window_table = {
|
|||
.destroy = gui_window_destroy,
|
||||
.redraw = gui_window_redraw_window,
|
||||
.update = gui_window_update_box,
|
||||
.get_scroll = gui_window_get_scroll,
|
||||
.set_scroll = gui_window_set_scroll,
|
||||
|
||||
.set_title = gui_window_set_title,
|
||||
.set_url = gui_window_set_url,
|
||||
|
|
|
@ -766,7 +766,7 @@ static void gui_window_update_box(struct gui_window *g, const struct rect *rect)
|
|||
* \return true iff successful
|
||||
*/
|
||||
|
||||
bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
||||
static bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
||||
{
|
||||
wimp_window_state state;
|
||||
os_error *error;
|
||||
|
@ -799,7 +799,7 @@ bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
|
|||
* \param sy point to place at top-left of window
|
||||
*/
|
||||
|
||||
void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
|
||||
static void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
|
||||
{
|
||||
wimp_window_state state;
|
||||
os_error *error;
|
||||
|
@ -5245,6 +5245,8 @@ static struct gui_window_table gui_window_table = {
|
|||
.destroy = gui_window_destroy,
|
||||
.redraw = gui_window_redraw_window,
|
||||
.update = gui_window_update_box,
|
||||
.get_scroll = gui_window_get_scroll,
|
||||
.set_scroll = gui_window_set_scroll,
|
||||
|
||||
.set_icon = gui_window_set_icon,
|
||||
.set_title = gui_window_set_title,
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
|
||||
static const char windowclassname_drawable[] = "nswsdrawablewindow";
|
||||
|
||||
void gui_window_set_scroll(struct gui_window *w, int sx, int sy);
|
||||
|
||||
/**
|
||||
* Handle wheel scroll messages.
|
||||
*/
|
||||
|
|
|
@ -73,6 +73,9 @@ static const char windowclassname_main[] = "nswsmainwindow";
|
|||
|
||||
static struct nsws_pointers nsws_pointer;
|
||||
|
||||
void gui_window_set_scroll(struct gui_window *w, int sx, int sy);
|
||||
static bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy);
|
||||
|
||||
void gui_file_gadget_open(struct gui_window *g, hlcache_handle *hl,
|
||||
struct form_control *gadget)
|
||||
{
|
||||
|
@ -1469,7 +1472,7 @@ static void gui_window_update_box(struct gui_window *gw, const struct rect *rect
|
|||
|
||||
}
|
||||
|
||||
bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy)
|
||||
static bool gui_window_get_scroll(struct gui_window *w, int *sx, int *sy)
|
||||
{
|
||||
LOG(("get scroll"));
|
||||
if (w == NULL)
|
||||
|
@ -1849,6 +1852,8 @@ static struct gui_window_table win32_window_table = {
|
|||
.destroy = gui_window_destroy,
|
||||
.redraw = gui_window_redraw_window,
|
||||
.update = gui_window_update_box,
|
||||
.get_scroll = gui_window_get_scroll,
|
||||
.set_scroll = gui_window_set_scroll,
|
||||
|
||||
.set_title = gui_window_set_title,
|
||||
.set_url = gui_window_set_url,
|
||||
|
|
Loading…
Reference in New Issue