Example #1
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 #2
0
static void PASCAL PostMessageToMdi(HWND hDlg,WORD param)
{
  HWND hMdi=GetProp(hDlg,gsPropName);
  HCURSOR hOldCursor=SetCursor(LoadCursor(NULL,IDC_WAIT));
  switch (param)
    {
    case IDOK:  // show current window
      {
      HWND hwndList = GetDlgItem(hDlg, 100);
      int curSel = ListBox_GetCurSel(hwndList);
      if (curSel!=LB_ERR)
        {
        HWND hWnd = (HWND)ListBox_GetItemData(hwndList, curSel);
        if (IsIconic(hWnd))
          SendMessage(hMdi,WM_MDIRESTORE,(WPARAM)hWnd,0L);
        SendMessage(hMdi,WM_MDIACTIVATE,(WPARAM)hWnd,0L);
        }
      }
      break;

    case 13: // iconize all
      PostToAll(hDlg,hMdi,TRUE,SW_SHOWMINNOACTIVE);
      break;

    case 14: // restore all
      PostToAll(hDlg,hMdi,FALSE,WM_MDIRESTORE);
      break;

    case 15: // close all
      PostToAll(hDlg,hMdi,FALSE,WM_MDIDESTROY);
      break;
    }
  SetCursor(hOldCursor);
}
void plResponderProc::ICreateCmdRollups()
{
    // Get the index of the current command
    HWND hCmds = GetDlgItem(fhDlg, IDC_CMD_LIST);
    int cmdIdx = ListBox_GetCurSel(hCmds);

    if (cmdIdx != LB_ERR && cmdIdx != fCmdIdx)
    {
        fCmdIdx = cmdIdx;
        fIgnoreNextDrop = true;

        // Save the current scroll position and reset it at the end, so the panels
        // won't always jerk back up to the top
        IRollupWindow *rollup = GetCOREInterface()->GetCommandPanelRollup();
        int scrollPos = rollup->GetScrollPos();

        // Destroy the last command's rollups
        IRemoveCmdRollups();

        // Create the rollup for the current command
        IParamBlock2 *pb = (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdParams, 0, fCmdIdx);
        fCmdMap = ICreateMap(pb);

        ResponderWait::InitDlg(fStatePB, fCmdIdx, GetDlgItem(fhDlg, IDC_CMD_LIST));
        pb = (IParamBlock2*)fStatePB->GetReferenceTarget(kStateCmdWait, 0, fCmdIdx);
        fWaitMap = ICreateMap(pb);

        rollup->SetScrollPos(scrollPos);
    }
}
Example #4
0
PPH_STRING PhGetListBoxString(
    _In_ HWND hwnd,
    _In_ INT Index
    )
{
    PPH_STRING string;
    ULONG length;

    if (Index == -1)
    {
        Index = ListBox_GetCurSel(hwnd);

        if (Index == -1)
            return NULL;
    }

    length = ListBox_GetTextLen(hwnd, Index);

    if (length == LB_ERR)
        return NULL;
    if (length == 0)
        return PhReferenceEmptyString();

    string = PhCreateStringEx(NULL, length * 2);

    if (ListBox_GetText(hwnd, Index, string->Buffer) != LB_ERR)
    {
        return string;
    }
    else
    {
        PhDereferenceObject(string);
        return NULL;
    }
}
Example #5
0
CUserControlListElement* CUserControlList::GetSelectedElement()
{
	//получить индекс выделенного элемента
	UINT ElementIndex=ListBox_GetCurSel(mhWindow);
	if(ElementIndex==LB_ERR) return NULL;
	return (CUserControlListElement*)ListBox_GetItemData(mhWindow,ElementIndex);
}
Example #6
0
void Cls_OnAdvCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)
//WM_COMMAND handler
{
	int     index;
	DWORD   dwItem;
	
	switch(codeNotify)
	{
		case LBN_SELCHANGE:
			index = ListBox_GetCurSel(hSettingsListbox);
			dwItem = ListBox_GetItemData(hSettingsListbox, index);
			
			if ( hCurrentDlg )
				ShowWindow(hCurrentDlg, SW_HIDE);
				
			if ( dwItem IS IDI_ERROR_LOG )
				hCurrentDlg = hErrLogDlg;
			else if ( dwItem IS IDI_ERROR_HANDLING )
				hCurrentDlg = hErrorsDlg;
			else if ( dwItem IS IDI_MEMORY )
				hCurrentDlg = hMemoryDlg;
			else if ( dwItem IS IDI_SECURITY )
				hCurrentDlg = hSecurityDlg;
			else if ( dwItem IS IDI_SETUP )
				hCurrentDlg = hSetupDlg;
			else if ( dwItem IS IDI_OUTPUT )
				hCurrentDlg = hOutputDlg;
			ShowWindow(hCurrentDlg, SW_SHOW);
			break;

			default:
				;
	}
}
Example #7
0
bool plMtlEventProc::IUserCommand(HWND hWnd, IParamBlock2* pb, int cmd, int resID)
{
    if (cmd == LBN_SELCHANGE && resID == IDC_EVENT_LIST)
    {
        HWND hList = GetDlgItem(hWnd, IDC_EVENT_LIST);
        int idx = ListBox_GetCurSel(hList);
        BOOL selected = ListBox_GetSel(hList, idx);
        int eventType = ListBox_GetItemData(hList, idx);

        if (eventType == kAnimEventBegin)
            pb->SetValue(kMtlBegin, 0, selected);
        else if (eventType == kAnimEventEnd)
            pb->SetValue(kMtlEnd, 0, selected);
        else if (eventType == kAnimEventMarker)
        {
            char buf[256];
            ListBox_GetText(hList, idx, buf);
            ST::string text = ST::string::from_utf8(buf);
            if (selected)
            {
                if (!IsMarkerSelected(pb, kMtlMarkers, text))
                {
                    TCHAR* name = buf;
                    pb->Append(kMtlMarkers, 1, &name);
                }
            }
            else
                IsMarkerSelected(pb, kMtlMarkers, text, true);
        }

        return true;
    }

    return false;
}
Example #8
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 #9
0
VOID ViewNoises_NoiseChanged( HWND hwnd )
{
    INT i;
    CHAR szBuf[128];
    LRESULT lResult;

    lResult = ListBox_GetCurSel(GetDlgItem(hwnd, IDC_NOISE_LIST));

    if (lResult >= 0 && lResult < po->nNoises)
    {
        i = (INT)lResult;

        DoubleToString(szBuf, po->pNoiseData[i].radius, 0);
        Edit_SetText(GetDlgItem(hwnd, IDC_NOISE_RADIUS), szBuf);

        DoubleToString(szBuf, po->pNoiseData[i].height, 0);
        Edit_SetText(GetDlgItem(hwnd, IDC_NOISE_HEIGHT), szBuf);

        wsprintf(szBuf, "%d", po->pNoiseData[i].delay);
        Edit_SetText(GetDlgItem(hwnd, IDC_NOISE_DELAY), szBuf);
    }

    return;

} // ViewNoises_NoiseChanged
Example #10
0
void CSetDlgNetwork::OnBnClickedButtonDelUdp()
{
	// TODO: ここにコントロール通知ハンドラー コードを追加します。
	HWND hItem = GetDlgItem(IDC_LIST_IP_UDP);
	int sel = ListBox_GetCurSel(hItem);
	if( sel != LB_ERR ){
		int index = (int)ListBox_GetItemData(hItem, sel);

		vector<NW_SEND_INFO>::iterator itr;
		itr = udpSendList.begin();
		advance(itr, index);
		udpSendList.erase(itr);

		ListBox_ResetContent(hItem);

		for( int i=0; i<(int)udpSendList.size(); i++ ){
			wstring add = L"";
			Format(add, L"%s:%d",udpSendList[i].ipString.c_str(), udpSendList[i].port);
			if( udpSendList[i].broadcastFlag == TRUE ){
				add+= L" ブロードキャスト";
			}
			index = ListBox_AddString(hItem, add.c_str());
			ListBox_SetItemData(hItem, index, i);
		}
	}
}
Example #11
0
// Get single selection, for single choice list items
int wxListBox::GetSelection() const
{
    wxCHECK_MSG( !HasMultipleSelection(),
                 -1,
                 wxT("GetSelection() can't be used with multiple-selection listboxes, use GetSelections() instead.") );

    return ListBox_GetCurSel(GetHwnd());
}
Example #12
0
static void sttUpdateAccountInfo(HWND hwndDlg, struct TAccMgrData *dat)
{
	HWND hwndList = GetDlgItem(hwndDlg, IDC_ACCLIST);
	int curSel = ListBox_GetCurSel( hwndList );
	if ( curSel != LB_ERR ) {
		HWND hwnd;
		char svc[MAXMODULELABELLENGTH];

		PROTOACCOUNT *pa = (PROTOACCOUNT *)ListBox_GetItemData(hwndList, curSel);
		if ( pa ) {
			EnableWindow( GetDlgItem( hwndDlg, IDC_UPGRADE ), pa->bOldProto || pa->bDynDisabled );
			EnableWindow( GetDlgItem( hwndDlg, IDC_EDIT ), !pa->bOldProto && !pa->bDynDisabled );
			EnableWindow( GetDlgItem( hwndDlg, IDC_REMOVE ), TRUE );
			EnableWindow( GetDlgItem( hwndDlg, IDC_OPTIONS ), pa->ppro != 0 );

			if ( dat->iSelected >= 0 ) {
				PROTOACCOUNT *pa_old = (PROTOACCOUNT *)ListBox_GetItemData(hwndList, dat->iSelected);
				if (pa_old && pa_old != pa && pa_old->hwndAccMgrUI)
					ShowWindow(pa_old->hwndAccMgrUI, SW_HIDE);
			}

			if ( pa->hwndAccMgrUI ) {
				ShowWindow(GetDlgItem(hwndDlg, IDC_TXT_INFO), SW_HIDE);
				ShowWindow(pa->hwndAccMgrUI, SW_SHOW);
			}
			else if ( !pa->ppro ) {
				ShowWindow(GetDlgItem(hwndDlg, IDC_TXT_INFO), SW_SHOW);
				SetWindowText(GetDlgItem(hwndDlg, IDC_TXT_INFO), TranslateT("Account is disabled. Please activate it to access options."));
			}
			else {
				mir_snprintf(svc, SIZEOF(svc), "%s%s", pa->szModuleName, PS_CREATEACCMGRUI);
				hwnd = (HWND)CallService(svc, 0, (LPARAM)hwndDlg);
				if (hwnd && (hwnd != (HWND)CALLSERVICE_NOTFOUND)) {
					RECT rc;

					ShowWindow(GetDlgItem(hwndDlg, IDC_TXT_INFO), SW_HIDE);

					GetWindowRect(GetDlgItem(hwndDlg, IDC_TXT_INFO), &rc);
					MapWindowPoints(NULL, hwndDlg, (LPPOINT)&rc, 2);
					SetWindowPos(hwnd, hwndList, rc.left, rc.top, 0, 0, SWP_NOSIZE|SWP_SHOWWINDOW);

					pa->hwndAccMgrUI = hwnd;
				}
				else {
					ShowWindow(GetDlgItem(hwndDlg, IDC_TXT_INFO), SW_SHOW);
					SetWindowText(GetDlgItem(hwndDlg, IDC_TXT_INFO), TranslateT(legacyMsg));
			}	}
			return;
	}	}
	
	EnableWindow( GetDlgItem( hwndDlg, IDC_UPGRADE ), FALSE );
	EnableWindow( GetDlgItem( hwndDlg, IDC_EDIT ), FALSE );
	EnableWindow( GetDlgItem( hwndDlg, IDC_REMOVE ), FALSE );
	EnableWindow( GetDlgItem( hwndDlg, IDC_OPTIONS ), FALSE );

	ShowWindow(GetDlgItem(hwndDlg, IDC_TXT_INFO), SW_SHOW);
	SetWindowText(GetDlgItem(hwndDlg, IDC_TXT_INFO), TranslateT(welcomeMsg));
}
void ProjectConfigDialog::onButtonRemoveSearchPathClicked(void)
{
    int index = ListBox_GetCurSel(GetDlgItem(m_hwndDialog, IDC_LIST_PACKAGE_SEARCH_PATHS));
    if (index != LB_ERR)
    {
        ListBox_DeleteString(GetDlgItem(m_hwndDialog, IDC_LIST_PACKAGE_SEARCH_PATHS), index);
        m_project.setPackagePath(makeSearchPath().c_str());
    }
}
Example #14
0
void TPack_ExtractSelected(TPack_WindowData * pData)
{
	HWND            hLB = GetDlgItem(pData->hwnd, IDC_TEXTURELIST);
	int             nSel;
	BitmapEntry *	pEntry;
	char            szName[MAX_TEXTURE_NAME_LENGTH];
	char            szFile[MAX_PATH];
	char            szPath[MAX_PATH];
	int             nErrorCode;

	//----------------------------------------------
	// Get current selected list box entry.
	// Get the  geBitmap.
	// Write 8-bit BMP file.
	//----------------------------------------------

	// Ouput to the current directory
	GetCurrentDirectory(MAX_PATH, szPath);

	nSel = ListBox_GetCurSel(hLB);
	if (nSel != LB_ERR)

	if (ListBox_GetText(hLB, nSel, szName) != LB_ERR)
	{
		pEntry = FindBitmap(pData, szName);
		if (pEntry)
		{
			// Create an output file name
			strcpy(szFile, szPath);
			strcat(szFile, "\\");
			strcat(szFile, pEntry->Name);
			strcat(szFile, ".bmp");

			nErrorCode = WriteBMP8(szFile, pEntry->Bitmap);

			if (nErrorCode != TPACKERROR_OK)
			{
				// Error writing this bitmap
				switch (nErrorCode)
				{
					case TPACKERROR_CREATEFILE:
						NonFatalError("Unable to create output file %s", szFile);
						break;
					case TPACKERROR_WRITE:
						NonFatalError("I/O error writing %s", szFile);
						break;
					case TPACKERROR_MEMORYALLOCATION:
						NonFatalError("Memory allocation error writing %s", szFile);
						break;
					case TPACKERROR_UNKNOWN:
					default:
						NonFatalError("UInknown error writing %s", szFile);
				}
			}
		}
	}
}
Example #15
0
void w32g_rotate_playlist(int dest)
{
    int i, i1, i2;
    HWND hListBox;
    PlayListEntry save;
	char temp[1024];

    if(playlist.nfiles == 0)
	return;
    if(!(hListBox = playlist_box()))
	return;

    i1 = ListBox_GetCurSel(hListBox);
    i2 = playlist.nfiles - 1;
    if(i1 >= i2)
	return;

#ifdef W32G_RANDOM_IS_SHUFFLE
	w32g_shuffle_playlist_rotate(dest,i1,i2);
#endif
    if(dest > 0)
    {
	save = playlist.list[i2];
	for(i = i2; i > i1; i--) /* i: i2 -> i1 */
	    playlist.list[i] = playlist.list[i - 1];
	playlist.list[i] = save;
	ListBox_GetText(hListBox,i2,temp);
    ListBox_DeleteString(hListBox,i2);
    ListBox_InsertString(hListBox,i1,temp);
	ListBox_SetCurSel(hListBox,i1);
	if(playlist.selected == i2){
	    playlist.selected = i1;
		w32g_update_playlist_pos(playlist.selected);
	} else if(i1 <= playlist.selected && playlist.selected < i2){
	    playlist.selected++;
		w32g_update_playlist_pos(playlist.selected);
	}
    }
    else
    {
	save = playlist.list[i1];
	for(i = i1; i < i2; i++) /* i: i1 -> i2 */
	    playlist.list[i] = playlist.list[i + 1];
	playlist.list[i] = save;
	ListBox_GetText(hListBox,i1,temp);
    ListBox_DeleteString(hListBox,i1);
    ListBox_InsertString(hListBox,-1,temp);
	ListBox_SetCurSel(hListBox,i1);
	if(playlist.selected == i1){
	    playlist.selected = i2;
		w32g_update_playlist_pos(playlist.selected);
	} else if(i1 < playlist.selected && playlist.selected <= i2){
	    playlist.selected--;    
		w32g_update_playlist_pos(playlist.selected);
	}
    }
}
Example #16
0
/*
 * OnCommand()
 */
