1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "listctrl.h"
14 // For compilers that support precompilation, includes "wx.h".
15 #include "wx/wxprec.h"
21 #include "wx/dcscreen.h"
23 #include "wx/listctrl.h"
25 //-----------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------
29 IMPLEMENT_DYNAMIC_CLASS(wxListItemData
,wxObject
);
31 wxListItemData::wxListItemData(void)
42 wxListItemData::wxListItemData( const wxListItem
&info
)
46 m_colour
= info
.m_colour
;
50 void wxListItemData::SetItem( const wxListItem
&info
)
52 if (info
.m_mask
& wxLIST_MASK_TEXT
) m_text
= info
.m_text
;
53 if (info
.m_mask
& wxLIST_MASK_IMAGE
) m_image
= info
.m_image
;
54 if (info
.m_mask
& wxLIST_MASK_DATA
) m_data
= info
.m_data
;
55 m_colour
= info
.m_colour
;
58 m_width
= info
.m_width
;
62 void wxListItemData::SetText( const wxString
&s
)
67 void wxListItemData::SetImage( int image
)
72 void wxListItemData::SetData( long data
)
77 void wxListItemData::SetPosition( int x
, int y
)
83 void wxListItemData::SetSize( int width
, int height
)
85 if (width
!= -1) m_width
= width
;
86 if (height
!= -1) m_height
= height
;
89 void wxListItemData::SetColour( wxColour
*col
)
94 bool wxListItemData::HasImage(void) const
96 return (m_image
>= 0);
99 bool wxListItemData::HasText(void) const
101 return (!m_text
.IsNull());
104 bool wxListItemData::IsHit( int x
, int y
) const
106 return ((x
>= m_xpos
) && (x
<= m_xpos
+m_width
) && (y
>= m_ypos
) && (y
<= m_ypos
+m_height
));
109 void wxListItemData::GetText( wxString
&s
)
114 int wxListItemData::GetX( void ) const
119 int wxListItemData::GetY( void ) const
124 int wxListItemData::GetWidth(void) const
129 int wxListItemData::GetHeight(void) const
134 int wxListItemData::GetImage(void) const
139 void wxListItemData::GetItem( wxListItem
&info
)
141 info
.m_text
= m_text
;
142 info
.m_image
= m_image
;
143 info
.m_data
= m_data
;
146 wxColour
*wxListItemData::GetColour(void)
151 //-----------------------------------------------------------------------------
153 //-----------------------------------------------------------------------------
155 IMPLEMENT_DYNAMIC_CLASS(wxListHeaderData
,wxObject
);
157 wxListHeaderData::wxListHeaderData(void)
168 wxListHeaderData::wxListHeaderData( const wxListItem
&item
)
176 void wxListHeaderData::SetItem( const wxListItem
&item
)
178 m_mask
= item
.m_mask
;
179 m_text
= item
.m_text
;
180 m_image
= item
.m_image
;
181 m_format
= item
.m_format
;
182 m_width
= item
.m_width
;
183 if (m_width
< 0) m_width
= 80;
184 if (m_width
< 6) m_width
= 6;
187 void wxListHeaderData::SetPosition( int x
, int y
)
193 void wxListHeaderData::SetHeight( int h
)
198 void wxListHeaderData::SetWidth( int w
)
201 if (m_width
< 0) m_width
= 80;
202 if (m_width
< 6) m_width
= 6;
205 void wxListHeaderData::SetFormat( int format
)
210 bool wxListHeaderData::HasImage(void) const
212 return (m_image
!= 0);
215 bool wxListHeaderData::HasText(void) const
217 return (m_text
.Length() > 0);
220 bool wxListHeaderData::IsHit( int x
, int y
) const
222 return ((x
>= m_xpos
) && (x
<= m_xpos
+m_width
) && (y
>= m_ypos
) && (y
<= m_ypos
+m_height
));
225 void wxListHeaderData::GetItem( wxListItem
&item
)
227 item
.m_mask
= m_mask
;
228 item
.m_text
= m_text
;
229 item
.m_image
= m_image
;
230 item
.m_format
= m_format
;
231 item
.m_width
= m_width
;
234 void wxListHeaderData::GetText( wxString
&s
)
239 int wxListHeaderData::GetImage(void) const
244 int wxListHeaderData::GetWidth(void) const
249 int wxListHeaderData::GetFormat(void) const
254 //-----------------------------------------------------------------------------
256 //-----------------------------------------------------------------------------
258 IMPLEMENT_DYNAMIC_CLASS(wxListLineData
,wxObject
);
260 wxListLineData::wxListLineData( wxListMainWindow
*owner
, int mode
, wxBrush
*hilightBrush
)
265 m_hilightBrush
= hilightBrush
;
266 m_items
.DeleteContents( TRUE
);
270 void wxListLineData::CalculateSize( wxDC
*dc
, int spacing
)
277 m_bound_all
.width
= m_spacing
;
278 m_bound_all
.height
= m_spacing
+13;
279 wxNode
*node
= m_items
.First();
282 wxListItemData
*item
= (wxListItemData
*)node
->Data();
286 dc
->GetTextExtent( s
, &lw
, &lh
);
287 if (lw
> m_spacing
) m_bound_all
.width
= lw
;
293 wxNode
*node
= m_items
.First();
296 wxListItemData
*item
= (wxListItemData
*)node
->Data();
300 dc
->GetTextExtent( s
, &lw
, &lh
);
301 m_bound_all
.width
= lw
;
302 m_bound_all
.height
= lh
;
308 m_bound_all
.width
= 0;
309 m_bound_all
.height
= 0;
310 wxNode
*node
= m_items
.First();
313 wxListItemData
*item
= (wxListItemData
*)node
->Data();
316 if (s
.IsNull()) s
= "H";
318 dc
->GetTextExtent( s
, &lw
, &lh
);
319 item
->SetSize( item
->GetWidth(), lh
);
320 m_bound_all
.width
+= lw
;
321 m_bound_all
.height
= lh
;
329 void wxListLineData::SetPosition( wxDC
*dc
, int x
, int y
, int window_width
)
337 AssignRect( m_bound_icon
, 0, 0, 0, 0 );
338 AssignRect( m_bound_label
, 0, 0, 0, 0 );
339 AssignRect( m_bound_hilight
, m_bound_all
);
340 wxNode
*node
= m_items
.First();
343 wxListItemData
*item
= (wxListItemData
*)node
->Data();
344 if (item
->HasImage())
346 wxListItemData
*item
= (wxListItemData
*)node
->Data();
349 m_owner
->GetImageSize( item
->GetImage(), w
, h
);
350 m_bound_icon
.x
= m_bound_all
.x
+ (m_spacing
/2) - (w
/2);
351 m_bound_icon
.y
= m_bound_all
.y
+ m_spacing
- h
- 5;
352 m_bound_icon
.width
= w
;
353 m_bound_icon
.height
= h
;
354 if (!item
->HasText())
356 AssignRect( m_bound_hilight
, m_bound_icon
);
357 m_bound_hilight
.x
-= 5;
358 m_bound_hilight
.y
-= 5;
359 m_bound_hilight
.width
+= 9;
360 m_bound_hilight
.height
+= 9;
368 dc
->GetTextExtent( s
, &lw
, &lh
);
369 if (m_bound_all
.width
> m_spacing
)
370 m_bound_label
.x
= m_bound_all
.x
;
372 m_bound_label
.x
= m_bound_all
.x
+ (m_spacing
/2) - lw
/2;
373 m_bound_label
.y
= m_bound_all
.y
+ m_bound_all
.height
- lh
;
374 m_bound_label
.width
= lw
;
375 m_bound_label
.height
= lh
;
376 AssignRect( m_bound_hilight
, m_bound_label
);
377 m_bound_hilight
.x
-= 2;
378 m_bound_hilight
.y
-= 2;
379 m_bound_hilight
.width
+= 4;
380 m_bound_hilight
.height
+= 4;
387 AssignRect( m_bound_label
, m_bound_all
);
390 m_bound_all
.width
+= 4;
391 m_bound_all
.height
+= 3;
392 AssignRect( m_bound_hilight
, m_bound_all
);
393 AssignRect( m_bound_icon
, 0, 0, 0, 0 );
399 dc
->GetTextExtent( "H", &lw
, &lh
);
402 m_bound_all
.height
= lh
+3;
403 m_bound_all
.width
= window_width
;
404 AssignRect( m_bound_hilight
, m_bound_all
);
405 AssignRect( m_bound_label
, 0, 0, 0 ,0 );
406 AssignRect( m_bound_icon
, 0, 0, 0, 0 );
412 void wxListLineData::SetColumnPosition( int index
, int x
)
415 wxNode
*node
= m_items
.Nth( i
);
418 wxListItemData
*item
= (wxListItemData
*)node
->Data();
419 item
->SetPosition( x
, m_bound_all
.y
+1 );
423 void wxListLineData::GetSize( int &width
, int &height
)
425 width
= m_bound_all
.width
;
426 height
= m_bound_all
.height
;
429 void wxListLineData::GetExtent( int &x
, int &y
, int &width
, int &height
)
433 width
= m_bound_all
.width
;
434 height
= m_bound_all
.height
;
437 void wxListLineData::GetLabelExtent( int &x
, int &y
, int &width
, int &height
)
441 width
= m_bound_label
.width
;
442 height
= m_bound_label
.height
;
445 void wxListLineData::GetRect( wxRectangle
&rect
)
447 AssignRect( rect
, m_bound_all
);
450 long wxListLineData::IsHit( int x
, int y
)
452 wxNode
*node
= m_items
.First();
455 wxListItemData
*item
= (wxListItemData
*)node
->Data();
456 if (item
->HasImage() && IsInRect( x
, y
, m_bound_icon
)) return wxLIST_HITTEST_ONITEMICON
;
457 if (item
->HasText() && IsInRect( x
, y
, m_bound_label
)) return wxLIST_HITTEST_ONITEMLABEL
;
458 // if (!(item->HasImage() || item->HasText())) return 0;
460 // if there is no icon or text = empty
461 if (IsInRect( x
, y
, m_bound_all
)) return wxLIST_HITTEST_ONITEMICON
;
465 void wxListLineData::InitItems( int num
)
467 for (int i
= 0; i
< num
; i
++) m_items
.Append( new wxListItemData() );
470 void wxListLineData::SetItem( int index
, const wxListItem
&info
)
472 wxNode
*node
= m_items
.Nth( index
);
475 wxListItemData
*item
= (wxListItemData
*)node
->Data();
476 item
->SetItem( info
);
480 void wxListLineData::GetItem( int index
, wxListItem
&info
)
483 wxNode
*node
= m_items
.Nth( i
);
486 wxListItemData
*item
= (wxListItemData
*)node
->Data();
487 item
->GetItem( info
);
491 void wxListLineData::GetText( int index
, wxString
&s
)
494 wxNode
*node
= m_items
.Nth( i
);
498 wxListItemData
*item
= (wxListItemData
*)node
->Data();
503 void wxListLineData::SetText( int index
, const wxString s
)
506 wxNode
*node
= m_items
.Nth( i
);
509 wxListItemData
*item
= (wxListItemData
*)node
->Data();
514 int wxListLineData::GetImage( int index
)
517 wxNode
*node
= m_items
.Nth( i
);
520 wxListItemData
*item
= (wxListItemData
*)node
->Data();
521 return item
->GetImage();
526 void wxListLineData::DoDraw( wxDC
*dc
, bool hilight
, bool paintBG
)
528 long dev_x
= dc
->LogicalToDeviceX( m_bound_all
.x
-2 );
529 long dev_y
= dc
->LogicalToDeviceY( m_bound_all
.y
-2 );
530 long dev_w
= dc
->LogicalToDeviceXRel( m_bound_all
.width
+4 );
531 long dev_h
= dc
->LogicalToDeviceYRel( m_bound_all
.height
+4 );
533 if (!m_owner
->IsExposed( dev_x
, dev_y
, dev_w
, dev_h
))
542 dc
->SetBrush( * m_hilightBrush
);
543 dc
->SetPen( * wxTRANSPARENT_PEN
);
547 dc
->SetBrush( * wxWHITE_BRUSH
);
548 dc
->SetPen( * wxTRANSPARENT_PEN
);
550 dc
->DrawRectangle( m_bound_hilight
.x
, m_bound_hilight
.y
,
551 m_bound_hilight
.width
, m_bound_hilight
.height
);
554 if (m_mode
== wxLC_REPORT
)
557 wxNode
*node
= m_items
.First();
560 wxListItemData
*item
= (wxListItemData
*)node
->Data();
561 dc
->SetClippingRegion( item
->GetX(), item
->GetY(), item
->GetWidth()-3, item
->GetHeight() );
562 int x
= item
->GetX();
563 if (item
->HasImage())
566 m_owner
->DrawImage( item
->GetImage(), dc
, x
, item
->GetY() );
567 m_owner
->GetImageSize( item
->GetImage(), x
, y
);
568 x
+= item
->GetX() + 5;
574 dc
->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT
) );
576 dc
->SetTextForeground( *item
->GetColour() );
577 dc
->DrawText( s
, x
, item
->GetY() );
579 dc
->DestroyClippingRegion();
585 wxNode
*node
= m_items
.First();
588 wxListItemData
*item
= (wxListItemData
*)node
->Data();
589 if (item
->HasImage())
591 m_owner
->DrawImage( item
->GetImage(), dc
, m_bound_icon
.x
, m_bound_icon
.y
);
598 dc
->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT
) );
600 dc
->SetTextForeground( * item
->GetColour() );
601 dc
->DrawText( s
, m_bound_label
.x
, m_bound_label
.y
);
607 void wxListLineData::Hilight( bool on
)
609 if (on
== m_hilighted
) return;
611 m_owner
->SelectLine( this );
613 m_owner
->DeselectLine( this );
617 void wxListLineData::ReverseHilight( void )
619 m_hilighted
= !m_hilighted
;
621 m_owner
->SelectLine( this );
623 m_owner
->DeselectLine( this );
626 void wxListLineData::DrawRubberBand( wxDC
*dc
, bool on
)
630 dc
->SetPen( * wxBLACK_PEN
);
631 dc
->SetBrush( * wxTRANSPARENT_BRUSH
);
632 dc
->DrawRectangle( m_bound_hilight
.x
, m_bound_hilight
.y
,
633 m_bound_hilight
.width
, m_bound_hilight
.height
);
637 void wxListLineData::Draw( wxDC
*dc
)
639 DoDraw( dc
, m_hilighted
, m_hilighted
);
642 bool wxListLineData::IsInRect( int x
, int y
, const wxRectangle
&rect
)
644 return ((x
>= rect
.x
) && (x
<= rect
.x
+rect
.width
) &&
645 (y
>= rect
.y
) && (y
<= rect
.y
+rect
.height
));
648 bool wxListLineData::IsHilighted( void )
653 void wxListLineData::AssignRect( wxRectangle
&dest
, int x
, int y
, int width
, int height
)
658 dest
.height
= height
;
661 void wxListLineData::AssignRect( wxRectangle
&dest
, const wxRectangle
&source
)
665 dest
.width
= source
.width
;
666 dest
.height
= source
.height
;
669 //-----------------------------------------------------------------------------
670 // wxListHeaderWindow
671 //-----------------------------------------------------------------------------
673 IMPLEMENT_DYNAMIC_CLASS(wxListHeaderWindow
,wxWindow
);
675 BEGIN_EVENT_TABLE(wxListHeaderWindow
,wxWindow
)
676 EVT_PAINT (wxListHeaderWindow::OnPaint
)
677 EVT_MOUSE_EVENTS (wxListHeaderWindow::OnMouse
)
678 EVT_SET_FOCUS (wxListHeaderWindow::OnSetFocus
)
681 wxListHeaderWindow::wxListHeaderWindow( void )
683 m_owner
= (wxListMainWindow
*) NULL
;
684 m_currentCursor
= (wxCursor
*) NULL
;
685 m_resizeCursor
= (wxCursor
*) NULL
;
689 wxListHeaderWindow::wxListHeaderWindow( wxWindow
*win
, wxWindowID id
, wxListMainWindow
*owner
,
690 const wxPoint
&pos
, const wxSize
&size
,
691 long style
, const wxString
&name
) :
692 wxWindow( win
, id
, pos
, size
, style
, name
)
695 // m_currentCursor = wxSTANDARD_CURSOR;
696 m_currentCursor
= (wxCursor
*) NULL
;
697 m_resizeCursor
= new wxCursor( wxCURSOR_SIZEWE
);
701 wxListHeaderWindow::~wxListHeaderWindow( void )
703 delete m_resizeCursor
;
706 void wxListHeaderWindow::DoDrawRect( wxDC
*dc
, int x
, int y
, int w
, int h
)
708 const int m_corner
= 1;
710 dc
->SetBrush( *wxTRANSPARENT_BRUSH
);
712 dc
->SetPen( *wxBLACK_PEN
);
713 dc
->DrawLine( x
+w
-m_corner
+1, y
, x
+w
, y
+h
); // right (outer)
714 dc
->DrawRectangle( x
, y
+h
, w
, 1 ); // bottom (outer)
716 wxPen
pen( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNSHADOW
), 1, wxSOLID
);
719 dc
->DrawLine( x
+w
-m_corner
, y
, x
+w
-1, y
+h
); // right (inner)
720 dc
->DrawRectangle( x
+1, y
+h
-1, w
-2, 1 ); // bottom (inner)
722 dc
->SetPen( *wxWHITE_PEN
);
723 dc
->DrawRectangle( x
, y
, w
-m_corner
+1, 1 ); // top (outer)
724 dc
->DrawRectangle( x
, y
, 1, h
); // left (outer)
725 dc
->DrawLine( x
, y
+h
-1, x
+1, y
+h
-1 );
726 dc
->DrawLine( x
+w
-1, y
, x
+w
-1, y
+1 );
729 void wxListHeaderWindow::OnPaint( wxPaintEvent
&WXUNUSED(event
) )
731 wxPaintDC
dc( this );
736 dc
.SetFont( GetFont() );
742 GetClientSize( &w
, &h
);
744 dc
.SetTextForeground( *wxBLACK
);
745 if (m_foregroundColour
.Ok()) dc
.SetTextForeground( m_foregroundColour
);
749 int numColumns
= m_owner
->GetColumnCount();
751 for (int i
= 0; i
< numColumns
; i
++)
753 m_owner
->GetColumn( i
, item
);
754 int cw
= item
.m_width
-2;
755 if ((i
+1 == numColumns
) || (x
+item
.m_width
> w
-5)) cw
= w
-x
-1;
756 dc
.SetPen( *wxWHITE_PEN
);
758 DoDrawRect( &dc
, x
, y
, cw
, h
-2 );
759 dc
.SetClippingRegion( x
, y
, cw
-5, h
-4 );
760 dc
.DrawText( item
.m_text
, x
+4, y
+3 );
761 dc
.DestroyClippingRegion();
768 void wxListHeaderWindow::DrawCurrent()
772 int x2
= m_currentX
-1;
775 m_owner
->GetClientSize( &dummy
, &y2
);
776 ClientToScreen( &x1
, &y1
);
777 m_owner
->ClientToScreen( &x2
, &y2
);
780 dc
.SetLogicalFunction( wxXOR
);
781 dc
.SetPen( wxPen( *wxBLACK
, 2, wxSOLID
) );
782 dc
.SetBrush( *wxTRANSPARENT_BRUSH
);
784 dc
.DrawLine( x1
, y1
, x2
, y2
);
786 dc
.SetLogicalFunction( wxCOPY
);
788 dc
.SetPen( wxNullPen
);
789 dc
.SetBrush( wxNullBrush
);
792 void wxListHeaderWindow::OnMouse( wxMouseEvent
&event
)
794 int x
= event
.GetX();
795 int y
= event
.GetY();
799 if (event
.ButtonUp())
803 m_owner
->SetColumnWidth( m_column
, m_currentX
-m_minX
);
809 GetClientSize( &size_x
, & dummy
);
813 m_currentX
= m_minX
+7;
814 if (m_currentX
> size_x
-7) m_currentX
= size_x
-7;
821 bool hit_border
= FALSE
;
823 for (int j
= 0; j
< m_owner
->GetColumnCount(); j
++)
825 xpos
+= m_owner
->GetColumnWidth( j
);
826 if ((abs(x
-xpos
) < 3) && (y
< 22))
835 if (event
.LeftDown() && hit_border
)
848 if (m_currentCursor
== wxSTANDARD_CURSOR
) SetCursor( * m_resizeCursor
);
849 m_currentCursor
= m_resizeCursor
;
853 if (m_currentCursor
!= wxSTANDARD_CURSOR
) SetCursor( * wxSTANDARD_CURSOR
);
854 m_currentCursor
= wxSTANDARD_CURSOR
;
859 void wxListHeaderWindow::OnSetFocus( wxFocusEvent
&WXUNUSED(event
) )
864 //-----------------------------------------------------------------------------
865 // wxListRenameTimer (internal)
866 //-----------------------------------------------------------------------------
868 wxListRenameTimer::wxListRenameTimer( wxListMainWindow
*owner
)
873 void wxListRenameTimer::Notify()
875 m_owner
->OnRenameTimer();
878 //-----------------------------------------------------------------------------
879 // wxListTextCtrl (internal)
880 //-----------------------------------------------------------------------------
882 IMPLEMENT_DYNAMIC_CLASS(wxListTextCtrl
,wxTextCtrl
);
884 BEGIN_EVENT_TABLE(wxListTextCtrl
,wxTextCtrl
)
885 EVT_CHAR (wxListTextCtrl::OnChar
)
886 EVT_KILL_FOCUS (wxListTextCtrl::OnKillFocus
)
889 wxListTextCtrl::wxListTextCtrl( wxWindow
*parent
, const wxWindowID id
,
890 bool *accept
, wxString
*res
, wxListMainWindow
*owner
,
891 const wxString
&value
, const wxPoint
&pos
, const wxSize
&size
,
892 int style
, const wxValidator
& validator
, const wxString
&name
) :
893 wxTextCtrl( parent
, id
, value
, pos
, size
, style
, validator
, name
)
900 void wxListTextCtrl::OnChar( wxKeyEvent
&event
)
902 if (event
.m_keyCode
== WXK_RETURN
)
905 (*m_res
) = GetValue();
906 m_owner
->OnRenameAccept();
911 if (event
.m_keyCode
== WXK_ESCAPE
)
922 void wxListTextCtrl::OnKillFocus( wxFocusEvent
&WXUNUSED(event
) )
931 //-----------------------------------------------------------------------------
933 //-----------------------------------------------------------------------------
935 IMPLEMENT_DYNAMIC_CLASS(wxListMainWindow
,wxScrolledWindow
);
937 BEGIN_EVENT_TABLE(wxListMainWindow
,wxScrolledWindow
)
938 EVT_PAINT (wxListMainWindow::OnPaint
)
939 EVT_SIZE (wxListMainWindow::OnSize
)
940 EVT_MOUSE_EVENTS (wxListMainWindow::OnMouse
)
941 EVT_CHAR (wxListMainWindow::OnChar
)
942 EVT_SET_FOCUS (wxListMainWindow::OnSetFocus
)
943 EVT_KILL_FOCUS (wxListMainWindow::OnKillFocus
)
946 wxListMainWindow::wxListMainWindow( void )
949 m_lines
.DeleteContents( TRUE
);
950 m_columns
.DeleteContents( TRUE
);
951 m_current
= (wxListLineData
*) NULL
;
953 m_hilightBrush
= (wxBrush
*) NULL
;
957 m_small_image_list
= (wxImageList
*) NULL
;
958 m_normal_image_list
= (wxImageList
*) NULL
;
959 m_small_spacing
= 30;
960 m_normal_spacing
= 40;
963 m_lastOnSame
= FALSE
;
964 m_renameTimer
= new wxListRenameTimer( this );
969 wxListMainWindow::wxListMainWindow( wxWindow
*parent
, wxWindowID id
,
970 const wxPoint
&pos
, const wxSize
&size
,
971 long style
, const wxString
&name
) :
972 wxScrolledWindow( parent
, id
, pos
, size
, style
|wxHSCROLL
|wxVSCROLL
, name
)
975 m_lines
.DeleteContents( TRUE
);
976 m_columns
.DeleteContents( TRUE
);
977 m_current
= (wxListLineData
*) NULL
;
980 m_hilightBrush
= new wxBrush( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHT
), wxSOLID
);
981 m_small_image_list
= (wxImageList
*) NULL
;
982 m_normal_image_list
= (wxImageList
*) NULL
;
983 m_small_spacing
= 30;
984 m_normal_spacing
= 40;
991 if (m_mode
& wxLC_REPORT
)
1001 SetScrollbars( m_xScroll
, m_yScroll
, 0, 0, 0, 0 );
1004 m_lastOnSame
= FALSE
;
1005 m_renameTimer
= new wxListRenameTimer( this );
1006 m_renameAccept
= FALSE
;
1008 SetBackgroundColour( *wxWHITE
);
1011 wxListMainWindow::~wxListMainWindow( void )
1013 if (m_hilightBrush
) delete m_hilightBrush
;
1015 delete m_renameTimer
;
1018 void wxListMainWindow::RefreshLine( wxListLineData
*line
)
1026 wxClientDC
dc(this);
1028 line
->GetExtent( x
, y
, w
, h
);
1030 dc
.LogicalToDeviceX(x
-3),
1031 dc
.LogicalToDeviceY(y
-3),
1032 dc
.LogicalToDeviceXRel(w
+6),
1033 dc
.LogicalToDeviceXRel(h
+6) );
1034 Refresh( TRUE
, &rect
);
1038 void wxListMainWindow::OnPaint( wxPaintEvent
&WXUNUSED(event
) )
1040 if (m_dirty
) return;
1042 if (m_lines
.GetCount() == 0) return;
1044 wxPaintDC
dc( this );
1049 dc
.SetFont( GetFont() );
1051 if (m_mode
& wxLC_REPORT
)
1053 int lineSpacing
= 0;
1054 wxListLineData
*line
= (wxListLineData
*)m_lines
.First()->Data();
1056 line
->GetSize( dummy
, lineSpacing
);
1059 int y_s
= m_yScroll
*GetScrollPos( wxVERTICAL
);
1061 wxNode
*node
= m_lines
.Nth( y_s
/ lineSpacing
);
1062 for (int i
= 0; i
< m_visibleLines
+2; i
++)
1066 line
= (wxListLineData
*)node
->Data();
1068 node
= node
->Next();
1073 wxNode
*node
= m_lines
.First();
1076 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1078 node
= node
->Next();
1082 if (m_current
) m_current
->DrawRubberBand( &dc
, m_hasFocus
);
1087 void wxListMainWindow::HilightAll( bool on
)
1089 wxNode
*node
= m_lines
.First();
1092 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1093 if (line
->IsHilighted() != on
)
1095 line
->Hilight( on
);
1096 RefreshLine( line
);
1098 node
= node
->Next();
1102 void wxListMainWindow::SendNotify( wxListLineData
*line
, wxEventType command
)
1104 wxListEvent
le( command
, GetParent()->GetId() );
1105 le
.SetEventObject( GetParent() );
1106 le
.m_itemIndex
= GetIndexOfLine( line
);
1107 line
->GetItem( 0, le
.m_item
);
1108 GetParent()->GetEventHandler()->ProcessEvent( le
);
1111 void wxListMainWindow::FocusLine( wxListLineData
*WXUNUSED(line
) )
1113 // SendNotify( line, wxEVT_COMMAND_LIST_ITEM_FOCUSSED );
1116 void wxListMainWindow::UnfocusLine( wxListLineData
*WXUNUSED(line
) )
1118 // SendNotify( line, wxEVT_COMMAND_LIST_ITEM_UNFOCUSSED );
1121 void wxListMainWindow::SelectLine( wxListLineData
*line
)
1123 SendNotify( line
, wxEVT_COMMAND_LIST_ITEM_SELECTED
);
1126 void wxListMainWindow::DeselectLine( wxListLineData
*line
)
1128 SendNotify( line
, wxEVT_COMMAND_LIST_ITEM_DESELECTED
);
1131 void wxListMainWindow::DeleteLine( wxListLineData
*line
)
1133 SendNotify( line
, wxEVT_COMMAND_LIST_DELETE_ITEM
);
1136 void wxListMainWindow::StartLabelEdit( wxListLineData
*line
)
1138 SendNotify( line
, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT
);
1141 void wxListMainWindow::RenameLine( wxListLineData
*line
, const wxString
&newName
)
1143 wxListEvent
le( wxEVT_COMMAND_LIST_END_LABEL_EDIT
, GetParent()->GetId() );
1144 le
.SetEventObject( GetParent() );
1145 le
.m_itemIndex
= GetIndexOfLine( line
);
1146 line
->GetItem( 0, le
.m_item
);
1147 le
.m_item
.m_text
= newName
;
1148 GetParent()->GetEventHandler()->ProcessEvent( le
);
1151 void wxListMainWindow::OnRenameTimer()
1153 StartLabelEdit( m_current
);
1155 m_current
->GetText( 0, s
);
1160 m_current
->GetLabelExtent( x
, y
, w
, h
);
1162 wxClientDC
dc(this);
1164 x
= dc
.LogicalToDeviceX( x
);
1165 y
= dc
.LogicalToDeviceY( y
);
1167 wxListTextCtrl
*text
= new wxListTextCtrl(
1168 this, -1, &m_renameAccept
, &m_renameRes
, this, s
, wxPoint(x
-4,y
-4), wxSize(w
+11,h
+8) );
1172 void wxListMainWindow::OnRenameAccept()
1174 RenameLine( m_current
, m_renameRes
);
1177 void wxListMainWindow::OnMouse( wxMouseEvent
&event
)
1179 if (GetParent()->GetEventHandler()->ProcessEvent( event
)) return;
1181 if (!m_current
) return;
1182 if (m_dirty
) return;
1184 wxClientDC
dc(this);
1186 long x
= dc
.DeviceToLogicalX( (long)event
.GetX() );
1187 long y
= dc
.DeviceToLogicalY( (long)event
.GetY() );
1189 // Did we actually hit an item ?
1191 wxNode
*node
= m_lines
.First();
1192 wxListLineData
*line
= (wxListLineData
*) NULL
;
1195 line
= (wxListLineData
*)node
->Data();
1196 hitResult
= line
->IsHit( x
, y
);
1197 if (hitResult
) break;
1198 line
= (wxListLineData
*) NULL
;
1199 node
= node
->Next();
1202 if (!event
.Dragging())
1207 if (event
.Dragging() && (m_dragCount
> 3))
1211 wxListEvent
le( wxEVT_COMMAND_LIST_BEGIN_DRAG
, GetParent()->GetId() );
1212 le
.SetEventObject( GetParent() );
1213 le
.m_pointDrag
.x
= x
;
1214 le
.m_pointDrag
.y
= y
;
1215 GetParent()->GetEventHandler()->ProcessEvent( le
);
1222 if (event
.ButtonDClick())
1225 m_lastOnSame
= FALSE
;
1226 m_renameTimer
->Stop();
1228 SendNotify( line
, wxEVT_COMMAND_LIST_ITEM_ACTIVATED
);
1233 if (event
.LeftUp() && m_lastOnSame
)
1236 if ((line
== m_current
) &&
1237 (hitResult
== wxLIST_HITTEST_ONITEMLABEL
) &&
1238 (m_mode
& wxLC_EDIT_LABELS
) )
1240 m_renameTimer
->Start( 100, TRUE
);
1242 m_lastOnSame
= FALSE
;
1246 if (event
.RightDown())
1248 SendNotify( line
, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK
);
1252 if (event
.MiddleDown())
1254 SendNotify( line
, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK
);
1258 if (event
.LeftDown())
1261 wxListLineData
*oldCurrent
= m_current
;
1262 if (m_mode
& wxLC_SINGLE_SEL
)
1265 HilightAll( FALSE
);
1266 m_current
->ReverseHilight();
1267 RefreshLine( m_current
);
1271 if (event
.ShiftDown())
1274 m_current
->ReverseHilight();
1275 RefreshLine( m_current
);
1277 else if (event
.ControlDown())
1281 int numOfCurrent
= -1;
1282 node
= m_lines
.First();
1285 wxListLineData
*test_line
= (wxListLineData
*)node
->Data();
1287 if (test_line
== oldCurrent
) break;
1288 node
= node
->Next();
1292 node
= m_lines
.First();
1295 wxListLineData
*test_line
= (wxListLineData
*)node
->Data();
1297 if (test_line
== line
) break;
1298 node
= node
->Next();
1301 if (numOfLine
< numOfCurrent
)
1304 numOfLine
= numOfCurrent
;
1308 wxNode
*node
= m_lines
.Nth( numOfCurrent
);
1309 for (int i
= 0; i
<= numOfLine
-numOfCurrent
; i
++)
1311 wxListLineData
*test_line
= (wxListLineData
*)node
->Data();
1312 test_line
->Hilight(TRUE
);
1313 RefreshLine( test_line
);
1314 node
= node
->Next();
1320 HilightAll( FALSE
);
1321 m_current
->ReverseHilight();
1322 RefreshLine( m_current
);
1325 if (m_current
!= oldCurrent
)
1327 RefreshLine( oldCurrent
);
1328 UnfocusLine( oldCurrent
);
1329 FocusLine( m_current
);
1331 m_lastOnSame
= (m_current
== oldCurrent
);
1336 void wxListMainWindow::MoveToFocus( void )
1338 if (!m_current
) return;
1344 m_current
->GetExtent( x
, y
, w
, h
);
1348 GetClientSize( &w_p
, &h_p
);
1350 if (m_mode
& wxLC_REPORT
)
1352 int y_s
= m_yScroll
*GetScrollPos( wxVERTICAL
);
1353 if ((y
> y_s
) && (y
+h
< y_s
+h_p
)) return;
1354 if (y
-y_s
< 5) Scroll( -1, (y
-5-h_p
/2)/m_yScroll
);
1355 if (y
+h
+5 > y_s
+h_p
) Scroll( -1, (y
+h
-h_p
/2+h
+15)/m_yScroll
);
1359 int x_s
= m_xScroll
*GetScrollPos( wxHORIZONTAL
);
1360 if ((x
> x_s
) && (x
+w
< x_s
+w_p
)) return;
1361 if (x
-x_s
< 5) Scroll( (x
-5)/m_xScroll
, -1 );
1362 if (x
+w
-5 > x_s
+w_p
) Scroll( (x
+w
-w_p
+15)/m_xScroll
, -1 );
1366 void wxListMainWindow::OnArrowChar( wxListLineData
*newCurrent
, bool shiftDown
)
1368 if ((m_mode
& wxLC_SINGLE_SEL
) || (m_usedKeys
== FALSE
)) m_current
->Hilight( FALSE
);
1369 wxListLineData
*oldCurrent
= m_current
;
1370 m_current
= newCurrent
;
1372 if (shiftDown
|| (m_mode
& wxLC_SINGLE_SEL
)) m_current
->Hilight( TRUE
);
1373 RefreshLine( m_current
);
1374 RefreshLine( oldCurrent
);
1375 FocusLine( m_current
);
1376 UnfocusLine( oldCurrent
);
1379 void wxListMainWindow::OnChar( wxKeyEvent
&event
)
1381 wxListEvent
le( wxEVT_COMMAND_LIST_KEY_DOWN
, GetParent()->GetId() );
1382 le
.m_code
= event
.KeyCode();
1383 le
.SetEventObject( GetParent() );
1384 GetParent()->GetEventHandler()->ProcessEvent( le
);
1387 if (event.KeyCode() == WXK_TAB)
1389 if (event.ShiftDown())
1402 switch (event
.KeyCode())
1406 wxNode
*node
= m_lines
.Member( m_current
)->Previous();
1407 if (node
) OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1412 wxNode
*node
= m_lines
.Member( m_current
)->Next();
1413 if (node
) OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1418 wxNode
*node
= m_lines
.Last();
1419 OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1424 wxNode
*node
= m_lines
.First();
1425 OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1431 if (m_mode
& wxLC_REPORT
) { steps
= m_visibleLines
-1; }
1435 wxNode
*node
= m_lines
.First();
1436 for (;;) { if (m_current
== (wxListLineData
*)node
->Data()) break; pos
++; node
= node
->Next(); }
1437 steps
= pos
% m_visibleLines
;
1439 wxNode
*node
= m_lines
.Member( m_current
);
1440 for (int i
= 0; i
< steps
; i
++) if (node
->Previous()) node
= node
->Previous();
1441 if (node
) OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1447 if (m_mode
& wxLC_REPORT
) { steps
= m_visibleLines
-1; }
1450 int pos
= 0; wxNode
*node
= m_lines
.First();
1451 for (;;) { if (m_current
== (wxListLineData
*)node
->Data()) break; pos
++; node
= node
->Next(); }
1452 steps
= m_visibleLines
-(pos
% m_visibleLines
)-1;
1454 wxNode
*node
= m_lines
.Member( m_current
);
1455 for (int i
= 0; i
< steps
; i
++) if (node
->Next()) node
= node
->Next();
1456 if (node
) OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1461 if (!(m_mode
& wxLC_REPORT
))
1463 wxNode
*node
= m_lines
.Member( m_current
);
1464 for (int i
= 0; i
<m_visibleLines
; i
++) if (node
->Previous()) node
= node
->Previous();
1465 if (node
) OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1471 if (!(m_mode
& wxLC_REPORT
))
1473 wxNode
*node
= m_lines
.Member( m_current
);
1474 for (int i
= 0; i
<m_visibleLines
; i
++) if (node
->Next()) node
= node
->Next();
1475 if (node
) OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1481 m_current
->ReverseHilight();
1482 RefreshLine( m_current
);
1487 if (!(m_mode
& wxLC_SINGLE_SEL
))
1489 wxListLineData
*oldCurrent
= m_current
;
1490 m_current
->ReverseHilight();
1491 wxNode
*node
= m_lines
.Member( m_current
)->Next();
1492 if (node
) m_current
= (wxListLineData
*)node
->Data();
1494 RefreshLine( oldCurrent
);
1495 RefreshLine( m_current
);
1496 UnfocusLine( oldCurrent
);
1497 FocusLine( m_current
);
1504 wxListEvent
le( wxEVT_COMMAND_LIST_ITEM_ACTIVATED
, GetParent()->GetId() );
1505 le
.SetEventObject( GetParent() );
1506 le
.m_itemIndex
= GetIndexOfLine( m_current
);
1507 m_current
->GetItem( 0, le
.m_item
);
1508 GetParent()->GetEventHandler()->ProcessEvent( le
);
1520 void wxListMainWindow::OnSetFocus( wxFocusEvent
&WXUNUSED(event
) )
1523 RefreshLine( m_current
);
1525 if (!GetParent()) return;
1527 wxFocusEvent
event( wxEVT_SET_FOCUS
, GetParent()->GetId() );
1528 event
.SetEventObject( GetParent() );
1529 GetParent()->GetEventHandler()->ProcessEvent( event
);
1532 void wxListMainWindow::OnKillFocus( wxFocusEvent
&WXUNUSED(event
) )
1535 RefreshLine( m_current
);
1538 void wxListMainWindow::OnSize( wxSizeEvent
&WXUNUSED(event
) )
1541 We don't even allow the wxScrolledWindow::AdjustScrollbars() call
1546 void wxListMainWindow::DrawImage( int index
, wxDC
*dc
, int x
, int y
)
1548 if ((m_mode
& wxLC_ICON
) && (m_normal_image_list
))
1550 m_normal_image_list
->Draw( index
, *dc
, x
, y
, wxIMAGELIST_DRAW_TRANSPARENT
);
1553 if ((m_mode
& wxLC_SMALL_ICON
) && (m_small_image_list
))
1555 m_small_image_list
->Draw( index
, *dc
, x
, y
, wxIMAGELIST_DRAW_TRANSPARENT
);
1557 if ((m_mode
& wxLC_REPORT
) && (m_small_image_list
))
1559 m_small_image_list
->Draw( index
, *dc
, x
, y
, wxIMAGELIST_DRAW_TRANSPARENT
);
1564 void wxListMainWindow::GetImageSize( int index
, int &width
, int &height
)
1566 if ((m_mode
& wxLC_ICON
) && (m_normal_image_list
))
1568 m_normal_image_list
->GetSize( index
, width
, height
);
1571 if ((m_mode
& wxLC_SMALL_ICON
) && (m_small_image_list
))
1573 m_small_image_list
->GetSize( index
, width
, height
);
1576 if ((m_mode
& wxLC_REPORT
) && (m_small_image_list
))
1578 m_small_image_list
->GetSize( index
, width
, height
);
1585 int wxListMainWindow::GetTextLength( wxString
&s
)
1587 wxClientDC
dc( this );
1590 dc
.GetTextExtent( s
, &lw
, &lh
);
1594 int wxListMainWindow::GetIndexOfLine( const wxListLineData
*line
)
1597 wxNode
*node
= m_lines
.First();
1600 if (line
== (wxListLineData
*)node
->Data()) return i
;
1602 node
= node
->Next();
1607 void wxListMainWindow::SetImageList( wxImageList
*imageList
, int which
)
1610 if (which
== wxIMAGE_LIST_NORMAL
) m_normal_image_list
= imageList
;
1611 if (which
== wxIMAGE_LIST_SMALL
) m_small_image_list
= imageList
;
1614 void wxListMainWindow::SetItemSpacing( int spacing
, bool isSmall
)
1619 m_small_spacing
= spacing
;
1623 m_normal_spacing
= spacing
;
1627 int wxListMainWindow::GetItemSpacing( bool isSmall
)
1629 if (isSmall
) return m_small_spacing
; else return m_normal_spacing
;
1632 void wxListMainWindow::SetColumn( int col
, wxListItem
&item
)
1635 wxNode
*node
= m_columns
.Nth( col
);
1638 if (item
.m_width
== wxLIST_AUTOSIZE_USEHEADER
) item
.m_width
= GetTextLength( item
.m_text
)+7;
1639 wxListHeaderData
*column
= (wxListHeaderData
*)node
->Data();
1640 column
->SetItem( item
);
1642 wxListCtrl
*lc
= (wxListCtrl
*) GetParent();
1643 if (lc
->m_headerWin
) lc
->m_headerWin
->Refresh();
1646 void wxListMainWindow::SetColumnWidth( int col
, int width
)
1648 if (!(m_mode
& wxLC_REPORT
)) return;
1652 wxNode
*node
= m_columns
.Nth( col
);
1655 wxListHeaderData
*column
= (wxListHeaderData
*)node
->Data();
1656 column
->SetWidth( width
);
1659 node
= m_lines
.First();
1662 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1663 wxNode
*n
= line
->m_items
.Nth( col
);
1666 wxListItemData
*item
= (wxListItemData
*)n
->Data();
1667 item
->SetSize( width
, -1 );
1669 node
= node
->Next();
1672 wxListCtrl
*lc
= (wxListCtrl
*) GetParent();
1673 if (lc
->m_headerWin
) lc
->m_headerWin
->Refresh();
1676 void wxListMainWindow::GetColumn( int col
, wxListItem
&item
)
1678 wxNode
*node
= m_columns
.Nth( col
);
1681 wxListHeaderData
*column
= (wxListHeaderData
*)node
->Data();
1682 column
->GetItem( item
);
1694 int wxListMainWindow::GetColumnWidth( int col
)
1696 wxNode
*node
= m_columns
.Nth( col
);
1699 wxListHeaderData
*column
= (wxListHeaderData
*)node
->Data();
1700 return column
->GetWidth();
1708 int wxListMainWindow::GetColumnCount( void )
1710 return m_columns
.Number();
1713 int wxListMainWindow::GetCountPerPage( void )
1715 return m_visibleLines
;
1718 void wxListMainWindow::SetItem( wxListItem
&item
)
1721 wxNode
*node
= m_lines
.Nth( item
.m_itemId
);
1724 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1725 if (m_mode
& wxLC_REPORT
) item
.m_width
= GetColumnWidth( item
.m_col
)-3;
1726 line
->SetItem( item
.m_col
, item
);
1730 void wxListMainWindow::SetItemState( long item
, long state
, long stateMask
)
1732 // m_dirty = TRUE; no recalcs needed
1734 wxListLineData
*oldCurrent
= m_current
;
1736 if (stateMask
& wxLIST_STATE_FOCUSED
)
1738 wxNode
*node
= m_lines
.Nth( item
);
1741 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1742 UnfocusLine( m_current
);
1744 FocusLine( m_current
);
1745 RefreshLine( m_current
);
1746 RefreshLine( oldCurrent
);
1750 if (stateMask
& wxLIST_STATE_SELECTED
)
1752 bool on
= state
& wxLIST_STATE_SELECTED
;
1753 if (!on
&& (m_mode
& wxLC_SINGLE_SEL
)) return;
1755 wxNode
*node
= m_lines
.Nth( item
);
1758 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1759 if (m_mode
& wxLC_SINGLE_SEL
)
1761 UnfocusLine( m_current
);
1763 FocusLine( m_current
);
1764 oldCurrent
->Hilight( FALSE
);
1765 RefreshLine( m_current
);
1766 RefreshLine( oldCurrent
);
1768 bool on
= state
& wxLIST_STATE_SELECTED
;
1769 if (on
!= line
->IsHilighted())
1771 line
->Hilight( on
);
1772 RefreshLine( line
);
1778 int wxListMainWindow::GetItemState( long item
, long stateMask
)
1780 int ret
= wxLIST_STATE_DONTCARE
;
1781 if (stateMask
& wxLIST_STATE_FOCUSED
)
1783 wxNode
*node
= m_lines
.Nth( item
);
1786 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1787 if (line
== m_current
) ret
|= wxLIST_STATE_FOCUSED
;
1790 if (stateMask
& wxLIST_STATE_SELECTED
)
1792 wxNode
*node
= m_lines
.Nth( item
);
1795 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1796 if (line
->IsHilighted()) ret
|= wxLIST_STATE_FOCUSED
;
1802 void wxListMainWindow::GetItem( wxListItem
&item
)
1804 wxNode
*node
= m_lines
.Nth( item
.m_itemId
);
1807 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1808 line
->GetItem( item
.m_col
, item
);
1819 int wxListMainWindow::GetItemCount( void )
1821 return m_lines
.Number();
1824 void wxListMainWindow::GetItemRect( long index
, wxRectangle
&rect
)
1826 wxNode
*node
= m_lines
.Nth( index
);
1829 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1830 line
->GetRect( rect
);
1841 bool wxListMainWindow::GetItemPosition(long item
, wxPoint
& pos
)
1843 wxNode
*node
= m_lines
.Nth( item
);
1847 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1848 line
->GetRect( rect
);
1860 int wxListMainWindow::GetSelectedItemCount( void )
1863 wxNode
*node
= m_lines
.First();
1866 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1867 if (line
->IsHilighted()) ret
++;
1868 node
= node
->Next();
1873 void wxListMainWindow::SetMode( long mode
)
1880 if (m_mode
& wxLC_REPORT
)
1892 long wxListMainWindow::GetMode( void ) const
1897 void wxListMainWindow::CalculatePositions( void )
1899 if (!m_lines
.First()) return;
1901 wxClientDC
dc( this );
1902 dc
.SetFont( GetFont() );
1904 int iconSpacing
= 0;
1905 if (m_mode
& wxLC_ICON
) iconSpacing
= m_normal_spacing
;
1906 if (m_mode
& wxLC_SMALL_ICON
) iconSpacing
= m_small_spacing
;
1908 // we take the first line (which also can be an icon or
1909 // an a text item in wxLC_ICON and wxLC_LIST modes) to
1910 // measure the size of the line
1914 int lineSpacing
= 0;
1916 wxListLineData
*line
= (wxListLineData
*)m_lines
.First()->Data();
1917 line
->CalculateSize( &dc
, iconSpacing
);
1919 line
->GetSize( dummy
, lineSpacing
);
1922 int clientWidth
= 0;
1923 int clientHeight
= 0;
1925 if (m_mode
& wxLC_REPORT
)
1929 int entireHeight
= m_lines
.Number() * lineSpacing
+ 2;
1930 int scroll_pos
= GetScrollPos( wxVERTICAL
);
1931 SetScrollbars( m_xScroll
, m_yScroll
, 0, (entireHeight
+15) / m_yScroll
, 0, scroll_pos
, TRUE
);
1932 GetClientSize( &clientWidth
, &clientHeight
);
1934 wxNode
* node
= m_lines
.First();
1937 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1938 line
->CalculateSize( &dc
, iconSpacing
);
1939 line
->SetPosition( &dc
, x
, y
, clientWidth
);
1941 for (int i
= 0; i
< GetColumnCount(); i
++)
1943 line
->SetColumnPosition( i
, col_x
);
1944 col_x
+= GetColumnWidth( i
);
1946 y
+= lineSpacing
; // one pixel blank line between items
1947 node
= node
->Next();
1949 m_visibleLines
= clientHeight
/ lineSpacing
;
1953 // at first we try without any scrollbar. if the items don't
1954 // fit into the window, we recalculate after subtracting an
1955 // approximated 15 pt for the horizontal scrollbar
1957 GetSize( &clientWidth
, &clientHeight
);
1958 clientHeight
-= 4; // sunken frame
1960 int entireWidth
= 0;
1962 for (int tries
= 0; tries
< 2; tries
++)
1965 int x
= 5; // painting is done at x-2
1966 int y
= 5; // painting is done at y-2
1968 wxNode
*node
= m_lines
.First();
1971 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1972 line
->CalculateSize( &dc
, iconSpacing
);
1973 line
->SetPosition( &dc
, x
, y
, clientWidth
);
1974 line
->GetSize( lineWidth
, lineHeight
);
1975 if (lineWidth
> maxWidth
) maxWidth
= lineWidth
;
1977 if (y
+lineSpacing
-6 >= clientHeight
) // -6 for earlier "line breaking"
1981 entireWidth
+= maxWidth
+6;
1984 node
= node
->Next();
1985 if (!node
) entireWidth
+= maxWidth
;
1986 if ((tries
== 0) && (entireWidth
> clientWidth
))
1988 clientHeight
-= 15; // scrollbar height
1991 if (!node
) tries
= 1; // everything fits, no second try required
1994 m_visibleLines
= (clientHeight
+6) / (lineSpacing
); // +6 for earlier "line breaking"
1996 int scroll_pos
= GetScrollPos( wxHORIZONTAL
);
1997 SetScrollbars( m_xScroll
, m_yScroll
, (entireWidth
+15) / m_xScroll
, 0, scroll_pos
, 0, TRUE
);
2001 void wxListMainWindow::RealizeChanges( void )
2005 wxNode
*node
= m_lines
.First();
2006 if (node
) m_current
= (wxListLineData
*)node
->Data();
2010 FocusLine( m_current
);
2011 if (m_mode
& wxLC_SINGLE_SEL
) m_current
->Hilight( TRUE
);
2015 long wxListMainWindow::GetNextItem( long item
, int WXUNUSED(geometry
), int state
)
2018 if (item
> 0) ret
= item
;
2019 wxNode
*node
= m_lines
.Nth( ret
);
2022 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2023 if ((state
& wxLIST_STATE_FOCUSED
) && (line
== m_current
)) return ret
;
2024 if ((state
& wxLIST_STATE_SELECTED
) && (line
->IsHilighted())) return ret
;
2025 if (!state
) return ret
;
2027 node
= node
->Next();
2032 void wxListMainWindow::DeleteItem( long index
)
2035 wxNode
*node
= m_lines
.Nth( index
);
2038 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2039 if (m_current
== line
) m_current
= (wxListLineData
*) NULL
;
2041 m_lines
.DeleteNode( node
);
2045 void wxListMainWindow::DeleteColumn( int col
)
2047 wxCHECK_RET( col
< (int)m_columns
.GetCount(),
2048 "attempting to delete inexistent column in wxListView" );
2051 wxNode
*node
= m_columns
.Nth( col
);
2052 if (node
) m_columns
.DeleteNode( node
);
2055 void wxListMainWindow::DeleteAllItems( void )
2058 m_current
= (wxListLineData
*) NULL
;
2059 wxNode
*node
= m_lines
.First();
2062 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2064 node
= node
->Next();
2069 void wxListMainWindow::DeleteEverything( void )
2072 m_current
= (wxListLineData
*) NULL
;
2073 wxNode
*node
= m_lines
.First();
2076 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2078 node
= node
->Next();
2081 m_current
= (wxListLineData
*) NULL
;
2085 void wxListMainWindow::EnsureVisible( long index
)
2087 wxListLineData
*oldCurrent
= m_current
;
2088 m_current
= (wxListLineData
*) NULL
;
2090 wxNode
*node
= m_lines
.Nth( i
);
2091 if (node
) m_current
= (wxListLineData
*)node
->Data();
2092 if (m_current
) MoveToFocus();
2093 m_current
= oldCurrent
;
2096 long wxListMainWindow::FindItem(long start
, const wxString
& str
, bool WXUNUSED(partial
) )
2100 if (pos
< 0) pos
= 0;
2101 wxNode
*node
= m_lines
.Nth( pos
);
2104 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2106 line
->GetText( 0, s
);
2107 if (s
== tmp
) return pos
;
2108 node
= node
->Next();
2114 long wxListMainWindow::FindItem(long start
, long data
)
2117 if (pos
< 0) pos
= 0;
2118 wxNode
*node
= m_lines
.Nth( pos
);
2121 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2123 line
->GetItem( 0, item
);
2124 if (item
.m_data
== data
) return pos
;
2125 node
= node
->Next();
2131 long wxListMainWindow::HitTest( int x
, int y
, int &flags
)
2133 wxNode
*node
= m_lines
.First();
2137 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2138 long ret
= line
->IsHit( x
, y
);
2144 node
= node
->Next();
2150 void wxListMainWindow::InsertItem( wxListItem
&item
)
2154 if (m_mode
& wxLC_REPORT
) mode
= wxLC_REPORT
;
2155 else if (m_mode
& wxLC_LIST
) mode
= wxLC_LIST
;
2156 else if (m_mode
& wxLC_ICON
) mode
= wxLC_ICON
;
2157 else if (m_mode
& wxLC_SMALL_ICON
) mode
= wxLC_ICON
; // no typo
2158 wxListLineData
*line
= new wxListLineData( this, mode
, m_hilightBrush
);
2159 if (m_mode
& wxLC_REPORT
)
2161 line
->InitItems( GetColumnCount() );
2162 item
.m_width
= GetColumnWidth( 0 )-3;
2165 line
->InitItems( 1 );
2166 line
->SetItem( 0, item
);
2167 if ((item
.m_itemId
>= 0) && (item
.m_itemId
< (int)m_lines
.GetCount()))
2169 wxNode
*node
= m_lines
.Nth( item
.m_itemId
);
2170 if (node
) m_lines
.Insert( node
, line
);
2174 m_lines
.Append( line
);
2178 void wxListMainWindow::InsertColumn( long col
, wxListItem
&item
)
2181 if (m_mode
& wxLC_REPORT
)
2183 if (item
.m_width
== wxLIST_AUTOSIZE_USEHEADER
) item
.m_width
= GetTextLength( item
.m_text
);
2184 wxListHeaderData
*column
= new wxListHeaderData( item
);
2185 if ((col
>= 0) && (col
< (int)m_columns
.GetCount()))
2187 wxNode
*node
= m_columns
.Nth( col
);
2189 m_columns
.Insert( node
, column
);
2193 m_columns
.Append( column
);
2198 wxListCtrlCompare list_ctrl_compare_func_2
;
2199 long list_ctrl_compare_data
;
2201 int list_ctrl_compare_func_1( const void *arg1
, const void *arg2
)
2203 wxListLineData
*line1
= *((wxListLineData
**)arg1
);
2204 wxListLineData
*line2
= *((wxListLineData
**)arg2
);
2206 line1
->GetItem( 0, item
);
2207 long data1
= item
.m_data
;
2208 line2
->GetItem( 0, item
);
2209 long data2
= item
.m_data
;
2210 return list_ctrl_compare_func_2( data1
, data2
, list_ctrl_compare_data
);
2213 void wxListMainWindow::SortItems( wxListCtrlCompare fn
, long data
)
2215 list_ctrl_compare_func_2
= fn
;
2216 list_ctrl_compare_data
= data
;
2217 m_lines
.Sort( list_ctrl_compare_func_1
);
2220 // -------------------------------------------------------------------------------------
2222 // -------------------------------------------------------------------------------------
2224 IMPLEMENT_DYNAMIC_CLASS(wxListItem
, wxObject
)
2226 wxListItem::wxListItem(void)
2235 m_format
= wxLIST_FORMAT_CENTRE
;
2240 // -------------------------------------------------------------------------------------
2242 // -------------------------------------------------------------------------------------
2244 IMPLEMENT_DYNAMIC_CLASS(wxListEvent
, wxNotifyEvent
)
2246 wxListEvent::wxListEvent( wxEventType commandType
, int id
):
2247 wxNotifyEvent( commandType
, id
)
2253 m_cancelled
= FALSE
;
2258 // -------------------------------------------------------------------------------------
2260 // -------------------------------------------------------------------------------------
2262 IMPLEMENT_DYNAMIC_CLASS(wxListCtrl
, wxControl
)
2264 BEGIN_EVENT_TABLE(wxListCtrl
,wxControl
)
2265 EVT_SIZE (wxListCtrl::OnSize
)
2266 EVT_IDLE (wxListCtrl::OnIdle
)
2269 wxListCtrl::wxListCtrl(void)
2271 m_imageListNormal
= (wxImageList
*) NULL
;
2272 m_imageListSmall
= (wxImageList
*) NULL
;
2273 m_imageListState
= (wxImageList
*) NULL
;
2274 m_mainWin
= (wxListMainWindow
*) NULL
;
2275 m_headerWin
= (wxListHeaderWindow
*) NULL
;
2278 wxListCtrl::~wxListCtrl(void)
2282 bool wxListCtrl::Create( wxWindow
*parent
, wxWindowID id
,
2283 const wxPoint
&pos
, const wxSize
&size
,
2284 long style
, const wxValidator
&validator
,
2285 const wxString
&name
)
2287 m_imageListNormal
= (wxImageList
*) NULL
;
2288 m_imageListSmall
= (wxImageList
*) NULL
;
2289 m_imageListState
= (wxImageList
*) NULL
;
2290 m_mainWin
= (wxListMainWindow
*) NULL
;
2291 m_headerWin
= (wxListHeaderWindow
*) NULL
;
2295 if ((s
& wxLC_REPORT
== 0) &&
2296 (s
& wxLC_LIST
== 0) &&
2297 (s
& wxLC_ICON
== 0))
2300 bool ret
= wxControl::Create( parent
, id
, pos
, size
, s
, name
);
2302 SetValidator( validator
);
2304 if (s
& wxSUNKEN_BORDER
) s
-= wxSUNKEN_BORDER
;
2306 m_mainWin
= new wxListMainWindow( this, -1, wxPoint(0,0), size
, s
);
2308 if (GetWindowStyleFlag() & wxLC_REPORT
)
2309 m_headerWin
= new wxListHeaderWindow( this, -1, m_mainWin
, wxPoint(0,0), wxSize(size
.x
,23), wxTAB_TRAVERSAL
);
2311 m_headerWin
= (wxListHeaderWindow
*) NULL
;
2316 void wxListCtrl::OnSize( wxSizeEvent
&WXUNUSED(event
) )
2318 // handled in OnIdle
2320 if (m_mainWin
) m_mainWin
->m_dirty
= TRUE
;
2323 void wxListCtrl::SetSingleStyle( long style
, bool add
)
2325 long flag
= GetWindowStyleFlag();
2329 if (style
& wxLC_MASK_TYPE
) flag
= flag
& ~wxLC_MASK_TYPE
;
2330 if (style
& wxLC_MASK_ALIGN
) flag
= flag
& ~wxLC_MASK_ALIGN
;
2331 if (style
& wxLC_MASK_SORT
) flag
= flag
& ~wxLC_MASK_SORT
;
2340 if (flag
& style
) flag
-= style
;
2343 SetWindowStyleFlag( flag
);
2346 void wxListCtrl::SetWindowStyleFlag( long flag
)
2348 m_mainWin
->DeleteEverything();
2352 GetClientSize( &width
, &height
);
2354 m_mainWin
->SetMode( flag
);
2356 if (flag
& wxLC_REPORT
)
2358 if (!(GetWindowStyleFlag() & wxLC_REPORT
))
2360 // m_mainWin->SetSize( 0, 24, width, height-24 );
2363 m_headerWin
= new wxListHeaderWindow( this, -1, m_mainWin
, wxPoint(0,0), wxSize(width
,23), wxTAB_TRAVERSAL
);
2367 // m_headerWin->SetSize( 0, 0, width, 23 );
2368 m_headerWin
->Show( TRUE
);
2374 if (GetWindowStyleFlag() & wxLC_REPORT
)
2376 // m_mainWin->SetSize( 0, 0, width, height );
2377 m_headerWin
->Show( FALSE
);
2381 wxWindow::SetWindowStyleFlag( flag
);
2384 bool wxListCtrl::GetColumn(int col
, wxListItem
&item
) const
2386 m_mainWin
->GetColumn( col
, item
);
2390 bool wxListCtrl::SetColumn( int col
, wxListItem
& item
)
2392 m_mainWin
->SetColumn( col
, item
);
2396 int wxListCtrl::GetColumnWidth( int col
) const
2398 return m_mainWin
->GetColumnWidth( col
);
2401 bool wxListCtrl::SetColumnWidth( int col
, int width
)
2403 m_mainWin
->SetColumnWidth( col
, width
);
2407 int wxListCtrl::GetCountPerPage(void) const
2409 return m_mainWin
->GetCountPerPage(); // different from Windows ?
2413 wxText& wxListCtrl::GetEditControl(void) const
2418 bool wxListCtrl::GetItem( wxListItem
&info
) const
2420 m_mainWin
->GetItem( info
);
2424 bool wxListCtrl::SetItem( wxListItem
&info
)
2426 m_mainWin
->SetItem( info
);
2430 long wxListCtrl::SetItem( long index
, int col
, const wxString
& label
, int imageId
)
2433 info
.m_text
= label
;
2434 info
.m_mask
= wxLIST_MASK_TEXT
;
2435 info
.m_itemId
= index
;
2439 info
.m_image
= imageId
;
2440 info
.m_mask
|= wxLIST_MASK_IMAGE
;
2443 m_mainWin
->SetItem(info
);
2447 int wxListCtrl::GetItemState( long item
, long stateMask
) const
2449 return m_mainWin
->GetItemState( item
, stateMask
);
2452 bool wxListCtrl::SetItemState( long item
, long state
, long stateMask
)
2454 m_mainWin
->SetItemState( item
, state
, stateMask
);
2458 bool wxListCtrl::SetItemImage( long item
, int image
, int WXUNUSED(selImage
) )
2461 info
.m_image
= image
;
2462 info
.m_mask
= wxLIST_MASK_IMAGE
;
2463 info
.m_itemId
= item
;
2464 m_mainWin
->SetItem( info
);
2468 wxString
wxListCtrl::GetItemText( long item
) const
2471 info
.m_itemId
= item
;
2472 m_mainWin
->GetItem( info
);
2476 void wxListCtrl::SetItemText( long item
, const wxString
&str
)
2479 info
.m_mask
= wxLIST_MASK_TEXT
;
2480 info
.m_itemId
= item
;
2482 m_mainWin
->SetItem( info
);
2485 long wxListCtrl::GetItemData( long item
) const
2488 info
.m_itemId
= item
;
2489 m_mainWin
->GetItem( info
);
2493 bool wxListCtrl::SetItemData( long item
, long data
)
2496 info
.m_mask
= wxLIST_MASK_DATA
;
2497 info
.m_itemId
= item
;
2499 m_mainWin
->SetItem( info
);
2503 bool wxListCtrl::GetItemRect( long item
, wxRectangle
&rect
, int WXUNUSED(code
) ) const
2505 m_mainWin
->GetItemRect( item
, rect
);
2509 bool wxListCtrl::GetItemPosition( long item
, wxPoint
& pos
) const
2511 m_mainWin
->GetItemPosition( item
, pos
);
2515 bool wxListCtrl::SetItemPosition( long WXUNUSED(item
), const wxPoint
& WXUNUSED(pos
) )
2520 int wxListCtrl::GetItemCount(void) const
2522 return m_mainWin
->GetItemCount();
2525 int wxListCtrl::GetColumnCount(void) const
2527 return m_mainWin
->GetColumnCount();
2530 void wxListCtrl::SetItemSpacing( int spacing
, bool isSmall
)
2532 m_mainWin
->SetItemSpacing( spacing
, isSmall
);
2535 int wxListCtrl::GetItemSpacing( bool isSmall
) const
2537 return m_mainWin
->GetItemSpacing( isSmall
);
2540 int wxListCtrl::GetSelectedItemCount(void) const
2542 return m_mainWin
->GetSelectedItemCount();
2546 wxColour wxListCtrl::GetTextColour(void) const
2550 void wxListCtrl::SetTextColour(const wxColour& WXUNUSED(col))
2555 long wxListCtrl::GetTopItem(void) const
2560 long wxListCtrl::GetNextItem( long item
, int geom
, int state
) const
2562 return m_mainWin
->GetNextItem( item
, geom
, state
);
2565 wxImageList
*wxListCtrl::GetImageList(int which
) const
2567 if (which
== wxIMAGE_LIST_NORMAL
)
2569 return m_imageListNormal
;
2571 else if (which
== wxIMAGE_LIST_SMALL
)
2573 return m_imageListSmall
;
2575 else if (which
== wxIMAGE_LIST_STATE
)
2577 return m_imageListState
;
2579 return (wxImageList
*) NULL
;
2582 void wxListCtrl::SetImageList( wxImageList
*imageList
, int which
)
2584 m_mainWin
->SetImageList( imageList
, which
);
2587 bool wxListCtrl::Arrange( int WXUNUSED(flag
) )
2592 bool wxListCtrl::DeleteItem( long item
)
2594 m_mainWin
->DeleteItem( item
);
2598 bool wxListCtrl::DeleteAllItems(void)
2600 m_mainWin
->DeleteAllItems();
2604 bool wxListCtrl::DeleteAllColumns()
2606 for ( size_t n
= 0; n
< m_mainWin
->m_columns
.GetCount(); n
++ )
2612 void wxListCtrl::ClearAll()
2614 m_mainWin
->DeleteEverything();
2617 bool wxListCtrl::DeleteColumn( int col
)
2619 m_mainWin
->DeleteColumn( col
);
2624 wxText& wxListCtrl::Edit( long WXUNUSED(item ) )
2629 bool wxListCtrl::EnsureVisible( long item
)
2631 m_mainWin
->EnsureVisible( item
);
2635 long wxListCtrl::FindItem( long start
, const wxString
& str
, bool partial
)
2637 return m_mainWin
->FindItem( start
, str
, partial
);
2640 long wxListCtrl::FindItem( long start
, long data
)
2642 return m_mainWin
->FindItem( start
, data
);
2645 long wxListCtrl::FindItem( long WXUNUSED(start
), const wxPoint
& WXUNUSED(pt
),
2646 int WXUNUSED(direction
))
2651 long wxListCtrl::HitTest( const wxPoint
&point
, int &flags
)
2653 return m_mainWin
->HitTest( (int)point
.x
, (int)point
.y
, flags
);
2656 long wxListCtrl::InsertItem( wxListItem
& info
)
2658 m_mainWin
->InsertItem( info
);
2662 long wxListCtrl::InsertItem( long index
, const wxString
&label
)
2665 info
.m_text
= label
;
2666 info
.m_mask
= wxLIST_MASK_TEXT
;
2667 info
.m_itemId
= index
;
2668 return InsertItem( info
);
2671 long wxListCtrl::InsertItem( long index
, int imageIndex
)
2674 info
.m_mask
= wxLIST_MASK_IMAGE
;
2675 info
.m_image
= imageIndex
;
2676 info
.m_itemId
= index
;
2677 return InsertItem( info
);
2680 long wxListCtrl::InsertItem( long index
, const wxString
&label
, int imageIndex
)
2683 info
.m_text
= label
;
2684 info
.m_image
= imageIndex
;
2685 info
.m_mask
= wxLIST_MASK_TEXT
| wxLIST_MASK_IMAGE
;
2686 info
.m_itemId
= index
;
2687 return InsertItem( info
);
2690 long wxListCtrl::InsertColumn( long col
, wxListItem
&item
)
2692 m_mainWin
->InsertColumn( col
, item
);
2696 long wxListCtrl::InsertColumn( long col
, const wxString
&heading
,
2697 int format
, int width
)
2700 item
.m_mask
= wxLIST_MASK_TEXT
| wxLIST_MASK_FORMAT
;
2701 item
.m_text
= heading
;
2704 item
.m_mask
|= wxLIST_MASK_WIDTH
;
2705 item
.m_width
= width
;
2708 item
.m_format
= format
;
2710 return InsertColumn( col
, item
);
2713 bool wxListCtrl::ScrollList( int WXUNUSED(dx
), int WXUNUSED(dy
) )
2719 // fn is a function which takes 3 long arguments: item1, item2, data.
2720 // item1 is the long data associated with a first item (NOT the index).
2721 // item2 is the long data associated with a second item (NOT the index).
2722 // data is the same value as passed to SortItems.
2723 // The return value is a negative number if the first item should precede the second
2724 // item, a positive number of the second item should precede the first,
2725 // or zero if the two items are equivalent.
2726 // data is arbitrary data to be passed to the sort function.
2728 bool wxListCtrl::SortItems( wxListCtrlCompare fn
, long data
)
2730 m_mainWin
->SortItems( fn
, data
);
2734 void wxListCtrl::OnIdle( wxIdleEvent
&WXUNUSED(event
) )
2736 if (!m_mainWin
->m_dirty
) return;
2740 GetClientSize( &cw
, &ch
);
2747 if (GetWindowStyleFlag() & wxLC_REPORT
)
2749 m_headerWin
->GetPosition( &x
, &y
);
2750 m_headerWin
->GetSize( &w
, &h
);
2751 if ((x
!= 0) || (y
!= 0) || (w
!= cw
) || (h
!= 23))
2752 m_headerWin
->SetSize( 0, 0, cw
, 23 );
2754 m_mainWin
->GetPosition( &x
, &y
);
2755 m_mainWin
->GetSize( &w
, &h
);
2756 if ((x
!= 0) || (y
!= 24) || (w
!= cw
) || (h
!= ch
-24))
2757 m_mainWin
->SetSize( 0, 24, cw
, ch
-24 );
2761 m_mainWin
->GetPosition( &x
, &y
);
2762 m_mainWin
->GetSize( &w
, &h
);
2763 if ((x
!= 0) || (y
!= 24) || (w
!= cw
) || (h
!= ch
))
2764 m_mainWin
->SetSize( 0, 0, cw
, ch
);
2767 m_mainWin
->CalculatePositions();
2768 m_mainWin
->RealizeChanges();
2769 m_mainWin
->m_dirty
= FALSE
;
2770 m_mainWin
->Refresh();
2773 void wxListCtrl::SetBackgroundColour( const wxColour
&colour
)
2777 m_mainWin
->SetBackgroundColour( colour
);
2778 m_mainWin
->m_dirty
= TRUE
;
2781 m_headerWin
->SetBackgroundColour( colour
);
2784 void wxListCtrl::SetForegroundColour( const wxColour
&colour
)
2788 m_mainWin
->SetForegroundColour( colour
);
2789 m_mainWin
->m_dirty
= TRUE
;
2792 m_headerWin
->SetForegroundColour( colour
);
2795 void wxListCtrl::SetFont( const wxFont
&font
)
2799 m_mainWin
->SetFont( font
);
2800 m_mainWin
->m_dirty
= TRUE
;
2803 m_headerWin
->SetFont( font
);