Пример #1
0
/*
Function: wz_init_button
*/
void wz_init_button(WZ_BUTTON* but, WZ_WIDGET* parent, float x, float y, float w, float h, ALLEGRO_USTR* text, int own, int id)
{
	WZ_WIDGET* wgt = (WZ_WIDGET*)but;
	wz_init_widget(wgt, parent, x, y, w, h, id);
	but->down = 0;
	but->own = own;
	but->text = text;
	wgt->proc = wz_button_proc;
}
Пример #2
0
/*
Function: wz_init_textbox
*/
void wz_init_textbox(WZ_TEXTBOX* box, WZ_WIDGET* parent, float x, float y, float w, float h, int halign, int valign, ALLEGRO_USTR* text, int own, int id)
{
	WZ_WIDGET* wgt = (WZ_WIDGET*)box;
	wz_init_widget(wgt, parent, x, y, w, h, id);
	wgt->flags |= WZ_STATE_NOTWANT_FOCUS;
	wgt->proc = wz_textbox_proc;
	box->own= own;
	box->h_align = halign;
	box->v_align = valign;
	box->text = text;
}
Пример #3
0
/*
Function: wz_init_editbox
*/
void wz_init_editbox(WZ_EDITBOX* box, WZ_WIDGET* parent, float x, float y, float w, float h, ALLEGRO_USTR* text, int own, int id)
{
	WZ_WIDGET* wgt = (WZ_WIDGET*)box;
	wz_init_widget(wgt, parent, x, y, w, h, id);
	
	box->own = own;
	if(!text)
	{
		box->text = al_ustr_new("");
		al_ustr_assign(box->text, text);
		box->own = 1;
	}
	else
	{
		box->text = text;
	}
	box->cursor_pos = 0;
	box->scroll_pos = 0;
	
	wgt->proc = wz_editbox_proc;
}
Пример #4
0
/*
Section: Public

Function: wz_create_widget

Creates a standard widget. You generally don't need to use this, unless you want a do-nothing dummy widget.

Parameters:
id - The id of this widget, which will be used to identify it when it sends events to the user's queue.
Pass -1 to automatically assign an id. If automatically assigned, id will equal the id of its previous sibling
plus one, or if it has none, the id of its parent plus one. If it has no parent, its id will be 0.

See Also:
<WZ_WIDGET>
*/
WZ_WIDGET* wz_create_widget(WZ_WIDGET* parent, float x, float y, int id)
{
	WZ_WIDGET* wgt = malloc(sizeof(WZ_WIDGET));
	wz_init_widget(wgt, parent, x, y, 0, 0, id);
	return wgt;
}