Code::Blocks  SVN r11506
ccmanager.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU Lesser General Public License, version 3
3  * http://www.gnu.org/licenses/lgpl-3.0.html
4  */
5 
6 #ifndef CCMANAGER_H
7 #define CCMANAGER_H
8 
9 #include "manager.h"
10 
11 #ifndef CB_PRECOMP
12  #include <wx/timer.h>
13  #include "cbplugin.h"
14 #endif
15 
17 class wxHtmlLinkEvent;
18 class wxHtmlWindow;
19 class wxListEvent;
20 class wxListView;
21 class wxScintillaEvent;
22 
47 class DLLIMPORT CCManager : public Mgr<CCManager>, wxEvtHandler
48 {
49  public:
50  friend class Mgr<CCManager>;
51  friend class Manager; // give Manager access to our private members
52 
58  cbCodeCompletionPlugin* GetProviderFor(cbEditor* ed = nullptr);
59 
64  void RegisterCallTipChars(const wxString& chars, cbCodeCompletionPlugin* registrant);
65 
66 
71  void RegisterAutoLaunchChars(const wxString& chars, cbCodeCompletionPlugin* registrant);
72 
74  void NotifyDocumentation();
76  void NotifyPluginStatus();
77 
79  void InjectAutoCompShow(int lenEntered, const wxString& itemList);
80 
85  bool ProcessArrow(int key);
86 
88  void UpdateEnvSettings();
89  private:
90  CCManager();
91  ~CCManager() override;
92 
94  void OnCompleteCode(CodeBlocksEvent& event);
95 
97  void OnDeactivateApp(CodeBlocksEvent& event);
99  void OnDeactivateEd(CodeBlocksEvent& event);
101  void OnEditorOpen(CodeBlocksEvent& event);
103  void OnEditorClose(CodeBlocksEvent& event);
104 
110  void OnEditorHook(cbEditor* ed, wxScintillaEvent& event);
111 
113  void OnEditorTooltip(CodeBlocksEvent& event);
114 
116  void OnShowCallTip(CodeBlocksEvent& event);
117 
119  void OnAutocompleteSelect(wxListEvent& event);
120 
122  void OnAutocompleteHide(wxShowEvent& event);
123 
129  void OnDeferredCallTipShow(wxCommandEvent& event);
130 
132  void OnDeferredCallTipCancel(wxCommandEvent& event);
133 
134 #ifdef __WXMSW__
135 
136  void OnPopupScroll(wxMouseEvent& event);
137 #endif // __WXMSW__
138 
140  void OnHtmlLink(wxHtmlLinkEvent& event);
141 
143  void OnTimer(wxTimerEvent& event);
144 
146  void OnMenuSelect(wxCommandEvent& event);
147 
149  void DoBufferedCC(cbStyledTextCtrl* stc);
150 
152  void DoHidePopup();
153 
155  void DoShowDocumentation(cbEditor* ed);
156 
158  void DoUpdateCallTip(cbEditor* ed);
159 
161  enum Direction { Previous, Next };
162 
164  void AdvanceTip(Direction direction);
165 
167  void DoShowTips(const wxStringVec& tips, cbStyledTextCtrl* stc, int pos, int argsPos, int hlStart, int hlEnd);
168 
170  void CallSmartIndentCCDone(cbEditor* ed);
171 
172  typedef std::map< cbCodeCompletionPlugin*, std::set<wxChar> > CCPluginCharMap;
173  CCPluginCharMap m_CallTipChars;
174  CCPluginCharMap m_AutoLaunchChars;
182  typedef std::vector<cbCodeCompletionPlugin::CCCallTip> CallTipVec;
183  CallTipVec m_CallTips;
184  CallTipVec::const_iterator m_CurCallTip;
185  std::map<int, size_t> m_CallTipChoiceDict;
186  std::map<int, size_t> m_CallTipFuzzyChoiceDict;
192 
193 #ifdef __WXMSW__
194 
198 #endif // __WXMSW__
199 
202 
208 
213 
214  int m_LastACLaunchState[2];
215 
219  std::vector<cbCodeCompletionPlugin::CCToken> m_AutocompTokens;
220 };
221 
222 #endif // CCMANAGER_H
wxHtmlWindow * m_pHtml
Documentation popup.
Definition: ccmanager.h:212
wxTimer m_AutocompSelectTimer
Definition: ccmanager.h:189
wxSize m_DocSize
Size of the documentation popup.
Definition: ccmanager.h:190
Base class for code-completion plugins.
Definition: cbplugin.h:732
std::vector< cbCodeCompletionPlugin::CCCallTip > CallTipVec
Definition: ccmanager.h:182
int m_LastTipPos
Last location a tool/call tip was displayed.
Definition: ccmanager.h:179
bool m_OwnsAutocomp
Do we control the current autocomplete popup?
Definition: ccmanager.h:181
wxTimer m_CallTipTimer
Definition: ccmanager.h:187
CCPluginCharMap m_AutoLaunchChars
Chars each plugin is interested in for autocomplete.
Definition: ccmanager.h:174
wxListView * m_pAutocompPopup
a handle to the autocomplete list window created by (wx)scintilla, needed under Windows to determine ...
Definition: ccmanager.h:197
int m_AutocompPosition
Location of caret when autocomplete timer starts, if caret is still there, launch autocomplete...
Definition: ccmanager.h:176
std::map< int, size_t > m_CallTipChoiceDict
Remember past choices.
Definition: ccmanager.h:185
std::map< cbCodeCompletionPlugin *, std::set< wxChar > > CCPluginCharMap
Definition: ccmanager.h:172
cbEditor * m_pLastEditor
Last editor operated on.
Definition: ccmanager.h:200
int m_EditorHookID
Definition: ccmanager.h:175
std::vector< cbCodeCompletionPlugin::CCToken > m_AutocompTokens
Cached autocomplete list.
Definition: ccmanager.h:219
UnfocusablePopupWindow * m_pPopup
Container for documentation popup.
Definition: ccmanager.h:207
std::vector< wxString > wxStringVec
Definition: globals.h:205
A generic Code::Blocks event.
Definition: sdk_events.h:20
#define DLLIMPORT
Definition: settings.h:16
int m_CallTipActive
Is CCManager currently displaying a calltip, and if so, where.
Definition: ccmanager.h:177
CallTipVec::const_iterator m_CurCallTip
Remember current choice.
Definition: ccmanager.h:184
wxTimer m_AutoLaunchTimer
Definition: ccmanager.h:188
wxPoint m_DocPos
Location of the documentation popup.
Definition: ccmanager.h:191
CCPluginCharMap m_CallTipChars
Chars each plugin is interested in for calltip state.
Definition: ccmanager.h:173
cbCodeCompletionPlugin * m_pLastCCPlugin
The plugin handling m_pLastEditor.
Definition: ccmanager.h:201
std::map< int, size_t > m_CallTipFuzzyChoiceDict
Remember past choices based on prefix.
Definition: ccmanager.h:186
int m_WindowBound
Right-most boundary the documentation popup is allowed to stretch to.
Definition: ccmanager.h:180
Definition: manager.h:183
Code Completion Plugin Manager.
Definition: ccmanager.h:47
int m_LastAutocompIndex
Index of currently selected entry in autocomplete popup.
Definition: ccmanager.h:178
A file editor.
Definition: cbeditor.h:43
Direction
User click the next or previous small button of the tip window.
Definition: ccmanager.h:161
CallTipVec m_CallTips
Cached calltips.
Definition: ccmanager.h:183