GList Class Reference

List widget. More...

#include <GList.h>

Inheritance diagram for GList:

GLayout GView

List of all members.

Public Member Functions

 GList (int id, int x, int y, int cx, int cy, char *name="List")
 Constructor.
char * GetClass ()
virtual void OnItemClick (GListItem *Item, GMouse &m)
 Called when an item is clicked.
virtual void OnItemBeginDrag (GListItem *Item, GMouse &m)
 Called when the user selects an item and starts to drag it.
virtual void OnItemSelect (GArray< GListItem * > &Items)
virtual void OnColumnClick (int Col, GMouse &m)
 Called when a column is clicked.
virtual void OnColumnDrag (int Col, GMouse &m)
 Called when a column is dragged somewhere.
virtual bool OnColumnReindex (GListColumn *Col, int OldIndex, int NewIndex)
void OnPaint (GSurface *pDC)
 Called to paint the onscreen representation of the view.
int OnEvent (GMessage *Msg)
 Handles the incoming events.
int OnHitTest (int x, int y)
void OnMouseClick (GMouse &m)
 The mouse was clicked over this view.
void OnMouseMove (GMouse &m)
 The mouse moves over the control.
int OnNotify (GViewI *Ctrl, int Flags)
 Called when a child view or view with it's SetNotify() set to this window changes.
void OnPosChange ()
 Called when the view position changes.
bool OnKey (GKey &k)
 A key was pressed while this view has focus.
void OnMouseWheel (double Lines)
 The mouse wheel was scrolled.
void OnFocus (bool b)
 The view gains or loses the keyboard focus.
void OnPulse ()
 Called every so often by the timer system.
GListColumnAddColumn (char *Name, int Width=50, int Where=-1)
 Adds a column to the list.
bool AddColumn (GListColumn *Col, int Where=-1)
 Adds a preexisting column to the control.
bool DeleteColumn (GListColumn *Col)
 Deletes a column from the GList.
void EmptyColumns ()
 Deletes all the columns of the GList.
GListColumnColumnAt (int Index)
 Returns the column at index 'Index'.
int ColumnAtX (int X, GListColumn **Col=0, int *Offset=0)
 Returns the column at horizontal offset 'x', or -1 if none matches.
int GetColumns ()
 Returns the number of columns.
void DragColumn (int Index)
bool GetColumnClickInfo (int &Col, GMouse &m)
 Returns the last column click info.
bool ShowColumnHeader ()
 Returns whether display of column headers is switched on.
void ShowColumnHeader (bool Show)
 Turns on display of column headers.
bool AllowEditLabels ()
 Returns whether the user can edit labels.
void AllowEditLabels (bool b)
 Sets whether the user can edit labels.
bool DrawGridLines ()
 Returns whether grid lines are drawn.
void DrawGridLines (bool b)
 Sets whether grid lines are drawn.
bool MultiSelect ()
 Returns whether the user can select multiple items at the same time.
void MultiSelect (bool b)
 Sets whether the user can select multiple items at the same time.
GListMode GetMode ()
void SetMode (GListMode m)
int64 Value ()
 Returns the index of the first selected item.
void Value (int64 i)
 Selects the item at index 'i'.
bool Select (GListItem *Obj)
 Selects 'obj'.
GListItemGetSelected ()
 Gets the first selected object.
void SelectAll ()
 Select all the item in the list.
void ScrollToSelection ()
 Scrolls the view to the first selected item if not in view.
void UpdateAllItems ()
 Clears the text cache for all the items and repaints the screen.
int Length ()
 Gets the number of items.
bool IsEmpty ()
 Returns true if the list is empty.
bool Delete ()
 Deletes the current item.
bool Delete (int Index)
 Deletes the item at index 'Index'.
bool Delete (GListItem *p)
 Deletes the item 'p'.
bool Insert (GListItem *p, int Index=-1, bool Update=true)
 Inserts the item 'p' at index 'Index'.
