#include "wx/hashmap.h"
-#if wxUSE_EXTENDED_RTTI
-WX_DEFINE_FLAGS( wxListCtrlStyle )
-
-wxBEGIN_FLAGS( wxListCtrlStyle )
- // new style border flags, we put them first to
- // use them for streaming out
- wxFLAGS_MEMBER(wxBORDER_SIMPLE)
- wxFLAGS_MEMBER(wxBORDER_SUNKEN)
- wxFLAGS_MEMBER(wxBORDER_DOUBLE)
- wxFLAGS_MEMBER(wxBORDER_RAISED)
- wxFLAGS_MEMBER(wxBORDER_STATIC)
- wxFLAGS_MEMBER(wxBORDER_NONE)
-
- // old style border flags
- wxFLAGS_MEMBER(wxSIMPLE_BORDER)
- wxFLAGS_MEMBER(wxSUNKEN_BORDER)
- wxFLAGS_MEMBER(wxDOUBLE_BORDER)
- wxFLAGS_MEMBER(wxRAISED_BORDER)
- wxFLAGS_MEMBER(wxSTATIC_BORDER)
- wxFLAGS_MEMBER(wxBORDER)
-
- // standard window styles
- wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
- wxFLAGS_MEMBER(wxCLIP_CHILDREN)
- wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
- wxFLAGS_MEMBER(wxWANTS_CHARS)
- wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
- wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
- wxFLAGS_MEMBER(wxVSCROLL)
- wxFLAGS_MEMBER(wxHSCROLL)
-
- wxFLAGS_MEMBER(wxLC_LIST)
- wxFLAGS_MEMBER(wxLC_REPORT)
- wxFLAGS_MEMBER(wxLC_ICON)
- wxFLAGS_MEMBER(wxLC_SMALL_ICON)
- wxFLAGS_MEMBER(wxLC_ALIGN_TOP)
- wxFLAGS_MEMBER(wxLC_ALIGN_LEFT)
- wxFLAGS_MEMBER(wxLC_AUTOARRANGE)
- wxFLAGS_MEMBER(wxLC_USER_TEXT)
- wxFLAGS_MEMBER(wxLC_EDIT_LABELS)
- wxFLAGS_MEMBER(wxLC_NO_HEADER)
- wxFLAGS_MEMBER(wxLC_SINGLE_SEL)
- wxFLAGS_MEMBER(wxLC_SORT_ASCENDING)
- wxFLAGS_MEMBER(wxLC_SORT_DESCENDING)
- wxFLAGS_MEMBER(wxLC_VIRTUAL)
-
-wxEND_FLAGS( wxListCtrlStyle )
-
-IMPLEMENT_DYNAMIC_CLASS_XTI(wxListCtrl, wxControl,"wx/listctrl.h")
-
-wxBEGIN_PROPERTIES_TABLE(wxListCtrl)
- wxEVENT_PROPERTY( TextUpdated , wxEVT_COMMAND_TEXT_UPDATED , wxCommandEvent )
-
- wxPROPERTY_FLAGS( WindowStyle , wxListCtrlStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
-wxEND_PROPERTIES_TABLE()
-
-wxBEGIN_HANDLERS_TABLE(wxListCtrl)
-wxEND_HANDLERS_TABLE()
-
-wxCONSTRUCTOR_5( wxListCtrl , wxWindow* , Parent , wxWindowID , Id , wxPoint , Position , wxSize , Size , long , WindowStyle )
-
-/*
- TODO : Expose more information of a list's layout etc. via appropriate objects (a la NotebookPageInfo)
-*/
-#else
-IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxControl)
-#endif
-
-IMPLEMENT_DYNAMIC_CLASS(wxListView, wxListCtrl)
-IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject)
-
-IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxNotifyEvent)
-
WX_DECLARE_HASH_MAP( int, wxListItem*, wxIntegerHash, wxIntegerEqual, wxListItemList );
#include "wx/listimpl.cpp"
&& (wxSystemOptions::GetOptionInt( wxMAC_ALWAYS_USE_GENERIC_LISTCTRL ) == 1)) ||
(style & wxLC_ICON) || (style & wxLC_SMALL_ICON) || (style & wxLC_LIST) )
{
- m_macIsUserPane = true;
-
long paneStyle = style;
paneStyle &= ~wxSIMPLE_BORDER;
paneStyle &= ~wxDOUBLE_BORDER;
else
{
- m_macIsUserPane = false;
+ DontCreatePeer();
if ( !wxWindow::Create(parent, id, pos, size, style & ~(wxHSCROLL | wxVSCROLL), name) )
return false;
m_dbImpl = new wxMacDataBrowserListCtrlControl( this, pos, size, style );
- m_peer = m_dbImpl;
+ SetPeer(m_dbImpl);
MacPostControlCreate( pos, size );
- InstallControlEventHandler( m_peer->GetControlRef() , GetwxMacListCtrlEventHandlerUPP(),
+ InstallControlEventHandler( GetPeer()->GetControlRef() , GetwxMacListCtrlEventHandlerUPP(),
GetEventTypeCount(eventList), eventList, this,
(EventHandlerRef *)&m_macListCtrlEventHandler);
void wxListCtrl::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
- wxControl::DoSetSize(x, y, width, height, sizeFlags);
+ wxListCtrlBase::DoSetSize(x, y, width, height, sizeFlags);
if (m_genericImpl)
m_genericImpl->SetSize(0, 0, width, height, sizeFlags);
}
}
-wxSize wxListCtrl::DoGetBestSize() const
-{
- return wxWindow::DoGetBestSize();
-}
-
bool wxListCtrl::SetFont(const wxFont& font)
{
bool rv = true;
- rv = wxControl::SetFont(font);
+ rv = wxListCtrlBase::SetFont(font);
if (m_genericImpl)
rv = m_genericImpl->SetFont(font);
return rv;
{
if (m_genericImpl)
m_genericImpl->Freeze();
- wxControl::Freeze();
+ wxListCtrlBase::Freeze();
}
void wxListCtrl::Thaw ()
{
if (m_genericImpl)
m_genericImpl->Thaw();
- wxControl::Thaw();
+ wxListCtrlBase::Thaw();
}
void wxListCtrl::Update ()
{
if (m_genericImpl)
m_genericImpl->Update();
- wxControl::Update();
+ wxListCtrlBase::Update();
}
// ----------------------------------------------------------------------------
}
// Sets information about this column
-bool wxListCtrl::SetColumn(int col, wxListItem& item)
+bool wxListCtrl::SetColumn(int col, const wxListItem& item)
{
if (m_genericImpl)
return m_genericImpl->SetColumn(col, item);
if (item.GetMask() & wxLIST_MASK_TEXT)
{
wxFontEncoding enc;
- if ( m_font.Ok() )
+ if ( m_font.IsOk() )
enc = GetFont().GetEncoding();
else
enc = wxLocale::GetSystemEncoding();
}
// For list view mode (only), inserts a column.
-long wxListCtrl::InsertColumn(long col, wxListItem& item)
+long wxListCtrl::DoInsertColumn(long col, const wxListItem& item)
{
if (m_genericImpl)
return m_genericImpl->InsertColumn(col, item);
if (imageList && imageList->GetImageCount() > 0)
{
wxBitmap bmp = imageList->GetBitmap(0);
- //if (bmp.Ok())
+ //if (bmp.IsOk())
// type = kDataBrowserIconAndTextType;
}
return col;
}
-long wxListCtrl::InsertColumn(long col,
- const wxString& heading,
- int format,
- int width)
-{
- if (m_genericImpl)
- return m_genericImpl->InsertColumn(col, heading, format, width);
-
- wxListItem item;
- item.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_FORMAT;
- item.m_text = heading;
- if ( width > -1 )
- {
- item.m_mask |= wxLIST_MASK_WIDTH;
- item.m_width = width;
- }
- item.m_format = format;
-
- return InsertColumn(col, item);
-}
-
// scroll the control by the given number of pixels (exception: in list view,
// dx is interpreted as number of columns)
bool wxListCtrl::ScrollList(int dx, int dy)
if (m_dbImpl)
{
- m_dbImpl->SetScrollPosition(dx, dy);
+ // Notice that the parameter order is correct here: first argument is
+ // the "top" displacement, second one is the "left" one.
+ m_dbImpl->SetScrollPosition(dy, dx);
}
return true;
}
if (bgColor == wxNullColour)
bgColor = listBgColor;
- if (!font.Ok())
+ if (!font.IsOk())
font = list->GetFont();
wxCFStringRef cfString( text, wxLocale::GetSystemEncoding() );
else
{
- if (color.Ok())
+ if (color.IsOk())
color.GetRGBColor(&labelColor);
- else if (list->GetTextColour().Ok())
+ else if (list->GetTextColour().IsOk())
list->GetTextColour().GetRGBColor(&labelColor);
- if (bgColor.Ok())
+ if (bgColor.IsOk())
{
bgColor.GetRGBColor(&backgroundColor);
CGContextSaveGState(context);
{
info.version = kHIThemeTextInfoVersionOne;
info.fontID = kThemeViewsFont;
- if (font.Ok())
+ if (font.IsOk())
{
info.fontID = kThemeSpecifiedFont;
info.font = (CTFontRef) font.OSXGetCTFont();
info.version = kHIThemeTextInfoVersionZero;
info.fontID = kThemeViewsFont;
- if (font.Ok())
+ if (font.IsOk())
{
info.fontID = font.MacGetThemeFontID();