os::ListView Class Reference
[The Syllable Graphical User Interface API]

Flexible multicolumn list view. More...

Inheritance diagram for os::ListView:

os::Control os::View os::Invoker os::Handler os::DirectoryView os::TreeView List of all members.

Public Types

enum  scroll_direction {
  SCROLL_UP,
  SCROLL_DOWN
}
enum  { AUTOSCROLL_BORDER = 20 }
enum  {
  F_MULTI_SELECT = 0x0001,
  F_NO_AUTO_SORT = 0x0002,
  F_RENDER_BORDER = 0x0004,
  F_DONT_SCROLL = 0x0008,
  F_NO_HEADER = 0x0010,
  F_NO_COL_REMAP = 0x0020,
  F_NO_SORT = 0x0040
}
enum  {
  INV_HEIGHT = 0x01,
  INV_WIDTH = 0x02,
  INV_VISUAL = 0x04
}
typedef std::vector< ListViewRow
* >::const_iterator 
const_iterator
typedef std::vector< int > column_map

Public Member Functions

 ListView (const Rect &cFrame, const String &cTitle, uint32 nModeFlags=F_MULTI_SELECT|F_RENDER_BORDER, uint32 nResizeMask=CF_FOLLOW_LEFT|CF_FOLLOW_TOP, uint32 nFlags=WID_WILL_DRAW|WID_FULL_UPDATE_ON_RESIZE)
 ~ListView ()
virtual void LabelChanged (const String &cNewLabel)
virtual void EnableStatusChanged (bool bIsEnabled)
virtual bool Invoked (Message *pcMessage)
 Intercept outgoing messages.
virtual void Invoked (int nFirstRow, int nLastRow)
virtual void SelectionChanged (int nFirstRow, int nLastRow)
virtual bool DragSelection (const Point &cPos)
void StartScroll (scroll_direction eDirection, bool bSelect)
void StopScroll ()
bool IsMultiSelect () const
void SetMultiSelect (bool bMulti)
bool IsAutoSort () const
void SetAutoSort (bool bAuto)
bool HasBorder () const
void SetRenderBorder (bool bRender)
bool HasColumnHeader () const
void SetHasColumnHeader (bool bFlag)
 Turn column header on or off.
void MakeVisible (int nRow, bool bCenter=true)
 Make row visible.
int InsertColumn (const char *pzTitle, int nWidth, int nPos=-1)
const column_mapGetColumnMapping () const
void SetColumnMapping (const column_map &cMap)
void InsertRow (int nPos, ListViewRow *pcRow, bool bUpdate=true)
 Insert a row.
void InsertRow (ListViewRow *pcRow, bool bUpdate=true)
 Insert a row.
ListViewRowRemoveRow (int nIndex, bool bUpdate=true)
 Remove a row.
void InvalidateRow (int nRow, uint32 nFlags)
 Refresh row.
uint GetRowCount () const
 Get row count.
ListViewRowGetRow (const Point &cPos) const
 Find row at a certain position.
ListViewRowGetRow (uint nIndex) const
 Get a row.
int HitTest (const Point &cPos) const
 Find row at a certain position.
float GetRowPos (int nRow)
 Get row vertical position.
void Clear ()
 Clear list.
bool IsSelected (uint nRow) const
 Check if a row is selected.
void Select (int nFirst, int nLast, bool bReplace=true, bool bSelect=true)
void Select (int nRow, bool bReplace=true, bool bSelect=true)
void ClearSelection ()
void Highlight (int nFirst, int nLast, bool bReplace, bool bHighlight=true)
void Highlight (int nRow, bool bReplace, bool bHighlight=true)
void SetCurrentRow (int nRow)
void Sort ()
 Sort rows.
int GetFirstSelected () const
 Get first selected row.
