1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "listctrl.h"
14 #include "wx/dcscreen.h"
16 #include "wx/listctrl.h"
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
22 IMPLEMENT_DYNAMIC_CLASS(wxListItemData
,wxObject
);
24 wxListItemData::wxListItemData(void)
35 wxListItemData::wxListItemData( const wxListItem
&info
)
39 m_colour
= info
.m_colour
;
43 void wxListItemData::SetItem( const wxListItem
&info
)
45 if (info
.m_mask
& wxLIST_MASK_TEXT
) m_text
= info
.m_text
;
46 if (info
.m_mask
& wxLIST_MASK_IMAGE
) m_image
= info
.m_image
;
47 if (info
.m_mask
& wxLIST_MASK_DATA
) m_data
= info
.m_data
;
48 m_colour
= info
.m_colour
;
51 m_width
= info
.m_width
;
55 void wxListItemData::SetText( const wxString
&s
)
60 void wxListItemData::SetImage( int image
)
65 void wxListItemData::SetData( long data
)
70 void wxListItemData::SetPosition( int x
, int y
)
76 void wxListItemData::SetSize( int const width
, int height
)
78 if (width
!= -1) m_width
= width
;
79 if (height
!= -1) m_height
= height
;
82 void wxListItemData::SetColour( wxColour
*col
)
87 bool wxListItemData::HasImage(void) const
89 return (m_image
>= 0);
92 bool wxListItemData::HasText(void) const
94 return (!m_text
.IsNull());
97 bool wxListItemData::IsHit( int x
, int y
) const
99 return ((x
>= m_xpos
) && (x
<= m_xpos
+m_width
) && (y
>= m_ypos
) && (y
<= m_ypos
+m_height
));
102 void wxListItemData::GetText( wxString
&s
)
107 int wxListItemData::GetX( void ) const
112 int wxListItemData::GetY( void ) const
117 int wxListItemData::GetWidth(void) const
122 int wxListItemData::GetHeight(void) const
127 int wxListItemData::GetImage(void) const
132 void wxListItemData::GetItem( wxListItem
&info
)
134 info
.m_text
= m_text
;
135 info
.m_image
= m_image
;
136 info
.m_data
= m_data
;
139 wxColour
*wxListItemData::GetColour(void)
144 //-----------------------------------------------------------------------------
146 //-----------------------------------------------------------------------------
148 IMPLEMENT_DYNAMIC_CLASS(wxListHeaderData
,wxObject
);
150 wxListHeaderData::wxListHeaderData(void)
161 wxListHeaderData::wxListHeaderData( const wxListItem
&item
)
169 void wxListHeaderData::SetItem( const wxListItem
&item
)
171 m_mask
= item
.m_mask
;
172 m_text
= item
.m_text
;
173 m_image
= item
.m_image
;
174 m_format
= item
.m_format
;
175 m_width
= item
.m_width
;
176 if (m_width
< 0) m_width
= 80;
177 if (m_width
< 6) m_width
= 6;
180 void wxListHeaderData::SetPosition( int x
, int y
)
186 void wxListHeaderData::SetHeight( int h
)
191 void wxListHeaderData::SetWidth( int w
)
194 if (m_width
< 0) m_width
= 80;
195 if (m_width
< 6) m_width
= 6;
198 void wxListHeaderData::SetFormat( int format
)
203 bool wxListHeaderData::HasImage(void) const
205 return (m_image
!= 0);
208 bool wxListHeaderData::HasText(void) const
210 return (m_text
.Length() > 0);
213 bool wxListHeaderData::IsHit( int x
, int y
) const
215 return ((x
>= m_xpos
) && (x
<= m_xpos
+m_width
) && (y
>= m_ypos
) && (y
<= m_ypos
+m_height
));
218 void wxListHeaderData::GetItem( wxListItem
&item
)
220 item
.m_mask
= m_mask
;
221 item
.m_text
= m_text
;
222 item
.m_image
= m_image
;
223 item
.m_format
= m_format
;
224 item
.m_width
= m_width
;
227 void wxListHeaderData::GetText( wxString
&s
)
232 int wxListHeaderData::GetImage(void) const
237 int wxListHeaderData::GetWidth(void) const
242 int wxListHeaderData::GetFormat(void) const
247 //-----------------------------------------------------------------------------
249 //-----------------------------------------------------------------------------
251 IMPLEMENT_DYNAMIC_CLASS(wxListLineData
,wxObject
);
253 wxListLineData::wxListLineData( wxListMainWindow
*owner
, int mode
, wxBrush
*hilightBrush
)
258 m_hilightBrush
= hilightBrush
;
259 m_items
.DeleteContents( TRUE
);
263 void wxListLineData::CalculateSize( wxPaintDC
*dc
, int spacing
)
270 m_bound_all
.width
= m_spacing
;
271 m_bound_all
.height
= m_spacing
+13;
272 wxNode
*node
= m_items
.First();
275 wxListItemData
*item
= (wxListItemData
*)node
->Data();
279 dc
->GetTextExtent( s
, &lw
, &lh
);
280 if (lw
> m_spacing
) m_bound_all
.width
= lw
;
286 wxNode
*node
= m_items
.First();
289 wxListItemData
*item
= (wxListItemData
*)node
->Data();
293 dc
->GetTextExtent( s
, &lw
, &lh
);
294 m_bound_all
.width
= lw
;
295 m_bound_all
.height
= lh
;
301 m_bound_all
.width
= 0;
302 m_bound_all
.height
= 0;
303 wxNode
*node
= m_items
.First();
306 wxListItemData
*item
= (wxListItemData
*)node
->Data();
309 if (s
.IsNull()) s
= "H";
311 dc
->GetTextExtent( s
, &lw
, &lh
);
312 item
->SetSize( item
->GetWidth(), lh
);
313 m_bound_all
.width
+= lw
;
314 m_bound_all
.height
= lh
;
322 void wxListLineData::SetPosition( wxPaintDC
*dc
, int x
, int y
, int window_width
)
330 AssignRect( m_bound_icon
, 0, 0, 0, 0 );
331 AssignRect( m_bound_label
, 0, 0, 0, 0 );
332 AssignRect( m_bound_hilight
, m_bound_all
);
333 wxNode
*node
= m_items
.First();
336 wxListItemData
*item
= (wxListItemData
*)node
->Data();
337 if (item
->HasImage())
339 wxListItemData
*item
= (wxListItemData
*)node
->Data();
342 m_owner
->GetImageSize( item
->GetImage(), w
, h
);
343 m_bound_icon
.x
= m_bound_all
.x
+ (m_spacing
/2) - (w
/2);
344 m_bound_icon
.y
= m_bound_all
.y
+ m_spacing
- h
- 5;
345 m_bound_icon
.width
= w
;
346 m_bound_icon
.height
= h
;
347 if (!item
->HasText())
349 AssignRect( m_bound_hilight
, m_bound_icon
);
350 m_bound_hilight
.x
-= 5;
351 m_bound_hilight
.y
-= 5;
352 m_bound_hilight
.width
+= 9;
353 m_bound_hilight
.height
+= 9;
361 dc
->GetTextExtent( s
, &lw
, &lh
);
362 if (m_bound_all
.width
> m_spacing
)
363 m_bound_label
.x
= m_bound_all
.x
;
365 m_bound_label
.x
= m_bound_all
.x
+ (m_spacing
/2) - lw
/2;
366 m_bound_label
.y
= m_bound_all
.y
+ m_bound_all
.height
- lh
;
367 m_bound_label
.width
= lw
;
368 m_bound_label
.height
= lh
;
369 AssignRect( m_bound_hilight
, m_bound_label
);
370 m_bound_hilight
.x
-= 2;
371 m_bound_hilight
.y
-= 2;
372 m_bound_hilight
.width
+= 4;
373 m_bound_hilight
.height
+= 4;
380 AssignRect( m_bound_label
, m_bound_all
);
383 m_bound_all
.width
+= 4;
384 m_bound_all
.height
+= 3;
385 AssignRect( m_bound_hilight
, m_bound_all
);
386 AssignRect( m_bound_icon
, 0, 0, 0, 0 );
392 dc
->GetTextExtent( "H", &lw
, &lh
);
395 m_bound_all
.height
= lh
+3;
396 m_bound_all
.width
= window_width
;
397 AssignRect( m_bound_hilight
, m_bound_all
);
398 AssignRect( m_bound_label
, 0, 0, 0 ,0 );
399 AssignRect( m_bound_icon
, 0, 0, 0, 0 );
405 void wxListLineData::SetColumnPosition( int index
, int x
)
408 wxNode
*node
= m_items
.Nth( i
);
411 wxListItemData
*item
= (wxListItemData
*)node
->Data();
412 item
->SetPosition( x
, m_bound_all
.y
+1 );
416 void wxListLineData::GetSize( int &width
, int &height
)
418 width
= m_bound_all
.width
;
419 height
= m_bound_all
.height
;
422 void wxListLineData::GetExtent( int &x
, int &y
, int &width
, int &height
)
426 width
= m_bound_all
.width
;
427 height
= m_bound_all
.height
;
430 void wxListLineData::GetLabelExtent( int &x
, int &y
, int &width
, int &height
)
434 width
= m_bound_label
.width
;
435 height
= m_bound_label
.height
;
438 void wxListLineData::GetRect( wxRectangle
&rect
)
440 AssignRect( rect
, m_bound_all
);
443 long wxListLineData::IsHit( int x
, int y
)
445 wxNode
*node
= m_items
.First();
448 wxListItemData
*item
= (wxListItemData
*)node
->Data();
449 if (item
->HasImage() && IsInRect( x
, y
, m_bound_icon
)) return wxLIST_HITTEST_ONITEMICON
;
450 if (item
->HasText() && IsInRect( x
, y
, m_bound_label
)) return wxLIST_HITTEST_ONITEMLABEL
;
451 // if (!(item->HasImage() || item->HasText())) return 0;
453 // if there is no icon or text = empty
454 if (IsInRect( x
, y
, m_bound_all
)) return wxLIST_HITTEST_ONITEMICON
;
458 void wxListLineData::InitItems( int num
)
460 for (int i
= 0; i
< num
; i
++) m_items
.Append( new wxListItemData() );
463 void wxListLineData::SetItem( int index
, const wxListItem
&info
)
465 wxNode
*node
= m_items
.Nth( index
);
468 wxListItemData
*item
= (wxListItemData
*)node
->Data();
469 item
->SetItem( info
);
473 void wxListLineData::GetItem( int const index
, wxListItem
&info
)
476 wxNode
*node
= m_items
.Nth( i
);
479 wxListItemData
*item
= (wxListItemData
*)node
->Data();
480 item
->GetItem( info
);
484 void wxListLineData::GetText( int index
, wxString
&s
)
487 wxNode
*node
= m_items
.Nth( i
);
491 wxListItemData
*item
= (wxListItemData
*)node
->Data();
496 void wxListLineData::SetText( int index
, const wxString s
)
499 wxNode
*node
= m_items
.Nth( i
);
502 wxListItemData
*item
= (wxListItemData
*)node
->Data();
507 int wxListLineData::GetImage( int index
)
510 wxNode
*node
= m_items
.Nth( i
);
513 wxListItemData
*item
= (wxListItemData
*)node
->Data();
514 return item
->GetImage();
519 void wxListLineData::DoDraw( wxPaintDC
*dc
, bool hilight
, bool paintBG
)
521 long dev_x
= dc
->LogicalToDeviceX( m_bound_all
.x
-2 );
522 long dev_y
= dc
->LogicalToDeviceY( m_bound_all
.y
-2 );
523 long dev_w
= dc
->LogicalToDeviceXRel( m_bound_all
.width
+4 );
524 long dev_h
= dc
->LogicalToDeviceYRel( m_bound_all
.height
+4 );
526 if (!m_owner
->IsExposed( dev_x
, dev_y
, dev_w
, dev_h
))
535 dc
->SetBrush( * m_hilightBrush
);
536 dc
->SetPen( * wxTRANSPARENT_PEN
);
540 dc
->SetBrush( * wxWHITE_BRUSH
);
541 dc
->SetPen( * wxTRANSPARENT_PEN
);
543 dc
->DrawRectangle( m_bound_hilight
.x
, m_bound_hilight
.y
,
544 m_bound_hilight
.width
, m_bound_hilight
.height
);
547 if (m_mode
== wxLC_REPORT
)
550 wxNode
*node
= m_items
.First();
553 wxListItemData
*item
= (wxListItemData
*)node
->Data();
554 dc
->SetClippingRegion( item
->GetX(), item
->GetY(), item
->GetWidth()-3, item
->GetHeight() );
555 int x
= item
->GetX();
556 if (item
->HasImage())
559 m_owner
->DrawImage( item
->GetImage(), dc
, x
, item
->GetY() );
560 m_owner
->GetImageSize( item
->GetImage(), x
, y
);
561 x
+= item
->GetX() + 5;
567 dc
->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT
) );
569 dc
->SetTextForeground( *item
->GetColour() );
570 dc
->DrawText( s
, x
, item
->GetY() );
572 dc
->DestroyClippingRegion();
578 wxNode
*node
= m_items
.First();
581 wxListItemData
*item
= (wxListItemData
*)node
->Data();
582 if (item
->HasImage())
584 m_owner
->DrawImage( item
->GetImage(), dc
, m_bound_icon
.x
, m_bound_icon
.y
);
591 dc
->SetTextForeground( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_HIGHLIGHTTEXT
) );
593 dc
->SetTextForeground( * item
->GetColour() );
594 dc
->DrawText( s
, m_bound_label
.x
, m_bound_label
.y
);
600 void wxListLineData::Hilight( bool on
)
602 if (on
== m_hilighted
) return;
604 m_owner
->SelectLine( this );
606 m_owner
->DeselectLine( this );
610 void wxListLineData::ReverseHilight( void )
612 m_hilighted
= !m_hilighted
;
614 m_owner
->SelectLine( this );
616 m_owner
->DeselectLine( this );
619 void wxListLineData::DrawRubberBand( wxPaintDC
*dc
, bool on
)
623 dc
->SetPen( * wxBLACK_PEN
);
624 dc
->SetBrush( * wxTRANSPARENT_BRUSH
);
625 dc
->DrawRectangle( m_bound_hilight
.x
, m_bound_hilight
.y
,
626 m_bound_hilight
.width
, m_bound_hilight
.height
);
630 void wxListLineData::Draw( wxPaintDC
*dc
)
632 DoDraw( dc
, m_hilighted
, m_hilighted
);
635 bool wxListLineData::IsInRect( int x
, int y
, const wxRectangle
&rect
)
637 return ((x
>= rect
.x
) && (x
<= rect
.x
+rect
.width
) &&
638 (y
>= rect
.y
) && (y
<= rect
.y
+rect
.height
));
641 bool wxListLineData::IsHilighted( void )
646 void wxListLineData::AssignRect( wxRectangle
&dest
, int x
, int y
, int width
, int height
)
651 dest
.height
= height
;
654 void wxListLineData::AssignRect( wxRectangle
&dest
, const wxRectangle
&source
)
658 dest
.width
= source
.width
;
659 dest
.height
= source
.height
;
662 //-----------------------------------------------------------------------------
663 // wxListHeaderWindow
664 //-----------------------------------------------------------------------------
666 IMPLEMENT_DYNAMIC_CLASS(wxListHeaderWindow
,wxWindow
);
668 BEGIN_EVENT_TABLE(wxListHeaderWindow
,wxWindow
)
669 EVT_PAINT (wxListHeaderWindow::OnPaint
)
670 EVT_MOUSE_EVENTS (wxListHeaderWindow::OnMouse
)
671 EVT_SET_FOCUS (wxListHeaderWindow::OnSetFocus
)
674 wxListHeaderWindow::wxListHeaderWindow( void )
676 m_owner
= (wxListMainWindow
*) NULL
;
677 m_currentCursor
= (wxCursor
*) NULL
;
678 m_resizeCursor
= (wxCursor
*) NULL
;
682 wxListHeaderWindow::wxListHeaderWindow( wxWindow
*win
, wxWindowID id
, wxListMainWindow
*owner
,
683 const wxPoint
&pos
, const wxSize
&size
,
684 long style
, const wxString
&name
) :
685 wxWindow( win
, id
, pos
, size
, style
, name
)
688 // m_currentCursor = wxSTANDARD_CURSOR;
689 m_currentCursor
= (wxCursor
*) NULL
;
690 m_resizeCursor
= new wxCursor( wxCURSOR_SIZEWE
);
694 wxListHeaderWindow::~wxListHeaderWindow( void )
696 delete m_resizeCursor
;
699 void wxListHeaderWindow::DoDrawRect( wxPaintDC
*dc
, int x
, int y
, int w
, int h
)
701 const int m_corner
= 1;
703 dc
->SetBrush( *wxTRANSPARENT_BRUSH
);
705 dc
->SetPen( *wxBLACK_PEN
);
706 dc
->DrawLine( x
+w
-m_corner
+1, y
, x
+w
, y
+h
); // right (outer)
707 dc
->DrawRectangle( x
, y
+h
, w
, 1 ); // bottom (outer)
709 wxPen
pen( wxSystemSettings::GetSystemColour( wxSYS_COLOUR_BTNSHADOW
), 1, wxSOLID
);
712 dc
->DrawLine( x
+w
-m_corner
, y
, x
+w
-1, y
+h
); // right (inner)
713 dc
->DrawRectangle( x
+1, y
+h
-1, w
-2, 1 ); // bottom (inner)
715 dc
->SetPen( *wxWHITE_PEN
);
716 dc
->DrawRectangle( x
, y
, w
-m_corner
+1, 1 ); // top (outer)
717 dc
->DrawRectangle( x
, y
, 1, h
); // left (outer)
718 dc
->DrawLine( x
, y
+h
-1, x
+1, y
+h
-1 );
719 dc
->DrawLine( x
+w
-1, y
, x
+w
-1, y
+1 );
722 void wxListHeaderWindow::OnPaint( wxPaintEvent
&WXUNUSED(event
) )
724 wxPaintDC
dc( this );
729 dc
.SetFont( GetFont() );
735 GetClientSize( &w
, &h
);
737 dc
.SetTextForeground( *wxBLACK
);
738 if (m_foregroundColour
.Ok()) dc
.SetTextForeground( m_foregroundColour
);
742 int numColumns
= m_owner
->GetColumnCount();
744 for (int i
= 0; i
< numColumns
; i
++)
746 m_owner
->GetColumn( i
, item
);
747 int cw
= item
.m_width
-2;
748 if ((i
+1 == numColumns
) || (x
+item
.m_width
> w
-5)) cw
= w
-x
-1;
749 dc
.SetPen( *wxWHITE_PEN
);
751 DoDrawRect( &dc
, x
, y
, cw
, h
-2 );
752 dc
.SetClippingRegion( x
, y
, cw
-5, h
-4 );
753 dc
.DrawText( item
.m_text
, x
+4, y
+3 );
754 dc
.DestroyClippingRegion();
761 void wxListHeaderWindow::DrawCurrent()
765 int x2
= m_currentX
-1;
768 m_owner
->GetClientSize( &dummy
, &y2
);
769 ClientToScreen( &x1
, &y1
);
770 m_owner
->ClientToScreen( &x2
, &y2
);
773 dc
.SetLogicalFunction( wxXOR
);
774 dc
.SetPen( wxPen( *wxBLACK
, 2, wxSOLID
) );
775 dc
.SetBrush( *wxTRANSPARENT_BRUSH
);
777 dc
.DrawLine( x1
, y1
, x2
, y2
);
779 dc
.SetLogicalFunction( wxCOPY
);
781 dc
.SetPen( wxNullPen
);
782 dc
.SetBrush( wxNullBrush
);
785 void wxListHeaderWindow::OnMouse( wxMouseEvent
&event
)
787 int x
= event
.GetX();
788 int y
= event
.GetY();
792 if (event
.ButtonUp())
796 m_owner
->SetColumnWidth( m_column
, m_currentX
-m_minX
);
802 GetClientSize( &size_x
, & dummy
);
806 m_currentX
= m_minX
+7;
807 if (m_currentX
> size_x
-7) m_currentX
= size_x
-7;
814 bool hit_border
= FALSE
;
816 for (int j
= 0; j
< m_owner
->GetColumnCount(); j
++)
818 xpos
+= m_owner
->GetColumnWidth( j
);
819 if ((abs(x
-xpos
) < 3) && (y
< 22))
828 if (event
.LeftDown() && hit_border
)
841 if (m_currentCursor
== wxSTANDARD_CURSOR
) SetCursor( * m_resizeCursor
);
842 m_currentCursor
= m_resizeCursor
;
846 if (m_currentCursor
!= wxSTANDARD_CURSOR
) SetCursor( * wxSTANDARD_CURSOR
);
847 m_currentCursor
= wxSTANDARD_CURSOR
;
852 void wxListHeaderWindow::OnSetFocus( wxFocusEvent
&WXUNUSED(event
) )
857 //-----------------------------------------------------------------------------
858 // wxListRenameTimer (internal)
859 //-----------------------------------------------------------------------------
861 wxListRenameTimer::wxListRenameTimer( wxListMainWindow
*owner
)
866 void wxListRenameTimer::Notify()
868 m_owner
->OnRenameTimer();
871 //-----------------------------------------------------------------------------
872 // wxListTextCtrl (internal)
873 //-----------------------------------------------------------------------------
875 IMPLEMENT_DYNAMIC_CLASS(wxListTextCtrl
,wxTextCtrl
);
877 BEGIN_EVENT_TABLE(wxListTextCtrl
,wxTextCtrl
)
878 EVT_CHAR (wxListTextCtrl::OnChar
)
879 EVT_KILL_FOCUS (wxListTextCtrl::OnKillFocus
)
882 wxListTextCtrl::wxListTextCtrl( wxWindow
*parent
, const wxWindowID id
,
883 bool *accept
, wxString
*res
, wxListMainWindow
*owner
,
884 const wxString
&value
, const wxPoint
&pos
, const wxSize
&size
,
885 int style
, const wxValidator
& validator
, const wxString
&name
) :
886 wxTextCtrl( parent
, id
, value
, pos
, size
, style
, validator
, name
)
893 void wxListTextCtrl::OnChar( wxKeyEvent
&event
)
895 if (event
.m_keyCode
== WXK_RETURN
)
898 (*m_res
) = GetValue();
899 m_owner
->OnRenameAccept();
904 if (event
.m_keyCode
== WXK_ESCAPE
)
915 void wxListTextCtrl::OnKillFocus( wxFocusEvent
&WXUNUSED(event
) )
924 //-----------------------------------------------------------------------------
926 //-----------------------------------------------------------------------------
928 IMPLEMENT_DYNAMIC_CLASS(wxListMainWindow
,wxScrolledWindow
);
930 BEGIN_EVENT_TABLE(wxListMainWindow
,wxScrolledWindow
)
931 EVT_PAINT (wxListMainWindow::OnPaint
)
932 EVT_SIZE (wxListMainWindow::OnSize
)
933 EVT_MOUSE_EVENTS (wxListMainWindow::OnMouse
)
934 EVT_CHAR (wxListMainWindow::OnChar
)
935 EVT_SET_FOCUS (wxListMainWindow::OnSetFocus
)
936 EVT_KILL_FOCUS (wxListMainWindow::OnKillFocus
)
939 wxListMainWindow::wxListMainWindow( void )
942 m_lines
.DeleteContents( TRUE
);
943 m_columns
.DeleteContents( TRUE
);
944 m_current
= (wxListLineData
*) NULL
;
946 m_hilightBrush
= (wxBrush
*) NULL
;
950 m_small_image_list
= (wxImageList
*) NULL
;
951 m_normal_image_list
= (wxImageList
*) NULL
;
952 m_small_spacing
= 30;
953 m_normal_spacing
= 40;
956 m_lastOnSame
= FALSE
;
957 m_renameTimer
= new wxListRenameTimer( this );
962 wxListMainWindow::wxListMainWindow( wxWindow
*parent
, wxWindowID id
,
963 const wxPoint
&pos
, const wxSize
&size
,
964 long style
, const wxString
&name
) :
965 wxScrolledWindow( parent
, id
, pos
, size
, style
|wxHSCROLL
|wxVSCROLL
, name
)
968 m_lines
.DeleteContents( TRUE
);
969 m_columns
.DeleteContents( TRUE
);
970 m_current
= (wxListLineData
*) NULL
;
973 m_hilightBrush
= new wxBrush( wxSystemSettings::GetSystemColour(wxSYS_COLOUR_HIGHLIGHT
), wxSOLID
);
974 m_small_image_list
= (wxImageList
*) NULL
;
975 m_normal_image_list
= (wxImageList
*) NULL
;
976 m_small_spacing
= 30;
977 m_normal_spacing
= 40;
984 if (m_mode
& wxLC_REPORT
)
994 SetScrollbars( m_xScroll
, m_yScroll
, 0, 0, 0, 0 );
997 m_lastOnSame
= FALSE
;
998 m_renameTimer
= new wxListRenameTimer( this );
999 m_renameAccept
= FALSE
;
1001 SetBackgroundColour( *wxWHITE
);
1004 wxListMainWindow::~wxListMainWindow( void )
1006 if (m_hilightBrush
) delete m_hilightBrush
;
1008 delete m_renameTimer
;
1011 void wxListMainWindow::RefreshLine( wxListLineData
*line
)
1019 wxClientDC
dc(this);
1021 line
->GetExtent( x
, y
, w
, h
);
1023 dc
.LogicalToDeviceX(x
-3),
1024 dc
.LogicalToDeviceY(y
-3),
1025 dc
.LogicalToDeviceXRel(w
+6),
1026 dc
.LogicalToDeviceXRel(h
+6) );
1027 Refresh( TRUE
, &rect
);
1031 void wxListMainWindow::OnPaint( wxPaintEvent
&WXUNUSED(event
) )
1033 if (m_dirty
) return;
1035 if (m_lines
.GetCount() == 0) return;
1037 wxPaintDC
dc( this );
1042 dc
.SetFont( GetFont() );
1044 if (m_mode
& wxLC_REPORT
)
1046 int lineSpacing
= 0;
1047 wxListLineData
*line
= (wxListLineData
*)m_lines
.First()->Data();
1049 line
->GetSize( dummy
, lineSpacing
);
1052 int y_s
= m_yScroll
*GetScrollPos( wxVERTICAL
);
1054 wxNode
*node
= m_lines
.Nth( y_s
/ lineSpacing
);
1055 for (int i
= 0; i
< m_visibleLines
+2; i
++)
1059 line
= (wxListLineData
*)node
->Data();
1061 node
= node
->Next();
1066 wxNode
*node
= m_lines
.First();
1069 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1071 node
= node
->Next();
1075 if (m_current
) m_current
->DrawRubberBand( &dc
, m_hasFocus
);
1080 void wxListMainWindow::HilightAll( bool on
)
1082 wxNode
*node
= m_lines
.First();
1085 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1086 if (line
->IsHilighted() != on
)
1088 line
->Hilight( on
);
1089 RefreshLine( line
);
1091 node
= node
->Next();
1095 void wxListMainWindow::SendNotify( wxListLineData
*line
, wxEventType command
)
1097 wxListEvent
le( command
, GetParent()->GetId() );
1098 le
.SetEventObject( GetParent() );
1099 le
.m_itemIndex
= GetIndexOfLine( line
);
1100 line
->GetItem( 0, le
.m_item
);
1101 GetParent()->GetEventHandler()->ProcessEvent( le
);
1104 void wxListMainWindow::FocusLine( wxListLineData
*WXUNUSED(line
) )
1106 // SendNotify( line, wxEVT_COMMAND_LIST_ITEM_FOCUSSED );
1109 void wxListMainWindow::UnfocusLine( wxListLineData
*WXUNUSED(line
) )
1111 // SendNotify( line, wxEVT_COMMAND_LIST_ITEM_UNFOCUSSED );
1114 void wxListMainWindow::SelectLine( wxListLineData
*line
)
1116 SendNotify( line
, wxEVT_COMMAND_LIST_ITEM_SELECTED
);
1119 void wxListMainWindow::DeselectLine( wxListLineData
*line
)
1121 SendNotify( line
, wxEVT_COMMAND_LIST_ITEM_DESELECTED
);
1124 void wxListMainWindow::DeleteLine( wxListLineData
*line
)
1126 SendNotify( line
, wxEVT_COMMAND_LIST_DELETE_ITEM
);
1129 void wxListMainWindow::StartLabelEdit( wxListLineData
*line
)
1131 SendNotify( line
, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT
);
1134 void wxListMainWindow::RenameLine( wxListLineData
*line
, const wxString
&newName
)
1136 wxListEvent
le( wxEVT_COMMAND_LIST_END_LABEL_EDIT
, GetParent()->GetId() );
1137 le
.SetEventObject( GetParent() );
1138 le
.m_itemIndex
= GetIndexOfLine( line
);
1139 line
->GetItem( 0, le
.m_item
);
1140 le
.m_item
.m_text
= newName
;
1141 GetParent()->GetEventHandler()->ProcessEvent( le
);
1144 void wxListMainWindow::OnRenameTimer()
1146 StartLabelEdit( m_current
);
1148 m_current
->GetText( 0, s
);
1153 m_current
->GetLabelExtent( x
, y
, w
, h
);
1155 wxClientDC
dc(this);
1157 x
= dc
.LogicalToDeviceX( x
);
1158 y
= dc
.LogicalToDeviceY( y
);
1160 wxListTextCtrl
*text
= new wxListTextCtrl(
1161 this, -1, &m_renameAccept
, &m_renameRes
, this, s
, wxPoint(x
-4,y
-4), wxSize(w
+11,h
+8) );
1165 void wxListMainWindow::OnRenameAccept()
1167 RenameLine( m_current
, m_renameRes
);
1170 void wxListMainWindow::OnMouse( wxMouseEvent
&event
)
1172 if (GetParent()->GetEventHandler()->ProcessEvent( event
)) return;
1174 if (!m_current
) return;
1175 if (m_dirty
) return;
1177 wxClientDC
dc(this);
1179 long x
= dc
.DeviceToLogicalX( (long)event
.GetX() );
1180 long y
= dc
.DeviceToLogicalY( (long)event
.GetY() );
1182 // Did we actually hit an item ?
1184 wxNode
*node
= m_lines
.First();
1185 wxListLineData
*line
= (wxListLineData
*) NULL
;
1188 line
= (wxListLineData
*)node
->Data();
1189 hitResult
= line
->IsHit( x
, y
);
1190 if (hitResult
) break;
1191 line
= (wxListLineData
*) NULL
;
1192 node
= node
->Next();
1195 if (!event
.Dragging())
1200 if (event
.Dragging() && (m_dragCount
> 3))
1204 wxListEvent
le( wxEVT_COMMAND_LIST_BEGIN_DRAG
, GetParent()->GetId() );
1205 le
.SetEventObject( GetParent() );
1206 le
.m_pointDrag
.x
= x
;
1207 le
.m_pointDrag
.y
= y
;
1208 GetParent()->GetEventHandler()->ProcessEvent( le
);
1215 if (event
.ButtonDClick())
1218 m_lastOnSame
= FALSE
;
1219 m_renameTimer
->Stop();
1221 SendNotify( line
, wxEVT_COMMAND_LIST_ITEM_ACTIVATED
);
1226 if (event
.LeftUp() && m_lastOnSame
)
1229 if ((line
== m_current
) &&
1230 (hitResult
== wxLIST_HITTEST_ONITEMLABEL
) &&
1231 (m_mode
& wxLC_EDIT_LABELS
) )
1233 m_renameTimer
->Start( 100, TRUE
);
1235 m_lastOnSame
= FALSE
;
1239 if (event
.RightDown())
1241 SendNotify( line
, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK
);
1245 if (event
.MiddleDown())
1247 SendNotify( line
, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK
);
1251 if (event
.LeftDown())
1254 wxListLineData
*oldCurrent
= m_current
;
1255 if (m_mode
& wxLC_SINGLE_SEL
)
1258 HilightAll( FALSE
);
1259 m_current
->ReverseHilight();
1260 RefreshLine( m_current
);
1264 if (event
.ShiftDown())
1267 m_current
->ReverseHilight();
1268 RefreshLine( m_current
);
1270 else if (event
.ControlDown())
1274 int numOfCurrent
= -1;
1275 node
= m_lines
.First();
1278 wxListLineData
*test_line
= (wxListLineData
*)node
->Data();
1280 if (test_line
== oldCurrent
) break;
1281 node
= node
->Next();
1285 node
= m_lines
.First();
1288 wxListLineData
*test_line
= (wxListLineData
*)node
->Data();
1290 if (test_line
== line
) break;
1291 node
= node
->Next();
1294 if (numOfLine
< numOfCurrent
)
1297 numOfLine
= numOfCurrent
;
1301 wxNode
*node
= m_lines
.Nth( numOfCurrent
);
1302 for (int i
= 0; i
<= numOfLine
-numOfCurrent
; i
++)
1304 wxListLineData
*test_line
= (wxListLineData
*)node
->Data();
1305 test_line
->Hilight(TRUE
);
1306 RefreshLine( test_line
);
1307 node
= node
->Next();
1313 HilightAll( FALSE
);
1314 m_current
->ReverseHilight();
1315 RefreshLine( m_current
);
1318 if (m_current
!= oldCurrent
)
1320 RefreshLine( oldCurrent
);
1321 UnfocusLine( oldCurrent
);
1322 FocusLine( m_current
);
1324 m_lastOnSame
= (m_current
== oldCurrent
);
1329 void wxListMainWindow::MoveToFocus( void )
1331 if (!m_current
) return;
1337 m_current
->GetExtent( x
, y
, w
, h
);
1341 GetClientSize( &w_p
, &h_p
);
1343 if (m_mode
& wxLC_REPORT
)
1345 int y_s
= m_yScroll
*GetScrollPos( wxVERTICAL
);
1346 if ((y
> y_s
) && (y
+h
< y_s
+h_p
)) return;
1347 if (y
-y_s
< 5) Scroll( -1, (y
-5-h_p
/2)/m_yScroll
);
1348 if (y
+h
+5 > y_s
+h_p
) Scroll( -1, (y
+h
-h_p
/2+h
+15)/m_yScroll
);
1352 int x_s
= m_xScroll
*GetScrollPos( wxHORIZONTAL
);
1353 if ((x
> x_s
) && (x
+w
< x_s
+w_p
)) return;
1354 if (x
-x_s
< 5) Scroll( (x
-5)/m_xScroll
, -1 );
1355 if (x
+w
-5 > x_s
+w_p
) Scroll( (x
+w
-w_p
+15)/m_xScroll
, -1 );
1359 void wxListMainWindow::OnArrowChar( wxListLineData
*newCurrent
, bool shiftDown
)
1361 if ((m_mode
& wxLC_SINGLE_SEL
) || (m_usedKeys
== FALSE
)) m_current
->Hilight( FALSE
);
1362 wxListLineData
*oldCurrent
= m_current
;
1363 m_current
= newCurrent
;
1365 if (shiftDown
|| (m_mode
& wxLC_SINGLE_SEL
)) m_current
->Hilight( TRUE
);
1366 RefreshLine( m_current
);
1367 RefreshLine( oldCurrent
);
1368 FocusLine( m_current
);
1369 UnfocusLine( oldCurrent
);
1372 void wxListMainWindow::OnChar( wxKeyEvent
&event
)
1374 wxListEvent
le( wxEVT_COMMAND_LIST_KEY_DOWN
, GetParent()->GetId() );
1375 le
.m_code
= event
.KeyCode();
1376 le
.SetEventObject( GetParent() );
1377 GetParent()->GetEventHandler()->ProcessEvent( le
);
1380 if (event.KeyCode() == WXK_TAB)
1382 if (event.ShiftDown())
1395 switch (event
.KeyCode())
1399 wxNode
*node
= m_lines
.Member( m_current
)->Previous();
1400 if (node
) OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1405 wxNode
*node
= m_lines
.Member( m_current
)->Next();
1406 if (node
) OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1411 wxNode
*node
= m_lines
.Last();
1412 OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1417 wxNode
*node
= m_lines
.First();
1418 OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1424 if (m_mode
& wxLC_REPORT
) { steps
= m_visibleLines
-1; }
1428 wxNode
*node
= m_lines
.First();
1429 for (;;) { if (m_current
== (wxListLineData
*)node
->Data()) break; pos
++; node
= node
->Next(); }
1430 steps
= pos
% m_visibleLines
;
1432 wxNode
*node
= m_lines
.Member( m_current
);
1433 for (int i
= 0; i
< steps
; i
++) if (node
->Previous()) node
= node
->Previous();
1434 if (node
) OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1440 if (m_mode
& wxLC_REPORT
) { steps
= m_visibleLines
-1; }
1443 int pos
= 0; wxNode
*node
= m_lines
.First();
1444 for (;;) { if (m_current
== (wxListLineData
*)node
->Data()) break; pos
++; node
= node
->Next(); }
1445 steps
= m_visibleLines
-(pos
% m_visibleLines
)-1;
1447 wxNode
*node
= m_lines
.Member( m_current
);
1448 for (int i
= 0; i
< steps
; i
++) if (node
->Next()) node
= node
->Next();
1449 if (node
) OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1454 if (!(m_mode
& wxLC_REPORT
))
1456 wxNode
*node
= m_lines
.Member( m_current
);
1457 for (int i
= 0; i
<m_visibleLines
; i
++) if (node
->Previous()) node
= node
->Previous();
1458 if (node
) OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1464 if (!(m_mode
& wxLC_REPORT
))
1466 wxNode
*node
= m_lines
.Member( m_current
);
1467 for (int i
= 0; i
<m_visibleLines
; i
++) if (node
->Next()) node
= node
->Next();
1468 if (node
) OnArrowChar( (wxListLineData
*)node
->Data(), event
.ShiftDown() );
1474 m_current
->ReverseHilight();
1475 RefreshLine( m_current
);
1480 if (!(m_mode
& wxLC_SINGLE_SEL
))
1482 wxListLineData
*oldCurrent
= m_current
;
1483 m_current
->ReverseHilight();
1484 wxNode
*node
= m_lines
.Member( m_current
)->Next();
1485 if (node
) m_current
= (wxListLineData
*)node
->Data();
1487 RefreshLine( oldCurrent
);
1488 RefreshLine( m_current
);
1489 UnfocusLine( oldCurrent
);
1490 FocusLine( m_current
);
1497 wxListEvent
le( wxEVT_COMMAND_LIST_ITEM_ACTIVATED
, GetParent()->GetId() );
1498 le
.SetEventObject( GetParent() );
1499 le
.m_itemIndex
= GetIndexOfLine( m_current
);
1500 m_current
->GetItem( 0, le
.m_item
);
1501 GetParent()->GetEventHandler()->ProcessEvent( le
);
1513 void wxListMainWindow::OnSetFocus( wxFocusEvent
&WXUNUSED(event
) )
1516 RefreshLine( m_current
);
1518 if (!GetParent()) return;
1520 wxFocusEvent
event( wxEVT_SET_FOCUS
, GetParent()->GetId() );
1521 event
.SetEventObject( GetParent() );
1522 GetParent()->GetEventHandler()->ProcessEvent( event
);
1525 void wxListMainWindow::OnKillFocus( wxFocusEvent
&WXUNUSED(event
) )
1528 RefreshLine( m_current
);
1531 void wxListMainWindow::OnSize( wxSizeEvent
&WXUNUSED(event
) )
1534 We don't even allow the wxScrolledWindow::AdjustScrollbars() call
1539 void wxListMainWindow::DrawImage( int index
, wxPaintDC
*dc
, int x
, int y
)
1541 if ((m_mode
& wxLC_ICON
) && (m_normal_image_list
))
1543 m_normal_image_list
->Draw( index
, *dc
, x
, y
, wxIMAGELIST_DRAW_TRANSPARENT
);
1546 if ((m_mode
& wxLC_SMALL_ICON
) && (m_small_image_list
))
1548 m_small_image_list
->Draw( index
, *dc
, x
, y
, wxIMAGELIST_DRAW_TRANSPARENT
);
1550 if ((m_mode
& wxLC_REPORT
) && (m_small_image_list
))
1552 m_small_image_list
->Draw( index
, *dc
, x
, y
, wxIMAGELIST_DRAW_TRANSPARENT
);
1557 void wxListMainWindow::GetImageSize( int index
, int &width
, int &height
)
1559 if ((m_mode
& wxLC_ICON
) && (m_normal_image_list
))
1561 m_normal_image_list
->GetSize( index
, width
, height
);
1564 if ((m_mode
& wxLC_SMALL_ICON
) && (m_small_image_list
))
1566 m_small_image_list
->GetSize( index
, width
, height
);
1569 if ((m_mode
& wxLC_REPORT
) && (m_small_image_list
))
1571 m_small_image_list
->GetSize( index
, width
, height
);
1578 int wxListMainWindow::GetTextLength( wxString
&s
)
1580 wxPaintDC
dc( this );
1583 dc
.GetTextExtent( s
, &lw
, &lh
);
1587 int wxListMainWindow::GetIndexOfLine( const wxListLineData
*line
)
1590 wxNode
*node
= m_lines
.First();
1593 if (line
== (wxListLineData
*)node
->Data()) return i
;
1595 node
= node
->Next();
1600 void wxListMainWindow::SetImageList( wxImageList
*imageList
, int which
)
1603 if (which
== wxIMAGE_LIST_NORMAL
) m_normal_image_list
= imageList
;
1604 if (which
== wxIMAGE_LIST_SMALL
) m_small_image_list
= imageList
;
1607 void wxListMainWindow::SetItemSpacing( int spacing
, bool isSmall
)
1612 m_small_spacing
= spacing
;
1616 m_normal_spacing
= spacing
;
1620 int wxListMainWindow::GetItemSpacing( bool isSmall
)
1622 if (isSmall
) return m_small_spacing
; else return m_normal_spacing
;
1625 void wxListMainWindow::SetColumn( int col
, wxListItem
&item
)
1628 wxNode
*node
= m_columns
.Nth( col
);
1631 if (item
.m_width
== wxLIST_AUTOSIZE_USEHEADER
) item
.m_width
= GetTextLength( item
.m_text
)+7;
1632 wxListHeaderData
*column
= (wxListHeaderData
*)node
->Data();
1633 column
->SetItem( item
);
1635 wxListCtrl
*lc
= (wxListCtrl
*) GetParent();
1636 if (lc
->m_headerWin
) lc
->m_headerWin
->Refresh();
1639 void wxListMainWindow::SetColumnWidth( int col
, int width
)
1641 if (!(m_mode
& wxLC_REPORT
)) return;
1645 wxNode
*node
= m_columns
.Nth( col
);
1648 wxListHeaderData
*column
= (wxListHeaderData
*)node
->Data();
1649 column
->SetWidth( width
);
1652 node
= m_lines
.First();
1655 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1656 wxNode
*n
= line
->m_items
.Nth( col
);
1659 wxListItemData
*item
= (wxListItemData
*)n
->Data();
1660 item
->SetSize( width
, -1 );
1662 node
= node
->Next();
1665 wxListCtrl
*lc
= (wxListCtrl
*) GetParent();
1666 if (lc
->m_headerWin
) lc
->m_headerWin
->Refresh();
1669 void wxListMainWindow::GetColumn( int col
, wxListItem
&item
)
1671 wxNode
*node
= m_columns
.Nth( col
);
1674 wxListHeaderData
*column
= (wxListHeaderData
*)node
->Data();
1675 column
->GetItem( item
);
1687 int wxListMainWindow::GetColumnWidth( int col
)
1689 wxNode
*node
= m_columns
.Nth( col
);
1692 wxListHeaderData
*column
= (wxListHeaderData
*)node
->Data();
1693 return column
->GetWidth();
1701 int wxListMainWindow::GetColumnCount( void )
1703 return m_columns
.Number();
1706 int wxListMainWindow::GetCountPerPage( void )
1708 return m_visibleLines
;
1711 void wxListMainWindow::SetItem( wxListItem
&item
)
1714 wxNode
*node
= m_lines
.Nth( item
.m_itemId
);
1717 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1718 if (m_mode
& wxLC_REPORT
) item
.m_width
= GetColumnWidth( item
.m_col
)-3;
1719 line
->SetItem( item
.m_col
, item
);
1723 void wxListMainWindow::SetItemState( long item
, long state
, long stateMask
)
1725 // m_dirty = TRUE; no recalcs needed
1727 wxListLineData
*oldCurrent
= m_current
;
1729 if (stateMask
& wxLIST_STATE_FOCUSED
)
1731 wxNode
*node
= m_lines
.Nth( item
);
1734 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1735 UnfocusLine( m_current
);
1737 FocusLine( m_current
);
1738 RefreshLine( m_current
);
1739 RefreshLine( oldCurrent
);
1743 if (stateMask
& wxLIST_STATE_SELECTED
)
1745 bool on
= state
& wxLIST_STATE_SELECTED
;
1746 if (!on
&& (m_mode
& wxLC_SINGLE_SEL
)) return;
1748 wxNode
*node
= m_lines
.Nth( item
);
1751 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1752 if (m_mode
& wxLC_SINGLE_SEL
)
1754 UnfocusLine( m_current
);
1756 FocusLine( m_current
);
1757 oldCurrent
->Hilight( FALSE
);
1758 RefreshLine( m_current
);
1759 RefreshLine( oldCurrent
);
1761 bool on
= state
& wxLIST_STATE_SELECTED
;
1762 if (on
!= line
->IsHilighted())
1764 line
->Hilight( on
);
1765 RefreshLine( line
);
1771 int wxListMainWindow::GetItemState( long item
, long stateMask
)
1773 int ret
= wxLIST_STATE_DONTCARE
;
1774 if (stateMask
& wxLIST_STATE_FOCUSED
)
1776 wxNode
*node
= m_lines
.Nth( item
);
1779 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1780 if (line
== m_current
) ret
|= wxLIST_STATE_FOCUSED
;
1783 if (stateMask
& wxLIST_STATE_SELECTED
)
1785 wxNode
*node
= m_lines
.Nth( item
);
1788 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1789 if (line
->IsHilighted()) ret
|= wxLIST_STATE_FOCUSED
;
1795 void wxListMainWindow::GetItem( wxListItem
&item
)
1797 wxNode
*node
= m_lines
.Nth( item
.m_itemId
);
1800 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1801 line
->GetItem( item
.m_col
, item
);
1812 int wxListMainWindow::GetItemCount( void )
1814 return m_lines
.Number();
1817 void wxListMainWindow::GetItemRect( long index
, wxRectangle
&rect
)
1819 wxNode
*node
= m_lines
.Nth( index
);
1822 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1823 line
->GetRect( rect
);
1834 bool wxListMainWindow::GetItemPosition(long item
, wxPoint
& pos
)
1836 wxNode
*node
= m_lines
.Nth( item
);
1840 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1841 line
->GetRect( rect
);
1853 int wxListMainWindow::GetSelectedItemCount( void )
1856 wxNode
*node
= m_lines
.First();
1859 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1860 if (line
->IsHilighted()) ret
++;
1861 node
= node
->Next();
1866 void wxListMainWindow::SetMode( long mode
)
1873 if (m_mode
& wxLC_REPORT
)
1885 long wxListMainWindow::GetMode( void ) const
1890 void wxListMainWindow::CalculatePositions( void )
1892 if (!m_lines
.First()) return;
1894 wxPaintDC
dc( this );
1895 dc
.SetFont( GetFont() );
1897 int iconSpacing
= 0;
1898 if (m_mode
& wxLC_ICON
) iconSpacing
= m_normal_spacing
;
1899 if (m_mode
& wxLC_SMALL_ICON
) iconSpacing
= m_small_spacing
;
1901 // we take the first line (which also can be an icon or
1902 // an a text item in wxLC_ICON and wxLC_LIST modes) to
1903 // measure the size of the line
1907 int lineSpacing
= 0;
1909 wxListLineData
*line
= (wxListLineData
*)m_lines
.First()->Data();
1910 line
->CalculateSize( &dc
, iconSpacing
);
1912 line
->GetSize( dummy
, lineSpacing
);
1915 int clientWidth
= 0;
1916 int clientHeight
= 0;
1918 if (m_mode
& wxLC_REPORT
)
1922 int entireHeight
= m_lines
.Number() * lineSpacing
+ 2;
1923 int scroll_pos
= GetScrollPos( wxVERTICAL
);
1924 SetScrollbars( m_xScroll
, m_yScroll
, 0, (entireHeight
+15) / m_yScroll
, 0, scroll_pos
, TRUE
);
1925 GetClientSize( &clientWidth
, &clientHeight
);
1927 wxNode
* node
= m_lines
.First();
1930 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1931 line
->CalculateSize( &dc
, iconSpacing
);
1932 line
->SetPosition( &dc
, x
, y
, clientWidth
);
1934 for (int i
= 0; i
< GetColumnCount(); i
++)
1936 line
->SetColumnPosition( i
, col_x
);
1937 col_x
+= GetColumnWidth( i
);
1939 y
+= lineSpacing
; // one pixel blank line between items
1940 node
= node
->Next();
1942 m_visibleLines
= clientHeight
/ lineSpacing
;
1946 // at first we try without any scrollbar. if the items don't
1947 // fit into the window, we recalculate after subtracting an
1948 // approximated 15 pt for the horizontal scrollbar
1950 GetSize( &clientWidth
, &clientHeight
);
1951 clientHeight
-= 4; // sunken frame
1953 int entireWidth
= 0;
1955 for (int tries
= 0; tries
< 2; tries
++)
1958 int x
= 5; // painting is done at x-2
1959 int y
= 5; // painting is done at y-2
1961 wxNode
*node
= m_lines
.First();
1964 wxListLineData
*line
= (wxListLineData
*)node
->Data();
1965 line
->CalculateSize( &dc
, iconSpacing
);
1966 line
->SetPosition( &dc
, x
, y
, clientWidth
);
1967 line
->GetSize( lineWidth
, lineHeight
);
1968 if (lineWidth
> maxWidth
) maxWidth
= lineWidth
;
1970 if (y
+lineSpacing
-6 >= clientHeight
) // -6 for earlier "line breaking"
1974 entireWidth
+= maxWidth
+6;
1977 node
= node
->Next();
1978 if (!node
) entireWidth
+= maxWidth
;
1979 if ((tries
== 0) && (entireWidth
> clientWidth
))
1981 clientHeight
-= 15; // scrollbar height
1984 if (!node
) tries
= 1; // everything fits, no second try required
1987 m_visibleLines
= (clientHeight
+6) / (lineSpacing
); // +6 for earlier "line breaking"
1989 int scroll_pos
= GetScrollPos( wxHORIZONTAL
);
1990 SetScrollbars( m_xScroll
, m_yScroll
, (entireWidth
+15) / m_xScroll
, 0, scroll_pos
, 0, TRUE
);
1994 void wxListMainWindow::RealizeChanges( void )
1998 wxNode
*node
= m_lines
.First();
1999 if (node
) m_current
= (wxListLineData
*)node
->Data();
2003 FocusLine( m_current
);
2004 if (m_mode
& wxLC_SINGLE_SEL
) m_current
->Hilight( TRUE
);
2008 long wxListMainWindow::GetNextItem( long item
, int WXUNUSED(geometry
), int state
)
2011 if (item
> 0) ret
= item
;
2012 wxNode
*node
= m_lines
.Nth( ret
);
2015 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2016 if ((state
& wxLIST_STATE_FOCUSED
) && (line
== m_current
)) return ret
;
2017 if ((state
& wxLIST_STATE_SELECTED
) && (line
->IsHilighted())) return ret
;
2018 if (!state
) return ret
;
2020 node
= node
->Next();
2025 void wxListMainWindow::DeleteItem( long index
)
2028 wxNode
*node
= m_lines
.Nth( index
);
2031 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2032 if (m_current
== line
) m_current
= (wxListLineData
*) NULL
;
2034 m_lines
.DeleteNode( node
);
2038 void wxListMainWindow::DeleteColumn( int col
)
2040 wxCHECK_RET( col
< (int)m_columns
.GetCount(),
2041 "attempting to delete inexistent column in wxListView" );
2044 wxNode
*node
= m_columns
.Nth( col
);
2045 if (node
) m_columns
.DeleteNode( node
);
2048 void wxListMainWindow::DeleteAllItems( void )
2051 m_current
= (wxListLineData
*) NULL
;
2052 wxNode
*node
= m_lines
.First();
2055 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2057 node
= node
->Next();
2062 void wxListMainWindow::DeleteEverything( void )
2065 m_current
= (wxListLineData
*) NULL
;
2066 wxNode
*node
= m_lines
.First();
2069 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2071 node
= node
->Next();
2074 m_current
= (wxListLineData
*) NULL
;
2078 void wxListMainWindow::EnsureVisible( long index
)
2080 wxListLineData
*oldCurrent
= m_current
;
2081 m_current
= (wxListLineData
*) NULL
;
2083 wxNode
*node
= m_lines
.Nth( i
);
2084 if (node
) m_current
= (wxListLineData
*)node
->Data();
2085 if (m_current
) MoveToFocus();
2086 m_current
= oldCurrent
;
2089 long wxListMainWindow::FindItem(long start
, const wxString
& str
, bool WXUNUSED(partial
) )
2093 if (pos
< 0) pos
= 0;
2094 wxNode
*node
= m_lines
.Nth( pos
);
2097 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2099 line
->GetText( 0, s
);
2100 if (s
== tmp
) return pos
;
2101 node
= node
->Next();
2107 long wxListMainWindow::FindItem(long start
, long data
)
2110 if (pos
< 0) pos
= 0;
2111 wxNode
*node
= m_lines
.Nth( pos
);
2114 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2116 line
->GetItem( 0, item
);
2117 if (item
.m_data
== data
) return pos
;
2118 node
= node
->Next();
2124 long wxListMainWindow::HitTest( int x
, int y
, int &flags
)
2126 wxNode
*node
= m_lines
.First();
2130 wxListLineData
*line
= (wxListLineData
*)node
->Data();
2131 long ret
= line
->IsHit( x
, y
);
2137 node
= node
->Next();
2143 void wxListMainWindow::InsertItem( wxListItem
&item
)
2147 if (m_mode
& wxLC_REPORT
) mode
= wxLC_REPORT
;
2148 else if (m_mode
& wxLC_LIST
) mode
= wxLC_LIST
;
2149 else if (m_mode
& wxLC_ICON
) mode
= wxLC_ICON
;
2150 else if (m_mode
& wxLC_SMALL_ICON
) mode
= wxLC_ICON
; // no typo
2151 wxListLineData
*line
= new wxListLineData( this, mode
, m_hilightBrush
);
2152 if (m_mode
& wxLC_REPORT
)
2154 line
->InitItems( GetColumnCount() );
2155 item
.m_width
= GetColumnWidth( 0 )-3;
2158 line
->InitItems( 1 );
2159 line
->SetItem( 0, item
);
2160 if ((item
.m_itemId
>= 0) && (item
.m_itemId
< (int)m_lines
.GetCount()))
2162 wxNode
*node
= m_lines
.Nth( item
.m_itemId
);
2163 if (node
) m_lines
.Insert( node
, line
);
2167 m_lines
.Append( line
);
2171 void wxListMainWindow::InsertColumn( long col
, wxListItem
&item
)
2174 if (m_mode
& wxLC_REPORT
)
2176 if (item
.m_width
== wxLIST_AUTOSIZE_USEHEADER
) item
.m_width
= GetTextLength( item
.m_text
);
2177 wxListHeaderData
*column
= new wxListHeaderData( item
);
2178 if ((col
>= 0) && (col
< (int)m_columns
.GetCount()))
2180 wxNode
*node
= m_columns
.Nth( col
);
2182 m_columns
.Insert( node
, column
);
2186 m_columns
.Append( column
);
2191 wxListCtrlCompare list_ctrl_compare_func_2
;
2192 long list_ctrl_compare_data
;
2194 int list_ctrl_compare_func_1( const void *arg1
, const void *arg2
)
2196 wxListLineData
*line1
= *((wxListLineData
**)arg1
);
2197 wxListLineData
*line2
= *((wxListLineData
**)arg2
);
2199 line1
->GetItem( 0, item
);
2200 long data1
= item
.m_data
;
2201 line2
->GetItem( 0, item
);
2202 long data2
= item
.m_data
;
2203 return list_ctrl_compare_func_2( data1
, data2
, list_ctrl_compare_data
);
2206 void wxListMainWindow::SortItems( wxListCtrlCompare fn
, long data
)
2208 list_ctrl_compare_func_2
= fn
;
2209 list_ctrl_compare_data
= data
;
2210 m_lines
.Sort( list_ctrl_compare_func_1
);
2213 // -------------------------------------------------------------------------------------
2215 // -------------------------------------------------------------------------------------
2217 IMPLEMENT_DYNAMIC_CLASS(wxListItem
, wxObject
)
2219 wxListItem::wxListItem(void)
2228 m_format
= wxLIST_FORMAT_CENTRE
;
2233 // -------------------------------------------------------------------------------------
2235 // -------------------------------------------------------------------------------------
2237 IMPLEMENT_DYNAMIC_CLASS(wxListEvent
, wxNotifyEvent
)
2239 wxListEvent::wxListEvent( wxEventType commandType
, int id
):
2240 wxNotifyEvent( commandType
, id
)
2246 m_cancelled
= FALSE
;
2251 // -------------------------------------------------------------------------------------
2253 // -------------------------------------------------------------------------------------
2255 IMPLEMENT_DYNAMIC_CLASS(wxListCtrl
, wxControl
)
2257 BEGIN_EVENT_TABLE(wxListCtrl
,wxControl
)
2258 EVT_SIZE (wxListCtrl::OnSize
)
2259 EVT_IDLE (wxListCtrl::OnIdle
)
2262 wxListCtrl::wxListCtrl(void)
2264 m_imageListNormal
= (wxImageList
*) NULL
;
2265 m_imageListSmall
= (wxImageList
*) NULL
;
2266 m_imageListState
= (wxImageList
*) NULL
;
2267 m_mainWin
= (wxListMainWindow
*) NULL
;
2268 m_headerWin
= (wxListHeaderWindow
*) NULL
;
2271 wxListCtrl::~wxListCtrl(void)
2275 bool wxListCtrl::Create( wxWindow
*parent
, wxWindowID id
,
2276 const wxPoint
&pos
, const wxSize
&size
,
2277 long style
, const wxValidator
&validator
,
2278 const wxString
&name
)
2280 m_imageListNormal
= (wxImageList
*) NULL
;
2281 m_imageListSmall
= (wxImageList
*) NULL
;
2282 m_imageListState
= (wxImageList
*) NULL
;
2283 m_mainWin
= (wxListMainWindow
*) NULL
;
2284 m_headerWin
= (wxListHeaderWindow
*) NULL
;
2288 if ((s
& wxLC_REPORT
== 0) &&
2289 (s
& wxLC_LIST
== 0) &&
2290 (s
& wxLC_ICON
== 0))
2293 bool ret
= wxControl::Create( parent
, id
, pos
, size
, s
, name
);
2295 SetValidator( validator
);
2297 if (s
& wxSUNKEN_BORDER
) s
-= wxSUNKEN_BORDER
;
2299 m_mainWin
= new wxListMainWindow( this, -1, wxPoint(0,0), size
, s
);
2301 if (GetWindowStyleFlag() & wxLC_REPORT
)
2302 m_headerWin
= new wxListHeaderWindow( this, -1, m_mainWin
, wxPoint(0,0), wxSize(size
.x
,23), wxTAB_TRAVERSAL
);
2304 m_headerWin
= (wxListHeaderWindow
*) NULL
;
2309 void wxListCtrl::OnSize( wxSizeEvent
&WXUNUSED(event
) )
2311 // handled in OnIdle
2313 if (m_mainWin
) m_mainWin
->m_dirty
= TRUE
;
2316 void wxListCtrl::SetSingleStyle( long style
, bool add
)
2318 long flag
= GetWindowStyleFlag();
2322 if (style
& wxLC_MASK_TYPE
) flag
= flag
& ~wxLC_MASK_TYPE
;
2323 if (style
& wxLC_MASK_ALIGN
) flag
= flag
& ~wxLC_MASK_ALIGN
;
2324 if (style
& wxLC_MASK_SORT
) flag
= flag
& ~wxLC_MASK_SORT
;
2333 if (flag
& style
) flag
-= style
;
2336 SetWindowStyleFlag( flag
);
2339 void wxListCtrl::SetWindowStyleFlag( long flag
)
2341 m_mainWin
->DeleteEverything();
2345 GetClientSize( &width
, &height
);
2347 m_mainWin
->SetMode( flag
);
2349 if (flag
& wxLC_REPORT
)
2351 if (!(GetWindowStyleFlag() & wxLC_REPORT
))
2353 // m_mainWin->SetSize( 0, 24, width, height-24 );
2356 m_headerWin
= new wxListHeaderWindow( this, -1, m_mainWin
, wxPoint(0,0), wxSize(width
,23), wxTAB_TRAVERSAL
);
2360 // m_headerWin->SetSize( 0, 0, width, 23 );
2361 m_headerWin
->Show( TRUE
);
2367 if (GetWindowStyleFlag() & wxLC_REPORT
)
2369 // m_mainWin->SetSize( 0, 0, width, height );
2370 m_headerWin
->Show( FALSE
);
2374 wxWindow::SetWindowStyleFlag( flag
);
2377 bool wxListCtrl::GetColumn(int col
, wxListItem
&item
) const
2379 m_mainWin
->GetColumn( col
, item
);
2383 bool wxListCtrl::SetColumn( int col
, wxListItem
& item
)
2385 m_mainWin
->SetColumn( col
, item
);
2389 int wxListCtrl::GetColumnWidth( int col
) const
2391 return m_mainWin
->GetColumnWidth( col
);
2394 bool wxListCtrl::SetColumnWidth( int col
, int width
)
2396 m_mainWin
->SetColumnWidth( col
, width
);
2400 int wxListCtrl::GetCountPerPage(void) const
2402 return m_mainWin
->GetCountPerPage(); // different from Windows ?
2406 wxText& wxListCtrl::GetEditControl(void) const
2411 bool wxListCtrl::GetItem( wxListItem
&info
) const
2413 m_mainWin
->GetItem( info
);
2417 bool wxListCtrl::SetItem( wxListItem
&info
)
2419 m_mainWin
->SetItem( info
);
2423 long wxListCtrl::SetItem( long index
, int col
, const wxString
& label
, int imageId
)
2426 info
.m_text
= label
;
2427 info
.m_mask
= wxLIST_MASK_TEXT
;
2428 info
.m_itemId
= index
;
2432 info
.m_image
= imageId
;
2433 info
.m_mask
|= wxLIST_MASK_IMAGE
;
2436 m_mainWin
->SetItem(info
);
2440 int wxListCtrl::GetItemState( long item
, long stateMask
) const
2442 return m_mainWin
->GetItemState( item
, stateMask
);
2445 bool wxListCtrl::SetItemState( long item
, long state
, long stateMask
)
2447 m_mainWin
->SetItemState( item
, state
, stateMask
);
2451 bool wxListCtrl::SetItemImage( long item
, int image
, int WXUNUSED(selImage
) )
2454 info
.m_image
= image
;
2455 info
.m_mask
= wxLIST_MASK_IMAGE
;
2456 info
.m_itemId
= item
;
2457 m_mainWin
->SetItem( info
);
2461 wxString
wxListCtrl::GetItemText( long item
) const
2464 info
.m_itemId
= item
;
2465 m_mainWin
->GetItem( info
);
2469 void wxListCtrl::SetItemText( long item
, const wxString
&str
)
2472 info
.m_mask
= wxLIST_MASK_TEXT
;
2473 info
.m_itemId
= item
;
2475 m_mainWin
->SetItem( info
);
2478 long wxListCtrl::GetItemData( long item
) const
2481 info
.m_itemId
= item
;
2482 m_mainWin
->GetItem( info
);
2486 bool wxListCtrl::SetItemData( long item
, long data
)
2489 info
.m_mask
= wxLIST_MASK_DATA
;
2490 info
.m_itemId
= item
;
2492 m_mainWin
->SetItem( info
);
2496 bool wxListCtrl::GetItemRect( long item
, wxRectangle
&rect
, int WXUNUSED(code
) ) const
2498 m_mainWin
->GetItemRect( item
, rect
);
2502 bool wxListCtrl::GetItemPosition( long item
, wxPoint
& pos
) const
2504 m_mainWin
->GetItemPosition( item
, pos
);
2508 bool wxListCtrl::SetItemPosition( long WXUNUSED(item
), const wxPoint
& WXUNUSED(pos
) )
2513 int wxListCtrl::GetItemCount(void) const
2515 return m_mainWin
->GetItemCount();
2518 int wxListCtrl::GetColumnCount(void) const
2520 return m_mainWin
->GetColumnCount();
2523 void wxListCtrl::SetItemSpacing( int spacing
, bool isSmall
)
2525 m_mainWin
->SetItemSpacing( spacing
, isSmall
);
2528 int wxListCtrl::GetItemSpacing( bool isSmall
) const
2530 return m_mainWin
->GetItemSpacing( isSmall
);
2533 int wxListCtrl::GetSelectedItemCount(void) const
2535 return m_mainWin
->GetSelectedItemCount();
2539 wxColour wxListCtrl::GetTextColour(void) const
2543 void wxListCtrl::SetTextColour(const wxColour& WXUNUSED(col))
2548 long wxListCtrl::GetTopItem(void) const
2553 long wxListCtrl::GetNextItem( long item
, int geom
, int state
) const
2555 return m_mainWin
->GetNextItem( item
, geom
, state
);
2558 wxImageList
*wxListCtrl::GetImageList(int which
) const
2560 if (which
== wxIMAGE_LIST_NORMAL
)
2562 return m_imageListNormal
;
2564 else if (which
== wxIMAGE_LIST_SMALL
)
2566 return m_imageListSmall
;
2568 else if (which
== wxIMAGE_LIST_STATE
)
2570 return m_imageListState
;
2572 return (wxImageList
*) NULL
;
2575 void wxListCtrl::SetImageList( wxImageList
*imageList
, int which
)
2577 m_mainWin
->SetImageList( imageList
, which
);
2580 bool wxListCtrl::Arrange( int WXUNUSED(flag
) )
2585 bool wxListCtrl::DeleteItem( long item
)
2587 m_mainWin
->DeleteItem( item
);
2591 bool wxListCtrl::DeleteAllItems(void)
2593 m_mainWin
->DeleteAllItems();
2597 bool wxListCtrl::DeleteAllColumns()
2599 for ( size_t n
= 0; n
< m_mainWin
->m_columns
.GetCount(); n
++ )
2605 void wxListCtrl::ClearAll()
2607 m_mainWin
->DeleteEverything();
2610 bool wxListCtrl::DeleteColumn( int col
)
2612 m_mainWin
->DeleteColumn( col
);
2617 wxText& wxListCtrl::Edit( long WXUNUSED(item ) )
2622 bool wxListCtrl::EnsureVisible( long item
)
2624 m_mainWin
->EnsureVisible( item
);
2628 long wxListCtrl::FindItem( long start
, const wxString
& str
, bool partial
)
2630 return m_mainWin
->FindItem( start
, str
, partial
);
2633 long wxListCtrl::FindItem( long start
, long data
)
2635 return m_mainWin
->FindItem( start
, data
);
2638 long wxListCtrl::FindItem( long WXUNUSED(start
), const wxPoint
& WXUNUSED(pt
),
2639 int WXUNUSED(direction
))
2644 long wxListCtrl::HitTest( const wxPoint
&point
, int &flags
)
2646 return m_mainWin
->HitTest( (int)point
.x
, (int)point
.y
, flags
);
2649 long wxListCtrl::InsertItem( wxListItem
& info
)
2651 m_mainWin
->InsertItem( info
);
2655 long wxListCtrl::InsertItem( long index
, const wxString
&label
)
2658 info
.m_text
= label
;
2659 info
.m_mask
= wxLIST_MASK_TEXT
;
2660 info
.m_itemId
= index
;
2661 return InsertItem( info
);
2664 long wxListCtrl::InsertItem( long index
, int imageIndex
)
2667 info
.m_mask
= wxLIST_MASK_IMAGE
;
2668 info
.m_image
= imageIndex
;
2669 info
.m_itemId
= index
;
2670 return InsertItem( info
);
2673 long wxListCtrl::InsertItem( long index
, const wxString
&label
, int imageIndex
)
2676 info
.m_text
= label
;
2677 info
.m_image
= imageIndex
;
2678 info
.m_mask
= wxLIST_MASK_TEXT
| wxLIST_MASK_IMAGE
;
2679 info
.m_itemId
= index
;
2680 return InsertItem( info
);
2683 long wxListCtrl::InsertColumn( long col
, wxListItem
&item
)
2685 m_mainWin
->InsertColumn( col
, item
);
2689 long wxListCtrl::InsertColumn( long col
, const wxString
&heading
,
2690 int format
, int width
)
2693 item
.m_mask
= wxLIST_MASK_TEXT
| wxLIST_MASK_FORMAT
;
2694 item
.m_text
= heading
;
2697 item
.m_mask
|= wxLIST_MASK_WIDTH
;
2698 item
.m_width
= width
;
2701 item
.m_format
= format
;
2703 return InsertColumn( col
, item
);
2706 bool wxListCtrl::ScrollList( int WXUNUSED(dx
), int WXUNUSED(dy
) )
2712 // fn is a function which takes 3 long arguments: item1, item2, data.
2713 // item1 is the long data associated with a first item (NOT the index).
2714 // item2 is the long data associated with a second item (NOT the index).
2715 // data is the same value as passed to SortItems.
2716 // The return value is a negative number if the first item should precede the second
2717 // item, a positive number of the second item should precede the first,
2718 // or zero if the two items are equivalent.
2719 // data is arbitrary data to be passed to the sort function.
2721 bool wxListCtrl::SortItems( wxListCtrlCompare fn
, long data
)
2723 m_mainWin
->SortItems( fn
, data
);
2727 void wxListCtrl::OnIdle( wxIdleEvent
&WXUNUSED(event
) )
2729 if (!m_mainWin
->m_dirty
) return;
2733 GetClientSize( &cw
, &ch
);
2740 if (GetWindowStyleFlag() & wxLC_REPORT
)
2742 m_headerWin
->GetPosition( &x
, &y
);
2743 m_headerWin
->GetSize( &w
, &h
);
2744 if ((x
!= 0) || (y
!= 0) || (w
!= cw
) || (h
!= 23))
2745 m_headerWin
->SetSize( 0, 0, cw
, 23 );
2747 m_mainWin
->GetPosition( &x
, &y
);
2748 m_mainWin
->GetSize( &w
, &h
);
2749 if ((x
!= 0) || (y
!= 24) || (w
!= cw
) || (h
!= ch
-24))
2750 m_mainWin
->SetSize( 0, 24, cw
, ch
-24 );
2754 m_mainWin
->GetPosition( &x
, &y
);
2755 m_mainWin
->GetSize( &w
, &h
);
2756 if ((x
!= 0) || (y
!= 24) || (w
!= cw
) || (h
!= ch
))
2757 m_mainWin
->SetSize( 0, 0, cw
, ch
);
2760 m_mainWin
->CalculatePositions();
2761 m_mainWin
->RealizeChanges();
2762 m_mainWin
->m_dirty
= FALSE
;
2763 m_mainWin
->Refresh();
2766 void wxListCtrl::SetBackgroundColour( const wxColour
&colour
)
2770 m_mainWin
->SetBackgroundColour( colour
);
2771 m_mainWin
->m_dirty
= TRUE
;
2774 m_headerWin
->SetBackgroundColour( colour
);
2777 void wxListCtrl::SetForegroundColour( const wxColour
&colour
)
2781 m_mainWin
->SetForegroundColour( colour
);
2782 m_mainWin
->m_dirty
= TRUE
;
2785 m_headerWin
->SetForegroundColour( colour
);
2788 void wxListCtrl::SetFont( const wxFont
&font
)
2792 m_mainWin
->SetFont( font
);
2793 m_mainWin
->m_dirty
= TRUE
;
2796 m_headerWin
->SetFont( font
);