Fcitx
Public Member Functions | List of all members
fcitx::CommonCandidateList Class Reference

A common simple candidate list that serves most of the purpose. More...

#include <fcitx/candidatelist.h>

Inheritance diagram for fcitx::CommonCandidateList:
Inheritance graph
[legend]
Collaboration diagram for fcitx::CommonCandidateList:
Collaboration graph
[legend]

Public Member Functions

void clear ()
 
void setLabels (const std::vector< std::string > &labels={})
 Set the label of candidate list. More...
 
void setSelectionKey (const KeyList &keyList)
 Set the label of candidate list by key. More...
 
void setPageSize (int size)
 
int pageSize () const
 
void setLayoutHint (CandidateLayoutHint hint)
 
void setGlobalCursorIndex (int index)
 
int globalCursorIndex () const
 Return Global cursor index. More...
 
void setCursorIndex (int index)
 Set cursor index on current page. More...
 
const fcitx::Textlabel (int idx) const override
 
const CandidateWordcandidate (int idx) const override
 
int cursorIndex () const override
 
int size () const override
 
bool hasPrev () const override
 
bool hasNext () const override
 
void prev () override
 
void next () override
 
bool usedNextBefore () const override
 
int totalPages () const override
 
int currentPage () const override
 
void setPage (int page) override
 
CandidateLayoutHint layoutHint () const override
 
const CandidateWordcandidateFromAll (int idx) const override
 If idx is out of range, it may raise exception. More...
 
int totalSize () const override
 It's possible for this function to return -1 if the implement has no clear number how many candidates are available.
 
void insert (int idx, std::unique_ptr< CandidateWord > word) override
 
void remove (int idx) override
 
void replace (int idx, std::unique_ptr< CandidateWord > word) override
 
void move (int from, int to) override
 
void prevCandidate () override
 
void nextCandidate () override
 
void setCursorIncludeUnselected (bool)
 
void setCursorKeepInSamePage (bool)
 
void setCursorPositionAfterPaging (CursorPositionAfterPaging afterPaging)
 
void setActionableImpl (std::unique_ptr< ActionableCandidateList > actionable)
 Set an optional implementation of actionable candidate list. More...
 
void setTabbedImpl (std::unique_ptr< TabbedCandidateList > tabbed)
 Set an optional implementation of tabbed candidate list. More...
 
void setFilter (const std::function< bool(const CandidateWord &)> &filterFunc)
 Set a filter function for the candidate list. More...
 
void clearFilter ()
 Clear the filter function for the candidate list. More...
 
const CandidateWordoriginCandidate (size_t idx) const
 Return the candidate at the specified index, ignore filter. More...
 
size_t originSize () const
 Return the total number of candidates, ignore filter. More...
 
- Public Member Functions inherited from fcitx::CandidateList
bool empty () const
 
PageableCandidateListtoPageable () const
 
BulkCandidateListtoBulk () const
 
ModifiableCandidateListtoModifiable () const
 
CursorMovableCandidateListtoCursorMovable () const
 
CursorModifiableCandidateListtoCursorModifiable () const
 
BulkCursorCandidateListtoBulkCursor () const
 
ActionableCandidateListtoActionable () const
 
TabbedCandidateListtoTabbed () const
 Cast to TabbedCandidateList if available. More...
 
- Public Member Functions inherited from fcitx::ModifiableCandidateList
void append (std::unique_ptr< CandidateWord > word)
 
template<typename CandidateWordType , typename... Args>
void append (Args &&...args)
 

Additional Inherited Members

- Protected Member Functions inherited from fcitx::CandidateList
void setPageable (PageableCandidateList *list)
 
void setBulk (BulkCandidateList *list)
 
void setModifiable (ModifiableCandidateList *list)
 
void setCursorMovable (CursorMovableCandidateList *list)
 
void setCursorModifiable (CursorModifiableCandidateList *list)
 
void setBulkCursor (BulkCursorCandidateList *list)
 
void setActionable (ActionableCandidateList *list)
 
void setTabbed (TabbedCandidateList *list)
 Set the TabbedCandidateList implementation. More...
 

Detailed Description

A common simple candidate list that serves most of the purpose.

Definition at line 336 of file candidatelist.h.

Member Function Documentation

◆ candidateFromAll()

const CandidateWord & fcitx::CommonCandidateList::candidateFromAll ( int  idx) const
overridevirtual

If idx is out of range, it may raise exception.

Catching the exception is useful to iterate over all candidate list for candidate list has no total size.

Implements fcitx::BulkCandidateList.

Definition at line 676 of file candidatelist.cpp.

◆ clearFilter()

void fcitx::CommonCandidateList::clearFilter ( )

Clear the filter function for the candidate list.

Since
5.1.20
See also
CommonCandidateList::setFilter

Definition at line 841 of file candidatelist.cpp.

◆ globalCursorIndex()

int fcitx::CommonCandidateList::globalCursorIndex ( ) const

Return Global cursor index.

-1 means it is not selected.

Returns
cursor index.
Since
5.0.4

Definition at line 666 of file candidatelist.cpp.

◆ originCandidate()

const CandidateWord & fcitx::CommonCandidateList::originCandidate ( size_t  idx) const

Return the candidate at the specified index, ignore filter.

Parameters
idxIndex of the candidate.
Returns
Reference to the candidate.
Since
5.1.20

Definition at line 851 of file candidatelist.cpp.

◆ originSize()

size_t fcitx::CommonCandidateList::originSize ( ) const

Return the total number of candidates, ignore filter.

Returns
Total number of candidates.
Since
5.1.20
See also
totalSize

Definition at line 856 of file candidatelist.cpp.

◆ setActionableImpl()

void fcitx::CommonCandidateList::setActionableImpl ( std::unique_ptr< ActionableCandidateList actionable)

Set an optional implementation of actionable candidate list.

Since
5.1.10

Definition at line 807 of file candidatelist.cpp.

◆ setCursorIndex()

void fcitx::CommonCandidateList::setCursorIndex ( int  index)

Set cursor index on current page.

Parameters
indexindex on current page;
Since
5.1.9

Definition at line 659 of file candidatelist.cpp.

◆ setFilter()

void fcitx::CommonCandidateList::setFilter ( const std::function< bool(const CandidateWord &)> &  filterFunc)

Set a filter function for the candidate list.

Any modification to the candidate list may clear the filter, so it's better to set filter after all modification is done.

Parameters
filterFuncA function that takes a CandidateWord and returns a boolean. Only candidates for which the function returns true will be included.
Since
5.1.20

Definition at line 821 of file candidatelist.cpp.

◆ setLabels()

void fcitx::CommonCandidateList::setLabels ( const std::vector< std::string > &  labels = {})

Set the label of candidate list.

The labels less than 10 will be automatically filled with to empty ones up to 10 to be more error prone.

Parameters
labelslist of labels.
Since
5.0.4

Definition at line 513 of file candidatelist.cpp.

◆ setSelectionKey()

void fcitx::CommonCandidateList::setSelectionKey ( const KeyList &  keyList)

Set the label of candidate list by key.

Parameters
keyListlist of selection key

Definition at line 518 of file candidatelist.cpp.

◆ setTabbedImpl()

void fcitx::CommonCandidateList::setTabbedImpl ( std::unique_ptr< TabbedCandidateList tabbed)

Set an optional implementation of tabbed candidate list.

Parameters
tabbedpointer to TabbedCandidateList.
Since
5.1.20

Definition at line 814 of file candidatelist.cpp.


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