NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
toolbarsearchctrl.hpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2020 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 TOOLBARSEARCHCTRL_HPP
20#define TOOLBARSEARCHCTRL_HPP
21
22#include "searchctrl.hpp"
23#include "../../kernel/core/datamanagement/database.hpp"
24
25class NumeReWindow;
26class NumeReTerminal;
27
28
36{
37 private:
41
42 protected:
43 // Interaction functions with the wxTreeCtrl
44 virtual bool selectItem(const wxString& value) override;
45 virtual wxString getDragDropText(const wxString& value) override;
46 virtual wxArrayString getCandidates(const wxString& enteredText) override;
47
48 public:
49 ToolBarSearchCtrl(wxWindow* parent, wxWindowID id, const NumeRe::DataBase& db, NumeReWindow* _mainframe, NumeReTerminal* _term, const wxString& hint = wxEmptyString, const wxString& calltip = wxEmptyString, const wxString& calltiphighlight = wxEmptyString, int width = 300, int extension = 200) : SearchCtrl(parent, id, wxEmptyString, 0)
50 {
51 // Provide a neat hint to the user, what he
52 // may expect from this control
53 SetHint(hint);
54 searchDB = db;
55 m_mainframe = _mainframe;
56 m_terminal = _term;
57
58 // Define size and additional extent
59 // (20 additional pixels for the scroll bar)
60 SetSize(wxSize(width, -1));
61 SetPopupExtents(0, extension+20);
62
63 // Define the number of columns
64 wxArrayInt sizes;
65 sizes.Add(130, 1);
66 sizes.Add(width + extension - 130, 1);
67
68 popUp->SetColSizes(sizes);
69 popUp->EnableDragDrop(true);
70 popUp->EnableColors(true);
71 popUp->SetCallTips(calltip, calltiphighlight);
72 }
73};
74
75
76
77#endif // TOOLBARSEARCHCTRL_HPP
78
79
80
This class is an implementation of a database. It will handle the *.ndb data format an provides an in...
Definition: database.hpp:37
The terminal class for the GUI. It's a specialisation of the GenericTerminal.
Definition: terminal.hpp:46
This class is the actual NumeRe main frame. The application's logic is implemented here.
Definition: NumeReWindow.h:177
Implementation of a generic search control based on a combo box.
Definition: searchctrl.hpp:135
SearchCtrlPopup * popUp
Definition: searchctrl.hpp:143
void EnableDragDrop(bool enable)
Enable or disable the drag-drop feature of this control.
Definition: searchctrl.hpp:93
void SetColSizes(const wxArrayInt &sizes)
Change the column sizes. Will create as many columns as fields are in the array.
Definition: searchctrl.hpp:80
void EnableColors(bool enable)
Enables or disables coloring of functions in blue.
Definition: searchctrl.hpp:106
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 be placed in the toolbar and to use the internal...
virtual wxArrayString getCandidates(const wxString &enteredText) override
This method returns an array of strings containing possible candidates for the passed search string.
NumeReWindow * m_mainframe
ToolBarSearchCtrl(wxWindow *parent, wxWindowID id, const NumeRe::DataBase &db, NumeReWindow *_mainframe, NumeReTerminal *_term, const wxString &hint=wxEmptyString, const wxString &calltip=wxEmptyString, const wxString &calltiphighlight=wxEmptyString, int width=300, int extension=200)
virtual wxString getDragDropText(const wxString &value) override
This member function provides the text to be inserted, when the user drag-drops one of the results....
virtual bool selectItem(const wxString &value) override
This member function performs the actions necessary, when the user selects an item in the popup list ...
NumeReTerminal * m_terminal
NumeRe::DataBase searchDB