Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
UppHub
Status & Roadmap
FAQ
Authors & License
Forums
Funding U++
Search on this site











SourceForge.net Logo

SourceForge.net Logo

GitHub Logo

Discord Logo

ColumnList

 

class ColumnList : public Ctrl, private CtrlFrame

 

This widget displays the same type of items in several columns. The number of columns can be altered by user action. It is typically used to display a list of files.

 

Public Method List

 

Event<> WhenLeftClick

This event is dispatched when the user clicks the widget with the left mouse button. Clicked item has the cursor.

 


 

Event<PointWhenLeftClickPos

Similar to WhenLeftClick but also provides the coordinates within the clicked item.

 


 

Event<> WhenLeftDouble

This event is dispatched when the user double-clicks the widget with the left mouse button.

 


 

Event<Bar&WhenBar

This event is dispatched when the user clicks the widget with the right mouse button. Client code can use this event to set a context menu.

 


 

Event<> WhenSel

This event is dispatched when the cursor, or selection status of the widget is changed.

 


 

int GetColumnItems() const

Returns the number of items that fit in a single column at current view size.

 


 

int GetColumnCx(int i = 0const

Returns the current width of column i.

 


 

int GetPageItems() const

Returns the number of items that fit into the current view size.

 


 

int GetItem(Point p)

Returns the item index for the given point of view area (accounts for the scrollbar position too).

 


 

Rect GetItemRect(int iconst

Returns the view rectangle of the item at i.

 


 

int GetCursor() const

Returns the current cursor position. If there is no cursor, returns a negative value.

 


 

void SetCursor(int c)

Sets the current cursor position. If c is out of range, it is "fixed" (negative becomes 0, >GetCount() becomes GetCount() - 1).

 


 

void KillCursor()

Cancels the cursor.

 


 

bool IsCursor() const

Tests whether cursor is at any item. Same as GetCursor() >= 0.

 


 

int GetSbPos() const

Returns the scrollbar position.

 


 

void SetSbPos(int y)

Sets the scrollbar position to y.

 


 

int GetScroll() const

Returns the scroll position.

 


 

void ScrollTo(int a)

Scrolls to position a.

 


 

void SetFrame(CtrlFrame& frame)

Sets the decorative frame of ColumnList to frame. This is required because ColumnList has special zero index (decorative) frame to provide RoundSize option. Decorative frame set by this method is used by this special rounding frame.

 


 

void Clear()

Empties the ColumnList.

 


 

void Add(const Value& val, bool canselect = true)

void Add(const Value& val, const Display& display, bool canselect = true)

void Add(const Value& key, const Value& val, bool canselect = true)

void Add(const Value& key, const Value& val, const Display& display, bool canselect = true)

Adds an item to the ColumnList. Optionally a key can be assigned to the item. If canselect is false, item cannot be selected. If specified, display is used to display the item (otherwise common display as set by SetDisplay method is used).

 


 

int GetCount() const

Returns the current number of items in the list.

 


 

const Value& Get(int iconst

const Value& operator[](int iconst

Returns the item with index i. If the item is previously assigned a key, then this method returns a reference to the key itself. Otherwise it is the same as GetValue.

 


 

const Value& GetValue(int iconst

Returns the  value of item with index i.

 


 

void Set(int ii, const Value& val, bool canselect = true)

void Set(int ii, const Value& val, const Display& display, bool canselect = true)

void Set(int ii, const Value& key, const Value& val, bool canselect = true)

void Set(int ii, const Value& key, const Value& val, const Display& display, bool canselect = true)

Sets the value of item at position ii. Optionally a key can be assigned to the item. If canselect is false, item cannot be selected. If specified, display is used to display the item (otherwise common display as set by SetDisplay method is used).

 


 

void Set(const Value& key, const Value& val, const Display& display, bool canselect = true)

void Set(const Value& key, const Value& val, bool canselect = true)

Sets the value of item with the key. If canselect is false, item cannot be selected. If specified, display is used to display the item (otherwise common display as set by SetDisplay method is used).

 


 

void Insert(int ii, const Value& val, bool canselect = true)

void Insert(int ii, const Value& val, const Display& display, bool canselect = true)

void Insert(int ii, const Value& key, const Value& val, bool canselect = true)

void Insert(int ii, const Value& key, const Value& val, const Display& display, bool canselect = true)

Inserts an item at position ii. Optionally a key can be assigned to the item. If canselect is false, item cannot be selected. If specified, display is used to display the item (otherwise common display as set by SetDisplay method is used).

 


 

void Remove(int ii)

Removes the item at position ii.

 


 

void Remove(const Value & key)

Removes the item with key.

 


 

void RemoveSelection()

Removes the selected item(s).

 


 

int GetSelectCount() const

Returns the number of selected items.

 


 

bool IsSelection() const

Test whether any items are selected.

 


 

void ClearSelection()

Clear the selection.

 


 

void SelectOne(int i, bool sel)

Sets the selection status for item at position i.

 


 

bool IsSelected(int iconst

Returns the selection status at position i.

 


 

bool IsSel(int iconst

If there is selection in the widget, returns true if i is selected, otherwise returns true if cursor is at i.

 


 

int Find(const Value& keyconst

Returns the position of item with key on success, and a negative value on failure.

 


 

void Sort(const ValueOrder& order)

Sorts list items.

 


 

ColumnList& Mode(int m)

Sets the view mode of ColumnList to m. Returns *this for method chaining. Currently there are three possible view modes: MODE_LIST, MODE_COLUMN, MODE_ROWS.

 


 

ColumnList& ListMode()

Puts the ColumnList into list mode. Same as Mode(MODE_LIST). Returns *this for method chaining.

 


 

ColumnList& RowMode()

Puts the ColumnList into row mode. Same as Mode(MODE_ROWS). Returns *this for method chaining.

 


 

ColumnList& ColumnMode()

Puts the ColumnList into column mode. Same as Mode(MODE_COLUMN). Returns *this for method chaining.

 


 

ColumnList& Columns(int n)

Sets the number of columns to n. (User action can change the number of columns by dragging the column boundary too). Returns *this for method chaining.

 


 

int GetColumns() const

Returns the column count.

 


 

ColumnList& ItemHeight(int cy)

Sets the item height in pixels. Returns *this for method chaining.

 


 

int GetItemHeight() const

Returns the value set by ItemHeight.

 


 

ColumnList& ItemWidth(int cx)

Sets the item width in pixels. Returns *this for method chaining.

 


 

int GetItemWidth() const

Returns the value set by ItemWidth.

 


 

ColumnList& RoundSize(bool b = true)

This mode visually changes the decorative frame of ColumnList so that there are no empty areas at the bottom of view (GetSize().cy % GetItemHeight()). Default is on. Returns *this for method chaining.

 


 

ColumnList& NoRoundSize()

Same as RoundSize(false). Returns *this for method chaining.

 


 

ColumnList& ClickKill(bool b = true)

In this mode, if user clicks on a view area that does not contain any items, cursor is canceled. Default is off. Returns *this for method chaining.

 


 

ColumnList& NoClickKill()

Same as ClickKill(false). Returns *this for method chaining.

 


 

ColumnList& SetDisplay(const Display& d)

Sets the display to be used for items to d, unless an item-specific display is specified in Add or Insert methods. Returns *this for method chaining.

 


 

ColumnList& NoBackground(bool b = true)

Sets the widget into transparent mode - background is not painted and Transparent is activated - a result, anything painted behind the widget is visible, allowing client code to provide any background it needs. Returns *this for method chaining.

 


 

ColumnList& Multi(bool b = true)

ColumnList& MultiSelect(bool b = true)

Enables or disables multiselection of items. Returns *this for method chaining.

 


 

bool IsMulti() const

bool IsMultiSelect() const

Returns the status of multiselection mode.

 


 

ColumnList& PopUpEx(bool b = true)

If active, enlarged small popup is displayed when mouse hovers over items that do not fit designated area (the area is smalled than Display::GetMinSize). Default is active.

 


 

ColumnList& NoPopUpEx()

Same as PopUpEx(false).

 


 

ColumnList& AutoHideSb(bool b = true)

Automatically hides the scrollbar if all of the items can fit into the widget's view. Returns *this for method chaining.

 


 

ColumnList& NoAutoHideSb()

Same as AutoHideSb(false). Returns *this for method chaining.

 


 

ColumnList& SetScrollBarStyle(const ScrollBar::Style& s)

Sets the scrollbar's visual style to s. Returns *this for method chaining.

 

Constructor detail

 

ColumnList()

Default constructor.

 

 

Do you want to contribute?