Exemplo n.º 1
0
/// Int-to-Index (choices can be items like e.g 0x400120 )
int ShuttleGuiBase::TranslateToIndex( const int Value, const wxArrayInt &Choices )
{  
   int n = Choices.Index( Value );
   if( n== wxNOT_FOUND )
      n=miNoMatchSelector;
   miNoMatchSelector = 0;
   return n;
}
Exemplo n.º 2
0
bool wxFontEnumeratorHelper::OnFont(const LPLOGFONT lf,
                                    const LPTEXTMETRIC tm) const
{
    if ( m_enumEncodings )
    {
        // is this a new charset?
        int cs = lf->lfCharSet;
        if ( m_charsets.Index(cs) == wxNOT_FOUND )
        {
            wxConstCast(this, wxFontEnumeratorHelper)->m_charsets.Add(cs);

            wxFontEncoding enc = wxGetFontEncFromCharSet(cs);
            return m_fontEnum->OnFontEncoding(lf->lfFaceName,
                                              wxFontMapper::GetEncodingName(enc));
        }
        else
        {
            // continue enumeration
            return true;
        }
    }

    if ( m_fixedOnly )
    {
        // check that it's a fixed pitch font (there is *no* error here, the
        // flag name is misleading!)
        if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
        {
            // not a fixed pitch font
            return true;
        }
    }

    if ( m_charset != DEFAULT_CHARSET )
    {
        // check that we have the right encoding
        if ( lf->lfCharSet != m_charset )
        {
            return true;
        }
    }
    else // enumerating fonts in all charsets
    {
        // we can get the same facename twice or more in this case because it
        // may exist in several charsets but we only want to return one copy of
        // it (note that this can't happen for m_charset != DEFAULT_CHARSET)
        if ( m_facenames.Index(lf->lfFaceName) != wxNOT_FOUND )
        {
            // continue enumeration
            return true;
        }

        wxConstCast(this, wxFontEnumeratorHelper)->
            m_facenames.Add(lf->lfFaceName);
    }

    return m_fontEnum->OnFacename(lf->lfFaceName);
}
Exemplo n.º 3
0
FbAuthListModel::FbAuthListModel(const wxArrayInt &items, int code)
{
	m_position = items.Count() ? 1 : 0;
	Append(items);
	if (code) {
		int i = items.Index(code);
		if (i != wxNOT_FOUND) m_position = (size_t)i + 1;
	}
}
Exemplo n.º 4
0
// -------------------------------------------------------------------------------- //
void guDbRadios::SetRadioGenresFilters( const wxArrayInt &filters )
{
    if( filters.Index( 0 ) != wxNOT_FOUND )
    {
        m_RaGeFilters.Empty();
    }
    else
    {
        m_RaGeFilters = filters;
    }
    //m_RadioSource = false;
}
Exemplo n.º 5
0
// -------------------------------------------------------------------------------- //
void guDbRadios::SetRadioLabelsFilters( const wxArrayInt &filters )
{
    if( filters.Index( 0 ) != wxNOT_FOUND )
    {
        m_RaLaFilters.Empty();
    }
    else
    {
        m_RaLaFilters = filters;
    }
    m_RaGeFilters.Empty();
}
Exemplo n.º 6
0
unsigned int wxHeaderCtrlBase::GetColumnPos(unsigned int idx) const
{
    const unsigned count = GetColumnCount();

    wxCHECK_MSG( idx < count, wxNO_COLUMN, "invalid index" );

    const wxArrayInt order = GetColumnsOrder();
    int pos = order.Index(idx);
    wxCHECK_MSG( pos != wxNOT_FOUND, wxNO_COLUMN, "column unexpectedly not displayed at all" );

    return (unsigned int)pos;
}
Exemplo n.º 7
0
/* static */
void wxHeaderCtrlBase::MoveColumnInOrderArray(wxArrayInt& order,
                                              unsigned int idx,
                                              unsigned int pos)
{
    int posOld = order.Index(idx);
    wxASSERT_MSG( posOld != wxNOT_FOUND, "invalid index" );

    if ( pos != (unsigned int)posOld )
    {
        order.RemoveAt(posOld);
        order.Insert(idx, pos);
    }
}
Exemplo n.º 8
0
bool
wxHtmlPageBreakCell::AdjustPagebreak(int* pagebreak,
                                     const wxArrayInt& known_pagebreaks,
                                     int WXUNUSED(pageHeight)) const
{
    // When we are counting pages, 'known_pagebreaks' is non-NULL.
    // That's the only time we change 'pagebreak'. Otherwise, pages
    // were already counted, 'known_pagebreaks' is NULL, and we don't
    // do anything except return false.
    //
    // We also simply return false if the 'pagebreak' argument is
    // less than (vertically above) or the same as the current
    // vertical position. Otherwise we'd be setting a pagebreak above
    // the current cell, which is incorrect, or duplicating a
    // pagebreak that has already been set.
    if( known_pagebreaks.GetCount() == 0 || *pagebreak <= m_PosY)
    {
        return false;
    }

    // m_PosY is only the vertical offset from the parent. The pagebreak
    // required here is the total page offset, so m_PosY must be added
    // to the parent's offset and height.
    int total_height = m_PosY;
    for ( wxHtmlCell *parent = GetParent(); parent; parent = parent->GetParent() )
    {
        total_height += parent->GetPosY();
    }


    // Search the array of pagebreaks to see whether we've already set
    // a pagebreak here.
    int where = known_pagebreaks.Index( total_height);
    // Add a pagebreak only if there isn't one already set here.
    if( wxNOT_FOUND != where)
    {
        return false;
    }
    else
    {
        *pagebreak = m_PosY;
        return true;
    }
}