Esempio n. 1
0
void wxCheckListBox::DoInsertItems(const wxArrayString& items, unsigned int pos)
{
    wxCHECK_RET( IsValidInsert( pos ),
                 wxT("invalid index in wxListBox::InsertItems") );

    for( unsigned int i = 0; i < items.GetCount(); i++ )
    {
        LVITEM newItem;
        wxZeroMemory(newItem);
        newItem.iItem = i+pos;
        int ret = ListView_InsertItem( (HWND)GetHWND(), & newItem );
        wxASSERT_MSG( int(i+pos) == ret , _T("Item not added") );
        SetString( ret , items[i] );
        m_itemsClientData.Insert(NULL, ret);
    }
}
Esempio n. 2
0
void pListView::append(const lstring& list) {
  wchar_t empty[] = L"";
  unsigned row = ListView_GetItemCount(hwnd);
  LVITEM item;
  item.mask = LVIF_TEXT;
  item.iItem = row;
  item.iSubItem = 0;
  item.pszText = empty;
  locked = true;
  ListView_InsertItem(hwnd, &item);
  locked = false;
  for(unsigned column = 0; column < list.size(); column++) {
    utf16_t wtext(list(column, ""));
    ListView_SetItemText(hwnd, row, column, wtext);
  }
}
Esempio n. 3
0
/*
================
rvDebuggerQuickWatchDlg::SetVariable

Sets the current variable being inspected
================
*/
void rvDebuggerQuickWatchDlg::SetVariable ( const char* varname, bool force )
{
	// See if the variable has changed
	if ( !force && !mVariable.Icmp ( varname ) )
	{
		return;
	}

	// Throw up a wait cursor	
	SetCursor ( LoadCursor ( NULL, IDC_WAIT ) );

	// Clear the current value list control
	ListView_DeleteAllItems ( GetDlgItem ( mWnd, IDC_DBG_CURVALUE ) );

	// Get the value of the new variable
	gDebuggerApp.GetClient().InspectVariable ( varname, mCallstackDepth );

	// Wait for the variable value to be sent over from the debugger server		
	if ( !gDebuggerApp.GetClient().WaitFor ( DBMSG_INSPECTVARIABLE, 2500 ) )
	{
		return;
	}
	
	// Make sure we got the value of the variable
	if ( !gDebuggerApp.GetClient().GetVariableValue(varname, mCallstackDepth)[0] )
	{
		return;
	}

	// Enable the windows that display the current value
	mVariable = varname;
	EnableWindow ( GetDlgItem ( mWnd, IDC_DBG_CURVALUE ), true );
	EnableWindow ( GetDlgItem ( mWnd, IDC_DBG_CURVALUE_STATIC ), true );
			
	// Add the variablae value to the list control			
	LVITEM item;
	item.mask = LVIF_TEXT;
	item.pszText = (LPSTR)varname;
	item.iItem = 0;
	item.iSubItem = 0;
	ListView_InsertItem ( GetDlgItem ( mWnd, IDC_DBG_CURVALUE ), &item );				
	ListView_SetItemText ( GetDlgItem ( mWnd, IDC_DBG_CURVALUE ), 0, 1, (LPSTR)gDebuggerApp.GetClient().GetVariableValue(varname,mCallstackDepth) );

	// Give focus back to the variable edit control and set the cursor back to an arrow
	SetFocus ( GetDlgItem ( mWnd, IDC_DBG_VARIABLE ) );
	SetCursor ( LoadCursor ( NULL, IDC_ARROW ) );
}
Esempio n. 4
0
/*
** Adds item to log.
**
*/
void CDialogAbout::CTabLog::AddItem(int level, LPCWSTR time, LPCWSTR message)
{
	WCHAR buffer[32];
	LVITEM vitem;
	vitem.mask = LVIF_IMAGE | LVIF_TEXT;
	vitem.iItem = 0;
	vitem.iSubItem = 0;
	vitem.pszText = buffer;
	HWND item;

	switch (level)
	{
	case LOG_ERROR:
		if (!m_Error) return;
		item = GetDlgItem(m_Window, IDC_ABOUTLOG_ERROR_CHECKBOX);
		vitem.iImage = 0;
		break;

	case LOG_WARNING:
		if (!m_Warning) return;
		item = GetDlgItem(m_Window, IDC_ABOUTLOG_WARNING_CHECKBOX);
		vitem.iImage = 1;
		break;

	case LOG_NOTICE:
		if (!m_Notice) return;
		item = GetDlgItem(m_Window, IDC_ABOUTLOG_NOTICE_CHECKBOX);
		vitem.iImage = 2;
		break;

	case LOG_DEBUG:
		if (!m_Debug) return;
		item = GetDlgItem(m_Window, IDC_ABOUTLOG_DEBUG_CHECKBOX);
		vitem.iImage = -1;
		break;
	}

	GetWindowText(item, buffer, 32);
	item = GetDlgItem(m_Window, IDC_ABOUTLOG_ITEMS_LISTVIEW);
	ListView_InsertItem(item, &vitem);
	ListView_SetItemText(item, vitem.iItem, 1, (WCHAR*)time);
	ListView_SetItemText(item, vitem.iItem, 2, (WCHAR*)message);
	if (!ListView_IsItemVisible(item, 0))
	{
		ListView_Scroll(item, 0, 16);
	}
}
Esempio n. 5
0
// Constructor for motion training sample (includes motion history image)
TrainingSample::TrainingSample(IplImage* srcImage, IplImage* motionHist, HWND lc, HIMAGELIST il, Rect bounds, int groupId) {
	// this constructor should only be called for motion sample type
	assert(groupId == GROUPID_MOTIONSAMPLES);

	hwndListControl = lc;
    hImageList = il;
    iGroupId = groupId;
	iOrigId = groupId;
	selectBounds = bounds;
    motionTrack.clear();

    fullImageCopy = cvCreateImage(cvSize(bounds.Width,bounds.Height),IPL_DEPTH_8U, 3); 
    motionHistory = cvCreateImage(cvSize(motionHist->width,motionHist->height),IPL_DEPTH_32F, 1);
	resizedImage = cvCreateImage(cvSize(LISTVIEW_SAMPLE_X,LISTVIEW_SAMPLE_Y),IPL_DEPTH_8U, 3); 
    bmpImage = new Bitmap(LISTVIEW_SAMPLE_X, LISTVIEW_SAMPLE_Y, PixelFormat24bppRGB);

    cvSetImageROI(srcImage, cvRect( bounds.X, bounds.Y, bounds.Width, bounds.Height));
    cvCopyImage(srcImage, fullImageCopy);

    if (srcImage->width >= LISTVIEW_SAMPLE_X && srcImage->height >= LISTVIEW_SAMPLE_Y) {
        cvResize(srcImage, resizedImage, CV_INTER_AREA);
    } else { 
        cvResize(srcImage, resizedImage, CV_INTER_LINEAR);
    }
    cvResetImageROI(srcImage);

	// copy entire frame motion history image (motion history analysis doesn't work as well on partial frame)
	cvCopyImage(motionHist, motionHistory);

    IplToBitmap(resizedImage, bmpImage);
    bmpImage->GetHBITMAP(NULL, &hbmImage);

    // Add image to imagelist
    int imgIndex = ImageList_Add(hImageList, hbmImage, NULL);

    // Add item to list view
    lvi.mask = LVIF_IMAGE | LVIF_STATE | LVIF_GROUPID;
    lvi.state = 0;
    lvi.stateMask = 0;
    lvi.iGroupId = groupId;
    lvi.iItem = imgIndex;
    lvi.iImage = imgIndex;
    lvi.iSubItem = 0;
    int newListItemPos = ListView_InsertItem(hwndListControl, &lvi);

    id = ListView_MapIndexToID(hwndListControl, newListItemPos);
}
Esempio n. 6
0
VOID AddToAlert(SYSTEMTIME rTime, unsigned char *buffer, int numbytes, char *col1, char *col2, char *col3, char *col4, char *col5, char *col6)
{
	int				position;
	LV_ITEM			lvI;
	char			str[64];
	struct packet	*pkt;


	++count;
	bytes_used += numbytes;
	wsprintf(str, "%d packets / %d bytes decoded", count, bytes_used);
	SendMessage(hWndStatus, SB_SETTEXT, (WPARAM) 2, (LPARAM) str);

	wsprintf(str, "%.2d:%.2d:%.2d:%.3d", rTime.wHour, rTime.wMinute, rTime.wSecond, rTime.wMilliseconds);

	lvI.mask = LVIF_TEXT | LVIF_PARAM;
	position = ListView_GetItemCount(hWndAlertList);

	lvI.iItem = position;
	lvI.iSubItem = 0;
	lvI.pszText = str; 
	lvI.cchTextMax = 64;

	pkt = malloc(sizeof(struct packet));
	pkt->size = numbytes;
	pkt->data = malloc(numbytes);
	memcpy(pkt->data, buffer, numbytes);
	pkt->time = rTime;
	lvI.lParam = (LPARAM)pkt;

	position = ListView_InsertItem(hWndAlertList, &lvI);
	ListView_SetItemText( hWndAlertList, position, 1, col1);
	ListView_SetItemText( hWndAlertList, position, 2, col2);
	ListView_SetItemText( hWndAlertList, position, 3, col3);
	ListView_SetItemText( hWndAlertList, position, 4, col4);
	ListView_SetItemText( hWndAlertList, position, 5, col5);
	ListView_SetItemText( hWndAlertList, position, 6, col6);
	ListView_EnsureVisible(hWndAlertList, position, FALSE);

	
	if (count > 65000)
	{
		g_bShutdown = TRUE;
		//MessageBox(hWndMain, "Maximum packet count reached. Capture stopped.", APP_NAME, MB_OK | MB_ICONEXCLAMATION);
	}
	return;
}
Esempio n. 7
0
void CSetPgDebug::debugLogCommand(LogCommandsData* apData)
{
	if (!apData)
		return;

	/*
		struct LogCommandsData
		{
			BOOL  bInput, bMainThread;
			DWORD nTick, nDur, nCmd, nSize, nPID;
			wchar_t szPipe[64];
		};
	*/

	wchar_t szText[128];
	HWND hList = GetDlgItem(mh_Dlg, lbActivityLog);

	wcscpy_c(szText, apData->bInput ? L"In" : L"Out");

	LVITEM lvi = {LVIF_TEXT|LVIF_STATE};
	lvi.state = lvi.stateMask = LVIS_SELECTED|LVIS_FOCUSED;
	lvi.pszText = szText;
	int nItem = ListView_InsertItem(hList, &lvi);

	int nMin = apData->nTick / 60000; apData->nTick -= nMin*60000;
	int nSec = apData->nTick / 1000;
	int nMS = apData->nTick % 1000;
	_wsprintf(szText, SKIPLEN(countof(szText)) L"%02i:%02i:%03i", nMin, nSec, nMS);
	ListView_SetItemText(hList, nItem, lcc_Time, szText);

	_wsprintf(szText, SKIPLEN(countof(szText)) apData->bInput ? L"" : L"%u", apData->nDur);
	ListView_SetItemText(hList, nItem, lcc_Duration, szText);

	_wsprintf(szText, SKIPLEN(countof(szText)) L"%u", apData->nCmd);
	ListView_SetItemText(hList, nItem, lcc_Command, szText);

	_wsprintf(szText, SKIPLEN(countof(szText)) L"%u", apData->nSize);
	ListView_SetItemText(hList, nItem, lcc_Size, szText);

	_wsprintf(szText, SKIPLEN(countof(szText)) apData->nPID ? L"%u" : L"", apData->nPID);
	ListView_SetItemText(hList, nItem, lcc_PID, szText);

	ListView_SetItemText(hList, nItem, lcc_Pipe, apData->szPipe);

	free(apData);
}
Esempio n. 8
0
INT PhAddListViewItem(
    _In_ HWND ListViewHandle,
    _In_ INT Index,
    _In_ PWSTR Text,
    _In_opt_ PVOID Param
    )
{
    LVITEM item;

    item.mask = LVIF_TEXT | LVIF_PARAM;
    item.iItem = Index;
    item.iSubItem = 0;
    item.pszText = Text;
    item.lParam = (LPARAM)Param;

    return ListView_InsertItem(ListViewHandle, &item);
}
Esempio n. 9
0
void AddItem(DWORD dwNum, struct entry_wav *sWav)
{
    LVITEM lv = {0};
    BYTE bSize[MAX_PATH];
    BYTE bOffset[MAX_PATH];
    BYTE bName[40];

    lv.iItem = 0;
    ListView_InsertItem(hListView, &lv);
    memcpy(bName, sWav->bName, 40);
    FixWavNameFile(bName);
    ListView_SetItemText(hListView, 0, 0, bName);
    sprintf(bOffset, "0x%X", sWav->dwOffset);
    ListView_SetItemText(hListView, 0, 1, bOffset);
    sprintf(bSize, "%d", sWav->dwSize);
    ListView_SetItemText(hListView, 0, 2, bSize);
}
Esempio n. 10
0
static VOID
UpdateUsersList(HWND hwndListView)
{
    NET_API_STATUS netStatus;
    PUSER_INFO_20 pBuffer;
    DWORD entriesread;
    DWORD totalentries;
    DWORD resume_handle = 0;
    DWORD i;
    LV_ITEM lvi;
    INT iItem;


    for (;;)
    {
        netStatus = NetUserEnum(NULL, 20, FILTER_NORMAL_ACCOUNT,
                                (LPBYTE*)&pBuffer,
                                1024, &entriesread,
                                &totalentries, &resume_handle);
        if (netStatus != NERR_Success && netStatus != ERROR_MORE_DATA)
            break;

        for (i = 0; i < entriesread; i++)
        {
           memset(&lvi, 0x00, sizeof(lvi));
           lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;
           lvi.pszText = pBuffer[i].usri20_name;
           lvi.state = 0;
           lvi.iImage = (pBuffer[i].usri20_flags & UF_ACCOUNTDISABLE) ? 1 : 0;
           iItem = ListView_InsertItem(hwndListView, &lvi);

           ListView_SetItemText(hwndListView, iItem, 1,
                                pBuffer[i].usri20_full_name);

           ListView_SetItemText(hwndListView, iItem, 2,
                                pBuffer[i].usri20_comment);
        }

        NetApiBufferFree(pBuffer);

        /* No more data left */
        if (netStatus != ERROR_MORE_DATA)
            break;
    }

}
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();
    generic_string nameStr = pNativeSpeaker->getAttrNameStr(TEXT("Name"), FS_ROOTNODE, FS_CLMNNAME);
    insertColumn(nameStr.c_str(), 150, 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 = 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()));
        }
    }
}
Esempio n. 12
0
/*
 * Displays a message in NSIS details window, roughly the same as NSIS' DetailPrint
 */
