Ejemplo n.º 1
0
wxString BattleroomListCtrl::GetSelectedUserNick()
{
	if (GetSelectedIndex() < 0)
		return wxEmptyString;
	else
		return TowxString(m_data[GetSelectedIndex()]->GetNick());
}
Ejemplo n.º 2
0
void BattleroomListCtrl::OnActivateItem(wxListEvent& /*unused*/)
{
	if (m_ro)
		return;
	if (GetSelectedIndex() < 0)
		return;

	const User* usr = m_data[GetSelectedIndex()];
	if (usr != NULL && !usr->BattleStatus().IsBot())
		ui().mw().OpenPrivateChat(*usr);
}
Ejemplo n.º 3
0
FX_BOOL CPDF_FormField::ClearOptions(FX_BOOL bNotify) {
  if (bNotify && m_pForm->m_pFormNotify) {
    int iRet = 0;
    CFX_WideString csValue;
    int iIndex = GetSelectedIndex(0);
    if (iIndex >= 0)
      csValue = GetOptionLabel(iIndex);
    if (GetType() == ListBox)
      iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
    if (GetType() == ComboBox)
      iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
    if (iRet < 0)
      return FALSE;
  }

  m_pDict->RemoveAt("Opt");
  m_pDict->RemoveAt("V");
  m_pDict->RemoveAt("DV");
  m_pDict->RemoveAt("I");
  m_pDict->RemoveAt("TI");

  if (bNotify && m_pForm->m_pFormNotify) {
    if (GetType() == ListBox)
      m_pForm->m_pFormNotify->AfterSelectionChange(this);
    if (GetType() == ComboBox)
      m_pForm->m_pFormNotify->AfterValueChange(this);
  }

  m_pForm->m_bUpdated = TRUE;
  return TRUE;
}
FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify)
{
    if (bNotify && m_pForm->m_pFormNotify != NULL) {
        int iRet = 0;
        CFX_WideString csValue;
        int iIndex = GetSelectedIndex(0);
        if (iIndex >= 0) {
            csValue = GetOptionLabel(iIndex);
        }
        if (GetType() == ListBox) {
            iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
        }
        if (GetType() == ComboBox) {
            iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
        }
        if (iRet < 0) {
            return FALSE;
        }
    }
    m_pDict->RemoveAt("V");
    m_pDict->RemoveAt("I");
    if (bNotify && m_pForm->m_pFormNotify != NULL) {
        if (GetType() == ListBox) {
            m_pForm->m_pFormNotify->AfterSelectionChange(this);
        }
        if (GetType() == ComboBox) {
            m_pForm->m_pFormNotify->AfterValueChange(this);
        }
    }
    if (CPDF_InterForm::m_bUpdateAP) {
        UpdateAP(NULL);
    }
    m_pForm->m_bUpdated = TRUE;
    return TRUE;
}
Ejemplo n.º 5
0
		int PaletteView::GetSelectedOrDefaultIndex() {
			int c = GetSelectedIndex();
			if(c == -1)
				return defaultColor;
			else
				return c;
		}
Ejemplo n.º 6
0
			Ptr<GuiComboBoxListControl::IItemStyleProvider> GuiComboBoxListControl::SetStyleProvider(Ptr<IItemStyleProvider> value)
			{
				RemoveStyleController();
				auto old = itemStyleProvider;
				if (itemStyleProvider)
				{
					itemStyleProvider->DetachComboBox();
				}

				itemStyleProvider = value;

				if (itemStyleProvider)
				{
					itemStyleProvider->AttachComboBox(this);
					styleController->SetTextVisible(false);
					InstallStyleController(GetSelectedIndex());
				}
				else
				{
					styleController->SetTextVisible(true);
				}

				StyleProviderChanged.Execute(GetNotifyEventArguments());
				return old;
			}
