2
* Copyright 2011 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3, as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the applicable version of the GNU Lesser General Public
12
* License for more details.
14
* You should have received a copy of both the GNU Lesser General Public
15
* License version 3 along with this program. If not, see
16
* <http://www.gnu.org/licenses/>
18
* Authored by: Gordon Allott <gord.allott@canonical.com>
22
#ifndef UNITYSHELL_RATINGSBUTTONWIDGET_H
23
#define UNITYSHELL_RATINGSBUTTONWIDGET_H
28
#include <Nux/ToggleButton.h>
29
#include "unity-shared/Introspectable.h"
34
class RatingsButton : public unity::debug::Introspectable, public nux::ToggleButton
37
RatingsButton(int star_size, int star_gap, NUX_FILE_LINE_PROTO);
38
virtual ~RatingsButton();
40
void SetEditable(bool editable);
41
virtual void SetRating(float rating);
42
virtual float GetRating() const;
45
virtual void Draw(nux::GraphicsEngine& GfxContext, bool force_draw);
48
virtual bool AcceptKeyNavFocus();
49
virtual bool InspectKeyEvent(unsigned int eventType, unsigned int keysym, const char* character);
51
// Introspectable methods
52
std::string GetName() const;
53
void AddProperties(GVariantBuilder* builder);
56
void OnKeyDown(unsigned long event_type, unsigned long event_keysym,
57
unsigned long event_state, const TCHAR* character,
58
unsigned short key_repeat_count);
60
void RecvMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);
61
void RecvMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
62
void RecvMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
63
void UpdateRatingToMouse(int x);
76
#endif // UNITYSHELL_RATINGSBUTTONWIDGET_H