本文整理汇总了C++中NativeLangSpeaker::getAttrNameStr方法的典型用法代码示例。如果您正苦于以下问题:C++ NativeLangSpeaker::getAttrNameStr方法的具体用法?C++ NativeLangSpeaker::getAttrNameStr怎么用?C++ NativeLangSpeaker::getAttrNameStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NativeLangSpeaker
的用法示例。
在下文中一共展示了NativeLangSpeaker::getAttrNameStr方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void ListView::init(HINSTANCE hInst, HWND parent)
{
Window::init(hInst, parent);
INITCOMMONCONTROLSEX icex;
// Ensure that the common control DLL is loaded.
icex.dwSize = sizeof(INITCOMMONCONTROLSEX);
icex.dwICC = ICC_LISTVIEW_CLASSES;
InitCommonControlsEx(&icex);
// Create the list-view window in report view with label editing enabled.
int listViewStyles = LVS_REPORT | LVS_NOSORTHEADER\
| LVS_SINGLESEL | LVS_AUTOARRANGE\
| LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS;
_hSelf = ::CreateWindow(WC_LISTVIEW,
TEXT(""),
WS_CHILD | listViewStyles,
0,
0,
0,
0,
_hParent,
(HMENU) NULL,
hInst,
NULL);
if (!_hSelf)
{
throw std::runtime_error("ListView::init : CreateWindowEx() function return null");
}
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, (LONG_PTR)this);
_defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, (LONG_PTR)staticProc));
DWORD exStyle = ListView_GetExtendedListViewStyle(_hSelf);
exStyle |= LVS_EX_FULLROWSELECT | LVS_EX_BORDERSELECT ;
ListView_SetExtendedListViewStyle(_hSelf, exStyle);
LVCOLUMN lvColumn;
lvColumn.mask = LVCF_TEXT|LVCF_WIDTH;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string valStr = pNativeSpeaker->getAttrNameStr(TEXT("Value"), "AsciiInsertion", "ColumnVal");
generic_string hexStr = pNativeSpeaker->getAttrNameStr(TEXT("Hex"), "AsciiInsertion", "ColumnHex");
generic_string charStr = pNativeSpeaker->getAttrNameStr(TEXT("Character"), "AsciiInsertion", "ColumnChar");
lvColumn.cx = 45;
lvColumn.pszText = (TCHAR *)valStr.c_str();
ListView_InsertColumn(_hSelf, 0, &lvColumn);
lvColumn.cx = 45;
lvColumn.pszText = (TCHAR *)hexStr.c_str();
ListView_InsertColumn(_hSelf, 1, &lvColumn);
lvColumn.cx = 70;
lvColumn.pszText = (TCHAR *)charStr.c_str();
ListView_InsertColumn(_hSelf, 2, &lvColumn);
}
示例2: initList
void VerticalFileSwitcherListView::initList()
{
TaskListInfo taskListInfo;
static HWND nppHwnd = ::GetParent(_hParent);
::SendMessage(nppHwnd, WM_GETTASKLISTINFO, (WPARAM)&taskListInfo, TRUE);
NppParameters *nppParams = NppParameters::getInstance();
NativeLangSpeaker *pNativeSpeaker = nppParams->getNativeLangSpeaker();
bool isExtColumn = !nppParams->getNppGUI()._fileSwitcherWithoutExtColumn;
RECT rc;
::GetClientRect(_hParent, &rc);
int totalWidth = rc.right - rc.left;
generic_string nameStr = pNativeSpeaker->getAttrNameStr(TEXT("Name"), FS_ROOTNODE, FS_CLMNNAME);
//insertColumn(nameStr.c_str(), 150, 0);
insertColumn(nameStr.c_str(), (isExtColumn ? totalWidth - 50 : totalWidth), 0);
//bool isExtColumn = !nppParams->getNppGUI()._fileSwitcherWithoutExtColumn;
if (isExtColumn)
{
generic_string extStr = pNativeSpeaker->getAttrNameStr(TEXT("Ext."), FS_ROOTNODE, FS_CLMNEXT);
insertColumn(extStr.c_str(), 50, 1);
}
for (size_t i = 0, len = taskListInfo._tlfsLst.size(); i < len ; ++i)
{
TaskLstFnStatus & fileNameStatus = taskListInfo._tlfsLst[i];
TaskLstFnStatus *tl = new TaskLstFnStatus(fileNameStatus._iView, fileNameStatus._docIndex, fileNameStatus._fn, fileNameStatus._status, (void *)fileNameStatus._bufID);
TCHAR fn[MAX_PATH];
lstrcpy(fn, ::PathFindFileName(fileNameStatus._fn.c_str()));
if (isExtColumn)
{
::PathRemoveExtension(fn);
}
LVITEM item;
item.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM;
item.pszText = fn;
item.iItem = static_cast<int32_t>(i);
item.iSubItem = 0;
item.iImage = fileNameStatus._status;
item.lParam = (LPARAM)tl;
ListView_InsertItem(_hSelf, &item);
if (isExtColumn)
{
ListView_SetItemText(_hSelf, i, 1, (LPTSTR)::PathFindExtension(fileNameStatus._fn.c_str()));
}
}
ListView_SetItemState(_hSelf, taskListInfo._currentIndex, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
}
示例3: newWorkSpace
void ProjectPanel::newWorkSpace()
{
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string workspace = pNativeSpeaker->getAttrNameStr(PM_WORKSPACEROOTNAME, "ProjectManager", "WorkspaceRootName");
_treeView.addItem(workspace.c_str(), TVI_ROOT, INDEX_CLEAN_ROOT);
setWorkSpaceDirty(false);
_workSpaceFilePath = TEXT("");
}
示例4: openWorkSpace
bool ProjectPanel::openWorkSpace(const TCHAR *projectFileName)
{
TiXmlDocument *pXmlDocProject = new TiXmlDocument(projectFileName);
bool loadOkay = pXmlDocProject->LoadFile();
if (!loadOkay)
return false;
TiXmlNode *root = pXmlDocProject->FirstChild(TEXT("NotepadPlus"));
if (!root)
return false;
TiXmlNode *childNode = root->FirstChildElement(TEXT("Project"));
if (!childNode)
return false;
if (!::PathFileExists(projectFileName))
return false;
_treeView.removeAllItems();
_workSpaceFilePath = projectFileName;
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string workspace = pNativeSpeaker->getAttrNameStr(PM_WORKSPACEROOTNAME, "ProjectManager", "WorkspaceRootName");
HTREEITEM rootItem = _treeView.addItem(workspace.c_str(), TVI_ROOT, INDEX_CLEAN_ROOT);
for ( ; childNode ; childNode = childNode->NextSibling(TEXT("Project")))
{
HTREEITEM projectItem = _treeView.addItem((childNode->ToElement())->Attribute(TEXT("name")), rootItem, INDEX_PROJECT);
buildTreeFrom(childNode, projectItem);
}
setWorkSpaceDirty(false);
_treeView.expand(rootItem);
delete pXmlDocProject;
return loadOkay;
}
示例5: popupMenuCmd
void ProjectPanel::popupMenuCmd(int cmdID)
{
// get selected item handle
HTREEITEM hTreeItem = _treeView.getSelection();
if (!hTreeItem)
return;
switch (cmdID)
{
//
// Toolbar menu buttons
//
case IDB_PROJECT_BTN:
{
POINT p = getMenuDisplayPoint(0);
TrackPopupMenu(_hWorkSpaceMenu, TPM_LEFTALIGN, p.x, p.y, 0, _hSelf, NULL);
}
break;
case IDB_EDIT_BTN:
{
POINT p = getMenuDisplayPoint(1);
HMENU hMenu = NULL;
NodeType nodeType = getNodeType(hTreeItem);
if (nodeType == nodeType_project)
hMenu = _hProjectMenu;
else if (nodeType == nodeType_folder)
hMenu = _hFolderMenu;
else if (nodeType == nodeType_file)
hMenu = _hFileMenu;
if (hMenu)
TrackPopupMenu(hMenu, TPM_LEFTALIGN, p.x, p.y, 0, _hSelf, NULL);
}
break;
//
// Toolbar menu commands
//
case IDM_PROJECT_NEWPROJECT :
{
HTREEITEM root = _treeView.getRoot();
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string newProjectLabel = pNativeSpeaker->getAttrNameStr(PM_NEWPROJECTNAME, "ProjectManager", "NewProjectName");
HTREEITEM addedItem = _treeView.addItem(newProjectLabel.c_str(), root, INDEX_PROJECT);
setWorkSpaceDirty(true);
_treeView.expand(hTreeItem);
TreeView_EditLabel(_treeView.getHSelf(), addedItem);
}
break;
case IDM_PROJECT_NEWWS :
{
if (_isDirty)
{
int res = ::MessageBox(_hSelf, TEXT("The current workspace was modified. Do you want to save the current project?"), TEXT("New Workspace"), MB_YESNOCANCEL | MB_ICONQUESTION | MB_APPLMODAL);
if (res == IDYES)
{
if (!saveWorkSpace())
return;
}
else if (res == IDNO)
{
// Don't save so do nothing here
}
else if (res == IDCANCEL)
{
// User cancels action "New Workspace" so we interrupt here
return;
}
}
_treeView.removeAllItems();
newWorkSpace();
}
break;
case IDM_PROJECT_RENAME :
TreeView_EditLabel(_treeView.getHSelf(), hTreeItem);
break;
case IDM_PROJECT_NEWFOLDER :
{
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
generic_string newFolderLabel = pNativeSpeaker->getAttrNameStr(PM_NEWFOLDERNAME, "ProjectManager", "NewFolderName");
addFolder(hTreeItem, newFolderLabel.c_str());
setWorkSpaceDirty(true);
}
break;
case IDM_PROJECT_MOVEDOWN :
{
if (_treeView.moveDown(hTreeItem))
setWorkSpaceDirty(true);
}
break;
case IDM_PROJECT_MOVEUP :
{
if (_treeView.moveUp(hTreeItem))
setWorkSpaceDirty(true);
//.........这里部分代码省略.........
示例6: run_dlgProc
INT_PTR CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
// Make edit field red if not found
case WM_CTLCOLOREDIT :
{
// if the text not found modify the background color of the editor
static HBRUSH hBrushBackground = CreateSolidBrush(BCKGRD_COLOR);
TCHAR text2search[MAX_PATH] ;
::SendMessage(_hSearchEdit, WM_GETTEXT, MAX_PATH, reinterpret_cast<LPARAM>(text2search));
if (text2search[0] == '\0')
{
return FALSE; // no text, use the default color
}
HTREEITEM searchViewRoot = _treeViewSearchResult.getRoot();
if (searchViewRoot)
{
if (_treeViewSearchResult.getChildFrom(searchViewRoot))
return FALSE; // children on root found, use the default color
}
else
return FALSE; // no root (no parser), use the default color
// text not found
SetTextColor((HDC)wParam, TXT_COLOR);
SetBkColor((HDC)wParam, BCKGRD_COLOR);
return (LRESULT)hBrushBackground;
}
case WM_INITDIALOG :
{
int editWidth = NppParameters::getInstance()->_dpiManager.scaleX(100);
int editWidthSep = NppParameters::getInstance()->_dpiManager.scaleX(105); //editWidth + 5
int editHeight = NppParameters::getInstance()->_dpiManager.scaleY(20);
// Create toolbar menu
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | BTNS_AUTOSIZE | BTNS_SEP | TBSTYLE_TOOLTIPS;
_hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style,
0,0,0,0,_hSelf,nullptr, _hInst, NULL);
oldFunclstToolbarProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hToolbarMenu, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(funclstToolbarProc)));
TBBUTTON tbButtons[3];
// Add the bmap image into toolbar's imagelist
TBADDBITMAP addbmp = {_hInst, 0};
addbmp.nID = IDI_FUNCLIST_SORTBUTTON;
::SendMessage(_hToolbarMenu, TB_ADDBITMAP, 1, reinterpret_cast<LPARAM>(&addbmp));
addbmp.nID = IDI_FUNCLIST_RELOADBUTTON;
::SendMessage(_hToolbarMenu, TB_ADDBITMAP, 1, reinterpret_cast<LPARAM>(&addbmp));
// Place holder of search text field
tbButtons[0].idCommand = 0;
tbButtons[0].iBitmap = editWidthSep;
tbButtons[0].fsState = TBSTATE_ENABLED;
tbButtons[0].fsStyle = BTNS_SEP; //This is just a separator (blank space)
tbButtons[0].iString = 0;
tbButtons[1].idCommand = IDC_SORTBUTTON_FUNCLIST;
tbButtons[1].iBitmap = 0;
tbButtons[1].fsState = TBSTATE_ENABLED;
tbButtons[1].fsStyle = BTNS_CHECK | BTNS_AUTOSIZE;
tbButtons[1].iString = reinterpret_cast<INT_PTR>(TEXT(""));
tbButtons[2].idCommand = IDC_RELOADBUTTON_FUNCLIST;
tbButtons[2].iBitmap = 1;
tbButtons[2].fsState = TBSTATE_ENABLED;
tbButtons[2].fsStyle = BTNS_BUTTON | BTNS_AUTOSIZE;
tbButtons[2].iString = reinterpret_cast<INT_PTR>(TEXT(""));
::SendMessage(_hToolbarMenu, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0);
::SendMessage(_hToolbarMenu, TB_SETBUTTONSIZE, 0, MAKELONG(16, 16));
::SendMessage(_hToolbarMenu, TB_ADDBUTTONS, sizeof(tbButtons) / sizeof(TBBUTTON), reinterpret_cast<LPARAM>(&tbButtons));
::SendMessage(_hToolbarMenu, TB_AUTOSIZE, 0, 0);
ShowWindow(_hToolbarMenu, SW_SHOW);
// tips text for toolbar buttons
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance())->getNativeLangSpeaker();
_sortTipStr = pNativeSpeaker->getAttrNameStr(_sortTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_SORTLOCALNODENAME);
_reloadTipStr = pNativeSpeaker->getAttrNameStr(_reloadTipStr.c_str(), FL_FUCTIONLISTROOTNODE, FL_RELOADLOCALNODENAME);
_hSearchEdit = CreateWindowEx(0, L"Edit", NULL,
WS_CHILD | WS_BORDER | WS_VISIBLE | ES_AUTOVSCROLL,
2, 2, editWidth, editHeight,
_hToolbarMenu, reinterpret_cast<HMENU>(IDC_SEARCHFIELD_FUNCLIST), _hInst, 0 );
HFONT hf = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
if (hf)
::SendMessage(_hSearchEdit, WM_SETFONT, reinterpret_cast<WPARAM>(hf), MAKELPARAM(TRUE, 0));
_treeViewSearchResult.init(_hInst, _hSelf, IDC_LIST_FUNCLIST_AUX);
_treeView.init(_hInst, _hSelf, IDC_LIST_FUNCLIST);
setTreeViewImageList(IDI_FUNCLIST_ROOT, IDI_FUNCLIST_NODE, IDI_FUNCLIST_LEAF);
_treeView.display();
return TRUE;
}
case WM_DESTROY:
//.........这里部分代码省略.........