Ejemplo n.º 7
0
void CSearchList::OnDeleteNote()
{
	int nNoteID = 0;
	BOOL bRes = FALSE;

	// Retrieve the index of the currently selected item
	int nIndex = GetSelectedIndex();

	if (nIndex != LB_ERR)
	{
		// Retrieve the 32-bit value associated with the item, in our case it's the note's id
		nNoteID = GetNoteId(nIndex);
		if (nNoteID != 0)
		{
			// Delete a note from the collection
			if (::SendMessage(m_pwndHidden->m_hWnd, WMU_DELETENOTE, (WPARAM)nNoteID, 0))
			{
				// Delete the item from the list control
				bRes = DeleteItem(nIndex);
				if (bRes == FALSE)
					ATLTRACE(_T("Item has not been deleted from the list control!\n"));
			}
			else
				ATLTRACE(_T("Note has not been deleted!\n"));
		}
	}
	else
		ATLTRACE(_T("No item is currently selected in the list control\n"));
}
Ejemplo n.º 8
0
NS_IMETHODIMP
HTMLOptionsCollection::GetSelectedIndex(int32_t* aSelectedIndex)
{
  ErrorResult rv;
  *aSelectedIndex = GetSelectedIndex(rv);
  return rv.ErrorCode();
}
Ejemplo n.º 9
0
void
nsDeckFrame::IndexChanged()
{
  //did the index change?
  int32_t index = GetSelectedIndex();
  if (index == mIndex)
    return;

  // redraw
  InvalidateFrame();

  // hide the currently showing box
  nsIFrame* currentBox = GetSelectedBox();
  if (currentBox) // only hide if it exists
    HideBox(currentBox);

  mIndex = index;

#ifdef ACCESSIBILITY
  nsAccessibilityService* accService = GetAccService();
  if (accService) {
    accService->DeckPanelSwitched(PresContext()->GetPresShell(), mContent,
                                  currentBox, GetSelectedBox());
  }
#endif
}
Ejemplo n.º 10
0
void MyLib::DeletePlayList(int nIndex,BOOL bNotify)
{
	LPCPlayList pl=GetItem(nIndex);

	if(nIndex == GetSelectedIndex())
	{
		if(nIndex ==GetItemCount() -1)
			m_IndexSelecting=nIndex-1;

		NotifyMsg(WM_SELECTED_PL_CHANGED,FALSE,(WPARAM)GetItem(m_IndexSelecting),(LPARAM)m_IndexSelecting);
	}

	
	if(pl->IsAuto())
	{
		delete m_pFileMonitor;
		m_pFileMonitor=NULL;
		SetAutoPlaylist(NULL);
	}


	m_playLists.erase(m_playLists.begin()+nIndex);
	NotifyMsg(WM_PL_WILL_DELETED,FALSE,(WPARAM)pl,0);
	
	delete pl;

	if(bNotify)
		NotifyMsg(WM_SOME_PL_CHANGED,FALSE,0,0);
}
Ejemplo n.º 11
0
MCVersion* MinecraftVersionDialog::GetSelectedVersion ( )
{
	MCVersionList & verList = MCVersionList::Instance();
	int idx = GetSelectedIndex();
	if(idx == -1)
		return nullptr;
	return & verList[visibleIndexes[idx]];
}
Ejemplo n.º 12
0
wxString ListSelectDialog::GetSelection() const
{
	int index = GetSelectedIndex();
	if (index != -1)
		return listCtrl->GetItemText(index);
	else
		return wxEmptyString;
}
Ejemplo n.º 13
0
void
nsDeckFrame::Init(nsIContent*       aContent,
                  nsContainerFrame* aParent,
                  nsIFrame*         aPrevInFlow)
{
  nsBoxFrame::Init(aContent, aParent, aPrevInFlow);

  mIndex = GetSelectedIndex();
}
Ejemplo n.º 14
0
NS_IMETHODIMP
nsDeckFrame::Init(nsIContent*     aContent,
                  nsIFrame*       aParent,
                  nsIFrame*       aPrevInFlow)
{
  nsresult rv = nsBoxFrame::Init(aContent, aParent, aPrevInFlow);

  mIndex = GetSelectedIndex();

  return rv;
}
Ejemplo n.º 15
0
bool CtrlBreakpointList::WindowMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT& returnValue)
{
	switch(msg)
	{
	case WM_KEYDOWN:
		returnValue = 0;
		if(wParam == VK_RETURN)
		{
			int index = GetSelectedIndex();
			editBreakpoint(index);
			return true;
		} else if (wParam == VK_DELETE)
		{
			int index = GetSelectedIndex();
			removeBreakpoint(index);
			return true;
		} else if (wParam == VK_TAB)
		{
			SendMessage(GetParent(GetHandle()),WM_DEB_TABPRESSED,0,0);
			return true;
		} else if (wParam == VK_SPACE)
		{
			int index = GetSelectedIndex();
			toggleEnabled(index);
			return true;
		}
		break;
	case WM_GETDLGCODE:
		if (lParam && ((MSG*)lParam)->message == WM_KEYDOWN)
		{
			if (wParam == VK_TAB || wParam == VK_RETURN)
			{
				returnValue = DLGC_WANTMESSAGE;
				return true;
			}
		}
		break;
	}

	return false;
}
Ejemplo n.º 16
0
			description::Value GuiComboBoxListControl::GetSelectedItem()
			{
				auto selectedIndex = GetSelectedIndex();
				if (selectedIndex != -1)
				{
					if (itemBindingView)
					{
						return itemBindingView->GetBindingValue(selectedIndex);
					}
				}
				return description::Value();
			}
