Ejemplo n.º 1
0
CMP_STATUSBAR sb_create( struct gui_window * gw )
{
	CMP_STATUSBAR s = malloc( sizeof(struct s_statusbar) );
	s->attached = false;
	s->comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL, STATUSBAR_HEIGHT, 0);
	s->comp->rect.g_h = STATUSBAR_HEIGHT;
	s->comp->bounds.max_height = STATUSBAR_HEIGHT;
	mt_CompDataAttach( &app, s->comp, CDT_OWNER, gw );
	mt_CompEvntAttach( &app, s->comp, WM_REDRAW, evnt_sb_redraw );
	mt_CompEvntAttach( &app, s->comp, WM_XBUTTON, evnt_sb_click );
	sb_set_text( s, (char*)"" );
	return( s );
}
Ejemplo n.º 2
0
/*
	Create an browser component.
	Currently, this area is the area which is used to display HTML content.
	However, it could also contains other areas, these need to be handled within
	"browser_get_rect" function.
*/
struct s_browser * browser_create
(
	struct gui_window * gw,
	struct browser_window *bw,
	struct browser_window * clone,
	int lt, int w, int flex
)
{
	CMP_BROWSER bnew = (CMP_BROWSER)malloc( sizeof(struct s_browser) );
	if( bnew )
	{
		memset(bnew, 0, sizeof(struct s_browser) );
		bnew->bw = bw;
		bnew->attached = false;
		if(clone)
			bw->scale = clone->scale;
		else
			bw->scale = 1;
		redraw_slots_init( &bnew->redraw, MAX_REDRW_SLOTS );
		bnew->comp = (COMPONENT*)mt_CompCreate(&app, CLT_HORIZONTAL, 100, 1);
		if( bnew->comp == NULL ) {
			free(bnew);
			return(NULL);
		}

		/* Attach events to the component: */
		mt_CompEvntDataAdd( &app, bnew->comp, WM_XBUTTON,
						browser_evnt_mbutton, (void*)gw, EV_BOT
		);
		mt_CompEvntDataAttach( &app, bnew->comp, WM_REDRAW,
								browser_evnt_redraw, (void*)gw
		);
		mt_CompEvntDataAttach( &app, bnew->comp, WM_DESTROY,
								browser_evnt_destroy, (void*)bnew
		);

		/* Set the gui_window owner. */
		/* it is an link to the netsurf window system */
		mt_CompDataAttach( &app, bnew->comp, CDT_OWNER, gw );

		bnew->scroll.requested.y = 0;
		bnew->scroll.requested.x = 0;
		bnew->scroll.current.x = 0;
		bnew->scroll.current.y = 0;
		bnew->reformat_pending = false;

	}
	return( bnew );
}