Example #1
0
BOOL CALLBACK LOADDS 
ReadMailDlgProc(HWND hWndMail, UINT wMsg, WPARAM wParam, LPARAM lParam) 
{
  switch (wMsg) 
  {
  case WM_INITDIALOG: 
    {
      DWORD i;
      // Do everything we need to display the message pointed to by
      // mailPtr
      if (!mailPtr)
        break;

      // Start with the basics...
      SetDlgItemText(hWndMail, IDC_EDIT_SUBJECT, mailPtr->lpszSubject);
      SetDlgItemText(hWndMail, IDC_EDIT_DATETIME, mailPtr->lpszDateReceived);
      SetDlgItemText(hWndMail, IDC_EDIT_THREAD, mailPtr->lpszConversationID);
      SetDlgItemText(hWndMail, IDC_EDIT_BODYTEXT, mailPtr->lpszNoteText);

      char    buf[1024];
      wsprintf(buf, "%s (%s)", mailPtr->lpOriginator->lpszName, 
                              mailPtr->lpOriginator->lpszAddress);
      SetDlgItemText(hWndMail, IDC_EDIT_FROM, buf);

      for (i=0; i<mailPtr->nRecipCount; i++)
      {
          wsprintf(buf, "%s (%s)", mailPtr->lpRecips[i].lpszName, 
                                   mailPtr->lpRecips[i].lpszAddress);
          ListBox_InsertString(GetDlgItem(hWndMail, IDC_LIST_RECIPIENTS), 
                  ListBox_GetCount(GetDlgItem(hWndMail, IDC_LIST_RECIPIENTS)), 
                  buf);
      }

      for (i=0; i<mailPtr->nFileCount; i++)
      {
          ListBox_InsertString(GetDlgItem(hWndMail, IDC_LIST_ATTACHMENTS), 
                ListBox_GetCount(GetDlgItem(hWndMail, IDC_LIST_ATTACHMENTS)), 
                mailPtr->lpFiles[i].lpszPathName);
      }
    }
    break;

  case WM_COMMAND:
    HANDLE_WM_COMMAND(hWndMail, wParam, lParam, ProcessReadMailCommand);
    break;

  default:
    return FALSE;
  }
  
  return TRUE;
}
Example #2
0
void plAgeDescInterface::INewPage()
{
    ST::string name = ST_LITERAL("New Page Name");

    // Get the name of the new age from the user
    int ret = DialogBoxParam(hInstance,
                            MAKEINTRESOURCE(IDD_AGE_NAME),
                            GetCOREInterface()->GetMAXHWnd(),
                            NewAgeDlgProc,
                            (LPARAM)&name);
    if (ret != 1)
        return;

    HWND hPages = GetDlgItem(fhDlg, IDC_PAGE_LIST);

    // Make sure this page doesn't already exist
    int count = ListBox_GetCount(hPages);
    for (int i = 0; i < count; i++)
    {
        char pageName[256];
        ListBox_GetText(hPages, i, pageName);
        if (!name.compare_i(pageName))
            return;
    }

    // Add the new page and select it
    int idx = ListBox_AddString(hPages, name.c_str());

    // Choose a new sequence suffix for it
    plAgePage *newPage = new plAgePage( name, IGetFreePageSeqSuffix( hPages ), 0 );
    ListBox_SetItemData( hPages, idx, (LPARAM)newPage );
   
    fDirty = true;
}
Example #3
0
/* This function updates the out-basket status
 */
void FASTCALL UpdateOutBasketStatus( void )
{
   if( hwndOutBasket )
      {
      BOOL fIsEditable;
      BOOL fHasItem;
      BOOL fCanDelete;
      HWND hwndList;
      int nSelCount;

      hwndList = GetDlgItem( hwndOutBasket, IDD_LIST );
      fIsEditable = FALSE;
      fHasItem = ( ListBox_GetCount( hwndList ) > 0 );
      fCanDelete = FALSE;
      if( ( nSelCount = ListBox_GetSelCount( hwndList ) ) > 0 )
         {
         OBINFO obinfo;
         LPOB lpob;
         int nSel;

         ListBox_GetSelItems( hwndList, 1, &nSel );
         lpob = (LPOB)ListBox_GetItemData( hwndList, nSel );
         Amob_GetObInfo( lpob, &obinfo );
         SetWindowText( GetDlgItem( hwndOutBasket, IDD_HOLD ), ( obinfo.obHdr.wFlags & OBF_HOLD ) ? GS(IDS_STR282) : GS(IDS_STR281) );
         SetWindowText( GetDlgItem( hwndOutBasket, IDD_KEEP ), ( obinfo.obHdr.wFlags & OBF_KEEP ) ? GS(IDS_STR318) : GS(IDS_STR319) );
         fIsEditable = !fInitiatingBlink && Amob_IsEditable( obinfo.obHdr.clsid ) && !TestF(obinfo.obHdr.wFlags, OBF_PENDING ) && !TestF(obinfo.obHdr.wFlags, OBF_ACTIVE );
         fCanDelete = !fInitiatingBlink && !TestF(obinfo.obHdr.wFlags, OBF_PENDING ) && !TestF(obinfo.obHdr.wFlags, OBF_ACTIVE );
         }
      EnableControl( hwndOutBasket, IDOK, fIsEditable );
      EnableControl( hwndOutBasket, IDD_LIST, fHasItem );
      EnableControl( hwndOutBasket, IDD_DELETE, fCanDelete );
      EnableControl( hwndOutBasket, IDD_HOLD, fHasItem && fCanDelete );
      EnableControl( hwndOutBasket, IDD_KEEP, fHasItem && fCanDelete );
      }
}
Example #4
0
/*
 * StatsListChangeStat:  Redisplay current statistic, whose value has changed.
 *   Requires that s is a list type stat in the current group.
 */
