本文整理汇总了C++中UT_Win32LocaleString::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ UT_Win32LocaleString::c_str方法的具体用法?C++ UT_Win32LocaleString::c_str怎么用?C++ UT_Win32LocaleString::c_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UT_Win32LocaleString
的用法示例。
在下文中一共展示了UT_Win32LocaleString::c_str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getColumns
BOOL AP_Win32Dialog_Columns::_onDeltaPos(NM_UPDOWN * pnmud)
{
wchar_t buf[BUFSIZE];
UT_Win32LocaleString str;
switch( pnmud->hdr.idFrom )
{
case AP_RID_DIALOG_COLUMN_SPIN_NUMCOLUMNS:
if( pnmud->iDelta < 0 )
{
setColumns( getColumns() + 1 );
}
else
{
if( getColumns() > 1 )
{
setColumns( getColumns() - 1 );
}
}
SetDlgItemTextW(m_hDlg, AP_RID_DIALOG_COLUMN_EDIT_NUMCOLUMNS, _itow(getColumns(),buf,10));
checkButton(AP_RID_DIALOG_COLUMN_RADIO_ONE, (getColumns()==1));
checkButton(AP_RID_DIALOG_COLUMN_RADIO_TWO, (getColumns()==2));
checkButton(AP_RID_DIALOG_COLUMN_RADIO_THREE, (getColumns()==3));
return 1;
case AP_RID_DIALOG_COLUMN_SPIN_SPACEAFTER:
if( pnmud->iDelta < 0 )
{
incrementSpaceAfter( true );
}
else
{
incrementSpaceAfter( false );
}
str.fromUTF8 (getSpaceAfterString());
SetDlgItemTextW(m_hDlg, AP_RID_DIALOG_COLUMN_EDIT_SPACEAFTER, str.c_str ());
return 1;
case AP_RID_DIALOG_COLUMN_SPIN_MAXSIZE:
if( pnmud->iDelta < 0 )
{
incrementMaxHeight( true );
}
else
{
incrementMaxHeight( false );
}
str.fromUTF8 (getHeightString());
SetDlgItemTextW(m_hDlg, AP_RID_DIALOG_COLUMN_EDIT_MAXSIZE, str.c_str ());
return 1;
default:
return 0;
}
}
示例2: SendMessageW
void AP_Win32Dialog_Field::SetFieldsList(void)
{
fp_FieldTypesEnum FType = fp_FieldTypes[m_iTypeIndex].m_Type;
SendMessageW(m_hwndFormats, LB_RESETCONTENT, 0, 0);
int i;
for (i = 0;fp_FieldFmts[i].m_Tag != NULL;i++)
{
if( fp_FieldFmts[i].m_Type == FType )
break;
}
UT_Win32LocaleString str;
for (;fp_FieldFmts[i].m_Tag != NULL && fp_FieldFmts[i].m_Type == FType;i++)
{
if((fp_FieldFmts[i].m_Num != FPFIELD_endnote_anch) &&
(fp_FieldFmts[i].m_Num != FPFIELD_endnote_ref) &&
(fp_FieldFmts[i].m_Num != FPFIELD_footnote_anch) &&
(fp_FieldFmts[i].m_Num != FPFIELD_footnote_ref))
{
str.fromUTF8(fp_FieldFmts[i].m_Desc);
UT_sint32 index = SendMessageW(m_hwndFormats, LB_ADDSTRING, 0, (LPARAM)str.c_str());
if (index != LB_ERR && index != LB_ERRSPACE)
{
SendMessageW(m_hwndFormats, LB_SETITEMDATA, (WPARAM)index, (LPARAM)i);
}
}
}
SendMessageW(m_hwndFormats, LB_SETCURSEL, 0, 0);
_FormatListBoxChange();
}
示例3:
void XAP_Win32DialogBase::setDialogTitle(const char* uft8_str)
{
UT_return_if_fail(IsWindow(m_hDlg));
UT_Win32LocaleString str;
str.fromUTF8 (uft8_str);
SetWindowTextW (m_hDlg, str.c_str());
}
示例4: SendDlgItemMessageW
int XAP_Win32DialogBase::addItemToCombo(UT_sint32 controlId, LPCSTR p_str)
{
UT_return_val_if_fail(IsWindow(m_hDlg), CB_ERR);
UT_Win32LocaleString str;
str.fromUTF8 (p_str);
return SendDlgItemMessageW(m_hDlg, controlId, CB_ADDSTRING, 0, (LPARAM)str.c_str());
}
示例5: SetDlgItemTextW
bool XAP_Win32DialogBase::setDlgItemText(HWND hWnd, int nIDDlgItem, const char* uft8_str)
{
UT_return_val_if_fail(IsWindow(hWnd), false);
UT_Win32LocaleString str;
str.fromUTF8 (uft8_str);
return (bool) SetDlgItemTextW (hWnd, nIDDlgItem, str.c_str());
}
示例6: CreatePen
/*
Draws the Format button with an arrow
*/
void AP_Win32Dialog_Styles::_onDrawButton(LPDRAWITEMSTRUCT lpDrawItemStruct, HWND hWnd)
{
UINT uiState = lpDrawItemStruct->itemState;
HPEN hPen;
HPEN pOldPen;
HDC hdc = lpDrawItemStruct->hDC;
int nWidth;
int nHeight;
int x, xEnd, xStart;
int y;
POINT p;
const char* pText;
HWND hParent;
LONG lData;
UT_Win32LocaleString str;
const XAP_StringSet * pSS = m_pApp->getStringSet();
pText= pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyFormat);
nWidth = lpDrawItemStruct->rcItem.right - lpDrawItemStruct->rcItem.left;
nHeight = lpDrawItemStruct->rcItem.bottom - lpDrawItemStruct->rcItem.top;
// set the pen color
if (uiState&ODS_DISABLED)
hPen = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_GRAYTEXT));
else
hPen = CreatePen(PS_SOLID, 0, GetSysColor(COLOR_BTNTEXT));
pOldPen = (HPEN) SelectObject(hdc, hPen);
// draw the border of the button
if(uiState&ODS_SELECTED)
DrawFrameControl(hdc, &lpDrawItemStruct->rcItem, DFC_BUTTON, DFCS_BUTTONPUSH|DFCS_PUSHED);
else
DrawFrameControl(hdc, &lpDrawItemStruct->rcItem, DFC_BUTTON, DFCS_BUTTONPUSH);
// Draw arrow
y = nHeight/2;
xStart = (nWidth/6)*5;
for (int i=0; i<4; i++)
{
x = xStart + i;
xEnd = xStart + 7 - i;
::MoveToEx(hdc, x, y, &p);
::LineTo(hdc, xEnd, y);
y++;
}
str.fromUTF8(pText);
ExtTextOutW(hdc, (nWidth/6)*1, ((nHeight/4)), 0, NULL, str.c_str(), str.length(), NULL);
// Clean Up
SelectObject(hdc, pOldPen);
DeleteObject(hPen);
}
示例7:
// cmdline processing call back I reckon
void AP_Win32App::errorMsgBadArg(const char *msg)
{
char *pszMessage;
UT_Win32LocaleString str;
pszMessage = g_strdup_printf ("%s\nRun with --help' to see a full list of available command line options.\n", msg);
str.fromUTF8(pszMessage);
MessageBoxW(NULL, str.c_str(), L"Command Line Option Error", MB_OK|MB_ICONERROR);
g_free( pszMessage );
}
示例8:
void AP_Win32Dialog_Field::SetTypesList(void)
{
UT_Win32LocaleString str;
for (int i = 0;fp_FieldTypes[i].m_Desc != NULL;i++)
{
str.fromUTF8(fp_FieldTypes[i].m_Desc);
SendMessageW(m_hwndTypes, LB_ADDSTRING, (WPARAM)0, (LPARAM)str.c_str());
}
SendMessageW(m_hwndTypes, LB_SETCURSEL, (WPARAM)0, (LPARAM)0);
m_iTypeIndex = 0;
}
示例9:
void AP_Win32Dialog_CollaborationAccounts::_populateWindowData()
{
AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager();
UT_return_if_fail(pManager);
m_bPopulating = true;
// clear out the old contents, if any
ListView_DeleteAllItems(m_hAccountList);
for (UT_uint32 i = 0; i < pManager->getAccounts().size(); i++)
{
AccountHandler* pAccount = pManager->getAccounts()[i];
UT_continue_if_fail(pAccount);
UT_Win32LocaleString sAccountText = AP_Win32App::s_fromUTF8ToWinLocale(pAccount->getDescription().utf8_str());
UT_Win32LocaleString sAccountTypeText = AP_Win32App::s_fromUTF8ToWinLocale(pAccount->getDisplayType().utf8_str());
// insert a new account record
LVITEMW lviAccount;
lviAccount.mask = LVIF_STATE | LVIF_IMAGE | LVIF_PARAM;
lviAccount.state = 1;
lviAccount.iItem = i;
lviAccount.iSubItem = 0;
lviAccount.lParam = (LPARAM)pAccount;
SendMessageW(m_hAccountList, LVM_INSERTITEMW, 0, (LPARAM) &lviAccount);
ListView_SetCheckState(m_hAccountList, i, pAccount->isOnline());
lviAccount.iSubItem=1;
lviAccount.pszText= const_cast<LPWSTR>(sAccountText.c_str());
SendMessageW(m_hAccountList, LVM_SETITEMTEXTW, i, (LPARAM) &lviAccount);
lviAccount.iSubItem=2;
lviAccount.pszText= const_cast<LPWSTR>(sAccountTypeText.c_str());
SendMessageW(m_hAccountList, LVM_SETITEMTEXTW, i, (LPARAM) &lviAccount);
}
_updateSelection();
m_bPopulating = false;
}
示例10: s_createDirectoryIfNecessary
static bool s_createDirectoryIfNecessary(const char * szDir)
{
struct _stat statbuf;
UT_Win32LocaleString str;
str.fromUTF8(szDir);
if (_wstat(str.c_str(),&statbuf) == 0) // if it exists
{
if ( (statbuf.st_mode & _S_IFDIR) == _S_IFDIR ) // and is a directory
return true;
UT_DEBUGMSG(("Pathname [%s] is not a directory.\n",szDir));
return false;
}
if (CreateDirectoryW(str.c_str(),NULL))
return true;
UT_DEBUGMSG(("Could not create Directory [%s].\n",szDir));
return false;
}
示例11: 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;
}
示例12: strlen
/*
Does a stringSet exist on disk?
*/
bool AP_Win32App::doesStringSetExist(const char* pLocale)
{
HANDLE in;
const char * szDirectory = NULL;
UT_return_val_if_fail(pLocale, false);
getPrefsValueDirectory(true,AP_PREF_KEY_StringSetDirectory,&szDirectory);
UT_return_val_if_fail(((szDirectory) && (*szDirectory)), false);
char *szPathname = (char*) UT_calloc(sizeof(char),strlen(szDirectory)+strlen(pLocale)+100);
UT_return_val_if_fail(szPathname, false);
char *szDest = szPathname;
strcpy(szDest, szDirectory);
szDest += strlen(szDest);
if ((szDest > szPathname) && (szDest[-1]!='\\'))
*szDest++='\\';
lstrcpyA(szDest,pLocale);
lstrcatA(szDest,".strings");
UT_Win32LocaleString wsFilename;
wsFilename.fromUTF8(szPathname);
in = CreateFileW(wsFilename.c_str(),0,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,
OPEN_EXISTING,0,NULL);
g_free (szPathname);
if (in!=INVALID_HANDLE_VALUE)
{
CloseHandle(in);
return true;
}
return false;
}
示例13: GetDlgItem
BOOL AP_Win32Dialog_Paragraph::_onInitDialog(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
const XAP_StringSet * pSS = m_pApp->getStringSet();
setDialogTitle (pSS->getValue(AP_STRING_ID_DLG_Para_ParaTitle));
// localize controls
_DSX(PARA_BTN_OK, DLG_OK);
_DSX(PARA_BTN_CANCEL, DLG_Cancel);
_DS(PARA_BTN_TABS, DLG_Para_ButtonTabs);
// setup the tabs
{
TabParam tp;
TCITEMW tie;
XAP_Win32App * pWin32App = static_cast<XAP_Win32App *>(m_pApp);
HINSTANCE hinst = pWin32App->getInstance();
DLGTEMPLATE * pTemplate = NULL;
HWND w = NULL;
tp.pThis = this;
// remember the windows we're using
m_hwndDlg = hWnd;
m_hwndTab = GetDlgItem(hWnd, AP_RID_DIALOG_PARA_TAB);
// add a tab for each of the child dialog boxes
UT_Win32LocaleString str;
tie.mask = TCIF_TEXT | TCIF_IMAGE | TCIF_PARAM;
tie.iImage = -1;
str.fromUTF8(_GV(DLG_Para_TabLabelIndentsAndSpacing));
tie.pszText = (LPWSTR)str.c_str();
tie.lParam = AP_RID_DIALOG_PARA_TAB1;
SendMessageW(m_hwndTab, TCM_INSERTITEMW, 0, (LPARAM)&tie);
str.fromUTF8(_GV(DLG_Para_TabLabelLineAndPageBreaks));
tie.pszText = (LPWSTR)str.c_str();
tie.lParam = AP_RID_DIALOG_PARA_TAB2;
SendMessageW(m_hwndTab, TCM_INSERTITEMW, 1, (LPARAM)&tie);
// finally, create the (modeless) child dialogs
tp.which = AP_RID_DIALOG_PARA_TAB1;
pTemplate = UT_LockDlgRes(hinst, MAKEINTRESOURCEW(tp.which));
w = CreateDialogIndirectParamW(hinst, pTemplate, m_hwndTab,
(DLGPROC)s_tabProc, (LPARAM)&tp);
UT_ASSERT_HARMLESS((w && (w == m_hwndSpacing)));
tp.which = AP_RID_DIALOG_PARA_TAB2;
pTemplate = UT_LockDlgRes(hinst, MAKEINTRESOURCEW(tp.which));
w = CreateDialogIndirectParamW(hinst, pTemplate, m_hwndTab,
(DLGPROC)s_tabProc, (LPARAM)&tp);
UT_ASSERT_HARMLESS((w && (w == m_hwndBreaks)));
}
// HACK: make sure the first tab is visible
// TODO: trigger selchange logic instead
ShowWindow(m_hwndSpacing, SW_SHOW);
// sync all controls once to get started
// HACK: the first arg gets ignored
_syncControls(id_MENU_ALIGNMENT, true);
centerDialog();
return 1; // 1 == we did not call SetFocus()
}
示例14: HIWORD
//.........这里部分代码省略.........
return 1;
case AP_RID_DIALOG_STYLES_TOP_LIST_STYLES:
if (wNotifyCode == LBN_SELCHANGE)
{
UT_uint32 nData = -1;
const char* name;
const PD_Style * pcStyle = NULL;
int row = _win32Dialog.getListSelectedIndex(AP_RID_DIALOG_STYLES_TOP_LIST_STYLES);
nData = _win32Dialog.getListDataItem( AP_RID_DIALOG_STYLES_TOP_LIST_STYLES, row);
if (row!=LB_ERR)
{
getDoc()->enumStyles(nData, &name, &pcStyle);
m_selectedStyle = name;
m_nSelectedStyleIdx = nData;
// refresh the previews
_populatePreviews(false);
}
break;
}
return 1;
case AP_RID_DIALOG_STYLES_TOP_BUTTON_DELETE:
{
if( m_selectedStyle != "" )
{
if ( !getDoc()->removeStyle(m_selectedStyle.c_str()) ) // actually remove the style
{
const XAP_StringSet * pSS = m_pApp->getStringSet();
getFrame()->showMessageBox( pSS->getValue (AP_STRING_ID_DLG_Styles_ErrStyleCantDelete),
XAP_Dialog_MessageBox::b_O,
XAP_Dialog_MessageBox::a_OK );
return 1;
}
getFrame()->repopulateCombos();
_populateWindowData(); // force a refresh
getDoc()->signalListeners(PD_SIGNAL_UPDATE_LAYOUT);
m_selectedStyle = "";
}
}
return 1;
case AP_RID_DIALOG_STYLES_TOP_BUTTON_NEW:
{
m_bisNewStyle = true;
//_win32Dialog.showWindow(SW_HIDE);
XAP_Frame* pFrame = getFrame();
//_win32DialogNewModify.runModal(pFrame, AP_DIALOG_ID_STYLES, AP_RID_DIALOG_STYLES_NEWMODIFY, this);
createModal(pFrame, MAKEINTRESOURCEW(AP_RID_DIALOG_STYLES_NEWMODIFY));
if(m_answer == AP_Dialog_Styles::a_OK)
{
createNewStyle((gchar *) m_newStyleName);
_populateCList();
}
destroyAbiPreview();
DELETEP(m_pAbiPreviewWidget);
//_win32Dialog.showWindow(SW_SHOW);
}
return 1;
示例15: GetDlgItem
//.........这里部分代码省略.........
delete pStyles;
// Strings (not styles names)
const char* pDefCurrent = pSS->getValue(AP_STRING_ID_DLG_Styles_DefCurrent);
const char* pDefNone = pSS->getValue(AP_STRING_ID_DLG_Styles_DefNone);
nIndex = _win32DialogNewModify.addItemToCombo( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA,
pDefCurrent );
_win32DialogNewModify.setComboDataItem(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA,
nIndex, (DWORD)-1);
nIndex = _win32DialogNewModify.addItemToCombo( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON,
pDefNone);
_win32DialogNewModify.setComboDataItem(AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON,
nIndex, (DWORD)-1);
if( m_bisNewStyle )
{
const char* p = pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyParagraph);
_win32DialogNewModify.addItemToCombo( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE,
p );
p = pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyCharacter);
_win32DialogNewModify.addItemToCombo( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE,
p);
// Set the Default syltes: none, default current
UT_sint32 result;
str.fromUTF8(pSS->getValue(AP_STRING_ID_DLG_Styles_DefNone));
result = SendDlgItemMessageW(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, CB_FINDSTRING, -1,
(LPARAM) str.c_str());
_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_BASEDON, result );
str.fromUTF8(pSS->getValue(AP_STRING_ID_DLG_Styles_DefCurrent));
result = SendDlgItemMessageW(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, CB_FINDSTRING, -1,
(LPARAM) str.c_str());
_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_FOLLOWPARA, result );
str.fromUTF8(pSS->getValue(AP_STRING_ID_DLG_Styles_ModifyParagraph));
result = SendDlgItemMessageW(hWnd, AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE, CB_FINDSTRING, -1,
(LPARAM) str.c_str());
_win32DialogNewModify.selectComboItem( AP_RID_DIALOG_STYLES_NEWMODIFY_CBX_TYPE, result );
eventBasedOn();
eventFollowedBy();
eventStyleType();
fillVecFromCurrentPoint();
}
else
{
const char * szCurrentStyle = NULL;
const char * szBasedOn = NULL;
const char * szFollowedBy = NULL;
const char * pLocalised = NULL;
PD_Style * pStyle = NULL;
PD_Style * pBasedOnStyle = NULL;
PD_Style * pFollowedByStyle = NULL;
szCurrentStyle = m_selectedStyle.c_str();
pt_PieceTable::s_getLocalisedStyleName(szCurrentStyle, utf8);
pLocalised = utf8.utf8_str();