wxMaxima
UnicodeSidebar.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-2015 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 "RegexCtrl.h"
30 #include <wx/wx.h>
31 #include <wx/grid.h>
32 
33 #ifndef UNICODESIDEBAR_H
34 #define UNICODESIDEBAR_H
35 
39 class UnicodeSidebar : public wxPanel
40 {
41 public:
43  UnicodeSidebar(wxWindow *parent, wxWindow *worksheet);
44 
45  /* The destructor
46 
47  */
48  ~UnicodeSidebar();
49 
51  enum PopIds
52  {
53  popid_addToSymbols = wxID_HIGHEST + 3500,
54  };
55 
57  void OnRegExEvent(wxCommandEvent &ev);
59  void UpdateDisplay();
60 
61 protected:
63  void OnMenu(wxCommandEvent &event);
65  void OnPaint(wxPaintEvent &event);
67  void OnSize(wxSizeEvent &event);
69  void OnDClick(wxGridEvent &event);
71  void OnRightClick(wxGridEvent &event);
73  void OnChangeAttempt(wxGridEvent &event);
74 
75 private:
76  bool m_initialized;
77  long m_charRightClickedOn;
78  wxWindow *m_worksheet;
79  wxGrid *m_grid;
80  RegexCtrl *m_regex;
81 };
82 
84 class SidebarKeyEvent: public wxCommandEvent
85 {
86 public:
87  explicit SidebarKeyEvent(int id = 0)
88  : wxCommandEvent(id) { }
89 
90  explicit SidebarKeyEvent(const SidebarKeyEvent& event)
91  : wxCommandEvent(event) {}
92 };
93 
95 class SymboladdEvent: public wxCommandEvent
96 {
97 public:
98  explicit SymboladdEvent(int id = 0)
99  : wxCommandEvent(id) { }
100 
101  explicit SymboladdEvent(const SymboladdEvent& event)
102  : wxCommandEvent(event) {}
103 };
104 
105 wxDECLARE_EVENT(SIDEBARKEYEVENT, SidebarKeyEvent);
106 wxDECLARE_EVENT(SYMBOLADDEVENT, SymboladdEvent);
107 
108 #endif // UNICODESIDEBAR_H
SidebarKeyEvent
An event that simulates a keypress and can be issued by UnicodeSidebar.
Definition: UnicodeSidebar.h:84
SymboladdEvent
An event that can be issued by UnicodeSidebar and tells the symbols sidebar to add a symbol.
Definition: UnicodeSidebar.h:95
UnicodeSidebar
Definition: UnicodeSidebar.h:39
UnicodeSidebar::OnRegExEvent
void OnRegExEvent(wxCommandEvent &ev)
Is called if the RegEx changes.
Definition: UnicodeSidebar.cpp:183
UnicodeSidebar::OnRightClick
void OnRightClick(wxGridEvent &event)
Is called if the control is right-clicked at.
Definition: UnicodeSidebar.cpp:87
UnicodeSidebar::UnicodeSidebar
UnicodeSidebar(wxWindow *parent, wxWindow *worksheet)
The constructor.
Definition: UnicodeSidebar.cpp:46
UnicodeSidebar::OnMenu
void OnMenu(wxCommandEvent &event)
Is called if a menu item is selected.
Definition: UnicodeSidebar.cpp:101
UnicodeSidebar::OnChangeAttempt
void OnChangeAttempt(wxGridEvent &event)
Is called if the user tries to edit the control's text.
Definition: UnicodeSidebar.cpp:116
UnicodeSidebar::OnSize
void OnSize(wxSizeEvent &event)
Is called if the control is resized.
Definition: UnicodeSidebar.cpp:135
UnicodeSidebar::PopIds
PopIds
The popup menu IDs this sidebar uses.
Definition: UnicodeSidebar.h:51
UnicodeSidebar::OnDClick
void OnDClick(wxGridEvent &event)
Is called if the control is double-clicked at.
Definition: UnicodeSidebar.cpp:74
RegexCtrl
Definition: RegexCtrl.h:34
UnicodeSidebar::UpdateDisplay
void UpdateDisplay()
Update the display after the regex has changed.
Definition: UnicodeSidebar.cpp:121
UnicodeSidebar::OnPaint
void OnPaint(wxPaintEvent &event)
Is called if a paint command is issued.
Definition: UnicodeSidebar.cpp:145