void StatsListChangeStat(Statistic *s)
{
   int index, top;

   if (s->num < 0 || s->num > ListBox_GetCount(hList))
   {
      debug(("StatListChangeList got illegal stat #%d\n", (int) s->num));
      return;
   }

   top = ListBox_GetTopIndex(hList);

   index = StatListFindItem(s->num);   
   if (index == -1)
   {
      debug(("StatListChangeList got illegal stat #%d\n", (int) s->num));
      return;
   }

   WindowBeginUpdate(hList);
   ListBox_DeleteString(hList, index);

   index = ListBox_AddString(hList, LookupNameRsc(s->name_res));
   ListBox_SetItemData(hList, index, s);

   ListBox_SetTopIndex(hList, top);
   WindowEndUpdate(hList);
}
Example #5
0
static void
DisconnectDialogDone(HWND hDlg, BOOL bResult)
{
    int i,Count;
    NETRESOURCE *pNetRes;
    HWND hListBoxWnd = GetDlgItem(hDlg,IDC_NETUI_DISCONLIST);

    // Free all the NETRESOURCE structs
    if ((Count = ListBox_GetCount(hListBoxWnd)) == LB_ERR)
        DEBUGMSG(ZONE_ERROR,(DBGTEXT("!DisconnectDlgDone: LB_GETCOUNT failed")));
    else {
        for (i=0; i<Count; i++) {
            pNetRes = (NETRESOURCE *)ListBox_GetItemData(hListBoxWnd,i);
            if ((LRESULT)pNetRes == LB_ERR) {
                DEBUGMSG(ZONE_ERROR,(DBGTEXT("!DisconnectDlgDone: LB_GETITEMDATA returned err %d"),
                                     GetLastError()));
            }
            else if (pNetRes == NULL) {
                DEBUGMSG(ZONE_ERROR,(DBGTEXT("!DisconnectDlgDone: LB_GETITEMDATA %d returned NULL"),i));
            }
            else
                LocalFree(pNetRes);
        }
    }

    if (!EndDialog(hDlg, bResult))
        DEBUGMSG(ZONE_ERROR,(DBGTEXT("!DisconnectDlgDone: Error in EndDialog(%X): %u"),
                             hDlg,GetLastError()));
}
Example #6
0
/* This function removes an item from the outbasket.
 */
void FASTCALL DeleteFromOutBasket( LPOB lpob )
{
   /* Now closes down the window if there is one
    * YH 03/05/96
    */
   HWND hwndSay;

   if( hwndSay = Amob_GetEditWindow( lpob ) )
      SendDlgCommand( hwndSay, IDCANCEL, BN_CLICKED );
   if( NULL != hwndOutBasket && !fIgnoreDeleteEvent )
      {
      HWND hwndList;

      hwndList = GetDlgItem( hwndOutBasket, IDD_LIST );
      if( hwndList )
         {
         int wCount;
         int nSel;

         wCount = ListBox_GetCount( hwndList );
         for( nSel = 0; nSel < wCount; ++nSel )
            if( (LPOB)ListBox_GetItemData( hwndList, nSel ) == lpob )
               {
               if( ListBox_DeleteString( hwndList, nSel ) == nSel )
                  --nSel;
               if( ListBox_GetSelCount( hwndList ) == 0 )
                  ListBox_SetSel( hwndList, TRUE, nSel );
               break;
               }
         }
      UpdateOutBasketStatus();
      }
}
Example #7
0
/*
 * LookSelChange:  We received a LBN_SELCHANGE message for the list box; see
 *   if a number item is being selected, and thus we should prompt for an amount.
 */
