wxMaxima
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Member Functions
TableOfContents Class Reference

This class generates a pane containing the table of contents. More...

#include <TableOfContents.h>

Inheritance diagram for TableOfContents:
[legend]
Collaboration diagram for TableOfContents:
[legend]

Public Member Functions

 TableOfContents (wxWindow *parent, int id, Configuration *config, std::unique_ptr< GroupCell > *tree)
 
void OnMouseRightDown (wxListEvent &event)
 
void OnRegExEvent (wxCommandEvent &ev)
 What happens if someone changes the search box contents.
 
void UpdateTableOfContents (GroupCell *pos)
 Update the structure information from the tree.
 
GroupCellGetCell (std::size_t index)
 Get the nth Cell in the table of contents.
 
GroupCellRightClickedOn ()
 Returns the cell that was last right-clicked on.
 
GroupCellDNDStart ()
 
GroupCellDNDEnd ()
 

Static Public Member Functions

static long ClampDropIndex (long hitIndex, int itemCount, std::size_t numberOfCaptionsDragged)
 Clamp a hit-tested drop position to a valid target.
 

Protected Member Functions

void OnSize (wxSizeEvent &event)
 
void OnDragStart (wxListEvent &evt)
 
void OnMouseUp (wxMouseEvent &evt)
 
void OnMouseCaptureLost (wxMouseCaptureLostEvent &event)
 
void OnMouseMotion (wxMouseEvent &event)
 
void OnTimer (wxTimerEvent &event)
 
wxString TocEntryString (GroupCell *cell)
 

Detailed Description

This class generates a pane containing the table of contents.

Member Function Documentation

◆ ClampDropIndex()

long TableOfContents::ClampDropIndex ( long  hitIndex,
int  itemCount,
std::size_t  numberOfCaptionsDragged 
)
static

Clamp a hit-tested drop position to a valid target.

hitIndex is tested against the pre-drop item count: once the dragged block of numberOfCaptionsDragged items is removed, only itemCount - numberOfCaptionsDragged "other" items are left, so dropping at or past that many means "move to the end of the list" – clamp to that boundary itself. (A negative hitIndex, meaning HitTest() found no item there, passes through unchanged.) Shared by OnMouseMotion() and OnMouseUp(), and exposed as a pure function so it can be unit-tested without needing to synthesize real mouse events – see test_TableOfContentsDnD.cpp.

◆ UpdateTableOfContents()

void TableOfContents::UpdateTableOfContents ( GroupCell pos)

Update the structure information from the tree.

Since this function traverses the tree and we don't want it to impact the performance too much

  • we call it only on creation of a cell and on leaving it again
  • and we only traverse the tree if the pane is actually shown.

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