Common wxListCtrl control name.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31359 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba 2005-01-14 13:07:44 +00:00
parent 51b83b3756
commit 52f2ad0899
11 changed files with 68 additions and 86 deletions

View File

@ -41,7 +41,7 @@ public:
const wxSize &size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
const wxString &name = _T("listctrl"))
const wxString &name = wxListCtrlNameStr)
: wxListCtrl(parent, id, pos, size, style, validator, name)
{
CreateColumns();
@ -222,7 +222,7 @@ void wxEditableListBox::OnNewItem(wxCommandEvent& WXUNUSED(event))
void wxEditableListBox::OnEndLabelEdit(wxListEvent& event)
{
if ( event.GetIndex() == m_listCtrl->GetItemCount()-1 &&
!event.GetText().IsEmpty() )
!event.GetText().empty() )
{
// The user edited last (empty) line, i.e. added new entry. We have to
// add new empty line here so that adding one more line is still

View File

@ -9,10 +9,10 @@ A special case of report view quite different from the other modes of the list
control is a virtual control in which the items data (including text, images
and attributes) is managed by the main program and is requested by the control
itself only when needed which allows to have controls with millions of items
without consuming much memory. To use virtual list control you must use
\helpref{SetItemCount}{wxlistctrlsetitemcount} first and overload at least
\helpref{OnGetItemText}{wxlistctrlongetitemtext} (and optionally
\helpref{OnGetItemImage}{wxlistctrlongetitemimage} and
without consuming much memory. To use virtual list control you must use
\helpref{SetItemCount}{wxlistctrlsetitemcount} first and overload at least
\helpref{OnGetItemText}{wxlistctrlongetitemtext} (and optionally
\helpref{OnGetItemImage}{wxlistctrlongetitemimage} and
\helpref{OnGetItemAttr}{wxlistctrlongetitemattr}) to return the information
about the items when the control requests it. Virtual list control can be used
as a normal one except that no operations which can take time proportional to
@ -111,7 +111,7 @@ Default constructor.
\func{}{wxListCtrl}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
\param{long}{ style = wxLC\_ICON}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``listCtrl"}}
\param{long}{ style = wxLC\_ICON}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = wxListCtrlNameStr}}
Constructor, creating and showing a list control.
@ -163,7 +163,7 @@ Arranges the items in icon or small icon view. This only has effect on Win32. {\
\func{void}{AssignImageList}{\param{wxImageList*}{ imageList}, \param{int }{which}}
Sets the image list associated with the control and
Sets the image list associated with the control and
takes ownership of it (i.e. the control will, unlike when using
SetImageList, delete the list when destroyed). {\it which} is one of
wxIMAGE\_LIST\_NORMAL, wxIMAGE\_LIST\_SMALL, wxIMAGE\_LIST\_STATE (the last is unimplemented).
@ -184,7 +184,7 @@ Deletes all items and all columns.
\func{bool}{Create}{\param{wxWindow*}{ parent}, \param{wxWindowID}{ id},\rtfsp
\param{const wxPoint\&}{ pos = wxDefaultPosition}, \param{const wxSize\&}{ size = wxDefaultSize},\rtfsp
\param{long}{ style = wxLC\_ICON}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = ``listCtrl"}}
\param{long}{ style = wxLC\_ICON}, \param{const wxValidator\& }{validator = wxDefaultValidator}, \param{const wxString\& }{name = wxListCtrlNameStr}}
Creates the list control. See \helpref{wxListCtrl::wxListCtrl}{wxlistctrlctor} for further details.
@ -251,7 +251,7 @@ the beginning if 'start' is -1.
\func{long}{FindItem}{\param{long }{start}, \param{const wxPoint\& }{pt}, \param{int }{direction}}
Find an item nearest this position in the specified direction, starting from
Find an item nearest this position in the specified direction, starting from
{\it start} or the beginning if {\it start} is -1.
\pythonnote{In place of a single overloaded method name, wxPython
@ -640,7 +640,7 @@ method:\par
\func{virtual wxListItemAttr *}{OnGetItemAttr}{\param{long }{item}}
This function may be overloaded in the derived class for a control with
This function may be overloaded in the derived class for a control with
{\tt wxLC\_VIRTUAL} style. It should return the attribute for the
for the specified {\tt item} or {\tt NULL} to use the default appearance
parameters.
@ -657,8 +657,8 @@ The base class version always returns {\tt NULL}.
\func{virtual int}{OnGetItemImage}{\param{long }{item}}
This function must be overloaded in the derived class for a control with
{\tt wxLC\_VIRTUAL} style having an \helpref{image list}{wxlistctrlsetimagelist}
This function must be overloaded in the derived class for a control with
{\tt wxLC\_VIRTUAL} style having an \helpref{image list}{wxlistctrlsetimagelist}
(if the control doesn't have an image list, it is not necessary to overload
it). It should return the index of the items image in the controls image list
or $-1$ for no image.
@ -675,7 +675,7 @@ The base class version always returns $-1$.
\constfunc{virtual wxString}{OnGetItemText}{\param{long }{item}, \param{long }{column}}
This function {\bf must} be overloaded in the derived class for a control with
This function {\bf must} be overloaded in the derived class for a control with
{\tt wxLC\_VIRTUAL} style. It should return the string containing the text of
the given {\it column} for the specified {\tt item}.
@ -716,8 +716,8 @@ virtual list controls.
\func{bool}{ScrollList}{\param{int }{dx}, \param{int }{dy}}
Scrolls the list control. If in icon, small icon or report view mode,
{\it dx} specifies the number of pixels to scroll. If in list view mode,
Scrolls the list control. If in icon, small icon or report view mode,
{\it dx} specifies the number of pixels to scroll. If in list view mode,
{\it dx} specifies the number of columns to scroll. {\it dy} always specifies
the number of pixels to scroll vertically.
@ -842,7 +842,7 @@ string or image at a given location.}
Sets the background colour for this item. This function only works in report view.
The colour can be retrieved using
The colour can be retrieved using
\helpref{GetItemBackgroundColour}{wxlistctrlgetitembackgroundcolour}.
@ -908,7 +908,7 @@ Sets the item text for this item.
Sets the colour for this item. This function only works in report view.
The colour can be retrieved using
The colour can be retrieved using
\helpref{GetItemTextColour}{wxlistctrlgetitemtextcolour}.

View File

@ -3,7 +3,7 @@
// Purpose: Generic list control
// Author: Robert Roebling
// Created: 01/02/97
// Id:
// RCS-ID: $Id$
// Copyright: (c) 1998 Robert Roebling and Julian Smart
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -72,7 +72,7 @@ public:
const wxSize &size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxT("listctrl") )
const wxString &name = wxListCtrlNameStr)
{
Create(parent, winid, pos, size, style, validator, name);
}
@ -84,7 +84,7 @@ public:
const wxSize &size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxT("listctrl") );
const wxString &name = wxListCtrlNameStr);
bool GetColumn( int col, wxListItem& item ) const;
bool SetColumn( int col, wxListItem& item );
@ -212,7 +212,7 @@ public:
virtual void SetFocus();
virtual wxSize DoGetBestSize() const;
// implementation
// --------------
@ -275,7 +275,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator &validator = wxDefaultValidator,
const wxString &name = wxT("listctrl") )
const wxString &name = wxListCtrlNameStr)
: wxGenericListCtrl(parent, winid, pos, size, style, validator, name)
{
}