void sd_OnCommand(HWND storeDlg, UINT cmdID, HWND ctrl, UINT notify)
{
    int lbxIndex;
    int itemGroupIndex;
    int lbxCount;

    switch (cmdID) {
        case IDOK:
            if (sd_itemToStore == SI_VCED) {
                itemGroupIndex = SI_VMEM;
                lbxCount = 16;
            } else { /* (sd_itemToStore == SI_PCED) */
                itemGroupIndex = SI_PMEM;
                lbxCount = 12;
            }
            *sd_destIndex = ListBox_GetCurSel(sd_lbx[0]);
            if (*sd_destIndex == -1) {
                *sd_destIndex = lbxCount + ListBox_GetCurSel(sd_lbx[1]);
            }
            *sd_destIndex += itemGroupIndex;
        case IDCANCEL:
            EndDialog(storeDlg, cmdID);
            break;
        case IDC_STORE1_LBX:
            lbxIndex = 0;
            goto LBX_INDEX_SET;
        case IDC_STORE2_LBX:
            lbxIndex = 1;
LBX_INDEX_SET:
            if (notify == LBN_SETFOCUS) {
                /*
                 * Allow only one selection among both list boxes.
                 */
                ListBox_SetCurSel(sd_lbx[1 - lbxIndex], -1);
            } else if (notify == LBN_DBLCLK) {
                /*
                 * Double clicking an item is equivalent to clicking OK.
                 */
                PostMessage(storeDlg, WM_COMMAND, IDOK, 0);
            }
            break;
    }
}
void CCreateBoundingWindow::OnClickDeleteButton()
{
	int selectedIndex = ListBox_GetCurSel(mBoundingsList);
	if (selectedIndex == -1)
		return;

	CEditorScene* scene = CEditorScene::getInstance();
	scene->DeleteBounding(selectedIndex);
	ListBox_DeleteString(mBoundingsList, selectedIndex);
}
int CCreateLightNodeWindow::GetSelectedItemId()
{
	int itemIndex = ListBox_GetCurSel(mLightNodesList);
	if (itemIndex != LB_ERR)
	{
		u32 id = ListBox_GetItemData(mLightNodesList, itemIndex);
		return id;
	}
	return -1;
}
Example #19
0
int w32g_refine_playlist(int *is_selected_removed)
{
    int nremoved;
    int i, j1, j2, cursel;
    HWND hListBox;

    hListBox = playlist_box();
    if(hListBox)
	cursel = ListBox_GetCurSel(hListBox);
    else
	cursel = -1;

    if(is_selected_removed != NULL)
	*is_selected_removed = 0;
    nremoved = 0;
    j1 = j2 = 0;
    while(j2 < playlist.nfiles) /* j1 <= j2 */
    {
	if(playlist.list[j2].info->format < 0)
	{
	    nremoved++;
	    free(playlist.list[j2].filename);
		if(j2 == playlist.selected &&
		   is_selected_removed != NULL &&
		   !*is_selected_removed)
		{
		    *is_selected_removed = 1;
		    playlist.selected = j1;
		}
		if(j2 < playlist.selected)
		    playlist.selected--;
		if(j2 < cursel)
		    cursel--;
	}
	else
	{
	    playlist.list[j1] = playlist.list[j2];
	    j1++;
	}
	j2++;
    }
    if(nremoved)
    {
	for(i = 0; i < nremoved; i++)
	    ListBox_DeleteString(hListBox, --playlist.nfiles);
	if(cursel >= playlist.nfiles)
	    cursel = playlist.nfiles - 1;
	if(cursel >= 0){
	    ListBox_SetCurSel(hListBox, cursel);
		SetNumListWnd(cursel,playlist.nfiles);
	}
	w32g_update_playlist();
    }
    return nremoved;
}
Example #20
0
VOID CUserControlList::DeleteSelectedElement()
{
	//получить выделенный элемент
	UINT ElementIndex=ListBox_GetCurSel(mhWindow);
	if(ElementIndex!=LB_ERR)
	{
		//удалить элемент
		delete (CUserControlListElement*)ListBox_GetItemData(mhWindow,ElementIndex);
		ListBox_DeleteString(mhWindow,ElementIndex);
	}
}
Example #21
0
// Return number of selections and an array of selected integers
int wxListBox::GetSelections(wxArrayInt& aSelections) const
{
    aSelections.Empty();

    if ( HasMultipleSelection() )
    {
        int countSel = ListBox_GetSelCount(GetHwnd());
        if ( countSel == LB_ERR )
        {
            wxLogDebug(wxT("ListBox_GetSelCount failed"));
        }
        else if ( countSel != 0 )
        {
            int *selections = new int[countSel];

            if ( ListBox_GetSelItems(GetHwnd(),
                                     countSel, selections) == LB_ERR )
            {
                wxLogDebug(wxT("ListBox_GetSelItems failed"));
                countSel = -1;
            }
            else
            {
                aSelections.Alloc(countSel);
                for ( int n = 0; n < countSel; n++ )
                    aSelections.Add(selections[n]);
            }

            delete [] selections;
        }

        return countSel;
    }
    else  // single-selection listbox
    {
        if (ListBox_GetCurSel(GetHwnd()) > -1)
            aSelections.Add(ListBox_GetCurSel(GetHwnd()));

        return aSelections.Count();
    }
}
Example #22
0
static bool GetPickedMtl(HWND hDlg, Mtl** mtl)
{
    HWND hList = GetDlgItem(hDlg, IDC_MTL_LIST);
    int sel = ListBox_GetCurSel(hList);
    if (sel != LB_ERR)
    {
        *mtl = (Mtl*)ListBox_GetItemData(hList, sel);
        return true;
    }

    return false;
}
Example #23
0
VOID ViewTriggers_TriggerChanged( HWND hwnd )
{
  INT i;
  CHAR szBuf[128];
  LRESULT lResult;

  lResult = ListBox_GetCurSel( GetDlgItem( hwnd, IDC_TRIGGER_LIST ) );

  if ( lResult >= 0 && lResult < pLevel->nTriggers )
  {
    i = (INT)lResult;

    DoubleToString( szBuf, pLevel->pTriggerData[i].radius, 0 );
    Edit_SetText( GetDlgItem( hwnd, IDC_TRIGGER_RADIUS ), szBuf );

    DoubleToString( szBuf, pLevel->pTriggerData[i].height, 0 );
    Edit_SetText( GetDlgItem( hwnd, IDC_TRIGGER_HEIGHT ), szBuf );

    CheckDlgButton( hwnd,
                    IDC_TRIGGER_PROXIMITY,
                    (pLevel->pTriggerData[i].flags & TF_PROXIMITY_TRIGGER) ? 1 : 0 );

    CheckDlgButton( hwnd,
                    IDC_TRIGGER_USER,
                    (pLevel->pTriggerData[i].flags & TF_USER_TRIGGER) ? 1 : 0 );

    CheckDlgButton( hwnd,
                    IDC_TRIGGER_SOUND,
                    (pLevel->pTriggerData[i].flags & TF_SOUND) ? 1 : 0 );

    CheckDlgButton( hwnd,
                    IDC_TRIGGER_END_LEVEL,
                    (pLevel->pTriggerData[i].flags & TF_END_LEVEL) ? 1 : 0 );

    CheckDlgButton( hwnd,
                    IDC_TRIGGER_END_GAME,
                    (pLevel->pTriggerData[i].flags & TF_END_GAME) ? 1 : 0 );

    if (pLevel->pTriggerData[i].flags & TF_ITEM_REQUIRED)
    {
      Static_SetText( GetDlgItem( hwnd, IDC_TRIGGER_ITEM_REQUIRED ),
                      GetItemTypeString( pLevel->pTriggerData[i].item_type ) );
    }
    else
    {
      Static_SetText( GetDlgItem( hwnd, IDC_TRIGGER_ITEM_REQUIRED ),
                      (LPSTR)"" );
    }
  }

  return;
  
} // ViewTriggers_TriggerChanged
Example #24
0
// Respond to a change in the function list selection.
static void onFunctionListSelChange(HWND win) {
	int idx = ListBox_GetCurSel(GetDlgItem(win, IDC_FUNCTION_LST));
	int id;
	int i;

	if (LB_ERR == idx) {
		return;
	}

	// Locate the function table entry corresponding to the selection.
	id = (int)ListBox_GetItemData(GetDlgItem(win, IDC_FUNCTION_LST), idx);
	for (i = 0; i < sizeof(functions) / sizeof(functions[0]); ++i) {
		if (functions[i].id == id) {
			break;
		}
	}
	if (i >= sizeof(functions) / sizeof(functions[0])) {
		// Shouldn't happen, but just in case...
		return;
	}

	// Clear the parameters.
	SetDlgItemText(win, IDC_PARAM1_EDT, "");
	SetDlgItemText(win, IDC_PARAM2_EDT, "");
	SetDlgItemText(win, IDC_PARAM3_EDT, "");
	SetDlgItemText(win, IDC_PARAM4_EDT, "");

	// Set the parameter labels as specified in the table.
	SetDlgItemText(win, IDC_PARAM1_LBL, functions[i].param1Lbl != NULL ?
	  functions[i].param1Lbl : "");
	SetDlgItemText(win, IDC_PARAM2_LBL, functions[i].param2Lbl != NULL ?
	  functions[i].param2Lbl : "");
	SetDlgItemText(win, IDC_PARAM3_LBL, functions[i].param3Lbl != NULL ?
	  functions[i].param3Lbl : "");
	SetDlgItemText(win, IDC_PARAM4_LBL, functions[i].param4Lbl != NULL ?
	  functions[i].param4Lbl : "");
	EnableWindow(GetDlgItem(win, IDC_PARAM1_EDT),
	  functions[i].param1Lbl != NULL);
	EnableWindow(GetDlgItem(win, IDC_PARAM2_EDT),
	  functions[i].param2Lbl != NULL);
	EnableWindow(GetDlgItem(win, IDC_PARAM3_EDT),
	  functions[i].param3Lbl != NULL);
	EnableWindow(GetDlgItem(win, IDC_PARAM4_EDT),
	  functions[i].param4Lbl != NULL);

	// Enable the session, lexicon, block id and text fields as required.
	EnableWindow(GetDlgItem(win, IDC_SESSION_ID_EDT), functions[i].sidEnabled);
	EnableWindow(GetDlgItem(win, IDC_LEXICON_ID_EDT),
	  functions[i].lexIdEnabled);
	EnableWindow(GetDlgItem(win, IDC_BLOCK_ID_EDT), functions[i].blkIdEnabled);
	EnableWindow(GetDlgItem(win, IDC_TEXT_EDT), functions[i].textEnabled);
}
Example #25
0
/* The selection has changed in the Blink Manager dialog, so
 * update the status buttons.
 */