int GetLastSelected () const
void SetSelChangeMsg (Message *pcMsg)
void SetInvokeMsg (Message *pcMsg)
MessageGetSelChangeMsg () const
MessageGetInvokeMsg () const
virtual void Paint (const Rect &cUpdateRect)
 Called by the system update "damaged" areas of the view.
virtual void FrameSized (const Point &cDelta)
 Virtual hook called by the system when the view is resized.
virtual void KeyDown (const char *pzString, const char *pzRawString, uint32 nQualifiers)
 Hook called by the system when a key is pressed while the view has focus.
virtual void AllAttached ()
virtual bool HasFocus (void) const
virtual void SortRows (std::vector< ListViewRow * > *pcRows, int nColumn)
 Sort rows.
virtual void MouseDown (const Point &, uint32)
 Hook called by the system when a mouse button is pressed.
virtual void MouseUp (const Point &cPosition, uint32 nButton, Message *pcData)
 Hook called by the system when a mouse button is release.
virtual void MouseMove (const Point &cNewPos, int nCode, uint32 nButtons, Message *pcData)
 Hook called by the system when the mouse is moved.
const_iterator begin () const
 STL iterator interface.
const_iterator end () const
 STL iterator interface.
void RefreshLayout ()
 Refresh layout.

Friends

class ListViewContainer
class ListViewHeader

Classes

class  Private

Detailed Description

Description:
See also:
Author:
Kurt Skauen ([email protected])


Member Typedef Documentation

typedef std::vector<ListViewRow*>::const_iterator os::ListView::const_iterator

typedef std::vector<int> os::ListView::column_map


Member Enumeration Documentation

enum os::ListView::scroll_direction

Enumerator:
SCROLL_UP 
SCROLL_DOWN 

anonymous enum

Enumerator:
AUTOSCROLL_BORDER 

anonymous enum

Enumerator:
F_MULTI_SELECT 
F_NO_AUTO_SORT 
F_RENDER_BORDER 
F_DONT_SCROLL 
F_NO_HEADER 
F_NO_COL_REMAP 
F_NO_SORT 

anonymous enum

Enumerator:
INV_HEIGHT 
INV_WIDTH 
INV_VISUAL 


Constructor & Destructor Documentation

ListView::ListView ( const Rect cFrame,
const String cTitle,
uint32  nModeFlags = F_MULTI_SELECT|F_RENDER_BORDER,
uint32  nResizeMask = CF_FOLLOW_LEFT|CF_FOLLOW_TOP,
uint32  nFlags = WID_WILL_DRAW|WID_FULL_UPDATE_ON_RESIZE 
)

ListView::~ListView (  ) 


Member Function Documentation

void ListView::LabelChanged ( const String cNewLabel  )  [virtual]

Reimplemented from os::Control.

void ListView::EnableStatusChanged ( bool  bIsEnabled  )  [virtual]

Implements os::Control.

bool ListView::Invoked ( Message pcMessage  )  [virtual]

Description:
This member is called from Invoke() just before a message is sendt to the target.
This allow classes that inherits from os::Invoker to add data to or otherwhice modify the message before it is sendt. The message can also be canceled entirely by returning false from this member.
The message passed to Invoked() is a copy of the internal message or the message passed to Invoke() (if any) so any changes made here will not affect the internal message or the message passed to Invoke(). When this method returns the message will imidiatly be sendt to the target and then discarded (unless false is returned in which case the message is simply discarded).
The default implementation of this member does nothing and return true.
Parameters:
pcMessage Pointer to the message that is about to be sendt. You can do any modification you like to this message (but never delete it).
Returns:
Normally you should return true to indicate that the message should be sendt. You can however return false if you for some reason want to cancel the invokation.
See also:
Invoke(), SetMessage(), SetTarget()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::Control.

void ListView::Invoked ( int  nFirstRow,
int  nLastRow 
) [virtual]

Reimplemented in os::DirectoryView.

void ListView::SelectionChanged ( int  nFirstRow,
int  nLastRow 
) [virtual]

