NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
graphviewer.cpp
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2017 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
20#include "graphviewer.hpp"
21
22
23BEGIN_EVENT_TABLE(GraphViewer, ViewerFrame)
24 EVT_KEY_DOWN (ViewerFrame::OnKeyDown)
25 EVT_SET_FOCUS (ViewerFrame::OnFocus)
26// EVT_ENTER_WINDOW (ViewerFrame::OnEnter)
27 EVT_CLOSE (ViewerFrame::OnClose)
29
30
31GraphViewer::GraphViewer(wxWindow* parent, const wxString& title, GraphHelper* _helper, NumeReTerminal* terminal) : ViewerFrame(parent, title)
32{
33 wxBoxSizer* sizer = new wxBoxSizer(wxHORIZONTAL);
34 _grapherWindow = new wxMGL(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBORDER_THEME);
35
36 _grapherWindow->SetDraw(_helper);
37 _grapherWindow->SetGraph(_helper->setGrapher());
38
39 sizer->Add(_grapherWindow, 1, wxEXPAND);
40 double dHeight = sqrt(640.0*480.0 / _helper->getAspect());
41 if (_helper->getHires())
42 dHeight = sqrt(1280.0*960.0 / _helper->getAspect());
43 _grapherWindow->SetSize((int)lrint(_helper->getAspect()*dHeight), (int)lrint(dHeight));
44
45 this->SetSizer(sizer);
46 this->SetClientSize(_grapherWindow->GetSize());
47
48 m_terminal = terminal;
49}
50
51
This class encapsulates the mglGraph object during transmission from the kernel to the GUI.
The terminal class for the GUI. It's a specialisation of the GenericTerminal.
Definition: terminal.hpp:46
This class generalizes a set of basic floating window functionalities like being closable by pressing...
Definition: viewerframe.hpp:31
void OnFocus(wxFocusEvent &event)
This event handler passes the keyboard focus down to the first child in the window list,...
Definition: viewerframe.cpp:56
void OnClose(wxCloseEvent &event)
This event handler informs all child windows that this frame will now close. It furthermore automatic...
Definition: viewerframe.cpp:93
void OnKeyDown(wxKeyEvent &event)
This event handler closes the frame, if the user presses ESC.
Definition: viewerframe.cpp:38
Class is Wx widget which display MathGL graphics.
Definition: wx.h:39
END_EVENT_TABLE()