View File

@ -22,6 +22,12 @@
#include "wx/listbase.h"
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
WXDLLEXPORT_DATA(extern const wxChar*) wxListCtrlNameStr;
// ----------------------------------------------------------------------------
// include the wxListCtrl class declaration
// ----------------------------------------------------------------------------
@ -46,7 +52,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxLC_REPORT,
const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxT("listctrl") )
const wxString &name = wxListCtrlNameStr)
{
Create(parent, winid, pos, size, style, validator, name);
}

View File

@ -176,14 +176,14 @@ class WXDLLEXPORT wxListCtrl: public wxControl
inline wxListCtrl(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator,
const wxString& name = "listCtrl")
const wxString& name = wxListCtrlNameStr)
{
Create(parent, id, pos, size, style, validator, name);
}
~wxListCtrl();
bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = "wxListCtrl");
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListCtrlNameStr);
// Attributes
@ -256,7 +256,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
int GetColumnCount() const;
// Retrieves the spacing between icons in pixels.
// If small is TRUE, gets the spacing for the small icon
// If isSmall is true, gets the spacing for the small icon
// view, otherwise the large icon view.
int GetItemSpacing(bool isSmall) const;
@ -274,7 +274,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
long GetTopItem() const ;
// Add or remove a single window style
void SetSingleStyle(long style, bool add = TRUE) ;
void SetSingleStyle(long style, bool add = true) ;
// Set the whole window style
void SetWindowStyleFlag(long style) ;
@ -335,7 +335,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
// Find an item whose label matches this string, starting from the item after 'start'
// or the beginning if 'start' is -1.
long FindItem(long start, const wxString& str, bool partial = FALSE);
long FindItem(long start, const wxString& str, bool partial = false);
// Find an item whose data matches this data, starting from the item after 'start'
// or the beginning if 'start' is -1.

