void CTDLFindTaskAttributeComboBox::BuildCombo() { ResetContent(); CLocalizer::EnableTranslation(*this, FALSE); int nAttrib; for (nAttrib = 0; nAttrib < ATTRIB_COUNT; nAttrib++) { const TDCATTRIBUTE& ap = ATTRIBUTES[nAttrib]; if (ap.nAttribResID) { CEnString sAttrib(ap.nAttribResID); DWORD dwItemData = EncodeItemData(ap.attrib, FALSE); int nItem = AddString(sAttrib); SetItemData(nItem, dwItemData); // is it a date // then add relative version too if (AttributeIsDate(ap.attrib)) { dwItemData = EncodeItemData(ap.attrib, TRUE); sAttrib += ' '; sAttrib += CEnString(IDS_TDLBC_RELATIVEDATESUFFIX); nItem = AddString(sAttrib); SetItemData(nItem, dwItemData); } } } // custom attributes for (nAttrib = 0; nAttrib < m_aAttribDefs.GetSize(); nAttrib++) { const TDCCUSTOMATTRIBUTEDEFINITION& attribDef = m_aAttribDefs[nAttrib]; CEnString sAttrib(IDS_CUSTOMCOLUMN, attribDef.sLabel); TDC_ATTRIBUTE attrib = attribDef.GetAttributeID(); int nItem = AddString(sAttrib); DWORD dwItemData = EncodeItemData(attrib, FALSE); SetItemData(nItem, dwItemData); // is it a date if (AttributeIsDate(attrib)) { dwItemData = EncodeItemData(attrib, TRUE); sAttrib.Format(IDS_CUSTOMRELDATECOLUMN, attribDef.sLabel); nItem = AddString(sAttrib); SetItemData(nItem, dwItemData); } } // recalc combo drop width CDialogHelper::RefreshMaxDropWidth(*this); }
// Updates the contents of the listbox void CClassList::UpdateContents(BOOL bShowTemplates) { CEditProjectMgr *pProject=GetProject(); if(!pProject) return; // Remove the current contents ResetContent(); // Add the classes to the listbox int i; for(i=0; i < pProject->m_nClassDefs; i++) { if (!(pProject->m_ClassDefs[i].m_ClassFlags & CF_HIDDEN)) { AddString(pProject->m_ClassDefs[i].m_ClassName); } } // Include the template classes if (bShowTemplates) { for(i=0; i < pProject->m_TemplateClasses; i++) { AddString(pProject->m_TemplateClasses[i]->m_ClassName); } } }
BOOL CSearchBox::InitStocks( BOOL bHasSTTTech, BOOL bShowOnSel, BOOL bDuplicate ) { ResetContent( ); m_bShowOnSel = bShowOnSel; CStockContainer & container = AfxGetStockContainer(); InitStorage( bDuplicate ? container.GetSize()*2 : container.GetSize(), 32 ); for( int i=0; i<container.GetSize(); i++ ) { CStockInfo & info = container.ElementAt(i); if( !info.IsValidStock() ) continue; CString strTemp = info.GetStockCode(); while( strTemp.GetLength() < 8 ) strTemp += ' '; strTemp += info.GetStockName(); int nItem = AddString( strTemp ); SetItemData( nItem, i ); if( bDuplicate ) { strTemp = info.GetStockShortName(); while( strTemp.GetLength() < 8 ) strTemp += ' '; strTemp += info.GetStockName(); if( CB_ERR == SelectString( 0, strTemp ) ) { nItem = AddString( strTemp ); SetItemData( nItem, i ); } } } if( bHasSTTTech ) { // 技术指标项 UINT nTechUserCount = CTechUser::GetTechUserCount(); for( UINT i=STT_MIN; i <= STT_MAX+nTechUserCount; i ++ ) { UINT nTech = i; if( nTech > STT_MAX ) nTech = i-STT_MAX-1+STT_USER_MIN; CString strTemp = AfxGetSTTShortName( nTech ); while( strTemp.GetLength() < 8 ) strTemp += ' '; strTemp += AfxGetSTTName( nTech ); int nItem = AddString( strTemp ); SetItemData( nItem, nTech | SEARCHBOX_SIGNBIT_STT ); } // 快捷键项 for( UINT i = ACCE_MIN; i <= ACCE_MAX; i++ ) { CString strTemp = AfxGetAccelerator( i, 8 ); SetItemData( AddString(strTemp), i | SEARCHBOX_SIGNBIT_ACCE ); } } return TRUE; }
void CBetPoolListBox::DeleteAllIndex() { for (int i=0; i< GetCount(); i++) { PoolBox_AppendData * pData = (PoolBox_AppendData *)GetItemDataPtr(i); if ( NULL != pData ) { delete pData->pSta0; pData->pSta0 = NULL ; delete pData->pBut2; pData->pBut2 = NULL ; delete pData->pSta1; pData->pSta1 = NULL ; delete pData->pSta3; pData->pSta3 = NULL; delete pData->pSta2; pData->pSta2 = NULL ; delete pData; pData = NULL; } } ResetContent(); m_mButton.clear(); }
void COXHistoryCombo::SetContents(LPCTSTR pszContents) { ASSERT_VALID(this); CString sContents(pszContents); // First remove everuthing from the combo ResetContent(); // Then add all new the items LPTSTR pszItem = sContents.GetBuffer(0); DWORD nIndex = 0; TCHAR * p; pszItem = UTBStr::tcstok(pszItem, ITEM_SEPERATOR, &p); // ... Cast to DWORD so that -1 becomes a very large number while ((nIndex < (DWORD)m_nMaxHistoryCount) && (pszItem != NULL)) { AddString(pszItem); pszItem = UTBStr::tcstok(NULL, ITEM_SEPERATOR, &p); } sContents.ReleaseBuffer(); ASSERT_VALID(this); }
//****************************************************************************** void CBCGPRibbonCommandsListBox::FillFromCategory (CBCGPRibbonCategory* pCategory) { ASSERT_VALID (this); ResetContent (); m_nTextOffset = 0; if (pCategory == NULL) { return; } ASSERT_VALID (pCategory); CArray<CBCGPBaseRibbonElement*, CBCGPBaseRibbonElement*> arElements; pCategory->GetElements (arElements); FillFromArray (arElements, TRUE, TRUE); if (m_pSeparator != NULL) { ASSERT_VALID (m_pSeparator); m_pSeparator->AddToListBox (this, FALSE); } }
bool CXTPSyntaxEditColorComboBox::Init() { // MFCBUG: adjust height so display is the same as non-owner drawn // CComboBoxes. MFC sets the height of an owner-drawn CComboBox // 2-3 pixels larger than a non owner-drawn combo. SetItemHeight(-1, (::GetSystemMetrics(SM_CYVTHUMB)-::GetSystemMetrics(SM_CYEDGE))); ResetContent(); AddColor( RGB(0x00,0x00,0x00), XTP_IDS_CLR_BLACK ), AddColor( RGB(0xff,0xff,0xff), XTP_IDS_CLR_WHITE ), AddColor( RGB(0x80,0x00,0x00), XTP_IDS_CLR_MAROON ), AddColor( RGB(0x00,0x80,0x00), XTP_IDS_CLR_DARK_GREEN ), AddColor( RGB(0x80,0x80,0x00), XTP_IDS_CLR_OLIVE ), AddColor( RGB(0x00,0x00,0x80), XTP_IDS_CLR_DARK_BLUE ), AddColor( RGB(0x80,0x00,0x80), XTP_IDS_CLR_PURPLE ), AddColor( RGB(0x00,0x80,0x80), XTP_IDS_CLR_TEAL ), AddColor( RGB(0xC0,0xC0,0xC0), XTP_IDS_CLR_GRAY25 ), AddColor( RGB(0x80,0x80,0x80), XTP_IDS_CLR_GRAY50 ), AddColor( RGB(0xFF,0x00,0x00), XTP_IDS_CLR_RED ), AddColor( RGB(0x00,0xFF,0x00), XTP_IDS_CLR_GREEN ), AddColor( RGB(0xFF,0xFF,0x00), XTP_IDS_CLR_YELLOW ), AddColor( RGB(0x00,0x00,0xFF), XTP_IDS_CLR_BLUE ), AddColor( RGB(0xFF,0x00,0xFF), XTP_IDS_CLR_PINK ), AddColor( RGB(0x00,0xFF,0xFF), XTP_IDS_CLR_TURQUOISE ), SetCurSel(0); return true; }
void CClipboardListBox::OnRButtonUp(UINT nFlags, CPoint point) { const UINT_PTR IDM_SELECTALL = 0x80fb; const UINT_PTR IDM_COPY = 0x80fc; const UINT_PTR IDM_CLEAR = 0x80fd; CMenu menu; menu.CreatePopupMenu(); menu.InsertMenu(0, MF_BYPOSITION|MF_STRING, IDM_SELECTALL, "Select All"); menu.InsertMenu(1, MF_BYPOSITION|MF_STRING, IDM_COPY, "Copy"); menu.InsertMenu(2, MF_BYPOSITION|MF_STRING, IDM_CLEAR, "Clear"); this->ClientToScreen(&point); UINT_PTR cmd = menu.TrackPopupMenu(TPM_LEFTALIGN|TPM_TOPALIGN|TPM_RETURNCMD, point.x, point.y, this); if(IDM_COPY==cmd) { DoCopy(); } else if(IDM_CLEAR==cmd) { ResetContent(); } else if(IDM_SELECTALL==cmd) { SelectAll(); } return; //CListBox::OnRButtonUp(nFlags, point); }
// removes all the items from the history list, and optionally deletes // the registry items. Note that if the history list is generated from // a CRecentFileList, then registry entries will not be deleted void CHistoryCombo::ClearHistory(BOOL bDeleteRegistryEntries/*=TRUE*/) { ResetContent(); if (! m_sSection.IsEmpty() && bDeleteRegistryEntries) { // remove profile entries CWinApp* pApp = AfxGetApp(); ASSERT(pApp); CString sKey; for (int n = 0; n < 1000/* prevent runaway*/; n++) { sKey.Format(KEY_PREFIX_FORMAT, m_sKeyPrefix, n); CString sText = pApp->GetProfileString(m_sSection, sKey); if (sText.IsEmpty()) break; pApp->WriteProfileString(m_sSection, sKey, NULL); // remove entry } if (! m_sKeyCurItem.IsEmpty()) sKey = m_sKeyCurItem; else if (m_sKeyPrefix.IsEmpty()) sKey = _T("Last"); else sKey = m_sKeyPrefix; pApp->WriteProfileString(m_sSection, sKey, NULL); } }
BOOL CDomainListBox::SetCurrentStocks( int nType, LPCTSTR lpszDomain, CDomainContainer & groups ) { // Delete All ResetContent( ); CStockContainer & container = AfxGetStockContainer(); CStockContainer cntn; BOOL bOK = FALSE; if( nType == CStockContainer::typeGroup ) { CSPStringArray astrSpecify; if( groups.GetDomainStocks( lpszDomain, astrSpecify ) ) bOK = cntn.RetrieveSpecify( astrSpecify ); // Not Set dwDate } else { bOK = cntn.RetrieveFromStatic( nType, lpszDomain, NULL, -1 ); } if( bOK ) { InitStorage( cntn.GetSize(), 32 ); for( int i=0; i<cntn.GetSize(); i++ ) { CStockInfo & info = cntn.ElementAt(i); CString strItem = CString(info.GetStockCode()) + "(" + info.GetStockShortName() + ") "; while( strItem.GetLength() < 16 ) strItem += " "; strItem += info.GetStockName() ; int nItem = AddString( strItem ); } } return bOK; }
void CListBoxDiffMarks::setLines(const StringArray &lines) { const size_t lastSize = m_lastContent.size(); const size_t n = lines.size(); m_diffSetArray.clear(); for (size_t i = 0; i < n; i++) { const String &line = lines[i]; const size_t len = line.length(); BitSet diffSet(max(len, 10)); if(len > 0) { if (i >= lastSize) { diffSet.add(0,len-1); } else { const String &lastLine = m_lastContent[i]; const size_t lastLen = lastLine.length(); const size_t lmin = min(len, lastLen); const TCHAR *cp = line.cstr(), *lcp = lastLine.cstr(); size_t j; for (j = 0; j < lmin; j++) { if(*(cp++) != *(lcp++)) diffSet.add(j); } if(j < len) diffSet.add(j, len-1); } } m_diffSetArray.add(diffSet); } ResetContent(); for(size_t i = 0; i < lines.size(); i++) { AddString(EMPTYSTRING); } m_lastContent = lines; }
void CPropertyComboBox::updatePropertyDesc(const EdsPropertyDesc* desc) { // The content of the list is deleted. // Current settings values are not changed in some cases even if the list changes, so leave the selected text as it is CString ss; GetWindowText(ss); ResetContent(); SetWindowText(ss); // It makes it to disable when there is no value list that can be set. EnableWindow( desc->numElements != 0 ); for(int i = 0; i < desc->numElements; i++) { // The character string corresponding to data is acquired. std::map<EdsUInt32, const char *>::iterator itr = _propertyTable.find((EdsUInt32)desc->propDesc[i]); // Create list of combo box if (itr != _propertyTable.end()) { // Insert string int index = InsertString(-1, itr->second); // Set data SetItemData(index, itr->first); } } }
// removes all the items from the history list, and optionally deletes // the registry items. Note that if the history list is generated from // a CRecentFileList, then registry entries will not be deleted void CHistoryCombo::ClearHistory(BOOL bDeleteRegistryEntries/*=TRUE*/) { ResetContent(); if (! m_sSection.IsEmpty() && bDeleteRegistryEntries) { // get the actual reg key used CWinApp* pApp = AfxGetApp(); CRegKey rk; CString sKey = "SOFTWARE\\"; if (pApp->m_pszRegistryKey == NULL || pApp->m_pszAppName == NULL) return; sKey += pApp->m_pszRegistryKey + CString("\\"); sKey += pApp->m_pszAppName + CString("\\"); sKey += m_sSection; if (rk.Open(HKEY_CURRENT_USER, sKey) != ERROR_SUCCESS) return; // delete actual values int nMax = m_nMaxHistoryItems + 1; for (int n = 0; n < nMax; n++) { sKey.Format("%s%d", m_sKeyPrefix, n); rk.DeleteValue(sKey); } if (!m_sKeyCurItem.IsEmpty()) sKey = m_sKeyCurItem; else if (m_sKeyPrefix.IsEmpty()) sKey = "Last"; else sKey = m_sKeyPrefix; rk.DeleteValue(sKey); } }
void CPWL_IconList_Content::CreateChildWnd(const PWL_CREATEPARAM& cp) { for (int32_t i = 0; i < m_nListCount; i++) { CPWL_IconList_Item* pNewItem = new CPWL_IconList_Item(); PWL_CREATEPARAM icp = cp; icp.pParentWnd = this; icp.dwFlags = PWS_CHILD | PWS_VISIBLE | PWS_NOREFRESHCLIP; pNewItem->Create(icp); } SetItemSpace(PWL_IconList_ITEM_SPACE); ResetContent(0); if (CPWL_Wnd* pParent = GetParentWindow()) { CPDF_Rect rcScroll = GetScrollArea(); GetScrollPos(); PWL_SCROLL_INFO sInfo; sInfo.fContentMin = rcScroll.bottom; sInfo.fContentMax = rcScroll.top; sInfo.fPlateWidth = GetClientRect().Height(); sInfo.fSmallStep = 13.0f; sInfo.fBigStep = sInfo.fPlateWidth; pParent->OnNotify(this, PNM_SETSCROLLINFO, SBT_VSCROLL, (intptr_t)&sInfo); } }
//Private BOOL COXMultiComboBox::ChangeMasterColumn(int /* nCol */) { int nNumItems = GetCount(); CArray<COXRowData*,COXRowData*> aPtrsRowData; aPtrsRowData.SetSize(nNumItems); int nIndex=0; for(nIndex=0; nIndex < nNumItems; nIndex++) { COXRowData* pRowData = GetRowData(nIndex); aPtrsRowData[nIndex] = pRowData; if (pRowData == NULL) TRACE0("In COXMultiComboBox::ChangeMasterColumn : GetRowData() returned NULL.\n"); } // ... To avoid deleting the Rowdata in DeleteItem m_fMasterColumnChanging = TRUE; // ... Delete all the Items ResetContent(); // ... Resets the flag m_fMasterColumnChanging = FALSE; int nRetVal; // Again add all the items. This deletion and addition is to effect // the sorting order based on current master column for(nIndex=0; nIndex < nNumItems; nIndex++) { if((nRetVal = CComboBox::AddString((aPtrsRowData[nIndex])->GetColumnString(m_nMasterColumn))) != CB_ERR) SetRowData(nRetVal,aPtrsRowData[nIndex]); else return FALSE; } return TRUE; }
void GVSearchListBox::Clear() { std::lock_guard<std::recursive_mutex> l(mutex_); ResetContent(); m_findMessages.clear(); }
void CListBoxEBX::OnDestroy() { //Clean up items and their strings ResetContent(); CListBox::OnDestroy(); }
BOOL CTriangularisationCombo::OnIdle(LONG lCount) { // get document ptr CWorldEditorDoc* pDoc = theApp.GetActiveDocument(); if( (pDoc == NULL) || (pDoc->GetEditingMode() != CSG_MODE) || (!pDoc->m_bPrimitiveMode) ) { // we should disable triangularisation combo if(GetCount() == 1) return TRUE; // we allready have "not available" in combo // remove all combo entries ResetContent(); // set none available message AddString( L"None Available"); SetCurSel( 0); } // we should enable triangularisation combo else { // if it is allready enabled if(GetCount() != 1) return TRUE; ResetContent(); // add all possible triangularisation types AddString( L"None"); AddString( L"Center"); AddString( L"Vertex 1"); AddString( L"Vertex 2"); AddString( L"Vertex 3"); AddString( L"Vertex 4"); AddString( L"Vertex 5"); AddString( L"Vertex 6"); AddString( L"Vertex 7"); AddString( L"Vertex 8"); AddString( L"Vertex 9"); AddString( L"Vertex 10"); AddString( L"Vertex 11"); AddString( L"Vertex 12"); AddString( L"Vertex 13"); AddString( L"Vertex 14"); AddString( L"Vertex 15"); AddString( L"Vertex 16"); // select currently selected triangularisation type SetCurSel( (int)theApp.m_vfpCurrent.vfp_ttTriangularisationType); } return TRUE; }
// This loads the given string as the content to parse into XML elements. inline void RestrictedXmlParser::LoadString( std::string const& stringToParse ) { ResetContent(); ParsingUtilities::ResetStringstream( xmlStringStream, stringToParse ); xmlStream = &xmlStringStream; }
void CFcColorComboBox::Init() { ResetContent(); for (unsigned ii = 0; ii < FcGetNamedColorMax(); ii++) { AddString(FcGetHtmlColorNameAndValue(ii)); } }
void CSmartComboBox::LoadFromConfiguration(const char* Section, const char* Key) { std::vector<std::string> StringVector; GetConfigStringVector(Section, Key, StringVector); ResetContent(); const std::string CurrentStr = std::string("__") + Key + "ThatShouldNotBeFound__"; UpdateList(StringVector, CurrentStr.c_str()); }
//##ModelId=474D306600BD void CGroupCombo::FillCombo() { ResetContent(); int nIndex = AddString(_T("--NONE--")); SetItemData(nIndex, 0); FillCombo(-1, 1); }
void CShaderListBox::SetList(const ShaderList& list) { if (&list != &m_List) { ResetContent(); for (const auto& shader : list) { VERIFY(AddShader(shader) >= 0); } } }
void CListBoxCtrl::ResetStrings() { ResetContent(); for (int i = 0; i < listStrings.Size(); i++) { int retVal = AddString(listStrings[i]); ASSERT(retVal == i); } }
void CMonthComboBox::InitCombo() { ASSERT(GetSafeHwnd()); CLocalizer::EnableTranslation(*this, FALSE); ResetContent(); for (int nMonth = 1; nMonth <= 12; nMonth++) AddString(CDateHelper::GetMonthName(nMonth, FALSE)); }
void CGuiComboFont::FillerCombo() { CClientDC dc(this); ResetContent(); ::EnumFonts( dc, // handle to device context NULL, // pointer to font typeface name string (FONTENUMPROC) EnumFontsProc, // pointer to callback function (LPARAM) this); // pointer to application-supplied data SetCurSel(0); }
void CSchemaCombo::Load(LPCTSTR pszSelectURI, int nType, int nAvailability, BOOL bReset) { if ( ( GetStyle() & CBS_OWNERDRAWVARIABLE ) == 0 ) { ModifyStyle( 0, CBS_OWNERDRAWVARIABLE|CBS_HASSTRINGS ); } SetExtendedUI(); m_nType = nType; m_nAvailability = nAvailability; if ( bReset ) ResetContent(); if ( bReset && m_sNoSchemaText.GetLength() ) { SetItemData( AddString( _T(" ") ), 0 ); SetCurSel( 0 ); } for ( POSITION pos = SchemaCache.GetIterator() ; pos ; ) { CSchemaPtr pSchema = SchemaCache.GetNext( pos ); BOOL bSelected = pSchema->CheckURI( pszSelectURI ); if ( ! bReset ) { int nIndex = FindSchema( pSchema ); if ( nIndex >= 0 ) { if ( bSelected ) SetCurSel( nIndex ); continue; } } if ( ( bSelected || pSchema->m_nType == nType || nType == -1 ) && ( bSelected || pSchema->m_nAvailability <= nAvailability ) ) { int nIndex = AddString( pSchema->m_sTitle ); SetItemData( nIndex, (LPARAM)pSchema ); if ( bSelected ) SetCurSel( nIndex ); } } if ( bReset && nAvailability < CSchema::saMax ) { SetItemData( AddString( _T("ZZZ") ), 0 ); } }
BOOL CTechComboBox::Initialize( ) { ResetContent(); for( int nTech = STT_MIN; nTech < STT_MAX; nTech ++ ) { int nIndex = AddString( AfxGetSTTFullName(nTech) ); SetItemData( nIndex, nTech ); } SetCurSel( 0 ); return TRUE; }
void CLogListBox::Clear() { SetRedraw(false); int n = GetCount(); for(int i= 0; i<n; i++) { LogListBoxItem * item =(LogListBoxItem *)GetItemDataPtr(i); delete item; } ResetContent(); SetRedraw(true); }
void CSizeComboBox::EnumFontSizes(CDC& dc, LPCTSTR pFontName) { ResetContent(); if (pFontName == NULL) return; if (pFontName[0] == NULL) return; ASSERT(dc.m_hDC != NULL); m_nLogVert = dc.GetDeviceCaps(LOGPIXELSY); ::EnumFontFamilies(dc.m_hDC, pFontName, (FONTENUMPROC) EnumSizeCallBack, (LPARAM) this); }