Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 97 lines (78 sloc) 2.52 KB
* Copyright (C) 2009, Alexander Stigsen,
* This software is licensed under the Open Company License as described
* in the file license.txt, which you should have received as part of this
* distribution. The terms are also available at
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
#ifndef __SYMBOLLIST_H__
#define __SYMBOLLIST_H__
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include <wx/panel.h>
#include <wx/textctrl.h>
#include "SearchListBox.h"
#include "IEditorSymbols.h"
#include <vector>
class IFrameSymbolService;
class SymbolList : public wxPanel {
SymbolList(IFrameSymbolService& services, bool keepOpen=true);
bool Destroy();
void LoadFilters();
void OnIdle(wxIdleEvent& event);
void OnSearch(wxCommandEvent& event);
void OnAction(wxCommandEvent& event);
void OnSearchChar(wxKeyEvent& event);
class ActionList : public SearchListBox {
ActionList(wxWindow* parent, wxWindowID id, const wxArrayString& actions);
void SetAllItems();
void Find(const wxString& text, bool refresh=true);
int GetSelectedAction() const;
void OnDrawItem(wxDC& dc, const wxRect& rect, size_t n) const;
void OnLeftDown(wxMouseEvent& event);
class aItem {
aItem() : id(0), action(NULL), rank(0) {};
aItem(unsigned int id, const wxString* a, const std::vector<unsigned int>& hl)
: id(id), action(a), hlChars(hl), rank(SearchListBox::CalcRank(hl)) {};
bool operator<(const aItem& ai) const {
if (rank < ai.rank) return true;
else if (rank > ai.rank) return false;
else if (action && ai.action) return *action < *ai.action;
else return false;
unsigned int id;
const wxString* action;
std::vector<unsigned int> hlChars;
unsigned int rank;
const wxArrayString& m_actions;
std::vector<aItem> m_items;
wxString m_searchText;
// Member variables
IFrameSymbolService& m_parentFrame;
wxTextCtrl* m_searchCtrl;
ActionList* m_listBox;
// Editor state
IEditorSymbols* m_editorSymbols;
EditorChangeState m_editorChangeState;
bool m_keepOpen;
std::vector<SymbolRef> m_symbols;
wxArrayString m_symbolStrings;
std::vector<wxString> m_regexFilters;
wxString m_filters;
#endif // __SYMBOLLIST_H__