void LookSelChange(HWND hList)
{
   int i, count;
   Bool selected;
   
   count = ListBox_GetCount(hList);
   for (i=0; i < count; i++)
   {
      selected = (ListBox_GetSel(hList, i) > 0);
      
      if (info->flags & LD_AMOUNTS && !info->selected[i] && selected)
      {
         // Selecting item
         if (!GetAmountListBox(hList, i))
         {
            ListBox_SetSel(hList, FALSE, i);
            info->selected[i] = False;
            continue;
         }
      }
      
      info->selected[i] = selected;
   }
   
}
Example #8
0
void AddDialogString(HWND hWndDlg, const PageHash key)
{
	TCHAR title[2048];
	GetWindowText(hWndDlg, title, _countof(title));
	if (mir_tstrlen(title) > 0)
		AddFilterString(key, title);

	TCHAR szClass[64];
	GetClassName(hWndDlg, szClass, _countof(szClass));

	if (mir_tstrcmpi(szClass, _T("SysTreeView32")) == 0) {
		HTREEITEM hItem = TreeView_GetRoot(hWndDlg);
		AddTreeViewNodes(hWndDlg, key, hItem);
		return;
	}

	if (mir_tstrcmpi(szClass, _T("listbox")) == 0) {
		if (GetWindowStyle(hWndDlg) & LBS_HASSTRINGS) {
			int count = ListBox_GetCount(hWndDlg);
			for (int i=0; i < count; i++) {
				title[0] = 0; //safety
				int res = ListBox_GetText(hWndDlg, i, title);
				if (res != LB_ERR) {
					title[_countof(title) - 1] = 0;
					if (mir_tstrlen(title) > 0)
						AddFilterString(key, title);
				}
			}
		}
		return;
	}

	if (mir_tstrcmpi(szClass, _T("SysListView32")) == 0) {
		int count = ListView_GetItemCount(hWndDlg);
		for (int i=0; i < count; i++) {
			title[0] = 0; //safety
			ListView_GetItemText(hWndDlg, i, 0, title, _countof(title));

			if (mir_tstrlen(title) > 0)
				AddFilterString(key, title);
		}
		return;
	}

	if (mir_tstrcmpi(szClass, _T("combobox")) == 0) {
		if (GetWindowStyle(hWndDlg) & CBS_HASSTRINGS) {
			int count = ComboBox_GetCount(hWndDlg);
			for (int i=0; i < count; i++) {
				title[0] = 0; //safety
				int res = ComboBox_GetLBText(hWndDlg, i, title);
				if (res != CB_ERR) {
					title[_countof(title) - 1] = 0;

					if (mir_tstrlen(title) > 0)
						AddFilterString(key, title);
				}
			}
		}
	}
}
Example #9
0
void AppendLog(char* str) {
	HWND list = GetDlgItem(ghWndOutput, IDC_LST_OUTPUT);

	ListBox_InsertString(list, -1,str);
	ListBox_SetCurSel(list, ListBox_GetCount(list) - 1);
	SetFocus(list);
}
Example #10
0
LOCAL LPLISTBOXDATA DragOK(HWND hWindow)
/***********************************************************************/
{
// get the listbox data pointer, if we don't have one, get out
LPLISTBOXDATA lpData = ListBox_GetData(hWindow);
if (!lpData)
	return(NULL);

if (!lpData->fEnableMove)
	return(NULL);

// the number of items in the list box
lpData->iCount = ListBox_GetCount(hWindow);         
if (lpData->iCount == 0 ) // don't do anything to and empty list box
   return(NULL);

// see if this is a multiple selection listbox
DWORD dwStyle = GetWindowLong (hWindow, GWL_STYLE);
if (dwStyle & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL))
	{
	// see how many items are selected we only work if one is selected
	int iSelCount = ListBox_GetSelCount(hWindow);
	if (iSelCount != 1)
		return(NULL);
	ListBox_GetSelItems(hWindow, 1, &lpData->iOldPos);
	}
else
	// the current item
	lpData->iOldPos = ListBox_GetCurSel(hWindow);
