Update local history window to use event callback

This commit is contained in:
Chris Young 2016-12-31 00:43:06 +00:00
parent d8eec1b048
commit 9df30eb78f
3 changed files with 22 additions and 16 deletions

View File

@ -1941,7 +1941,7 @@ static void ami_handle_msg(void)
continue;
}
} else if(node->Type == AMINS_HISTORYWINDOW) {
if(ami_history_event((struct history_window *)w)) {
if(w->tbl->event(w)) {
ami_try_quit();
break;
} else {

View File

@ -57,9 +57,25 @@
#include "amiga/gui.h"
#include "amiga/history_local.h"
struct history_window {
struct ami_generic_window w;
struct Window *win;
Object *objects[GID_LAST];
struct gui_window *gw;
struct Hook scrollerhook;
struct gui_globals *gg;
};
static void ami_history_update_extent(struct history_window *hw);
HOOKF(void, ami_history_scroller_hook, Object *, object, struct IntuiMessage *);
static BOOL ami_history_event(void *w);
static const struct ami_win_event_table ami_localhistory_table = {
ami_history_event,
NULL, /* we don't explicitly close the local history window on quit */
};
/**
* Redraw history window.
*/
@ -159,8 +175,7 @@ void ami_history_open(struct gui_window *gw)
EndWindow;
gw->hw->win = (struct Window *)RA_OpenWindow(gw->hw->objects[OID_MAIN]);
gw->hw->node = AddObject(window_list,AMINS_HISTORYWINDOW);
gw->hw->node->objstruct = gw->hw;
ami_gui_win_list_add(gw->hw, AMINS_HISTORYWINDOW, &ami_localhistory_table);
GetAttr(WINDOW_HorizObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_HSCROLL]);
GetAttr(WINDOW_VertObject,gw->hw->objects[OID_MAIN],(ULONG *)&gw->hw->objects[OID_VSCROLL]);
@ -229,12 +244,13 @@ void ami_history_close(struct history_window *hw)
free(hw->gg);
hw->gw->hw = NULL;
DisposeObject(hw->objects[OID_MAIN]);
DelObject(hw->node);
ami_gui_win_list_remove(hw);
}
BOOL ami_history_event(struct history_window *hw)
static BOOL ami_history_event(void *w)
{
/* return TRUE if window destroyed */
struct history_window *hw = (struct history_window *)w;
ULONG result = 0;
uint16 code;
const char *url;

View File

@ -24,15 +24,7 @@
struct gui_window;
struct gui_globals;
struct history_window {
struct nsObject *node;
struct Window *win;
Object *objects[GID_LAST];
struct gui_window *gw;
struct Hook scrollerhook;
struct gui_globals *gg;
};
struct history_window;
/**
* Open history window.
@ -42,7 +34,5 @@ struct history_window {
void ami_history_open(struct gui_window *gw);
void ami_history_close(struct history_window *hw);
BOOL ami_history_event(struct history_window *hw);
#endif