bool Insert (List< GListItem > &l, int Index=-1, bool Update=true)
 Insert a list of item.
bool Remove (GListItem *Obj)
 Remove the item 'Obj' but don't delete it.
bool HasItem (GListItem *Obj)
 Return true if the item 'Obj' is in the list.
int IndexOf (GListItem *Obj)
 Return the index of the item 'Obj' or -1 if not present.
GListItemItemAt (int Index)
 Returns the item at index 'Index'.
void Sort (GListCompareFunc Compare, int Data)
 Sort the list.
void Empty ()
 Removes all items from list and delete the objects.
void RemoveAll ()
 Removes all references to externally owned items. Doesn't delete objects.
void ResizeColumnsToContent (int Border=DEFAULT_COLUMN_SPACING)
 Resizes all the columns to their content, allowing a little extra space for visual effect.

Friends

class GListItem
class GListColumn


Detailed Description

List widget.

Constructor & Destructor Documentation

GList::GList ( int  id,
int  x,
int  y,
int  cx,
int  cy,
char *  name = "List" 
)

Constructor.

Parameters:
id  The control's ID
x  Left edge position
y  Top edge position
cx  The width
cy  The height
name  An unseen descriptor of the control

References GView::Handle(), GView::Name(), GView::SetId(), GView::SetPos(), GView::SetTabStop(), GView::Sunken(), and GRect::ZOff().


Member Function Documentation

bool GList::AddColumn ( GListColumn Col,
int  Where = -1 
)

Adds a preexisting column to the control.

Parameters:
Col  The column object. The object once added is owned by the GList
Where  The location to insert or -1 to append

References GLIST_NOTIFY_COLS_CHANGE, List< Type >::Insert(), GView::Lock(), GView::SendNotify(), GView::Unlock(), and UpdateAllItems().

GListColumn * GList::AddColumn ( char *  Name,
int  Width = 50,
int  Where = -1 
)

Adds a column to the list.

Parameters:
Name  The text for the column or NULL for no text
Width  The width of the column
Where  The index to insert at, or -1 to append to the end

References GLIST_NOTIFY_COLS_CHANGE, List< Type >::Insert(), GView::Lock(), GView::SendNotify(), GView::Unlock(), and UpdateAllItems().

Referenced by GFontSelect::GFontSelect().

void GList::DragColumn ( int  Index  ) 

Starts a column d'n'd operation with the column at index 'Index'

See also:
OnColumnReindex is called when the user drops the column

References GView::Capture().

char* GList::GetClass (  )  [inline]

The class' name. Should be overriden in child classes to return the right class name. Mostly used for debugging, but in the win32 port it is also the default WIN32 class name passed to RegisterClass() in GView::CreateClass().

Returns:
the Class' name for debugging

Reimplemented from GLayout.

GListMode GList::GetMode (  ) 

bool GList::Insert ( List< GListItem > &  l,
int  Index = -1,
bool  Update = true 
)

Insert a list of item.

Parameters:
l  The items to insert
Index  The starting index to insert at
Update  True if you want the list to update immediately. If you are inserting a lot of item list quickly then you should pass false here and then update just once at the end of the insertions.

References List< Type >::First(), GLIST_NOTIFY_INSERT, GView::Invalidate(), GView::Lock(), List< Type >::Next(), GItem::OnInsert(), GListItem::Parent, GListItem::Select(), GView::SendNotify(), and GView::Unlock().

bool GList::Insert ( GListItem p,
int  Index = -1,
bool  Update = true 
)

Inserts the item 'p' at index 'Index'.

Parameters:
p  The item to insert
Index  The index to insert at or -1 for append
Update  True if you want the list to update immediately. If you are inserting a lot of items quickly then you should pass false here and then update just once at the end of the insertions.

