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
83 enum MaximaStatus
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 disconnected
96 };
97
98 void UpdateStatusMaximaBusy(MaximaStatus status, std::size_t bytesFromMaxima);
99 void SetStatusText(wxString statusText){m_statusText->SetLabel(statusText);}
100protected:
101 void StatusMsgDClick(wxCommandEvent &ev);
102 void OnSize(wxSizeEvent &event);
103 void OnTimerEvent(wxTimerEvent &event);
104
105 void HandleTimerEvent();
106
107private:
108 std::unique_ptr<struct wxm_NSVGrasterizer, decltype(std::free)*> m_svgRast{nullptr, std::free};
110 wxSize m_ppi = wxSize(75, 75);
115 float m_maximaPercentage = -1;
120 float m_oldmaximaPercentage = -1;
121 networkState m_oldNetworkState = receive;
122 wxString m_stdToolTip;
123 wxString m_networkErrToolTip;
124 wxString m_noConnectionToolTip;
126 networkState m_networkState = offline;
128 bool m_icon_shows_receive = false;
130 bool m_icon_shows_transmit = false;
132 wxPanel *m_statusTextPanel = NULL;
134 wxStaticText *m_statusText = NULL;
136 wxStaticBitmap *m_networkStatus = NULL;
138 wxStaticBitmap *m_maximaStatus = NULL;
140 wxBitmap m_network_error;
142 wxBitmap m_network_offline;
144 wxBitmap m_network_transmit;
146 wxBitmap m_network_idle;
148 wxBitmap m_network_idle_inactive;
150 wxBitmap m_network_receive;
152 wxBitmap m_network_transmit_receive;
154 wxTimer SendTimer;
156 wxTimer ReceiveTimer;
157
158 wxBitmap m_bitmap_waitForStart;
159 wxBitmap m_bitmap_process_wont_start;
160 wxBitmap m_bitmap_sending;
161 wxBitmap m_bitmap_waiting;
162 wxBitmap m_bitmap_waitingForPrompt;
163 wxBitmap m_bitmap_waitingForAuth;
164 wxBitmap m_bitmap_calculating;
165 wxBitmap m_bitmap_parsing;
166 wxBitmap m_bitmap_transferring;
167 wxBitmap m_bitmap_userinput;
168 wxBitmap m_bitmap_disconnected;
169};
170
171#endif
172
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:112
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 NetworkStatus(networkState status)
Informs the status bar about networking events.
Definition: StatusBar.cpp:308