+ // We'd like to always use wxLC_ICON mode but it doesn't work with the
+ // native wxListCtrl under MSW unless we do have icons for all the items,
+ // so we can't use it if we have no image list. In this case we'd like to
+ // use wxLC_LIST mode because it works correctly for both horizontally and
+ // vertically laid out controls, but MSW native wxListCtrl insists on
+ // creating multiple columns if there are too many items and there doesn't
+ // seem anything to do about it, so we have to use wxLC_REPORT mode in this
+ // case there.
+
+ long flags = IsVertical() ? wxLC_ALIGN_LEFT : wxLC_ALIGN_TOP;
+ if ( GetImageList() )
+ {
+ flags |= wxLC_ICON;
+ }
+ else // No images.
+ {
+#ifdef __WXMSW__
+ if ( !IsVertical() )
+ {
+ // Notice that we intentionally overwrite the alignment flags here
+ // by not using "|=", alignment isn't used for report view.
+ flags = wxLC_REPORT | wxLC_NO_HEADER;
+ }
+ else
+#endif // __WXMSW__
+ {
+ flags |= wxLC_LIST;
+ }
+ }