View File

@ -176,14 +176,14 @@ class WXDLLEXPORT wxListCtrl: public wxControl
inline wxListCtrl(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator,
const wxString& name = "listCtrl")
const wxString& name = wxListCtrlNameStr)
{
Create(parent, id, pos, size, style, validator, name);
}
~wxListCtrl();
bool Create(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = "wxListCtrl");
long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, const wxString& name = wxListCtrlNameStr);
// Attributes
@ -256,7 +256,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
int GetColumnCount() const;
// Retrieves the spacing between icons in pixels.
// If small is TRUE, gets the spacing for the small icon
// If isSmall is true, gets the spacing for the small icon
// view, otherwise the large icon view.
int GetItemSpacing(bool isSmall) const;
@ -274,7 +274,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
long GetTopItem() const ;
// Add or remove a single window style
void SetSingleStyle(long style, bool add = TRUE) ;
void SetSingleStyle(long style, bool add = true) ;
// Set the whole window style
void SetWindowStyleFlag(long style) ;
@ -335,7 +335,7 @@ class WXDLLEXPORT wxListCtrl: public wxControl
// Find an item whose label matches this string, starting from the item after 'start'
// or the beginning if 'start' is -1.
long FindItem(long start, const wxString& str, bool partial = FALSE);
long FindItem(long start, const wxString& str, bool partial = false);
// Find an item whose data matches this data, starting from the item after 'start'
// or the beginning if 'start' is -1.

View File

@ -95,7 +95,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = _T("wxListCtrl"))
const wxString& name = wxListCtrlNameStr)
{
Init();
@ -110,7 +110,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = _T("wxListCtrl"));
const wxString& name = wxListCtrlNameStr);
// Attributes

View File

@ -1,3 +1,14 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/os2/listctrl.h
// Purpose: wxListCtrl class
// Author:
// Modified by:
// Created:
// RCS-ID: $Id$
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_LISTCTRL_H_
#define _WX_LISTCTRL_H_
@ -27,7 +38,7 @@ public:
,const wxSize& rSize = wxDefaultSize
,long lStyle = wxLC_ICON
,const wxValidator& rValidator = wxDefaultValidator
,const wxString& rsName = _T("wxListCtrl"))
,const wxString& rsName = wxListCtrlNameStr)
{
Init();
Create( pParent
@ -47,7 +58,7 @@ public:
,const wxSize& rSize = wxDefaultSize
,long lStyle = wxLC_ICON
,const wxValidator& rValidator = wxDefaultValidator
,const wxString& rsName = _T("wxListCtrl")
,const wxString& rsName = wxListCtrlNameStr
);
@ -173,7 +184,7 @@ public:
//
// Retrieves the spacing between icons in pixels.
// If small is TRUE, gets the spacing for the small icon
// If bIsSmall is true, gets the spacing for the small icon
// view, otherwise the large icon view.
//
int GetItemSpacing(bool bIsSmall) const;
@ -214,7 +225,7 @@ public:
//
// Add or remove a single window style
void SetSingleStyle( long lStyle
,bool bAdd = TRUE
,bool bAdd = true
);
//
@ -317,7 +328,7 @@ public:
//
long FindItem( long lStart
,const wxString& rsStr
,bool bPartial = FALSE
,bool bPartial = false
);
//
@ -476,12 +487,12 @@ protected:
// keep track of inserted/deleted columns
//
// TRUE if we have any internal data (user data & attributes)
// true if we have any internal data (user data & attributes)
//
bool m_bAnyInternalData;
//
// TRUE if we have any items with custom attributes
// true if we have any items with custom attributes
//
bool m_bHasAnyAttr;

View File

@ -4,7 +4,7 @@
// Author: William Osborne
// Modified by:
// Created: 10/13/04
// RCS-ID: $Id:
// RCS-ID: $Id$
// Copyright: (c) William Osborne
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -72,9 +72,6 @@ class WXDLLEXPORT wxImageList;
- addition of further convenience functions
to avoid use of wxListItem in some functions
- state/overlay images: probably not needed.
- in Win95, you can be called back to supply other information
besides text, such as state information. This saves no memory
and is probably superfluous to requirements.
- testing of whole API, extending current sample.
@ -95,7 +92,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = _T("wxListCtrl"))
const wxString& name = wxListCtrlNameStr)
{
Init();
@ -110,7 +107,7 @@ public:
const wxSize& size = wxDefaultSize,
long style = wxLC_ICON,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = _T("wxListCtrl"));
const wxString& name = wxListCtrlNameStr);
// Attributes
@ -229,12 +226,6 @@ public:
wxImageList *GetImageList(int which) const ;
// Sets the image list
// N.B. There's a quirk in the Win95 list view implementation.
// If in wxLC_LIST mode, it'll *still* display images by the labels if
// there's a small-icon image list set for the control - even though you
// haven't specified wxLIST_MASK_IMAGE when inserting.
// So you have to set a NULL small-icon image list to be sure that
// the wxLC_LIST mode works without icons. Of course, you may want icons...
void SetImageList(wxImageList *imageList, int which) ;
void AssignImageList(wxImageList *imageList, int which) ;
@ -401,8 +392,6 @@ protected:
virtual wxListItemAttr *OnGetItemAttr(long item) const;
private:
// process NM_CUSTOMDRAW notification message
WXLPARAM OnCustomDraw(WXLPARAM lParam);
DECLARE_DYNAMIC_CLASS(wxListCtrl)
DECLARE_EVENT_TABLE()
@ -412,4 +401,3 @@ private:
#endif // wxUSE_LISTCTRL
#endif // _WX_LISTCTRL_H_