bool ListView::DragSelection ( const Point cPos  )  [virtual]

Reimplemented in os::DirectoryView.

void ListView::StartScroll ( scroll_direction  eDirection,
bool  bSelect 
)

void ListView::StopScroll (  ) 

bool ListView::IsMultiSelect (  )  const

void ListView::SetMultiSelect ( bool  bMulti  ) 

bool ListView::IsAutoSort (  )  const

void ListView::SetAutoSort ( bool  bAuto  ) 

bool ListView::HasBorder (  )  const

void ListView::SetRenderBorder ( bool  bRender  ) 

bool ListView::HasColumnHeader (  )  const

void ListView::SetHasColumnHeader ( bool  bFlag  ) 

Description:
Use this method to specify if a column header should be drawn.
See also:
HasColumnHeader()
Author:
Kurt Skauen

void ListView::MakeVisible ( int  nRow,
bool  bCenter = true 
)

Description:
Scroll the ListView so that a row becomes visible.
Parameters:
nRow Index to row to make visible.
bCenter Set to true to have the view centred on nRow.
Author:
Kurt Skauen

int ListView::InsertColumn ( const char *  pzTitle,
int  nWidth,
int  nPos = -1 
)

const std::vector< int > & ListView::GetColumnMapping (  )  const

void ListView::SetColumnMapping ( const column_map cMap  ) 

void ListView::InsertRow ( int  nPos,
ListViewRow pcRow,
bool  bUpdate = true 
)

Description:
Insert a row at a specific position.
Parameters:
nPos Row index.
bUpdate Update display. If many operations are performed, often only the last one need to update the display.
Author:
Kurt Skauen

void ListView::InsertRow ( ListViewRow pcRow,
bool  bUpdate = true 
)

Description:
Insert a row at the end of the list.
Parameters:
bUpdate Update display. If many operations are performed, often only the last one need to update the display.
Author:
Kurt Skauen

ListViewRow * ListView::RemoveRow ( int  nIndex,
bool  bUpdate = true 
)

Description:
Removes a row from the ListView. A pointer to the removed row is returned, and the application is responsible for freeing it.
Parameters:
nIndex Row index.
bUpdate Update display. If many operations are performed, often only the last one need to update the display.
Author:
Kurt Skauen

Reimplemented in os::TreeView.

void ListView::InvalidateRow ( int  nRow,
uint32  nFlags 
)

Description:
This method causes a row to be redrawn.
Parameters:
nIndex Row index.
nFlags Flags. Use INV_VISUAL.
Author:
Kurt Skauen

uint ListView::GetRowCount (  )  const

Description:
Returns the number of rows currently attached to the ListView.
Author:
Kurt Skauen

ListViewRow * ListView::GetRow ( const Point cPos  )  const

Description:
Returns a pointer to the row that is located at cPos, or NULL if no row was found at that position. Can for example be used to implement pop-up menus.
Parameters:
cPos Coordinates referenced to ListView control.
Author:
Kurt Skauen

ListViewRow * ListView::GetRow ( uint  nIndex  )  const

Description:
Returns the a pointer to the row at index nIndex or NULL if the index is out of bounds.
Parameters:
nIndex Row index.
Author:
Kurt Skauen

int ListView::HitTest ( const Point cPos  )  const

Description:
Returns the row index to the row that is located at cPos, or -1 if no row was found at that position. Can for example be used to implement pop-up menus.
Parameters:
cPos Screen coordinate to look for a row at.
Author:
Kurt Skauen

float ListView::GetRowPos ( int  nRow  ) 

Description:
Returns the vertical position, in reference to the ListView control, of a row with index nRow, or 0.0 if no row was found at that position.
Parameters:
nRow Row index to look at.
Author:
Kurt Skauen

void ListView::Clear (  ) 

Description:
Clears the ListView for all rows.
Author:
Kurt Skauen

Reimplemented in os::TreeView.

