当前位置: 首页>>代码示例>>C++>>正文


C++ UT_Win32LocaleString::fromASCII方法代码示例

本文整理汇总了C++中UT_Win32LocaleString::fromASCII方法的典型用法代码示例。如果您正苦于以下问题:C++ UT_Win32LocaleString::fromASCII方法的具体用法?C++ UT_Win32LocaleString::fromASCII怎么用?C++ UT_Win32LocaleString::fromASCII使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UT_Win32LocaleString的用法示例。


在下文中一共展示了UT_Win32LocaleString::fromASCII方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: LoadCursor

bool AP_Win32LeftRuler::registerClass(XAP_Win32App * app)
{
	ATOM a;
	UT_Win32LocaleString str;
 	
	str.fromASCII (app->getApplicationName());
	// register class for the left ruler
	swprintf(s_LeftRulerWndClassName, L"%sLeftRuler",  str.c_str());

	a = UT_RegisterClassEx(CS_DBLCLKS | CS_OWNDC, AP_Win32LeftRuler::_LeftRulerWndProc, app->getInstance(),
						   NULL, LoadCursor(NULL, IDC_ARROW), GetSysColorBrush(COLOR_BTNFACE), NULL,
						   NULL, s_LeftRulerWndClassName);
	
	UT_ASSERT_HARMLESS(a);

	return true;
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:17,代码来源:ap_Win32LeftRuler.cpp

示例2: GetDlgItem

BOOL AP_Win32Dialog_New::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
	m_hThisDlg = hWnd;

	XAP_Win32App * app = static_cast<XAP_Win32App *> (m_pApp);
	UT_return_val_if_fail (app,1);

	const XAP_StringSet * pSS = m_pApp->getStringSet();

	_win32Dialog.setDialogTitle(pSS->getValue(AP_STRING_ID_DLG_NEW_Title));

	// localize controls
	_DSX(NEW_BTN_OK,		DLG_OK);
	_DSX(NEW_BTN_CANCEL,	DLG_Cancel);
	_DS(NEW_RDO_TEMPLATE,	DLG_NEW_Create);
	_DS(NEW_RDO_EXISTING,	DLG_NEW_Open);
    _DS(NEW_BTN_EXISTING,	DLG_NEW_Choose);

	// set initial state
	_win32Dialog.setControlText(AP_RID_DIALOG_NEW_EBX_EXISTING, 
  								pSS->getValue(AP_STRING_ID_DLG_NEW_NoFile));

	HWND hControl = GetDlgItem(hWnd, AP_RID_DIALOG_NEW_LBX_TEMPLATE);

	long findtag;
	struct _finddata_t cfile;
	UT_String templateName, searchDir;
	templateName = XAP_App::getApp()->getUserPrivateDirectory(); 
	searchDir = XAP_App::getApp()->getUserPrivateDirectory();
	searchDir += "\\templates\\*.awt";
	findtag = _findfirst( searchDir.c_str(), &cfile );
	if( findtag != -1 )
	{
		do
		{	
			templateName = XAP_App::getApp()->getUserPrivateDirectory();
			templateName += "\\templates\\";
			templateName += cfile.name;
			if(!strstr(templateName.c_str(), "normal.awt-")) // don't truncate localized template names
				templateName = templateName.substr ( 0, templateName.size () - 4 ) ;

			UT_Win32LocaleString str;
			str.fromASCII (templateName.c_str());
			char *uri = UT_go_filename_to_uri(str.utf8_str().utf8_str());
			UT_continue_if_fail(uri);

			UT_sint32 nIndex = SendMessageW( hControl, LB_ADDSTRING, 0, (LPARAM) UT_basename( uri ) );
			SendMessageW( hControl, LB_SETITEMDATA, (WPARAM) nIndex, (LPARAM) 0 );

			g_free(uri);
		} while( _findnext( findtag, &cfile ) == 0 );
	}
	_findclose( findtag );

	templateName = XAP_App::getApp()->getAbiSuiteLibDir(); 
	searchDir = XAP_App::getApp()->getAbiSuiteLibDir();
	searchDir += "\\templates\\*.awt";
	findtag = _findfirst( searchDir.c_str(), &cfile );
	if( findtag != -1 )
	{
		do
		{	
			templateName = XAP_App::getApp()->getAbiSuiteLibDir();
			templateName += "\\templates\\";
			templateName += cfile.name;
			if(!strstr(templateName.c_str(), "normal.awt-"))  // don't truncate localized template names
				templateName = templateName.substr ( 0, templateName.size () - 4 ) ;

            UT_Win32LocaleString str;
			str.fromASCII (templateName.c_str());
			char *uri = UT_go_filename_to_uri(str.utf8_str().utf8_str());
			UT_continue_if_fail(uri);

			UT_sint32 nIndex = SendMessageW( hControl, LB_ADDSTRING, 0, (LPARAM) UT_basename( uri ) );
			SendMessageW( hControl, LB_SETITEMDATA, (WPARAM) nIndex, (LPARAM) 1 );

			g_free(uri);
		} while( _findnext( findtag, &cfile ) == 0 );
	}
	_findclose( findtag );

	XAP_Win32DialogHelper::s_centerDialog(hWnd);	
	_updateControls();
	return 1;	// 1 == we did not call SetFocus()
}
开发者ID:monkeyiq,项目名称:odf-2011-track-changes-git-svn,代码行数:85,代码来源:ap_Win32Dialog_New.cpp