View File

@ -120,6 +120,7 @@ WXDLLEXPORT_DATA(const wxChar *) wxFrameNameStr = wxT("frame");
WXDLLEXPORT_DATA(const wxChar *) wxGaugeNameStr = wxT("gauge");
WXDLLEXPORT_DATA(const wxChar *) wxStaticBoxNameStr = wxT("groupBox");
WXDLLEXPORT_DATA(const wxChar *) wxListBoxNameStr = wxT("listBox");
WXDLLEXPORT_DATA(const wxChar *) wxListCtrlNameStr = wxT("listctrl");
WXDLLEXPORT_DATA(const wxChar *) wxStaticTextNameStr = wxT("message");
WXDLLEXPORT_DATA(const wxChar *) wxStaticBitmapNameStr = wxT("message");
WXDLLEXPORT_DATA(const wxChar *) wxMultiTextNameStr = wxT("multitext");

View File

@ -4,7 +4,7 @@
// Author: William Osborne
// Modified by:
// Created: 10/13/04
// RCS-ID: $Id:
// RCS-ID: $Id$
// Copyright: (c) William Osborne
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
@ -29,7 +29,7 @@
#pragma hdrstop
#endif
#if wxUSE_LISTCTRL && defined(__WIN95__)
#if wxUSE_LISTCTRL
#ifndef WX_PRECOMP
#include "wx/app.h"
@ -43,18 +43,6 @@
#include "wx/listctrl.h"
#include "wx/dcclient.h"
#include "wx/palmos/private.h"
#include "wx/palmos/wrapcctl.h"
// ----------------------------------------------------------------------------
// private functions
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// private helper classes
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// events
// ----------------------------------------------------------------------------
@ -212,8 +200,7 @@ void wxListCtrl::SetWindowStyleFlag(long flag)
// accessors
// ----------------------------------------------------------------------------
/* static */ wxVisualAttributes
wxListCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
/* static */ wxVisualAttributes wxListCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
{
wxVisualAttributes attrs;
@ -626,16 +613,6 @@ bool wxListCtrl::SortItems(wxListCtrlCompare fn, long data)
// message processing
// ----------------------------------------------------------------------------
// see comment at the end of wxListCtrl::GetColumn()
#ifdef NM_CUSTOMDRAW // _WIN32_IE >= 0x0300
WXLPARAM wxListCtrl::OnCustomDraw(WXLPARAM lParam)
{
return CDRF_DODEFAULT;
}
#endif // NM_CUSTOMDRAW supported
// Necessary for drawing hrules and vrules, if specified
void wxListCtrl::OnPaint(wxPaintEvent& event)
{
@ -682,8 +659,7 @@ static wxListItemInternalData *wxGetInternalData(HWND hwnd, long itemId)
return NULL;
};
static
wxListItemInternalData *wxGetInternalData(const wxListCtrl *ctl, long itemId)
static wxListItemInternalData *wxGetInternalData(const wxListCtrl *ctl, long itemId)
{
return wxGetInternalData(GetHwndOf(ctl), itemId);
};