bool ListView::IsSelected ( uint  nRow  )  const

Description:
Returns true if nRow is selected.
Parameters:
nRow Row to check.
Author:
Kurt Skauen

void ListView::Select ( int  nFirst,
int  nLast,
bool  bReplace = true,
bool  bSelect = true 
)

void ListView::Select ( int  nRow,
bool  bReplace = true,
bool  bSelect = true 
)

void ListView::ClearSelection (  ) 

void ListView::Highlight ( int  nFirst,
int  nLast,
bool  bReplace,
bool  bHighlight = true 
)

void ListView::Highlight ( int  nRow,
bool  bReplace,
bool  bHighlight = true 
)

void ListView::SetCurrentRow ( int  nRow  ) 

void ListView::Sort (  ) 

Description:
Sort rows in the ListView by the selected column, according to ListViewRow::IsLessThan(). The actual sorting takes place in SortRows(), which can be overridden to provide custom sorting routines.
See also:
SortRows()
Author:
Kurt Skauen, Henrik Isaksson ([email protected])

int ListView::GetFirstSelected (  )  const

Description:
Returns index to the first select row, or -1 if none is selected.
Author:
Kurt Skauen

int ListView::GetLastSelected (  )  const

void ListView::SetSelChangeMsg ( Message pcMsg  ) 

void ListView::SetInvokeMsg ( Message pcMsg  ) 

Message * ListView::GetSelChangeMsg (  )  const

Message * ListView::GetInvokeMsg (  )  const

void ListView::Paint ( const Rect cUpdateRect  )  [virtual]

Description:
Note:
Warning:
Parameters:
cUpdateRect A rectangle enclosing all damaged areas. This is just a rough "worst-case", further fine-grained clipping will be performed by the Application Server to avoid updating non-damaged pixels and make the update as fast and flicker-free as possible.
See also:
Invalidate(), Flush()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::View.

Reimplemented in os::TreeView.

void ListView::FrameSized ( const Point cDelta  )  [virtual]

Description:
Overload this member if you need to know when the view is resized.
Note:
This member is called after the view is resized. If you need the old size you can subtract the cDelta calue from the current size.
Parameters:
cDelta The distance the bottom/right corner was moved relative to the upper/left corner.
See also:
FrameMoved(), SetFrame, ResizeBy(), ResizeTo()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::View.

void ListView::KeyDown ( const char *  pzString,
const char *  pzRawString,
uint32  nQualifiers 
) [virtual]

Description:
Overload this member if your view need to handle keyboard input. This member is called to allow the view to handle M_KEY_DOWN messages. The most common members are exctracted from the message and passed as parameters but you might need to obtain the raw message with os::Looper::GetCurrentMessage() and find some members yourself if you the data you needed are not passed in.
For example if you need the raw key-code for the pressed key you will have to lookup the "_raw_key" member from the message.
Parameters:
pzString String containing a single UTF-8 encoded character. This is the character generated by the pressed key according to the current keymap accounting for any qualifiers that might be pressed.
pzRawString Same as pzString except that the key is converted without accounting for qualifiers. Ie. if 'A' is pressed while pressing <SHIFT> pzString will contain 'A' and pzRawString will contain 'a'.
nQualifiers Bitmask describing which qualifiers that was active when the key was pressed.
See also:
KeyUp(), os::Looper::GetCurrentMessage()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::View.

Reimplemented in os::DirectoryView.

void ListView::AllAttached (  )  [virtual]

Reimplemented from os::View.

bool ListView::HasFocus ( void   )  const [virtual]

Reimplemented from os::View.

void ListView::SortRows ( std::vector< ListViewRow * > *  pcRows,
int  nColumn 
) [virtual]

Description:
Overridable default sorting routine.
Parameters:
pcRows std::vector of ListViewRows to be sorted.
nColumn The column to sort by.
See also:
Sort()
Author:
Henrik Isaksson ([email protected])