void DetailPrint(const TCHAR *pStr)  /* LogMessage() */
{
	if (!g_hwndList) return;
	if (!lstrlen(pStr)) return;

	{
		LVITEM item={0};
		int nItemCount=SendMessage(g_hwndList, LVM_GETITEMCOUNT, 0, 0);
		item.mask=LVIF_TEXT;
		item.pszText=(TCHAR *)pStr;
		item.cchTextMax=0;  /* =6 */
		item.iItem=nItemCount;
		/* SendMessage(g_hwndList, LVM_INSERTITEM, 0, (LPARAM)&item); */
		ListView_InsertItem(g_hwndList, &item);
		ListView_EnsureVisible(g_hwndList, item.iItem, 0);
	}
}
Esempio n. 13
0
static int AddDatabaseToList(HWND hwndList, const TCHAR* filename, TCHAR* dir)
{
	LV_ITEM lvi;
	lvi.mask = LVIF_PARAM;
	lvi.iSubItem = 0;
	for (lvi.iItem = ListView_GetItemCount(hwndList) - 1; lvi.iItem >= 0; lvi.iItem--) {
		ListView_GetItem(hwndList, &lvi);
		if (!_tcsicmp((TCHAR*)lvi.lParam, filename))
			return lvi.iItem;
	}

	_stat st;
	if (_tstat(filename, &st) == -1)
		return -1;

	DWORD totalSize = st.st_size;

	bool isBroken = CheckBroken(filename);

	const TCHAR *pName = _tcsrchr(filename, '\\');
	if (pName == NULL)
		pName = (LPTSTR)filename;
	else
		pName++;

	TCHAR szName[MAX_PATH];
	mir_sntprintf(szName, MAX_PATH, _T("%s%s"), dir, pName);

	TCHAR *pDot = _tcsrchr(szName, '.');
	if (pDot != NULL && !_tcsicmp(pDot, _T(".dat")))
		*pDot = 0;

	lvi.iItem = 0;
	lvi.mask = LVIF_TEXT | LVIF_PARAM | LVIF_IMAGE;
	lvi.iSubItem = 0;
	lvi.lParam = (LPARAM)_tcsdup(filename);
	lvi.pszText = szName;
	lvi.iImage = (isBroken) ? 1 : 0;

	int iNewItem = ListView_InsertItem(hwndList, &lvi);
	TCHAR szSize[20];
	mir_sntprintf(szSize, SIZEOF(szSize), _T("%.2lf MB"), totalSize / 1048576.0);
	ListView_SetItemText(hwndList, iNewItem, 1, szSize);
	return iNewItem;
}
Esempio n. 14
0
static VOID
OnNewVariable(HWND hwndDlg,
              INT iDlgItem)
{
    HWND hwndListView;
    PVARIABLE_DATA VarData;
    LV_ITEM lvi;
    INT iItem;

    hwndListView = GetDlgItem(hwndDlg, iDlgItem);

    VarData = GlobalAlloc(GPTR, sizeof(VARIABLE_DATA));

    if (DialogBoxParam(hApplet,
                       MAKEINTRESOURCE(IDD_EDIT_VARIABLE),
                       hwndDlg,
                       EditVariableDlgProc,
                       (LPARAM)VarData) <= 0)
    {
        if (VarData->lpName != NULL)
            GlobalFree(VarData->lpName);

        if (VarData->lpRawValue != NULL)
            GlobalFree(VarData->lpRawValue);

        if (VarData->lpCookedValue != NULL)
            GlobalFree(VarData->lpCookedValue);

        GlobalFree(VarData);
    }
    else
    {
        if (VarData->lpName != NULL && (VarData->lpCookedValue || VarData->lpRawValue))
        {
            memset(&lvi, 0x00, sizeof(lvi));
            lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM;
            lvi.lParam = (LPARAM)VarData;
            lvi.pszText = VarData->lpName;
            lvi.state = 0;
            iItem = ListView_InsertItem(hwndListView, &lvi);

            ListView_SetItemText(hwndListView, iItem, 1, VarData->lpCookedValue);
        }
    }
}
Esempio n. 15
0
static void append_debug_item(const char *timestamp, const char *level,
                              const char *category, const char *file,
                              const char *line, const char *function,
                              const char *message) {
	SCROLLINFO si;
	LVITEM lvi;

	si.cbSize = sizeof(si);
	si.fMask = SIF_RANGE | SIF_POS | SIF_PAGE;

	GetScrollInfo(_debug_list_view, SB_VERT, &si);

	lvi.mask = LVIF_TEXT;

	lvi.iItem = ListView_GetItemCount(_debug_list_view);
	lvi.iSubItem = 0;
	lvi.pszText = (char *)timestamp;
	ListView_InsertItem(_debug_list_view, &lvi);

	lvi.iSubItem = 1;
	lvi.pszText = (char *)level;
	ListView_SetItem(_debug_list_view, &lvi);

	lvi.iSubItem = 2;
	lvi.pszText = (char *)category;
	ListView_SetItem(_debug_list_view, &lvi);

	lvi.iSubItem = 3;
	lvi.pszText = (char *)(*file != '\0' ? file : function);
	ListView_SetItem(_debug_list_view, &lvi);

	lvi.iSubItem = 4;
	lvi.pszText = (char *)line;
	ListView_SetItem(_debug_list_view, &lvi);

	lvi.iSubItem = 5;
	lvi.pszText = (char *)message;
	ListView_SetItem(_debug_list_view, &lvi);

	if (si.nPos >= si.nMax - (int)si.nPage) {
		ListView_EnsureVisible(_debug_list_view, lvi.iItem, FALSE);
	}

	update_status_bar_message_count();
}
Esempio n. 16
0
void mm_add_mod_item(mm_mod_item* modItem)
{
    mm_mod_item_list[freeModSlot] = modItem;

    // add it to the list
    LVITEM listviewItem = { 0 };
    listviewItem.iItem = freeModSlot;

    ListView_InsertItem(mm_mod_list, &listviewItem);

    // toggle the checkbox if the mod has been installed
    listviewItem = { 0 };
    listviewItem.mask = LVIF_STATE;
    listviewItem.state = modItem->enabled ? 0x2000 : 0x1000; // Cosmic magic constants from hell
    listviewItem.stateMask = 0xF000;
    listviewItem.iItem = freeModSlot;
    listviewItem.iSubItem = MOD_LIST_COLUMN_ENABLED;

    ListView_SetItem(mm_mod_list, &listviewItem);

    // set the name
    listviewItem = { 0 };
    listviewItem.mask = LVIF_TEXT;
    listviewItem.pszText = modItem->mod_name;
    listviewItem.iItem = freeModSlot;
    listviewItem.iSubItem = MOD_LIST_COLUMN_NAME;

    ListView_SetItem(mm_mod_list, &listviewItem);

    // set the size
    listviewItem = { 0 };
    listviewItem.mask = LVIF_TEXT;

    char fileSize[128] = { 0 };
    sprintf(fileSize, "%0.2fMB", ((float)modItem->file_size / 1000000));
    listviewItem.pszText = fileSize;

    listviewItem.iItem = freeModSlot;
    listviewItem.iSubItem = MOD_LIST_COLUMN_FILE_SIZE;

    ListView_SetItem(mm_mod_list, &listviewItem);

    // update the free mod slot
    freeModSlot++;
}
Esempio n. 17
0
int CListView::InsertItem(int Index,LPCTSTR pszText,LPARAM Param)
{
	if (m_hwnd==nullptr)
		return -1;

	if (Index<0)
		Index=GetItemCount();

	LVITEM lvi;

	lvi.mask=LVIF_TEXT | LVIF_PARAM;
	lvi.iItem=Index;
	lvi.iSubItem=0;
	lvi.pszText=const_cast<LPTSTR>(pszText);
	lvi.lParam=Param;

	return ListView_InsertItem(m_hwnd,&lvi);
}
Esempio n. 18
0
static void PopulateItem(HWND hwnd, STRINGS *strings, int items)
{
    LV_ITEM item;
    static char id[256];
    id[0] = 0;
    FormatExp(id, strings->id);
    memset(&item, 0, sizeof(LV_ITEM));
    item.iItem = items;
    item.iSubItem = 0;
    item.mask = LVIF_PARAM | LVIF_TEXT;
    item.lParam = (LPARAM)strings;
    item.pszText = id;
    ListView_InsertItem(hwnd, &item);
    item.iSubItem = 1;
    item.mask = LVIF_PARAM;
    item.lParam = (LPARAM)strings;
    ListView_SetItem(hwnd, &item);
}
Esempio n. 19
0
// InsertItem ---------------------------------------------------------------
int CCodeListCtrl::InsertItem( int iIndex, LPCTSTR lpszItem, int iImage,
                        LPARAM lParam )
{
   ASSERT( ::IsWindow( m_hWnd ) );

   LVITEM lvi = {0};

   if( -1 == iIndex )
      iIndex = GetItemCount() + 1;

   lvi.iItem = iIndex;
   lvi.iImage = iImage;
   lvi.lParam = lParam;
   lvi.pszText = (LPTSTR)lpszItem;
   lvi.mask = LVIF_IMAGE | LVIF_PARAM | LVIF_TEXT;

   return ListView_InsertItem( m_hWnd, &lvi );
}
bool ServerPingSettings::InitServerListData(HWND hwndServerList)
{
	LVITEM lvi;

    lvi.pszText   = LPSTR_TEXTCALLBACK;
    lvi.mask      = LVIF_TEXT | LVIF_STATE;
    lvi.stateMask = 0;
    lvi.iSubItem  = 0;
    lvi.state     = 0;
	
	for(UINT i = 0; i < pingers->Num(); i++) {
		lvi.iItem = i;
		if (ListView_InsertItem(hwndServerList, &lvi) == -1) {
			return false;
		}
	}
	return true;
}
Esempio n. 21
0
// Constructor for loading sample from image file
TrainingSample::TrainingSample(char *filename, HWND lc, HIMAGELIST il, int groupId) {
	// this constructor should only be called for positive and negative sample types
	assert((groupId == GROUPID_POSSAMPLES) || (groupId == GROUPID_NEGSAMPLES));
	
	hwndListControl = lc;
    hImageList = il;
    iGroupId = groupId;
	iOrigId = groupId;
    motionTrack.clear();
	motionHistory = NULL;

    fullImageCopy = cvLoadImage(filename, 1);
    if (fullImageCopy == NULL) {
        fullImageCopy = cvCreateImage(cvSize(LISTVIEW_SAMPLE_X,LISTVIEW_SAMPLE_Y),IPL_DEPTH_8U, 3);
        cvZero(fullImageCopy);
    }

    resizedImage = cvCreateImage(cvSize(LISTVIEW_SAMPLE_X,LISTVIEW_SAMPLE_Y),IPL_DEPTH_8U, 3); 
    bmpImage = new Bitmap(LISTVIEW_SAMPLE_X, LISTVIEW_SAMPLE_Y, PixelFormat24bppRGB);

    if (fullImageCopy->width >= LISTVIEW_SAMPLE_X && fullImageCopy->height >= LISTVIEW_SAMPLE_Y) {
        cvResize(fullImageCopy, resizedImage, CV_INTER_AREA);
    } else { 
        cvResize(fullImageCopy, resizedImage, CV_INTER_LINEAR);
    }

    IplToBitmap(resizedImage, bmpImage);
    bmpImage->GetHBITMAP(NULL, &hbmImage);

    // Add image to imagelist
    int imgIndex = ImageList_Add(hImageList, hbmImage, NULL);

    // Add item to list view
    lvi.mask = LVIF_IMAGE | LVIF_STATE | LVIF_GROUPID;
    lvi.state = 0;
    lvi.stateMask = 0;
    lvi.iGroupId = groupId;
    lvi.iItem = imgIndex;
    lvi.iImage = imgIndex;
    lvi.iSubItem = 0;
    int newListItemPos = ListView_InsertItem(hwndListControl, &lvi);

    id = ListView_MapIndexToID(hwndListControl, newListItemPos);
}
Esempio n. 22
0
static void InsertAllDeviceMapList(HWND hList)
{
    _TCHAR buffer[64];
    std::map<Range, class CDevice *>::iterator scope;
    LVITEM item;
    int index;
	int length = 0;

    ListView_DeleteAllItems(hList);
    item.iItem = -1;

    EnterCriticalSection(&_Module.cs);

    scope = _Module.DeviceMap.begin();
    while(scope != _Module.DeviceMap.end()) {
		_TCHAR * strbuf = (_TCHAR *)(BSTR)scope->second->DeviceName;

#ifndef _UNICODE
		length = WideCharToMultiByte(CP_ACP, 0, (BSTR)scope->second->DeviceName, -1, 0, 0, NULL, NULL);
		if(length != 0) {
			strbuf = new _TCHAR [length + 1];
			WideCharToMultiByte(CP_ACP, 0, (BSTR)scope->second->DeviceName, length, (char *)strbuf, length, NULL, NULL);
		}
		else
			strbuf = _T("<unknown>");
#endif

        item.mask = LVIF_TEXT;
        ++ item.iItem;
        item.iSubItem = 0;
        item.pszText = strbuf;
        index = ListView_InsertItem(hList, &item);

		if(length != 0)
			delete [] strbuf;

        wsprintf(buffer, _T("0x%08X -- 0x%08X"), scope->first.GetBase(), scope->first.GetBase() + scope->first.GetLength() - 1);
        ListView_SetItemText(hList, index, 1, buffer);

        ++ scope;
    }

    LeaveCriticalSection(&_Module.cs);
}
Esempio n. 23
0
static VOID
AddGroupToUser(HWND hwndDlg,
               PMEMBERSHIP_USER_DATA pUserData)
{
    HWND hwndLV;
    NET_API_STATUS status;
    DWORD i;
    DWORD dwTotal;
    LV_ITEM lvi;

    if (DialogBoxParam(hApplet,
                       MAKEINTRESOURCE(IDD_USER_ADD_MEMBERSHIP),
                       hwndDlg,
                       AddGroupToUserDlgProc,
                       (LPARAM)pUserData) == IDOK)
    {
        // TODO: Update Membership list!
        hwndLV = GetDlgItem(hwndDlg, IDC_USER_MEMBERSHIP_LIST);

        if (pUserData->pGroupData)
            NetApiBufferFree(pUserData->pGroupData);

        (void)ListView_DeleteAllItems(hwndLV);

        status = NetUserGetLocalGroups(NULL, pUserData->szUserName, 0, 0,
                                       (LPBYTE*)&pUserData->pGroupData,
                                       MAX_PREFERRED_LENGTH,
                                       &pUserData->dwGroupCount,
                                       &dwTotal);
        if (status != NERR_Success)
            return;

        for (i = 0; i < pUserData->dwGroupCount; i++)
        {
            ZeroMemory(&lvi, sizeof(lvi));
            lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;
            lvi.pszText = pUserData->pGroupData[i].lgrui0_name;
            lvi.state = 0;
            lvi.iImage = 0; 

            (void)ListView_InsertItem(hwndLV, &lvi);
        }
    }
}
Esempio n. 24
0
void OBS::AddSourceItem(LPWSTR name, bool checked, UINT index)
{
    LVITEM lvI;
    // Initialize LVITEM members that are common to all items.
    lvI.mask      = LVIF_TEXT | LVIF_IMAGE | LVIF_STATE;
    lvI.stateMask = 0;
    lvI.iSubItem  = 0;
    lvI.state     = 0;
    lvI.pszText = name;
    lvI.iItem = index;


    HWND hwndSources = GetDlgItem(hwndMain, ID_SOURCES);
    
    ListView_InsertItem(hwndSources, &lvI);
    ListView_SetCheckState(hwndSources, index, checked);   
    ListView_SetColumnWidth(hwndSources, 0, LVSCW_AUTOSIZE_USEHEADER);
    ListView_SetColumnWidth(hwndSources, 1, LVSCW_AUTOSIZE_USEHEADER);
}
Esempio n. 25
0
int AddNewItemToFunctionList(HWND list, const std::string & name,
							  const std::string & value, int parameters)
{
LVITEM item;
char buffer[20];

	item.mask     = LVIF_TEXT;
	item.pszText  = const_cast<char*>( name.c_str() );
	item.iSubItem = 0;

	int id = ListView_InsertItem(list, &item);

	sprintf(buffer,"%u", parameters);
	ListView_SetItemText(list,id,1, buffer);

	ListView_SetItemText(list,id,2,const_cast<char*>( value.c_str() ));

return id;
}
Esempio n. 26
0
VOID scanZeroGravity_Init(HWND hwndList)
{
	PPOINTER_DATA ppd;
	LVITEM lvi;
	
	ppd = (PPOINTER_DATA)HeapAlloc(GetProcessHeap(), 0, sizeof(POINTER_DATA));
	ppd->pszCategory = SCAN_CATEGORY;
	ppd->pszName = SCAN_NAME;
	ppd->bRequired = SCAN_REQUIRED;
	ppd->dwValue = 0;
	ppd->pfnScanProc = scanZeroGravity_ScanProc;

	lvi.mask = LVIF_TEXT | LVIF_PARAM;
	lvi.pszText = SCAN_NAME;
	lvi.iSubItem = 0;
	lvi.iItem = ListView_GetItemCount(hwndList);
	lvi.lParam = (LPARAM)ppd;
	ListView_InsertItem(hwndList, &lvi);
}
Esempio n. 27
0
static BOOL 
sAddShareHolder (
		PSPLITKEYSTRUCT		psks,
		PSHAREHOLDERSTRUCT	pshs, 
		INT					iImage, 
		HWND				hwndList)
{
	LV_ITEM		lvI;
	INT			iItem;	
	CHAR		sz[16];

	// see if we're over the limit
	if ((psks->uTotalShares + pshs->uShares) > MAX_TOTAL_SHARES) {
		MessageBeep (MB_ICONASTERISK);
		return FALSE;
	}

	// figure item index to use
	iItem = ListView_GetItemCount (hwndList);

	// insert listview item
	lvI.mask = LVIF_TEXT|LVIF_IMAGE|LVIF_STATE|LVIF_PARAM;
	lvI.state = 0;      
	lvI.stateMask = 0;
	lvI.iImage = iImage;

	lvI.iItem = iItem;
	lvI.iSubItem = 0;
	lvI.pszText	= pshs->szUserID; 
	lvI.cchTextMax = 0;
	lvI.lParam = (LPARAM)pshs;

	iItem = ListView_InsertItem (hwndList, &lvI);
	if (iItem == -1) {
		return FALSE;
	}
	else {
		// add strings for Shares column
		wsprintf (sz, "%i", pshs->uShares);
		ListView_SetItemText (hwndList, iItem, 1, sz);
		return TRUE;
	}
}
Esempio n. 28
0
void insert_logrecord(HWND hwndLV, const TrayWidget::log_entry &entry) {
	LVITEM item;
	item.mask = LVIF_TEXT;
	std::wstring msg = entry.category;
	item.pszText = const_cast<TCHAR*>(msg.c_str());
	item.iSubItem = 0;
	item.iItem = 0; //ListView_GetItemCount(hwndLV);
	int id = ListView_InsertItem(hwndLV, &item);
	msg = entry.file;

	std::wstring::size_type pos = msg.find_last_of(_T("\\"));
	if (pos != std::wstring::npos)
		msg = msg.substr(pos);
	ListView_SetItemText(hwndLV, id, 1, const_cast<TCHAR*>(msg.c_str()));
	msg = strEx::itos(entry.line);
	ListView_SetItemText(hwndLV, id, 2, const_cast<TCHAR*>(msg.c_str()));
	msg = entry.message;
	ListView_SetItemText(hwndLV, id, 3, const_cast<TCHAR*>(msg.c_str()));
}
Esempio n. 29
0
void ListView::addItem(int index, const TCHAR *caption, LPARAM tag)
{
  //
  // Prepare LVITEM structure
  //

  LVITEM lvI;
  lvI.mask = LVIF_TEXT | LVIF_PARAM;
  lvI.lParam = tag;
  lvI.iItem = index;
  lvI.iSubItem = 0;
  lvI.pszText = (TCHAR*)caption;

  //
  // Send message to window
  //

  ListView_InsertItem(m_hwnd, &lvI);
}
void EditorApplication::addPhysicsEditorEntryGUI(LibGens::LevelCollisionEntry *entry) {
	char name_str[256];
	char body_str[256];
	HWND hCollisionList = GetDlgItem(hPhysicsEditorDlg, IDL_COLLISION_LIST);

	LV_ITEM Item;
	Item.mask = LVIF_TEXT;
	strcpy(name_str, entry->name.c_str());
	strcpy(body_str, "");

	Item.pszText = name_str;
	Item.cchTextMax = strlen(name_str);            
	Item.iSubItem = 0;                           
	Item.lParam = (LPARAM) NULL;                   
	Item.iItem = ListView_GetItemCount(hCollisionList); 
	ListView_InsertItem(hCollisionList, &Item);
	ListView_SetItemText(hCollisionList, Item.iItem, 1, body_str);
	ListView_SetCheckState(hCollisionList, Item.iItem, entry->rendering);
}