References GLIST_NOTIFY_INSERT, GView::Invalidate(), GView::Lock(), GItem::OnInsert(), GListItem::Parent, GListItem::Select(), GView::SendNotify(), GView::Unlock(), GView::Y(), and GRect::y2.

Referenced by GXmlToUi::Convert().

void GList::OnColumnClick ( int  Col,
GMouse m 
) [virtual]

Called when a column is clicked.

Parameters:
Col  The index of the column
m  The mouse parameters at the time

References GLIST_NOTIFY_COLS_CLICK, and GView::SendNotify().

Referenced by OnMouseClick().

virtual void GList::OnColumnDrag ( int  Col,
GMouse m 
) [inline, virtual]

Called when a column is dragged somewhere.

Parameters:
Col  The column index
m  The mouse parameters at the time

Referenced by OnMouseMove().

virtual bool GList::OnColumnReindex ( GListColumn Col,
int  OldIndex,
int  NewIndex 
) [inline, virtual]

Called when the column is dropped to a new location /return true to have the columns reindexed for you

Parameters:
Col  The column dropped
OldIndex  The old index
NewIndex  The new index

Referenced by OnMouseClick().

int GList::OnHitTest ( int  x,
int  y 
)

Return the type of cursor that should be visible when the mouse is at x,y e.g. LCUR_Normal

Reimplemented from GView.

References LCUR_SizeHor, and GView::SetCursor().

void GList::OnItemBeginDrag ( GListItem Item,
GMouse m 
) [virtual]

Called when the user selects an item and starts to drag it.

Parameters:
Item  The item being dragged
m  The mouse parameters at the time

References GItem::OnBeginDrag().

Referenced by OnMouseMove().

void GList::OnItemClick ( GListItem Item,
GMouse m 
) [virtual]

Called when an item is clicked.

Parameters:
Item  The item clicked
m  The mouse parameters for the click

References GListItem::OnMouseClick().

Referenced by OnMouseClick().

void GList::OnItemSelect ( GArray< GListItem * > &  Items  )  [virtual]

Called when the user selects an item. If multiple items are selected in one hit this is only called for the first item. Use GetSelection to get the extent of the selected items.

Parameters:
Items  The item selected

References GHashTbl< Key, Value >::Add(), GHashTbl< Key, Value >::Find(), GLIST_NOTIFY_SELECT, GArray< Type >::Length(), and GView::SendNotify().

Referenced by OnMouseClick(), Remove(), RemoveAll(), and GListItem::Select().

int GList::OnNotify ( GViewI *  Ctrl,
int  Flags 
)

Called when a child view or view with it's SetNotify() set to this window changes.

The event by default will bubble up to the GWindow at the top of the window heirarchy visiting each GView on the way. If it reaches a GView that processes it then the event stops propergating up the heirarchy.

Reimplemented from GLayout.

References GLayout::HScroll, IDC_HSCROLL, IDC_VSCROLL, GView::Invalidate(), and GLayout::VScroll.

void GList::OnPulse (  ) 

Called every so often by the timer system.

See also:
SetPulse()

Reimplemented from GView.

References GView::GetMouse(), GView::IsCapturing(), GView::Lock(), GListItem::ScrollTo(), GView::SetPulse(), GView::Unlock(), GMeasureInfo::y, GView::Y(), and GMouse::y.

void GList::SetMode ( GListMode  m  ) 

Set the display mode.

See also:
GListMode

References GView::Invalidate(), and GView::IsAttached().

void GList::Sort ( GListCompareFunc  Compare,
int  Data 
)

Sort the list.

Parameters:
Compare  The comparision function. Should return a integer greater then > 0 if the first item item is greater in value.
Data  User defined 32-bit value passed through to the 'Compare' function

References GView::Invalidate(), GView::Lock(), and GView::Unlock().


The documentation for this class was generated from the following files:

Generated on Wed Dec 1 15:41:03 2010 for Lgi by  doxygen 1.5.7.1