#include <GList.h>
Public Member Functions | |
GList (int id, int x, int y, int cx, int cy, const char *name="List") | |
Constructor. | |
const 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. | |
GListColumn * | AddColumn (const 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. | |
GListColumn * | ColumnAt (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'. | |
GListItem * | GetSelected () |
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'. | |
virtual bool | Delete (GListItem *p) |
Deletes the item 'p'. | |
virtual bool | Remove (GListItem *Obj) |
Remove the item 'Obj' but don't delete it. | |
bool | Insert (GListItem *p, int Index=-1, bool Update=true) |
Inserts the item 'p' at index 'Index'. | |
virtual bool | Insert (List< GListItem > &l, int Index=-1, bool Update=true) |
Insert a list of item. | |
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. | |
GListItem * | ItemAt (int Index) |
Returns the item at index 'Index'. | |
void | Sort (GListCompareFunc Compare, int Data) |
Sort the list. | |
virtual void | Empty () |
Removes all items from list and delete the objects. | |
virtual 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 |
GList::GList | ( | int | id, | |
int | x, | |||
int | y, | |||
int | cx, | |||
int | cy, | |||
const char * | name = "List" | |||
) |
Constructor.
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().
const 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().
Reimplemented from GLayout.
Called when an item is clicked.
Item | The item clicked |
m | The mouse parameters for the click |
References GListItem::OnMouseClick().
Referenced by OnMouseClick().
Called when the user selects an item and starts to drag it.
Item | The item being dragged |
m | The mouse parameters at the time |
References GItem::OnBeginDrag().
Referenced by OnMouseMove().
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.
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().
void GList::OnColumnClick | ( | int | Col, | |
GMouse & | m | |||
) | [virtual] |
Called when a column is clicked.
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.
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
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().
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(), GLayout::OnNotify(), and GLayout::VScroll.
void GList::OnPulse | ( | ) |
Called every so often by the timer system.
Reimplemented from GView.
References GView::GetMouse(), GView::IsCapturing(), GView::Lock(), GListItem::ScrollTo(), GView::SetPulse(), GView::Unlock(), GMeasureInfo::y, GView::Y(), and GMouse::y.
GListColumn * GList::AddColumn | ( | const char * | Name, | |
int | Width = 50 , |
|||
int | Where = -1 | |||
) |
Adds a column to the list.
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().
bool GList::AddColumn | ( | GListColumn * | Col, | |
int | Where = -1 | |||
) |
Adds a preexisting column to the control.
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().
void GList::DragColumn | ( | int | Index | ) |
Starts a column d'n'd operation with the column at index 'Index'
References GView::Capture().
GListMode GList::GetMode | ( | ) |
Get the display mode.
Referenced by GListItem::GetPos(), OnKey(), GListItem::OnMeasure(), GListItem::OnPaint(), and GListItem::ScrollTo().
void GList::SetMode | ( | GListMode | m | ) |
bool GList::Insert | ( | GListItem * | p, | |
int | Index = -1 , |
|||
bool | Update = true | |||
) |
Inserts the item 'p' at index 'Index'.
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, List< Type >::Insert(), GView::Invalidate(), GView::Lock(), GItem::OnInsert(), GListItem::Parent, GListItem::Select(), GView::SendNotify(), GView::Unlock(), GView::Y(), and GRect::y2.
Referenced by GXmlToUi::Convert().
Insert a list of item.
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().
void GList::Sort | ( | GListCompareFunc | Compare, | |
int | Data | |||
) |
Sort the list.
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().