Ejemplo n.º 17
0
		void PaletteView::Draw() {
			Handle<IImage> img = renderer->RegisterImage("Gfx/Palette.png");
			
			int sel = GetSelectedIndex();
			
			float scrW = renderer->ScreenWidth();
			float scrH = renderer->ScreenHeight();
			
			for(size_t phase = 0; phase < 2; phase++){
				for(size_t i = 0; i < colors.size(); i++){
					if((sel == i) != (phase == 1))
						continue;
					
					int row = i / 8;
					int col = i % 8;
					
					bool selected = sel == i;
					
					// draw color
					IntVector3 icol = colors[i];
					Vector4 cl;
					cl.x = icol.x / 255.f;
					cl.y = icol.y / 255.f;
					cl.z = icol.z / 255.f;
					cl.w = 1.f;
					
					float x = scrW - 100.f + 10.f * col;
					float y = scrH - 96.f + 10.f * row - 40.f;
					
					renderer->SetColorAlphaPremultiplied(cl);
					if(selected){
						renderer->DrawImage(img,
											MakeVector2(x, y),
											AABB2(0, 16, 16, 16));
					}else{
						renderer->DrawImage(img,
											MakeVector2(x, y),
											AABB2(0, 0, 16, 16));
					}
					
					renderer->SetColorAlphaPremultiplied(MakeVector4(1, 1, 1, 1));
					if(selected){
						renderer->DrawImage(img,
											MakeVector2(x, y),
											AABB2(16, 16, 16, 16));
					}else{
						renderer->DrawImage(img,
											MakeVector2(x, y),
											AABB2(16, 0, 16, 16));
					}
				}
			}
		}
