1
//--------------------------------------------------------------------------------------
2
// LenMus Phonascus: The teacher of music
3
// Copyright (c) 2002-2010 LenMus project
5
// This file is based on file awx/button.h from AWX 0.2 (Additional wxWindow Classes),
6
// downloaded from http://www.iftools.com/awx.en.html
8
// Author: Joachim Buermann
9
// Copyright: (c) 2003,2004 Joachim Buermann
10
// Original licence: wxWindows
11
// More info $Id: button.h,v 1.3 2004/08/30 10:20:19 jb Exp $
17
// This program is free software; you can redistribute it and/or modify it under the
18
// terms of the GNU General Public License as published by the Free Software Foundation,
19
// either version 3 of the License, or (at your option) any later version.
21
// This program is distributed in the hope that it will be useful, but WITHOUT ANY
22
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
23
// PARTICULAR PURPOSE. See the GNU General Public License for more details.
25
// You should have received a copy of the GNU General Public License along with this
26
// program. If not, see <http://www.gnu.org/licenses/>.
28
// For any comment, suggestion or feature request, please contact the manager of
29
// the project at cecilios@users.sourceforge.net
31
//-------------------------------------------------------------------------------------
32
#ifndef __LM_BUTTON_H__
33
#define __LM_BUTTON_H__
35
//#include <wx/dcmemory.h>
38
enum lmEButtonBorder {
47
class lmBitmapButton : public wxWindow
50
DECLARE_DYNAMIC_CLASS(lmBitmapButton)
53
lmBitmapButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
54
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
56
virtual ~ lmBitmapButton();
58
virtual void Disable();
59
virtual void Enable();
60
virtual bool Enable(bool enable) {
65
virtual bool IsPressed() {return m_state == lm_eButtonDown;};
66
bool IsEnabled() {return m_enabled;};
67
virtual void OnPaint(wxPaintEvent &event);
68
virtual void OnEraseBackground(wxEraseEvent &event);
69
virtual void OnMouseEvent(wxMouseEvent& event);
70
virtual void OnSizeEvent(wxSizeEvent& event);
72
virtual bool Release();
73
virtual void SetText(const wxChar* text);
74
virtual void SetBorderDown(lmEButtonBorder nBorderType) { m_nBorderDown = nBorderType; }
75
virtual void SetBorderOver(lmEButtonBorder nBorderType) { m_nBorderOver = nBorderType; }
77
virtual void SetBitmapDown(const wxBitmap& bitmap);
78
virtual void SetBitmapOver(const wxBitmap& bitmap);
80
virtual void SetBitmapUp(wxString sBmpName, wxString sBg, wxSize size);
81
virtual void SetBitmapDown(wxString sBmpName, wxString sBg, wxSize size);
82
virtual void SetBitmapOver(wxString sBmpName, wxString sBg, wxSize size);
83
virtual void SetBitmapDisabled(wxString sBmpName, wxString sBg, wxSize size);
96
wxBitmap CreateBitmap(wxString sBmpName, wxString sBg, wxSize size);
98
void Create(const wxPoint& pos, const wxSize& size);
109
lmEButtonState m_state;
110
lmEButtonState m_laststate;
115
wxBitmap m_bitmaps[4];
117
lmEButtonBorder m_nBorderDown;
118
lmEButtonBorder m_nBorderOver;
121
DECLARE_EVENT_TABLE()
124
class lmCheckButton : public lmBitmapButton
127
lmCheckButton(wxWindow* parent, wxWindowID id, const wxBitmap& bitmap,
128
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
130
virtual void OnMouseEvent(wxMouseEvent& event);
131
virtual bool Press();
132
virtual bool Release();
138
DECLARE_EVENT_TABLE()
142
#endif // __LM_BUTTON_H__