return(lpData);
}
Example #11
0
void LoggerWin::platformShut()
{
  if(hWnd != NULL)
  {
    char szLog[] = "--- GOING AWAY... PRESS SPACE BAR TO CONTINUE ---";
    HWND hWndOutput = GetDlgItem(hWnd, IDC_MAIN_OUTPUT);
    ListBox_AddString(hWndOutput, "");
    ListBox_AddString(hWndOutput, szLog);
    int count = ListBox_GetCount(hWndOutput);
    ListBox_SetCaretIndex(hWndOutput, count - 1);
    UpdateWindow(hWndOutput);

    DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG_PAUSE), hWnd, (DLGPROC)PauseDlgProc);

    ProfileWin profile;

    RECT rc;
    if(GetWindowRect(hWnd, &rc))
      profile.setSizeAndPosition(rc.right - rc.left, rc.bottom - rc.top, rc.left, rc.top);

    DestroyWindow(hWnd);
    hWnd = NULL;
  }

  UnregisterClass(szClassName, hInst);
}
Example #12
0
LOCAL void SelectBegin(HWND hWindow, int x, int y)
/***********************************************************************/
{
RECT rect;

// get the listbox data pointer, if we don't have one, get out
LPLISTBOXDATA lpData = ListBox_GetData(hWindow);
if (!lpData)
	return;

// the number of items in the list box
lpData->iCount = ListBox_GetCount(hWindow);         

// get the client area
GetClientRect(hWindow, &rect);        
  
// the height of each item   
lpData->iItemHeight = ListBox_GetItemHeight(hWindow, 0);          

// the number of visible items                  
lpData->iVisible = (rect.bottom - rect.top) / lpData->iItemHeight;

// setup a timer for scrolling the list
lpData->idTimer = NULL;
lpData->idTimer = SetTimer(hWindow, 1, 100, NULL);  

// make sure we get all messages
SetCapture(hWindow);

// init values for dragging
lpData->fCapture = TRUE;
lpData->iCurPos = -1;
lpData->fSuccess = FALSE;
}
Example #13
0
int ListBox_MoveString(HWND hwndListBox, int iIndex, int iNewIndex, BOOL bRelativeToOld)
{
    int iCount = ListBox_GetCount(hwndListBox);
    int nExactNewIndex;

    if (iIndex == 0 && iNewIndex < 0)
        iNewIndex = 0;

    nExactNewIndex = bRelativeToOld ? (iIndex + iNewIndex) : iNewIndex;

    if ((bRelativeToOld && (iIndex + iNewIndex) >= iCount) ||
        (iNewIndex >= iCount))
    {
        return (LB_ERR);
    }
    else
    {
        LPTSTR pszBuffer = (LPTSTR)Mem_AllocStr(ListBox_GetTextLen(hwndListBox, iIndex) + SZ);
        LPVOID lpVoid = (LPVOID)ListBox_GetItemData(hwndListBox, iIndex);

        ListBox_GetText(hwndListBox, iIndex, pszBuffer);
        ListBox_DeleteString(hwndListBox, iIndex);
        ListBox_InsertString(hwndListBox, nExactNewIndex, pszBuffer);
        ListBox_SetItemData(hwndListBox, nExactNewIndex, lpVoid);
    
        Mem_Free(pszBuffer);
    }

    return (nExactNewIndex);
}
Example #14
0
/////////////////////////////////////////////////////////////////////////
//Function:    RemoveItem
//Description: remove a item from selected object list
/////////////////////////////////////////////////////////////////////////
void RemoveItem(HWND hDlg)
	{
	 long nObjects ;
	 long Index ;

	 EnableWindow(GetDlgItem(hDlg, removeB), FALSE) ;
	 EnableWindow(GetDlgItem(hDlg, editB), FALSE) ;
	 /*nObjects = SendDlgItemMessage (hDlg, IDD_FIELDSLIST, LB_GETSELCOUNT, 0, 0L) ;
	 if (nObjects!=0 &&(0!=SendDlgItemMessage (hDlg, IDD_FIELDSLIST, LB_GETCOUNT, 0, 0)))
	 {
		while(SendDlgItemMessage (hDlg, IDD_FIELDSLIST, LB_GETSELITEMS, 1, (long) &Index) !=0)
	 	{
			SendDlgItemMessage (hDlg, IDD_FIELDSLIST, LB_DELETESTRING, (WORD)Index, 0) ;
		}
		SendDlgItemMessage (hDlg, IDD_FIELDSLIST, LB_SETCARETINDEX, 0, 0) ;
     }*/
	 nObjects = ListBox_GetSelCount (GetDlgItem(hDlg, IDD_FIELDSLIST)) ;
	 if(nObjects!=0&&(0!=ListBox_GetCount(GetDlgItem(hDlg, IDD_FIELDSLIST))))
		{
		while(ListBox_GetSelItems (GetDlgItem(hDlg,IDD_FIELDSLIST),1, &Index)!=0)
			{
			ListBox_DeleteString (GetDlgItem(hDlg, IDD_FIELDSLIST), Index) ;
			}
		ListBox_SetCaretIndex (GetDlgItem(hDlg, IDD_FIELDSLIST),0) ;
		}
	 SetFocus(GetDlgItem (hDlg,IDD_FIELDSLIST)) ;
	}
Example #15
0
/*
 * MaybeEnableAddButton: Enable/disable the "add spell" button
 *   depending on whether the currently selected spell in the available
 *   list box can be chosen.
 */
