예제 #1
0
파일: button.c 프로젝트: varialus/agar
static void
Init(void *obj)
{
	AG_Button *bu = obj;

	WIDGET(bu)->flags |= AG_WIDGET_FOCUSABLE|
	                     AG_WIDGET_UNFOCUSED_MOTION|
			     AG_WIDGET_UNFOCUSED_BUTTONUP|
			     AG_WIDGET_TABLE_EMBEDDABLE|
			     AG_WIDGET_USE_TEXT|
			     AG_WIDGET_USE_MOUSEOVER;

	bu->flags = 0;
	bu->lbl = NULL;
	bu->surface = -1;
	bu->state = 0;
	bu->justify = AG_TEXT_CENTER;
	bu->valign = AG_TEXT_MIDDLE;
	bu->lPad = 4;
	bu->rPad = 4;
	bu->tPad = 3;
	bu->bPad = 3;
	AG_InitTimer(&bu->delayTo, "delay", 0);
	AG_InitTimer(&bu->repeatTo, "repeat", 0);

	AG_AddEvent(bu, "widget-shown", OnShow, NULL);
	AG_SetEvent(bu, "mouse-button-up", MouseButtonUp, NULL);
	AG_SetEvent(bu, "mouse-button-down", MouseButtonDown, NULL);
	AG_SetEvent(bu, "mouse-motion", MouseMotion, NULL);
	AG_SetEvent(bu, "key-up", KeyUp, NULL);
	AG_SetEvent(bu, "key-down", KeyDown, NULL);

	AG_BindInt(bu, "state", &bu->state);
}
예제 #2
0
파일: slider.c 프로젝트: LiberatorUSA/GUCEF
static void
Init(void *obj)
{
	AG_Slider *sl = obj;

	WIDGET(sl)->flags |= AG_WIDGET_UNFOCUSED_BUTTONUP|
	                     AG_WIDGET_UNFOCUSED_MOTION|
			     AG_WIDGET_FOCUSABLE|
			     AG_WIDGET_TABLE_EMBEDDABLE;

	sl->type = AG_SLIDER_HORIZ;
	sl->ctlPressed = 0;
	sl->flags = 0;
	sl->wControlPref = agTextFontHeight;
	sl->wControl = sl->wControlPref;
	sl->xOffs = 0;
	
	AG_InitTimer(&sl->moveTo, "move", 0);

	AG_AddEvent(sl, "widget-shown", OnShow, NULL);
	AG_AddEvent(sl, "widget-hidden", OnFocusLoss, NULL);
	AG_SetEvent(sl, "widget-lostfocus", OnFocusLoss, NULL);
	AG_SetEvent(sl, "mouse-button-down", MouseButtonDown, NULL);
	AG_SetEvent(sl, "mouse-button-up", MouseButtonUp, NULL);
	AG_SetEvent(sl, "mouse-motion", MouseMotion, NULL);
	AG_SetEvent(sl, "key-down", KeyDown, NULL);
	AG_SetEvent(sl, "key-up", KeyUp, NULL);

#ifdef AG_DEBUG
	AG_BindInt(sl, "xOffs", &sl->xOffs);
	AG_BindInt(sl, "extent", &sl->extent);
#endif /* AG_DEBUG */
}