delete m_gi;
}
+ // called by the owner when it toggles report view
+ void SetReportView(bool inReportView)
+ {
+ // we only need m_gi when we're not in report view so update as needed
+ if ( inReportView )
+ {
+ delete m_gi;
+ m_gi = NULL;
+ }
+ else
+ {
+ m_gi = new GeometryInfo;
+ }
+ }
+
// are we in report mode?
inline bool InReportView() const;
}
// draw the line on the given DC in icon/list mode
- void Draw( wxDC *dc );
+ void Draw( wxDC *dc, bool current );
- // the same in report mode
+ // the same in report mode: it needs more parameters as we don't store
+ // everything in the item in report mode
void DrawInReportMode( wxDC *dc,
const wxRect& rect,
const wxRect& rectHL,
// get the mode (i.e. style) of the list control
inline int GetMode() const;
- // prepare the DC for drawing with these item's attributes, return true if
- // we need to draw the items background to highlight it, false otherwise
- bool SetAttributes(wxDC *dc,
- const wxListItemAttr *attr,
- bool highlight);
+ // Apply this item attributes to the given DC: set the text font and colour
+ // and also erase the background appropriately.
+ void ApplyAttributes(wxDC *dc,
+ const wxRect& rectHL,
+ bool highlighted,
+ bool current);
// draw the text on the DC with the correct justification; also add an
// ellipsis if the text is too large to fit in the current width
wxTextCtrl *GetText() const { return m_text; }
- void EndEdit( bool discardChanges );
+ // Different reasons for calling EndEdit():
+ //
+ // It was called because:
+ enum EndReason
+ {
+ End_Accept, // user has accepted the changes.
+ End_Discard, // user has cancelled editing.
+ End_Destroy // the entire control is being destroyed.
+ };
+
+ void EndEdit(EndReason reason);
protected:
void OnChar( wxKeyEvent &event );
virtual ~wxListMainWindow();
+ // called by the main control when its mode changes
+ void SetReportView(bool inReportView);
+
+ // helper to simplify testing for wxLC_XXX flags
bool HasFlag(int flag) const { return m_parent->HasFlag(flag); }
// return true if this is a virtual list control
// start editing the label of the given item
wxTextCtrl *EditLabel(long item,
- wxClassInfo* textControlClass = CLASSINFO(wxTextCtrl));
+ wxClassInfo* textControlClass = wxCLASSINFO(wxTextCtrl));
wxTextCtrl *GetEditControl() const
{
return m_textctrlWrapper ? m_textctrlWrapper->GetText() : NULL;
bool GetItemPosition( long item, wxPoint& pos ) const;
int GetSelectedItemCount() const;
- wxString GetItemText(long item) const
+ wxString GetItemText(long item, int col = 0) const
{
wxListItem info;
info.m_mask = wxLIST_MASK_TEXT;
info.m_itemId = item;
+ info.m_col = col;
GetItem( info );
return info.m_text;
}