wxMaxima
Loading...
Searching...
No Matches
StatusBar.h
Go to the documentation of this file.
1// -*- mode: c++; c-file-style: "linux"; c-basic-offset: 2; indent-tabs-mode: nil -*-
2//
3// Copyright (C) 2009-2015 Andrej Vodopivec <andrej.vodopivec@gmail.com>
4// (C) 2014-2015 Gunter Königsmann <wxMaxima@physikbuch.de>
5//
6// This program is free software; you can redistribute it and/or modify
7// it under the terms of the GNU General Public License as published by
8// the Free Software Foundation; either version 2 of the License, or
9// (at your option) any later version.
10//
11// This program is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14// GNU General Public License for more details.
15//
16//
17// You should have received a copy of the GNU General Public License
18// along with this program; if not, write to the Free Software
19// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20//
21// SPDX-License-Identifier: GPL-2.0+
22
28#include "precomp.h"
29#include <wx/wx.h>
30#include <wx/bitmap.h>
31#include <wx/image.h>
32#include <wx/timer.h>
33#include <wx/statbmp.h>
34#include <wx/statusbr.h>
35#include <wx/stattext.h>
36#include <memory>
37
38#ifndef STATUSBAR_H
39#define STATUSBAR_H
40
41extern unsigned char GO_NEXT_SVG_GZ[];
42extern size_t GO_NEXT_SVG_GZ_SIZE;
43
46class StatusBar : public wxStatusBar
47{
48public:
49 StatusBar(wxWindow *parent, int id);
50 virtual ~StatusBar();
53 {
54 idle,
55 error,
56 offline,
57 receive,
58 transmit
59 };
60
62 void UpdateBitmaps();
63
65 void NetworkStatus(networkState status);
66
67 wxWindow *GetNetworkStatusElement()
68 { return m_networkStatus; }
69
70 wxWindow *GetStatusTextElement()
71 { return m_statusTextPanel; }
72
73 wxWindow *GetMaximaStatusElement()
74 { return m_maximaStatus; }
75
77 void SetMaximaCPUPercentage(float percentage)
78 {
79 m_maximaPercentage = percentage;
80 NetworkStatus(m_oldNetworkState);
81 }
82
84 {
85 wait_for_start,
86 process_wont_start,
87 sending,
88 waiting,
89 waitingForPrompt,
90 waitingForAuth,
91 calculating,
92 parsing,
93 transferring,
94 userinput,
95 maximaerror,
100 disconnected
101 };
102
103 void UpdateStatusMaximaBusy(MaximaStatus status, std::size_t bytesFromMaxima);
110 void SetStatusText(wxString statusText){
111 if (m_statusText->GetLabel() != statusText)
112 m_statusText->SetLabel(statusText);
113 }
114protected:
115 void StatusMsgDClick(wxMouseEvent &ev);
116 void OnSize(wxSizeEvent &event);
117 void OnTimerEvent(wxTimerEvent &event);
118
119 void HandleTimerEvent();
120
121private:
122 std::unique_ptr<struct wxm_NSVGrasterizer, decltype(std::free)*> m_svgRast{nullptr, std::free};
124 wxSize m_ppi = wxSize(75, 75);
129 float m_maximaPercentage = -1;
134 float m_oldmaximaPercentage = -1;
135 networkState m_oldNetworkState = receive;
136 wxString m_stdToolTip;
137 wxString m_networkErrToolTip;
138 wxString m_noConnectionToolTip;
140 networkState m_networkState = offline;
142 bool m_icon_shows_receive = false;
144 bool m_icon_shows_transmit = false;
145 bool m_overlayIconIsSet = false;
147 wxPanel *m_statusTextPanel = NULL;
149 wxStaticText *m_statusText = NULL;
151 wxStaticBitmap *m_networkStatus = NULL;
153 wxStaticBitmap *m_maximaStatus = NULL;
155 wxBitmap m_network_error;
157 wxBitmap m_network_offline;
159 wxBitmap m_network_transmit;
161 wxBitmap m_network_idle;
163 wxBitmap m_network_idle_inactive;
165 wxBitmap m_network_receive;
167 wxBitmap m_network_transmit_receive;
169 wxTimer SendTimer;
171 wxTimer ReceiveTimer;
172
173 wxBitmap m_bitmap_waitForStart;
174 wxBitmap m_bitmap_process_wont_start;
175 wxBitmap m_bitmap_sending;
176 wxBitmap m_bitmap_waiting;
177 wxBitmap m_bitmap_waitingForPrompt;
178 wxBitmap m_bitmap_waitingForAuth;
179 wxBitmap m_bitmap_calculating;
180 wxBitmap m_bitmap_parsing;
181 wxBitmap m_bitmap_transferring;
182 wxBitmap m_bitmap_userinput;
183 wxBitmap m_bitmap_debugging;
184 wxBitmap m_bitmap_lispmode;
185 wxBitmap m_bitmap_disconnected;
186};
187
188#endif
189
The class that draws the status bar.
Definition: StatusBar.h:47
void UpdateBitmaps()
Update the bitmaps to the Right size for the Resolution.
Definition: StatusBar.cpp:117
networkState
The network states that can be passed to NetworkStatus()
Definition: StatusBar.h:53
void SetMaximaCPUPercentage(float percentage)
Inform the status bar how many percents of the available CPU power maxima uses.
Definition: StatusBar.h:77
void SetStatusText(wxString statusText)
Set the left status text.
Definition: StatusBar.h:110
void NetworkStatus(networkState status)
Informs the status bar about networking events.
Definition: StatusBar.cpp:427
MaximaStatus
Definition: StatusBar.h:84
@ debugging
Maxima's Lisp is stopped in a debugger (e.g. sbcl's LDB).
Definition: StatusBar.h:97
@ lispmode
Maxima's reader is in Lisp mode (after to_lisp() / a MAXIMA> prompt).
Definition: StatusBar.h:99