Ejemplo n.º 18
0
// Creates a context menu
LRESULT CSearchList::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
	// Retrieve the index of the currently selected item
	int nIndex = GetSelectedIndex();

	// Display the context menu
	if (nIndex != LB_ERR)
	{
		if (::IsMenu(m_menuSearch.m_hMenu))
		{
			ATLTRACE(_T("Menu is already displayed!\n"));
			return 0;
		}

		// Cursor's horizontal and vertical position
		CPoint pt(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));

		// Load the menu resource 
		if (!m_menuSearch.LoadMenu(IDR_DELETE_NOTE))
		{
			ATLTRACE(_T("Menu resource was not loaded successfully!\n"));
			return 0;
		}

		// TrackPopupMenu cannot display the menu bar so get 
		// a handle to the first shortcut menu. 
 		CMenuHandle menuPopup = m_menuSearch.GetSubMenu(0);
		if (menuPopup.m_hMenu == NULL)
		{
			ATLTRACE(_T("Submenu was not retrieved successfully!\n"));
			return 0;
		}

		// Display the shortcut menu
 		if (!menuPopup.TrackPopupMenu(TPM_LEFTALIGN|TPM_TOPALIGN|TPM_LEFTBUTTON,
								pt.x, pt.y, m_hWnd))
		{
			ATLTRACE(_T("Context menu was not displayed successfully!\n"));
			return 0;
		}		

		// Destroy the menu and free any memory that the menu occupies
		menuPopup.DestroyMenu();
		m_menuSearch.DestroyMenu();
		m_menuSearch.m_hMenu = NULL;
	}

	return 0;
}
Ejemplo n.º 19
0
void NickListCtrl::OnShowMenu( wxContextMenuEvent& /*unused*/ )
{
	wxLogDebugFunc( wxEmptyString );
	if ( m_menu != 0 )
	{
		//no need to popup the menu when there's no user selected
		int selected = GetSelectedIndex();
		if ( selected != -1 && m_data[selected] ) {
			const User& user = *m_data[selected];
			wxString nick = user.GetNick();
			m_menu->EnableItems( ( selected != -1 ), nick );
			PopupMenu( m_menu );
		}
	}
}
Ejemplo n.º 20
0
void NickListCtrl::OnShowMenu(wxContextMenuEvent& /*unused*/)
{
	slLogDebugFunc("");
	if (m_menu != 0) {
		//no need to popup the menu when there's no user selected
		int selected = GetSelectedIndex();
		if (selected != -1 && m_data[selected]) {
			const User& user = *m_data[selected];
			wxString nick = TowxString(user.GetNick());
			SL_GENERIC::UserMenu<ChatPanelMenu>* popup = m_menu->GetUserMenu();
			popup->EnableItems((selected != -1), nick);
			PopupMenu(popup);
		}
	}
}
Ejemplo n.º 21
0
gedString ListPop::GetText(int index)
{
	if(index == -1)
	{
		if(!selectedText.empty()) return selectedText;
		else index = GetSelectedIndex();
	}
	else if(index < 0) index = 0;
	else if(index > pCurrentList->Count() - 1) index = pCurrentList->Count() - 1;


	if(index >= 0)
		return (*pCurrentList)[index].text;

	return "";
}
Ejemplo n.º 22
0
bool CPDF_FormField::ClearSelection(bool bNotify) {
  if (bNotify && m_pForm->m_pFormNotify) {
    CFX_WideString csValue;
    int iIndex = GetSelectedIndex(0);
    if (iIndex >= 0)
      csValue = GetOptionLabel(iIndex);

    if (!NotifyListOrComboBoxBeforeChange(csValue))
      return false;
  }
  m_pDict->RemoveFor("V");
  m_pDict->RemoveFor("I");
  if (bNotify)
    NotifyListOrComboBoxAfterChange();
  return true;
}
Ejemplo n.º 23
0
FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify) {
  if (bNotify && m_pForm->m_pFormNotify) {
    CFX_WideString csValue;
    int iIndex = GetSelectedIndex(0);
    if (iIndex >= 0)
      csValue = GetOptionLabel(iIndex);

    if (!NotifyListOrComboBoxBeforeChange(csValue))
      return FALSE;
  }
  m_pDict->RemoveAt("I");
  if (bNotify)
    NotifyListOrComboBoxAfterChange();

  return TRUE;
}
Ejemplo n.º 24
0
void
nsDeckFrame::IndexChanged()
{
    //did the index change?
    PRInt32 index = GetSelectedIndex();
    if (index == mIndex)
        return;

    // redraw
    InvalidateOverflowRect();

    // hide the currently showing box
    nsIBox* currentBox = GetSelectedBox();
    if (currentBox) // only hide if it exists
        HideBox(currentBox);

    mIndex = index;
}
Ejemplo n.º 25
0
// Tells the hidden window to display a note
void CSearchList::DisplayNote()
{
	// Retrieve the index of the currently selected item
	int nIndex = GetSelectedIndex();

	if (nIndex != LB_ERR)
	{
		// Retrieve the 32-bit value associated with the item, in our case it's the note's id
		int nNoteID = GetNoteId(nIndex);
		if (nNoteID != 0)
		{
			// Post a message to the hidden window to display a note
			::PostMessage(m_pwndHidden->m_hWnd, WMU_DISPLAYNOTE, (WPARAM)nNoteID, 0);
		}
	}
	else
		ATLTRACE(_T("No item is currently selected in the list control\n"));
}
Ejemplo n.º 26
0
void
nsDeckFrame::IndexChanged(nsPresContext* aPresContext)
{
  //did the index change?
  PRInt32 index = GetSelectedIndex();
  if (index == mIndex)
    return;

  // redraw
  InvalidateOverflowRect();

  // hide the currently showing box
  nsIBox* currentBox = GetSelectedBox();
  if (currentBox) // only hide if it exists
     HideBox(aPresContext, currentBox);

  mIndex = index;

  // show the new box
  nsIBox* newBox = GetSelectedBox();
  if (newBox) // only show if it exists
     ShowBox(aPresContext, newBox);
}
Ejemplo n.º 27
0
bool CtrlAllDisplayLists::WindowMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT& returnValue)
{
	switch (msg)
	{
	case WM_KEYDOWN:
		if (wParam == VK_RETURN)
		{
			int item = GetSelectedIndex();
			SendMessage(GetParent(GetHandle()),WM_GEDBG_LISTS_CHANGELIST,item,0);
		}
		break;
	case WM_GETDLGCODE:
		if (lParam && ((MSG*)lParam)->message == WM_KEYDOWN)
		{
			if (wParam == VK_RETURN)
			{
				returnValue = DLGC_WANTMESSAGE;
				return true;
			}
		}
	}

	return false;
}
Ejemplo n.º 28
0
dword AutoStartPage::OnKey( dword key, dword extKey )
{
	switch ( key )
	{
	case RKEY_Exit:
		if ( CanExit() )
			Close();
		return 0;
	case RKEY_Mute:
		// pass Mute to the firmware
		return key;
	case RKEY_Menu:
	{
		if (menuActivates)
		{
			Close();
			return key;
		}
		Replace(new ConfigPage());
		return 0;
	}
	case RKEY_PlayList:
		if ( CanExit() )
			Replace(new LoadedTAPPage());
		return 0;
	case RKEY_VolUp:
	{
		int index = GetSelectedIndex();
		if ( index < (int)m_taps.size()-1 )
		{
			// swap the filenames
			AutoStartTAP t = m_taps[index];
			m_taps[index] = m_taps[index+1];
			m_taps[index+1] = t;
			// move the selection
			MoveSelection( 1, false );
			m_dirty = true;
		}
		return 0;
	}
	case RKEY_VolDown:
	{
		int index = GetSelectedIndex();
		if ( index > 0 && index < (int)m_taps.size() )
		{
			// swap the filenames
			AutoStartTAP t = m_taps[index];
			m_taps[index] = m_taps[index-1];
			m_taps[index-1] = t;
			// move the selection
			MoveSelection( -1, false );
			m_dirty = true;
		}
		return 0;
	}
	case RKEY_NewF1:
	{
		// enable/disable TAP
		int index = GetSelectedIndex();
		EnableTAP( index, !m_taps[index].enabled );
		return 0;
	}
	case RKEY_F2:
	{
		int index = GetSelectedIndex();
		if ( index < (int)m_taps.size() )
		{
			bool enable = !m_taps[index].enabled;
			for ( unsigned int i = 0; i < m_taps.size(); ++i )
				EnableTAP( i, enable );
		}
		return 0;
	}
	// Discard changes
	case RKEY_Recall:
		// get rid of the list items, then the 
		DiscardItems();
		AddItem(new SimpleTextListItem(this, 0, "", "Loading..."));
		Draw();
		PopulateList();
		m_dirty = false;
		return 0;
	// Save Changes
	case RKEY_Record:
		Save();
		Close();
		return 0;
	}
	ListPage::OnKey( key, extKey );

	return 0;
}
Ejemplo n.º 29
0
bool CDropDown::HandleMessage(CMessage* pMessage)
{
	bool bHandled = false;
	CRect SubRect(m_WindowRect);
	SubRect.Grow(-3);

	if (pMessage)
	{
		switch(pMessage->MessageType())
		{
		case CMessage::KEYBOARD_KEYDOWN:
    {
      CKeyboardMessage* pKeyboardMessage = dynamic_cast<CKeyboardMessage*>(pMessage);
      if (pKeyboardMessage && pMessage->Destination() == this)
      {
        switch (pKeyboardMessage->Key)
        {
          case SDLK_UP:
            SelectItem(GetSelectedIndex() - 1);
						ShowListBox();
            break;
          case SDLK_DOWN:
            SelectItem(GetSelectedIndex() + 1);
						ShowListBox();
            break;
          case SDLK_RETURN:
          case SDLK_SPACE:
						HideListBox();
            break;
          case SDLK_TAB:
						HideListBox();
            // intentional fall through: the parent frame will change focused widget
          default:
            // Forward all key downs to parent
            CMessageServer::Instance().QueueMessage(new CKeyboardMessage(CMessage::KEYBOARD_KEYDOWN, m_pParentWindow, this,
                  pKeyboardMessage->ScanCode, pKeyboardMessage->Modifiers, pKeyboardMessage->Key, pKeyboardMessage->Unicode));
            break;
        }
      }
      break;
    }
		case CMessage::MOUSE_BUTTONDOWN:
		{
			CMouseMessage* pMouseMessage = dynamic_cast<CMouseMessage*>(pMessage);
			if (pMouseMessage->Button == CMouseMessage::LEFT)
			{
				if (m_pListBox->IsVisible() &&
					m_pDropButton->GetWindowRect().SizeRect().HitTest(m_pDropButton->ViewToWindow(pMouseMessage->Point)) != CRect::RELPOS_INSIDE &&
					m_pListBox->GetWindowRect().SizeRect().HitTest(m_pListBox->ViewToWindow(pMouseMessage->Point)) != CRect::RELPOS_INSIDE)
				{
					HideListBox();
				}
			}
			break;
		}
		case CMessage::CTRL_SINGLELCLICK:
		{
			if (pMessage->Destination() == this)
			{
				if (pMessage->Source() == m_pDropButton)
				{
					if (m_pListBox->IsVisible())
					{
						HideListBox();
					}
					else
					{
						ShowListBox();
					}
					bHandled = true;
				}
			}
			break;
		}
		case CMessage::CTRL_VALUECHANGE:
		{
			TIntMessage* pCtrlMessage = dynamic_cast<TIntMessage*>(pMessage);
			if (pCtrlMessage && pMessage->Destination() == this)
			{
				if (pCtrlMessage->Source() == m_pListBox)
				{
					const SListItem& ListItem = m_pListBox->GetItem(pCtrlMessage->Value());
					SetWindowText(ListItem.sItemText);
					HideListBox();
					CMessageServer::Instance().QueueMessage(new TIntMessage(CMessage::CTRL_VALUECHANGE, m_pParentWindow, this, 0));
					bHandled = true;
				}
				else if (pCtrlMessage->Source() == m_pEditBox)
				{
					m_pListBox->SetAllSelections(false);
					HideListBox();
					CMessageServer::Instance().QueueMessage(new TIntMessage(CMessage::CTRL_VALUECHANGE, m_pParentWindow, this, 0));
					bHandled = true;
				}
			}
			break;
		}
		default :
			bHandled = CWindow::HandleMessage(pMessage);
			break;
		}
	}

	return bHandled;
}
Ejemplo n.º 30
0
			void GuiComboBoxListControl::OnListControlSelectionChanged(compositions::GuiGraphicsComposition* sender, compositions::GuiEventArgs& arguments)
			{
				DisplaySelectedContent(GetSelectedIndex());
				SelectItem();
				SelectedIndexChanged.Execute(GetNotifyEventArguments());
			}