Reimplemented in os::TreeView.

void ListView::MouseDown ( const Point cPos,
uint32  nButtons 
) [virtual]

Description:
This member is called from the window thread whenever a mouse button is clicked above the view. You can overload this member if your view need to know about mouse-down events.
A view will not automatically take focus when clicked so if you want that behaviour you must call MakeFocus() from an overloaded version of this member.
The default implementation of this member will call MouseDown() on it's parent view if one exists.
Parameters:
cPosition Mouse position in the views coordinate system at the time the mouse was pressed.
nButtons Index of the pressed button. Buttons start at 1 for the left button, 2 for the right button, 3 for the middle button. Additional buttons might be supported by the mouse driver and will then be assigned numbers from 4 and up.
See also:
MouseUp(), MouseMove(), WheelMoved()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::View.

void ListView::MouseUp ( const Point cPosition,
uint32  nButton,
Message pcData 
) [virtual]

Description:
This member is called from the window thread whenever a mouse button is released above the view. You can overload this member if your view need to know about mouse-up events or if your view support drag and drop.
If mouse-up was the result of ending a drag and drop operation the pcData member will point to a Message containing the dragged data. Look at BeginDrag() for a more detailed description of the drag and drop system.
The default implementation of this member will call MouseDown() on it's parent view if one exists.
Parameters:
cPosition Mouse position in the views coordinate system at the time the mouse was pressed.
nButtons Index of the pressed button. Buttons start at 1 for the left button, 2 for the right button, 3 for the middle button. Additional buttons might be supported by the mouse driver and will then be assigned numbers from 4 and up.
pcData Pointer to a Message object containing the dragged data if this mouse-up was the end of a drag and drop operation. If no data was dragged it will be NULL.
See also:
MouseDown(), MouseMove(), WheelMoved()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::View.

Reimplemented in os::DirectoryView.

void ListView::MouseMove ( const Point cNewPos,
int  nCode,
uint32  nButtons,
Message pcData 
) [virtual]

Description:
This member is called from the window thread whenever the mouse is moved above the view or if the view has focus.
Oveload this member if your view need to handle mouse-move events.
The default implementation of this member will call MouseMove() on it's parent view if one exists.
Parameters:
cNewPos New mouse position given in the views coordinate system.
nCode Enter/exit code. This is MOUSE_ENTERED when the mouse first enter the view, MOUSE_EXITED when the mouse leaves the view, MOUSE_INSIDE whenever the mouse move withing the boundary of the view and MOUSE_OUTSIDE when the mouse move outside the view (will only happen if the view has focus).
nButtons Bitmask telling which buttons that are currently pressed. Bit 0 is button 1 (left), bit 1 is button 2 (right), and bit 2 is button 3 (middle), and so on.
pcData Pointer to a Message object containing the dragged data if the user is in the middle of a drag and drop operation. Otherwise this pointer is NULL. Look at BeginDrag() for a more detailed description of the drag and drop system.
See also:
MouseDown(), MouseUp(), WheelMoved(), BeginDrag()
Author:
Kurt Skauen ([email protected])

Reimplemented from os::View.

Reimplemented in os::DirectoryView.

ListView::const_iterator ListView::begin (  )  const

Description:
Returns iterator pointing to the first row.
Author:
Kurt Skauen

ListView::const_iterator ListView::end (  )  const

Description:
Returns iterator pointing past the last row.
Author:
Kurt Skauen

void ListView::RefreshLayout (  ) 

Description:
Calculates new positions for all rows, invalidates them so that they are rendered, and adjusts scrollbars. Normally there is no reason to use this function, it is primarily implemented for use by the TreeView class.
Author:
Henrik Isaksson ([email protected])


Friends And Related Function Documentation

friend class ListViewContainer [friend]

friend class ListViewHeader [friend]


Generated on Sat May 9 22:51:35 2009 for Syllable higlevel API by  doxygen 1.5.1