Code::Blocks  SVN r11506
classbrowser.h
Go to the documentation of this file.
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 CLASSBROWSER_H
7 #define CLASSBROWSER_H
8 
9 #include <wx/panel.h>
10 
11 #include <settings.h> // SDK
12 #include <cbplugin.h>
13 #include <manager.h>
14 
15 #include "cctreectrl.h"
17 #include "parser/parser.h"
18 #include "parser/token.h"
19 
20 class NativeParser;
21 class wxComboBox;
22 class wxTreeCtrl;
23 class wxTextCtrl;
24 class cbProject;
25 
53 class ClassBrowser : public wxPanel
54 {
55 public:
60  ClassBrowser(wxWindow* parent, NativeParser* np);
61 
63  virtual ~ClassBrowser();
64 
70  void SetParser(ParserBase* parser);
71 
82  void UpdateClassBrowserView(bool checkHeaderSwap = false);
83 
87  void UpdateSash();
88 
89 private:
94 
96  void OnTreeItemRightClick(wxTreeEvent& event);
97 
98  // those are the handler for context menus
100  void OnJumpTo(wxCommandEvent& event);
101 
103  void OnRefreshTree(wxCommandEvent& event);
104 
106  void OnForceReparse(wxCommandEvent& event);
107 
109  void OnCBViewMode(wxCommandEvent& event);
110 
112  void OnCBExpandNS(wxCommandEvent& event);
113 
117  void OnViewScope(wxCommandEvent& event);
118 
120  void OnDebugSmartSense(wxCommandEvent& event);
121 
123  void OnSetSortType(wxCommandEvent& event);
124 
126  void OnSearch(wxCommandEvent& event);
127 
134  bool FoundMatch(const wxString& search, wxTreeCtrl* tree, const wxTreeItemId& item);
135 
147  wxTreeItemId FindNext(const wxString& search, wxTreeCtrl* tree, const wxTreeItemId& start);
148 
153  wxTreeItemId FindChild(const wxString& search, wxTreeCtrl* tree, const wxTreeItemId& start, bool recurse = false, bool partialMatch = false);
154 
158  bool RecursiveSearch(const wxString& search, wxTreeCtrl* tree, const wxTreeItemId& parent, wxTreeItemId& result);
159 
161  void ShowMenu(wxTreeCtrl* tree, wxTreeItemId id, const wxPoint& pt);
162 
166  void ThreadedBuildTree(cbProject* activeProject);
167 
172  void OnTreeItemExpanding(wxTreeEvent& event);
173 
174 #ifndef CC_NO_COLLAPSE_ITEM
175 
176  void OnTreeItemCollapsing(wxTreeEvent& event);
177 #endif // CC_NO_COLLAPSE_ITEM
178 
180  void OnTreeSelChanged(wxTreeEvent& event);
181 
187  void OnThreadEvent(wxCommandEvent& event);
188 
189 private:
190 
193 
196 
199 
202 
205 
208 
211 
216 
222 
223  DECLARE_EVENT_TABLE()
224 };
225 
226 #endif // CLASSBROWSER_H
wxTreeCtrl * m_TreeForPopupMenu
remember the context menu is created from which tree control, the upper or the bottom ...
Definition: classbrowser.h:201
void OnViewScope(wxCommandEvent &event)
the view scope choice has changed, user can switch between view everything, view a single file...
wxSemaphore m_ClassBrowserSemaphore
semaphore to synchronize the GUI(class browser) and the tree builder thread, when the GUI post the se...
Definition: classbrowser.h:215
void UpdateSash()
update the position sash bar between top tree and the bottom tree, the position (percentage) of the t...
ClassBrowserBuilderThread * m_ClassBrowserBuilderThread
a wxThread used to build the wxTreeCtrl for the top and bottom in the class(symbol) browser because i...
Definition: classbrowser.h:221
CCTreeCtrl * m_CCTreeCtrl
the top(main) level tree control, see above diagram for details
Definition: classbrowser.h:195
void OnThreadEvent(wxCommandEvent &event)
class browser builder thread will send notification event to the parent, this is the event handler fu...
void OnDebugSmartSense(wxCommandEvent &event)
whether print the debug log message
wxTreeItemId FindNext(const wxString &search, wxTreeCtrl *tree, const wxTreeItemId &start)
get the next item of the "start" item, if no next item in the current level, go up one level ...
worker thread to build the symbol browser tree controls(both the top tree and the bottom tree) When t...
void UpdateClassBrowserView(bool checkHeaderSwap=false)
update or refresh the symbol browser trees
ParserBase * m_Parser
a pointer to the associated parser object
Definition: classbrowser.h:207
ClassBrowser(wxWindow *parent, NativeParser *np)
class constructor
bool RecursiveSearch(const wxString &search, wxTreeCtrl *tree, const wxTreeItemId &parent, wxTreeItemId &result)
find an item whose item name matches the "search" key string in the sub-tree
void ThreadedBuildTree(cbProject *activeProject)
create a thread to update the symbol tree, if the thread is already created, just pause and resume th...
void OnTreeItemDoubleClick(wxTreeEvent &event)
handler for the mouse double click on a tree item, we usually make a jump to the associated token&#39;s p...
NativeParser * m_NativeParser
the pointer to parser manager object
Definition: classbrowser.h:192
void OnForceReparse(wxCommandEvent &event)
reparse the current project
wxString m_ActiveFilename
source file name of active editor, used for filtering(if view option is Current file&#39;s symbols) ...
Definition: classbrowser.h:210
void OnCBViewMode(wxCommandEvent &event)
user change the view mode (View Inheritance or View the bottom tree)
CCTreeCtrl * m_CCTreeCtrlBottom
the bottom tree control, mainly used to show the member variable and member functions ...
Definition: classbrowser.h:198
Represents a Code::Blocks project.
Definition: cbproject.h:96
void OnTreeItemRightClick(wxTreeEvent &event)
show a context menu
void OnRefreshTree(wxCommandEvent &event)
force rebuilding the tree
void OnJumpTo(wxCommandEvent &event)
the handler for jump to declaration or jump to definition menu item
void OnSetSortType(wxCommandEvent &event)
sort type changed
void OnCBExpandNS(wxCommandEvent &event)
whether automatically expand the namespace option switch
symbol browser panel is shown in the Management panel besides projects browser panel.
Definition: classbrowser.h:53
void ShowMenu(wxTreeCtrl *tree, wxTreeItemId id, const wxPoint &pt)
build and show a context menu when user right click on the tree item "id"
wxTreeItemId FindChild(const wxString &search, wxTreeCtrl *tree, const wxTreeItemId &start, bool recurse=false, bool partialMatch=false)
get a child of the parent item, which matches the "search" key
NativeParser class is just like a manager class to control Parser objects.
Definition: nativeparser.h:55
void OnTreeItemExpanding(wxTreeEvent &event)
expanding one node of top tree
void OnTreeItemCollapsing(wxTreeEvent &event)
collapse one node of the top tree
virtual ~ClassBrowser()
class destructor
bool FoundMatch(const wxString &search, wxTreeCtrl *tree, const wxTreeItemId &item)
string compare between the search and the token&#39;s name associated with item
void OnSearch(wxCommandEvent &event)
when user try to search a word in the symbols tree
void SetParser(ParserBase *parser)
Set the Parser object associated with the class browser.
void OnTreeSelChanged(wxTreeEvent &event)
item selection changed in the top tree