NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
treesearchctrl.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2019 Erik Haenel et al.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17******************************************************************************/
18
19#ifndef TREESEARCHCTRL_HPP
20#define TREESEARCHCTRL_HPP
21
22#include "searchctrl.hpp"
23#include <wx/wx.h>
24#include <wx/treectrl.h>
25#include "treelistctrl.h"
26
27
33{
34 private:
35 wxTreeCtrl* m_associatedCtrl;
37
38 protected:
39 // Interaction functions with the wxTreeCtrl
40 virtual bool selectItem(const wxString& value) override;
41 wxTreeItemId findItem(const wxString& value, wxTreeItemId node);
42 virtual wxArrayString getCandidates(const wxString& enteredText) override;
43 wxArrayString getChildCandidates(const wxString& enteredText, wxTreeItemId node);
44
45 public:
46 TreeSearchCtrl(wxWindow* parent, wxWindowID id, const wxString& hint = wxEmptyString, const wxString& calltip = wxEmptyString, wxTreeCtrl* associatedCtrl = nullptr, bool searchToolTip = false) : SearchCtrl(parent, id, wxEmptyString), m_associatedCtrl(associatedCtrl), m_searchToolTip(searchToolTip)
47 {
48 // Provide a neat hint to the user, what he
49 // may expect from this control
50 SetHint(hint);
51 popUp->SetCallTips(calltip);
52 }
53
54};
55
56#endif // TREESEARCHCTRL_HPP
57
58
Implementation of a generic search control based on a combo box.
Definition: searchctrl.hpp:135
SearchCtrlPopup * popUp
Definition: searchctrl.hpp:143
void SetCallTips(const wxString &calltip, const wxString &calltiphighlight=wxEmptyString)
Sets the calltips for the popup list.
Definition: searchctrl.hpp:119
This class specializes the generic search control to interact with a wxTreeCtrl.
virtual bool selectItem(const wxString &value) override
This method searches and selects the item with the passed label in the associated tree.
TreeSearchCtrl(wxWindow *parent, wxWindowID id, const wxString &hint=wxEmptyString, const wxString &calltip=wxEmptyString, wxTreeCtrl *associatedCtrl=nullptr, bool searchToolTip=false)
virtual wxArrayString getCandidates(const wxString &enteredText) override
This method returns an array of strings containing possible candidates for the passed search string.
wxTreeCtrl * m_associatedCtrl
wxTreeItemId findItem(const wxString &value, wxTreeItemId node)
This method searches for the tree item, whose label corresponds to the passed string.
wxArrayString getChildCandidates(const wxString &enteredText, wxTreeItemId node)
This method returns an array of strings containing possible candiates for the passed search string,...