void MaybeEnableAddButton(HWND hDlg)
{
   int i;
   int school = 0;
   Spell *s;
   BOOL enable = TRUE;
   int index = ListBox_GetCurSel(hList1);
   if (index != LB_ERR)
   {
      // First find any chosen Qor/Shallile spells
      for (i = 0; i < ListBox_GetCount(hList2); ++i)
      {
         s = (Spell *) ListBox_GetItemData(hList2, i);
         if (s->school == SS_QOR || s->school == SS_SHALILLE)
            school = s->school;
      }
      
      // If school of selected spell conflicts, disable button
      s = (Spell *) ListBox_GetItemData(hList1, index);
      
      if (school == SS_QOR && s->school == SS_SHALILLE ||
          school == SS_SHALILLE && s->school == SS_QOR)
         enable = FALSE;
   }

   EnableWindow(GetDlgItem(hDlg, IDC_ADDSPELL), enable);
}
Example #16
0
  static char raise_killed_monster(HWND hDlg)
  {
    HWND listdlg = PrepareListWindow(hDlg);
    HWND list = GetDlgItem(listdlg,IDC_LIST);
    char buff[256];
    int i;
    int res;

    for (i = 0;i<MAX_MOBS;i++) if (~mobs[i].vlajky & MOB_LIVE && mobs[i].cislo_vzoru != 0) 
    {
      int p;
      _snprintf(buff,sizeof(buff),"%4d. %s (sector: %d home %d)",i,mobs[i].name,mobs[i].sector,mobs[i].home_pos);
      kamenik2windows(buff,strlen(buff),buff);
      p = ListBox_AddString(list,buff);
      ListBox_SetItemData(list,p,i);
    }
    res = PumpDialogMessages(listdlg);
    while (res == IDOK)
    {
      int cnt;
      for (i = 0,cnt = ListBox_GetCount(list);i<cnt;i++) if (ListBox_GetSel(list,i))
      {
        int idx = ListBox_GetItemData(list,i);
        mobs[idx].vlajky |= MOB_LIVE;
        mobs[idx].lives = mobs[idx].vlastnosti[VLS_MAXHIT];
        wzprintf("%s znovu povstal(a)\r\n",mobs[idx].name);
        SEND_LOG("(WIZARD) '%s' has been raised",mobs[idx].name,0);
      }
      res = PumpDialogMessages(listdlg);
    }
    CloseListWindow(listdlg);
    return 1;
  }
Example #17
0
void CSetDlgNetwork::OnBnClickedButtonAddTcp()
{
	// TODO: ここにコントロール通知ハンドラー コードを追加します。
	DWORD ip = 0;
	SendDlgItemMessage(m_hWnd, IDC_IPADDRESS_TCP, IPM_GETADDRESS, 0, (LPARAM)&ip);
	UINT tcpPort = GetDlgItemInt(m_hWnd, IDC_EDIT_PORT_TCP, NULL, FALSE);

	NW_SEND_INFO item;
	item.ip = ip;
	item.port = tcpPort;
	Format(item.ipString, L"%d.%d.%d.%d",
		(item.ip&0xFF000000)>>24,
		(item.ip&0x00FF0000)>>16,
		(item.ip&0x0000FF00)>>8,
		(item.ip&0x000000FF) );

	wstring add = L"";
	Format(add, L"%s:%d",item.ipString.c_str(), item.port);
	item.broadcastFlag = FALSE;

	HWND hItem = GetDlgItem(IDC_LIST_IP_TCP);
	for( int i=0; i<ListBox_GetCount(hItem); i++ ){
		WCHAR buff[256]=L"";
		int len = ListBox_GetTextLen(hItem, i);
		if( 0 <= len && len < 256 ){
			ListBox_GetText(hItem, i, buff);
			if(lstrcmpi(buff, add.c_str()) == 0 ){
				return ;
			}
		}
	}
	int index = ListBox_AddString(hItem, add.c_str());
	ListBox_SetItemData(hItem, index, (int)tcpSendList.size());
	tcpSendList.push_back(item);
}
Example #18
0
/*
 * StatsListVScroll:  User did something with stats list scroll bar.
 */
