#include "wx/renderer.h"
+#ifdef __WXMAC__
+ #include "wx/mac/private.h"
+#endif
+
+#include <math.h>
+
+
+// NOTE: If using the wxListBox visual attributes works everywhere then this can
+// be removed, as well as the #else case below.
+#define _USE_VISATTR 0
+
+
// ----------------------------------------------------------------------------
// events
// ----------------------------------------------------------------------------
static const int LINE_SPACING = 0;
// extra margins around the text label
-static const int EXTRA_WIDTH = 3;
+static const int EXTRA_WIDTH = 4;
static const int EXTRA_HEIGHT = 4;
// margin between the window and the items
// all these functions only do something if the line is currently visible
- // change the line "selected" state, return TRUE if it really changed
- bool HighlightLine( size_t line, bool highlight = TRUE);
+ // change the line "selected" state, return true if it really changed
+ bool HighlightLine( size_t line, bool highlight = true);
// as HighlightLine() but do it for the range of lines: this is incredibly
// more efficient for virtual list controls!
//
// NB: unlike HighlightLine() this one does refresh the lines on screen
- void HighlightLines( size_t lineFrom, size_t lineTo, bool on = TRUE );
+ void HighlightLines( size_t lineFrom, size_t lineTo, bool on = true );
// toggle the line state and refresh it
void ReverseHighlight( size_t line )
int GetTextLength( const wxString &s ) const;
void SetImageList( wxImageListType *imageList, int which );
- void SetItemSpacing( int spacing, bool isSmall = FALSE );
- int GetItemSpacing( bool isSmall = FALSE );
+ void SetItemSpacing( int spacing, bool isSmall = false );
+ int GetItemSpacing( bool isSmall = false );
void SetColumn( int col, wxListItem &item );
void SetColumnWidth( int col, int width );
}
// set the scrollbars and update the positions of the items
- void RecalculatePositions(bool noRefresh = FALSE);
+ void RecalculatePositions(bool noRefresh = false);
// refresh the window and the header
void RefreshAll();
void DeleteColumn( int col );
void DeleteEverything();
void EnsureVisible( long index );
- long FindItem( long start, const wxString& str, bool partial = FALSE );
+ long FindItem( long start, const wxString& str, bool partial = false );
long FindItem( long start, long data);
+ long FindItem( const wxPoint& pt );
long HitTest( int x, int y, int &flags );
void InsertItem( wxListItem &item );
void InsertColumn( long col, wxListItem &item );
virtual bool SetFont(const wxFont& font)
{
if ( !wxScrolledWindow::SetFont(font) )
- return FALSE;
+ return false;
m_lineHeight = 0;
- return TRUE;
+ return true;
}
// these are for wxListLineData usage only
bool wxListItemData::IsHit( int x, int y ) const
{
- wxCHECK_MSG( m_rect, FALSE, _T("can't be called in this mode") );
+ wxCHECK_MSG( m_rect, false, _T("can't be called in this mode") );
return wxRect(GetX(), GetY(), GetWidth(), GetHeight()).Inside(x, y);
}
m_gi = new GeometryInfo;
}
- m_highlighted = FALSE;
+ m_highlighted = false;
InitItems( GetMode() == wxLC_REPORT ? m_owner->GetColumnCount() : 1 );
}
dc->SetPen( *wxTRANSPARENT_PEN );
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void wxListLineData::Draw( wxDC *dc )
bool wxListLineData::Highlight( bool on )
{
- wxCHECK_MSG( !IsVirtual(), FALSE, _T("unexpected call to Highlight") );
+ wxCHECK_MSG( !IsVirtual(), false, _T("unexpected call to Highlight") );
if ( on == m_highlighted )
- return FALSE;
+ return false;
m_highlighted = on;
- return TRUE;
+ return true;
}
void wxListLineData::ReverseHighlight( void )
void wxListHeaderWindow::Init()
{
m_currentCursor = (wxCursor *) NULL;
- m_isDragging = FALSE;
- m_dirty = FALSE;
+ m_isDragging = false;
+ m_dirty = false;
}
wxListHeaderWindow::wxListHeaderWindow()
m_owner = owner;
m_resizeCursor = new wxCursor( wxCURSOR_SIZEWE );
- SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
+#if _USE_VISATTR
+ wxVisualAttributes attr = wxPanel::GetClassDefaultAttributes();
+ SetOwnForegroundColour( attr.colFg );
+ SetOwnBackgroundColour( attr.colBg );
+ if (!m_hasFont)
+ SetOwnFont( attr.font );
+#else
+ SetOwnForegroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
+ SetOwnBackgroundColour( wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
+ if (!m_hasFont)
+ SetOwnFont( wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT ));
+#endif
}
wxListHeaderWindow::~wxListHeaderWindow()
dc.SetBackgroundMode(wxTRANSPARENT);
- // do *not* use the listctrl colour for headers - one day we will have a
- // function to set it separately
- //dc.SetTextForeground( *wxBLACK );
- dc.SetTextForeground(wxSystemSettings::
- GetSystemColour( wxSYS_COLOUR_WINDOWTEXT ));
+ dc.SetTextForeground(GetForegroundColour());
int x = HEADER_OFFSET_X;
// for this we need the width of the text
wxCoord wLabel;
- wxCoord hLabel;
+ wxCoord hLabel;
dc.GetTextExtent(item.GetText(), &wLabel, &hLabel);
wLabel += 2*EXTRA_WIDTH;
if (event.ButtonUp())
{
ReleaseMouse();
- m_isDragging = FALSE;
- m_dirty = TRUE;
+ m_isDragging = false;
+ m_dirty = true;
m_owner->SetColumnWidth( m_column, m_currentX - m_minX );
SendListEvent(wxEVT_COMMAND_LIST_COL_END_DRAG, event.GetPosition());
}
else // not dragging
{
m_minX = 0;
- bool hit_border = FALSE;
+ bool hit_border = false;
// end of the current column
int xpos = 0;
if ( (abs(x-xpos) < 3) && (y < 22) )
{
// near the column border
- hit_border = TRUE;
+ hit_border = true;
break;
}
if ( SendListEvent(wxEVT_COMMAND_LIST_COL_BEGIN_DRAG,
event.GetPosition()) )
{
- m_isDragging = TRUE;
+ m_isDragging = true;
m_currentX = x;
CaptureMouse();
DrawCurrent();
m_itemEdited(itemEdit)
{
m_owner = owner;
- m_finished = FALSE;
+ m_finished = false;
wxRect rectLabel = owner->GetLineLabelRect(itemEdit);
{
wxPendingDelete.Append(this);
- m_finished = TRUE;
+ m_finished = true;
m_owner->SetFocus();
}
if ( value == m_startValue )
{
// nothing changed, always accept
- return TRUE;
+ return true;
}
if ( !m_owner->OnRenameAccept(m_itemEdited, value) )
{
// vetoed by the user
- return FALSE;
+ return false;
}
// accepted, do rename the item
m_owner->SetItemText(m_itemEdited, value);
- return TRUE;
+ return true;
}
void wxListTextCtrl::OnChar( wxKeyEvent &event )
switch ( event.m_keyCode )
{
case WXK_RETURN:
- if ( !AcceptChanges() )
+ if ( AcceptChanges() )
{
- // vetoed by the user code
- break;
+ // Close the text control, changes were accepted
+ Finish();
}
- //else: fall through
+ // else do nothing, do not accept and do not close
+
+ break;
case WXK_ESCAPE:
Finish();
sx = parentSize.x - myPos.x;
if (mySize.x > sx)
sx = mySize.x;
- SetSize(sx, -1);
+ SetSize(sx, wxDefaultCoord);
event.Skip();
}
{
if ( !m_finished )
{
- // We must finish regardless of success, otherwise we'll get focus problems
+ // We must finish regardless of success, otherwise we'll get
+ // focus problems:
Finish();
if ( !AcceptChanges() )
m_owner->OnRenameCancelled( m_itemEdited );
}
+ // We must let the native text control handle focus, too, otherwise
+ // it could have problems with the cursor (e.g., in wxGTK):
event.Skip();
}
void wxListMainWindow::Init()
{
- m_dirty = TRUE;
+ m_dirty = true;
m_countVirt = 0;
m_lineFrom =
m_lineTo = (size_t)-1;
m_small_spacing = 30;
m_normal_spacing = 40;
- m_hasFocus = FALSE;
+ m_hasFocus = false;
m_dragCount = 0;
- m_isCreated = FALSE;
+ m_isCreated = false;
- m_lastOnSame = FALSE;
+ m_lastOnSame = false;
m_renameTimer = new wxListRenameTimer( this );
m_current =
SetScrollbars( 0, 0, 0, 0, 0, 0 );
- SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_LISTBOX ) );
+ wxVisualAttributes attr = wxGenericListCtrl::GetClassDefaultAttributes();
+ SetOwnForegroundColour( attr.colFg );
+ SetOwnBackgroundColour( attr.colBg );
+ if (!m_hasFont)
+ SetOwnFont( attr.font );
}
wxListMainWindow::~wxListMainWindow()
else // !virtual
{
wxListLineData *ld = GetLine(line);
- wxCHECK_MSG( ld, FALSE, _T("invalid index in IsHighlighted") );
+ wxCHECK_MSG( ld, false, _T("invalid index in IsHighlighted") );
return ld->IsHighlighted();
}
else // !virtual
{
wxListLineData *ld = GetLine(line);
- wxCHECK_MSG( ld, FALSE, _T("invalid index in HighlightLine") );
+ wxCHECK_MSG( ld, false, _T("invalid index in HighlightLine") );
changed = ld->Highlight(highlight);
}
else // !report
{
// TODO: how to do it more efficiently?
- m_dirty = TRUE;
+ m_dirty = true;
}
}
// we just have one item to turn off
if ( HasCurrent() && IsHighlighted(m_current) )
{
- HighlightLine(m_current, FALSE);
+ HighlightLine(m_current, false);
RefreshLine(m_current);
}
}
le.m_itemIndex = itemEdit;
wxListLineData *data = GetLine(itemEdit);
- wxCHECK_MSG( data, FALSE, _T("invalid index in OnRenameAccept()") );
+ wxCHECK_MSG( data, false, _T("invalid index in OnRenameAccept()") );
data->GetItem( 0, le.m_item );
le.m_item.m_text = value;
// let owner know that the edit was cancelled
wxListEvent le( wxEVT_COMMAND_LIST_END_LABEL_EDIT, GetParent()->GetId() );
- le.SetEditCanceled(TRUE);
+ le.SetEditCanceled(true);
le.SetEventObject( GetParent() );
le.m_itemIndex = itemEdit;
return;
}
- bool forceClick = FALSE;
+ bool forceClick = false;
if (event.ButtonDClick())
{
m_renameTimer->Stop();
- m_lastOnSame = FALSE;
+ m_lastOnSame = false;
if ( current == m_lineLastClicked )
{
{
// the first click was on another item, so don't interpret this as
// a double click, but as a simple click instead
- forceClick = TRUE;
+ forceClick = true;
}
}
(hitResult == wxLIST_HITTEST_ONITEMLABEL) &&
HasFlag(wxLC_EDIT_LABELS) )
{
- m_renameTimer->Start( 100, TRUE );
+ m_renameTimer->Start( 100, true );
}
- m_lastOnSame = FALSE;
+ m_lastOnSame = false;
}
else if (event.RightDown())
{
m_lineLastClicked = current;
size_t oldCurrent = m_current;
-
- if ( IsSingleSel() || !(event.ControlDown() || event.ShiftDown()) )
+ bool cmdModifierDown = event.CmdDown();
+ if ( IsSingleSel() || !(cmdModifierDown || event.ShiftDown()) )
{
- HighlightAll( FALSE );
+ HighlightAll( false );
ChangeCurrent(current);
}
else // multi sel & either ctrl or shift is down
{
- if (event.ControlDown())
+ if (cmdModifierDown)
{
ChangeCurrent(current);
{
// all previously selected items are unselected unless ctrl is held
if ( !event.ControlDown() )
- HighlightAll(FALSE);
+ HighlightAll(false);
ChangeCurrent(newCurrent);
-
+
// refresh the old focus to remove it
RefreshLine( oldCurrent );
if ( !event.ControlDown() )
{
- HighlightLine( m_current, TRUE );
+ HighlightLine( m_current, true );
}
}
-
+
RefreshLine( m_current );
MoveToFocus();
// it
if ( !m_hasFocus )
{
- m_hasFocus = TRUE;
+ m_hasFocus = true;
RefreshSelected();
}
if ( GetParent()->GetEventHandler()->ProcessEvent( event) )
return;
}
- m_hasFocus = FALSE;
+ m_hasFocus = false;
RefreshSelected();
}
void wxListMainWindow::SetImageList( wxImageListType *imageList, int which )
{
- m_dirty = TRUE;
+ m_dirty = true;
// calc the spacing from the icon size
int width = 0,
void wxListMainWindow::SetItemSpacing( int spacing, bool isSmall )
{
- m_dirty = TRUE;
+ m_dirty = true;
if (isSmall)
{
m_small_spacing = spacing;
wxListHeaderWindow *headerWin = GetListCtrl()->m_headerWin;
if ( headerWin )
- headerWin->m_dirty = TRUE;
+ headerWin->m_dirty = true;
- m_dirty = TRUE;
+ m_dirty = true;
// invalidate it as it has to be recalculated
m_headerWidth = 0;
wxCHECK_RET( InReportView(),
_T("SetColumnWidth() can only be called in report mode.") );
- m_dirty = TRUE;
+ m_dirty = true;
wxListHeaderWindow *headerWin = GetListCtrl()->m_headerWin;
if ( headerWin )
- headerWin->m_dirty = TRUE;
+ headerWin->m_dirty = true;
wxListHeaderDataList::compatibility_iterator node = m_columns.Item( col );
wxCHECK_RET( node, _T("no column?") );
{
if ( IsSingleSel() )
{
- HighlightLine(oldCurrent, FALSE);
+ HighlightLine(oldCurrent, false);
}
RefreshLine(oldCurrent);
// we must unselect the old current item as well or we
// might end up with more than one selected item in a
// single selection control
- HighlightLine(oldCurrent, FALSE);
+ HighlightLine(oldCurrent, false);
}
RefreshLine( oldCurrent );
if ( oldCurrent != (size_t)-1 )
{
- HighlightLine( oldCurrent, FALSE );
+ HighlightLine( oldCurrent, false );
RefreshLine( oldCurrent );
}
}
ResetVisibleLinesRange();
// scrollbars must be reset
- m_dirty = TRUE;
+ m_dirty = true;
}
int wxListMainWindow::GetSelectedItemCount() const
// deal with the quick case first
if ( IsSingleSel() )
{
- return HasCurrent() ? IsHighlighted(m_current) : FALSE;
+ return HasCurrent() ? IsHighlighted(m_current) : false;
}
// virtual controls remmebers all its selections itself
if ( m_dirty )
{
wxConstCast(this, wxListMainWindow)->
- RecalculatePositions(TRUE /* no refresh */);
+ RecalculatePositions(true /* no refresh */);
}
rect = GetLineRect((size_t)index);
pos.x = rect.x;
pos.y = rect.y;
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
(entireHeight + lineHeight - 1) / lineHeight,
GetScrollPos(wxHORIZONTAL),
GetScrollPos(wxVERTICAL),
- TRUE );
+ true );
}
else // !report
{
(y + lineHeight) / lineHeight,
GetScrollPos( wxHORIZONTAL ),
GetScrollPos( wxVERTICAL ),
- TRUE
+ true
);
}
else // "flowed" arrangement, the most complicated case
0,
GetScrollPos( wxHORIZONTAL ),
0,
- TRUE
+ true
);
}
}
void wxListMainWindow::RefreshAll()
{
- m_dirty = FALSE;
+ m_dirty = false;
Refresh();
wxListHeaderWindow *headerWin = GetListCtrl()->m_headerWin;
if ( headerWin && headerWin->m_dirty )
{
- headerWin->m_dirty = FALSE;
+ headerWin->m_dirty = false;
headerWin->Refresh();
}
}
}
// we need to refresh the (vert) scrollbar as the number of items changed
- m_dirty = TRUE;
+ m_dirty = true;
SendNotify( index, wxEVT_COMMAND_LIST_DELETE_ITEM );
wxCHECK_RET( node, wxT("invalid column index in DeleteColumn()") );
- m_dirty = TRUE;
+ m_dirty = true;
delete node->GetData();
m_columns.Erase( node );
// been added and its position is not known yet
if ( m_dirty )
{
- RecalculatePositions(TRUE /* no refresh */);
+ RecalculatePositions(true /* no refresh */);
}
MoveToItem((size_t)index);
return wxNOT_FOUND;
}
+long wxListMainWindow::FindItem( const wxPoint& pt )
+{
+ size_t topItem;
+ GetVisibleLinesRange(&topItem, NULL);
+
+ wxPoint p;
+ GetItemPosition( GetItemCount()-1, p );
+ if( p.y == 0 )
+ return topItem;
+ long id = (long) floor( pt.y*(GetItemCount()-topItem-1)/p.y+topItem );
+ if( id >= 0 && id < (long)GetItemCount() )
+ return id;
+
+ return wxNOT_FOUND;
+}
+
long wxListMainWindow::HitTest( int x, int y, int &flags )
{
CalcUnscrolledPosition( x, y, &x, &y );
{
wxASSERT_MSG( !IsVirtual(), _T("can't be used with virtual control") );
- size_t count = GetItemCount();
- wxCHECK_RET( item.m_itemId >= 0 && (size_t)item.m_itemId <= count,
- _T("invalid item index") );
+ int count = GetItemCount();
+ wxCHECK_RET( item.m_itemId >= 0, _T("invalid item index") );
+ if (item.m_itemId > count)
+ item.m_itemId = count;
+
size_t id = item.m_itemId;
- m_dirty = TRUE;
+ m_dirty = true;
#if 0
// this is unused variable
m_lines.Insert( line, id );
- m_dirty = TRUE;
+ m_dirty = true;
// If an item is selected at or below the point of insertion, we need to
// increment the member variables because the current row's index has gone
void wxListMainWindow::InsertColumn( long col, wxListItem &item )
{
- m_dirty = TRUE;
+ m_dirty = true;
if ( InReportView() )
{
if (item.m_width == wxLIST_AUTOSIZE_USEHEADER)
list_ctrl_compare_func_2 = fn;
list_ctrl_compare_data = data;
m_lines.Sort( list_ctrl_compare_func_1 );
- m_dirty = TRUE;
+ m_dirty = true;
}
// ----------------------------------------------------------------------------
m_ownsImageListNormal =
m_ownsImageListSmall =
- m_ownsImageListState = FALSE;
+ m_ownsImageListState = false;
m_mainWin = (wxListMainWindow*) NULL;
m_headerWin = (wxListHeaderWindow*) NULL;
m_headerWin->SetSize(m_headerWin->GetSize().x, m_headerHeight);
if ( HasHeader() )
- ResizeReportView(TRUE);
+ ResizeReportView(true);
}
}
}
{
m_headerWin = new wxListHeaderWindow
(
- this, -1, m_mainWin,
+ this, wxID_ANY, m_mainWin,
wxPoint(0, 0),
wxSize(GetClientSize().x, m_headerHeight),
wxTAB_TRAVERSAL
m_imageListState = (wxImageListType *) NULL;
m_ownsImageListNormal =
m_ownsImageListSmall =
- m_ownsImageListState = FALSE;
+ m_ownsImageListState = false;
m_mainWin = (wxListMainWindow*) NULL;
m_headerWin = (wxListHeaderWindow*) NULL;
}
if ( !wxControl::Create( parent, id, pos, size, style, validator, name ) )
- return FALSE;
+ return false;
// don't create the inner window with the border
style &= ~wxBORDER_MASK;
- m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, style );
+ m_mainWin = new wxListMainWindow( this, wxID_ANY, wxPoint(0,0), size, style );
+#if defined( __WXMAC__ ) && __WXMAC_CARBON__
+ wxFont font ;
+ font.MacCreateThemeFont( kThemeViewsFont ) ;
+ SetFont( font ) ;
+#endif
if ( InReportView() )
{
CreateHeaderWindow();
if ( HasFlag(wxLC_NO_HEADER) )
{
// VZ: why do we create it at all then?
- m_headerWin->Show( FALSE );
+ m_headerWin->Show( false );
}
}
- return TRUE;
+ SetBestSize(size);
+
+ return true;
}
void wxGenericListCtrl::SetSingleStyle( long style, bool add )
if ( m_headerWin )
{
// don't delete, just hide, as we can reuse it later
- m_headerWin->Show(FALSE);
+ m_headerWin->Show(false);
}
//else: nothing to do
}
}
else // already have it, just show
{
- m_headerWin->Show( TRUE );
+ m_headerWin->Show( true );
}
}
bool wxGenericListCtrl::GetColumn(int col, wxListItem &item) const
{
m_mainWin->GetColumn( col, item );
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::SetColumn( int col, wxListItem& item )
{
m_mainWin->SetColumn( col, item );
- return TRUE;
+ return true;
}
int wxGenericListCtrl::GetColumnWidth( int col ) const
bool wxGenericListCtrl::SetColumnWidth( int col, int width )
{
m_mainWin->SetColumnWidth( col, width );
- return TRUE;
+ return true;
}
int wxGenericListCtrl::GetCountPerPage() const
bool wxGenericListCtrl::GetItem( wxListItem &info ) const
{
m_mainWin->GetItem( info );
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::SetItem( wxListItem &info )
{
m_mainWin->SetItem( info );
- return TRUE;
+ return true;
}
long wxGenericListCtrl::SetItem( long index, int col, const wxString& label, int imageId )
info.m_mask |= wxLIST_MASK_IMAGE;
};
m_mainWin->SetItem(info);
- return TRUE;
+ return true;
}
int wxGenericListCtrl::GetItemState( long item, long stateMask ) const
bool wxGenericListCtrl::SetItemState( long item, long state, long stateMask )
{
m_mainWin->SetItemState( item, state, stateMask );
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::SetItemImage( long item, int image, int WXUNUSED(selImage) )
info.m_mask = wxLIST_MASK_IMAGE;
info.m_itemId = item;
m_mainWin->SetItem( info );
- return TRUE;
+ return true;
}
wxString wxGenericListCtrl::GetItemText( long item ) const
info.m_itemId = item;
info.m_data = data;
m_mainWin->SetItem( info );
- return TRUE;
+ return true;
}
wxRect wxGenericListCtrl::GetViewRect() const
m_mainWin->GetItemRect( item, rect );
if ( m_mainWin->HasHeader() )
rect.y += m_headerHeight + 1;
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::GetItemPosition( long item, wxPoint& pos ) const
{
m_mainWin->GetItemPosition( item, pos );
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::SetItemPosition( long WXUNUSED(item), const wxPoint& WXUNUSED(pos) )
{
if (m_ownsImageListNormal) delete m_imageListNormal;
m_imageListNormal = imageList;
- m_ownsImageListNormal = FALSE;
+ m_ownsImageListNormal = false;
}
else if ( which == wxIMAGE_LIST_SMALL )
{
if (m_ownsImageListSmall) delete m_imageListSmall;
m_imageListSmall = imageList;
- m_ownsImageListSmall = FALSE;
+ m_ownsImageListSmall = false;
}
else if ( which == wxIMAGE_LIST_STATE )
{
if (m_ownsImageListState) delete m_imageListState;
m_imageListState = imageList;
- m_ownsImageListState = FALSE;
+ m_ownsImageListState = false;
}
m_mainWin->SetImageList( imageList, which );
{
SetImageList(imageList, which);
if ( which == wxIMAGE_LIST_NORMAL )
- m_ownsImageListNormal = TRUE;
+ m_ownsImageListNormal = true;
else if ( which == wxIMAGE_LIST_SMALL )
- m_ownsImageListSmall = TRUE;
+ m_ownsImageListSmall = true;
else if ( which == wxIMAGE_LIST_STATE )
- m_ownsImageListState = TRUE;
+ m_ownsImageListState = true;
}
bool wxGenericListCtrl::Arrange( int WXUNUSED(flag) )
bool wxGenericListCtrl::DeleteItem( long item )
{
m_mainWin->DeleteItem( item );
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::DeleteAllItems()
{
m_mainWin->DeleteAllItems();
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::DeleteAllColumns()
for ( size_t n = 0; n < count; n++ )
DeleteColumn(0);
- return TRUE;
+ return true;
}
void wxGenericListCtrl::ClearAll()
// if we don't have the header any longer, we need to relayout the window
if ( !GetColumnCount() )
{
- ResizeReportView(FALSE /* no header */);
+ ResizeReportView(false /* no header */);
}
- return TRUE;
+ return true;
}
void wxGenericListCtrl::Edit( long item )
bool wxGenericListCtrl::EnsureVisible( long item )
{
m_mainWin->EnsureVisible( item );
- return TRUE;
+ return true;
}
long wxGenericListCtrl::FindItem( long start, const wxString& str, bool partial )
return m_mainWin->FindItem( start, data );
}
-long wxGenericListCtrl::FindItem( long WXUNUSED(start), const wxPoint& WXUNUSED(pt),
+long wxGenericListCtrl::FindItem( long WXUNUSED(start), const wxPoint& pt,
int WXUNUSED(direction))
{
- return 0;
+ return m_mainWin->FindItem( pt );
}
long wxGenericListCtrl::HitTest( const wxPoint &point, int &flags )
// window
if ( GetColumnCount() == 1 && m_mainWin->HasHeader() )
{
- ResizeReportView(TRUE /* have header */);
+ ResizeReportView(true /* have header */);
}
m_headerWin->Refresh();
bool wxGenericListCtrl::SortItems( wxListCtrlCompare fn, long data )
{
m_mainWin->SortItems( fn, data );
- return TRUE;
+ return true;
}
// ----------------------------------------------------------------------------
if (m_mainWin)
{
m_mainWin->SetBackgroundColour( colour );
- m_mainWin->m_dirty = TRUE;
+ m_mainWin->m_dirty = true;
}
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::SetForegroundColour( const wxColour &colour )
{
if ( !wxWindow::SetForegroundColour( colour ) )
- return FALSE;
+ return false;
if (m_mainWin)
{
m_mainWin->SetForegroundColour( colour );
- m_mainWin->m_dirty = TRUE;
+ m_mainWin->m_dirty = true;
}
if (m_headerWin)
m_headerWin->SetForegroundColour( colour );
}
- return TRUE;
+ return true;
}
bool wxGenericListCtrl::SetFont( const wxFont &font )
{
if ( !wxWindow::SetFont( font ) )
- return FALSE;
+ return false;
if (m_mainWin)
{
m_mainWin->SetFont( font );
- m_mainWin->m_dirty = TRUE;
+ m_mainWin->m_dirty = true;
}
if (m_headerWin)
Refresh();
- return TRUE;
+ return true;
+}
+
+
+
+#if _USE_VISATTR
+#include "wx/listbox.h"
+#endif
+
+//static
+wxVisualAttributes
+wxGenericListCtrl::GetClassDefaultAttributes(wxWindowVariant variant)
+{
+#if _USE_VISATTR
+ // Use the same color scheme as wxListBox
+ return wxListBox::GetClassDefaultAttributes(variant);
+#else
+ wxUnusedVar(variant);
+ wxVisualAttributes attr;
+ attr.colFg = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT);
+ attr.colBg = wxSystemSettings::GetColour(wxSYS_COLOUR_LISTBOX);
+ attr.font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
+ return attr;
+#endif
}
// ----------------------------------------------------------------------------
bool wxGenericListCtrl::SetCursor( const wxCursor &cursor )
{
- return m_mainWin ? m_mainWin->wxWindow::SetCursor(cursor) : FALSE;
+ return m_mainWin ? m_mainWin->wxWindow::SetCursor(cursor) : false;
}
wxColour wxGenericListCtrl::GetBackgroundColour() const
#if wxUSE_MENUS
return m_mainWin->PopupMenu( menu, x, y );
#else
- return FALSE;
+ return false;
#endif // wxUSE_MENUS
}