void FASTCALL Comms_Blink_SelChange( HWND hwnd )
{
   LPBLINKENTRY lpbe;
   HWND hwndList;
   int index;

   VERIFY( hwndList = GetDlgItem( hwnd, IDD_LIST ) );
   index = ListBox_GetCurSel( hwndList );
   ASSERT( index != LB_ERR );
   lpbe = (LPBLINKENTRY)ListBox_GetItemData( hwndList, index );
   ASSERT( 0L != lpbe );
   EnableControl( hwnd, IDD_REMOVE, ( strcmp( lpbe->szName, "Full" ) != 0 && strcmp( lpbe->szName, "Custom" ) != 0 ) );
}
void CCreateBoundingWindow::OnClickBoundingListItem()
{
	int selectedIndex = ListBox_GetCurSel(mBoundingsList);
	if (selectedIndex != -1)
	{
		CEditorScene* scene = CEditorScene::getInstance();
		SBoundingShape* shape = scene->SelectBoundingShape(selectedIndex);

		ShowBoundingShapeInfo(shape);
	}

	SetFocus(mParentHwnd);
}
Example #27
0
void CInstanceInfoWindow::OnClickListItem()
{
	int itemIndex = ListBox_GetCurSel(mInstancesListBox);
	if (itemIndex != LB_ERR)
	{
		u32 id = ListBox_GetItemData(mInstancesListBox, itemIndex);
		EditorScene* scene = EditorScene::getInstance();
		EditorWindow* window = EditorWindow::getInstance();
		SNodeInfo* info = scene->GetNodeInfoById(id);
		scene->SelectObject(id);
		window->ShowNodeInfo(id);
		SetFocus(mParentHwnd);
	}
}
void CCreateLightNodeWindow::OnClickListItem()
{
	int itemIndex = ListBox_GetCurSel(mLightNodesList);
	if (itemIndex != LB_ERR)
	{
		u32 id = ListBox_GetItemData(mLightNodesList, itemIndex);
		EditorScene* scene = EditorScene::getInstance();
		EditorWindow* window = EditorWindow::getInstance();

		scene->SelectLight(id);
		window->ShowNodeInfo(id);
		SetFocus(mParentHwnd);
	}
}
HRESULT OnOK(HWND hwnd, ChooseDeviceParam *pParam)
{
    HWND hList = GetDlgItem(hwnd, IDC_DEVICE_LIST);

    // Get the current selection and return it to the application.
    int sel = ListBox_GetCurSel(hList);

    if (sel != LB_ERR)
    {
        pParam->selection = (UINT32)ListBox_GetItemData(hList, sel);
    }

    return S_OK;
}
Example #30
0
VOID FixControlStates(
    _In_ HWND hwndDlg,
    _In_ HWND ListBox
    )
{
    ULONG i;
    ULONG count;

    i = ListBox_GetCurSel(ListBox);
    count = ListBox_GetCount(ListBox);

    EnableWindow(GetDlgItem(hwndDlg, IDC_REMOVE), i != LB_ERR);
    EnableWindow(GetDlgItem(hwndDlg, IDC_MOVEUP), i != LB_ERR && i != 0);
    EnableWindow(GetDlgItem(hwndDlg, IDC_MOVEDOWN), i != LB_ERR && i != count - 1);
}