コード例 #1
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
int wxOwnerDrawnComboBox::DoInsertItems(const wxArrayStringsAdapter& items,
                                        unsigned int pos,
                                        void **clientData,
                                        wxClientDataType type)
{
    EnsurePopupControl();

    const unsigned int count = items.GetCount();

    if ( HasFlag(wxCB_SORT) )
    {
        int n = pos;

        for ( unsigned int i = 0; i < count; ++i )
        {
            n = GetVListBoxComboPopup()->Append(items[i]);
            AssignNewItemClientData(n, clientData, i, type);
        }

        return n;
    }
    else
    {
        for ( unsigned int i = 0; i < count; ++i, ++pos )
        {
            GetVListBoxComboPopup()->Insert(items[i], pos);
            AssignNewItemClientData(pos, clientData, i, type);
        }

        return pos - 1;
    }
}
コード例 #2
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
void* wxOwnerDrawnComboBox::DoGetItemClientData(unsigned int n) const
{
    if ( !m_popupInterface )
        return NULL;

    return GetVListBoxComboPopup()->GetItemClientData(n);
}
コード例 #3
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
int wxOwnerDrawnComboBox::GetSelection() const
{
    if ( !m_popupInterface )
        return m_initChs.Index(m_valueString);

    return GetVListBoxComboPopup()->GetSelection();
}
コード例 #4
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
unsigned int wxOwnerDrawnComboBox::GetCount() const
{
    if ( !m_popupInterface )
        return m_initChs.GetCount();

    return GetVListBoxComboPopup()->GetCount();
}
コード例 #5
0
ファイル: odcombo.cpp プロジェクト: 252525fb/rpcs3
int wxOwnerDrawnComboBox::DoAppend(const wxString& item)
{
    EnsurePopupControl();
    wxASSERT(m_popupInterface);

    return GetVListBoxComboPopup()->Append(item);
}
コード例 #6
0
ファイル: ODIconCombo.cpp プロジェクト: nohal/ocpn_draw_pi
void ODIconCombo::OnDrawItem( wxDC& dc,
                                       const wxRect& rect,
                                       int item,
                                       int flags ) const
{
    int offset_x = bmpArray.Item(item).GetWidth();
    int bmpHeight = bmpArray.Item(item).GetHeight();
    dc.DrawBitmap(bmpArray.Item(item), rect.x, rect.y + (rect.height - bmpHeight)/2, true);
    
    if ( flags & wxODCB_PAINTING_CONTROL )
    {
        wxString text = GetValue();
        int margin_x = 2;
        
#if wxCHECK_VERSION(2, 9, 0)
        if ( ShouldUseHintText() )
        {
            text = GetHint();
            wxColour col = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
            dc.SetTextForeground(col);
        }
        
        margin_x = GetMargins().x;
#endif

        dc.DrawText( text,
                     rect.x + margin_x + offset_x,
                     (rect.height-dc.GetCharHeight())/2 + rect.y );
    }
    else
    {
        dc.DrawText( GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x, (rect.height-dc.GetCharHeight())/2 + rect.y );
    }
}
コード例 #7
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
void wxOwnerDrawnComboBox::OnDrawItem( wxDC& dc,
                                       const wxRect& rect,
                                       int item,
                                       int flags ) const
{
    if ( flags & wxODCB_PAINTING_CONTROL )
    {
        wxString text;

        if ( !ShouldUseHintText() )
        {
            text = GetValue();
        }
        else
        {
            text = GetHint();
            wxColour col = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT);
            dc.SetTextForeground(col);
        }

        dc.DrawText( text,
                     rect.x + GetMargins().x,
                     (rect.height-dc.GetCharHeight())/2 + rect.y );
    }
    else
    {
        dc.DrawText( GetVListBoxComboPopup()->GetString(item), rect.x + 2, rect.y );
    }
}
コード例 #8
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
void wxOwnerDrawnComboBox::DoSetItemClientData(unsigned int n, void* clientData)
{
    EnsurePopupControl();

    GetVListBoxComboPopup()->SetItemClientData(n, clientData,
                                               GetClientDataType());
}
コード例 #9
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
int wxOwnerDrawnComboBox::FindString(const wxString& s, bool bCase) const
{
    if ( !m_popupInterface )
        return m_initChs.Index(s, bCase);

    return GetVListBoxComboPopup()->FindString(s, bCase);
}
コード例 #10
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
void wxOwnerDrawnComboBox::SetString(unsigned int n, const wxString& s)
{
    EnsurePopupControl();

    wxCHECK_RET( IsValid(n), wxT("invalid index in wxOwnerDrawnComboBox::SetString") );

    GetVListBoxComboPopup()->SetString(n,s);
}
コード例 #11
0
ファイル: odcombo.cpp プロジェクト: 252525fb/rpcs3
void wxOwnerDrawnComboBox::Clear()
{
    EnsurePopupControl();

    GetVListBoxComboPopup()->Clear();

    SetValue(wxEmptyString);
}
コード例 #12
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
wxString wxOwnerDrawnComboBox::GetString(unsigned int n) const
{
    wxCHECK_MSG( IsValid(n), wxEmptyString, wxT("invalid index in wxOwnerDrawnComboBox::GetString") );

    if ( !m_popupInterface )
        return m_initChs.Item(n);

    return GetVListBoxComboPopup()->GetString(n);
}
コード例 #13
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
void wxOwnerDrawnComboBox::DoDeleteOneItem(unsigned int n)
{
    wxCHECK_RET( IsValid(n), wxT("invalid index in wxOwnerDrawnComboBox::Delete") );

    if ( GetSelection() == (int) n )
        ChangeValue(wxEmptyString);

    GetVListBoxComboPopup()->Delete(n);
}
コード例 #14
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
void wxOwnerDrawnComboBox::DoSetPopupControl(wxComboPopup* popup)
{
    if ( !popup )
    {
        popup = new wxVListBoxComboPopup();
    }

    wxComboCtrl::DoSetPopupControl(popup);

    wxASSERT(popup);

    // Add initial choices to the wxVListBox
    if ( !GetVListBoxComboPopup()->GetCount() )
    {
        GetVListBoxComboPopup()->Populate(m_initChs);
        m_initChs.Clear();
    }
}
コード例 #15
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
void wxOwnerDrawnComboBox::DoClear()
{
    EnsurePopupControl();

    GetVListBoxComboPopup()->Clear();

    // NB: This really needs to be SetValue() instead of ChangeValue(),
    //     as wxTextEntry API expects an event to be sent.
    SetValue(wxEmptyString);
}
コード例 #16
0
ファイル: odcombo.cpp プロジェクト: catalinr/wxWidgets
void wxOwnerDrawnComboBox::DoClear()
{
    EnsurePopupControl();

    GetVListBoxComboPopup()->Clear();

    // There is no text entry when using wxCB_READONLY style, so test for it.
    if ( GetTextCtrl() )
        wxTextEntry::Clear();
}
コード例 #17
0
ファイル: odcombo.cpp プロジェクト: 252525fb/rpcs3
int wxOwnerDrawnComboBox::DoInsert(const wxString& item, unsigned int pos)
{
    EnsurePopupControl();

    wxCHECK_MSG(!(GetWindowStyle() & wxCB_SORT), -1, wxT("can't insert into sorted list"));
    wxCHECK_MSG(IsValidInsert(pos), -1, wxT("invalid index"));

    GetVListBoxComboPopup()->Insert(item,pos);

    return pos;
}
コード例 #18
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
void wxOwnerDrawnComboBox::Select(int n)
{
    EnsurePopupControl();

    wxCHECK_RET( (n == wxNOT_FOUND) || IsValid(n), wxT("invalid index in wxOwnerDrawnComboBox::Select") );

    GetVListBoxComboPopup()->SetSelection(n);

    wxString str;
    if ( n >= 0 )
        str = GetVListBoxComboPopup()->GetString(n);

    // Refresh text portion in control
    if ( m_text )
        m_text->ChangeValue( str );
    else
        m_valueString = str;

    Refresh();
}
コード例 #19
0
ファイル: odcombo.cpp プロジェクト: 252525fb/rpcs3
void wxOwnerDrawnComboBox::OnDrawItem( wxDC& dc,
                                       const wxRect& rect,
                                       int item,
                                       int flags ) const
{
    if ( flags & wxODCB_PAINTING_CONTROL )
    {
        dc.DrawText( GetValue(),
                     rect.x + GetTextIndent(),
                     (rect.height-dc.GetCharHeight())/2 + rect.y );
    }
    else
    {
        dc.DrawText( GetVListBoxComboPopup()->GetString(item), rect.x + 2, rect.y );
    }
}
コード例 #20
0
ファイル: odcombo.cpp プロジェクト: beanhome/dev
wxOwnerDrawnComboBox::~wxOwnerDrawnComboBox()
{
    if ( m_popupInterface )
        GetVListBoxComboPopup()->ClearClientDatas();
}