Esempio n. 1
0
File: main.c Progetto: berkus/acess2
void add_toolbar_button(tAxWin3_Widget *Toolbar, const char *Ident, tAxWin3_Widget_FireCb Callback)
{
	tAxWin3_Widget *btn = AxWin3_Widget_AddWidget(Toolbar, ELETYPE_BUTTON, ELEFLAG_NOSTRETCH, Ident);
	const char *img = getimg(Ident);
	if( img )
	{
		tAxWin3_Widget *txt = AxWin3_Widget_AddWidget(btn, ELETYPE_IMAGE, 0, Ident);
		AxWin3_Widget_SetText(txt, img);
		// TODO: tooltip?
	}
	else
	{
		tAxWin3_Widget *txt = AxWin3_Widget_AddWidget(btn, ELETYPE_TEXT, 0, Ident);
		AxWin3_Widget_SetText(txt, getstr(Ident));
	}
	AxWin3_Widget_SetFireHandler(btn, Callback);
}
Esempio n. 2
0
tAxWin3_Widget *make_textbutton(tAxWin3_Widget *Parent, const char *Label, tAxWin3_Widget_FireCb handler)
{
	tAxWin3_Widget	*ret, *txt;
	ret = AxWin3_Widget_AddWidget(Parent, ELETYPE_BUTTON, ELEFLAG_ALIGN_CENTER, "_btn");
	AxWin3_Widget_SetFireHandler(ret, handler);
	AxWin3_Widget_AddWidget(ret, ELETYPE_NONE, 0, "_spacer1");
	txt = AxWin3_Widget_AddWidget(ret, ELETYPE_TEXT, ELEFLAG_NOSTRETCH|ELEFLAG_NOEXPAND, "_txt");
	AxWin3_Widget_SetText(txt, Label);
	AxWin3_Widget_AddWidget(ret, ELETYPE_NONE, 0, "_spacer2");
	return ret;
}
Esempio n. 3
0
void create_sidebar(void)
{
	tAxWin3_Widget	*btn, *txt, *ele;

	// Create sidebar
	gSidebar = AxWin3_Widget_CreateWindow(NULL, SIDEBAR_WIDTH, giScreenHeight, ELEFLAG_VERTICAL);
	AxWin3_MoveWindow(gSidebar, 0, 0);
	gSidebarRoot = AxWin3_Widget_GetRoot(gSidebar);	

	// - Main menu
	btn = AxWin3_Widget_AddWidget(gSidebarRoot, ELETYPE_BUTTON, ELEFLAG_NOSTRETCH, "SystemButton");
	AxWin3_Widget_SetSize(btn, SIDEBAR_WIDTH);
	AxWin3_Widget_SetFireHandler(btn, systembutton_fire);
	txt = AxWin3_Widget_AddWidget(btn, ELETYPE_IMAGE, 0, "SystemLogo");
	AxWin3_Widget_SetText(txt, "file:///Acess/Apps/AxWin/3.0/AcessLogoSmall.sif");
	
	// - Plain <hr/> style spacer
	ele = AxWin3_Widget_AddWidget(gSidebarRoot, ELETYPE_SPACER, ELEFLAG_NOSTRETCH, "SideBar Spacer Top");
	AxWin3_Widget_SetSize(ele, 4);

	// TODO: Program list
	gWindowList = AxWin3_Widget_AddWidget(gSidebarRoot, ELETYPE_BOX, ELEFLAG_VERTICAL, "ProgramList");

	// - Plain <hr/> style spacer
	ele = AxWin3_Widget_AddWidget(gSidebarRoot, ELETYPE_SPACER, ELEFLAG_NOSTRETCH, "SideBar Spacer Top");
	AxWin3_Widget_SetSize(ele, 4);

	// > Version/Time
	ele = AxWin3_Widget_AddWidget(gSidebarRoot,
		ELETYPE_BOX,
		ELEFLAG_VERTICAL|ELEFLAG_ALIGN_CENTER|ELEFLAG_NOSTRETCH,
		"Version/Time"
		);
	gTimeDisplay = AxWin3_Widget_AddWidget(ele, ELETYPE_TEXT, ELEFLAG_NOSTRETCH, "Time");
	AxWin3_Widget_SetSize(gTimeDisplay, 20);
	//AxWin3_Widget_SetText(gTimeDisplay, "--:--");
	update_time();

	// Turn off decorations
	AxWin3_DecorateWindow(gSidebar, 0);

	// Show!
	AxWin3_ShowWindow(gSidebar, 1);	
	
}
Esempio n. 4
0
void update_time(void)
{
	char	tmpbuf[2+1+2+1] = "--:--";
	//strftime(tmpbuf, sizeof(tmpbuf), "%H:%M", NULL);
	AxWin3_Widget_SetText(gTimeDisplay, tmpbuf);
}