added wxEL_NO_REORDER style (modified patch 1655969)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44502 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
e3a50b565b
commit
a41b5c2fd4
@ -21,6 +21,7 @@ class WXDLLEXPORT wxListEvent;
|
||||
#define wxEL_ALLOW_NEW 0x0100
|
||||
#define wxEL_ALLOW_EDIT 0x0200
|
||||
#define wxEL_ALLOW_DELETE 0x0400
|
||||
#define wxEL_NO_REORDER 0x0800
|
||||
|
||||
// This class provides a composite control that lets the
|
||||
// user easily enter list of strings
|
||||
|
@ -144,18 +144,21 @@ wxEditableListBox::wxEditableListBox(wxWindow *parent, wxWindowID id,
|
||||
subsizer->Add(m_bDel, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
|
||||
}
|
||||
|
||||
m_bUp = new wxBitmapButton(subp, wxID_ELB_UP, wxBitmap(elup_xpm));
|
||||
subsizer->Add(m_bUp, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
|
||||
if (!(m_style & wxEL_NO_REORDER))
|
||||
{
|
||||
m_bUp = new wxBitmapButton(subp, wxID_ELB_UP, wxBitmap(elup_xpm));
|
||||
subsizer->Add(m_bUp, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
|
||||
|
||||
m_bDown = new wxBitmapButton(subp, wxID_ELB_DOWN, wxBitmap(eldown_xpm));
|
||||
subsizer->Add(m_bDown, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
|
||||
m_bDown = new wxBitmapButton(subp, wxID_ELB_DOWN, wxBitmap(eldown_xpm));
|
||||
subsizer->Add(m_bDown, 0, wxALIGN_CENTRE_VERTICAL | wxTOP | wxBOTTOM, BTN_BORDER);
|
||||
}
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
if ( m_bEdit ) m_bEdit->SetToolTip(_("Edit item"));
|
||||
if ( m_bNew ) m_bNew->SetToolTip(_("New item"));
|
||||
if ( m_bDel ) m_bDel->SetToolTip(_("Delete item"));
|
||||
m_bUp->SetToolTip(_("Move up"));
|
||||
m_bDown->SetToolTip(_("Move down"));
|
||||
if ( m_bUp ) m_bUp->SetToolTip(_("Move up"));
|
||||
if ( m_bDown ) m_bDown->SetToolTip(_("Move down"));
|
||||
#endif
|
||||
|
||||
subp->SetSizer(subsizer);
|
||||
@ -200,8 +203,12 @@ void wxEditableListBox::GetStrings(wxArrayString& strings) const
|
||||
void wxEditableListBox::OnItemSelected(wxListEvent& event)
|
||||
{
|
||||
m_selection = event.GetIndex();
|
||||
m_bUp->Enable(m_selection != 0 && m_selection < m_listCtrl->GetItemCount()-1);
|
||||
m_bDown->Enable(m_selection < m_listCtrl->GetItemCount()-2);
|
||||
if (!(m_style & wxEL_NO_REORDER))
|
||||
{
|
||||
m_bUp->Enable(m_selection != 0 && m_selection < m_listCtrl->GetItemCount()-1);
|
||||
m_bDown->Enable(m_selection < m_listCtrl->GetItemCount()-2);
|
||||
}
|
||||
|
||||
if (m_style & wxEL_ALLOW_EDIT)
|
||||
m_bEdit->Enable(m_selection < m_listCtrl->GetItemCount()-1);
|
||||
if (m_style & wxEL_ALLOW_DELETE)
|
||||
|
Loading…
Reference in New Issue
Block a user