1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  */
5 
6 #ifndef OCCURRENCESHIGHLIGHTING_H_INCLUDED
7 #define OCCURRENCESHIGHLIGHTING_H_INCLUDED
8 
9 // For compilers that support precompilation, includes <wx/wx.h>
10 #include <wx/wxprec.h>
11 
12 #ifndef WX_PRECOMP
13     #include <wx/wx.h>
14 #endif
15 
16 #include <set>
17 
18 #include <cbplugin.h>
19 
20 class Highlighter;
21 class OccurrencesPanel;
22 
23 class OccurrencesHighlighting : public cbPlugin
24 {
25     public:
26         OccurrencesHighlighting();
27         virtual ~OccurrencesHighlighting();
28 
29         virtual void BuildMenu(wxMenuBar* menuBar);
30         virtual void BuildModuleMenu(const ModuleType type, wxMenu* menu, const FileTreeData* data = 0);
BuildToolBar(cb_unused wxToolBar * toolBar)31         virtual bool BuildToolBar(cb_unused wxToolBar* toolBar){ return false; }
32         virtual cbConfigurationPanel* GetConfigurationPanel(wxWindow* parent);
GetConfigurationPriority()33         virtual int GetConfigurationPriority() const { return 50; }
GetConfigurationGroup()34         virtual int GetConfigurationGroup() const { return cgEditor; }
35 
36 
37     protected:
38         virtual void OnAttach();
39         virtual void OnRelease(bool appShutDown);
40 
41     private:
42         void OnListKeyDown(wxListEvent &event);
43 
44     private:
45         void OnViewOccurrencesPanel(wxCommandEvent& event);
46         void OnUpdateViewMenu(wxUpdateUIEvent &event);
47         void OnHighlightPermanently(wxCommandEvent &event);
48         void OnHighlightRemove(wxCommandEvent &event);
49         void OnRemove(wxCommandEvent &event);
50         void OnPanelPopupMenu(wxContextMenuEvent &event);
51 
52         void OnEditorHook(cbEditor* editor, wxScintillaEvent& event);
53         void OnEditorEvent(CodeBlocksEvent& event);
54     private:
55         wxString GetWordAtCaret()const;
56         void RemoveSelected();
57         void UpdatePanel();
58 
59 
60     private:
61         int m_FunctorId;
62         Highlighter *m_pHighlighter;
63 
64         OccurrencesPanel *m_pPanel;
65         wxMenu* m_pViewMenu;
66 
67         std::set<wxString> m_texts;
68 
69     private:
70         DECLARE_EVENT_TABLE();
71 };
72 
73 #endif // OCCURRENCESHIGHLIGHTING_H_INCLUDED
74