void StatsListVScroll(HWND hwnd, HWND hwndCtl, UINT code, int pos)
{
   int old_top;  // Current top row index
   int new_top;  // New top row index
   int num_items;

   old_top = ListBox_GetTopIndex(hwnd);
   num_items = ListBox_GetCount(hwnd);

   switch (code)
   {
   case SB_LINEUP:
      new_top = old_top - 1;
      break;

   case SB_LINEDOWN:
      new_top = old_top + 1;
      break;

   case SB_PAGEUP:
      new_top = old_top - num_visible;
      break;

   case SB_PAGEDOWN:
      new_top = old_top + num_visible;
      break;

   case SB_THUMBPOSITION:
      new_top = pos;
      break;

   case SB_THUMBTRACK:
      new_top = pos;
      break;

   case SB_BOTTOM:
      new_top = num_items - num_visible;
      break;

   case SB_TOP:
      new_top = 0;
      break;
      
   default:
      // Pointless "SB_ENDSCROLL" added recently
      return;
   }
   new_top = max(new_top, 0);
   new_top = min(new_top, num_items - num_visible);

   if (new_top != old_top)
   {
      SetScrollPos(hwnd, SB_VERT, new_top, TRUE); 

      WindowBeginUpdate(hwnd);
      ListBox_SetTopIndex(hwnd, new_top);
      WindowEndUpdate(hwnd);
   }
}
Example #19
0
static void DispInfoExt(HWND hDlg,CShellExt *lpcs)
{
	//クリア
	long items = ListBox_GetCount(GetDlgItem(hDlg,IDC_LIST_VALUE));
	if(items != LB_ERR)
	{
		for(int i=0; i<items; i++)
		{
			COggExt *oggExt = (COggExt *)ListBox_GetItemData(GetDlgItem(hDlg,IDC_LIST_VALUE),0);
			if(oggExt)
			{
				delete oggExt;
			}
			ListBox_DeleteString(GetDlgItem(hDlg,IDC_LIST_VALUE),0);
		}
	}

	CString strDisp;
	CStringArray strArray;
	lpcs->m_Ogg.GetCommentNames(strArray);
	items = 0;
	for(int i=0; i<strArray.GetSize(); i++)
	{
		CString strName = strArray.GetAt(i);
		CString strValue;
		CString _strValue;
		int j = 0;
		while(1)
		{
			if(!lpcs->m_Ogg.GetComment(strName,j++,strValue))
			{
				break;
			}

			//標準名は除外
			if((j == 1) &&
				(
				!strName.Compare(_T("TITLE")) ||
				!strName.Compare(_T("TRACKNUMBER")) ||
				!strName.Compare(_T("ARTIST")) ||
				!strName.Compare(_T("ALBUM")) ||
				!strName.Compare(_T("ALBUMARTIST")) ||
				!strName.Compare(_T("DISCNUMBER")) ||
				!strName.Compare(_T("DATE")) ||
				!strName.Compare(_T("GENRE")) ||
				!strName.Compare(_T("COMMENT")))
				)
			{
				continue;
			}
//			TRACE(_T("OGG %s %s\n"),strName,strValue);
			COggExt *oggExt = new COggExt(strName,strValue);
			ListBox_AddString(GetDlgItem(hDlg,IDC_LIST_VALUE),oggExt->Get1LineDisp());
			ListBox_SetItemData(GetDlgItem(hDlg,IDC_LIST_VALUE),items,oggExt);
			items++;
		}
	}
}
Example #20
0
void ClearLog(void) {
	HWND list = GetDlgItem(ghWndOutput, IDC_LST_OUTPUT);
	int count, i;

	count = ListBox_GetCount(list);
	for (i = 0; i < count; i++) {
		ListBox_DeleteString(list, 0);
	}
}
Example #21
0
/* 
 * StatsListDrawStat:  Draw info about stat in stat list box.
 *   selected is True iff the item is currently selected.
 */
