wxMaxima
Loading...
Searching...
No Matches
TableOfContents.h
Go to the documentation of this file.
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2009-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// (C) 2014-2018 Gunter Königsmann <wxMaxima@physikbuch.de>
5//
6// This program is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation; either version 2 of the License, or
9// (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20//
21// SPDX-License-Identifier: GPL-2.0+
22
28#include <memory>
29#include <wx/wx.h>
30#include <wx/timer.h>
31#include <wx/listctrl.h>
32#include <wx/dragimag.h>
33#include <vector>
34#include "precomp.h"
35#include "Configuration.h"
36#include "RegexCtrl.h"
37#include "cells/GroupCell.h"
38
39#ifndef TABLEOFCONTENTS_H
40#define TABLEOFCONTENTS_H
41
42enum
43{
44 structure_ctrl_id = 4,
45 structure_regex_id
46};
47
51class TableOfContents : public wxPanel
52{
53public:
54 TableOfContents(wxWindow *parent, int id, Configuration *config, std::unique_ptr<GroupCell> *tree);
55
56 /* The destructor
57 */
59
60 void OnMouseRightDown(wxListEvent &event);
61
63 void OnRegExEvent(wxCommandEvent &ev);
64
73
75 GroupCell *GetCell(std::size_t index);
76
79 { return m_cellRightClickedOn; }
80
81 GroupCell *DNDStart() {return m_dndStartCell;}
82 GroupCell *DNDEnd() {return m_dndEndCell;}
83protected:
84 void OnSize(wxSizeEvent &event);
85 void OnDragStart(wxListEvent &evt);
86 void OnMouseUp(wxMouseEvent &evt);
87 void OnMouseCaptureLost(wxMouseCaptureLostEvent &event);
88 void OnMouseMotion(wxMouseEvent &event);
89 void OnTimer(wxTimerEvent &event);
90
91 wxString TocEntryString(GroupCell *cell);
92private:
93 void UpdateStruct();
94 std::unique_ptr<GroupCell> *m_tree;
95 GroupCell *m_dndStartCell = NULL;
96 GroupCell *m_dndEndCell = NULL;
97 wxTimer m_scrollUpTimer;
98 wxTimer m_scrollDownTimer;
99 wxDragImage *m_dragImage = NULL;
100 std::vector<GroupCell *> m_displayedGroupCells;
102 std::size_t m_numberOfCaptionsDragged = 0;
103 GroupCell *m_cellRightClickedOn = NULL;
105 long m_dragStart = -1;
106 long m_dragStop = -1;
107 signed long m_dragCurrentPos = -1;
109 int m_dragFeedback_Last = -1;
111 long m_lastSelection;
112
114 void UpdateDisplay();
115
116 wxListCtrl *m_displayedItems;
117 RegexCtrl *m_regex;
119 wxArrayString m_items_old;
120 Configuration *m_configuration;
121
122 std::vector<GroupCell *> m_structure;
123};
124
125#endif // TABLEOFCONTENTS_H
This file defines the class GroupCell that bundles input and output in the worksheet.
The configuration storage for the current worksheet.
Definition: Configuration.h:85
A cell grouping input (and, if there is one, also the output) cell to a foldable item.
Definition: GroupCell.h:74
A BTextCtrl that allows to input a regex.
Definition: RegexCtrl.h:36
This class generates a pane containing the table of contents.
Definition: TableOfContents.h:52
GroupCell * GetCell(std::size_t index)
Get the nth Cell in the table of contents.
Definition: TableOfContents.cpp:409
void OnRegExEvent(wxCommandEvent &ev)
What happens if someone changes the search box contents.
Definition: TableOfContents.cpp:453
GroupCell * RightClickedOn()
Returns the cell that was last right-clicked on.
Definition: TableOfContents.h:78
void UpdateTableOfContents(GroupCell *pos)
Update the structure information from the tree.
Definition: TableOfContents.cpp:238