示例#1
0
LCUI_Widget SideBar_AppendItem( LCUI_Widget sidebar, const wchar_t *id,
				const wchar_t *icon, const wchar_t *text )
{
	SideBar *sb;
	SideBarItem *sbi;
	LCUI_Widget w;
	int len = id ? wcslen( id ) : 0;
	wchar_t *new_id = malloc( sizeof( wchar_t )*(len + 1) );
	if( !new_id ) {
		return NULL;
	}
	sb = sidebar->private_data;
	w = LCUIWidget_New( "sidebar-item" );
	sbi = w->private_data;
	id ? wcscpy( new_id, id ) : (new_id[0] = 0, NULL);
	sbi->id ? free( sbi->id ) : 0;
	sbi->id = new_id;
	Widget_Append( sidebar, w );
	TextView_SetTextW( sbi->icon, icon );
	TextView_SetTextW( sbi->text, text );
	Widget_Show( w );
	Widget_Show( sbi->icon );
	Widget_Show( sbi->text );
	LinkedList_Append( &sb->items, sbi );
	return w;
}
示例#2
0
文件: filesync.c 项目: npk/LC-Finder
static void FileSyncThread( void *arg )
{
	LCUI_Widget alert = self.text->parent;
	TextView_SetTextW( self.title, TEXT_STARED );
	Widget_RemoveClass( alert, "hide" );
	LCFinder_SyncFiles( &self.status );
	OnUpdateStats( NULL );
	LCUITimer_Free( self.timer );
	TextView_SetTextW( self.title, TEXT_FINISHED );
	LCUITimer_Set( 3000, OnHideTip, NULL, FALSE );
	self.is_syncing = FALSE;
	self.timer = 0;
	LCFinder_TriggerEvent( EVENT_SYNC_DONE, NULL );
}
示例#3
0
文件: filesync.c 项目: npk/LC-Finder
static void OnUpdateStats( void *arg )
{
	wchar_t wstr[256];
	int count, total;
	switch( self.status.state ) {
	case STATE_STARTED:
		count = self.status.scaned_files;
		if( self.status.task ) {
			count += self.status.task->total_files;
		}
		wsprintf( wstr, TEXT_SCANING, count );
		break;
	case STATE_SAVING:
		count = self.status.synced_files;
		total = self.status.added_files + self.status.deleted_files;
		wsprintf( wstr, TEXT_SAVING, count, total );
		break;
	case STATE_FINISHED:
		count = self.status.synced_files;
		wsprintf( wstr, TEXT_SAVED, count );
		break;
	default:return;
	}
	TextView_SetTextW( self.text, wstr );
}
示例#4
0
文件: helloworld.c 项目: lc-soft/LCUI
static void OnBtnClick( LCUI_Widget self, LCUI_WidgetEvent e, void *arg )
{
        wchar_t str[256];
        LCUI_Widget edit = LCUIWidget_GetById( "edit" );
        LCUI_Widget txt = LCUIWidget_GetById( "text-hello" );
        TextEdit_GetTextW( edit, 0, 255, str );
        TextView_SetTextW( txt, str );
}
示例#5
0
文件: helloworld.c 项目: rokite/LCUI
int main( int argc, char **argv )
{
	LCUI_Widget w, root, text;
	LCUI_Graph desktop_image;

	InitConsoleWindow();
	LCUI_Init();
	LCUIDisplay_SetMode( LDM_WINDOWED );
	LCUIDisplay_SetSize( 960, 540 );
	w = LCUIWidget_New("debug-widget");
	text = LCUIWidget_New("textview");
	Widget_Append( w, text );
	TextView_SetTextW( text, L"测试文本内容,呵呵达!\nABCDEFG,abcdefg,[color=#ff0000]color font[/color]");
	Widget_Top( w );
	Widget_Show( w );
	Widget_Resize( w, 320, 240 );
	Widget_Move( w, 200, 200 );
	Widget_SetTitleW( w, L"测试" );
	Graph_Init( &desktop_image );
	Graph_LoadImage( "images/background-image.png", &desktop_image );
	root = LCUIWidget_GetRoot();

	Widget_PullStyle( root, WSS_BACKGROUND );
	root->style.background.color = RGB(255,242,223);
	root->style.background.image = desktop_image;
	root->style.background.size.using_value = TRUE;
	root->style.background.size.value = SV_COVER;
	Widget_PushStyle( root, WSS_BACKGROUND );

	Widget_PullStyle( w, WSS_BACKGROUND | WSS_SHADOW | WSS_BORDER );
	w->style.background.color.value = 0xccffffff;
	w->style.background.size.w.scale = 0.50; 
	w->style.background.size.h.px = 200;
	w->style.background.size.w.type = SVT_SCALE;
	w->style.background.size.h.type = SVT_PX;
	w->style.background.size.using_value = FALSE;
	w->style.background.position.using_value = TRUE;
	w->style.background.position.value = SV_BOTTOM_CENTER;
	w->style.shadow.color = ARGB(200,0,122,204);
	w->style.shadow.x = 2;
	w->style.shadow.y = 2;
	w->style.shadow.spread = 0;
	w->style.shadow.blur = 8;
	w->style.border.top.width = 1;
	w->style.border.right.width = 1;
	w->style.border.bottom.width = 1;
	w->style.border.left.width = 1;
	w->style.border.top.color = RGB(0,122,204);
	w->style.border.right.color = RGB(0,122,204);
	w->style.border.bottom.color = RGB(0,122,204);
	w->style.border.left.color = RGB(0,122,204);
	Widget_PushStyle( w, WSS_BACKGROUND | WSS_SHADOW | WSS_BORDER );
	//LCUITimer_Set( 5000, onTimer, NULL, TRUE );
	return LCUI_Main();
}
示例#6
0
void Button_SetTextW( LCUI_Widget w, const wchar_t *wstr )
{
	LCUI_Button *btn = (LCUI_Button*)w->private_data;
	TextView_SetTextW( btn->text, wstr );
}