void StatsListDrawStat(const DRAWITEMSTRUCT *lpdis, Bool selected, Bool bShowSpellIcon )
{
   HFONT hOldFont;
   Statistic *s;
   char str[MAXRSCSTRING + 10];
   RECT r;
   int lastItem = ListBox_GetCount(lpdis->hwndItem) - 1;
   RECT rcWnd;

   GetClientRect(lpdis->hwndItem,&rcWnd);
   if (lpdis->rcItem.bottom > rcWnd.bottom)
      return;

   hOldFont = (HFONT) SelectObject(lpdis->hDC, GetFont(FONT_STATS));

   s = (Statistic *) ListBox_GetItemData(hList, lpdis->itemID);
   if (s == NULL)
      return;

   sprintf(str, "%s %d%%", LookupNameRsc(s->name_res), s->list.value);

   SetBkMode(lpdis->hDC, TRANSPARENT);

   memcpy(&r, &lpdis->rcItem, sizeof(RECT));
   r.left += ENCHANT_SIZE + 2;
   // Draw text with drop shadow
   SetTextColor(lpdis->hDC, GetColor(COLOR_STATSBGD));
   //DrawText(lpdis->hDC, str, strlen(str), &r,  DT_CENTER);
   DrawText( lpdis->hDC, str, strlen(str), &r, DT_LEFT );
   OffsetRect(&r, 1, 1);
   SetTextColor(lpdis->hDC, selected ? GetColor(COLOR_HIGHLITE) : GetColor(COLOR_STATSFGD));
   //DrawText(lpdis->hDC, str, strlen(str), &r,  DT_CENTER);
   DrawText( lpdis->hDC, str, strlen(str), &r, DT_LEFT );

   SelectObject(lpdis->hDC, hOldFont);

   switch (StatsGetCurrentGroup())
   {
   AREA areaIcon;
   case STATS_SPELLS:
   case STATS_SKILLS:
      areaIcon.x = lpdis->rcItem.left;
      areaIcon.y = lpdis->rcItem.top;
      areaIcon.cx = ENCHANT_SIZE;		//xxx
      areaIcon.cy = ENCHANT_SIZE;
      DrawObjectIcon(lpdis->hDC, s->list.icon, 0, True, &areaIcon, NULL, 0, 0, True);
      break;
   }
   if (lastItem == (int)lpdis->itemID)
   {
      RECT rcWnd;
      GetClientRect(lpdis->hwndItem,&rcWnd);
      rcWnd.top = lpdis->rcItem.bottom;
      if (rcWnd.top < rcWnd.bottom)
	 InvalidateRect(lpdis->hwndItem,&rcWnd,TRUE);
   }
}
Example #22
0
LOCAL void SelectItems(HWND hWindow, int iSelect)
/***********************************************************************/
{
LPLISTBOXDATA lpData = ListBox_GetData(hWindow);
if (!lpData)
	return;

if (lpData->iSelectDir > 0) // select downwards
	{
	ListBox_SelItemRange(hWindow, FALSE, 0, iSelect-1);
	ListBox_SelItemRange(hWindow, TRUE, iSelect, ListBox_GetCount(hWindow)-1);
	}
else	// select upwards
	{
	ListBox_SelItemRange(hWindow, FALSE, iSelect+1, ListBox_GetCount(hWindow)-1);
	ListBox_SelItemRange(hWindow, TRUE, 0, iSelect);
	}
ListBox_SetCaretIndex(hWindow, iSelect);
}
Example #23
0
VOID CUserControlList::Clear()
{
	//удалить все элементы в списке
	while(ListBox_GetCount(mhWindow))
	{
		//удалить элемент
		delete (CUserControlListElement*)ListBox_GetItemData(mhWindow,0);
		ListBox_DeleteString(mhWindow,0);
	}
}
Example #24
0
void plAgeDescInterface::ISaveCurAge( const plFileName &path, bool checkSeqNum )
{
    hsUNIXStream s;
    if( !s.Open( path, "wt" ) )
    {
        hsMessageBox("Unable to open the Age Description file for writing. Updates not saved.", "Error", hsMessageBoxNormal);
        return;
    }

    plAgeDescription aged;
    aged.SetAgeNameFromPath( path );

    // set the date and time
    HWND hDate = GetDlgItem(fhDlg, IDC_DATE);
    SYSTEMTIME dst = {0};
    DateTime_GetSystemtime(hDate, &dst);
    HWND hTime = GetDlgItem(fhDlg, IDC_TIME);
    SYSTEMTIME tst = {0};
    DateTime_GetSystemtime(hTime, &tst);
    aged.SetStart(dst.wYear,dst.wMonth,dst.wDay,tst.wHour,tst.wMinute,tst.wSecond);
    aged.SetDayLength(fSpin->GetFVal());
    aged.SetMaxCapacity(fCapSpin->GetIVal());
    if( checkSeqNum )
    {
        ICheckSequenceNumber( aged );
    }
    else if( IsDlgButtonChecked( fhDlg, IDC_RSVDCHECK ) )
    {
        // Store reserved sequence prefix
        aged.SetSequencePrefix( -fSeqPrefixSpin->GetIVal() );
    }
    else
    {
        aged.SetSequencePrefix( fSeqPrefixSpin->GetIVal() );
    }

    // gather pages
    HWND hPages = GetDlgItem(fhDlg, IDC_PAGE_LIST);
    int count = ListBox_GetCount(hPages);
    if (count != LB_ERR)
    {
        for (int i = 0; i < count; i++)
        {
            char pageName[256];
            ListBox_GetText(hPages, i, pageName);
            plAgePage *page = (plAgePage *)ListBox_GetItemData( hPages, i );
            aged.AppendPage( pageName, page->GetSeqSuffix(), page->GetFlags() );
        }
    }

    // write it all out
    aged.Write(&s);
    s.Close();
}
Example #25
0
/*
 * LookInitDialog:  Handle WM_INITDIALOG messages.
 */ 
