Пример #1
0
static void 
ScrollBar_Drag( LCUI_Widget *widget, LCUI_DragEvent *event )
{
	static LCUI_Pos pos, offset;
	static LCUI_ScrollBar *scrollbar;
	
	if( !widget->parent ) {
		return;
	}
	
	scrollbar = Get_Widget_PrivData( widget->parent );
	pos = Get_Widget_Global_Pos( widget );
	offset = Pos_Sub( event->new_pos, pos ); 
	pos = Pos_Add( pos, offset ); 
	pos = GlobalPos_ConvTo_RelativePos( widget, pos );
	
	Move_ScrollBar( widget, pos );
	/* 若函数指针有效,则调用回调函数 */
	if( scrollbar->callback_func ) {
		scrollbar->callback_func( scrollbar->data, scrollbar->arg );
	}
}
Пример #2
0
static void 
ScrollBar_Drag( LCUI_Widget *widget, LCUI_WidgetEvent *event )
{
	static LCUI_Pos pos, offset;
	static LCUI_ScrollBar *scrollbar;
	if( !widget->parent ) {
		return;
	}
	
	scrollbar = Widget_GetPrivData( widget->parent );
	pos = Widget_GetGlobalPos( widget );
	offset = Pos_Sub( event->drag.new_pos, pos ); 
	pos = Pos_Add( pos, offset ); 
	pos = GlobalPos_ConvTo_RelativePos( widget, pos );
	
	Move_ScrollBar( widget, pos );
	/* 若函数指针有效,则调用回调函数 */
	if( scrollbar->callback_func ) {
		//_DEBUG_MSG("current_num: %d, max_num: %d\n", 
		//scrollbar->data.current_num, scrollbar->data.max_num);
		scrollbar->callback_func( scrollbar->data, scrollbar->arg );
	}
}