wxFLAGS_MEMBER(wxBORDER_RAISED)
wxFLAGS_MEMBER(wxBORDER_STATIC)
wxFLAGS_MEMBER(wxBORDER_NONE)
-
+
// old style border flags
wxFLAGS_MEMBER(wxSIMPLE_BORDER)
wxFLAGS_MEMBER(wxSUNKEN_BORDER)
IMPLEMENT_DYNAMIC_CLASS_XTI(wxListBox, wxControl,"wx/listbox.h")
wxBEGIN_PROPERTIES_TABLE(wxListBox)
- wxEVENT_PROPERTY( Select , wxEVT_COMMAND_LISTBOX_SELECTED , wxCommandEvent )
- wxEVENT_PROPERTY( DoubleClick , wxEVT_COMMAND_LISTBOX_DOUBLECLICKED , wxCommandEvent )
+ wxEVENT_PROPERTY( Select , wxEVT_COMMAND_LISTBOX_SELECTED , wxCommandEvent )
+ wxEVENT_PROPERTY( DoubleClick , wxEVT_COMMAND_LISTBOX_DOUBLECLICKED , wxCommandEvent )
wxPROPERTY( Font , wxFont , SetFont , GetFont , EMPTY_MACROVALUE, 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
wxPROPERTY_COLLECTION( Choices , wxArrayString , wxString , AppendString , GetStrings, 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
- wxPROPERTY( Selection ,int, SetSelection, GetSelection, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
+ wxPROPERTY( Selection ,int, SetSelection, GetSelection, EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group") )
wxPROPERTY_FLAGS( WindowStyle , wxListBoxStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
wxEND_PROPERTIES_TABLE()
wxBEGIN_HANDLERS_TABLE(wxListBox)
wxEND_HANDLERS_TABLE()
-wxCONSTRUCTOR_4( wxListBox , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size )
+wxCONSTRUCTOR_4( wxListBox , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size )
#else
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
#endif
/*
TODO PROPERTIES
- selection
- content
- item
+ selection
+ content
+ item
*/
// ============================================================================
Append(choices[i]);
}
+ // now we can compute our best size correctly, so do it if necessary
+ SetBestSize(size);
+
return true;
}
int wxListBox::DoAppend(const wxString& item)
{
+ InvalidateBestSize();
+
int index = ListBox_AddString(GetHwnd(), item);
m_noItems++;
void wxListBox::SetSelection(int N, bool select)
{
- wxCHECK_RET( N == wxNOT_FOUND ||
+ wxCHECK_RET( N == wxNOT_FOUND ||
(N >= 0 && N < m_noItems),
wxT("invalid index in wxListBox::SetSelection") );
wxCHECK_RET( pos >= 0 && pos <= m_noItems,
wxT("invalid index in wxListBox::InsertItems") );
+ InvalidateBestSize();
+
int nItems = items.GetCount();
for ( int i = 0; i < nItems; i++ )
{
ListBox_SetItemData(GetHwnd(), idx, pNewItem);
}
+#else
+ wxUnusedVar(idx);
#endif // wxUSE_OWNER_DRAWN
}
// the listbox should be slightly larger than the widest string
int cx, cy;
- wxGetCharSize(GetHWND(), &cx, &cy, &GetFont());
+ wxGetCharSize(GetHWND(), &cx, &cy, GetFont());
wListbox += 3*cx;
wxDC dc;
dc.SetHDC((WXHDC)hdc);
- dc.SetFont(wxSystemSettings::GetFont(wxSYS_ANSI_VAR_FONT));
+ dc.SetFont(GetFont());
pStruct->itemHeight = dc.GetCharHeight() + 2*OWNER_DRAWN_LISTBOX_EXTRA_SPACE;
pStruct->itemWidth = dc.GetCharWidth();