wxMaxima
Loading...
Searching...
No Matches
CharButton.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
23#ifndef CHARBUTTON_H
24#define CHARBUTTON_H
25
31#include "precomp.h"
32#include "StringUtils.h"
33#include "Configuration.h"
34#include <wx/panel.h>
35#include <wx/stattext.h>
36
40class CharButton : public wxPanel
41{
42public:
45 {
46 wchar_t symbol = {};
47 const wxString description = wxm::emptyString;
48 bool matchesMaximaCommand = false;
49 };
50
57 CharButton(wxWindow *parent, wxWindow *worksheet, Configuration *config,
58 const Definition &def,
59 bool forceShow = false);
60 wxWindow *GetTextObject() const { return m_buttonText; }
63 void ActivateButton();
64#if wxUSE_ACCESSIBILITY
67 wxString GetAccessibleLabel() const {
68 return m_description.IsEmpty() ? wxString(m_char) : m_description;
69 }
70#endif
77 void UpdateMinSize();
78protected:
79 wchar_t m_char;
80 Configuration *m_configuration;
81 void CharButtonPressed(wxMouseEvent &event);
82 void OnSize(wxSizeEvent &event);
83 void OnIdleEvent(wxIdleEvent &event);
84 void MouseOverPanel(wxMouseEvent &event);
85 void MouseOverText(wxMouseEvent &event);
86 void MouseLeftPanel(wxMouseEvent &event);
87 void MouseLeftText(wxMouseEvent &event);
88protected:
89 void MouseOverTextIs(bool mouseOver = true);
90 void MouseOverPanelIs(bool mouseOver = true);
91 wxString m_description;
92
93private:
94 bool m_mouseOverPanel = false;
95 bool m_mouseOverText = false;
96 bool m_backgroundColorChangeNeeded = false;
97 wxStaticText *m_buttonText;
98 wxWindow *m_worksheet;
99};
100
101#endif // CHARBUTTON_H
This class generates a pane containing the last commands that were issued.
Definition: CharButton.h:41
void UpdateMinSize()
Sets the min size the button needs to show its symbol.
Definition: CharButton.cpp:164
void ActivateButton()
Emit this button's symbol to the worksheet – the button's action, shared by the mouse handler and the...
Definition: CharButton.cpp:101
The configuration storage for the current worksheet.
Definition: Configuration.h:101
A definition of this button, used to construct it.
Definition: CharButton.h:45
wchar_t symbol
The unicode symbol.
Definition: CharButton.h:46
bool matchesMaximaCommand
Whether this symbol is automatically translated into a maxima command/operator.
Definition: CharButton.h:48
const wxString description
The help text for the symbol.
Definition: CharButton.h:47