示例3: GetDlgItem

BOOL AP_Win32Dialog_ListRevisions::_onInitDialog(HWND hWnd, WPARAM /*wParam*/, LPARAM /*lParam*/)
{
	const XAP_StringSet * pSS = m_pApp->getStringSet();
    
	setDialogTitle (getTitle());

	// localize controls
	_DSX(BTN_OK,			DLG_OK);
	_DSX(BTN_CANCEL,		DLG_Cancel);

	setDlgItemText(AP_RID_DIALOG_LIST_REVISIONS_FRAME,getLabel1());

	// set the column headings
	HWND h = GetDlgItem(hWnd, AP_RID_DIALOG_LIST_REVISIONS_LIST);

    LVCOLUMNW col;
    UT_Win32LocaleString str;
	col.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH;

	int col_hdr[3]={AP_STRING_ID_DLG_ListRevisions_Column1Label,
					AP_STRING_ID_DLG_ListRevisions_Column2Label,
					AP_STRING_ID_DLG_ListRevisions_Column3Label};
	int col_wid[3]={80,160,230};

	for (int i=0; i<3; i++) {
		col.iSubItem = i;
		col.cx = col_wid[i];
		str.fromUTF8(pSS->getValue(col_hdr[i]));
		col.pszText = (LPWSTR) str.c_str();
		SendMessageW(h, LVM_INSERTCOLUMNW, i, (LPARAM)&col);
	}

	ListView_SetItemCount(h, getItemCount());

	LVITEMW item;
	item.state = 0;
	item.stateMask = 0;
	item.iImage = 0;

	WCHAR buf[60];
	const char *tmp;
	item.pszText = buf;

	for(UT_uint32 i = 0; i < getItemCount(); i++)
	{
		wsprintfW(buf,L"%d",getNthItemId(i));
		item.pszText = buf;
		item.iItem = i;
		item.iSubItem = 0;
		item.lParam = getNthItemId(i);
		item.mask = LVIF_TEXT | LVIF_PARAM;
		SendMessageW(h, LVM_INSERTITEMW, 0, (LPARAM)&item);

		item.iSubItem = 1;
		tmp=getNthItemTime(i);
		if (tmp) {
			str.fromASCII(tmp,-1);
			item.pszText = (LPWSTR) str.c_str();
		} else {
			item.pszText = L"";
		}
		item.mask = LVIF_TEXT;
		SendMessageW(h, LVM_SETITEMW, 0, (LPARAM)&item);
		
		item.iSubItem = 2;
		str.fromUTF8(getNthItemText(i));
		item.pszText = (LPWSTR) str.c_str();
		item.mask = LVIF_TEXT;
		SendMessageW(h, LVM_SETITEMW, 0, (LPARAM)&item);
	}
   
	SendMessageW(h, LVM_SETEXTENDEDLISTVIEWSTYLE, LVS_EX_FULLROWSELECT, LVS_EX_FULLROWSELECT);  								
    centerDialog();	

	return 1;							// 1 == we did not call SetFocus()
}
开发者ID:lokeshguddu,项目名称:AbiWord,代码行数:76,代码来源:ap_Win32Dialog_ListRevisions.cpp


注:本文中的UT_Win32LocaleString::fromASCII方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。