1
// -------------------------------------------------------------------------------- //
2
// Copyright (C) 2008-2010 J.Rios
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 2, or (at your option)
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.
15
// You should have received a copy of the GNU General Public License
16
// along with this program; see the file LICENSE. If not, write to
17
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18
// http://www.gnu.org/copyleft/gpl.html
20
// -------------------------------------------------------------------------------- //
24
#include <wx/control.h>
26
#define GURATING_STYLE_TINY 0
27
#define GURATING_STYLE_MID 1
28
#define GURATING_STYLE_BIG 2
30
#define GURATING_IMAGE_MINSIZE 12
31
#define GURATING_IMAGE_SEPARATION 1
32
#define GURATING_IMAGE_SIZE GURATING_IMAGE_MINSIZE + GURATING_IMAGE_SEPARATION
34
class guRatingEvent : public wxNotifyEvent
37
guRatingEvent( wxEventType commandType = wxEVT_NULL, int winid = 0 )
38
: wxNotifyEvent( commandType, winid )
42
guRatingEvent( const guRatingEvent &clone )
43
: wxNotifyEvent( clone )
47
virtual wxEvent *Clone() const
49
return new guRatingEvent(*this);
53
typedef void (wxEvtHandler::*guRatingEventFunction)(guRatingEvent&);
55
#define guRatingEventHandler(func) \
56
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(guRatingEventFunction, &func)
59
#define guRATING_CHANGED_ID 1170
60
DECLARE_EVENT_TYPE( guEVT_RATING_CHANGED, guRATING_CHANGED_ID )
61
#define EVT_RATING_CHANGED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( guEVT_RATING_CHANGED, winid, wxID_ANY, wxRatingEventHandler(fn), (wxObject *) NULL ),
63
// -------------------------------------------------------------------------------- //
64
class guRating : public wxControl
69
wxBitmap * m_NormalStar;
70
wxBitmap * m_SelectStar;
75
virtual wxSize DoGetBestSize() const;
76
void OnPaint( wxPaintEvent &event );
77
void OnMouseEvents( wxMouseEvent &event );
80
guRating( wxWindow * parent, const int style );
82
void SetRating( const int rating );
83
int GetRating( void );
89
// -------------------------------------------------------------------------------- //