void UI_InitSidebar(void) { int i; LCUI_Widget btn, view; for( i = 0; i < MAX_VIEWS; ++i ) { btn = LCUIWidget_GetById( btn_view_ids[i][0] ); view = LCUIWidget_GetById( btn_view_ids[i][1] ); Widget_BindEvent( btn, "click", OnSidebarBtnClick, view, NULL ); } }
ScrollLoading ScrollLoading_New( LCUI_Widget container ) { ScrollLoading ctx = NEW( ScrollLoadingRec, 1 ); ctx->top = 0; ctx->top_child = NULL; ctx->container = container; ctx->event_id = LCUIWidget_AllocEventId(); LCUIWidget_SetEventName( ctx->event_id, "scrollload" ); Widget_BindEvent( container, "scroll", OnScroll, ctx, NULL ); return ctx; }
int main( int argc, char **argv ) { LCUI_Widget root, pack, btn; LCUI_Init(); root = LCUIWidget_GetRoot(); pack = LCUIBuilder_LoadFile( "helloworld.xml" ); if( !pack ) { return -1; } Widget_Append( root, pack ); Widget_Unwrap( pack ); btn = LCUIWidget_GetById( "btn" ); Widget_BindEvent( btn, "click", OnBtnClick, NULL, NULL ); return LCUI_Main(); }
static void SideBarToggle_OnInit( LCUI_Widget w ) { Widget_BindEvent( w, "click", OnToggle, NULL, NULL ); }