BOOL LookInitDialog(HWND hDlg, HWND hwndFocus, LPARAM lParam) 
{
   DWORD style;
   int numItems, index;

   info = (LookDialogStruct *) lParam;

   CenterWindow(hDlg, GetParent(hDlg));
   info->hwndListBox = GetDlgItem(hDlg, IDC_ITEMLIST);
   info->hwndFind = GetDlgItem(hDlg, IDC_ITEMFIND);
   info->hwndQuanList = GetDlgItem(hDlg, IDC_QUANLIST);

   // Make list sorted if desired
   if (info->flags & LD_SORT)
   {
      style = GetWindowLong(info->hwndListBox, GWL_STYLE);
      SetWindowLong(info->hwndListBox, GWL_STYLE, style | LBS_SORT);
   }

   if (!(info->flags & LD_AMOUNTS))
   {
      ShowWindow(GetDlgItem(hDlg, IDC_STATIC1), SW_HIDE);
      ShowWindow(GetDlgItem(hDlg, IDC_QUANLIST), SW_HIDE);
   }
   
   // Draw objects in owner-drawn list box
   SetWindowLong(info->hwndListBox, GWL_USERDATA, OD_DRAWOBJ);
   
   SetWindowText(hDlg, info->title);  /* Set window's title */

   // Remember state of list box items
   info->selected = (Bool *) SafeMalloc(list_length(info->contents) * sizeof(Bool));
   memset(info->selected, 0, list_length(info->contents) * sizeof(Bool));
   
   LookListSetContents(info->hwndListBox, info->contents, info->flags);

   numItems = ListBox_GetCount(info->hwndListBox);
   for(index=0; index < numItems; index++)
   {
      ListBox_AddString(info->hwndQuanList," ");
      ListBox_SetItemData(info->hwndQuanList, index, 0);
   }
      
   Edit_LimitText(info->hwndFind, MAXNAME);
   SetWindowFont(info->hwndFind, GetFont(FONT_EDIT), TRUE);
   
   hwndLookDialog = hDlg;

   /* Subclass main list box */
   info->lpfnDefLookProc = SubclassWindow(info->hwndListBox, LookProc);

   return TRUE;
}
Example #26
0
void FASTCALL CmdPrintOutbasket( HWND hwnd )
{
   HPRINT hPr;
   BOOL fOk = TRUE;
   LPSTR lpOBPrintBuf;

   /* Show and get the print terminal dialog box.
    */
   if( !Adm_Dialog( hRscLib, hwnd, MAKEINTRESOURCE(IDDLG_PRINTOUTBASKET), PrintOutbasketDlg, 0L ) )
      return;

   fNewMemory( &lpOBPrintBuf, LEN_TEMPBUF );
   GetWindowText( hwnd, lpOBPrintBuf, LEN_TEMPBUF );
   if(   NULL != ( hPr = BeginPrint( hwnd, lpOBPrintBuf, &lfFixedFont ) ) )
      {
      register int cCount;

      for( cCount = 0; fOk && cCount < cCopies; ++cCount )
         {

      int nCount;
      int c;
      HWND hwndList;

      ResetPageNumber( hPr );
      fOk = BeginPrintPage( hPr );

      hwndList = GetDlgItem( hwnd, IDD_LIST );

      nCount = ListBox_GetCount( hwndList );
      for( c = 0; c != nCount; c++ )
         {
         OBINFO obinfo;
         LPOB lpob;

         lpob = (LPOB)ListBox_GetItemData( hwndList, c );
         Amob_GetObInfo( lpob, &obinfo );
         Amob_Describe( lpob, lpOBPrintBuf );
         if( TestF(obinfo.obHdr.wFlags, OBF_HOLD) )
            wsprintf( lpOBPrintBuf, "%s (H)", lpOBPrintBuf );
         if( TestF(obinfo.obHdr.wFlags, OBF_KEEP) )
            wsprintf( lpOBPrintBuf, "%s (K)", lpOBPrintBuf );
         if( fOk )
            fOk = PrintLine( hPr, lpOBPrintBuf );
         }
      if( fOk )
         EndPrintPage( hPr );
      }
      }
   EndPrint( hPr );
   if( NULL != lpOBPrintBuf )
      FreeMemory( &lpOBPrintBuf );
}
Example #27
0
/*
 * StatsListLButton:  User clicked left button on stats list.
 */
void StatsListLButton(HWND hwnd, BOOL fDoubleClick, int x, int y, UINT keyFlags)
{
   int index;

   SetFocus(hwnd);
   index = y / ListBox_GetItemHeight(hwnd, 0) + ListBox_GetTopIndex(hwnd);

   if (index >= ListBox_GetCount(hwnd))
      return;

   ListBox_SetCurSel(hwnd, index);	
}
Example #28
0
void CInstanceInfoWindow::SelectListItem(u32 id)
{
	u32 count = ListBox_GetCount(mInstancesListBox);
	for (u32 i = 0; i < count; i++)
	{
		u32 data = ListBox_GetItemData(mInstancesListBox, i);
		if (data == id)
		{
			ListBox_SetCurSel(mInstancesListBox, i);
			return;
		}
	}
}
void CCreateLightNodeWindow::SelectListItem(u32 id)
{
	u32 count = ListBox_GetCount(mLightNodesList);
	for (u32 i = 0; i < count; i++)
	{
		u32 data = ListBox_GetItemData(mLightNodesList, i);
		if (data == id)
		{
			ListBox_SetCurSel(mLightNodesList, i);
			return;
		}
	}
}
Example #30
0
/*
 * MailFindIndex:  Return index in list box of message with given number.
 *   Returns -1 if message not found.
 */
int MailFindIndex(int number)
{
   int i, msgnum, num_msgs;

   num_msgs = ListBox_GetCount(hMsgList);
   for (i=0; i < num_msgs; i++)
   {
      msgnum = ListBox_GetItemData(hMsgList, i);
      if (msgnum == number)
	 return i;
   }
   return -1;
}