wxMaxima
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 "precomp.h"
29 #include "Configuration.h"
30 #include "RegexCtrl.h"
31 #include <wx/wx.h>
32 #include <wx/timer.h>
33 #include <wx/listctrl.h>
34 #include <wx/dragimag.h>
35 #include <vector>
36 #include "GroupCell.h"
37 
38 #ifndef TABLEOFCONTENTS_H
39 #define TABLEOFCONTENTS_H
40 
41 enum
42 {
43  structure_ctrl_id = 4,
44  structure_regex_id
45 };
46 
50 class TableOfContents : public wxPanel
51 {
52 public:
53  enum PopIds
54  {
55  popid_Fold = wxID_HIGHEST + 1500,
56  popid_Unfold,
57  popid_SelectTocChapter,
58  popid_EvalTocChapter,
59  popid_ToggleTOCshowsSectionNumbers,
60  popid_tocLevel1,
61  popid_tocLevel2,
62  popid_tocLevel3,
63  popid_tocLevel4,
64  popid_tocLevel5,
65  popid_tocLevel6,
66  popid_tocdnd,
67  popid_tocMoveIn,
68  popid_tocMoveOut
69  };
70 
71  TableOfContents(wxWindow *parent, int id, Configuration **config, std::unique_ptr<GroupCell> *tree);
72 
73  /* The destructor
74  */
75  ~TableOfContents();
76 
77  void OnMouseRightDown(wxListEvent &event);
78 
80  void OnRegExEvent(wxCommandEvent &ev);
81 
90 
92  GroupCell *GetCell(long index);
93 
96  { return m_cellRightClickedOn; }
97 
98  GroupCell *DNDStart() {return m_dndStartCell;}
99  GroupCell *DNDEnd() {return m_dndEndCell;}
100 protected:
101  void OnSize(wxSizeEvent &event);
102  void OnDragStart(wxListEvent &evt);
103  void OnMouseUp(wxMouseEvent &evt);
104  void OnMouseCaptureLost(wxMouseCaptureLostEvent &event);
105  void OnMouseMotion(wxMouseEvent &event);
106  void OnTimer(wxTimerEvent &event);
107 
108  wxString TocEntryString(GroupCell *cell);
109 private:
110  void UpdateStruct();
111  std::unique_ptr<GroupCell> *m_tree;
112  GroupCell *m_dndStartCell;
113  GroupCell *m_dndEndCell;
114  wxTimer m_scrollUpTimer;
115  wxTimer m_scrollDownTimer;
116  wxDragImage *m_dragImage = NULL;
117  std::vector<GroupCell *> m_displayedGroupCells;
119  int m_numberOfCaptionsDragged;
120  GroupCell *m_cellRightClickedOn;
122  int m_dragStart = -1;
123  int m_dragStop = -1;
124  long m_dragCurrentPos = -1;
126  int m_dragFeedback_Last = -1;
128  long m_lastSelection;
129 
131  void UpdateDisplay();
132 
133  wxListCtrl *m_displayedItems;
134  RegexCtrl *m_regex;
136  wxArrayString m_items_old;
137  Configuration **m_configuration;
138 
139  std::vector<GroupCell *> m_structure;
140 };
141 
142 #endif // TABLEOFCONTENTS_H
GroupCell.h
TableOfContents::RightClickedOn
GroupCell * RightClickedOn()
Returns the cell that was last right-clicked on.
Definition: TableOfContents.h:95
TableOfContents
Definition: TableOfContents.h:50
Configuration
Definition: Configuration.h:83
TableOfContents::OnRegExEvent
void OnRegExEvent(wxCommandEvent &ev)
What happens if someone changes the search box contents.
Definition: TableOfContents.cpp:482
TableOfContents::UpdateTableOfContents
void UpdateTableOfContents(GroupCell *pos)
Definition: TableOfContents.cpp:256
GroupCell
Definition: GroupCell.h:68
TableOfContents::GetCell
GroupCell * GetCell(long index)
Get the nth Cell in the table of contents.
Definition: TableOfContents.cpp:431
RegexCtrl
Definition: RegexCtrl.h:34